* lisp/emacs-lisp/cursor-sensor.el (cursor-sensor--detect): Change last fix
Make sure we always work in the selected-window's buffer.
This commit is contained in:
parent
3bce7ec382
commit
e74fb4688b
1 changed files with 56 additions and 54 deletions
|
@ -141,15 +141,17 @@ By convention, this is a list of symbols where each symbol stands for the
|
||||||
;;; Detect cursor movement.
|
;;; Detect cursor movement.
|
||||||
|
|
||||||
(defun cursor-sensor--detect (&optional window)
|
(defun cursor-sensor--detect (&optional window)
|
||||||
|
(with-current-buffer (window-buffer window)
|
||||||
(unless cursor-sensor-inhibit
|
(unless cursor-sensor-inhibit
|
||||||
(let* ((point (window-point window))
|
(let* ((point (window-point window))
|
||||||
;; It's often desirable to make the cursor-sensor-functions property
|
;; It's often desirable to make the
|
||||||
;; non-sticky on both ends, but that means get-pos-property might
|
;; cursor-sensor-functions property non-sticky on both
|
||||||
;; never see it.
|
;; ends, but that means get-pos-property might never
|
||||||
(new (and (eq (current-buffer) (window-buffer))
|
;; see it.
|
||||||
(or (get-char-property point 'cursor-sensor-functions)
|
(new (or (get-char-property point 'cursor-sensor-functions)
|
||||||
(unless (<= (point-min) point)
|
(unless (<= (point-min) point)
|
||||||
(get-char-property (1- point) 'cursor-sensor-functions)))))
|
(get-char-property (1- point)
|
||||||
|
'cursor-sensor-functions))))
|
||||||
(old (window-parameter window 'cursor-sensor--last-state))
|
(old (window-parameter window 'cursor-sensor--last-state))
|
||||||
(oldposmark (car old))
|
(oldposmark (car old))
|
||||||
(oldpos (or (if oldposmark (marker-position oldposmark))
|
(oldpos (or (if oldposmark (marker-position oldposmark))
|
||||||
|
@ -195,7 +197,7 @@ By convention, this is a list of symbols where each symbol stands for the
|
||||||
(progn (move-marker (car old) point)
|
(progn (move-marker (car old) point)
|
||||||
(setcdr old new))
|
(setcdr old new))
|
||||||
(set-window-parameter window 'cursor-sensor--last-state
|
(set-window-parameter window 'cursor-sensor--last-state
|
||||||
(cons (copy-marker point) new))))))
|
(cons (copy-marker point) new)))))))
|
||||||
|
|
||||||
;;;###autoload
|
;;;###autoload
|
||||||
(define-minor-mode cursor-sensor-mode
|
(define-minor-mode cursor-sensor-mode
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue