When I copy some selected text (kill-ring-save with M-w), I automatically lose my selection. I have tried with Transient Mark Mode with no luck. (Note that I'm not using CUA Mode.)
Asked
Active
Viewed 792 times
14
NVaughan
- 1,481
- 12
- 27
1 Answers
11
The best solution is using C-x C-x to reactivate the mark.
But if you want to really keep the selection you can use:
(defun copy-keep-highlight (beg end)
(interactive "r")
(prog1 (kill-ring-save beg end)
(setq deactivate-mark nil)))
djangoliv
- 3,199
- 16
- 32
-
1I'd suggest using a piece of advice like this :
(defun yf/no-deactivate-mark (&rest _) (setq deactivate-mark nil)) (advice-addadvice-add 'kill-ring-save :after #'yf/no-deactivate-mark)– YoungFrog Feb 01 '16 at 10:48 -
-
@YoungFrog, thanks, but your code doesn't work as its got a syntax error somewhere. – NVaughan Feb 02 '16 at 01:19
-
2Ah, copy paste error :
advice-addshould be there only once. I can't edit the comment. – YoungFrog Feb 02 '16 at 09:20 -
1@NVaughan here a good explanation: http://emacs.stackexchange.com/questions/5829/curiosity-what-does-progn-stands-for – djangoliv Feb 02 '16 at 11:10
-
select-active-regionswould be relevant), but it seems to be about highlighting the region. – YoungFrog Feb 01 '16 at 10:46