Keymap for Launching External Applications and Websites
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.
(defmacrorun(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-keylauncher-map"m"(run"Mathematica"))(define-keylauncher-map"k"(run"keepass"))(define-keylauncher-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.
(defmacrobrowse(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-keylauncher-map"t"(browse"http://twitter.com/"))(define-keylauncher-map"?";; See also SX.el.(browse"http://emacs.stackexchange.com/"))(define-keylauncher-map"r"(browse"http://www.reddit.com/r/emacs/"))(define-keylauncher-map"w"(browse"http://www.emacswiki.org/"))(define-keylauncher-map"+"(browse"https://plus.google.com/communities/114815898697665598016"))
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.