GNU bug report logs -
#40788
28.0.50; Error running timer ‘custom-magic-reset’
Previous Next
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.
To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 40788 in the body.
You can then email your comments to 40788 AT debbugs.gnu.org in the normal way.
Toggle the display of automated, internal messages from the tracker.
Report forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#40788
; Package
emacs
.
(Thu, 23 Apr 2020 05:13:02 GMT)
Full text and
rfc822 format available.
Acknowledgement sent
to
David Ponce <da_vid <at> orange.fr>
:
New bug report received and forwarded. Copy sent to
bug-gnu-emacs <at> gnu.org
.
(Thu, 23 Apr 2020 05:13:02 GMT)
Full text and
rfc822 format available.
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
Hello,
Here is the recipe for an error I encounter when using customize with
2 windows in the same frame:
emacs -Q
M-x pop-to-buffer RET *Message*
M-x customize-variable RET blink-cursor-alist
At this point the *scratch* buffer is on top window and the customize
buffer on bottom.
Click on 'INS' button and insert a new Key/Value pair
Clict on 'State' button, then 'Set for Current Session'
Then click somewhere in the *scratch* buffer, then click on the 'DEL'
button in the customize buffer to delete the value previously entered.
At this point custom try to redraw the 'State' button in the *scratch*
buffer instead of the customize buffer! In this case, because the
*scratch* buffer is shorter than the position of the State button, it
fails with the error:
Error running timer ‘custom-magic-reset’: (args-out-of-range #<buffer
*scratch*> #<marker (moves after insertion) at 287 in *Customize Option:
Blink Cursor Alist*> #<marker at 294 in *Customize Option: Blink Cursor
Alist*>)
This error can be severe because, if in place of the *scratch* buffer
you were editing a file big enough to include the position of the 'State'
button, the 'State' button is drawn in your file without you realizing it!
And if you ever realize it, this change cannot be undone!
Thanks!
In GNU Emacs 28.0.50 (build 32, x86_64-pc-linux-gnu, GTK+ Version 3.24.13, cairo version 1.16.0)
of 2020-04-23 built
Repository revision: 7b15cc3ebb45e50ac5faf3bbc2a813afffdaa418
Repository branch: master
Windowing system distributor 'Fedora Project', version 11.0.12006000
System Description: Fedora 31 (KDE Plasma)
Recent messages:
Mark set
Creating customization items...
Creating customization items ...done
Creating customization setup...done
Mark set
Beginning of buffer
Mark set [2 times]
scroll-up-command: End of buffer
Configured using:
'configure --prefix=/home/dponce --with-cairo
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig'
Configured features:
XPM JPEG TIFF GIF PNG RSVG CAIRO SOUND DBUS GSETTINGS GLIB NOTIFY
INOTIFY LIBSELINUX GNUTLS LIBXML2 FREETYPE HARFBUZZ M17N_FLT LIBOTF ZLIB
TOOLKIT_SCROLL_BARS GTK3 X11 XDBE XIM MODULES THREADS LIBSYSTEMD JSON
PDUMPER LCMS2 GMP
Important settings:
value of $LC_TIME: fr_FR.utf8
value of $LANG: fr_FR.UTF-8
locale-coding-system: utf-8-unix
Major mode: Messages
Minor modes in effect:
tooltip-mode: t
global-eldoc-mode: t
electric-indent-mode: t
mouse-wheel-mode: t
tool-bar-mode: t
menu-bar-mode: t
file-name-shadow-mode: t
global-font-lock-mode: t
font-lock-mode: t
blink-cursor-mode: t
auto-composition-mode: t
auto-encryption-mode: t
auto-compression-mode: t
buffer-read-only: t
line-number-mode: t
transient-mark-mode: t
Load-path shadows:
None found.
Features:
(shadow sort mail-extr emacsbug message rmc puny dired dired-loaddefs
format-spec rfc822 mml mml-sec password-cache epa derived epg epg-config
gnus-util rmail rmail-loaddefs text-property-search mm-decode mm-bodies
mm-encode mail-parse rfc2231 mailabbrev gmm-utils mailheader sendmail
rfc2047 rfc2045 ietf-drums mm-util mail-prsvr mail-utils vc-git
diff-mode easy-mmode bug-reference eieio-opt cl-extra seq speedbar
ezimage dframe cl-print debug backtrace find-func cus-theme eieio-custom
cl-seq eieio byte-opt bytecomp byte-compile cconv eieio-core cl-macs gv
eieio-loaddefs wid-browse tree-widget thingatpt help-fns radix-tree
help-mode cus-edit easymenu cus-start cus-load wid-edit time-date subr-x
cl-loaddefs cl-lib tooltip eldoc electric uniquify ediff-hook vc-hooks
lisp-float-type mwheel term/x-win x-win term/common-win x-dnd tool-bar
dnd fontset image regexp-opt fringe tabulated-list replace newcomment
text-mode elisp-mode lisp-mode prog-mode register page tab-bar menu-bar
rfn-eshadow isearch timer select scroll-bar mouse jit-lock font-lock
syntax facemenu font-core term/tty-colors frame minibuffer cl-generic
cham georgian utf-8-lang misc-lang vietnamese tibetan thai tai-viet lao
korean japanese eucjp-ms cp51932 hebrew greek romanian slovak czech
european ethiopic indian cyrillic chinese composite charscript charprop
case-table epa-hook jka-cmpr-hook help simple abbrev obarray
cl-preloaded nadvice loaddefs button faces cus-face macroexp files
text-properties overlay sha1 md5 base64 format env code-pages mule
custom widget hashtable-print-readable backquote threads dbusbind
inotify lcms2 dynamic-setting system-font-setting font-render-setting
cairo move-toolbar gtk x-toolkit x multi-tty make-network-process emacs)
Memory information:
((conses 16 98994 16077)
(symbols 48 10003 1)
(strings 32 26548 2003)
(string-bytes 1 811951)
(vectors 16 14342)
(vector-slots 8 182195 11344)
(floats 8 43 119)
(intervals 56 4061 0)
(buffers 992 16))
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#40788
; Package
emacs
.
(Thu, 23 Apr 2020 17:40:02 GMT)
Full text and
rfc822 format available.
Message #8 received at 40788 <at> debbugs.gnu.org (full text, mbox):
Hello again,
Below is a possible patch that seems to have fixed the issue for me.
But I am not sure the approach is correct
Thanks!
diff --git a/installs/emacs/lisp/cus-edit.el b/emacs.d/cus-edit.el
index d3d17fd..eec7ef0 100644
--- a/installs/emacs/lisp/cus-edit.el
+++ b/emacs.d/cus-edit.el
@@ -2217,9 +2217,16 @@ 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-async (current-buffer) widget)
(apply 'widget-default-notify widget args))))
+(defun custom-magic-reset-async (buffer widget)
+ "Redraw the :custom-magic property of WIDGET.
+Called asynchronously thru an idle timer, ensure redrawing will happen in the
+origin custom BUFFER."
+ (set-buffer buffer)
+ (custom-magic-reset widget))
+
(defun custom-redraw (widget)
"Redraw WIDGET with current settings."
(let ((line (count-lines (point-min) (point)))
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#40788
; Package
emacs
.
(Fri, 24 Apr 2020 11:57:01 GMT)
Full text and
rfc822 format available.
Message #11 received at 40788 <at> debbugs.gnu.org (full text, mbox):
>>>>> 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)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#40788
; Package
emacs
.
(Fri, 24 Apr 2020 15:57:02 GMT)
Full text and
rfc822 format available.
Message #14 received at 40788 <at> debbugs.gnu.org (full text, mbox):
On 24/04/2020 13:56, Robert Pluim wrote:
>>>>>> 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)
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)
Merged 40788 41245.
Request was from
Robert Pluim <rpluim <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Tue, 21 Jul 2020 08:30:02 GMT)
Full text and
rfc822 format available.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#40788
; Package
emacs
.
(Tue, 21 Jul 2020 08:40:01 GMT)
Full text and
rfc822 format available.
Message #19 received at 40788 <at> debbugs.gnu.org (full text, mbox):
>>>>> On Fri, 24 Apr 2020 17:56:42 +0200, David Ponce <da_vid <at> orange.fr> said:
David> On 24/04/2020 13:56, Robert Pluim wrote:
>>>>>>> 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)
David> Hi Robert,
David> Sure, your patch is better :-)
David> I tested it, and I confirm it fixes the issue :-)
David> I also tested the below variant, because it seems to me that it is not
David> necessary to set the buffer when magic is nil, as there is nothing to do.
David> Please feel free to apply which version looks better to you.
David> Thanks!
Thanks for testing. Eli, would this be OK to go into emacs-27 ? The
bug causes unintended changes to buffers unrelated to customize.
David> diff --git a/home/dponce/installs/emacs/lisp/cus-edit.el b/cus-edit.el
David> index d3d17fd..490d905 100644
David> --- a/home/dponce/installs/emacs/lisp/cus-edit.el
David> +++ b/cus-edit.el
David> @@ -2102,11 +2102,12 @@ and `face'."
David> (insert " "))
David> (widget-put widget :children children))))
David> -(defun custom-magic-reset (widget)
David> +(defun custom-magic-reset (widget &optional buffer)
David> "Redraw the :custom-magic property of WIDGET."
David> (let ((magic (widget-get widget :custom-magic)))
David> (when magic
David> - (widget-value-set magic (widget-value magic)))))
David> + (with-current-buffer (or buffer (current-buffer))
David> + (widget-value-set magic (widget-value magic))))))
David> ;;; The `custom' Widget.
David> @@ -2217,7 +2218,7 @@ and `face'."
David> ;; commands like `M-u' (that work on a region in the buffer)
David> ;; will upcase the wrong part of the buffer, since more text has
David> ;; been inserted before point.
David> - (run-with-idle-timer 0.0 nil #'custom-magic-reset widget)
David> + (run-with-idle-timer 0.0 nil #'custom-magic-reset widget (current-buffer))
David> (apply 'widget-default-notify widget args))))
David> (defun custom-redraw (widget)
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#40788
; Package
emacs
.
(Tue, 21 Jul 2020 14:21:01 GMT)
Full text and
rfc822 format available.
Message #22 received at 40788 <at> debbugs.gnu.org (full text, mbox):
> From: Robert Pluim <rpluim <at> gmail.com>
> Date: Tue, 21 Jul 2020 10:39:26 +0200
> Cc: 40788 <at> debbugs.gnu.org
>
> David> Please feel free to apply which version looks better to you.
> David> Thanks!
>
> Thanks for testing. Eli, would this be OK to go into emacs-27 ? The
> bug causes unintended changes to buffers unrelated to customize.
Yes, OK.
Thanks.
Information forwarded
to
bug-gnu-emacs <at> gnu.org
:
bug#40788
; Package
emacs
.
(Tue, 21 Jul 2020 14:41:01 GMT)
Full text and
rfc822 format available.
Message #25 received at 40788 <at> debbugs.gnu.org (full text, mbox):
>>>>> On Tue, 21 Jul 2020 17:20:11 +0300, Eli Zaretskii <eliz <at> gnu.org> said:
>> From: Robert Pluim <rpluim <at> gmail.com>
>> Date: Tue, 21 Jul 2020 10:39:26 +0200
>> Cc: 40788 <at> debbugs.gnu.org
>>
David> Please feel free to apply which version looks better to you.
David> Thanks!
>>
>> Thanks for testing. Eli, would this be OK to go into emacs-27 ? The
>> bug causes unintended changes to buffers unrelated to customize.
Eli> Yes, OK.
Done as 4db3235fd8
Closing.
Thanks
Robert
bug marked as fixed in version 27.1, send any further explanations to
40788 <at> debbugs.gnu.org and David Ponce <da_vid <at> orange.fr>
Request was from
Robert Pluim <rpluim <at> gmail.com>
to
control <at> debbugs.gnu.org
.
(Tue, 21 Jul 2020 14:41:02 GMT)
Full text and
rfc822 format available.
bug archived.
Request was from
Debbugs Internal Request <help-debbugs <at> gnu.org>
to
internal_control <at> debbugs.gnu.org
.
(Wed, 19 Aug 2020 11:24:06 GMT)
Full text and
rfc822 format available.
This bug report was last modified 3 years and 243 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.