After a while playing with XMonad and Org-Mode in Emacs I wrote a function for XMonad to start a Note-File with Emacs in XMonad.
First of all I will have a prompt which shows me all the current org-files in a given directory and then I will select one of the shown files or create a new one.
The following function will produce this prompt and shows me alle available org-files in a given directory.
firingOrgPrompt :: FilePath -> X () firingOrgPrompt path = do files <- liftIO $ getDirectoryContents path inputPromptWithCompl defaultXP "Org" (mkComplFunFromList $ filterOrg files) ?+ (openOrgFile path) where openOrgFile p f = spawn (emacsClient ++ p ++ "/" ++ f) filterOrg f = filter (endswith ".org") f
After writing this function you will define some keyboard shortcuts in your xmonad.hs file.
myKeys = \c -> newKeys c `M.union` keys defaultConfig c newKeys (XConfig {modMask = modm}) = M.fromList $ [ ((modm, xK_n), firingOrgPrompt (wikiRootPath ++ "notes")) ]
After that you have to define the variable emacsClient and wikiRootPath. The variable emacsClient could alse be the function getEditor.
After reloading your XMonad you could hit M-n and you get a prompt where you could select one of those org-files.
Keine Kommentare:
Kommentar veröffentlichen