0

Usually when doing the normal undo it will undo all code changes since you went into insert-mode (for me it's evil-undo). I was wondering if it were possible to implement a function that will only undo the line your cursor is currently hovering over in elisp, if so pointers to the necessary information as a resource would be invaluable..

If not I was wondering why as the undo redo logs must be accessible?

Drew
  • 75,699
  • 9
  • 109
  • 225
  • 1
    Maybe you can find a good answer here: https://emacs.stackexchange.com/questions/32244/undo-region-spacemacs (of course selecting a line is just `S-v`) – dalanicolai Sep 05 '22 at 21:09
  • https://emacs.stackexchange.com/tags/elisp/info – Drew Sep 06 '22 at 02:26
  • https://evil.readthedocs.io/en/latest/settings.html#elispobj-evil-want-fine-undo – nega Sep 06 '22 at 19:23

1 Answers1

0

See C-hig (emacs)Undo:

When there is an active region, any use of undo performs selective undo: it undoes the most recent change within the region, instead of the entire buffer. However, when Transient Mark mode is off (see Disabling Transient Mark Mode), C-/ always operates on the entire buffer, ignoring the region. In this case, you can perform selective undo by supplying a prefix argument to the undo command: C-u C-/. To undo further changes in the same region, repeat the undo command (no prefix argument is needed).

https://www.gnu.org/software/emacs/manual/html_node/emacs/Undo.html

phils
  • 48,657
  • 3
  • 76
  • 115