[Top][All Lists]

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

bug#19328: [PATCH] Add mechanism to prompt about unsaved customizations

From: Drew Adams
Subject: bug#19328: [PATCH] Add mechanism to prompt about unsaved customizations
Date: Thu, 11 Dec 2014 18:48:48 -0800 (PST)

> > What about turning something like this on by default?
> I'm not necessarily opposed to it, but I wonder if it's
> sufficiently unintrusive.
> E.g. if you just want to try out a minor mode like global-auto-
> revert-mode, IIUC this will set the var and mark it as
> "set but unsaved", so when you exit, Emacs will prompt you to
> save this setting.
> Maybe it's actually the right thing to do, but I wonder if it will
> turn out to be more annoying than useful.  And I don't see a good
> solution for it.

FWIW, in the version of this feature that I use:

1. You are not asked to save the changes.  You are asked whether
   you want to see the changed options (in Customize).  If/when
   you see them, you can quit or save any or all of them first.

2. There are some ways to deal with changes that you don't care
   about.  From the `cus-edit+.el' file header:

;;  Dealing with Spurious Changes, 1: Save
;;  --------------------------------------
;;  Even if you don't change any preferences yourself, when
;;  you quit Emacs the first time you are informed that
;;  there are lots of changed preferences, and you are given
;;  a chance to save those changes.  What are those changes?
;;  They represent all of the user preferences that Emacs
;;  and various Emacs libraries have changed behind
;;  Customize's back - even before you did anything.
;;  You'll see user options like `baud-rate' that are set in
;;  Emacs C code without informing Customize to mark their
;;  settings as `standard' (= installed).  There shouldn't
;;  be any such apparent "changes", since this is part of
;;  standard Emacs, but that's the way it is, for now.
;;  Customize is still fairly new, and lots of Emacs
;;  libraries still define and change user preferences
;;  without going through Customize and, in effect, telling
;;  it not to consider such preference changes as changes.
;;  If you choose to save these preference changes, you will
;;  never again be bothered by being informed that they have
;;  changed (unless you change them).  So, that's one
;;  solution to this bother, which makes it a one-time only
;;  nuisance: just say "save all".
;;  Dealing with Spurious Changes, 2: Ignore
;;  ----------------------------------------
;;  Another solution is also possible.  Some user
;;  preferences, like `case-fold-search' and
;;  `debug-on-error' are really the kind of thing that you
;;  change often and temporarily - you don't really care
;;  about saving their changes, and you certainly don't want
;;  to be asked whether or not you want to save them each
;;  time you quit Emacs.
;;  To deal with that, a list of ignored preferences,
;;  `customize-customized-ignore', is defined here.  Its
;;  preferences (symbols) are not used by
;;  `customize-unsaved' at all (you can override that
;;  interactively with a prefix arg).  So, the other way to
;;  deal with the legacy Emacs preferences, besides just
;;  saving them in your custom file, is to add them to
;;  `customize-customized-ignore' so `customize-unsaved'
;;  will ignore them.
;;  To make it easy for you to add preferences to this
;;  ignore list, `Ignore Unsaved Changes' menu items and
;;  buttons have been added.  You can choose to ignore
;;  specific preferences or all preferences in a Customize
;;  buffer - in particular, all preferences in the Customize
;;  buffer from `customize-unsaved' (all changed
;;  preferences).
;;  Dealing with Spurious Changes, 3: Consider Unchanged
;;  ----------------------------------------------------
;;  There is also a third way to treat preference changes
;;  that you are not responsible for, as an alternative to
;;  saving them to your custom file or having Customize
;;  always ignore them: tell Customize to consider the
;;  current changes as unchanged.  This essentially treats
;;  them as having been saved, but without saving them.  You
;;  can do this using the `Consider Unchanged' menu items
;;  and buttons added here.
;;  For instance, after starting Emacs, you can examine the
;;  current preference changes (using `customize-unsaved')
;;  from Emacs itself and loaded libraries, and choose
;;  `Consider Unchanged' to let Customize know that the
;;  current values are to be treated as if they were saved,
;;  but without actually saving them to your custom file.
;;  That way, your custom file is not polluted with things
;;  that you are not really concerned with, yet you are not
;;  bothered by seeing such fictitious changes show up each
;;  time you check for changes.
;;  However, unlike ignoring changes to certain preferences,
;;  and really saving current preference values, `Consider
;;  Unchanged' is not a persistent change.  You can use it
;;  at any time to "reset" the change counter for given
;;  preferences, so that the current change is considered
;;  the new base value (as if it were saved), and any
;;  further changes you make to them will show up as
;;  changes, using `customize-unsaved'.

And note that in my version it is `customize-unsaved'
itself that is modified, so the advantageous behavior is
available also when that command is used interactively.

reply via email to

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