Somelauw / evil-org-mode

Supplemental evil-mode keybindings to emacs org-mode

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`evil-redirect-digit-argument` removed from evil

sballert opened this issue · comments

Hi, I get the following error message when I try to execute a command from org-mode:

evil-org--populate-base-bindings: Symbol’s function definition is void: evil-redirect-digit-argument

I think this issue results from the following evil mode change:

emacs-evil/evil#1519

This commit removes the evil-redirect-digit-argument function from evil.

As a quick solution I've deleted lines 635 and 636, recompiled the evil-org source and restarted Emacs. All is good again.

Yeah, apologies to evil-org users - I thought my PR would go through another round of cleanup by people more experienced with package development than me before it got merged, where we'd add a more idiomatic way of gracefully retiring a function. For those out of the loop though, evil-redirect-digit-argument was pretty broken: its use in evil-org caused any motion with a 0 in the count argument to fail, per #91. At least #93 is an obvious bug, and not an upstream one that causes your motions to fail silently and makes you comb through keypress parsers for a week!

@jmmathena Not to worry, things like that happen. Especially when there's so many packages that rely on each other as dependencies.
I don't know if anyone is actually maintaining evil-org. Last commit was a while back.

This code should fix this issue temporary

(fset 'evil-redirect-digit-argument 'ignore) ;; before evil-org loaded

(add-to-list 'evil-digit-bound-motions 'evil-org-beginning-of-line)
(evil-define-key 'motion 'evil-org-mode
    (kbd "0") 'evil-org-beginning-of-line)

Also, update: I'm nearly done with a PR for evil that will remove the evil-digit-bound-motions custom var added in my PR in favor of a more seamless strategy for handling motions bound to "0". If or when it's merged in, you'll just be able to treat the binding to "0" the same as any other keybinding; e.g. have

(defun evil-org--populate-base-bindings ()
  "Bindings that are always available."
  (evil-define-key 'motion 'evil-org-mode
    (kbd "0") 'evil-org-beginning-of-line
    (kbd "$") 'evil-org-end-of-line
. . . ;; Remainder of evil-org

This won't fix the issue with evil-org being broken by the removal of evil-redirect-digit-argument, but it does mean you won't have to futz around with a clunky custom variable.

I've been using this kludge to avoid the bug while the packages upstream are not fixed (only evil-iedit and evil-org use the function in my setup)

(when (not (boundp 'evil-redirect-digit-argument))
  (defmacro evil-redirect-digit-argument (map keys target)
     `(define-key ,map ,keys ,target)))

0 seems to behave as expected in iedit and org

Solved by #96