Function: helpful--set
helpful--set is a byte-compiled function defined in helpful.el.
Signature
(helpful--set BUTTON)
Documentation
Set the value of this symbol.
Source Code
;; Defined in ~/.emacs.d/elpa/helpful-20250408.334/helpful.el
(defun helpful--set (button)
"Set the value of this symbol."
(let* ((sym (button-get button 'symbol))
(buf (button-get button 'buffer))
(sym-value (helpful--sym-value sym buf))
(set-func (if (local-variable-p sym buf)
"setq"
(symbol-name helpful-set-variable-function)))
;; Inspired by `counsel-read-setq-expression'.
(expr
(minibuffer-with-setup-hook
(lambda ()
(add-function :before-until (local 'eldoc-documentation-function)
#'elisp-eldoc-documentation-function)
(run-hooks 'eval-expression-minibuffer-setup-hook)
(goto-char (minibuffer-prompt-end))
(forward-char (length (format "(%s %S " set-func sym))))
(read-from-minibuffer
"Eval: "
(format
(if (or (consp sym-value)
(and (symbolp sym-value)
(not (null sym-value))
(not (keywordp sym-value))))
"(%s %s '%S)"
"(%s %s %S)")
set-func sym sym-value)
read-expression-map t
'read-expression-history))))
(save-current-buffer
;; If this is a buffer-local variable, ensure we're in the right
;; buffer.
(when buf
(set-buffer buf))
(eval-expression expr))
(helpful-update)))