[Top][All Lists]

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

RFC: omit some variables from custom-save-variables

From: Ted Zlatanov
Subject: RFC: omit some variables from custom-save-variables
Date: Fri, 19 Jun 2020 18:41:20 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux)


I am proposing a simple way for Emacs packages to use the customize
machinery without forcing the variables to be saved.

A good use case is to let use-package :custom coexist with
cus-edit.el:custom-save-variables. It bothered me yesterday because I
like use-package :custom a lot so I thought I'd propose something :)

Specific example. On the use-package side, something like this:

  (use-package python-mode
    (python-indent-offset 4))

creates python-indent-offset in my custom.el file *and* in the code
above, creating duplication and possible problems if I remove it from
the use-package invocation.

The proposal is for use-package to apply the save-exemptions symbol
property behind the scenes. This is a new symbol property. 

This change has no effect on existing code or customizations so it's a
gentle upgrade. For users with older Emacs versions, there is no

There is no provision in this proposal for channeling Customize UI
interactions into use-package :custom or other places. Users will have
to manually migrate customized variables from the custom.el file, just
like they do now.


#+BEGIN_SRC diff
diff --git i/lisp/cus-edit.el w/lisp/cus-edit.el
index 1ec2708550..308bb9fa0a 100644
--- i/lisp/cus-edit.el
+++ w/lisp/cus-edit.el
@@ -4600,6 +4600,8 @@ custom-save-variables
        (lambda (symbol)
         (if (and (get symbol 'saved-value)
+                 ;; Drop explicitly ignored customizations.
+                 (null (get symbol 'save-exemptions))
                  ;; ignore theme values
                  (or (null (get symbol 'theme-value))
                      (eq 'user (caar (get symbol 'theme-value)))))

reply via email to

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