summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2022-03-04 12:18:41 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2022-03-04 12:18:41 -0500
commit6ad223fa9f0d30f321dea90f2228873d166003bb (patch)
treeb63252cab2d1c2b8b9740d70e0f648a365d644de /lisp/emacs-lisp
parent5f7db63a93f0c670d6f88dd24f922462abce7d8c (diff)
downloademacs-6ad223fa9f0d30f321dea90f2228873d166003bb.tar.gz
emacs-6ad223fa9f0d30f321dea90f2228873d166003bb.tar.bz2
emacs-6ad223fa9f0d30f321dea90f2228873d166003bb.zip
trace.el: Preserve the line structure
Print newlines appearing inside values (i.e. inside strings) as \n rather than actual newlines so as to avoid messing up the main structure of the trace buffer. * lisp/emacs-lisp/trace.el (trace-entry-message) (trace-exit-message, trace--read-args): Quote newlines
Diffstat (limited to 'lisp/emacs-lisp')
-rw-r--r--lisp/emacs-lisp/trace.el11
1 files changed, 7 insertions, 4 deletions
diff --git a/lisp/emacs-lisp/trace.el b/lisp/emacs-lisp/trace.el
index 71eca5a3230..165f5c7bfe2 100644
--- a/lisp/emacs-lisp/trace.el
+++ b/lisp/emacs-lisp/trace.el
@@ -172,9 +172,10 @@ You can call this function to add internal values in the trace buffer."
LEVEL is the trace level, ARGS is the list of arguments passed to FUNCTION,
and CONTEXT is a string describing the dynamic context (e.g. values of
some global variables)."
- (let ((print-circle t))
+ (let ((print-circle t)
+ (print-escape-newlines t))
(format "%s%s%d -> %S%s\n"
- (mapconcat 'char-to-string (make-string (max 0 (1- level)) ?|) " ")
+ (mapconcat #'char-to-string (make-string (max 0 (1- level)) ?|) " ")
(if (> level 1) " " "")
level
;; FIXME: Make it so we can click the function name to jump to its
@@ -187,7 +188,8 @@ some global variables)."
LEVEL is the trace level, VALUE value returned by FUNCTION,
and CONTEXT is a string describing the dynamic context (e.g. values of
some global variables)."
- (let ((print-circle t))
+ (let ((print-circle t)
+ (print-escape-newlines t))
(format "%s%s%d <- %s: %S%s\n"
(mapconcat 'char-to-string (make-string (1- level) ?|) " ")
(if (> level 1) " " "")
@@ -278,7 +280,8 @@ If `current-prefix-arg' is non-nil, also read a buffer and a \"context\"
nil read-expression-map t
'read-expression-history))))
(lambda ()
- (let ((print-circle t))
+ (let ((print-circle t)
+ (print-escape-newlines t))
(concat " [" (prin1-to-string (eval exp t)) "]"))))))))
;;;###autoload