GNU bug report logs - #64547
`show-paren-mode` thinks that a paren is offscreen in `M-:` when it isn't

Previous Next

Package: emacs;

Reported by: Okamsn <okamsn <at> protonmail.com>

Date: Sun, 9 Jul 2023 19:50:01 UTC

Severity: normal

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

Bug is archived. No further changes may be made.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 64547 in the body.
You can then email your comments to 64547 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-gnu-emacs <at> gnu.org:
bug#64547; Package emacs. (Sun, 09 Jul 2023 19:50:01 GMT) Full text and rfc822 format available.

Acknowledgement sent to Okamsn <okamsn <at> protonmail.com>:
New bug report received and forwarded. Copy sent to bug-gnu-emacs <at> gnu.org. (Sun, 09 Jul 2023 19:50:01 GMT) Full text and rfc822 format available.

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

From: Okamsn <okamsn <at> protonmail.com>
To: bug-gnu-emacs <at> gnu.org
Subject: `show-paren-mode` thinks that a paren is offscreen in `M-:` when it
 isn't
Date: Sun, 09 Jul 2023 19:49:06 +0000
[Message part 1 (text/plain, inline)]
Hello,

I have `show-paren-style` set to `mixed` and 
`show-paren-context-when-offscreen` set to `overlay`.

When using `eval-expression`, `show-paren` thinks that the starting 
parenthesis is offscreen.

I have attached images showing how, although I am typing on the same 
line as the parenthesis, the context overlay is still shown.

With `show-paren-when-point-inside-paren` enabled, typing before the 
closing parenthesis causes the prompt of `M-:` to be shown before 
quickly being hidden by the context overlay again. This causes text to 
quickly move side to side as I type. I have attached a screen recording 
of this movement.

This is in Emacs 29.0.92. If it is relevant, I have `line-spacing` set 
to 0.15.

Thank you.
[without-context.png (image/png, attachment)]
[with-context.png (image/png, attachment)]
[show-paren-movement.mp4 (video/mp4, attachment)]

Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#64547; Package emacs. (Mon, 10 Jul 2023 12:16:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Okamsn <okamsn <at> protonmail.com>
Cc: 64547 <at> debbugs.gnu.org
Subject: Re: bug#64547: `show-paren-mode` thinks that a paren is offscreen in
 `M-:` when it isn't
Date: Mon, 10 Jul 2023 15:15:48 +0300
> Date: Sun, 09 Jul 2023 19:49:06 +0000
> From:  Okamsn via "Bug reports for GNU Emacs,
>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
> 
> I have `show-paren-style` set to `mixed` and 
> `show-paren-context-when-offscreen` set to `overlay`.
> 
> When using `eval-expression`, `show-paren` thinks that the starting 
> parenthesis is offscreen.
> 
> I have attached images showing how, although I am typing on the same 
> line as the parenthesis, the context overlay is still shown.
> 
> With `show-paren-when-point-inside-paren` enabled, typing before the 
> closing parenthesis causes the prompt of `M-:` to be shown before 
> quickly being hidden by the context overlay again. This causes text to 
> quickly move side to side as I type. I have attached a screen recording 
> of this movement.
> 
> This is in Emacs 29.0.92. If it is relevant, I have `line-spacing` set 
> to 0.15.

I cannot reproduce this.  I see neither of the problems you describe,
and nothing like the screen recording you posted.  You don't show the
details of your platform and build, so maybe it is something specific
to that (macOS, per chance?).

Can you post a detailed reproduction recipe, starting from "emacs -Q"
and showing all the settings and commands you have to do to reproduce
the problem.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#64547; Package emacs. (Mon, 10 Jul 2023 13:27:02 GMT) Full text and rfc822 format available.

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

From: Stephen Berman <stephen.berman <at> gmx.net>
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: Okamsn <okamsn <at> protonmail.com>, 64547 <at> debbugs.gnu.org
Subject: Re: bug#64547: `show-paren-mode` thinks that a paren is offscreen
 in `M-:` when it isn't
Date: Mon, 10 Jul 2023 15:26:34 +0200
On Mon, 10 Jul 2023 15:15:48 +0300 Eli Zaretskii <eliz <at> gnu.org> wrote:

>> Date: Sun, 09 Jul 2023 19:49:06 +0000
>> From:  Okamsn via "Bug reports for GNU Emacs,
>>  the Swiss army knife of text editors" <bug-gnu-emacs <at> gnu.org>
>>
>> I have `show-paren-style` set to `mixed` and
>> `show-paren-context-when-offscreen` set to `overlay`.
>>
>> When using `eval-expression`, `show-paren` thinks that the starting
>> parenthesis is offscreen.
>>
>> I have attached images showing how, although I am typing on the same
>> line as the parenthesis, the context overlay is still shown.
>>
>> With `show-paren-when-point-inside-paren` enabled, typing before the
>> closing parenthesis causes the prompt of `M-:` to be shown before
>> quickly being hidden by the context overlay again. This causes text to
>> quickly move side to side as I type. I have attached a screen recording
>> of this movement.
>>
>> This is in Emacs 29.0.92. If it is relevant, I have `line-spacing` set
>> to 0.15.
>
> I cannot reproduce this.  I see neither of the problems you describe,
> and nothing like the screen recording you posted.  You don't show the
> details of your platform and build, so maybe it is something specific
> to that (macOS, per chance?).
>
> Can you post a detailed reproduction recipe, starting from "emacs -Q"
> and showing all the settings and commands you have to do to reproduce
> the problem.

I can reproduce the problem in GNU Emacs 29.0.92 (x86_64-pc-linux-gnu,
GTK+ Version 3.24.38, cairo version 1.17.6), but only with line-spacing
set to at least 0.06.  Recipe:

0. emacs -Q
1. M-x customize-option show-paren-style RET.  Choose "mixed" from the
   Value Menu and set for current session.
2. M-x customize-option show-paren-context-when-offscreen RET.  Choose
   "In overlay" from the Value Menu and set for current session.
3. M-x customize-option line-spacing RET.  Choose "Number" from the
   Value Menu, enter 0.06 or greater and set for current session.
4. M-: ()
=> On typing ")" the "Eval: " prompt vanishes, the string "(" is
   displayed with a hollow box over it, followed directly by the string
   "()" with a cyan background.  Typing DEL to delete the final ")"
   displays the "Eval: " prompt again, the "(" with a hollow box over it
   vanishes, and the remaining "(" has no cyan overlay.  Typing any
   characters and then ")" at the end again makes the prompt vanishes,
   "(" with the hollow box and the cyan overlay return.  Lather, rinse,
   repeat...

Steve Berman




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#64547; Package emacs. (Mon, 10 Jul 2023 14:18:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: Stephen Berman <stephen.berman <at> gmx.net>
Cc: okamsn <at> protonmail.com, 64547 <at> debbugs.gnu.org
Subject: Re: bug#64547: `show-paren-mode` thinks that a paren is offscreen
 in `M-:` when it isn't
Date: Mon, 10 Jul 2023 17:17:38 +0300
> From: Stephen Berman <stephen.berman <at> gmx.net>
> Cc: Okamsn <okamsn <at> protonmail.com>,  64547 <at> debbugs.gnu.org
> Date: Mon, 10 Jul 2023 15:26:34 +0200
> 
> 0. emacs -Q
> 1. M-x customize-option show-paren-style RET.  Choose "mixed" from the
>    Value Menu and set for current session.
> 2. M-x customize-option show-paren-context-when-offscreen RET.  Choose
>    "In overlay" from the Value Menu and set for current session.
> 3. M-x customize-option line-spacing RET.  Choose "Number" from the
>    Value Menu, enter 0.06 or greater and set for current session.
> 4. M-: ()
> => On typing ")" the "Eval: " prompt vanishes, the string "(" is
>    displayed with a hollow box over it, followed directly by the string
>    "()" with a cyan background.  Typing DEL to delete the final ")"
>    displays the "Eval: " prompt again, the "(" with a hollow box over it
>    vanishes, and the remaining "(" has no cyan overlay.  Typing any
>    characters and then ")" at the end again makes the prompt vanishes,
>    "(" with the hollow box and the cyan overlay return.  Lather, rinse,
>    repeat...

Thanks, should be fixed now on the emacs-29 branch.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#64547; Package emacs. (Fri, 14 Jul 2023 03:04:01 GMT) Full text and rfc822 format available.

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

From: okamsn <at> protonmail.com
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 64547 <at> debbugs.gnu.org, Stephen Berman <stephen.berman <at> gmx.net>
Subject: Re: bug#64547: `show-paren-mode` thinks that a paren is offscreen in
 `M-:` when it isn't
Date: Fri, 14 Jul 2023 03:03:31 +0000
On 2023-07-10 14:17 UTC, Eli Zaretskii wrote:
>> From: Stephen Berman <stephen.berman <at> gmx.net>
>> Cc: Okamsn <okamsn <at> protonmail.com>,  64547 <at> debbugs.gnu.org
>> Date: Mon, 10 Jul 2023 15:26:34 +0200
>>
>> 0. emacs -Q
>> 1. M-x customize-option show-paren-style RET.  Choose "mixed" from the
>>     Value Menu and set for current session.
>> 2. M-x customize-option show-paren-context-when-offscreen RET.  Choose
>>     "In overlay" from the Value Menu and set for current session.
>> 3. M-x customize-option line-spacing RET.  Choose "Number" from the
>>     Value Menu, enter 0.06 or greater and set for current session.
>> 4. M-: ()
>> => On typing ")" the "Eval: " prompt vanishes, the string "(" is
>>     displayed with a hollow box over it, followed directly by the string
>>     "()" with a cyan background.  Typing DEL to delete the final ")"
>>     displays the "Eval: " prompt again, the "(" with a hollow box over it
>>     vanishes, and the remaining "(" has no cyan overlay.  Typing any
>>     characters and then ")" at the end again makes the prompt vanishes,
>>     "(" with the hollow box and the cyan overlay return.  Lather, rinse,
>>     repeat...
> 
> Thanks, should be fixed now on the emacs-29 branch.

Hello,

The change fixed it for the minibuffer, but also disabled it when the 
opening parenthesis was offscreen.  I think this is because
`(pos-visible-in-window-p openparen nil t)` seems to return nil in that 
case.

I got it to work by swapping

     (or (< (length part) 4)
         (and
          (< (nth 2 part) dfh4)
          (< (nth 3 part) dfh4)))

with

     (and (>= (length part) 4)
          (< (nth 2 part) dfh4)
          (< (nth 3 part) dfh4))

, which did not re-introduce the problem in the minibuffer.

Thank you.





Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#64547; Package emacs. (Fri, 14 Jul 2023 06:45:02 GMT) Full text and rfc822 format available.

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

From: Eli Zaretskii <eliz <at> gnu.org>
To: okamsn <at> protonmail.com
Cc: 64547 <at> debbugs.gnu.org, stephen.berman <at> gmx.net
Subject: Re: bug#64547: `show-paren-mode` thinks that a paren is offscreen in
 `M-:` when it isn't
Date: Fri, 14 Jul 2023 09:44:31 +0300
> Date: Fri, 14 Jul 2023 03:03:31 +0000
> From: okamsn <at> protonmail.com
> Cc: 64547 <at> debbugs.gnu.org, Stephen Berman <stephen.berman <at> gmx.net>
> 
> On 2023-07-10 14:17 UTC, Eli Zaretskii wrote:
> > 
> > Thanks, should be fixed now on the emacs-29 branch.
> 
> Hello,
> 
> The change fixed it for the minibuffer, but also disabled it when the 
> opening parenthesis was offscreen.  I think this is because
> `(pos-visible-in-window-p openparen nil t)` seems to return nil in that 
> case.

Disabled what?  Can you post a detailed recipe, and the description of
what you see and what you expected to see?  I'd like to make sure I
understand the issue we are discussing now.

Thanks.




Information forwarded to bug-gnu-emacs <at> gnu.org:
bug#64547; Package emacs. (Sat, 15 Jul 2023 01:08:02 GMT) Full text and rfc822 format available.

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

From: okamsn <at> protonmail.com
To: Eli Zaretskii <eliz <at> gnu.org>
Cc: 64547 <at> debbugs.gnu.org, stephen.berman <at> gmx.net
Subject: Re: bug#64547: `show-paren-mode` thinks that a paren is offscreen in
 `M-:` when it isn't
Date: Sat, 15 Jul 2023 01:06:54 +0000
On 2023-07-14 06:44 UTC, Eli Zaretskii wrote:
>> Date: Fri, 14 Jul 2023 03:03:31 +0000
>> From: okamsn <at> protonmail.com
>> Cc: 64547 <at> debbugs.gnu.org, Stephen Berman <stephen.berman <at> gmx.net>
>>
>> On 2023-07-10 14:17 UTC, Eli Zaretskii wrote:
>>>
>>> Thanks, should be fixed now on the emacs-29 branch.
>>
>> Hello,
>>
>> The change fixed it for the minibuffer, but also disabled it when the
>> opening parenthesis was offscreen.  I think this is because
>> `(pos-visible-in-window-p openparen nil t)` seems to return nil in that
>> case.
> 
> Disabled what?  Can you post a detailed recipe, and the description of
> what you see and what you expected to see?  I'd like to make sure I
> understand the issue we are discussing now.
> 
> Thanks.

Sorry, I meant that the new change stopped showing the overlay in the 
normal buffers in addition to the minibuffer. I was expecting it to only 
stop showing the overlay for the minibuffer when the opening parenthesis 
was visible.

These are the steps I took:

1) Start `emacs -q` without the new change to paren.el.

2) Set `show-paren-context-when-offscreen` to `overlay`.

3) In a normal buffer (not the minibuffer), move to the end of a long 
expression so that the starting parenthesis is no longer on the screen 
and is not visible.

4) See the overlay, as expected.

5) Move inside the expression so that the overlay is no longer shown.

6) Evaluate the new definition of `show-paren-function`.

7) Move back to the end of the long expression.

8) See that the overlay is no longer shown.


I expected to see that the overlay would still be shown for the opening 
parenthesis that is completely unseen.

I think that this happens because there is an expression `(not ... (or 
(< (length part) 4) ...))` which resolves to `nil` when the parenthesis 
is not visible and not partially visible, from what I can tell.

Does this make sense?

Thank you.








Reply sent to Eli Zaretskii <eliz <at> gnu.org>:
You have taken responsibility. (Sat, 15 Jul 2023 07:22:01 GMT) Full text and rfc822 format available.

Notification sent to Okamsn <okamsn <at> protonmail.com>:
bug acknowledged by developer. (Sat, 15 Jul 2023 07:22:02 GMT) Full text and rfc822 format available.

Message #28 received at 64547-done <at> debbugs.gnu.org (full text, mbox):

From: Eli Zaretskii <eliz <at> gnu.org>
To: okamsn <at> protonmail.com
Cc: stephen.berman <at> gmx.net, 64547-done <at> debbugs.gnu.org
Subject: Re: bug#64547: `show-paren-mode` thinks that a paren is offscreen in
 `M-:` when it isn't
Date: Sat, 15 Jul 2023 10:22:10 +0300
> Date: Sat, 15 Jul 2023 01:06:54 +0000
> From: okamsn <at> protonmail.com
> Cc: 64547 <at> debbugs.gnu.org, stephen.berman <at> gmx.net
> 
> 1) Start `emacs -q` without the new change to paren.el.
> 
> 2) Set `show-paren-context-when-offscreen` to `overlay`.
> 
> 3) In a normal buffer (not the minibuffer), move to the end of a long 
> expression so that the starting parenthesis is no longer on the screen 
> and is not visible.
> 
> 4) See the overlay, as expected.
> 
> 5) Move inside the expression so that the overlay is no longer shown.
> 
> 6) Evaluate the new definition of `show-paren-function`.
> 
> 7) Move back to the end of the long expression.
> 
> 8) See that the overlay is no longer shown.
> 
> 
> I expected to see that the overlay would still be shown for the opening 
> parenthesis that is completely unseen.
> 
> I think that this happens because there is an expression `(not ... (or 
> (< (length part) 4) ...))` which resolves to `nil` when the parenthesis 
> is not visible and not partially visible, from what I can tell.
> 
> Does this make sense?

Thanks, now fixed as you suggested, and closing the bug.




bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Sat, 12 Aug 2023 11:24:11 GMT) Full text and rfc822 format available.

This bug report was last modified 1 year and 312 days ago.

Previous Next


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