]> git.eshelyaron.com Git - emacs.git/commitdiff
(jsonrpc--log-event): Try and fix bug#68072
authorStefan Monnier <monnier@iro.umontreal.ca>
Sun, 7 Jan 2024 05:02:08 +0000 (00:02 -0500)
committerStefan Monnier <monnier@iro.umontreal.ca>
Sun, 7 Jan 2024 05:02:08 +0000 (00:02 -0500)
* lisp/jsonrpc.el (jsonrpc--log-event): Force the use of
`lisp-indent-function` in `pp-to-string`.

lisp/jsonrpc.el

index 3f33443f321a5edaf3a3eb50772ff57b1d93b3c2..f0f5842a0eee65231954a4ecf4510f3fe01dd707 100644 (file)
@@ -1003,16 +1003,17 @@ of the API instead.")
                                            (or method "")
                                            (if id (format "[%s]" id) "")))))
                (msg
-                (cond ((eq format 'full)
-                       (format "%s%s\n" preamble (or json log-text)))
-                      ((eq format 'short)
-                       (format "%s%s\n" preamble (or log-text "")))
-                      (t
-                       (format "%s%s" preamble
-                               (or (and foreign-message
-                                        (concat "\n" (pp-to-string
-                                                      foreign-message)))
-                                   (concat log-text "\n")))))))
+                (pcase format
+                  ('full  (format "%s%s\n" preamble (or json log-text)))
+                  ('short (format "%s%s\n" preamble (or log-text "")))
+                  (_
+                   (format "%s%s" preamble
+                           (or (and foreign-message
+                                    (let ((lisp-indent-function ;bug#68072
+                                           #'lisp-indent-function))
+                                      (concat "\n" (pp-to-string
+                                                    foreign-message))))
+                               (concat log-text "\n")))))))
           (goto-char (point-max))
           ;; XXX: could use `run-at-time' to delay server logs
           ;; slightly to play nice with verbose servers' stderr.