From: Andrii Kolomoiets <andreyk.mad@gmail.com>
To: "João Távora" <joaotavora@gmail.com>
Cc: 44885@debbugs.gnu.org
Subject: bug#44885: 28.0.50; [PATCH] ElDoc buffer mode and separator
Date: Thu, 03 Dec 2020 11:25:33 +0200 [thread overview]
Message-ID: <m24kl3fdgy.fsf@gmail.com> (raw)
In-Reply-To: <m2eekd596r.fsf@gmail.com> ("João Távora"'s message of "Sat, 28 Nov 2020 23:54:36 +0000")
[-- Attachment #1: Type: text/plain, Size: 2548 bytes --]
João Távora <joaotavora@gmail.com> writes:
> The only incompatibility I see between my idea and your current proposal
> is the major mode that you picked for the Eldoc doc buffer. I wonder if
> you could make it inherit from Help mode? Then it would glue better
> with my idea.
Sure.
>> +(define-derived-mode eldoc-doc-mode fundamental-mode "ElDoc doc"
>> + "Major mode for ElDoc documentation buffer."
>> + (setq buffer-read-only t))
>
> As I said above, I wonder if inheriting from help-mode wouldn't give us
> most of this for free. Maybe it would bring us _too much_ though...
The only reason I didn't inherit from `special-mode` is to avoid binding
the `g` key to the `revert-buffer` function.
> So some inheritance snipping would be needed.
OK, will do.
>> With little customization and custom display function in
>> display-buffer-alist 'M-x eldoc-doc-buffer' can show the ElDoc buffer
>> like some kind of tooltip.
>
> Very interesting. Can you share the display-buffer-alist hack that
> allowed you to do this? I didn't think about the possibility of
> tweaking it like this, but it's certainly "legal".
See attached eldoc-frame.el.
In emacs -Q:
1. M-x load-file eldoc-frame.el
2. Type "(setq" and wait a bit for eldoc message to appear in the echo
area
3. C-c h
> I wonder if you cann't do the same by adding a different function to
> eldoc-display-functions, which was how I intented it to work.
This will work even better. This way the "tooltip" can fit to content
as soon as new docs will be shown.
>> do (insert this-doc)
>> - when rest do (insert "\n")
>> + when rest do (insert eldoc-doc-buffer-separator)
>
> I like this and I like the separator, however, notice that the current
> implementation of the eldoc-display-in-echo-area also uses this buffer
> as an implementation detail. So this would break eldoc-display-in-echo
> area.
I was hoping it would look like an enhancement -- eldoc-separator
everywhere! :)
> The solution would be for eldoc-display-in-echo-area to use its own
> "hidden" buffer and then eldoc-display-in-buffer would be free to format
> the buffer as it sees fit.
>
> So you could extract the buffer-formatting code to a common helper, use
> it in eldoc-display-in-echo-area with a "\n" separator and in
> eldoc-display-in-buffer with an arbitrary user-chosen separator. The
> performance hit of formatting two buffers would likely be negligible.
OK, will do.
[-- Attachment #2: eldoc-frame.el --]
[-- Type: application/emacs-lisp, Size: 2381 bytes --]
next prev parent reply other threads:[~2020-12-03 9:25 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-26 12:42 bug#44885: 28.0.50; [PATCH] ElDoc buffer mode and separator Andrii Kolomoiets
2020-11-28 23:54 ` João Távora
2020-12-03 9:25 ` Andrii Kolomoiets [this message]
2020-11-29 13:02 ` Basil L. Contovounesios
2020-12-03 10:29 ` Andrii Kolomoiets
2021-01-25 14:19 ` Felician Nemeth
2021-09-08 9:44 ` Lars Ingebrigtsen
2021-09-08 9:46 ` João Távora
2021-09-08 18:56 ` Andrii Kolomoiets
2022-09-11 11:33 ` Lars Ingebrigtsen
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
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m24kl3fdgy.fsf@gmail.com \
--to=andreyk.mad@gmail.com \
--cc=44885@debbugs.gnu.org \
--cc=joaotavora@gmail.com \
/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 public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).