GNU bug report logs - #40788
28.0.50; Error running timer ‘custom-magic-reset’

Previous Next

Package: emacs;

Reported by: David Ponce <da_vid <at> orange.fr>

Date: Thu, 23 Apr 2020 05:13:02 UTC

Severity: normal

Merged with 41245

Found in versions 27.0.91, 28.0.50

Fixed in version 27.1

Done: Robert Pluim <rpluim <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Robert Pluim <rpluim <at> gmail.com>
To: David PONCE <da_vid <at> orange.fr>
Cc: 40788 <at> debbugs.gnu.org
Subject: bug#40788: 28.0.50; Error running timer ‘custom-magic-reset’
Date: Fri, 24 Apr 2020 13:56:10 +0200
>>>>> On Thu, 23 Apr 2020 19:39:26 +0200 (CEST), David PONCE <da_vid <at> 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)

diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index d3d17fda7a..93012b134f 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -2102,11 +2102,12 @@ custom-magic-value-create
 	(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))
+    (let ((magic (widget-get widget :custom-magic)))
+      (when magic
+        (widget-value-set magic (widget-value magic))))))
 
 ;;; The `custom' Widget.
 
@@ -2217,7 +2218,7 @@ custom-notify
       ;; 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)




This bug report was last modified 4 years and 301 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.