emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

master 04ab390: * lisp/gnus/gnus-art.el: Fix misuse of `standard-value`.


From: Stefan Monnier
Subject: master 04ab390: * lisp/gnus/gnus-art.el: Fix misuse of `standard-value`.
Date: Tue, 2 Feb 2021 14:39:33 -0500 (EST)

branch: master
commit 04ab3904eddc01af918fb85b8712cd5d45238468
Author: Stefan Monnier <monnier@iro.umontreal.ca>
Commit: Stefan Monnier <monnier@iro.umontreal.ca>

    * 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 5e354c4..8338107 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 ec864d5..a94bdf5 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 b723643..2e327d1 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 39b182f..70ededf 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 <hr>, there's no need for the body boundary.
          (gnus-treat-body-boundary nil))
diff --git a/lisp/startup.el b/lisp/startup.el
index 60e1a20..b173d61 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



reply via email to

[Prev in Thread] Current Thread [Next in Thread]