]> git.eshelyaron.com Git - emacs.git/commitdiff
Fix cursor-sensor--detect when current buf != selected window's buf
authorFederico Tedin <federicotedin@gmail.com>
Mon, 17 Feb 2020 20:58:43 +0000 (21:58 +0100)
committerEli Zaretskii <eliz@gnu.org>
Fri, 21 Feb 2020 09:11:05 +0000 (11:11 +0200)
* lisp/emacs-lisp/cursor-sensor.el (cursor-sensor--detect): Avoid
trying to read text properties from position taken from another
buffer.  (Bug#38740)

lisp/emacs-lisp/cursor-sensor.el

index d8e8eeb16efa52091338a945339b7fd644ccac16..7728e78c4715d1cc000b599cb147de0f6a79d60b 100644 (file)
@@ -146,9 +146,10 @@ By convention, this is a list of symbols where each symbol stands for the
            ;; It's often desirable to make the cursor-sensor-functions property
            ;; non-sticky on both ends, but that means get-pos-property might
            ;; never see it.
-           (new (or (get-char-property point 'cursor-sensor-functions)
-                    (unless (<= (point-min) point)
-                      (get-char-property (1- point) 'cursor-sensor-functions))))
+           (new (and (eq (current-buffer) (window-buffer))
+                     (or (get-char-property point 'cursor-sensor-functions)
+                         (unless (<= (point-min) point)
+                           (get-char-property (1- point) 'cursor-sensor-functions)))))
            (old (window-parameter window 'cursor-sensor--last-state))
            (oldposmark (car old))
            (oldpos (or (if oldposmark (marker-position oldposmark))