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

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

bug#36187: 27.0.50; M-x timer-list fails for functions with multi-line s


From: Pip Cet
Subject: bug#36187: 27.0.50; M-x timer-list fails for functions with multi-line string representations
Date: Thu, 13 Jun 2019 07:17:17 +0000

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: 0001-Escape-newlines-when-printing-functions-in-timer-lis.patch
Description: Text Data


reply via email to

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