all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Philip K." <philip@warpmail.net>
To: npostavs@gmail.com
Cc: 41473@debbugs.gnu.org
Subject: bug#41473: Not saving all user options
Date: Fri, 26 Jun 2020 21:59:51 +0200	[thread overview]
Message-ID: <87ftahtx6w.fsf@warpmail.net> (raw)
In-Reply-To: 85367iu983.fsf@gmail.com

[-- Attachment #1: Type: text/plain, Size: 321 bytes --]


> 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.


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-Allow-inhibiting-a-user-option-from-being-saved.patch --]
[-- Type: text/x-diff, Size: 1591 bytes --]

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


  parent reply	other threads:[~2020-06-26 19:59 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <87sgfrxekc.fsf@warpmail.net>
2020-05-29 14:06 ` bug#41473: Not saving all user options Noam Postavsky
2020-06-26 19:59 ` Philip K. [this message]
2020-06-27  7:17   ` Eli Zaretskii
2020-06-27  8:21     ` Philip K.
2020-06-27  8:48       ` Eli Zaretskii
2020-06-27  9:03         ` Philip K.
2020-06-27  9:23           ` Eli Zaretskii

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ftahtx6w.fsf@warpmail.net \
    --to=philip@warpmail.net \
    --cc=41473@debbugs.gnu.org \
    --cc=npostavs@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.