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

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

bug#60311: json-available-p: make dynamically correct for Windows


From: Eli Zaretskii
Subject: bug#60311: json-available-p: make dynamically correct for Windows
Date: Sun, 25 Dec 2022 20:43:11 +0200

> From: Mattias Engdegård <mattias.engdegard@gmail.com>
> Date: Sun, 25 Dec 2022 15:32:06 +0100
> 
> --- a/lisp/subr.el
> +++ b/lisp/subr.el
> @@ -6905,11 +6905,11 @@ internal--format-docstring-line
>  
>  (defun json-available-p ()
>    "Return non-nil if Emacs has libjansson support."
> -  (and (fboundp 'json-serialize)
> -       (condition-case nil
> -           (json-serialize t)
> -         (:success t)
> -         (json-unavailable nil))))
> +  (declare (side-effect-free error-free))
> +  (and (eval-when-compile (fboundp 'json-serialize))
> +       ;; If `json--available-p' is present, we need to call it at run-time.
> +       (or (not (eval-when-compile (fboundp 'json--available-p)))
> +           (json--available-p))))

Btw, I don't understand this use of eval-when-compile here.  Can you
explain why should we care at compile time whether these functions are
fboundp?

IOW, why not just

  (and (fboundp 'json--available-p)
       (json--available-p))

?





reply via email to

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