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
1 changed files with 14 additions and 5 deletions
|
@ -92,7 +92,7 @@ If any hook returns non-nil, all hooks after it are ignored.")
|
||||||
(setq prefix def))
|
(setq prefix def))
|
||||||
(when prefix
|
(when prefix
|
||||||
(setq key `(general--concat t ,prefix ,key)))
|
(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)
|
(bdef (if (general--extended-def-p udef)
|
||||||
(general--extract-def (general--normalize-extended-def udef))
|
(general--extract-def (general--normalize-extended-def udef))
|
||||||
def)))
|
def)))
|
||||||
|
@ -115,7 +115,9 @@ If any hook returns non-nil, all hooks after it are ignored.")
|
||||||
"Define <leader> keys.
|
"Define <leader> keys.
|
||||||
|
|
||||||
Uses `general-define-key' under the hood, but does not support :states,
|
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
|
`(general-define-key
|
||||||
:states nil
|
:states nil
|
||||||
:wk-full-keys nil
|
:wk-full-keys nil
|
||||||
|
@ -123,10 +125,17 @@ Uses `general-define-key' under the hood, but does not support :states,
|
||||||
,@args))
|
,@args))
|
||||||
|
|
||||||
(defmacro define-localleader-key! (&rest 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)
|
(if (featurep 'evil)
|
||||||
;; :non-normal-prefix doesn't apply to non-evil sessions (only evil's
|
;; :non-normal-prefix doesn't apply to non-evil sessions (only evil's
|
||||||
;; emacs state), so we must redefine `define-localleader-key!' to behave
|
;; emacs state)
|
||||||
;; differently where evil is present.
|
|
||||||
`(general-define-key
|
`(general-define-key
|
||||||
:states '(normal visual motion emacs)
|
:states '(normal visual motion emacs)
|
||||||
:major-modes t
|
:major-modes t
|
||||||
|
@ -324,7 +333,7 @@ For example, :nvi will map to (list 'normal 'visual 'insert). See
|
||||||
(cond ((and (listp def)
|
(cond ((and (listp def)
|
||||||
(keywordp (car-safe (setq unquoted (doom-unquote def)))))
|
(keywordp (car-safe (setq unquoted (doom-unquote def)))))
|
||||||
(setq def (list 'quote (plist-put unquoted :which-key desc))))
|
(setq def (list 'quote (plist-put unquoted :which-key desc))))
|
||||||
((setq def (list 'quote
|
((setq def (cons 'list
|
||||||
(if (and (equal key "")
|
(if (and (equal key "")
|
||||||
(null def))
|
(null def))
|
||||||
`(:ignore t :which-key ,desc)
|
`(:ignore t :which-key ,desc)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue