Skip to content

Instantly share code, notes, and snippets.

@michalmarczyk
Forked from ato/sawfishstuff.el
Created May 3, 2010 12:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save michalmarczyk/388042 to your computer and use it in GitHub Desktop.
Save michalmarczyk/388042 to your computer and use it in GitHub Desktop.
(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