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.
This commit is contained in:
parent
a111978de8
commit
68276f6d30
2 changed files with 14 additions and 0 deletions
3
etc/NEWS
3
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
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue