aggressive-indent-protected-commands does not appear to work
raxod502 opened this issue · 2 comments
This problem manifests itself in aggressive-indent
sometimes preventing me from undoing using undo-tree
(or indeed vanilla Emacs undo, but that drives me too crazy to deal with even momentarily).
To reproduce the problem, I start with emacs -Q
and load both undo-tree
and aggressive-indent
using Dired L
. Then I go into the *scratch*
buffer and type the following, with point represented by the |
:
(defun example-foo ()
| )
Then, I type a letter (say f
) and quickly press TAB
, before aggressive-indent
can act automatically. This is very important! The problem only reproduces if you indent manually, instead of letting aggressive-indent
do it for you.
Now my undo is broken, because the edit was made in two steps. Whenever I press C-/
, the indentation edit is undone, but aggressive-indent
immediately fixes the indentation (thus creating a new edit). And now we're back to where we started! So there is no way to undo anymore, unless you use undo-tree-visualize
or turn off aggressive-indent-mode
temporarily.
Here is my interpretation of the problem: on line 191 of aggressive-indent.el
, this-command
needs to be changed to last-command
. In my testing, this-command
is always nil
at that point in the code, whereas last-command
is the actual command that I typed (such as undo-tree-undo
). Making this change resolves the problem.
Thanks for the report and the fix! Indeed, I let this slide when I refactored things a bit.
This issue seems appearing again 👀