Skip to content

Commit

Permalink
Always showing global value.
Browse files Browse the repository at this point in the history
NOTE: This is Wilfred#311
  • Loading branch information
haji-ali authored and slotThe committed Oct 5, 2023
1 parent 66ba816 commit 2bc6038
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions helpful.el
Original file line number Diff line number Diff line change
Expand Up @@ -2267,6 +2267,10 @@ state of the current symbol."
(when (not helpful--callable-p)
(helpful--insert-section-break)
(let* ((sym helpful--sym)
(local-p (and
helpful--associated-buffer
(local-variable-p sym helpful--associated-buffer)))
(local-set-p (local-variable-if-set-p sym))
(multiple-views-p
(or (stringp val)
(keymapp val)
Expand All @@ -2283,18 +2287,15 @@ state of the current symbol."
(cond
;; Buffer-local variable and we're looking at the value in
;; a specific buffer.
((and
helpful--associated-buffer
(local-variable-p sym helpful--associated-buffer))
(local-p
(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")
(local-set-p "Global Value")
;; This variable is not buffer-local.
(t "Value")))
(helpful--format-value sym val)
Expand All @@ -2306,6 +2307,13 @@ state of the current symbol."
sym
(car (helpful--original-value sym)))
"\n\n"))
(when (and local-p (not local-set-p))
(insert
(helpful--heading "Global Value")
(helpful--format-value
sym
(helpful--sym-value sym nil))
"\n\n"))
(when multiple-views-p
(insert (helpful--make-toggle-literal-button) " "))

Expand Down

0 comments on commit 2bc6038

Please sign in to comment.