* lisp/gnus/gnus-art.el: Fix misuse of standard-value.

* lisp/custom.el (custom--standard-value): New function.

* lisp/gnus/gnus-art.el: (gnus-article-browse-html-parts)
(gnus-article-browse-html-article):
* lisp/dired-aux.el (dired-do-find-regexp-and-replace):
* lisp/emacs-lisp/package-x.el (package-upload-buffer-internal):
* lisp/startup.el (command-line): Use it.
This commit is contained in:
Stefan Monnier 2021-02-02 14:39:28 -05:00
parent c2b3a1d414
commit 04ab3904ed
5 changed files with 11 additions and 9 deletions

View file

@ -350,7 +350,7 @@ for more information."
;; if you need to recompile all the Lisp files using interpreted code.
`(custom-declare-variable
',symbol
,(if lexical-binding ;FIXME: This is not reliable, but is all we have.
,(if lexical-binding
;; The STANDARD arg should be an expression that evaluates to
;; the standard value. The use of `eval' for it is spread
;; over many different places and hence difficult to
@ -627,6 +627,10 @@ property, or (ii) an alias for another customizable variable."
(or (get variable 'standard-value)
(get variable 'custom-autoload))))
(defun custom--standard-value (variable)
"Return the standard value of VARIABLE."
(eval (car (get variable 'standard-value)) t))
(define-obsolete-function-alias 'user-variable-p 'custom-variable-p "24.3")
(defun custom-note-var-changed (variable)

View file

@ -3148,7 +3148,7 @@ REGEXP should use constructs supported by your local `grep' command."
(with-current-buffer
(let ((xref-show-xrefs-function
;; Some future-proofing (bug#44905).
(eval (car (get 'xref-show-xrefs-function 'standard-value)))))
(custom--standard-value 'xref-show-xrefs-function)))
(dired-do-find-regexp from))
(xref-query-replace-in-results from to)))

View file

@ -182,8 +182,7 @@ if it exists."
;; Check if `package-archive-upload-base' is valid.
(when (or (not (stringp package-archive-upload-base))
(equal package-archive-upload-base
(car-safe
(get 'package-archive-upload-base 'standard-value))))
(custom--standard-value 'package-archive-upload-base)))
(setq package-archive-upload-base
(read-directory-name
"Base directory for package archive: ")))

View file

@ -3010,8 +3010,7 @@ message header will be added to the bodies of the \"text/html\" parts."
(when header
(article-decode-encoded-words)
(let ((gnus-visible-headers
(or (get 'gnus-visible-headers 'standard-value)
gnus-visible-headers)))
(custom--standard-value 'gnus-visible-headers)))
(article-hide-headers))
(goto-char (point-min))
(search-forward "\n\n" nil 'move)
@ -3045,8 +3044,8 @@ images if any to the browser, and deletes them when exiting the group
(interactive "P")
(if arg
(gnus-summary-show-article)
(let ((gnus-visible-headers (or (get 'gnus-visible-headers 'standard-value)
gnus-visible-headers))
(let ((gnus-visible-headers
(custom--standard-value 'gnus-visible-headers))
(gnus-mime-display-attachment-buttons-in-header nil)
;; As we insert a <hr>, there's no need for the body boundary.
(gnus-treat-body-boundary nil))

View file

@ -1386,7 +1386,7 @@ please check its value")
(equal user-mail-address
(let (mail-host-address)
(ignore-errors
(eval (car (get 'user-mail-address 'standard-value))))))
(custom--standard-value 'user-mail-address))))
(custom-reevaluate-setting 'user-mail-address))
;; If parameter have been changed in the init file which influence