all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Tassilo Horn <tsdh@gnu.org>
To: "Daniel Martín" <mardani29@yahoo.es>
Cc: emacs-devel@gnu.org
Subject: Re: Show show-paren context in a child frame
Date: Sat, 05 Feb 2022 20:03:36 +0100	[thread overview]
Message-ID: <878rup2kg2.fsf@gnu.org> (raw)
In-Reply-To: <m1zgn5gpm6.fsf@yahoo.es>

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	other threads:[~2022-02-05 19:03 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-05 12:33 Show show-paren context in a child frame Tassilo Horn
2022-02-05 18:00 ` Daniel Martín
2022-02-05 19:03   ` Tassilo Horn [this message]
2022-02-05 20:06     ` Tassilo Horn
2022-02-06 10:18       ` Tassilo Horn

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=878rup2kg2.fsf@gnu.org \
    --to=tsdh@gnu.org \
    --cc=emacs-devel@gnu.org \
    --cc=mardani29@yahoo.es \
    /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.