emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 79113b5: Use window-point in event-start and event-end (bug#50256


From: Juri Linkov
Subject: master 79113b5: Use window-point in event-start and event-end (bug#50256)
Date: Sun, 12 Sep 2021 12:32:11 -0400 (EDT)

branch: master
commit 79113b5e4a7d69ec0fb3401b763292d91b54632e
Author: Juri Linkov <juri@linkov.net>
Commit: Juri Linkov <juri@linkov.net>

    Use window-point in event-start and event-end (bug#50256)
    
    * lisp/subr.el (event-start, event-end): Provide window-point
    as an arg for posn-at-point, and for the constructed list.
    
    * lisp/help-mode.el (help-mode-context-menu): Remove a kludge
    that checked if window-buffer is current-buffer.
---
 lisp/help-mode.el |  7 +------
 lisp/subr.el      | 12 ++++++++----
 2 files changed, 9 insertions(+), 10 deletions(-)

diff --git a/lisp/help-mode.el b/lisp/help-mode.el
index 08182b7..d224bdc 100644
--- a/lisp/help-mode.el
+++ b/lisp/help-mode.el
@@ -85,12 +85,7 @@
       (when (consp item)
         (define-key menu (vector (car item)) (cdr item)))))
 
-  (when (and
-         ;; First check if `help-fns--list-local-commands'
-         ;; used `where-is-internal' to call this function
-         ;; with wrong `last-input-event'.
-         (eq (current-buffer) (window-buffer (posn-window (event-start 
last-input-event))))
-         (mouse-posn-property (event-start last-input-event) 'mouse-face))
+  (when (mouse-posn-property (event-start last-input-event) 'mouse-face)
     (define-key menu [help-mode-push-button]
       '(menu-item "Follow Link" (lambda (event)
                                   (interactive "e")
diff --git a/lisp/subr.el b/lisp/subr.el
index 6ae6d24..be13fc0 100644
--- a/lisp/subr.el
+++ b/lisp/subr.el
@@ -1510,8 +1510,10 @@ nil or (STRING . POSITION)'.
 
 For more information, see Info node `(elisp)Click Events'."
   (if (consp event) (nth 1 event)
-    (or (posn-at-point)
-        (list (selected-window) (point) '(0 . 0) 0))))
+    ;; Use `window-point' for the case when the current buffer
+    ;; is temporarily switched to some other buffer (bug#50256)
+    (or (posn-at-point (window-point))
+        (list (selected-window) (window-point) '(0 . 0) 0))))
 
 (defun event-end (event)
   "Return the ending position of EVENT.
@@ -1519,8 +1521,10 @@ EVENT should be a click, drag, or key press event.
 
 See `event-start' for a description of the value returned."
   (if (consp event) (nth (if (consp (nth 2 event)) 2 1) event)
-    (or (posn-at-point)
-        (list (selected-window) (point) '(0 . 0) 0))))
+    ;; Use `window-point' for the case when the current buffer
+    ;; is temporarily switched to some other buffer (bug#50256)
+    (or (posn-at-point (window-point))
+        (list (selected-window) (window-point) '(0 . 0) 0))))
 
 (defsubst event-click-count (event)
   "Return the multi-click count of EVENT, a click or drag event.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]