I often want to quickly mark everything from point
to the end of line, leaving point
at the same place.
I tried to write simple function for that purpose:
(defun mark-from-point-to-end-of-line ()
"Marks everything from point to end of line"
(interactive)
(save-excursion
(progn
(set-mark-command nil)
(move-end-of-line nil)
(set-mark-command nil)
)))
However, it behaves not as expected, e.g. if you place point over m
in line (move-end-of-line nil)
and execute this command this will mark everything from beginning of buffer to point. I guess this is somehow related to save-excursion
function, but can't be certain. How should I fix that?
P.S. Sorry for question title, don't know how to name it better.