Posts mit dem Label Haskell werden angezeigt. Alle Posts anzeigen
Posts mit dem Label Haskell werden angezeigt. Alle Posts anzeigen

Freitag, August 10, 2012

XMonad and Org-Mode

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.

Dienstag, November 29, 2011

Zurück zu XMonad

Nach längerer Zeit mit verschiedenen Window-Managern bin ich jetzt wieder zurück zu XMonad gekommen. Da ich beruflich viel mit Haskell viel zu tun haben liegt dieser Window-Manager nahe um sich auch ein wenig mit der Sprache zu beschäftigen.

XMonad ist ein Tiling-Window-Manager der, wie schon oben erwähnt, in Haskell implementiert wurde. Der Vorteil von XMonad ist es das man den Window-Manager komplett in Haskell konfigurieren kann.

Ein Tiling-Window-Manager bringt den Vorteil, das die Fenster am Bildschirm automatisch angeordnet werden, wobei immer der optimale Platz dafür verwendet wird. Diese Window-Manager sind vor allem für jene Leute gedacht die sehr viel mit der Tastatur arbeiten und arbeiten möchten.