Created
March 1, 2018 13:17
-
-
Save shrdlu68/19e979b8b63be290e4d1b3116ea6c899 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;; Make multiple binding with a common prefix | |
(in-package :next) | |
(defmacro defhydra (name prefix &body suffixes) | |
`(progn | |
(defun ,name () | |
(with-result (suffix (read-from-minibuffer | |
(mode *minibuffer*))) | |
(cond ,@(map 'list (lambda (arg) | |
(list (list 'equal 'suffix (first arg)) | |
(list (second arg)))) | |
suffixes)))) | |
(define-key *global-map* ,prefix #',name))) | |
(defhydra switch-buffer (kbd "s") | |
("p" switch-buffer-previous) | |
("n" switch-buffer-next)) | |
(defhydra load-url (kbd "c") | |
("l" set-url-current-buffer) | |
("L" set-url-new-buffer)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment