Skip to content

Commit

Permalink
Fix bug in advice around define-key
Browse files Browse the repository at this point in the history
define-key takes an optional 4th argument REMOVE, which this :around
advice causes to be dropped completely.
  • Loading branch information
yuhan0 authored and noctuid committed Apr 10, 2024
1 parent ced143c commit 826bf2b
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions general.el
Original file line number Diff line number Diff line change
Expand Up @@ -2253,7 +2253,7 @@ with `general-translate-key') and optionally keyword arguments for
`(general-translate-key ,states ,keymaps ,@args))

;; ** Automatic Key Unbinding
(defun general-unbind-non-prefix-key (define-key keymap key def &rest _)
(defun general-unbind-non-prefix-key (define-key keymap key &rest args)
"Use DEFINE-KEY in KEYMAP to unbind an existing non-prefix subsequence of KEY.
When a general key definer is in use and a subsequnece of KEY is already bound
in KEYMAP, unbind it using DEFINE-KEY. Always bind KEY to DEF using DEFINE-KEY."
Expand All @@ -2264,7 +2264,7 @@ in KEYMAP, unbind it using DEFINE-KEY. Always bind KEY to DEF using DEFINE-KEY."
(while (numberp (lookup-key keymap key))
(setq key (cl-subseq key 0 -1)))
(funcall define-key keymap key nil)))
(funcall define-key keymap key def))
(apply define-key keymap key args))

;;;###autoload
(defun general-auto-unbind-keys (&optional undo)
Expand Down

0 comments on commit 826bf2b

Please sign in to comment.