[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#44885: 28.0.50; [PATCH] ElDoc buffer mode and separator
From: |
Andrii Kolomoiets |
Subject: |
bug#44885: 28.0.50; [PATCH] ElDoc buffer mode and separator |
Date: |
Thu, 03 Dec 2020 11:25:33 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (darwin) |
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.
eldoc-frame.el
Description: application/emacs-lisp
- bug#44885: 28.0.50; [PATCH] ElDoc buffer mode and separator,
Andrii Kolomoiets <=