[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
master 68276f6: Support reverting in Customize buffers
From: |
Lars Ingebrigtsen |
Subject: |
master 68276f6: Support reverting in Customize buffers |
Date: |
Mon, 5 Jul 2021 10:56:14 -0400 (EDT) |
branch: master
commit 68276f6d30bbdc09cc26fb49d7f0c3aa4bce35f2
Author: Lars Ingebrigtsen <larsi@gnus.org>
Commit: Lars Ingebrigtsen <larsi@gnus.org>
Support reverting in Customize buffers
* lisp/cus-edit.el (custom--revert-buffer): New function (bug#26871).
(Custom-mode): Set up reversion.
(custom--invocation-options): New variable.
(custom-buffer-create-internal): Set it.
---
etc/NEWS | 3 +++
lisp/cus-edit.el | 11 +++++++++++
2 files changed, 14 insertions(+)
diff --git a/etc/NEWS b/etc/NEWS
index a62e9c8..c3eaf5f 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -1266,6 +1266,9 @@ To revert to the previous behavior,
** Customize
+---
+*** Customize buffers can now be reverted with 'C-x x g'.
+
*** Most customize commands now hide obsolete user options.
Obsolete user options are no longer shown in the listings produced by
the commands 'customize', 'customize-group', 'customize-apropos' and
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index 7627930..a8b2640 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -1665,8 +1665,11 @@ Otherwise use brackets."
'custom-button-pressed
'custom-button-pressed-unraised))))
+(defvar custom--invocation-options nil)
+
(defun custom-buffer-create-internal (options &optional _description)
(Custom-mode)
+ (setq custom--invocation-options options)
(let ((init-file (or custom-file user-init-file)))
;; Insert verbose help at the top of the custom buffer.
(when custom-buffer-verbose-help
@@ -5148,11 +5151,19 @@ if that value is non-nil."
:label (nth 5 arg)))
custom-commands)
(setq custom-tool-bar-map map))))
+ (setq-local custom--invocation-options nil)
+ (setq-local revert-buffer-function #'custom--revert-buffer)
(make-local-variable 'custom-options)
(make-local-variable 'custom-local-buffer)
(custom--initialize-widget-variables)
(add-hook 'widget-edit-functions 'custom-state-buffer-message nil t))
+(defun custom--revert-buffer (_ignore-auto _noconfirm)
+ (unless custom--invocation-options
+ (error "Insufficient data to revert"))
+ (custom-buffer-create custom--invocation-options
+ (buffer-name)))
+
(put 'Custom-mode 'mode-class 'special)
(provide 'cus-edit)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- master 68276f6: Support reverting in Customize buffers,
Lars Ingebrigtsen <=