unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier via "Bug reports for GNU Emacs, the Swiss army knife of text editors" <bug-gnu-emacs@gnu.org>
To: Eli Zaretskii <eliz@gnu.org>
Cc: 62300@debbugs.gnu.org
Subject: bug#62300: 29.0.60; No hyperlinks for some symbols in *Help* buffers
Date: Mon, 20 Mar 2023 17:55:40 -0400	[thread overview]
Message-ID: <jwvsfdzglj8.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <83ttyf6ys3.fsf@gnu.org> (Eli Zaretskii's message of "Mon, 20 Mar 2023 20:52:28 +0200")

>>   emacs -Q
>>   C-h f global-text-scale-adjust RET
>> 
>> Observe that in the *Help* buffer the variable
>> global-text-scale-adjust-resizes-frames does not have the link
>> appearance.  This is because:
>> 
>>   (boundp 'global-text-scale-adjust-resizes-frames) => nil

`help-definition-prefixes` and friends
(`help-enable-completion-autoload`, ...) are the result of a tradeoff:
we offer to autoload files "on demand" but the "demand" is often
vague/implicit, so we have to judge when the demand is clear enough to
justify loading a file and when it's not.

If we're too trigger happy, we can end up auto-loading all the .el files
in sight, making Emacs unnecessarily bigger&slower (and increasing the
risk that we bump into a file that breaks the convention, such as
`c-ts-mode`).

In this case, `global-text-scale-adjust` has an explicit autoload in
`loaddefs.el` so we already have the docstring needed to display
`C-h f global-text-scale-adjust RET` without having to load
`face-remap.el`, so `help-enable-completion-autoload` doesn't load
`face-remap.el`.

>> By contrast, if you try
>> 
>>   C-h f text-scale-adjust RET
>> 
>> then the variable text-scale-mode-step in the *Help* buffer does get
>> the link appearance, and boundp returns non-nil for that variable.

Among the prefixes registered for `face-remap.el` there is `text-scale-`
because there are various other functions beside `text-scale-adjust`
which start with `text-scale-`.  I'm not completely sure why we end up
loading `face-remap.el` here (it doesn't seem necessary since the
function is also autoloaded), but this difference in the
definition-prefixes is probably the reason for the difference
in behavior (apparently completion gets involved somewhere even tho
it's not needed).

>>  (radix-tree-prefixes (help-definition-prefixes) "global-text-scale-adjust")
>> 
>> This returns nil, whereas if you do the same with "text-scale-adjust",
>> you get:
>> 
>>   (("text-scale-" "face-remap") ("tex" "flyspell"))
>> 
>> Interestingly, just appending a dash to global-text-scale-adjust, i.e.
>> 
>>  (radix-tree-prefixes (help-definition-prefixes) "global-text-scale-adjust-")

Yup: in `face-remap.el`, all the definitions that aren't known before
the file is loaded (i.e. not autoloaded) and whose name starts with
"global-text-" also start  with "global-text-scale-adjust-", so the
definition-prefixes data registers this longer prefix, which is more
precise.

BTW, this is also related to the part of `C-h f` which loads autoloaded
functions when it sees something like \\< or \\[ (this is controlled by
`help-enable-autoload`).  We could change it so it does it also when it
sees `...' in the docstring.


        Stefan






  reply	other threads:[~2023-03-20 21:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-20 18:34 bug#62300: 29.0.60; No hyperlinks for some symbols in *Help* buffers Eli Zaretskii
2023-03-20 18:52 ` Eli Zaretskii
2023-03-20 21:55   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors [this message]
2023-03-21 13:11     ` Eli Zaretskii
2023-03-21 14:19       ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-21 17:26         ` Eli Zaretskii
2023-03-21 17:59           ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-21 18:23             ` Eli Zaretskii
2023-03-21 19:09               ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-21 19:54                 ` Eli Zaretskii
2023-03-22  1:48                   ` Stefan Monnier via Bug reports for GNU Emacs, the Swiss army knife of text editors
2023-03-22 15:52                     ` Eli Zaretskii

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=jwvsfdzglj8.fsf-monnier+emacs@gnu.org \
    --to=bug-gnu-emacs@gnu.org \
    --cc=62300@debbugs.gnu.org \
    --cc=eliz@gnu.org \
    --cc=monnier@iro.umontreal.ca \
    /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).