From: Federico Tedin <federicotedin@gmail.com>
To: Eli Zaretskii <eliz@gnu.org>
Cc: lg.zevlg@gmail.com, 38740@debbugs.gnu.org
Subject: bug#38740: 28.0.50; cursor-sensor-mode error in post-command-hook
Date: Mon, 17 Feb 2020 22:04:36 +0100 [thread overview]
Message-ID: <m17e0lq61n.fsf@gmail.com> (raw)
In-Reply-To: <83blq0ntm1.fsf@gnu.org> (Eli Zaretskii's message of "Sat, 15 Feb 2020 10:27:02 +0200")
[-- Attachment #1: Type: text/plain, Size: 1108 bytes --]
Eli Zaretskii <eliz@gnu.org> writes:
>> From: Federico Tedin <federicotedin@gmail.com>
>> Date: Wed, 05 Feb 2020 21:24:35 +0100
>> Cc: 38740@debbugs.gnu.org
>>
>> > Evaluating next form in scratch buffer:
>> >
>> > (with-help-window "TEST"
>> > (set-buffer standard-output)
>> > (cursor-sensor-mode 1)
>> > (insert "here"))
>> >
>> > Results in error:
>> >
>> > Error in post-command-hook (cursor-sensor--detect): (args-out-of-range 354582)
>> >
>> > Looks like cursor-sensor uses scratch's window instead of "TEST" buffer window.
>> >
>> > I do not remember getting such error in Emacs 26, 27
>>
>> I found that `cursor-sensor--detect' reads the point position from the
>> buffer displayed in the selected window, and then tries to read text
>> properties in that position in the current buffer. In your example,
>> those two buffers are not the same, the buffer at `standard-output'
>> isn't being displayed yet. I'm attaching a short patch that checks for
>> this case.
>
> LGTM, thanks.
I'm attaching the patch again but with the correct commit message
formatting.
- Fede
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: patch --]
[-- Type: text/x-patch, Size: 1613 bytes --]
From 5c9edf2f69ff531229f06c3dbedb468aef01e69a Mon Sep 17 00:00:00 2001
From: Federico Tedin <federicotedin@gmail.com>
Date: Mon, 17 Feb 2020 21:58:43 +0100
Subject: [PATCH] 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.21.1 (Apple Git-122.3)
next prev parent reply other threads:[~2020-02-17 21:04 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-25 13:23 bug#38740: 28.0.50; cursor-sensor-mode error in post-command-hook Evgeny Zajcev
2020-02-05 20:24 ` Federico Tedin
2020-02-15 8:27 ` Eli Zaretskii
2020-02-15 12:26 ` Federico Tedin
2020-02-17 21:04 ` Federico Tedin [this message]
2020-02-21 9:12 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m17e0lq61n.fsf@gmail.com \
--to=federicotedin@gmail.com \
--cc=38740@debbugs.gnu.org \
--cc=eliz@gnu.org \
--cc=lg.zevlg@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.