summaryrefslogtreecommitdiff
path: root/lisp/progmodes
diff options
context:
space:
mode:
authorJuri Linkov <juri@linkov.net>2021-12-06 19:24:09 +0200
committerJuri Linkov <juri@linkov.net>2021-12-06 19:24:09 +0200
commitda23e607d33260c9aabaa3d136722a45457930dc (patch)
tree0f55701c4e3f25a1ed8a82fe9f4983ec0821af85 /lisp/progmodes
parentd529207b0eb26b623fadf4716581add58f2cc282 (diff)
downloademacs-da23e607d33260c9aabaa3d136722a45457930dc.tar.gz
emacs-da23e607d33260c9aabaa3d136722a45457930dc.tar.bz2
emacs-da23e607d33260c9aabaa3d136722a45457930dc.zip
Select the right buffer for event in context-menu functions (bug#9923)
* lisp/mouse.el (context-menu-region): * lisp/progmodes/prog-mode.el (prog-context-menu): Switch to the buffer displayed by the window of the event before using syntax-ppss, char-after.
Diffstat (limited to 'lisp/progmodes')
-rw-r--r--lisp/progmodes/prog-mode.el4
1 files changed, 3 insertions, 1 deletions
diff --git a/lisp/progmodes/prog-mode.el b/lisp/progmodes/prog-mode.el
index 4997c2746f2..e43f2ff90b5 100644
--- a/lisp/progmodes/prog-mode.el
+++ b/lisp/progmodes/prog-mode.el
@@ -87,7 +87,9 @@
'mark-whole-buffer)
;; Include text-mode select menu only in strings and comments.
- (when (nth 8 (save-excursion (syntax-ppss (posn-point (event-end click)))))
+ (when (nth 8 (save-excursion
+ (with-current-buffer (window-buffer (posn-window (event-end click)))
+ (syntax-ppss (posn-point (event-end click))))))
(text-mode-context-menu menu click))
menu)