From e68b715772834050960289e8ef7fecd86d1c8fe3 Mon Sep 17 00:00:00 2001 From: Alan Mackenzie Date: Wed, 15 Oct 2014 15:23:27 +0000 Subject: [PATCH] cus-edit.el (custom-command-apply): Specify the return value in the doc string. (Custom-reset-standard): Save custom-file (e.g. .emacs) only when custom-command-apply has returned non-nil. --- lisp/ChangeLog | 7 +++++++ lisp/cus-edit.el | 21 +++++++++++---------- 2 files changed, 18 insertions(+), 10 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7e09336183c..6b0c8a67b79 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,10 @@ +2014-10-15 Alan Mackenzie + + * cus-edit.el (custom-command-apply): Specify the return value in + the doc string. + (Custom-reset-standard): Save custom-file (e.g. .emacs) only when + custom-command-apply has returned non-nil. + 2014-10-15 Stefan Monnier * emacs-lisp/lisp.el (lisp--local-variables-1): Handle `quote'. diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index b54898a171c..c8e9b90437d 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el @@ -779,7 +779,8 @@ when the action is chosen.") "Call function FUN on all widgets in `custom-options'. If there is more than one widget, ask user for confirmation using the query string QUERY, using `y-or-n-p' if STRONG-QUERY is nil, -and `yes-or-no-p' otherwise." +and `yes-or-no-p' otherwise. Return non-nil if the functionality +has been executed, nil otherwise." (if (or (and (= 1 (length custom-options)) (memq (widget-type (car custom-options)) '(custom-variable custom-face))) @@ -892,16 +893,16 @@ making them as if they had never been customized at all." ;; Bind these temporarily. (let ((custom-reset-standard-variables-list '(t)) (custom-reset-standard-faces-list '(t))) - (custom-command-apply - (lambda (widget) - (and (or (null (widget-get widget :custom-standard-value)) - (widget-apply widget :custom-standard-value)) - (memq (widget-get widget :custom-state) - '(modified set changed saved rogue)) - (widget-apply widget :custom-mark-to-reset-standard))) - "The settings will revert to their default values, in this + (if (custom-command-apply + (lambda (widget) + (and (or (null (widget-get widget :custom-standard-value)) + (widget-apply widget :custom-standard-value)) + (memq (widget-get widget :custom-state) + '(modified set changed saved rogue)) + (widget-apply widget :custom-mark-to-reset-standard))) + "The settings will revert to their default values, in this and future sessions. Really erase customizations? " t) - (custom-reset-standard-save-and-update))) + (custom-reset-standard-save-and-update)))) ;;; The Customize Commands -- 2.39.2