bug-gnu-emacs
[Top][All Lists]
Advanced

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

bug#40788: 28.0.50; Error running timer ‘custom-magic-reset’


From: David Ponce
Subject: bug#40788: 28.0.50; Error running timer ‘custom-magic-reset’
Date: Fri, 24 Apr 2020 17:56:42 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.7.0

On 24/04/2020 13:56, Robert Pluim wrote:
On Thu, 23 Apr 2020 19:39:26 +0200 (CEST), David PONCE <da_vid@orange.fr> said:

     David> Hello again,
     David> Below is a possible patch that seems to have fixed the issue for me.
     David> But I am not sure the approach is correct

Rather than defining a new function, you can add an argument to the
existing one. Something like (untested)

Hi Robert,

Sure, your patch is better :-)
I tested it, and I confirm it fixes the issue :-)
I also tested the below variant, because it seems to me that it is not
necessary to set the buffer when magic is nil, as there is nothing to do.

Please feel free to apply which version looks better to you.
Thanks!

diff --git a/home/dponce/installs/emacs/lisp/cus-edit.el b/cus-edit.el
index d3d17fd..490d905 100644
--- a/home/dponce/installs/emacs/lisp/cus-edit.el
+++ b/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 
(current-buffer))
       (apply 'widget-default-notify widget args))))
(defun custom-redraw (widget)





reply via email to

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