diff options
| author | Juri Linkov | 2025-09-16 19:48:43 +0300 |
|---|---|---|
| committer | Juri Linkov | 2025-09-16 19:48:43 +0300 |
| commit | bd194c9a572bae0e13468c8dbca63d5a64af192a (patch) | |
| tree | 2b7284a31e08f24884bd57291dd3fa7b4e393051 | |
| parent | e568f44b54f5d265d540eb72d116dcb64394e087 (diff) | |
| download | emacs-bd194c9a572bae0e13468c8dbca63d5a64af192a.tar.gz emacs-bd194c9a572bae0e13468c8dbca63d5a64af192a.zip | |
Context menu related fixes (bug#64980)
* etc/PROBLEMS: Suggest how to keep context menus open on Lucid.
* lisp/mouse.el (context-menu-mode-map): Bind [mouse-3] to
'ignore' instead of 'nil' to not fallback to the default binding.
(mouse--drag-start-event): Remove unused variable.
(mouse-undouble-last-event): Remove unused function.
| -rw-r--r-- | etc/PROBLEMS | 9 | ||||
| -rw-r--r-- | lisp/mouse.el | 25 |
2 files changed, 10 insertions, 24 deletions
diff --git a/etc/PROBLEMS b/etc/PROBLEMS index 5da83fefeb1..be023b3d5ce 100644 --- a/etc/PROBLEMS +++ b/etc/PROBLEMS | |||
| @@ -2012,6 +2012,15 @@ Very long popup menus cannot be shown in their entirety, and don't have | |||
| 2012 | a scroll bar to scroll them vertically. Lucid does not support this | 2012 | a scroll bar to scroll them vertically. Lucid does not support this |
| 2013 | feature. A workaround is to use other toolkits (GTK, LessTif, etc.). | 2013 | feature. A workaround is to use other toolkits (GTK, LessTif, etc.). |
| 2014 | 2014 | ||
| 2015 | *** In Emacs built with Lucid cannot keep context menus open. | ||
| 2016 | |||
| 2017 | After enabling context-menu-mode, when the menu is opened by | ||
| 2018 | <down-mouse-3>, it closes right away when the right mouse button | ||
| 2019 | is released. It's possible to keep the context menu open | ||
| 2020 | after releasing the mouse button by disabling XInput 2 support: | ||
| 2021 | |||
| 2022 | ./configure --with-x-toolkit=lucid --without-xinput2 | ||
| 2023 | |||
| 2015 | *** Emacs running under X Window System does not handle mouse clicks. | 2024 | *** Emacs running under X Window System does not handle mouse clicks. |
| 2016 | *** 'emacs -geometry 80x20' finds a file named '80x20'. | 2025 | *** 'emacs -geometry 80x20' finds a file named '80x20'. |
| 2017 | 2026 | ||
diff --git a/lisp/mouse.el b/lisp/mouse.el index 907a4883230..b8d46d8dbed 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el | |||
| @@ -687,7 +687,7 @@ Some context functions add menu items below the separator." | |||
| 687 | 687 | ||
| 688 | (defvar context-menu-mode-map | 688 | (defvar context-menu-mode-map |
| 689 | (let ((map (make-sparse-keymap))) | 689 | (let ((map (make-sparse-keymap))) |
| 690 | (define-key map [mouse-3] nil) | 690 | (define-key map [mouse-3] #'ignore) |
| 691 | (define-key map [down-mouse-3] context-menu-entry) | 691 | (define-key map [down-mouse-3] context-menu-entry) |
| 692 | (define-key map [menu] #'context-menu-open) | 692 | (define-key map [menu] #'context-menu-open) |
| 693 | (if (featurep 'w32) | 693 | (if (featurep 'w32) |
| @@ -1520,8 +1520,6 @@ point determined by `mouse-select-region-move-to-beginning'." | |||
| 1520 | (eq mouse-last-region-end (region-end)) | 1520 | (eq mouse-last-region-end (region-end)) |
| 1521 | (eq mouse-last-region-tick (buffer-modified-tick)))) | 1521 | (eq mouse-last-region-tick (buffer-modified-tick)))) |
| 1522 | 1522 | ||
| 1523 | (defvar mouse--drag-start-event nil) | ||
| 1524 | |||
| 1525 | (defun mouse-set-region (click) | 1523 | (defun mouse-set-region (click) |
| 1526 | "Set the region to the text dragged over, and copy to kill ring. | 1524 | "Set the region to the text dragged over, and copy to kill ring. |
| 1527 | This should be bound to a mouse drag event. | 1525 | This should be bound to a mouse drag event. |
| @@ -2064,27 +2062,6 @@ If MODE is 2 then do the same for lines." | |||
| 2064 | (if (numberp (posn-point posn)) | 2062 | (if (numberp (posn-point posn)) |
| 2065 | (push-mark (posn-point posn) t t)))) | 2063 | (push-mark (posn-point posn) t t)))) |
| 2066 | 2064 | ||
| 2067 | (defun mouse-undouble-last-event (events) | ||
| 2068 | (let* ((index (1- (length events))) | ||
| 2069 | (last (nthcdr index events)) | ||
| 2070 | (event (car last)) | ||
| 2071 | (basic (event-basic-type event)) | ||
| 2072 | (old-modifiers (event-modifiers event)) | ||
| 2073 | (modifiers (delq 'double (delq 'triple (copy-sequence old-modifiers)))) | ||
| 2074 | (new | ||
| 2075 | (if (consp event) | ||
| 2076 | ;; Use reverse, not nreverse, since event-modifiers | ||
| 2077 | ;; does not copy the list it returns. | ||
| 2078 | (cons (event-convert-list (reverse (cons basic modifiers))) | ||
| 2079 | (cdr event)) | ||
| 2080 | event))) | ||
| 2081 | (setcar last new) | ||
| 2082 | (if (and (not (equal modifiers old-modifiers)) | ||
| 2083 | (key-binding (apply #'vector events))) | ||
| 2084 | t | ||
| 2085 | (setcar last event) | ||
| 2086 | nil))) | ||
| 2087 | |||
| 2088 | ;; Momentarily show where the mark is, if highlighting doesn't show it. | 2065 | ;; Momentarily show where the mark is, if highlighting doesn't show it. |
| 2089 | 2066 | ||
| 2090 | (defun mouse-set-mark (click) | 2067 | (defun mouse-set-mark (click) |