From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 25 09:32:15 2022 Received: (at submit) by debbugs.gnu.org; 25 Dec 2022 14:32:15 +0000 Received: from localhost ([127.0.0.1]:47722 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p9S2w-0000kl-HF for submit@debbugs.gnu.org; Sun, 25 Dec 2022 09:32:14 -0500 Received: from lists.gnu.org ([209.51.188.17]:46654) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p9S2u-0000ka-8i for submit@debbugs.gnu.org; Sun, 25 Dec 2022 09:32:12 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p9S2u-0001hE-30 for bug-gnu-emacs@gnu.org; Sun, 25 Dec 2022 09:32:12 -0500 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9S2s-0004WO-GC for bug-gnu-emacs@gnu.org; Sun, 25 Dec 2022 09:32:11 -0500 Received: by mail-lf1-x134.google.com with SMTP id cf42so13178092lfb.1 for ; Sun, 25 Dec 2022 06:32:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:date:message-id:subject:mime-version:from:sender:from:to:cc :subject:date:message-id:reply-to; bh=BRP6FxmzbSX/EDOBOLIOaCyMAPlq6bgPPeWRjWiEq4c=; b=TAW8ScEjtgGVdyzRxOU2lPXRH/vlemR7XxhlADMw65FhMELNRUacdSlBv0y1gogso/ SH4IaN8sRq6MFSQDF+lD+LQNpdNDbn2zYS4ct55kJX8aSC0VpIr4jI9VU3LiXem7hW9i n/25NM+9OBwbzyHW8VaHtZxJdXBBd+qja5P+VSYSRPkNty+Zb31zGTdhVdo0ybPpM84O Z9Zm7/rIgLoTlnyYIminDAjUljFnipkcCMBX5aeV05bC65Vjjxd04DkqNJXJM/qchVX3 S19HNeLmyuhRCtltPmEfalGx/R6UWCh/1Zb5LwzvAhk+jkY/ZGr3l/OrBsjsFMViwtcF 6VPw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:date:message-id:subject:mime-version:from:sender :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=BRP6FxmzbSX/EDOBOLIOaCyMAPlq6bgPPeWRjWiEq4c=; b=EMfjPbjeRok/5kkJwn6DXB7SjzqFB2mjoigdgLZyHLglIcbHeSRpT424p3M/i3h7zi WPDMbmIDKcEGhCdZ5YbA/bz4fFJ597U09Z+aQyjRexQJpVXphSldGzZ4ZGNG0ZKaC7rP 8BPMIUk/qcM5w3u9DImwoj05Mrqbv3atzf4UNSJ4ryA0EUX6LBHZrphFJx3XdnftLvfA UaVthdfke6VuEJXy8Tk06dTeEaLohmzIiHyXZhjuhWeL9TNAFQ4cc3KtyF3Nx1FeFQNF l3AXut7mYW82AHxT/tElWxTYkoWww87RGfq6oEzKrLYb4mOedNlRQSqZnH4vM12xBHfd lhXA== X-Gm-Message-State: AFqh2koHOISiWRxuphqVkmYDrnYZTwNF3G3FJ8JAD3lrs59kqYiQumSM rijcwXI9dJ8qAyezGJc0vhsN805qP/U= X-Google-Smtp-Source: AMrXdXu4BLNc3CuLv0EqNYAX8Xs+O9Oy3KpD4N0OuI02TqzAqaLFNnoCwqlMosq1EPU8Pw57EoHrfw== X-Received: by 2002:ac2:5982:0:b0:4b5:892:3987 with SMTP id w2-20020ac25982000000b004b508923987mr5480343lfn.9.1671978727726; Sun, 25 Dec 2022 06:32:07 -0800 (PST) Received: from smtpclient.apple (c188-150-171-209.bredband.tele2.se. [188.150.171.209]) by smtp.gmail.com with ESMTPSA id z11-20020a056512370b00b0049c29389b98sm1346864lfr.151.2022.12.25.06.32.06 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 25 Dec 2022 06:32:07 -0800 (PST) From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= Content-Type: multipart/mixed; boundary="Apple-Mail=_B531C513-F760-47B3-9A16-FF7390E66714" Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: json-available-p: make dynamically correct for Windows Message-Id: Date: Sun, 25 Dec 2022 15:32:06 +0100 To: Emacs Bug Report X-Mailer: Apple Mail (2.3654.120.0.1.13) Received-SPF: pass client-ip=2a00:1450:4864:20::134; envelope-from=mattias.engdegard@gmail.com; helo=mail-lf1-x134.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) --Apple-Mail=_B531C513-F760-47B3-9A16-FF7390E66714 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=us-ascii The implementation of `json-available-p`, (and (fboundp 'json-serialize) (condition-case nil (json-serialize t) (:success t) (json-unavailable nil)))) probably isn't quite right on Windows: `json-serialize` is pure so it = will be called at compile time and the result, "true", used in the code = (actually not even that since the result is never used). Thus, if = libjansson could not be loaded during actual Emacs use (as opposed to = when Emacs was built), this would never be detected and json-available-p = would still return t. The patch below should take care of this. Would someone please help = testing it on Windows? --Apple-Mail=_B531C513-F760-47B3-9A16-FF7390E66714 Content-Disposition: attachment; filename=json-available-p.diff Content-Type: application/octet-stream; x-unix-mode=0644; name="json-available-p.diff" Content-Transfer-Encoding: 7bit diff --git a/lisp/subr.el b/lisp/subr.el index fff4c88ccf..ce5ac14f5f 100644 --- 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)))) (defun ensure-list (object) "Return OBJECT as a list. diff --git a/src/json.c b/src/json.c index cdcc11358e..d2105bc27b 100644 --- a/src/json.c +++ b/src/json.c @@ -555,6 +555,38 @@ json_parse_args (ptrdiff_t nargs, } } +#ifdef WINDOWSNT +static bool +json_available_p (void) +{ + if (json_initialized) + return true; + json_initialized = init_json_functions (); + Lisp_Object status = json_initialized ? Qt : Qnil; + Vlibrary_cache = Fcons (Fcons (Qjson, status), Vlibrary_cache); + return json_initialized; +} +#endif + +static void +ensure_json_available (void) +{ +#ifdef WINDOWSNT + if (!json_available_p ()) + Fsignal (Qjson_unavailable, + list1 (build_unibyte_string ("jansson library not found"))); +#endif +} + +#ifdef WINDOWSNT +DEFUN ("json--available-p", Fjson__available_p, Sjson__available_p, 0, 0, NULL, + doc: /* Whether libjansson is available (internal). */) + (void) +{ + return json_available_p () ? Qt : Qnil; +} +#endif + DEFUN ("json-serialize", Fjson_serialize, Sjson_serialize, 1, MANY, NULL, doc: /* Return the JSON representation of OBJECT as a string. @@ -585,19 +617,7 @@ DEFUN ("json-serialize", Fjson_serialize, Sjson_serialize, 1, MANY, (ptrdiff_t nargs, Lisp_Object *args) { specpdl_ref count = SPECPDL_INDEX (); - -#ifdef WINDOWSNT - if (!json_initialized) - { - Lisp_Object status; - json_initialized = init_json_functions (); - status = json_initialized ? Qt : Qnil; - Vlibrary_cache = Fcons (Fcons (Qjson, status), Vlibrary_cache); - } - if (!json_initialized) - Fsignal (Qjson_unavailable, - list1 (build_unibyte_string ("jansson library not found"))); -#endif + ensure_json_available (); struct json_configuration conf = {json_object_hashtable, json_array_array, QCnull, QCfalse}; @@ -694,19 +714,7 @@ DEFUN ("json-insert", Fjson_insert, Sjson_insert, 1, MANY, (ptrdiff_t nargs, Lisp_Object *args) { specpdl_ref count = SPECPDL_INDEX (); - -#ifdef WINDOWSNT - if (!json_initialized) - { - Lisp_Object status; - json_initialized = init_json_functions (); - status = json_initialized ? Qt : Qnil; - Vlibrary_cache = Fcons (Fcons (Qjson, status), Vlibrary_cache); - } - if (!json_initialized) - Fsignal (Qjson_unavailable, - list1 (build_unibyte_string ("jansson library not found"))); -#endif + ensure_json_available (); struct json_configuration conf = {json_object_hashtable, json_array_array, QCnull, QCfalse}; @@ -951,19 +959,7 @@ DEFUN ("json-parse-string", Fjson_parse_string, Sjson_parse_string, 1, MANY, (ptrdiff_t nargs, Lisp_Object *args) { specpdl_ref count = SPECPDL_INDEX (); - -#ifdef WINDOWSNT - if (!json_initialized) - { - Lisp_Object status; - json_initialized = init_json_functions (); - status = json_initialized ? Qt : Qnil; - Vlibrary_cache = Fcons (Fcons (Qjson, status), Vlibrary_cache); - } - if (!json_initialized) - Fsignal (Qjson_unavailable, - list1 (build_unibyte_string ("jansson library not found"))); -#endif + ensure_json_available (); Lisp_Object string = args[0]; CHECK_STRING (string); @@ -1048,19 +1044,7 @@ DEFUN ("json-parse-buffer", Fjson_parse_buffer, Sjson_parse_buffer, (ptrdiff_t nargs, Lisp_Object *args) { specpdl_ref count = SPECPDL_INDEX (); - -#ifdef WINDOWSNT - if (!json_initialized) - { - Lisp_Object status; - json_initialized = init_json_functions (); - status = json_initialized ? Qt : Qnil; - Vlibrary_cache = Fcons (Fcons (Qjson, status), Vlibrary_cache); - } - if (!json_initialized) - Fsignal (Qjson_unavailable, - list1 (build_unibyte_string ("jansson library not found"))); -#endif + ensure_json_available (); struct json_configuration conf = {json_object_hashtable, json_array_array, QCnull, QCfalse}; @@ -1137,6 +1121,9 @@ syms_of_json (void) DEFSYM (Qplist, "plist"); DEFSYM (Qarray, "array"); +#ifdef WINDOWSNT + defsubr (&Sjson__available_p); +#endif defsubr (&Sjson_serialize); defsubr (&Sjson_insert); defsubr (&Sjson_parse_string); --Apple-Mail=_B531C513-F760-47B3-9A16-FF7390E66714-- From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 25 10:34:36 2022 Received: (at submit) by debbugs.gnu.org; 25 Dec 2022 15:34:36 +0000 Received: from localhost ([127.0.0.1]:49923 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p9T1I-0003Gf-En for submit@debbugs.gnu.org; Sun, 25 Dec 2022 10:34:36 -0500 Received: from lists.gnu.org ([209.51.188.17]:51678) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p9T1H-0003GY-6a for submit@debbugs.gnu.org; Sun, 25 Dec 2022 10:34:35 -0500 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p9T1G-0002C5-VD for bug-gnu-emacs@gnu.org; Sun, 25 Dec 2022 10:34:34 -0500 Received: from mail-lf1-x12f.google.com ([2a00:1450:4864:20::12f]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1p9T1F-0000Ul-Ie for bug-gnu-emacs@gnu.org; Sun, 25 Dec 2022 10:34:34 -0500 Received: by mail-lf1-x12f.google.com with SMTP id o6so13289572lfi.5 for ; Sun, 25 Dec 2022 07:34:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:in-reply-to:to:references:date:subject:mime-version :content-transfer-encoding:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=o0Kyh8XhdrdOcKHyjU6vF0o2WBe1/9a8DiYz/kKs6Zc=; b=obj9pqEm/TjzjdOmQyTjN/6vp8CMN8vjHVm5yT/oDyk4UxGwKHZtXllUxZLy814tU8 WkmHSTGBkiGafyHeosJ0injaw0TtVIF+CeNL6JWmL3GPwfVQeA7vutcv78sc8J6TwqLo /+HqY+lOgKVezyid0dEt9pRLJjdIlA7u2VESZixFGY+2/hz6wH8PHp3ZBeku9J4xQvQc WD5mzbismVQZCEJ8/kt/Ybs7DIBEfQnUlJ20Ta98OokKSArI4F6Fe/nN9+MlCzd8L8cx xBNmq3QaJjozsIb+Yp7rCNTIBHMFGeit/1KMXgpUuCdpWmSmQt0JYkRxvd4OVwoGZQu0 WpWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=message-id:in-reply-to:to:references:date:subject:mime-version :content-transfer-encoding:from:sender:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=o0Kyh8XhdrdOcKHyjU6vF0o2WBe1/9a8DiYz/kKs6Zc=; b=tiO1putUyPmOF+tu/j695bY+frUtOwux1JOjnVC1e/l2wvFFdYRC8rUfF/XmLYuv5U lLR1rgWHuI/ApgFLM1ZMKhpjVHuYZLIkYgcwmqVZSZ6JtSzM0elFYMxSe8USf+KAhq2f 6kD0/9TRf1bDM7IJds5m4aHwy7MfqnutDHJrYcxileNFsthaFaCJCDqnj8YQEhPpe2NA WUaaFyKiz9OFvqz3XevsFS+DNOMCLKEJFUjqa9fxb8XHWRhrV5nQLy76VbN385ZcO3n4 Vf8P89bI6pgozJTMkg3ay2OhRvtApK/mkgSfiIg798wyaiW9c7DRHZY4sTAI+9gd9bbg cfqQ== X-Gm-Message-State: AFqh2koa3FL4K4NX2ilEIrzdv5xyo6yUM3Lb3IC1dgrE89FlvsQ8MGZx JTanXuav2QQSJ2EzdxjpwJovmTXl6Dc= X-Google-Smtp-Source: AMrXdXtOu6r6jnf5Q5/8S0RaCqpe7FLM/NLxu7S50jGjCeAwB+iFUOGBsxoakTRs1jM7ePicMMdcrQ== X-Received: by 2002:ac2:5395:0:b0:4cb:7fb:1868 with SMTP id g21-20020ac25395000000b004cb07fb1868mr116726lfh.52.1671982471482; Sun, 25 Dec 2022 07:34:31 -0800 (PST) Received: from smtpclient.apple (c188-150-171-209.bredband.tele2.se. [188.150.171.209]) by smtp.gmail.com with ESMTPSA id r18-20020a2e8e32000000b0027cf0ecab3fsm1071993ljk.138.2022.12.25.07.34.30 for (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Sun, 25 Dec 2022 07:34:30 -0800 (PST) From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: json-available-p: make dynamically correct for Windows Date: Sun, 25 Dec 2022 16:34:30 +0100 References: To: Emacs Bug Report In-Reply-To: Message-Id: X-Mailer: Apple Mail (2.3654.120.0.1.13) Received-SPF: pass client-ip=2a00:1450:4864:20::12f; envelope-from=mattias.engdegard@gmail.com; helo=mail-lf1-x12f.google.com X-Spam_score_int: -20 X-Spam_score: -2.1 X-Spam_bar: -- X-Spam_report: (-2.1 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_FROM=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-Spam-Score: -1.3 (-) X-Debbugs-Envelope-To: submit X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -2.3 (--) By the way, I'm entirely to blame for this flaw: a compiler bug only = recently fixed (8bb8cc5b49) prevented the emission of a warning that = would have alerted the author of `json-available-p` to the issue at = hand. From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 25 10:40:55 2022 Received: (at 60311) by debbugs.gnu.org; 25 Dec 2022 15:40:56 +0000 Received: from localhost ([127.0.0.1]:49932 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p9T7P-0003Sw-LL for submit@debbugs.gnu.org; Sun, 25 Dec 2022 10:40:55 -0500 Received: from eggs.gnu.org ([209.51.188.92]:40540) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p9T7M-0003SW-5E for 60311@debbugs.gnu.org; Sun, 25 Dec 2022 10:40:53 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p9T7G-0001fY-V3; Sun, 25 Dec 2022 10:40:46 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=S6Yf5Qg5UTGvnLqFYLJ5//gflGjk+SbyHLl2LsUZgLg=; b=JI9ftRLHI84M5PBROTQT iZoX6z0sas0enIxGmNFvQU9T9vPzd1hIXCn+e9GVmR+nHZFxxHQarRUhyw2x4iVGYEMcZ2vzV7B4f 1KW8NeeUDGl9/5BUcx1pAVSo95aI0RXga2dcMfWM2KpvVUTgvRHdDp0ifssNgFYpL7/TQyspBePk+ VZ0Sb9a0nkt3X3YY36BQBC8ZiZBFa643kaqsPZJId2UGa+fne34N3KeA9tSNg76h8HwGuBWcIwhoc VPUN1eFFuZYLT8Fvbe/iFknjHTcn+cIf6nDl5Zjgk/gvVJBRXAydw8fpZ/6PAVVk0uGuvqYZabGck OlpoDbIuW8uEbg==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p9T7G-00080C-AA; Sun, 25 Dec 2022 10:40:46 -0500 Date: Sun, 25 Dec 2022 17:40:47 +0200 Message-Id: <83wn6f330g.fsf@gnu.org> From: Eli Zaretskii To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= In-Reply-To: (message from Mattias =?utf-8?Q?Engdeg=C3=A5rd?= on Sun, 25 Dec 2022 15:32:06 +0100) Subject: Re: bug#60311: json-available-p: make dynamically correct for Windows References: MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 60311 Cc: 60311@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Mattias Engdegård > Date: Sun, 25 Dec 2022 15:32:06 +0100 > > The implementation of `json-available-p`, > > (and (fboundp 'json-serialize) > (condition-case nil > (json-serialize t) > (:success t) > (json-unavailable nil)))) > > probably isn't quite right on Windows: `json-serialize` is pure so it will be called at compile time and the result, "true", used in the code (actually not even that since the result is never used). Thus, if libjansson could not be loaded during actual Emacs use (as opposed to when Emacs was built), this would never be detected and json-available-p would still return t. Yes, you are right. But please come up with a smaller changeset which only changes what strictly needs to be changed. Or if you want, I can do this myself. AFAIU, we just need a C implementation of json-available-p, since doing this in Lisp doesn't work. So that's the change I expect, nothing more, nothing less. Like we do with other optional libraries and features, there's more than enough examples in the codebase. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 25 11:25:01 2022 Received: (at 60311) by debbugs.gnu.org; 25 Dec 2022 16:25:01 +0000 Received: from localhost ([127.0.0.1]:50016 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p9To4-00059a-QB for submit@debbugs.gnu.org; Sun, 25 Dec 2022 11:25:01 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53224) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p9To3-00059N-1I for 60311@debbugs.gnu.org; Sun, 25 Dec 2022 11:24:59 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p9Tnx-0004jo-R5; Sun, 25 Dec 2022 11:24:53 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=UGCNTx/qD2/CV780Z351AsQsC+/bENp6grdgJ2pnY4Q=; b=R+8Uwc7G1Deo kig7jPgCUCPMxbS15fIg0sYZxXoX56lWrLFEYr8ZxzuMvZsZCoRQXKfq4oWHUtKAW67NmQGJkq3T8 YFOsEWxPhCJp4ZtxcCAI5Ap/qMnS+OJOoJuKvodItjw2JDTncFED8cO3DO3pZmwh8WiKP7i4TuMpq QXq+zZk8falSml5YhGqAckSHSXIMr+0P5SoCvTb/mJ0pYI3q+IYbWMXguz6vLWR/udrYjD1cJ4hTM CgTRraqZRi/mIkYvY3l/Lgy3g4vbL7vZWlE5aF54guCUx1EkHxtikOnz+6R1aCHAGGhagfAUDfC1C zZGQ+YaVFb/w7FZ58GT+hQ==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p9Tnx-0000uo-5u; Sun, 25 Dec 2022 11:24:53 -0500 Date: Sun, 25 Dec 2022 18:24:54 +0200 Message-Id: <83v8lz30yx.fsf@gnu.org> From: Eli Zaretskii To: mattias.engdegard@gmail.com In-Reply-To: <83wn6f330g.fsf@gnu.org> (message from Eli Zaretskii on Sun, 25 Dec 2022 17:40:47 +0200) Subject: Re: bug#60311: json-available-p: make dynamically correct for Windows References: <83wn6f330g.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 60311 Cc: 60311@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Cc: 60311@debbugs.gnu.org > Date: Sun, 25 Dec 2022 17:40:47 +0200 > From: Eli Zaretskii > > AFAIU, we just need a C implementation of json-available-p, since > doing this in Lisp doesn't work. This came out too ambiguous. So here's a more accurate request: please make your json_available_p use the same code as the first part of the below: #ifdef WINDOWSNT if (!json_initialized) { Lisp_Object status; json_initialized = init_json_functions (); status = json_initialized ? Qt : Qnil; Vlibrary_cache = Fcons (Fcons (Qjson, status), Vlibrary_cache); } if (!json_initialized) Fsignal (Qjson_unavailable, list1 (build_unibyte_string ("jansson library not found"))); #endif and your ensure_json_available use the second part of the above. There's no reason to reshuffle the code that works. Also, please make ensure_json_available specific to WINDOWSNT, so that we don't pay an extra function call on Posix platforms. And finally, json--available-p should be defined on all platforms that compile json.c, not just on WINDOWSNT; it should return t on Posix platforms. Thanks. From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 25 12:27:05 2022 Received: (at 60311) by debbugs.gnu.org; 25 Dec 2022 17:27:05 +0000 Received: from localhost ([127.0.0.1]:50077 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p9Um9-0007Je-92 for submit@debbugs.gnu.org; Sun, 25 Dec 2022 12:27:05 -0500 Received: from eggs.gnu.org ([209.51.188.92]:47388) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p9Um6-0007J1-J7 for 60311@debbugs.gnu.org; Sun, 25 Dec 2022 12:27:03 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p9Um1-0004sj-Cv; Sun, 25 Dec 2022 12:26:57 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=+y7NeKQpoN1B7sov/bPbzbQp4Cdzw3RHeXWK1WyIRh4=; b=qP64MNTuJR5M pPjbc9pPXT2dubndQPbh2u8T+Ngd/Bc4OUkg4Ce3bHxXKRITpgoYVer+2hL3cOZb5I6q9HsyMbVNw qMeStwstrLWMEj5jwAOG92PKSmrHjCT1mg2eRRlp3t6eib7rqC/spbXKkMdazwzze7ztv+Me61BKL tobf/Z8YJl5Dz3gRPJsX4X2SaABOc6syceSS6dz3h3gkpYdC/Ugp5WJPAFZSXftg0/gFodKHr+wKp O/LS6D98umF78KH67R3a6MFcUWxlzZBnTNDvzC61n93ZbnNPVJMDMJRhLGUE5KHVr9QlSqZDYIs0S 3RytN2sf5WPpgSzucuq7SA==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p9Um0-00032I-TM; Sun, 25 Dec 2022 12:26:57 -0500 Date: Sun, 25 Dec 2022 19:26:59 +0200 Message-Id: <83sfh32y3g.fsf@gnu.org> From: Eli Zaretskii To: mattias.engdegard@gmail.com In-Reply-To: <83v8lz30yx.fsf@gnu.org> (message from Eli Zaretskii on Sun, 25 Dec 2022 18:24:54 +0200) Subject: Re: bug#60311: json-available-p: make dynamically correct for Windows References: <83wn6f330g.fsf@gnu.org> <83v8lz30yx.fsf@gnu.org> X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 60311 Cc: 60311@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > Cc: 60311@debbugs.gnu.org > Date: Sun, 25 Dec 2022 18:24:54 +0200 > From: Eli Zaretskii > > This came out too ambiguous. So here's a more accurate request: > please make your json_available_p use the same code as the first part > of the below: > > #ifdef WINDOWSNT > if (!json_initialized) > { > Lisp_Object status; > json_initialized = init_json_functions (); > status = json_initialized ? Qt : Qnil; > Vlibrary_cache = Fcons (Fcons (Qjson, status), Vlibrary_cache); > } > if (!json_initialized) > Fsignal (Qjson_unavailable, > list1 (build_unibyte_string ("jansson library not found"))); > #endif > > and your ensure_json_available use the second part of the above. > There's no reason to reshuffle the code that works. > > Also, please make ensure_json_available specific to WINDOWSNT, so that > we don't pay an extra function call on Posix platforms. > > And finally, json--available-p should be defined on all platforms that > compile json.c, not just on WINDOWSNT; it should return t on Posix > platforms. The above is for the emacs-29 branch. I think on master we should compile json.c on all platforms, even if libjansson is not being linked against, and then have json--available-p always fboundp, so that test at run time will not be needed. From debbugs-submit-bounces@debbugs.gnu.org Sun Dec 25 13:43:17 2022 Received: (at 60311) by debbugs.gnu.org; 25 Dec 2022 18:43:17 +0000 Received: from localhost ([127.0.0.1]:50155 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p9Vxt-0003Zr-FI for submit@debbugs.gnu.org; Sun, 25 Dec 2022 13:43:17 -0500 Received: from eggs.gnu.org ([209.51.188.92]:46292) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p9Vxr-0003Zd-Il for 60311@debbugs.gnu.org; Sun, 25 Dec 2022 13:43:16 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p9Vxl-000376-IR; Sun, 25 Dec 2022 13:43:10 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=ACOWf4DE8x41rwum1v4ipvFjxC3yEkiuCGXp1fh9Xog=; b=CTip4foJQ21GSnoXebwq rnwPZnhj6kJtkr7yBG6pSVfxRHOvBZ4VMDA8PEk589eVydjl34/3p2fmyzbpvA6gUcgTYJnDakd0f PBvBftvRSipD6IgT/ObIM1kXpJIEEidPNBu/PCuCODDcOlaFJoAkz659qlr0xHHyBzklUBiLB/JjA Uns0RDou2Jp+14qy8+NErwao+xfDVXeB17rlktnx8sKxOMVXM8Or7bK/zC7i23AhRiBSz9oZ5Uw1k jS6qBS7YNlXp/XqEON2K2LiaO5pz2gI1unN5lb+JmKuj7JtCzto4Mkk+RR+Aw9Ov2bZd0VCiIsEp1 5ownUU1WQ9NbwA==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p9Vxk-00087h-Un; Sun, 25 Dec 2022 13:43:09 -0500 Date: Sun, 25 Dec 2022 20:43:11 +0200 Message-Id: <83mt7b2ukg.fsf@gnu.org> From: Eli Zaretskii To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= In-Reply-To: (message from Mattias =?utf-8?Q?Engdeg=C3=A5rd?= on Sun, 25 Dec 2022 15:32:06 +0100) Subject: Re: bug#60311: json-available-p: make dynamically correct for Windows References: MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 60311 Cc: 60311@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Mattias Engdegård > 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)) ? From debbugs-submit-bounces@debbugs.gnu.org Mon Dec 26 07:11:31 2022 Received: (at 60311) by debbugs.gnu.org; 26 Dec 2022 12:11:32 +0000 Received: from localhost ([127.0.0.1]:50879 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p9mKJ-0004CM-Jk for submit@debbugs.gnu.org; Mon, 26 Dec 2022 07:11:31 -0500 Received: from mail-lf1-f43.google.com ([209.85.167.43]:46672) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p9mKH-0004C9-T6 for 60311@debbugs.gnu.org; Mon, 26 Dec 2022 07:11:30 -0500 Received: by mail-lf1-f43.google.com with SMTP id bp15so15698500lfb.13 for <60311@debbugs.gnu.org>; Mon, 26 Dec 2022 04:11:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:sender:from:to:cc:subject :date:message-id:reply-to; bh=YCrz4BdWHUDpl/GZKeBNP63x8Ys2wy7X5Y5oom5EfKo=; b=Cp0CSSzWVChQtRYs98afulbUAG7d8WcE3y+TppDqQTWcy2FiDF9EmwxwDCIoh/ASi0 5VHOr8Jjfk2ytRSrLJ6OPVSibPg3XSZ3TQyoiK3qphThweAi09ydfgEJA9yMBaARi8LF NmEZQNyfxCNdbOJ2YaxUFCK3ORIU+gVm3LIDUqZhOBtAAbj2pQJkgd73UPbNjKGP7Atd qb2IO1RJ09a3xLwByixK9MfAu9bLBi6sCg68PCJPUufkoG4AZVg6ARNM3U1XurLFLiDy x0XDlBT2bDkXY/CNYkDoORJpio7xZo+lNi9X5Ex2oBynQdFJHZsJxMt6jlj1UGxNS8dv sscQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=to:references:message-id:content-transfer-encoding:cc:date :in-reply-to:from:subject:mime-version:sender:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=YCrz4BdWHUDpl/GZKeBNP63x8Ys2wy7X5Y5oom5EfKo=; b=yWdAAPw3HtfmiVog6dINLJai7DGYxqy47vRjVKP3vDLmjItdtjk5deFKtC9jsOlDev hofXQLbUkjKWbBvNOHk0pJKeZ8H1LcWPhBktLZzIEcVXmE9M+0X6+Fs+ouPQ7uXPsDCR ngs2KL0ZrHaQv0s7lpMQ0wfaLjTq9Ly89wqUu3ezMKtWFBc1DhJdtJJ3c3kP0iuv572N tDOfE2f5sIXQlkMOaf55RgDmGfUO1zyLG/NZHTB2p6Xi3xH3kO7U0uKWO9savjrhRuBQ qT9oO4R9E3PnnDZYLibTabBn/ueJuSpTS14JNvC87kTtr59Ba/ItSpTchKrIqVvNK4AF kOOA== X-Gm-Message-State: AFqh2koJuO/mw6QgDsNFv1V+m2S5lwTVIVWYDhK05r6ofo4sr1VxbFDy ur/wJmLuCfMyE9gB8IhS0Ck= X-Google-Smtp-Source: AMrXdXsbj3RsllTHgPzbQwVm99d+h5NE8uql1ICwAkpAWskYsxlNTz5fiUhsoT+tkuHeyN6zvcUMVA== X-Received: by 2002:a05:6512:2390:b0:4b5:649a:9105 with SMTP id c16-20020a056512239000b004b5649a9105mr6310518lfv.65.1672056683434; Mon, 26 Dec 2022 04:11:23 -0800 (PST) Received: from smtpclient.apple (c188-150-171-209.bredband.tele2.se. [188.150.171.209]) by smtp.gmail.com with ESMTPSA id m2-20020ac24242000000b0048b0696d0b1sm1781939lfl.90.2022.12.26.04.11.22 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 26 Dec 2022 04:11:22 -0800 (PST) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.120.0.1.13\)) Subject: Re: bug#60311: json-available-p: make dynamically correct for Windows From: =?utf-8?Q?Mattias_Engdeg=C3=A5rd?= In-Reply-To: <83wn6f330g.fsf@gnu.org> Date: Mon, 26 Dec 2022 13:11:21 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <87FCD796-629F-44AE-B539-2DDAE6C148F2@gmail.com> References: <83wn6f330g.fsf@gnu.org> To: Eli Zaretskii X-Mailer: Apple Mail (2.3654.120.0.1.13) X-Spam-Score: 0.0 (/) X-Debbugs-Envelope-To: 60311 Cc: 60311@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -1.0 (-) 25 dec. 2022 kl. 16.40 skrev Eli Zaretskii : > Yes, you are right. But please come up with a smaller changeset which > only changes what strictly needs to be changed. Or if you want, I can > do this myself. Since you have very specific ideas about how to go about it it's better = that you make the change yourself. After all, attempts to remote-control = someone else this way rarely make either party very happy. As long as it gets done I'm not very particular about it myself. >> + (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)))) >=20 > 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? Because we can: we already know the answers when subr.el is compiled, = giving us constant nil or t values that will simplify the function to a = constant or a call to json--available-p. > why not just >=20 > (and (fboundp 'json--available-p) > (json--available-p)) Calling `fboundp` at run time is wasteful, and that patch used the = presence of json--available-p to indicate whether it needs to be called = at run time (on Windows only, but it's good to keep that = platform-dependency in one place). It doesn't matter much if json-available-p is implemented in Lisp or C; = even performance-wise it's a wash. From debbugs-submit-bounces@debbugs.gnu.org Mon Dec 26 08:30:03 2022 Received: (at 60311-done) by debbugs.gnu.org; 26 Dec 2022 13:30:03 +0000 Received: from localhost ([127.0.0.1]:50950 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p9nYI-0002Ev-Oi for submit@debbugs.gnu.org; Mon, 26 Dec 2022 08:30:03 -0500 Received: from eggs.gnu.org ([209.51.188.92]:60184) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1p9nYH-0002E2-Bm for 60311-done@debbugs.gnu.org; Mon, 26 Dec 2022 08:30:01 -0500 Received: from fencepost.gnu.org ([2001:470:142:3::e]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p9nYC-0004Ul-1I; Mon, 26 Dec 2022 08:29:56 -0500 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=MIME-version:References:Subject:In-Reply-To:To:From: Date; bh=CMFVwby6/Fz2+O3DJo8HhbLx67yyYDZxAt1NUZIabz0=; b=SKH4Gq/Pip41v2r5Jj/R FilmiNSw/aYTqCPRTgknmW7KKPM4UFHdheijOBGamwXxRTph9rQS+A0LwZ9sxDQ4l5FkBHCdO0fQ/ 7HcVvugYaj2+BWHWw1NRoK79itt4I4Lo+S62kQozhv3KK/GtiOBqEKFHM7rXytjV1sbn1I8KEKp9c P84KcLn9rLE+nX6+alSrxiGAjUQzBl7pPN+Ff0+VS51G6+AHtXhXMEw50xCgPpVtThYp5wZkhLppu vKV2v+xcbYbH/j5hv7EheqebJ1HkPhtxd8MEsgj4jDJVd6Hn4XL8YhVarlVCFJkg7/6wLFEm55TgG CLqajtkWFa5JTw==; Received: from [87.69.77.57] (helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1p9nYB-0004di-Dg; Mon, 26 Dec 2022 08:29:55 -0500 Date: Mon, 26 Dec 2022 15:29:58 +0200 Message-Id: <835ydy2syx.fsf@gnu.org> From: Eli Zaretskii To: Mattias =?utf-8?Q?Engdeg=C3=A5rd?= In-Reply-To: <87FCD796-629F-44AE-B539-2DDAE6C148F2@gmail.com> (message from Mattias =?utf-8?Q?Engdeg=C3=A5rd?= on Mon, 26 Dec 2022 13:11:21 +0100) Subject: Re: bug#60311: json-available-p: make dynamically correct for Windows References: <83wn6f330g.fsf@gnu.org> <87FCD796-629F-44AE-B539-2DDAE6C148F2@gmail.com> MIME-version: 1.0 Content-type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Spam-Score: -2.3 (--) X-Debbugs-Envelope-To: 60311-done Cc: 60311-done@debbugs.gnu.org X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: debbugs-submit-bounces@debbugs.gnu.org Sender: "Debbugs-submit" X-Spam-Score: -3.3 (---) > From: Mattias Engdegård > Date: Mon, 26 Dec 2022 13:11:21 +0100 > Cc: 60311@debbugs.gnu.org > > 25 dec. 2022 kl. 16.40 skrev Eli Zaretskii : > > > Yes, you are right. But please come up with a smaller changeset which > > only changes what strictly needs to be changed. Or if you want, I can > > do this myself. > > Since you have very specific ideas about how to go about it it's better that you make the change yourself. Done. > > why not just > > > > (and (fboundp 'json--available-p) > > (json--available-p)) > > Calling `fboundp` at run time is wasteful, and that patch used the presence of json--available-p to indicate whether it needs to be called at run time (on Windows only, but it's good to keep that platform-dependency in one place). Yes, but using eval-when-compile precludes defining json--available-p at run time, something that I don't like doing in Emacs, since it's IMO against the Emacs's spirit of being interpreter based. So I went with the simpler definition that doesn't assume functions are only defined at byte-compile time. Thanks, I'm now closing the bug. From unknown Thu Aug 14 18:37:30 2025 Received: (at fakecontrol) by fakecontrolmessage; To: internal_control@debbugs.gnu.org From: Debbugs Internal Request Subject: Internal Control Message-Id: bug archived. Date: Tue, 24 Jan 2023 12:24:04 +0000 User-Agent: Fakemail v42.6.9 # This is a fake control message. # # The action: # bug archived. thanks # This fakemail brought to you by your local debbugs # administrator