From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp11.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms0.migadu.com with LMTPS id QKo4GQwk7GHDlgAAgWs5BA (envelope-from ) for ; Sat, 22 Jan 2022 16:34:36 +0100 Received: from aspmx1.migadu.com ([2001:41d0:2:4a6f::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp11.migadu.com with LMTPS id ePJ0Fgwk7GG7MQAA9RJhRA (envelope-from ) for ; Sat, 22 Jan 2022 16:34:36 +0100 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 0A25D2A903 for ; Sat, 22 Jan 2022 16:34:36 +0100 (CET) Received: from localhost ([::1]:33024 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1nBIPT-0002gG-6R for larch@yhetil.org; Sat, 22 Jan 2022 10:34:35 -0500 Received: from eggs.gnu.org ([209.51.188.92]:33910) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nBIP1-0002g7-TH for emacs-orgmode@gnu.org; Sat, 22 Jan 2022 10:34:08 -0500 Received: from [2001:4b98:dc4:8::226] (port=37393 helo=relay6-d.mail.gandi.net) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1nBIOw-0002Sc-Kp for emacs-orgmode@gnu.org; Sat, 22 Jan 2022 10:34:04 -0500 Received: (Authenticated sender: admin@nicolasgoaziou.fr) by mail.gandi.net (Postfix) with ESMTPSA id 484A5C0006; Sat, 22 Jan 2022 15:33:57 +0000 (UTC) From: Nicolas Goaziou To: Jonas Bernoulli Subject: Re: [PATCH v3 2/3] ox-texinfo: Optionally use @itemx for certain description list items References: <20211218214038.9459-1-jonas@bernoul.li> <20220118151129.19646-1-jonas@bernoul.li> <20220118151129.19646-3-jonas@bernoul.li> Date: Sat, 22 Jan 2022 16:33:56 +0100 In-Reply-To: <20220118151129.19646-3-jonas@bernoul.li> (Jonas Bernoulli's message of "Tue, 18 Jan 2022 16:11:28 +0100") Message-ID: <874k5vzswr.fsf@nicolasgoaziou.fr> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-Host-Lookup-Failed: Reverse DNS lookup failed for 2001:4b98:dc4:8::226 (failed) Received-SPF: pass client-ip=2001:4b98:dc4:8::226; envelope-from=mail@nicolasgoaziou.fr; helo=relay6-d.mail.gandi.net X-Spam_score_int: -10 X-Spam_score: -1.1 X-Spam_bar: - X-Spam_report: (-1.1 / 5.0 requ) BAYES_00=-1.9, RDNS_NONE=0.793, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: emacs-orgmode@gnu.org X-Mailman-Version: 2.1.29 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 X-Migadu-Country: US ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1642865676; 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:in-reply-to:in-reply-to: references:references:list-id:list-help:list-unsubscribe: list-subscribe:list-post; bh=DjtawncLwg5bXNMWgRgWVuahtRcfRcIh/rnYec10zf0=; b=Mvy5tjMXZUOBxtUPsT+RNJ0wMPCK6I8Ig9oMQerDzbCs7XCDJa4GtJX7FYOQXIXpnjBnar BWUkU9gQXIECtf+/LOZxSbB5BMPKU27Lr2s1TcSdjM70PwfbPwVYIJJRvaO91GF+K4AbFR lWWuF5+/di5Ubql50btc8+DFk3mN5GR6ZFAvoHsWVTzri5L54DHCR39dvLsOeImwGuKiOP p6FUlf27e2gNYdw52WMnMbhGVJFAHo1pk+HeC6A6j260dG4FcAp1kT/9A/CqlP42L9kYNr RC7yjbVpHP97zy12Dzk5Ndiqdo2SQ5Vs5+VGrOFqIKV9EFdZzhAB/VBIplw0dA== ARC-Seal: i=1; s=key1; d=yhetil.org; t=1642865676; a=rsa-sha256; cv=none; b=hptt+WoTfR4QtYv6yC4Mm2XsTpFnS8ut+ad3qB8ruAEHQLwLdPgutgcqWgb7Vtxw0B01wB ZbCghTKORbNemz+oFP24J870oSm6DrUQy5+2nBh/Uwh+XnnsB2/mzb3F7lhcsNGjslDTTu Xjddk2aDqiDnyWj5FQitzuciIVapifjYN8BUwMOf/wCoNPif7We/C13iCKxBKftRNgMtTS kHTwk7QdjLkziil2AQMLEEb6k09bc6tAh+CsWOjhoRrpsbAD1b6JOs4ERvWeS2VtXUEk31 yxGUdCod9brLFAJQxmmLGoZ6NyuKVGRLqKaVb9Xz+Gd1n4vzdV/LBGTsj+FPPA== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Spam-Score: -3.13 Authentication-Results: aspmx1.migadu.com; dkim=none; dmarc=none; spf=pass (aspmx1.migadu.com: domain of "emacs-orgmode-bounces+larch=yhetil.org@gnu.org" designates 209.51.188.17 as permitted sender) smtp.mailfrom="emacs-orgmode-bounces+larch=yhetil.org@gnu.org" X-Migadu-Queue-Id: 0A25D2A903 X-Spam-Score: -3.13 X-Migadu-Scanner: scn1.migadu.com X-TUID: Ph+jfxlyd+x2 Hello, Jonas Bernoulli writes: > * doc/org-manual.org (Plain lists in Texinfo export): Reorder and > document new functionality. > * lisp/ox-texinfo.el: Add org-texinfo--combine-items to the list of > :filter-parse-tree functions of the texinfo backend. > * lisp/ox-texinfo.el (org-texinfo--combine-items) New function. > * lisp/ox-texinfo.el (org-texinfo-item) Transcode combined items to > one @item and one or more @itemx. This looks good. I have some comments below. > #+begin_example > -,#+ATTR_TEXINFO: :table-type vtable :sep , :indic asis > +,#+attr_texinfo: :table-type vtable :indic asis :sep , > - foo, bar :: This is the common text for variables foo and bar. > #+end_example This change is not needed. Org markup is capitalized in examples to make it stand out. It's not great because 1) it is ugly 2) users may think Org syntax is uppercase. But changing that is not the point of this patch. > -#+ATTR_TEXINFO: :enum A > -1. Alpha > -2. Bravo > -3. Charlie > +,#+attr_texinfo: :table-type vtable :indic asis :combine t > +- foo :: > +- bar :: > + This is the common text for variables foo and bar. See above. > (defun org-texinfo--normalize-headlines (tree _backend info) > "Normalize headlines in TREE. > > -BACK-END is the symbol specifying back-end used for export. > +_BACKEND is the symbol `texinfo'; the back-end used for export. You don't need to document ignored arguments. > +(defun org-texinfo--combine-items (tree _backend info) > + "Combine certain description list items. > + > +_BACKEND is the symbol `texinfo'; the back-end used for export. > +INFO is a plist used as a communication channel. Same as above. > +If the `:combine' attribute of a description list is non-nil and > +an item in that list has no body and is followed by another item, > +then remove the first item and prepend its `:tag' to that of the > +second item. > + > +Such an item that absorbed the tags of other items is later > +transcoded to one `@item', followed by one or more `@itemx'. > + > +Return new tree." > + (org-element-map tree 'item > + (lambda (item) > + (let ((plain-list (org-element-property :parent item))) > + (when (and (org-not-nil (org-export-read-attribute > + :attr_texinfo plain-list :compact)) > + (eq (org-element-property :type plain-list) 'descriptive)) > + (let ((next-item > + (cadr (memq item (org-element-contents plain-list))))) I suggest to use `org-export-get-next-element', which is not as low-level as this. > + (when (and next-item > + (not (org-element-contents item)) > + (= (org-element-property :post-blank item) 1)) Be careful, (org-element-property :post-blank item) may be nil. I suggest to use (eq 1 (org-element-property :post-blank item)) instead. > - (items (and tag > - (let ((tag (org-export-data tag info))) > + (items (org-element-property :itemx item)) > + (items (cond (items > + (mapcar (lambda (tag) (org-export-data tag info)) > + (nconc items (list tag)))) > + ((not tag) nil) > + (t > + (setq tag (org-export-data tag info)) OK, but I think this is a bit convoluted. I wonder if we need `org-texinfo--combine-items' at all. I.e., `org-texinfo-item' could decide to prefix current tag with @itemx if 1) the item is empty 2) the list has a non-nil :compact attribute 3) there's another item following it. IOW, we do not need to rely on an :itemx property. WDYT? Regards, -- Nicolas Goaziou