[Top][All Lists]

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

emacs-27 4db3235: Run custom-magic-reset in the customize buffer

From: Robert Pluim
Subject: emacs-27 4db3235: Run custom-magic-reset in the customize buffer
Date: Tue, 21 Jul 2020 10:39:11 -0400 (EDT)

branch: emacs-27
commit 4db3235fd8a99f20de414372524948982b23d1fc
Author: Robert Pluim <rpluim@gmail.com>
Commit: Robert Pluim <rpluim@gmail.com>

    Run custom-magic-reset in the customize buffer
    If the user has navigated away from the customize buffer, then
    clicking on a widget in the customize buffer applies changes in the
    selected buffer rather than in the customize buffer.  Pass the
    customize buffer to 'custom-magic-reset' to avoid this.
    * lisp/cus-edit.el (custom-magic-reset): Add optional buffer argument,
    apply changes in that buffer.
    (custom-notify): Pass the buffer containing the widget to
    'custom-magic-reset'.  (Bug#40788)
 lisp/cus-edit.el | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index d3d17fd..490d905 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -2102,11 +2102,12 @@ and `face'."
        (insert " "))
       (widget-put widget :children children))))
-(defun custom-magic-reset (widget)
+(defun custom-magic-reset (widget &optional buffer)
   "Redraw the :custom-magic property of WIDGET."
   (let ((magic (widget-get widget :custom-magic)))
     (when magic
-      (widget-value-set magic (widget-value magic)))))
+      (with-current-buffer (or buffer (current-buffer))
+        (widget-value-set magic (widget-value magic))))))
 ;;; The `custom' Widget.
@@ -2217,7 +2218,7 @@ and `face'."
       ;; commands like `M-u' (that work on a region in the buffer)
       ;; will upcase the wrong part of the buffer, since more text has
       ;; been inserted before point.
-      (run-with-idle-timer 0.0 nil #'custom-magic-reset widget)
+      (run-with-idle-timer 0.0 nil #'custom-magic-reset widget 
       (apply 'widget-default-notify widget args))))
 (defun custom-redraw (widget)

reply via email to

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