From: Arthur Miller <arthur.miller@live.com>
To: martin rudalics <rudalics@gmx.at>
Cc: emacs-devel@gnu.org
Subject: Re: Patch proposal: display symbol source code in help buffers
Date: Tue, 21 Sep 2021 20:56:54 +0200 [thread overview]
Message-ID: <AM9PR09MB4977EB85ABF94B4A4143004296A19@AM9PR09MB4977.eurprd09.prod.outlook.com> (raw)
In-Reply-To: <aab6c476-9802-ac5c-89c3-527542013b24@gmx.at> (martin rudalics's message of "Tue, 21 Sep 2021 18:52:10 +0200")
martin rudalics <rudalics@gmx.at> writes:
>>>> It would be nice to make it fit to N lines in height, and C columns in width,
>>>> i.e. to make it fit to certain size.
>>>
>>> Who would specify that "certain size"?
>> User, of course, who else? We put some default size and a defcuctom for user to
>> change, as always?
>
> Do you mean "one size fits all"?
Of course not :).
I said "user", because I meant an user should have the final word. I just said in
short words that there should be a defcustom variable for users to customize the
default value. But also every value that is in use, has to have some default
value to start with, no? I didn't proposed a hadcoded literal, I proposed a
defcustom variable, so users can set this their liking.
>> Let's
>> have a face lift for built in help for 28. I am sure we could debate for years
>> and always someone will like it differently. Let's have something that works.
>
> That something will take its time to be written. Certainly not before
> Emacs 28 comes out.
>
>> I haven't read the other thread, but I have used help and why I think it is
>> good, and some other have as well.
>
> There are two threads and I think you should read them if you plan to
> change anything in this area.
>
>> Can you try what I send in yesterday, with soucre view toggle? I think it works
>> quite nice (I did a misstake and went 1 row too far when deleting, but that's a
>> trivial to fix).
>
> Compiling it tells me
>
> ../../lisp/help-mode.el:530:22: Warning: the function
> ‘find-function-advised-original’ is not known to be defined.
>
> so it should require 'find-func'. A few remarks:
Thank you for spotting that one! I used to have it in fetch-c-src, but than I
removed it, and than refactored that code from 'find-function-C-source' but
forgott that it might require find-func.
> +(defcustom help-mode-inline-source nil
> + "Display inlined source code for SYMBOL in `help-mode' buffer.
>
> What is SYMBOL here?
Current symbol in the help buffer. There is always a 'current symbol' in the
help buffer, as I understand the implementation, the one that help was asked
about. I can reword the docs. I have tried to be short as possible so it fits in
one line. I see also now that it shoudl at least be 'the SYMBOL', but I can
probably just skip "for SYMBOL" completely.
> + "Find C source code for a Lisp symbol in a `file'.
> +
> +sym is the symbol to find.
> +type is the type as obtained by 'describe-*' functions.
> +file is the source file to search in."
>
> Arguments should be uppercase and not hyphenated.
Ok, thank you, I wasn't thinking about that one. I'll fix that of course.
> + (with-no-warnings (font-lock-fontify-buffer)))
>
> Do you know how long it takes to fontify xdisp.c? With a non-optimized
> build, C-h v for 'scroll-minibuffer-conservatively' takes more than 10
> seconds here.
I would't be surprised. I try to do as little work as possible: only function
oor defvar in question is fontified, so xdisp.c will never get fontified all at
once in this context. If that would still be problematic for low-level CPUs I
can of course do this optionally as well, with another defcustom.
I am really concerned with efficiency; I always am. I really like Helpful, and I
am not the only one, it is a popular library. What is problem is that it
does not use any built-in functionality but provides everything from scratch. It
has complete implementation of a help buffer on its own. So it is a dubble
functionality when I import it. I like it's implementation too, it is simpler
than built-in help infrastructure. So I hoped to get it into Emacs, and let old
help die out :). It won't happen so the next best thing is to re-implement Helpful
in terms of Emacs built-in features, i.e. bring Helpful features (not the source
code) to built-in *Help* buffers. At least some of them.
> Other than that I can only say that this is _one_ possible option for
> showing the source of the code. BTW, we should decide on a suitable
> interface for 'help-toggle-source-view' probably using the button for
> showing the code.
Yes, I had my thoughts to propertize the "Source Code:" string in help buffer to
act similar as other link (or buttons as they are called in Emacs), but I just
haven't got to that yet. Also until there is any decision to use
'help-toggle-source-view' as an API, it can wait for a bit; but generally yes,
it should be another help-xref button.
I have also explicitly coded it so it can be used from any buffer, so user does
not need to switch to a help buffer to toggle the source view on/off. I see it
as a feature that help does not switch my cursor to help buffer by default :).
Thank you for your input Martin, that was really helpful. Some pun unavaoided
here :).
next prev parent reply other threads:[~2021-09-21 18:56 UTC|newest]
Thread overview: 58+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-19 19:50 Patch proposal: display symbol source code in help buffers Arthur Miller
2021-09-20 5:46 ` Lars Ingebrigtsen
2021-09-20 6:09 ` Stefan Kangas
2021-09-20 6:14 ` Lars Ingebrigtsen
2021-09-20 7:17 ` Ihor Radchenko
2021-09-20 7:43 ` Stefan Kangas
2021-09-20 8:29 ` martin rudalics
2021-09-20 9:04 ` Ihor Radchenko
2021-09-20 23:45 ` Arthur Miller
2021-09-21 4:16 ` Lars Ingebrigtsen
2021-09-21 6:59 ` Ihor Radchenko
2021-09-21 7:41 ` Stefan Kangas
2021-09-21 8:38 ` Eli Zaretskii
2021-09-21 9:17 ` Ihor Radchenko
2021-09-21 16:49 ` Lars Ingebrigtsen
2021-10-01 7:05 ` Ihor Radchenko
2021-10-01 7:09 ` Lars Ingebrigtsen
2021-10-01 7:21 ` Ihor Radchenko
2021-10-01 7:21 ` Lars Ingebrigtsen
2021-10-01 9:04 ` Ihor Radchenko
2021-10-01 12:20 ` Lars Ingebrigtsen
2021-10-01 7:24 ` Eli Zaretskii
2021-10-01 9:08 ` Ihor Radchenko
2021-10-01 10:24 ` Eli Zaretskii
2021-10-01 14:14 ` Ihor Radchenko
2021-09-21 8:34 ` martin rudalics
2021-09-20 15:01 ` Arthur Miller
2021-09-21 7:41 ` Stefan Kangas
2021-09-20 15:27 ` Arthur Miller
2021-09-20 6:47 ` Eli Zaretskii
2021-09-20 15:27 ` Arthur Miller
2021-09-20 14:55 ` Arthur Miller
2021-09-21 4:18 ` Lars Ingebrigtsen
2021-09-21 10:26 ` Arthur Miller
2021-09-20 15:23 ` Arthur Miller
2021-09-20 5:59 ` Eli Zaretskii
2021-09-20 6:37 ` Gregor Zattler
2021-09-20 7:01 ` Eli Zaretskii
2021-09-20 15:21 ` Arthur Miller
2021-09-20 8:21 ` martin rudalics
2021-09-20 18:13 ` Arthur Miller
2021-09-21 8:34 ` martin rudalics
2021-09-21 10:24 ` Arthur Miller
2021-09-21 16:52 ` martin rudalics
2021-09-21 18:56 ` Arthur Miller [this message]
2021-09-21 17:30 ` Juri Linkov
2021-09-21 19:13 ` Arthur Miller
2021-09-22 7:49 ` martin rudalics
2021-09-22 16:04 ` Juri Linkov
2021-09-22 17:52 ` martin rudalics
2021-09-23 8:15 ` martin rudalics
2021-09-23 15:52 ` Juri Linkov
2021-09-26 9:10 ` martin rudalics
2021-09-22 22:38 ` Arthur Miller
2021-09-23 8:22 ` martin rudalics
2021-09-20 12:19 ` Dmitry Gutov
2021-09-20 15:13 ` Arthur Miller
2021-09-20 15:11 ` Arthur Miller
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=AM9PR09MB4977EB85ABF94B4A4143004296A19@AM9PR09MB4977.eurprd09.prod.outlook.com \
--to=arthur.miller@live.com \
--cc=emacs-devel@gnu.org \
--cc=rudalics@gmx.at \
/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).