undo
(bound to C-/
, C-_
, and C-x u
by default) will restrict its action to the active region, if there is one:
In Transient Mark mode when the mark is active, only undo changes within
the current region. Similarly, when not in Transient Mark mode, just C-u
as an argument limits undo to changes within the current region.
(from C-h undo
)
That allows to you undo changes in any arbitrary contiguous block of text. Emacs includes mark-paragraph
out of the box, bound to M-h
by default. That means M-h C-/
(followed by as many repetitions of C-/
as you need) will progressively undo changes to the highlighted paragraph.
We don't have a mark-line
function by default. You can mark the line 'by-hand' with: C-a C-space C-e
, and then use C-/
(or C-x u
etc) to undo changes to just that line.
Moving to the beginning (C-a
) or end (C-e
) of the line, and setting the mark (C-space
) are things that you do so frequently in Emacs that after a while it just becomes part of your muscle memory. Meaning, I wouldn't gain much by wrapping this up in a special-purpose function. However, you certainly could do that, and you might want to use the mark-line
function from misc-cmds
that @Charles mentioned to do that.