emacs-devel
[Top][All Lists]
Advanced

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

Re: master f866c85ac4e: (jsonrpc--log-event): Try and fix bug#68072


From: Po Lu
Subject: Re: master f866c85ac4e: (jsonrpc--log-event): Try and fix bug#68072
Date: Sun, 07 Jan 2024 18:38:31 +0800
User-agent: Gnus/5.13 (Gnus v5.13)

Stefan Monnier via Mailing list for Emacs changes <emacs-diffs@gnu.org>
writes:

> branch: master
> commit f866c85ac4e32df8061b285b6b44b15346994f3d
> Author: Stefan Monnier <monnier@iro.umontreal.ca>
> Commit: Stefan Monnier <monnier@iro.umontreal.ca>
>
>     (jsonrpc--log-event): Try and fix bug#68072
>     
>     * lisp/jsonrpc.el (jsonrpc--log-event): Force the use of
>     `lisp-indent-function` in `pp-to-string`.
> ---
>  lisp/jsonrpc.el | 21 +++++++++++----------
>  1 file changed, 11 insertions(+), 10 deletions(-)
>
> diff --git a/lisp/jsonrpc.el b/lisp/jsonrpc.el
> index 3f33443f321..f0f5842a0ee 100644
> --- a/lisp/jsonrpc.el
> +++ b/lisp/jsonrpc.el
> @@ -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.

Is there any substantive reason it was necessary to replace cond with
pcase?  If not, why was cond replaced with pcase?

Thanks.


reply via email to

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