summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorJuri Linkov <juri@linkov.net>2021-09-12 20:55:57 +0300
committerJuri Linkov <juri@linkov.net>2021-09-12 20:55:57 +0300
commitaa33e38e21e09045bc2ab598e34f3c1510442cb0 (patch)
treea01f74ca81b13f5e0f3c88ec3e4319febe76aa25 /lisp
parentbd917088e69e71e77c15069f0751096141ca3f1a (diff)
downloademacs-aa33e38e21e09045bc2ab598e34f3c1510442cb0.tar.gz
emacs-aa33e38e21e09045bc2ab598e34f3c1510442cb0.tar.bz2
emacs-aa33e38e21e09045bc2ab598e34f3c1510442cb0.zip
Allow region-related context menu to be used on selected region with one click
* lisp/mouse.el (mouse-drag-track): Don't deactivate the mark for the context menu invoked by down-mouse-3. https://lists.gnu.org/archive/html/emacs-devel/2021-08/msg01577.html
Diffstat (limited to 'lisp')
-rw-r--r--lisp/mouse.el11
1 files changed, 9 insertions, 2 deletions
diff --git a/lisp/mouse.el b/lisp/mouse.el
index bd11ec50d57..c107322815a 100644
--- a/lisp/mouse.el
+++ b/lisp/mouse.el
@@ -1583,8 +1583,15 @@ The region will be defined with mark and point."
t (lambda ()
(setq track-mouse old-track-mouse)
(setq auto-hscroll-mode auto-hscroll-mode-saved)
- (deactivate-mark)
- (pop-mark)))))
+ ;; Don't deactivate the mark when the context menu was invoked
+ ;; by down-mouse-3 immediately after down-mouse-1 and without
+ ;; releasing the mouse button with mouse-1. This allows to use
+ ;; region-related context menu to operate on the selected region.
+ (unless (and context-menu-mode
+ (eq (car-safe (aref (this-command-keys-vector) 0))
+ 'down-mouse-3))
+ (deactivate-mark)
+ (pop-mark))))))
(defun mouse--drag-set-mark-and-point (start click click-count)
(let* ((range (mouse-start-end start click click-count))