From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2 ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id MFANLPVblWAKHgAAgWs5BA (envelope-from ) for ; Fri, 07 May 2021 17:25:41 +0200 Received: from aspmx1.migadu.com ([2001:41d0:8:6d80::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2 with LMTPS id 6DiZJ/VblWD4AwAAB5/wlQ (envelope-from ) for ; Fri, 07 May 2021 15:25:41 +0000 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by aspmx1.migadu.com (Postfix) with ESMTPS id 901221E59C for ; Fri, 7 May 2021 17:25:39 +0200 (CEST) Received: from localhost ([::1]:52578 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1lf2MD-0006ST-8l for larch@yhetil.org; Fri, 07 May 2021 11:25:37 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:48170) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lf2Kd-0006Ru-9Z for emacs-orgmode@gnu.org; Fri, 07 May 2021 11:24:00 -0400 Received: from wout1-smtp.messagingengine.com ([64.147.123.24]:33633) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1lf2KY-0000GN-PS for emacs-orgmode@gnu.org; Fri, 07 May 2021 11:23:59 -0400 Received: from compute5.internal (compute5.nyi.internal [10.202.2.45]) by mailout.west.internal (Postfix) with ESMTP id 5CDA1138F; Fri, 7 May 2021 11:23:52 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute5.internal (MEProxy); Fri, 07 May 2021 11:23:52 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.fm; h= references:from:to:cc:subject:date:in-reply-to:message-id :mime-version:content-type:content-transfer-encoding; s=fm3; bh= HsZye0FyZeQ4ntFAnh5j7CfGM/OxfEdmREjTi6mmgfY=; b=TkENH/CBZ9CPvp64 qcIg6RBm6Ocbf06iVhFvJjiZMaohiJ3qM4cLh5W24zDE5RrVr6T0Nl2/BEYihBQy T2l4Qt+LQ7lTscBwAgeczWs4vvp/Pgkz56id0zChMMTwDh10HtZKVCBxoUUNlg3D BCWMZ1dFYT3XdCbA3RMRYiHMMExxIRLymjvdrMQgigXFfDGGAif3QrN4VJYPM9jE +wcaA4LHHXh+CMNkuocPOfSDpvQl5k83f/BiP1vqAMBo7zqNg8LKMH/RtsWLi5d0 Ez+AsEEyrMVVyZTMQoinmZgX1jRa8Hny0A9XGat3QsKCakhzvEAke4KufpQTHOrY GPzFxw== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:content-type :date:from:in-reply-to:message-id:mime-version:references :subject:to:x-me-proxy:x-me-proxy:x-me-sender:x-me-sender :x-sasl-enc; s=fm2; bh=HsZye0FyZeQ4ntFAnh5j7CfGM/OxfEdmREjTi6mmg fY=; b=qdeHy3DW2a8se4XoEAO/wIHkZL+Ewf21D4A1O/xTJPyxMjB9Tmo2FB3r5 A6yI90MixZn55VFp9WvUnZUeNVk9pnwpsZaP38HmOlWNkqtVYfUbFrCY5Gvx37rW teheCH9sRw85jDKd6C2oST0qaftmI+s/EWvoLIFbnVJXvXxZkuwoBr61CffF+K9P nv5K4Kd0lrYFwKgw/xKrN+T6t39DM8TWc7eaxEkkZbEnKotPK8qfxfQNF0LPNZMR TOuaExCyPNQ7pXSs5NPgdMxOpL3r1MahKCJj32A+8ajCM0nGgyMzlnQx9yRjnL4e ByLiRjPlZMTgBO1P5Tl6Hi3kyow5w== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrvdegvddgkeekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepfhgfhffvufffjgfkgggtgfesthhqredttderjeenucfhrhhomheplfhoohhs thcumfhrvghmvghrshcuoehjohhoshhtkhhrvghmvghrshesfhgrshhtmhgrihhlrdhfmh eqnecuggftrfgrthhtvghrnhepvddvgfeghfdtiefhvedvvddtjefhleejveeltdelffev hfeijeekhfdutdffgeefnecukfhppeefuddrudejrddvhedurdduleelnecuvehluhhsth gvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepjhhoohhsthhkrhgvmhgv rhhssehfrghsthhmrghilhdrfhhm X-ME-Proxy: Received: from Swift.fastmail.com (ip1f11fbc7.dynamic.kabel-deutschland.de [31.17.251.199]) by mail.messagingengine.com (Postfix) with ESMTPA; Fri, 7 May 2021 11:23:50 -0400 (EDT) References: <87fsyy6at8.fsf@fastmail.fm> <875yzuk9qd.fsf@posteo.de> <875yzuwv4z.fsf@fastmail.fm> <87tuneis8a.fsf@posteo.de> User-agent: mu4e 1.5.12; emacs 27.2.50 From: Joost Kremers To: Titus von der Malsburg Subject: Re: CSL-JSON support for =parsebib= Date: Fri, 07 May 2021 16:47:57 +0200 In-reply-to: <87tuneis8a.fsf@posteo.de> Message-ID: <8735uywosb.fsf@fastmail.fm> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=64.147.123.24; envelope-from=joostkremers@fastmail.fm; helo=wout1-smtp.messagingengine.com X-Spam_score_int: -27 X-Spam_score: -2.8 X-Spam_bar: -- X-Spam_report: (-2.8 / 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_LOW=-0.7, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: emacs-orgmode@gnu.org Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: "Emacs-orgmode" X-Migadu-Flow: FLOW_IN ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1620401141; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post:dkim-signature; bh=HsZye0FyZeQ4ntFAnh5j7CfGM/OxfEdmREjTi6mmgfY=; b=JpKNuXUXkwJj2BhSMphoBsBadS52E1Xh0nGZzRuRtAPee/qVDhYHyN8vEcdgx0YfbkAzfA t34hQ+E2wluum42lWvowjMoPrsNEq3Ugz3u5u7NK5JIBS9FNiicFgWGjLFUpb/SZm7uFZ7 PCJ6Qjlwxhq62cauEd8HY0cpo5pGWlAQyPZaltJljVewDqKC54PREyAq2NY+ULhhHs3H92 l7cspVpxKvBW1X8uOVKTRcFicAYWy2zEYb2cX3ZDyIPqhvEcaUrB2Ui9iOw4rMYhyJhmzj 2Wt6gnpiZlXu/kPUnE90H2le2/YoFt5q3GdbN7IXs//KiOmon2ehbz7icuTWKA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1620401141; a=rsa-sha256; cv=none; b=IaKMY/8exz2hfgfH48py4TZQo6pP2CecYb8Ef6nCiINMR/QOY8lsMT+nYQlQCggiGx5UOv w9h06Aeq3VxIbV+DFw6j4XMoqKQBWtChj6y4SZ3buxWhedVWKpYliCkcEUjpRIGSJBFDE8 RK+K3pWR+uDoall+/VcbqB2D1EMy2jTSIzp/D3RFFKme6DvlZ4dCJpWHX5vg+dZ6FgOWUe tgNst4d9k7kHW6jEV+XeKzVPgnRIKnzmYdWBrBAuFQRnJA04/OPm/WB2/IqahiyBl0xhzN WQ4DpzzJstJl1IXL1jN2i2BWun6yxz+VN8l3gtsSRdj6t1BGsMBG/KUkG7NL0w== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=fastmail.fm header.s=fm3 header.b="TkENH/CB"; dkim=pass header.d=messagingengine.com header.s=fm2 header.b=qdeHy3DW; dmarc=pass (policy=none) header.from=fastmail.fm; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Spam-Score: -1.65 Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=fastmail.fm header.s=fm3 header.b="TkENH/CB"; dkim=pass header.d=messagingengine.com header.s=fm2 header.b=qdeHy3DW; dmarc=pass (policy=none) header.from=fastmail.fm; spf=pass (aspmx1.migadu.com: domain of emacs-orgmode-bounces@gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=emacs-orgmode-bounces@gnu.org X-Migadu-Queue-Id: 901221E59C X-Spam-Score: -1.65 X-Migadu-Scanner: scn0.migadu.com X-TUID: bw7am3ZAqZTM On Fri, May 07 2021, Titus von der Malsburg wrote: >> Apparently, =3Djson-parse-{buffer|string}=3D then gives you a symbol wit= h a space >> in it... > > I now see that symbol names =E2=80=9Ccan contain any characters whatever= =E2=80=9D [1]. But many > characters need to be escaped (like spaces) which isn=E2=80=99t pretty. Agreed. But if you pass such a symbol to =3Dsymbol-name=3D or to =3D(format= "%s")=3D, the escape character is removed, so when it comes to displaying those symbo= ls to users, it shouldn't matter much. Note, though, that the keys in CSL-JSON don't seem to contain any spaces or other weird characters. There are just lower case a-z and dash, that's all. >> This works for the Elisp library =3Djson.el=3D, but Emacs 27 can be comp= iled with >> native JSON support, which, however, doesn't provide this option, >> unfortunately. > > I see. In this case it might make sense to propose string keys as a featu= re for > json.c. The key is a string anyway at some point during parsing, so avoid= ing the > conversion to symbol may actually be the best way to speed things up. True. I'll ask on emacs-devel. Personally, I'd prefer strings, too, but I'm= a bit hesitant about doing the conversion myself, esp. given that in Ebib, al= l the keys would need to be converted back before I can save a file. >> That would be easy to support, but IMHO is better handled in >> bibtex-completion: >> just parse the buffer and then call =3Dgethash=3D on the resulting hash = table. Or >> what use-case do you have in mind? > > One use case: bibtex-completion drops fields that aren=E2=80=99t needed e= arly on to save > memory and CPU cycles. (Some people work with truly enormous bibliographi= es, > like crypto.bib with ~60K entries.) But this means that we sometimes have= to > read an individual entry again if we need more fields that were dropped e= arlier. > In this case I=E2=80=99d like to be able to read just one entry without h= aving to > reparse the complete bibliography. Makes sense. For .bib sources, this should be fairly easy to do. For .json,= I can't really say how easy it would be. It's not difficult to find the entry= key in the buffer, but from there you'd have to be able to find the start of the entry in order to parse it. Currently, I don't know how to do that. >>> - Functions for resolving strings and cross-references. [...] >> parsebib has a lower-level API and a higher-level API, and the latter do= es >> essentially what you suggest here. I thought bibtex-completion was alrea= dy >> using it... > > Nope. I think the high-level API didn=E2=80=99t exist when I wrote my cod= e in 2014. No, it didn't. I seem to remember, though, that you gave me the idea for the higher-level API, which is probably why I assumed you were using it. So that part of =3Dparsebib=3D hasn't been tested much... (Ebib doesn't use= it, either). If you do decide to start using it, please test it and report any issues you find. And let me know if I can help with testing. --=20 Joost Kremers Life has its moments