mirror of
https://github.com/masscollaborationlabs/emacs.git
synced 2025-07-14 16:02:12 +00:00
Change use-package to use bind-keys and bind-keys*
Fixes https://github.com/jwiegley/use-package/issues/129
This commit is contained in:
parent
012c37d722
commit
8c00f108bf
2 changed files with 28 additions and 31 deletions
|
@ -191,32 +191,35 @@ function symbol (unquoted)."
|
|||
(pop args)
|
||||
(pop args))
|
||||
args)))
|
||||
(when (or (and prefix-map
|
||||
(not prefix))
|
||||
(and prefix
|
||||
(not prefix-map)))
|
||||
(when (or (and prefix-map (not prefix))
|
||||
(and prefix (not prefix-map)))
|
||||
(error "Both :prefix-map and :prefix must be supplied"))
|
||||
(when (and menu-name (not prefix))
|
||||
(error "If :menu-name is supplied, :prefix must be too"))
|
||||
`(progn
|
||||
,@(when prefix-map
|
||||
(macroexp-progn
|
||||
(append
|
||||
(when prefix-map
|
||||
`((defvar ,prefix-map)
|
||||
,@(when doc `((put ',prefix-map 'variable-documentation ,doc)))
|
||||
,@(if menu-name
|
||||
`((define-prefix-command ',prefix-map nil ,menu-name))
|
||||
`((define-prefix-command ',prefix-map)))
|
||||
,@(mapcar
|
||||
,@(if maps
|
||||
(mapcar
|
||||
#'(lambda (m)
|
||||
`(bind-key ,prefix ',prefix-map ,m)) maps)))
|
||||
,@(apply
|
||||
`(bind-key ,prefix ',prefix-map ,m)) maps)
|
||||
`((bind-key ,prefix ',prefix-map)))))
|
||||
(apply
|
||||
#'nconc
|
||||
(mapcar (lambda (form)
|
||||
(if prefix-map
|
||||
`((bind-key ,(car form) ',(cdr form) ,prefix-map))
|
||||
(if maps
|
||||
(mapcar
|
||||
#'(lambda (m)
|
||||
`(bind-key ,(car form) ',(cdr form) ,m)) maps)))
|
||||
key-bindings)))))
|
||||
`(bind-key ,(car form) ',(cdr form) ,m)) maps)
|
||||
`((bind-key ,(car form) ',(cdr form))))))
|
||||
key-bindings))))))
|
||||
|
||||
(defmacro bind-keys* (&rest args)
|
||||
`(bind-keys :map override-global-map ,@args))
|
||||
|
|
|
@ -633,19 +633,13 @@ manually updated package."
|
|||
|
||||
(defun use-package-handler/:bind
|
||||
(name-symbol keyword arg rest state &optional override)
|
||||
(let* (commands
|
||||
(form (mapcar
|
||||
#'(lambda (binding)
|
||||
(push (cdr binding) commands)
|
||||
`(,(if override
|
||||
'bind-key*
|
||||
'bind-key) ,(car binding) #',(cdr binding))) arg)))
|
||||
(let ((commands (mapcar #'cdr arg)))
|
||||
(use-package-concat
|
||||
(use-package-process-keywords name-symbol
|
||||
(use-package-sort-keywords
|
||||
(use-package-plist-maybe-put rest :defer t))
|
||||
(use-package-plist-append state :commands commands))
|
||||
`((ignore ,@form)))))
|
||||
`((ignore (,(if override 'bind-keys* 'bind-keys) ,@arg))))))
|
||||
|
||||
(defun use-package-handler/:bind* (name-symbol keyword arg rest state)
|
||||
(use-package-handler/:bind name-symbol keyword arg rest state t))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue