Skip to main content
Share Your Experience: Take the 2024 Developer Survey
5 votes
Accepted

How to leave mark region highlighted when switching windows

highlight-nonselected-windows is a variable defined in xdisp.c. Its default value is nil. A non-nil value means highlight region even in nonselected windows. You can customize this variable, e.g.: ...
lawlist's user avatar
  • 19.2k
2 votes

click highlights areas of the buffer when the click is away from the cursor position

If you’re clicking with the right mouse button (aka mouse3), then this is the default behavior. See chapter 22.1 Mouse Commands for Editing in the Emacs manual, where it says: ‘mouse-3’ If the ...
db48x's user avatar
  • 18.2k
2 votes
Accepted

Strange behaviour using C-<spc> to select multiple lines - first line is skipped if it starts with whitespace

Things work a bit differently in Emacs. Selections are always defined by the mark, and the current position of the point (i.e. the cursor). You can't select a line explicitly, you select the region ...
Tyler's user avatar
  • 22.3k
2 votes

How to save the text selection and keep the selection highlight

The following is based on Tobias's answer but use Advising instead: (define-advice kill-ring-save (:around (old-fun &rest args) highlight) "Save the text selection and keep the selection ...
xuchunyang's user avatar
  • 14.6k
2 votes
Accepted

How to save the text selection and keep the selection highlight

The function kill-ring-save-keep-selection defined in the following emacs-lisp snippet works like kill-ring-save but keeps the selection. I've bound it to M-W in contrast to M-w for kill-ring-save. (...
Tobias's user avatar
  • 33.2k
1 vote
Accepted

Region does not get deselected on move commands using `push-mark` from Elisp

You need to set variable transient-mark-mode to a special value: a cons with only as its car: (defun sandric/select-symbol-under-cursor () "Select symbol under cursor." (interactive) (unless (...
Drew's user avatar
  • 77.9k
1 vote
Accepted

Buffer local transient-mark-mode?

Barely tested, but try this: (transient-mark-mode 0) (define-minor-mode local-transient-mark-mode "Toggle `transient-mark-mode' (see which) for the current buffer." :variable transient-mark-mode)...
phils's user avatar
  • 51.5k
1 vote
Accepted

Make region transient in elisp function

Base on the implementation of the function handle-shift-selection, you can try something like this (defun isearch-exit-mark-match () "Exit isearch and mark the current match." (interactive) (...
xuchunyang's user avatar
  • 14.6k
1 vote

Since upgrading to emacs 26.1 C-SPC behaviour changed and I have to press it twice to set-mark

This is sort of embarassing. At the same time of the emacs upgrade to 26, I also installed an alternate desktop notification engine (dunst, which I need because at work I use i3wm). On receiveing ...
Alien Life Form's user avatar

Only top scored, non community-wiki answers of a minimum length are eligible