* bug#36187: 27.0.50; M-x timer-list fails for functions with multi-line string representations
@ 2019-06-13 7:17 Pip Cet
2019-06-13 12:11 ` Lars Ingebrigtsen
0 siblings, 1 reply; 2+ messages in thread
From: Pip Cet @ 2019-06-13 7:17 UTC (permalink / raw)
To: 36187
[-- Attachment #1: Type: text/plain, Size: 1500 bytes --]
The timer list fails to deal with functions that cl-prin1-to-string
represents in multiple lines, such as those containing newlines in
strings. (This happens for process sentinels, as well as for closures
with the right bound variables).
Evaluate in *scratch*:
(run-with-timer 0 1 (lambda () (message "tick\ntock")))
Then run M-x timer-list and attempt to cancel the new timer; doing so on
the first line of the representation fails, on the second line of the
representation the cancellation succeeds but leaves the timer list in a
broken state.
The attached one-liner patch fixes things.
* timer-list.el (list-timers): bind `print-escape-newlines' to avoid
newlines in printed representation.
---
lisp/emacs-lisp/timer-list.el | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lisp/emacs-lisp/timer-list.el b/lisp/emacs-lisp/timer-list.el
index 55aa56b72e..adfc225022 100644
--- a/lisp/emacs-lisp/timer-list.el
+++ b/lisp/emacs-lisp/timer-list.el
@@ -59,7 +59,8 @@ list-timers
(format "%s" repeat))))
;; Function.
(let ((cl-print-compiled 'static)
- (cl-print-compiled-button nil))
+ (cl-print-compiled-button nil)
+ (print-escape-newlines t))
(cl-prin1-to-string (aref timer 5)))))
(put-text-property (line-beginning-position)
(1+ (line-beginning-position))
[-- Attachment #2: 0001-Escape-newlines-when-printing-functions-in-timer-lis.patch --]
[-- Type: text/x-patch, Size: 1133 bytes --]
From 696bc181b55df2bac106a97fb5ec8cf902f80bcd Mon Sep 17 00:00:00 2001
From: Pip Cet <pipcet@gmail.com>
Date: Thu, 13 Jun 2019 07:13:08 +0000
Subject: [PATCH] Escape newlines when printing functions in timer list.
* timer-list.el (list-timers): bind `print-escape-newlines' to avoid
newlines in printed representation.
---
lisp/emacs-lisp/timer-list.el | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/lisp/emacs-lisp/timer-list.el b/lisp/emacs-lisp/timer-list.el
index 55aa56b72e..adfc225022 100644
--- a/lisp/emacs-lisp/timer-list.el
+++ b/lisp/emacs-lisp/timer-list.el
@@ -59,7 +59,8 @@ list-timers
(format "%s" repeat))))
;; Function.
(let ((cl-print-compiled 'static)
- (cl-print-compiled-button nil))
+ (cl-print-compiled-button nil)
+ (print-escape-newlines t))
(cl-prin1-to-string (aref timer 5)))))
(put-text-property (line-beginning-position)
(1+ (line-beginning-position))
--
2.20.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-06-13 12:11 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-06-13 7:17 bug#36187: 27.0.50; M-x timer-list fails for functions with multi-line string representations Pip Cet
2019-06-13 12:11 ` Lars Ingebrigtsen
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).