GNU bug report logs - #44885
28.0.50; [PATCH] ElDoc buffer mode and separator

Previous Next

Package: emacs;

Reported by: Andrii Kolomoiets <andreyk.mad <at> gmail.com>

Date: Thu, 26 Nov 2020 12:44:01 UTC

Severity: normal

Tags: patch

Found in version 28.0.50

Fixed in version 29.1

Done: Lars Ingebrigtsen <larsi <at> gnus.org>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Andrii Kolomoiets <andreyk.mad <at> gmail.com>
To: João Távora <joaotavora <at> gmail.com>
Cc: 44885 <at> debbugs.gnu.org
Subject: bug#44885: 28.0.50; [PATCH] ElDoc buffer mode and separator
Date: Thu, 03 Dec 2020 11:25:33 +0200
[Message part 1 (text/plain, inline)]
João Távora <joaotavora <at> 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 (application/emacs-lisp, attachment)]

This bug report was last modified 2 years and 254 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.