Wilfred / helpful

A better Emacs *help* buffer
1.11k stars 62 forks source link

`helpful-variable` doesn't show a "Global Values" toggle for local hooks #242

Open hlissner opened 4 years ago

hlissner commented 4 years ago

When I invoke M-x helpful-variable on any hook variable with a buffer-local value, helpful displays its buffer-local value, but no "Global Value" button to toggle its global value.

image

I find changing this line

https://github.com/Wilfred/helpful/blob/c0662aa07266fe204f4e6d72ccaa6af089400556/helpful.el#L2190

To

        (when (local-variable-if-set-p sym helpful--associated-buffer)

fixes the issue for me, but introduces another: once you toggle the global value of a hook, both "Buffer values" and "Global values" buttons disappear. No way to return to the buffer-local value without invoking helpful-variable from scratch.


Tested on Emacs 26.3 and 27.0.91 in vanilla and Doom Emacs, with the latest commit of helpful (c0662aa07266fe204f4e6d72ccaa6af089400556).

twlz0ne commented 2 years ago

I looked at the latest code and if there is a buffer local value, then the "Global value" will never be displayed:

https://github.com/Wilfred/helpful/blob/60c1cd49f72e930b8796e5644bd222e8fc466740/helpful.el#L2271-L2282

@Wilfred Is there any particular reason for this?

Screenshot_2022-10-31_at_1 16 05_PM

Code to reproduce:

(progn
  (defvar foo '(1))
  (put 'foo 'standard-value (list (list 'quote '(2))))
  (setq-local foo '(3))
  (describe-variable 'foo)
  (helpful-variable 'foo))
haji-ali commented 1 year ago

See #311 for a possible fix.