The launcher-map wouldn't be half of what it is if not for the run macro. With it, we can easily turn Emacs into a quick 'n dirty app launcher.
run
(defmacro run (exec) "Return a named function that runs EXEC." (let ((func-name (intern (concat "endless/run-" exec)))) `(progn (defun ,func-name () ,(format "Run the %s executable." exec) (interactive) (start-process "" nil ,exec)) #',func-name))) (define-key launcher-map "m" (run "Mathematica")) (define-key launcher-map "k" (run "keepass")) (define-key launcher-map "v" (run "steam")) ; Vapor =P
We could use a lambda instead of the macro, but the macro defines a nicely documented function.
While we're at it, let's do something similar for websites.
(defmacro browse (url) "Return a named function that calls `browse-url' on URL." (let ((func-name (intern (concat "endless/browse-" url)))) `(progn (defun ,func-name () ,(format "Browse to the url %s." url) (interactive) (browse-url ,url)) #',func-name))) (define-key launcher-map "t" (browse "http://twitter.com/")) (define-key launcher-map "?" ;; See also SX.el. (browse "http://emacs.stackexchange.com/")) (define-key launcher-map "r" (browse "http://www.reddit.com/r/emacs/")) (define-key launcher-map "w" (browse "http://www.emacswiki.org/")) (define-key launcher-map "+" (browse "https://plus.google.com/communities/114815898697665598016"))
Tags: keymap, intuitive, keybind, init.el, emacs,
Keymap for Launching External Applications and Websites
05 Oct 2014, by Artur Malabarba.Mnemonic Keymaps post series
The launcher-map wouldn't be half of what it is if not for the
run
macro. With it, we can easily turn Emacs into a quick 'n dirty app launcher.We could use a lambda instead of the macro, but the macro defines a nicely documented function.
While we're at it, let's do something similar for websites.
Tags: keymap, intuitive, keybind, init.el, emacs,
And the Beta goes Public »
« Longlines mode in LaTeX
Related Posts
A few paredit keys that take over the world in keybind
Fill and unfill paragraphs with a single key in keybind
Disable Mouse only inside Emacs in keybind
Content © 2019, All rights reserved. Icons under CC3.0.