From: Jonas Bernoulli <jonas@bernoul.li>
To: emacs-orgmode@gnu.org
Subject: [PATCH v5 4/4] ox-texinfo: Allow enabling compact syntax for @itemx per file
Date: Tue, 1 Feb 2022 00:45:40 +0100 [thread overview]
Message-ID: <20220131234540.762181-5-jonas@bernoul.li> (raw)
In-Reply-To: <20220131234540.762181-1-jonas@bernoul.li>
* doc/org-manual.org (Plain lists in Texinfo export): Document the
:texinfo-compact-itemx export option and variable
org-texinfo-compact-itemx.
* lisp/ox-texinfo.el: Add org-texinfo-compact-itemx to the
:options-alist of the texinfo backend.
* lisp/ox-texinfo.el (org-texinfo-compact-itemx): New option.
* lisp/ox-texinfo.el (org-texinfo--massage-key-item): Add INFO
argument and use the :texinfo-compact-itemx export option.
* lisp/ox-texinfo.el (org-texinfo-item): Use the
:texinfo-compact-itemx export option.
---
doc/org-manual.org | 6 +++++-
lisp/ox-texinfo.el | 35 ++++++++++++++++++++++++++---------
2 files changed, 31 insertions(+), 10 deletions(-)
diff --git a/doc/org-manual.org b/doc/org-manual.org
index d7d81c1d4..7cd93ab0e 100644
--- a/doc/org-manual.org
+++ b/doc/org-manual.org
@@ -15307,7 +15307,11 @@ example is transcoded to the same output as above.
This is the common text for variables foo and bar.
#+end_example
-Likewise, the Texinfo export back-end supports two approaches to
+Support for this compact syntax can also be enabled for all lists in a
+file using the =compat-itemx= export option, or globally using the
+variable =org-texinfo-compact-itemx=.
+
+The Texinfo export back-end also supports two approaches to
writing Texinfo definition commands (see [[info:texinfo::Definition
Commands]]). One of them uses description lists and is describe below,
the other is described in [[*Special blocks in Texinfo export]].
diff --git a/lisp/ox-texinfo.el b/lisp/ox-texinfo.el
index 673084859..dba93e318 100644
--- a/lisp/ox-texinfo.el
+++ b/lisp/ox-texinfo.el
@@ -119,8 +119,8 @@ (org-export-define-backend 'texinfo
(:texinfo-table-default-markup nil nil org-texinfo-table-default-markup)
(:texinfo-text-markup-alist nil nil org-texinfo-text-markup-alist)
(:texinfo-format-drawer-function nil nil org-texinfo-format-drawer-function)
- (:texinfo-format-inlinetask-function nil nil org-texinfo-format-inlinetask-function)))
-
+ (:texinfo-format-inlinetask-function nil nil org-texinfo-format-inlinetask-function)
+ (:texinfo-compact-itemx nil "compact-itemx" org-texinfo-compact-itemx)))
\f
;;; User Configurable Variables
@@ -355,6 +355,19 @@ (defcustom org-texinfo-format-inlinetask-function
:group 'org-export-texinfo
:type 'function)
+;;;; Itemx
+
+(defcustom org-texinfo-compact-itemx nil
+ "Non-nil means certain items in description list are transcoded using `@itemx'.
+
+If this is non-nil and an item in a description list has no
+body but is followed by another item, then the second item is
+transcoded to `@itemx'. See info node `(org)Plain lists in
+Texinfo export' for how to enable this for individual lists."
+ :package-version '(Org . "9.6")
+ :group 'org-export-texinfo
+ :type 'boolean)
+
;;;; Compilation
(defcustom org-texinfo-info-process '("makeinfo --no-split %f")
@@ -614,7 +627,7 @@ (defun org-texinfo--separate-definitions (tree _backend info)
(org-texinfo--split-definition plain-list item cmd args))
(t
(when args
- (org-texinfo--massage-key-item plain-list item args))
+ (org-texinfo--massage-key-item plain-list item args info))
(push item items)))))
(unless (org-element-contents plain-list)
(org-element-extract-element plain-list)))))
@@ -663,7 +676,7 @@ (defun org-texinfo--split-plain-list (plain-list items)
(mapc #'org-element-extract-element items))
plain-list))
-(defun org-texinfo--massage-key-item (plain-list item args)
+(defun org-texinfo--massage-key-item (plain-list item args info)
"In PLAIN-LIST modify ITEM based on ARGS.
Reformat ITEM's tag property and determine the arguments for the
@@ -674,7 +687,9 @@ (defun org-texinfo--massage-key-item (plain-list item args)
non-nil and ITEM has no content but is followed by another item,
then store the `@findex' and `@kindex' values in the next item.
If the previous item stored its respecive values in this item,
-then move them to the next item."
+then move them to the next item.
+
+INFO is a plist used as a communication channel."
(let ((key nil)
(cmd nil))
(if (string-match (rx (+ " ")
@@ -701,8 +716,9 @@ (defun org-texinfo--massage-key-item (plain-list item args)
(setq kindex (nconc kindex (list key))))
(cond
((and next-item
- (org-not-nil
- (org-export-read-attribute :attr_texinfo plain-list :compact))
+ (or (plist-get info :texinfo-compact-itemx)
+ (org-not-nil
+ (org-export-read-attribute :attr_texinfo plain-list :compact)))
(not (org-element-contents item))
(eq 1 (org-element-property :post-blank item)))
(org-element-put-property next-item :findex findex)
@@ -1138,8 +1154,9 @@ (defun org-texinfo-item (item contents info)
(let* ((tag (org-element-property :tag item))
(plain-list (org-element-property :parent item))
(compact (and (eq (org-element-property :type plain-list) 'descriptive)
- (org-not-nil (org-export-read-attribute
- :attr_texinfo plain-list :compact))))
+ (or (plist-get info :texinfo-compact-itemx)
+ (org-not-nil (org-export-read-attribute
+ :attr_texinfo plain-list :compact)))))
(previous-item nil))
(when (and compact
(org-export-get-next-element item info)
--
2.35.1
next prev parent reply other threads:[~2022-02-01 0:12 UTC|newest]
Thread overview: 47+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-11-09 18:01 Merging ox-texinfo+ into ox-texinfo Jonas Bernoulli
2021-11-19 12:46 ` Nicolas Goaziou
2021-11-20 21:06 ` Jonas Bernoulli
2021-11-21 12:41 ` Nicolas Goaziou
2021-11-30 16:58 ` Jonas Bernoulli
2021-12-18 21:40 ` [PATCH 0/2] ox-texinfo: Define definition commands using description lists Jonas Bernoulli
2021-12-18 21:40 ` [PATCH 1/2] ox-texinfo: Turn a description list item with "+" bullet into @itemx Jonas Bernoulli
2021-12-26 21:37 ` Nicolas Goaziou
2021-12-27 18:05 ` Jonas Bernoulli
2021-12-30 9:40 ` Nicolas Goaziou
2022-01-05 13:12 ` Jonas Bernoulli
2022-01-23 15:01 ` Jonas Bernoulli
2021-12-18 21:40 ` [PATCH 2/2] ox-texinfo: Define definition commands using description lists Jonas Bernoulli
2021-12-26 21:46 ` Nicolas Goaziou
2021-12-27 18:05 ` Jonas Bernoulli
2021-12-30 0:57 ` Nicolas Goaziou
2022-01-05 13:16 ` Jonas Bernoulli
2022-01-05 13:30 ` [PATCH v2 0/3] " Jonas Bernoulli
2022-01-05 13:30 ` [PATCH v2 1/3] ox-texinfo: Add function for use by kbd macro Jonas Bernoulli
2022-01-05 13:30 ` [PATCH v2 2/3] ox-texinfo: Optionally use @itemx for certain description list items Jonas Bernoulli
2022-01-05 13:30 ` [PATCH v2 3/3] ox-texinfo: Define definition commands using description lists Jonas Bernoulli
2022-01-14 23:01 ` [PATCH v2 0/3] " Jonas Bernoulli
2022-01-18 15:11 ` [PATCH v3 " Jonas Bernoulli
2022-01-18 15:11 ` [PATCH v3 1/3] ox-texinfo: Add function for use by kbd macro Jonas Bernoulli
2022-01-22 15:19 ` Nicolas Goaziou
2022-01-18 15:11 ` [PATCH v3 2/3] ox-texinfo: Optionally use @itemx for certain description list items Jonas Bernoulli
2022-01-22 15:33 ` Nicolas Goaziou
2022-01-23 1:26 ` Jonas Bernoulli
2022-01-23 20:43 ` Jonas Bernoulli
2022-01-18 15:11 ` [PATCH v3 3/3] ox-texinfo: Define definition commands using description lists Jonas Bernoulli
2022-01-23 0:02 ` Nicolas Goaziou
2022-01-23 1:14 ` Jonas Bernoulli
2022-01-23 14:45 ` Jonas Bernoulli
2022-01-23 20:27 ` [PATCH v4 0/3] " Jonas Bernoulli
2022-01-23 20:27 ` [PATCH v4 1/3] ox-texinfo: Add function for use by kbd macro Jonas Bernoulli
2022-01-23 20:27 ` [PATCH v4 2/3] ox-texinfo: Optionally use @itemx for certain description list items Jonas Bernoulli
2022-01-23 21:17 ` Jonas Bernoulli
2022-01-23 20:27 ` [PATCH v4 3/3] ox-texinfo: Define definition commands using description lists Jonas Bernoulli
2022-01-31 23:45 ` [PATCH v5 0/4] " Jonas Bernoulli
2022-01-31 23:45 ` [PATCH v5 1/4] ox-texinfo: Add function for use by kbd macro Jonas Bernoulli
2022-01-31 23:45 ` [PATCH v5 2/4] ox-texinfo: Optionally use @itemx for certain description list items Jonas Bernoulli
2022-01-31 23:45 ` [PATCH v5 3/4] ox-texinfo: Define definition commands using description lists Jonas Bernoulli
2022-01-31 23:45 ` Jonas Bernoulli [this message]
2022-02-08 23:46 ` [PATCH v5 0/4] " Nicolas Goaziou
2022-02-11 20:01 ` Jonas Bernoulli
2022-02-15 21:01 ` [PATCH] etc/ORG-NEWS: Add news items about new features in texinfo exporter Jonas Bernoulli
2022-02-22 19:14 ` Nicolas Goaziou
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.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220131234540.762181-5-jonas@bernoul.li \
--to=jonas@bernoul.li \
--cc=emacs-orgmode@gnu.org \
/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/org-mode.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).