all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ted Zlatanov <tzz@lifelogs.com>
To: Emacs Development <emacs-devel@gnu.org>,
	John Wiegley <jwiegley@gmail.com>
Subject: RFC: omit some variables from custom-save-variables
Date: Fri, 19 Jun 2020 18:41:20 +0000	[thread overview]
Message-ID: <4kr6525r.fsf@lifelogs.com> (raw)

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



             reply	other threads:[~2020-06-19 18:41 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-19 18:41 Ted Zlatanov [this message]
2020-06-19 20:14 ` RFC: omit some variables from custom-save-variables Stefan Monnier
2020-06-19 20:24   ` Ted Zlatanov
2020-06-19 21:26     ` Stefan Monnier
2020-06-22 18:22       ` Ted Zlatanov

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=4kr6525r.fsf@lifelogs.com \
    --to=tzz@lifelogs.com \
    --cc=emacs-devel@gnu.org \
    --cc=jwiegley@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.