Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
hlissner opened this issue May 26, 2020 · 2 comments
Open

Comments

@hlissner
Copy link

hlissner commented May 26, 2020

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

(when (local-variable-if-set-p sym)

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 (c0662aa).

@twlz0ne
Copy link

twlz0ne commented Nov 1, 2022

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

helpful/helpful.el

Lines 2271 to 2282 in 60c1cd4

((and
helpful--associated-buffer
(local-variable-p sym helpful--associated-buffer))
(format "Value in %s"
(helpful--button
(format "#<buffer %s>" (buffer-name helpful--associated-buffer))
'helpful-buffer-button
'buffer helpful--associated-buffer
'position pos)))
;; Buffer-local variable but default/global value.
((local-variable-if-set-p sym)
"Global Value")

@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
Copy link

See #311 for a possible fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants