branch: elpa/evil commit 040210af0b3c9000ff9e552855322a1d35cebcf3 Author: jmmathena <46335614+jmmath...@users.noreply.github.com> Commit: GitHub <nore...@github.com>
Fix #1518: "custom functions bound to '0' break motion parsing" in a saner way (#1534) * Try just comparing to '0' * Remove cruft and clean things up * Remove magic number --- evil-common.el | 11 ++++++----- evil-integration.el | 1 - evil-vars.el | 9 --------- 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/evil-common.el b/evil-common.el index 70204af..ddb26e1 100644 --- a/evil-common.el +++ b/evil-common.el @@ -555,7 +555,7 @@ Both COUNT and CMD may be nil." (list (car cmd) (* (or count 1) (or (cadr cmd) 1)))))))) ((or (eq cmd #'digit-argument) - (and (memq cmd evil-digit-bound-motions) + (and (equal seq "0") count)) (let* ((event (aref seq (- (length seq) 1))) (char (or (when (characterp event) event) @@ -710,10 +710,11 @@ recursively." (end 1) (found-prefix nil)) (while (and (<= end len)) - (let ((cmd (key-binding (substring keys beg end)))) + (let* ((seq (substring keys beg end)) + (cmd (key-binding seq))) (cond ((memq cmd '(undefined nil)) - (user-error "No command bound to %s" (substring keys beg end))) + (user-error "No command bound to %s" seq)) ((arrayp cmd) ; keyboard macro, replace command with macro (setq keys (vconcat (substring keys 0 beg) cmd @@ -723,7 +724,7 @@ recursively." ((functionp cmd) (if (or (memq cmd '(digit-argument negative-argument)) (and found-prefix - (memq cmd evil-digit-bound-motions))) + (equal (vconcat seq) (vector ?0)))) ;; skip those commands (setq found-prefix t ; found at least one prefix argument beg end @@ -734,7 +735,7 @@ recursively." (string-to-number (concat (substring keys 0 beg)))) cmd - (substring keys beg end) + seq (when (< end len) (substring keys end)))))) (t ; append a further event diff --git a/evil-integration.el b/evil-integration.el index 4cc2e65..9450c22 100644 --- a/evil-integration.el +++ b/evil-integration.el @@ -476,7 +476,6 @@ Based on `evil-enclose-ace-jump-for-motion'." ;; visual-line-mode integration (when evil-respect-visual-line-mode - (customize-set-variable 'evil-digit-bound-motions '(evil-beginning-of-visual-line)) (evil-define-minor-mode-key 'motion 'visual-line-mode "j" 'evil-next-visual-line "gj" 'evil-next-line diff --git a/evil-vars.el b/evil-vars.el index b87814b..5e2cb93 100644 --- a/evil-vars.el +++ b/evil-vars.el @@ -611,15 +611,6 @@ in insert state." :type 'boolean :group 'evil) -(defcustom evil-digit-bound-motions - '(evil-beginning-of-line) - "The motion commands that can be bound to some digit key (typically 0). -While Evil is reading a motion command, functions in this list act as themselves -if their corresponding key was the first digit in the key sequence, and behave -like `digit-argument' for the purposes of `evil-keypress-parser' otherwise." - :type '(repeat function) - :group 'evil) - (defvar dabbrev-search-these-buffers-only) (defvar dabbrev-case-distinction) (defcustom evil-complete-next-func