* 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.
|
||||
|
||||
(defun cursor-sensor--detect (&optional window)
|
||||
(with-current-buffer (window-buffer window)
|
||||
(unless cursor-sensor-inhibit
|
||||
(let* ((point (window-point window))
|
||||
;; 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 (and (eq (current-buffer) (window-buffer))
|
||||
(or (get-char-property point 'cursor-sensor-functions)
|
||||
;; 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)))))
|
||||
(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))
|
||||
|
@ -195,7 +197,7 @@ By convention, this is a list of symbols where each symbol stands for the
|
|||
(progn (move-marker (car old) point)
|
||||
(setcdr old new))
|
||||
(set-window-parameter window 'cursor-sensor--last-state
|
||||
(cons (copy-marker point) new))))))
|
||||
(cons (copy-marker point) new)))))))
|
||||
|
||||
;;;###autoload
|
||||
(define-minor-mode cursor-sensor-mode
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue