Archive for June, 2007

XMonad does things just right

Posted: June 24, 2007 in XMonad

Two weeks ago I became aware of all the buzz about XMonad and so I tried it. With its default settings it’s pretty much like dwm, but there’s a XMonadContrib module that includes a whole bunch of additional layout algorithms which might be useful in one or the other situation.

XMonad is configured by editing a haskell source file named Config.hs and recompiling. It’s not like in lisp that you can edit the source and evaluate your changes without restart, but XMonad can be restarted with M-q without losing window or workspace informations.

The time I tried it out there was a xmonad-darcs ebuild in the gentoo-haskell overlay, but that didn’t have support for user configurations. Gentoo provides a mechanism for that, so extended the ebuild with that functionality. If you set USE=savedconfig for it, then the file /etc/portage/savedconfig/x11-wm/xmonad-darcs-0 will be used as Config.hs for compilation.

Another addition I made was that the ebuild fetches and uses the contrib modules if you set USE=extensions for it.

Both enhancements are now in the x11-wm/xmonad-darcs ebuild available in the gentoo-haskell overlay. (You can add the overlay with layman -a haskell and update it with layman -S, which will update all installed overlays. After that use the normal emerge command.)

My Config.hs can be gotten from my homepage, section Configs.

Advertisements

Zapping to strings and regexps

Posted: June 22, 2007 in Emacs

Here’re two functions which are similar to zap-to-char, but zap to a given string or regular expression.

(defun th-zap-to-string (arg str)
  "Same as `zap-to-char' except that it zaps to the given string
instead of a char."
  (interactive "p\\nsZap to string: ")
  (kill-region (point) (progn
                         (search-forward str nil nil arg)
                         (point))))

(defun th-zap-to-regexp (arg regexp)
  "Same as `zap-to-char' except that it zaps to the given regexp
instead of a char."
  (interactive "p\\nsZap to regexp: ")
  (kill-region (point) (progn
                         (re-search-forward regexp nil nil arg)
                         (point))))

Since I like zapping to strings and regexps more than zapping to chars, I bound them globally to M-z and M-Z, zap-to-char can be accessed with C-M-z.

(global-set-key (kbd "M-z")   'th-zap-to-string)
(global-set-key (kbd "M-Z")   'th-zap-to-regexp)
(global-set-key (kbd "C-M-z") 'zap-to-char)