From: Eli Zaretskii <eliz@gnu.org>
To: "Mattias Engdegård" <mattias.engdegard@gmail.com>
Cc: 60311@debbugs.gnu.org
Subject: bug#60311: json-available-p: make dynamically correct for Windows
Date: Sun, 25 Dec 2022 20:43:11 +0200 [thread overview]
Message-ID: <83mt7b2ukg.fsf@gnu.org> (raw)
In-Reply-To: <FDA1AAF8-F02A-4FDF-8B5E-ED009842B753@gmail.com> (message from Mattias Engdegård on Sun, 25 Dec 2022 15:32:06 +0100)
> 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))
?
prev parent reply other threads:[~2022-12-25 18:43 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-12-25 14:32 bug#60311: json-available-p: make dynamically correct for Windows Mattias Engdegård
2022-12-25 15:34 ` Mattias Engdegård
2022-12-25 15:40 ` Eli Zaretskii
2022-12-25 16:24 ` Eli Zaretskii
2022-12-25 17:26 ` Eli Zaretskii
2022-12-26 12:11 ` Mattias Engdegård
2022-12-26 13:29 ` Eli Zaretskii
2022-12-25 18:43 ` Eli Zaretskii [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.gnu.org/software/emacs/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=83mt7b2ukg.fsf@gnu.org \
--to=eliz@gnu.org \
--cc=60311@debbugs.gnu.org \
--cc=mattias.engdegard@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).