GNU bug report logs - #77747
'cursor-face-highlight-mode' signals 'args-out-of-range' in narrowed buffer

Previous Next

Package: emacs;

Reported by: Ship Mints <shipmints <at> gmail.com>

Date: Fri, 11 Apr 2025 15:33:02 UTC

Severity: normal

Done: Eli Zaretskii <eliz <at> gnu.org>

Bug is archived. No further changes may be made.

Full log


Message #14 received at 77747 <at> debbugs.gnu.org (full text, mbox):

From: Ship Mints <shipmints <at> gmail.com>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 77747 <at> debbugs.gnu.org
Subject: Re: bug#77747: 'cursor-face-highlight-mode' signals
 'args-out-of-range' in narrowed buffer
Date: Sun, 13 Apr 2025 07:38:34 -0400
[Message part 1 (text/plain, inline)]
On Sun, Apr 13, 2025 at 7:28 AM Ship Mints <shipmints <at> gmail.com> wrote:

> On Sun, Apr 13, 2025 at 5:52 AM Eli Zaretskii <eliz <at> gnu.org> wrote:
>
>> > From: Ship Mints <shipmints <at> gmail.com>
>> > Date: Fri, 11 Apr 2025 11:32:18 -0400
>> >
>> > -Q reproducer
>> >
>> > ;; The culprit appears to be `redisplay--update-cursor-face-highlight'
>> > (setq debug-on-error t)
>> > (cursor-face-highlight-mode)
>> > (save-excursion (insert (propertize "cursor face text\n"
>> >                                     'cursor-face 'region)))
>> > (narrow-to-region (pos-bol) (pos-eol))
>> > (setq unread-command-events (mapcar #'identity
>> >                                     (kbd "C-n")))
>>
>> Thanks, does the below fix it?
>>
>> diff --git a/lisp/simple.el b/lisp/simple.el
>> index ee09a6f..9e9dd15 100644
>> --- a/lisp/simple.el
>> +++ b/lisp/simple.el
>> @@ -7265,7 +7265,7 @@ redisplay--update-cursor-face-highlight
>>                (pt (window-point window))
>>                (cursor-face (get-text-property pt 'cursor-face)))
>>          (let* ((start (previous-single-property-change
>> -                       (1+ pt) 'cursor-face nil (point-min)))
>> +                       (min (1+ pt) (point-min)) 'cursor-face nil
>> (point-min)))
>>                 (end (next-single-property-change
>>                       pt 'cursor-face nil (point-max)))
>>                 (new (redisplay--highlight-overlay-function
>>
>
> Not quite.  That winds up coalescing the highlight across lines rather
> than just the line with the cursor.
>
> This works better but I'm not sure if this is in the true spirit of the
> intended use as the property change may not be floored to bol?
>
> diff --git a/lisp/simple.el b/lisp/simple.el
> index 7037158df8d..9ebe9a0ba34 100644
> --- a/lisp/simple.el
> +++ b/lisp/simple.el
> @@ -7259,7 +7259,7 @@ redisplay--update-cursor-face-highlight
>                (pt (window-point window))
>                (cursor-face (get-text-property pt 'cursor-face)))
>          (let* ((start (previous-single-property-change
> -                       (1+ pt) 'cursor-face nil (point-min)))
> +                       (min (1+ pt) (pos-bol)) 'cursor-face nil
> (point-min)))
>                 (end (next-single-property-change
>                       pt 'cursor-face nil (point-max)))
>                 (new (redisplay--highlight-overlay-function
>

I tested my experiment above in my own reproducer and it doesn't work
there, though it worked in a larger case with a lot more text, I didn't
look further.

Your recommendation doesn't work in the reproducer and it signals as before.
[Message part 2 (text/html, inline)]

This bug report was last modified 118 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.