emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] master 4c4f970: Provide custom-prompt-customize-unsaved-op


From: Teodor Zlatanov
Subject: [Emacs-diffs] master 4c4f970: Provide custom-prompt-customize-unsaved-options.
Date: Sun, 14 Dec 2014 11:50:38 +0000

branch: master
commit 4c4f970c8d10b346acc6d231f3755c1d1f5827fb
Author: Cameron Desautels <address@hidden>
Commit: Ted Zlatanov <address@hidden>

    Provide custom-prompt-customize-unsaved-options.
    
    * doc/emacs/custom.texi (Saving Customizations): Mention
    `custom-prompt-customize-unsaved-options'.
    
    * etc/NEWS: Mention `custom-prompt-customize-unsaved-options'.
    
    * etc/TODO: Remove its entry.
    
    * lisp/cus-edit.el (custom-prompt-customize-unsaved-options): Add a
    mechanism for prompting user about unsaved customizations.
    (Bug#19328)
---
 doc/emacs/ChangeLog   |    5 +++++
 doc/emacs/custom.texi |   10 ++++++++++
 etc/ChangeLog         |    6 ++++++
 etc/NEWS              |    3 +++
 etc/TODO              |    6 ------
 lisp/ChangeLog        |    6 ++++++
 lisp/cus-edit.el      |   29 +++++++++++++++++++++++------
 7 files changed, 53 insertions(+), 12 deletions(-)

diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog
index 3ed8c13..cd46d9f 100644
--- a/doc/emacs/ChangeLog
+++ b/doc/emacs/ChangeLog
@@ -1,3 +1,8 @@
+2014-12-14  Cameron Desautels  <address@hidden>
+
+       * custom.texi (Saving Customizations): Mention
+       `custom-prompt-customize-unsaved-options'.
+
 2014-12-08  Lars Magne Ingebrigtsen  <address@hidden>
 
        * misc.texi (Network Security): Mention the new protocol-level
diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi
index 0d0013f..6c392cb 100644
--- a/doc/emacs/custom.texi
+++ b/doc/emacs/custom.texi
@@ -405,6 +405,16 @@ customizations in your initialization file.  This is 
because saving
 customizations from such a session would wipe out all the other
 customizations you might have on your initialization file.
 
+  Please note that any customizations you have not chosen to save for
+future sessions will be lost when you terminate Emacs.  If you'd like
+to be prompted about unsaved customizations at termination time, add
+the following to your initialization file:
+
address@hidden
+(add-hook 'kill-emacs-query-functions
+          'custom-prompt-customize-unsaved-options)
address@hidden example
+
 @node Face Customization
 @subsection Customizing Faces
 @cindex customizing faces
diff --git a/etc/ChangeLog b/etc/ChangeLog
index 0a22f9f..f344e24 100644
--- a/etc/ChangeLog
+++ b/etc/ChangeLog
@@ -1,3 +1,9 @@
+2014-12-14  Cameron Desautels  <address@hidden>
+
+       * NEWS: Mention `custom-prompt-customize-unsaved-options'.
+
+       * TODO: Remove its entry.
+
 2014-12-13  Paul Eggert  <address@hidden>
 
        Convert Czech and Slovakian refcards to UTF-8
diff --git a/etc/NEWS b/etc/NEWS
index 01c8431..37cb4b4 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -54,6 +54,9 @@ so if you want to use it, you can always take a copy from an 
older Emacs.
 
 * Changes in Emacs 25.1
 
+** New function `custom-prompt-customize-unsaved-options' checks for
+unsaved customizations and prompts user to customize (if found).
+
 +++
 ** Network security (TLS/SSL certificate validity and the like) is
 added via the new Network Security Manager (NSM) and controlled via
diff --git a/etc/TODO b/etc/TODO
index ccd00e5..cbb2394 100644
--- a/etc/TODO
+++ b/etc/TODO
@@ -419,12 +419,6 @@ rather than interactively.  This a trivial one-liner in 
easy-mode.el.
 
 ** Make byte-optimization warnings issue accurate line numbers.
 
-** A function to check for customizable options that have been
-  set but not saved, and ask the user whether to save them.
-  This could go in kill-emacs-query-functions, to remind people
-  to save their changes. If the user says yes, show them
-  in a Custom buffer using customize-customized.
-
 ** Record the sxhash of the default value for customized variables
   and notify the user (maybe by adding a menu item or toolbar button,
   as the detection can occur during autoload time) when the default
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 75e8476..f97a887 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,9 @@
+2014-12-14  Cameron Desautels  <address@hidden>
+
+       * cus-edit.el (custom-prompt-customize-unsaved-options): Add a
+       mechanism for prompting user about unsaved customizations.
+       (Bug#19328)
+
 2014-12-14  Dmitry Gutov  <address@hidden>
 
        * fringe.el (fringe-bitmap-p): Fix 2014-12-05 breakage.
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index c8e9b90..a6da50e 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -1356,12 +1356,10 @@ suggest to customize that face, if it's customizable."
                                      (or (face-at-point t t) "all faces") t)))
   (customize-face face t))
 
-(defalias 'customize-customized 'customize-unsaved)
-
-;;;###autoload
-(defun customize-unsaved ()
-  "Customize all options and faces set in this session but not saved."
-  (interactive)
+(defun custom-unsaved-options ()
+  "List of options and faces set in this session but not saved.
+Each entry is of the form (SYMBOL TYPE), where TYPE is one of the
+symbols `custom-face' or `custom-variable'."
   (let ((found nil))
     (mapatoms (lambda (symbol)
                (and (or (get symbol 'customized-face)
@@ -1372,6 +1370,15 @@ suggest to customize that face, if it's customizable."
                         (get symbol 'customized-variable-comment))
                     (boundp symbol)
                     (push (list symbol 'custom-variable) found))))
+    found))
+
+(defalias 'customize-customized 'customize-unsaved)
+
+;;;###autoload
+(defun customize-unsaved ()
+  "Customize all options and faces set in this session but not saved."
+  (interactive)
+  (let ((found (custom-unsaved-options)))
     (if (not found)
        (error "No user options are set but unsaved")
       (custom-buffer-create (custom-sort-items found t nil)
@@ -1477,6 +1484,16 @@ If TYPE is `groups', include only groups."
   (interactive (list (apropos-read-pattern "groups")))
   (customize-apropos regexp 'groups))
 
+;;;###autoload
+(defun custom-prompt-customize-unsaved-options ()
+  "Prompt user to customize any unsaved customization options.
+Return non-nil if user chooses to customize, for use in
+`kill-emacs-query-functions'."
+  (not (and (custom-unsaved-options)
+           (yes-or-no-p "Some customized options have not been saved; Examine? 
")
+           (customize-unsaved)
+           t)))
+
 ;;; Buffer.
 
 (defcustom custom-buffer-style 'links



reply via email to

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