bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#60587: Patch for adding links to symbols' help documentation


From: H. Dieter Wilhelm
Subject: bug#60587: Patch for adding links to symbols' help documentation
Date: Wed, 15 Feb 2023 23:18:17 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Stefan Monnier <monnier@iro.umontreal.ca> writes:

>> +(define-minor-mode info-links-to-help-mode
>> +  "The mode creates buttons on symbols linking to their documentation 
>> string.
>> +It shows their documentation in a *Help* buffers (in another
>> +window) when typing <RET> or clicking `mouse-2' on the buttons.
>> +These can be followed, as the regular Info manual references,
>> +with \\[Info-next-reference] and \\[Info-prev-reference].
>> +
>> +For details about which symbols are considered and the linking
>> +process itself please see the function `info-make-links-to-help'."
>> +  :init-value nil
>> +  :lighter " Hlp"
>> +  :group 'info
>> +  :version "30.1"
>> +  (if info-links-to-help-mode
>> +      (progn
>> +        (if (eq major-mode 'Info-mode)
>> +            ;; we need this under Info-mode because of the narrowed
>> +            ;; Info file
>> +            (add-hook 'Info-selection-hook 'info-make-links-to-help))
>> +        (info-make-links-to-help))      ;for the current buffer
>
> The above `define-minor-mode` still defines a buffer-local minor mode

I thought a minor mode is necessary when 'info-make-links-to-help' is
supposed to work for arbitrary major modes and buffers besides Info.

> whereas the above `add-hook` is still global and hence affects all
> buffers.

I'm not sure I understand, it affects only Info buffers globally (eq
major-mode 'Info-mode).  Do you think it is better to use a global minor
mode for all Info buffers and a separate buffer local mode for other
buffers (and major modes)?

> This is a recipe for inconsistent behavior.
  
>> +;; Activate the mode for all Info buffers
>> +(add-hook 'Info-mode-hook 'info-links-to-help-mode)
>
> Better add a call to `info-links-to-help-mode` directly inside
> `Info-mode`.

(Please tell me why are you quoting with two grave accents and not with
apostrophes?)

Do you think setting

(defcustom Info-mode-hook '(turn-on-font-lock info-links-to-help-mode)
  "Hook run when activating Info Mode."
  :type 'hook
  :version "29.1")

is a possible alternative to call it into 'Info-mode'?

-- 
Thank you

      Dieter

Best wishes
H. Dieter Wilhelm
Zwingenberg, Germany





reply via email to

[Prev in Thread] Current Thread [Next in Thread]