From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp1 ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id IK5OGu/IxGCaTQAAgWs5BA (envelope-from ) for ; Sat, 12 Jun 2021 16:47:11 +0200 Received: from aspmx1.migadu.com ([2001:41d0:2:bcc0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp1 with LMTPS id 0M+uFe/IxGAOKwAAbx9fmQ (envelope-from ) for ; Sat, 12 Jun 2021 14:47:11 +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 A5D5D1BB18 for ; Sat, 12 Jun 2021 16:47:10 +0200 (CEST) Received: from localhost ([::1]:58970 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1ls4uj-0008Mh-JN for larch@yhetil.org; Sat, 12 Jun 2021 10:47:09 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:52284) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ls4u4-0008ME-MW for emacs-orgmode@gnu.org; Sat, 12 Jun 2021 10:46:29 -0400 Received: from relay8-d.mail.gandi.net ([217.70.183.201]:50573) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1ls4u0-0004TD-2u for emacs-orgmode@gnu.org; Sat, 12 Jun 2021 10:46:28 -0400 Received: (Authenticated sender: admin@nicolasgoaziou.fr) by relay8-d.mail.gandi.net (Postfix) with ESMTPSA id 6CA661BF207; Sat, 12 Jun 2021 14:46:19 +0000 (UTC) From: Nicolas Goaziou To: =?utf-8?Q?Andr=C3=A1s?= Simonyi Subject: Re: [wip-cite-new] experimental citeproc-el based activation processor References: Mail-Followup-To: =?utf-8?Q?Andr=C3=A1s?= Simonyi , emacs-orgmode list Date: Sat, 12 Jun 2021 16:46:18 +0200 In-Reply-To: (=?utf-8?Q?=22Andr=C3=A1s?= Simonyi"'s message of "Sat, 12 Jun 2021 13:30:31 +0200") Message-ID: <87sg1nta2t.fsf@nicolasgoaziou.fr> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Received-SPF: pass client-ip=217.70.183.201; envelope-from=mail@nicolasgoaziou.fr; helo=relay8-d.mail.gandi.net X-Spam_score_int: -25 X-Spam_score: -2.6 X-Spam_bar: -- X-Spam_report: (-2.6 / 5.0 requ) BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001, SPF_HELO_NONE=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 list 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=1623509231; 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; bh=8EgcaK5E+XYtcyuZFOhUoQNaay/DDrzfI6eJkdHiAPc=; b=R+4tQSw39hJTbiJeKBTLsXBs/tfNdUWmZyPGLxYKViD/e4+3r+mwjbPbbexTx7Ui+Vvjyy zOq8xnoQJF36WZxUzdGBG1SpC0xlEiEw71nP3EH3NCmTEKu93Fv05lppb054cquGQfYQ18 6WQb/1xm5oPkJVL67YR+xR3LfcKsiVIm+Wxxtg5dCH/8khLL/zXhJMtIUZzGslrYphON58 ApWzUqNHOHNwJY64PLl1LWDD6UkDlDFjO6uSBjlo+VgkppkO6TWV3XwzbB5vo2b6jNOi1m LUvGgxFWTXTUVWxQImpBg9T+dt5G4iGn2OgDZJdBgVd4XcsxO+EtiOOb+/mL2g== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1623509231; a=rsa-sha256; cv=none; b=HklgIN7ldFsq393H92FKF4JPXhYug8+OL0gzXcLd/5P4jgJxJjlH4rTo2qCDmuar9yWLQ9 BsxS96mZ3Os3R5H+3/LUYJJL/h6cFDTGOiZ0l2LBGgTr31IWQyS+6uR4NpZWfOYs/VOrc0 1w2zftC0D71UtqXXQsJ1r3XbhzRMlvmQMpDvyB5RxAdpqPsCx3zSZVE4eRCwi1XL13qwj+ nwwBOtE7FpwT422Abm8AqShDdLnb3bARe0EmqW6nEboNQj4B0W/rnHjbNDyrDJPdfbIkgF yCqXE5qJlVtKWy3ek8dmt/hM5pckeSgPWQ9dmdpkssMjM3BOPxu5btBIrMIhOg== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; 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: -2.43 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; 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: A5D5D1BB18 X-Spam-Score: -2.43 X-Migadu-Scanner: scn1.migadu.com X-TUID: +o0WzqurhKUG Hello, Andr=C3=A1s Simonyi writes: > playing with the new citation API (which is already very impressive > and usable!) I cobbled together an "activation processor" which > fontifies Org citations using citeproc-el generated previews (when the > cursor is elsewhere). It also shows the full references as a tooltip > on mouse-over. Currently everything is very experimental, but if any > of you is willing to give it a try it can be found at > https://github.com/andras-simonyi/org-cite-csl-activate, and, of > course, any feedback is welcome. This looks very nice already! Thanks for sharing. It may make sense to merge it with "oc-csl.el" at some point. If that suits you, there are a few gotchas: - `alist' library isn't usable in Org, as it didn't exist in Emacs 24.3. So, there's unfortunately no `alist-get' for us. - `<=3D' was not a variadic function back in Emacs 24.3, so (<=3D beg (point) end) is not possible either. In addition, I have a couple of comments: - As suggested by Bruce D'Arcus, we might move `org-cite-get-boundaries' in `oc.el' proper, since it is also used elsewhere (at least in "oc-basic.el"). - Nitpick: (car element) =3D> (org-element-type element) - I think it is inefficient to call `org-element-context' in `org-cite-csl-activate--sensor-fun'. You may as well store the parsed object as a text property on the citation during fontification, and read the property in the function above to know where you are. - I am also wondering about the call of `org-element-parse-buffer' in `org-cite-csl-activate-render-all'. It is not wrong per se, but it is only optimal when citation density in every part of the document is not low. This might not be the most common case. The other option is to `re-search-forward' for `org-element-citation-prefix-re' and then call `org-element-context' at point. Of course, optimizing `org-cite-csl-activate-render-all' may not be the top priority, since some latency is to be expected anyway. WDYT? Regards, --=20 Nicolas Goaziou