>From a4c1b8029587ab82afd21db646ad0c0fd691252a Mon Sep 17 00:00:00 2001 From: Federico Tedin Date: Wed, 5 Feb 2020 21:22:18 +0100 Subject: [PATCH 1/1] Fix cursor-sensor--detect when current buf != selected window's buf * 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 | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lisp/emacs-lisp/cursor-sensor.el b/lisp/emacs-lisp/cursor-sensor.el index d8e8eeb16e..7728e78c47 100644 --- a/lisp/emacs-lisp/cursor-sensor.el +++ b/lisp/emacs-lisp/cursor-sensor.el @@ -146,9 +146,10 @@ cursor-sensor--detect ;; 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)) -- 2.17.1