Created
May 3, 2010 12:24
-
-
Save ato/388039 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defun get-window-by-class (class) | |
"Return a window with the given class." | |
(first (filter-windows #'(lambda (w) (equal (window-class w) class))))) | |
(defun gimme (cmdline class) | |
"If a window matching CLASS is found switch to it, else launch cmdline." | |
(if class | |
(let ((wnd (get-window-by-class class))) | |
(if wnd | |
(display-window wnd) | |
(system cmdline))) | |
(system cmdline))) | |
(defun gimme-emacs () | |
(gimme "emacs &" "Emacs")) | |
(bind-keys global-keymap "W-e" gimme-emacs) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment