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

From: [email-masked]
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: [email-masked]
>> Cc: [email-masked], Stephen Berman <[email-masked]>
>>
>> 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.