Skip to content

Instantly share code, notes, and snippets.

@mskorzhinskiy
Created January 5, 2016 19:07
Show Gist options
  • Save mskorzhinskiy/d71d4fe7a0817a609880 to your computer and use it in GitHub Desktop.
Save mskorzhinskiy/d71d4fe7a0817a609880 to your computer and use it in GitHub Desktop.
Weird thing
;; Common use of third-party function looks like that:
(evilified-state-evilify-map
:mode some-emacs-mode
:bindings
(kdb "C-c a") 'function1
(kdb "C-c b") 'function2)
;; I want to declare function or macro that will produce such bindings
(defun producer (binding function)
(list (kdb (concat "C-c" binding)) 'function
(kdb (concat "C-x" binding)) 'function))
;; And then call it like that:
(evilified-state-evilify-map
:mode some-emacs-mode
:bindings
(producer "c" 'function))
;; To produce code like that
(evilified-state-evilify-map
:mode some-emacs-mode
:bindings
(kdb "C-c c") 'function
(kdb "C-x c") 'function)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment