From: "João Távora" <joaotavora@gmail.com>
To: Andrii Kolomoiets <andreyk.mad@gmail.com>
Cc: 44885@debbugs.gnu.org
Subject: bug#44885: 28.0.50; [PATCH] ElDoc buffer mode and separator
Date: Sat, 28 Nov 2020 23:54:36 +0000 [thread overview]
Message-ID: <m2eekd596r.fsf@gmail.com> (raw)
In-Reply-To: <m2h7pcmgqg.fsf@gmail.com> (Andrii Kolomoiets's message of "Thu, 26 Nov 2020 14:42:47 +0200")
Andrii Kolomoiets <andreyk.mad@gmail.com> writes:
> Hi,
>
> Patch attached.
>
> The configurable separator will make it possible to show multiple docs
> in user pleasant way.
Thanks. The patch looks generally good but it has an important flaw that
can be fixed. See comments below.
> The mode will allow tweak ElDoc doc buffer appearance by adding hooks.
Yes. I also have some ideas about how to sophisticate this buffer.
One of them involves having some backends, like the Elisp backends,
transmit a special key on the side -- much like :thing or :face -- that
specifies a function that fills in the whole buffer. Thus, M-x eldoc in
a symbol of the Elisp buffer could eventually format this Eldoc doc
buffer much in the same way that currently M-x describe-symbol does.
And thus the Elisp disconnect between M-x eldoc and M-x describe-* would
be bridged.
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.
> 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". 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.
> +(defvar eldoc-doc-mode-map
> + (let ((map (make-sparse-keymap)))
> + (suppress-keymap map)
> + (define-key map "q" 'quit-window)
> + (define-key map " " 'scroll-up-command)
> + (define-key map [?\S-\ ] 'scroll-down-command)
> + (define-key map "\C-?" 'scroll-down-command)
> + (define-key map "?" 'describe-mode)
> + (define-key map "h" 'describe-mode)
> + (define-key map ">" 'end-of-buffer)
> + (define-key map "<" 'beginning-of-buffer)
> + map)
> + "Keymap used in ElDoc documentation buffer.")
> +
> +(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... So
some inheritance snipping would be needed.
> 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.
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.
João
next prev parent reply other threads:[~2020-11-28 23:54 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 [this message]
2020-12-03 9:25 ` Andrii Kolomoiets
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=m2eekd596r.fsf@gmail.com \
--to=joaotavora@gmail.com \
--cc=44885@debbugs.gnu.org \
--cc=andreyk.mad@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 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.