diff options
| author | Stefan Kangas | 2021-12-07 06:47:32 +0100 |
|---|---|---|
| committer | Stefan Kangas | 2021-12-07 06:47:32 +0100 |
| commit | abf06a46b490be49f12f5509817cbb400c78bc6e (patch) | |
| tree | fb1cb7da95a39ae2c92cc3f286a3ee153cc9e5b3 | |
| parent | bdcf3c3504566fd61c42b06ee41cae5c074c3c03 (diff) | |
| parent | da23e607d33260c9aabaa3d136722a45457930dc (diff) | |
| download | emacs-abf06a46b490be49f12f5509817cbb400c78bc6e.tar.gz emacs-abf06a46b490be49f12f5509817cbb400c78bc6e.zip | |
Merge from origin/emacs-28
da23e607d3 Select the right buffer for event in context-menu function...
| -rw-r--r-- | lisp/mouse.el | 17 | ||||
| -rw-r--r-- | lisp/progmodes/prog-mode.el | 4 |
2 files changed, 12 insertions, 9 deletions
diff --git a/lisp/mouse.el b/lisp/mouse.el index af1eca12f45..459cce4cd97 100644 --- a/lisp/mouse.el +++ b/lisp/mouse.el | |||
| @@ -489,14 +489,15 @@ Some context functions add menu items below the separator." | |||
| 489 | `(menu-item "All" | 489 | `(menu-item "All" |
| 490 | ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'buffer)) | 490 | ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'buffer)) |
| 491 | :help "Mark the whole buffer for a subsequent cut/copy")) | 491 | :help "Mark the whole buffer for a subsequent cut/copy")) |
| 492 | (when (let* ((pos (posn-point (event-end click))) | 492 | (with-current-buffer (window-buffer (posn-window (event-end click))) |
| 493 | (char (when pos (char-after pos)))) | 493 | (when (let* ((pos (posn-point (event-end click))) |
| 494 | (or (and char (eq (char-syntax char) ?\")) | 494 | (char (when pos (char-after pos)))) |
| 495 | (nth 3 (save-excursion (syntax-ppss pos))))) | 495 | (or (and char (eq (char-syntax char) ?\")) |
| 496 | (define-key-after submenu [mark-string] | 496 | (nth 3 (save-excursion (syntax-ppss pos))))) |
| 497 | `(menu-item "String" | 497 | (define-key-after submenu [mark-string] |
| 498 | ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'string)) | 498 | `(menu-item "String" |
| 499 | :help "Mark the string at click for a subsequent cut/copy"))) | 499 | ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'string)) |
| 500 | :help "Mark the string at click for a subsequent cut/copy")))) | ||
| 500 | (define-key-after submenu [mark-line] | 501 | (define-key-after submenu [mark-line] |
| 501 | `(menu-item "Line" | 502 | `(menu-item "Line" |
| 502 | ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'line)) | 503 | ,(lambda (e) (interactive "e") (mark-thing-at-mouse e 'line)) |
diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el index 30b6edf0d9d..496b0810183 100644 --- a/lisp/progmodes/prog-mode.el +++ b/lisp/progmodes/prog-mode.el | |||
| @@ -93,7 +93,9 @@ | |||
| 93 | 'mark-whole-buffer) | 93 | 'mark-whole-buffer) |
| 94 | 94 | ||
| 95 | ;; Include text-mode select menu only in strings and comments. | 95 | ;; Include text-mode select menu only in strings and comments. |
| 96 | (when (nth 8 (save-excursion (syntax-ppss (posn-point (event-end click))))) | 96 | (when (nth 8 (save-excursion |
| 97 | (with-current-buffer (window-buffer (posn-window (event-end click))) | ||
| 98 | (syntax-ppss (posn-point (event-end click)))))) | ||
| 97 | (text-mode-context-menu menu click)) | 99 | (text-mode-context-menu menu click)) |
| 98 | 100 | ||
| 99 | menu) | 101 | menu) |