all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* RFC: omit some variables from custom-save-variables
@ 2020-06-19 18:41 Ted Zlatanov
  2020-06-19 20:14 ` Stefan Monnier
  0 siblings, 1 reply; 5+ messages in thread
From: Ted Zlatanov @ 2020-06-19 18:41 UTC (permalink / raw)
  To: Emacs Development, John Wiegley

Hello!

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
    :custom
    (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
difference.

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.

Ted

#+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
       (mapatoms
        (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)))))
#+END_SRC



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2020-06-22 18:22 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-06-19 18:41 RFC: omit some variables from custom-save-variables Ted Zlatanov
2020-06-19 20:14 ` Stefan Monnier
2020-06-19 20:24   ` Ted Zlatanov
2020-06-19 21:26     ` Stefan Monnier
2020-06-22 18:22       ` Ted Zlatanov

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.