emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Show show-paren context in a child frame


From: Tassilo Horn
Subject: Re: Show show-paren context in a child frame
Date: Sat, 05 Feb 2022 20:03:36 +0100
User-agent: mu4e 1.7.7; emacs 29.0.50

Daniel Martín <mardani29@yahoo.es> writes:

Hi Daniel,

>> today I've discovered `show-paren-context-when-offscreen' which
>> displays the context around the opening paren in the echo area.
>> That's a very nice feature, however it competes with eldoc, i.e.,
>> it'll show the context in the echo area and a fraction of a second
>> later, that's repressed by eldoc's text (or the other way round
>> depending on the delays one uses).
>
> I'm glad you like the feature! Yes, unfortunately there are some cases
> where this feature competes with Eldoc.  I taught
> `eldoc-display-message-no-interference-p' about this new option, but
> perhaphs the mechanism needs some more refinement.

Ah, I see.  Shouldn't in the code

  (and (boundp 'show-paren-context-when-offscreen)
                show-paren-context-when-offscreen
                (not (pos-visible-in-window-p
                      (overlay-end show-paren--overlay))))

the `overlay-end' be `overlay-start'?  I mean the show-paren context
message is shown when the `show-paren--overlay's start is further up
than the window is showing, no?

>> Therefore, I've experimented with adding a special `child-frame'
>> value for `show-paren-context-when-offscreen' which displays the
>> context in a child frame.  This works pretty well although setting up
>> a child frame with corresponding buffer for a kind of tooltip pane
>> requires quite some gymnastics in frame parameters and buffer-local
>> variables which I've copied from vertico.  Comments welcome!
>
> Thank you! I've given your code a try and I think it can be a useful
> option.  Some comments:
>
> - Is there a way to make the header more prominent? I feel it can be
> easily confused with the rest of the buffer.  Perhaps putting a thin
> border around the child frame might be enough.

Yeah, just give the `child-frame-border' some :background.

> - I've found an error when I clicked on the child frame by mistake and
>   scrolled (I wanted to scroll the parent frame instead):
>
> mouse-scroll-subr: Wrong type argument: window-live-p, #<window 386> [30
> times]
>
> Not sure if it's a bug in the child frame API or in the way you use
> it; I'm not familiar enough with the child frame API.

Neither am I.  I stole most of the child-frame code from vertico which
adds some more hacks to redirect accidental focus from the child frame
back to the parent.  Seems like those are needed.

> - The way the child frame is positioned makes me think that using the
>   header line would be more reliable and imply much less code than using
>   a child frame.

Indeed, but the header-line has the drawback that it can only display
one line.  The context shown here can be two lines if the opening paren
is on its own line (like in c-ish languages).

> I'd like to give a header line-based approach a try to see how it
> compares against using a child frame.

Sure, give it a go! :-)

Bye,
Tassilo



reply via email to

[Prev in Thread] Current Thread [Next in Thread]