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?


1 Answer 1


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).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.