bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#41473: Not saving all user options


From: Philip K.
Subject: bug#41473: Not saving all user options
Date: Fri, 26 Jun 2020 21:59:51 +0200

> I don't see any.  Regarding your suggestions in particular, I think
> the plist method would be the cleanest.  Four spaces strikes me as
> overly cryptic.

The patch below should implement that behaviour. The property
"custom-inhibit-save" doesn't seem to be used anywhere else, so that
should be OK.

-- 
        Philip K.

>From 07097f7bb79e5014ceafcb02563c173938e079bc Mon Sep 17 00:00:00 2001
From: Philip K <philip@warpmail.net>
Date: Fri, 26 Jun 2020 21:54:36 +0200
Subject: [PATCH] Allow inhibiting a user option from being saved

---
 lisp/cus-edit.el | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index 1ec2708550..6bd11908ce 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -4594,17 +4594,19 @@ custom-save-variables
   (save-excursion
     (custom-save-delete 'custom-set-variables)
     (let ((standard-output (current-buffer))
-         (saved-list (make-list 1 0))
-         sort-fold-case)
+         saved-list sort-fold-case)
       ;; First create a sorted list of saved variables.
       (mapatoms
        (lambda (symbol)
-        (if (and (get symbol 'saved-value)
-                 ;; ignore theme values
-                 (or (null (get symbol 'theme-value))
-                     (eq 'user (caar (get symbol 'theme-value)))))
-            (nconc saved-list (list symbol)))))
-      (setq saved-list (sort (cdr saved-list) 'string<))
+        (when (and (get symbol 'saved-value)
+                   ;; ignore theme values
+                   (or (null (get symbol 'theme-value))
+                       (eq 'user (caar (get symbol 'theme-value))))
+                    ;; don't save comments if the symbol as a non-nil
+                    ;; value for it's `custom-inhibit-save' property
+                    (not (get symbol 'custom-inhibit-save)))
+          (push symbol saved-list))))
+      (setq saved-list (sort saved-list 'string<))
       (unless (bolp)
        (princ "\n"))
       (princ "(custom-set-variables
-- 
2.20.1


reply via email to

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