New answers tagged

2

To avoid side effects like moving the point (that is, the cursor), wrap your movement commands in save-excursion. Prior Emacs 25 this also saved the mark (the other end of the selected region). Now to save the mark as well use save-mark-and-excursion. First we need a function to select the whole line: (defun mark-whole-line () (beginning-of-line) (set-...


2

You want the whole-line-or-region package. With whole-line-or-region-local-mode activated, things like C-w and M-w Do The Right Thing on the current line when then is no active region.


Top 50 recent answers are included