Skip to content

Instantly share code, notes, and snippets.

@mpontus
Created February 25, 2015 05:43
Show Gist options
  • Save mpontus/962ee0ab527460064c59 to your computer and use it in GitHub Desktop.
Save mpontus/962ee0ab527460064c59 to your computer and use it in GitHub Desktop.
(defun transient-map (keymap &optional pred onexit)
(defalias (-> ((user-error "It's an active map!")
(-contains? (current-active-maps))
(-compose 'symbol-value 'eq keymap)
(-andfn 'mapatoms 'boundp 'keymapp)
(-orfn (catch 'found) (cl-gens))))
(lambda (interactive "p") (keymap pred onexit)
(set-transient-map keymap pred onexit))))
(defun keymap-symbol (keymap)
(->> ((s-format "Keymap: %s" symbol-name)
(-compose 'symbol-value 'eq keymap)
(-andfn 'mapatoms 'boundp 'keymapp)
(-andfn (catch 'found) (message)))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment