From 04ab3904eddc01af918fb85b8712cd5d45238468 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 2 Feb 2021 14:39:28 -0500 Subject: [PATCH] * 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. --- lisp/custom.el | 6 +++++- lisp/dired-aux.el | 2 +- lisp/emacs-lisp/package-x.el | 3 +-- lisp/gnus/gnus-art.el | 7 +++---- lisp/startup.el | 2 +- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/lisp/custom.el b/lisp/custom.el index 5e354c4c595..833810718b7 100644 --- a/lisp/custom.el +++ b/lisp/custom.el @@ -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) diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index ec864d54d69..a94bdf5b42e 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -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))) diff --git a/lisp/emacs-lisp/package-x.el b/lisp/emacs-lisp/package-x.el index b723643ffb9..2e327d16de4 100644 --- a/lisp/emacs-lisp/package-x.el +++ b/lisp/emacs-lisp/package-x.el @@ -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: "))) diff --git a/lisp/gnus/gnus-art.el b/lisp/gnus/gnus-art.el index 39b182f2cda..70ededf1ba1 100644 --- a/lisp/gnus/gnus-art.el +++ b/lisp/gnus/gnus-art.el @@ -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
, there's no need for the body boundary. (gnus-treat-body-boundary nil)) diff --git a/lisp/startup.el b/lisp/startup.el index 60e1a200bbd..b173d619733 100644 --- a/lisp/startup.el +++ b/lisp/startup.el @@ -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 -- 2.39.2