Fix commandp errors on {local,}leader keys
General would read (function ...) forms unevaluated, as a list, rather than a function symbol.
This commit is contained in:
parent
af4ca974a3
commit
3b352143c0
|
@ -92,7 +92,7 @@ If any hook returns non-nil, all hooks after it are ignored.")
|
|||
(setq prefix def))
|
||||
(when prefix
|
||||
(setq key `(general--concat t ,prefix ,key)))
|
||||
(let* ((udef (doom-unquote def))
|
||||
(let* ((udef (cdr-safe (doom-unquote def)))
|
||||
(bdef (if (general--extended-def-p udef)
|
||||
(general--extract-def (general--normalize-extended-def udef))
|
||||
def)))
|
||||
|
@ -115,7 +115,9 @@ If any hook returns non-nil, all hooks after it are ignored.")
|
|||
"Define <leader> keys.
|
||||
|
||||
Uses `general-define-key' under the hood, but does not support :states,
|
||||
:wk-full-keys or :keymaps."
|
||||
:wk-full-keys or :keymaps. Use `map!' for a more convenient interface.
|
||||
|
||||
See `doom-leader-key' and `doom-leader-alt-key' to change the leader prefix."
|
||||
`(general-define-key
|
||||
:states nil
|
||||
:wk-full-keys nil
|
||||
|
@ -123,10 +125,17 @@ Uses `general-define-key' under the hood, but does not support :states,
|
|||
,@args))
|
||||
|
||||
(defmacro define-localleader-key! (&rest args)
|
||||
"Define <localleader> key.
|
||||
|
||||
Uses `general-define-key' under the hood, but does not support :major-modes,
|
||||
:states, :prefix or :non-normal-prefix. Use `map!' for a more convenient
|
||||
interface.
|
||||
|
||||
See `doom-localleader-key' and `doom-localleader-alt-key' to change the
|
||||
localleader prefix."
|
||||
(if (featurep 'evil)
|
||||
;; :non-normal-prefix doesn't apply to non-evil sessions (only evil's
|
||||
;; emacs state), so we must redefine `define-localleader-key!' to behave
|
||||
;; differently where evil is present.
|
||||
;; emacs state)
|
||||
`(general-define-key
|
||||
:states '(normal visual motion emacs)
|
||||
:major-modes t
|
||||
|
@ -324,7 +333,7 @@ For example, :nvi will map to (list 'normal 'visual 'insert). See
|
|||
(cond ((and (listp def)
|
||||
(keywordp (car-safe (setq unquoted (doom-unquote def)))))
|
||||
(setq def (list 'quote (plist-put unquoted :which-key desc))))
|
||||
((setq def (list 'quote
|
||||
((setq def (cons 'list
|
||||
(if (and (equal key "")
|
||||
(null def))
|
||||
`(:ignore t :which-key ,desc)
|
||||
|
|
Loading…
Reference in New Issue
Block a user