From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mp2.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by ms8.migadu.com with LMTPS id SCcKMURy52VkUwAAe85BDQ:P1 (envelope-from ) for ; Tue, 05 Mar 2024 20:28:04 +0100 Received: from aspmx1.migadu.com ([2001:41d0:403:58f0::]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) by mp2.migadu.com with LMTPS id SCcKMURy52VkUwAAe85BDQ (envelope-from ) for ; Tue, 05 Mar 2024 20:28:04 +0100 X-Envelope-To: larch@yhetil.org Authentication-Results: aspmx1.migadu.com; dkim=pass header.d=iro.umontreal.ca header.s=mail header.b=MEvmIE0A; 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"; dmarc=pass (policy=quarantine) header.from=iro.umontreal.ca ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=yhetil.org; s=key1; t=1709666884; 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:dkim-signature; bh=bLRnN2tHhcLO6Q1ky9gdqvJvhFh2Sgv6aBV0rdwMqHI=; b=SsFTDrZeKzl3mWOXnvpklDI+nH5oqpd64UGNxcPlrCbaI0r3tpzEt5NvoJgfBslGZ+VM45 JiujTzdTH0XVgGJHJcADSMs5w4N1mJ8TWGuCz5maL+u/tbY64Jy+NPrzqDx+qAGWQTD5Sy Kr9gSYcjprM2hSifAkbp1AZnKpqfoVYLBkp/RfqSbpyHu5KB8iN9o0k4saQsHPBTA2LV1E RyGL/RtSZbKGPWq3EwEhtVW15DAQ8YEnVpSRlLMxW424rs3M892sA6Y7xgRyKVUQC4SXRL iJkWz9x3Jl17vBHJzjeXv/4w+XlgYpa5yHiB5If3tHYiONl9zqqQy5GF+eQ2ew== ARC-Authentication-Results: i=1; aspmx1.migadu.com; dkim=pass header.d=iro.umontreal.ca header.s=mail header.b=MEvmIE0A; 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"; dmarc=pass (policy=quarantine) header.from=iro.umontreal.ca ARC-Seal: i=1; s=key1; d=yhetil.org; t=1709666884; a=rsa-sha256; cv=none; b=rrmBeMQYPtK+gjRFiE8VtXKyb+Mx9eF0DDX7XE6hv87bSUY3rpSAaTyqKaZmjAdr5C7QkG y1xz1HJo+fs7gVlA0Pdqb/y0mgEHlXqFVJM+PxYvwg+n2BzxceLKvyhjn+3Slz8aagqF4V Z3ZV/lHjzG5pMSpagM7gGbIbUSNWBFiH476+Efr8WqLOjtgWIScUrU8eibvdoCq9XbQKGf XruvRgzU8OQPiH0le5Qz6TCgzIfowz9kKWV/WspFL6MxPMEWFBKRxLoHtG9ihSoDDBCuwP 9QUsz3kgVjhKRDjMKYyw1h26kFpDm5AirRg9NIx3j1LFx/FjQE0j3CstE+GmSg== 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 06B476CDAC for ; Tue, 5 Mar 2024 20:28:04 +0100 (CET) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1rhaRh-0000KB-Jt; Tue, 05 Mar 2024 14:27:25 -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 1rhaRd-0000JW-7s for emacs-orgmode@gnu.org; Tue, 05 Mar 2024 14:27:21 -0500 Received: from mailscanner.iro.umontreal.ca ([132.204.25.50]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1rhaRZ-0004yM-J5 for emacs-orgmode@gnu.org; Tue, 05 Mar 2024 14:27:20 -0500 Received: from pmg2.iro.umontreal.ca (localhost.localdomain [127.0.0.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 7829380989; Tue, 5 Mar 2024 14:27:12 -0500 (EST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=iro.umontreal.ca; s=mail; t=1709666826; bh=am9b5So2dPSj1sDCEyASnc/ly3d4SbSbJZPdSsn8jqE=; h=From:To:Cc:Subject:In-Reply-To:References:Date:From; b=MEvmIE0A19UUq1xFeQdJX38Hfj6IdcMFjXMoIdBiP1MtoMZuLqRo3HPl2eeQlW1BI eEckT0yM3NfZZ87OXhzbgS0SxsHBVLBKUpgStxyEE58sNw/PVksH2d+qBRs1XaqLG5 WByz3/YZ7E7sqLpLRtefD4CDXtLiGnAG60f+xvQaiguq5Ij7G1YZjOJ6Z32N4z6yH3 Xp4Symc2mn9u734ms9qyFCDZdhm/QKQ5NSGSd/TKxPo82Jpo9QxpvFxiwiBMVie9A6 AllL55S2WSw2rzOnWmHtNH1ENdmN1imK2lbLh1bDlGRVSM+OHkwiGF0n2ixT52TKDV ZfI44xJ5LjpJw== Received: from mail01.iro.umontreal.ca (unknown [172.31.2.1]) by pmg2.iro.umontreal.ca (Proxmox) with ESMTP id 3A98C80394; Tue, 5 Mar 2024 14:27:06 -0500 (EST) Received: from pastel (unknown [104.247.233.29]) by mail01.iro.umontreal.ca (Postfix) with ESMTPSA id 15BDF12034B; Tue, 5 Mar 2024 14:27:06 -0500 (EST) From: Stefan Monnier To: Ihor Radchenko Cc: emacs-orgmode@gnu.org Subject: Re: Provide sane default for the @direntry In-Reply-To: <87o7bs4zdf.fsf@localhost> (Ihor Radchenko's message of "Tue, 05 Mar 2024 12:49:48 +0000") Message-ID: References: <87v868khb2.fsf@localhost> <871q8q1cfd.fsf@localhost> <87o7bs4zdf.fsf@localhost> Date: Tue, 05 Mar 2024 14:27:05 -0500 User-Agent: Gnus/5.13 (Gnus v5.13) MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Received-SPF: pass client-ip=132.204.25.50; envelope-from=monnier@iro.umontreal.ca; helo=mailscanner.iro.umontreal.ca X-Spam_score_int: -42 X-Spam_score: -4.3 X-Spam_bar: ---- X-Spam_report: (-4.3 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, RCVD_IN_DNSWL_MED=-2.3, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=ham 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: , Errors-To: emacs-orgmode-bounces+larch=yhetil.org@gnu.org Sender: emacs-orgmode-bounces+larch=yhetil.org@gnu.org X-Migadu-Country: US X-Migadu-Flow: FLOW_IN X-Migadu-Spam-Score: -12.01 X-Spam-Score: -12.01 X-Migadu-Queue-Id: 06B476CDAC X-Migadu-Scanner: mx11.migadu.com X-TUID: bT5GXH+H4+Jq --=-=-= Content-Type: text/plain New version of the patch, which I believe address your comments. Stefan --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0001-lisp-org-ox-texinfo.el-Remove-redundant-group-s.patch >From 53c8fab18625e8a722657181cb3c825a1d8c895c Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 5 Mar 2024 14:11:19 -0500 Subject: [PATCH 1/2] * lisp/org/ox-texinfo.el: Remove redundant `:group`s --- lisp/org/ox-texinfo.el | 22 ++-------------------- 1 file changed, 2 insertions(+), 20 deletions(-) diff --git a/lisp/org/ox-texinfo.el b/lisp/org/ox-texinfo.el index 84313645e6e..b3b94511d50 100644 --- a/lisp/org/ox-texinfo.el +++ b/lisp/org/ox-texinfo.el @@ -147,12 +147,10 @@ org-texinfo-coding-system "Default document encoding for Texinfo output. If nil it will default to `buffer-file-coding-system'." - :group 'org-export-texinfo :type 'coding-system) (defcustom org-texinfo-default-class "info" "The default Texinfo class." - :group 'org-export-texinfo :type '(string :tag "Texinfo class")) (defcustom org-texinfo-classes @@ -205,7 +203,6 @@ org-texinfo-classes following the header string. For each sectioning level, a number of strings is specified. A %s formatter is mandatory in each section string and will be replaced by the title of the section." - :group 'org-export-texinfo :version "27.1" :package-version '(Org . "9.2") :type '(repeat @@ -233,7 +230,6 @@ org-texinfo-format-headline-function TAGS the tags as a list of strings (list of strings or nil). The function result will be used in the section format string." - :group 'org-export-texinfo :type 'function :version "26.1" :package-version '(Org . "8.3")) @@ -244,38 +240,32 @@ org-texinfo-node-description-column "Column at which to start the description in the node listings. If a node title is greater than this length, the description will be placed after the end of the title." - :group 'org-export-texinfo :type 'integer) ;;;; Timestamps (defcustom org-texinfo-active-timestamp-format "@emph{%s}" "A printf format string to be applied to active timestamps." - :group 'org-export-texinfo :type 'string) (defcustom org-texinfo-inactive-timestamp-format "@emph{%s}" "A printf format string to be applied to inactive timestamps." - :group 'org-export-texinfo :type 'string) (defcustom org-texinfo-diary-timestamp-format "@emph{%s}" "A printf format string to be applied to diary timestamps." - :group 'org-export-texinfo :type 'string) ;;;; Links (defcustom org-texinfo-link-with-unknown-path-format "@indicateurl{%s}" "Format string for links with unknown path type." - :group 'org-export-texinfo :type 'string) ;;;; Tables (defcustom org-texinfo-tables-verbatim nil "When non-nil, tables are exported verbatim." - :group 'org-export-texinfo :type 'boolean) (defcustom org-texinfo-table-scientific-notation nil @@ -285,7 +275,6 @@ org-texinfo-table-scientific-notation \(i.e. \"%s\\\\times10^{%s}\"). When nil, no transformation is made." - :group 'org-export-texinfo :type '(choice (string :tag "Format string") (const :tag "No formatting" nil))) @@ -297,7 +286,6 @@ org-texinfo-table-default-markup \"@samp\". It can be overridden locally using the \":indic\" attribute." - :group 'org-export-texinfo :type 'string :version "26.1" :package-version '(Org . "9.1") @@ -323,7 +311,6 @@ org-texinfo-text-markup-alist When no association is found for a given markup, text is returned as-is." - :group 'org-export-texinfo :version "26.1" :package-version '(Org . "9.1") :type 'alist @@ -341,7 +328,6 @@ org-texinfo-format-drawer-function The function should return the string to be exported. The default function simply returns the value of CONTENTS." - :group 'org-export-texinfo :version "24.4" :package-version '(Org . "8.2") :type 'function) @@ -361,7 +347,6 @@ org-texinfo-format-inlinetask-function CONTENTS the contents of the inlinetask, as a string. The function should return the string to be exported." - :group 'org-export-texinfo :type 'function) ;;;; LaTeX @@ -374,7 +359,6 @@ org-texinfo-with-latex respectively. Alternatively, when set to `detect', the exporter does so only if the installed version of Texinfo supports the necessary commands." - :group 'org-export-texinfo :package-version '(Org . "9.6") :type '(choice (const :tag "Detect" detect) @@ -391,7 +375,6 @@ org-texinfo-compact-itemx 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 :safe t) @@ -406,7 +389,6 @@ org-texinfo-info-process base name (i.e. without directory and extension parts), %o by the base directory of the file and %O by the absolute file name of the output file." - :group 'org-export-texinfo :version "26.1" :package-version '(Org . "9.1") :type '(repeat :tag "Shell command sequence" @@ -416,8 +398,8 @@ org-texinfo-logfiles-extensions '("aux" "toc" "cp" "fn" "ky" "pg" "tp" "vr") "The list of file extensions to consider as Texinfo logfiles. The logfiles will be remove if `org-texinfo-remove-logfiles' is + non-nil." - :group 'org-export-texinfo :type '(repeat (string :tag "Extension"))) (defcustom org-texinfo-remove-logfiles t @@ -1590,7 +1572,7 @@ org-texinfo-planning (concat "@noindent" (mapconcat - 'identity + #'identity (delq nil (list (let ((closed (org-element-property :closed planning))) -- 2.43.0 --=-=-= Content-Type: text/x-diff Content-Disposition: inline; filename=0002-ox-texinfo-Always-provide-a-direntry.patch >From 1318e575eb4b3602c7e26c4bdf1f6176ca1367f1 Mon Sep 17 00:00:00 2001 From: Stefan Monnier Date: Tue, 5 Mar 2024 14:15:55 -0500 Subject: [PATCH 2/2] ox-texinfo:: Always provide a @direntry Until now @dircategory/@direntry entries were added only if both TEXINFO_DIR_CATEGORY and TEXINFO_DIR_TITLE were set. And the setting of TEXINFO_DIR_TITLE had to be careful to provide exactly the right syntax. This patch changes various things in this regard: - Always generate a @dircategory/@direntry. - Default TEXINFO_DIR_CATEGORY to "Misc". - Use the document title by default if TEXINFO_DIR_DESC is missing. - Rename TEXINFO_DIR_TITLE to TEXINFO_DIR_NAME. - Use the filename by default when TEXINFO_DIR_NAME is missing. - Try and make it harder to provide a direntry that does not have the right format or refers to a different filename than the one we're outputting to. * lisp/org/ox-texinfo.el (texinfo): Add entry for TEXINFO_DIR_NAME. (org-texinfo-template): Use sane defaults for `@direntry` and `@dircategory`. * doc/misc/org.org (Texinfo specific export settings): Adjust accordingly. --- doc/misc/org.org | 22 +++++++++++--- etc/ORG-NEWS | 7 +++++ lisp/org/ox-texinfo.el | 65 +++++++++++++++++++++++++++++------------- 3 files changed, 70 insertions(+), 24 deletions(-) diff --git a/doc/misc/org.org b/doc/misc/org.org index 05ab5b36ca0..14000dc7a53 100644 --- a/doc/misc/org.org +++ b/doc/misc/org.org @@ -15316,17 +15316,31 @@ the general options (see [[*Export Settings]]). - =TEXINFO_DIR_CATEGORY= :: #+cindex: @samp{TEXINFO_DIR_CATEGORY}, keyword - The directory category of the document. + The directory category of the document. Defaults to ~Misc~. + +- =TEXINFO_DIR_NAME= :: + + #+cindex: @samp{TEXINFO_DIR_NAME}, keyword + The directory name of the document. + This is the short name under which the ~m~ command will find your + manual in the main Info directory. It defaults to the base name of + the Texinfo file. + + The full form of the Texinfo entry is ~* DIRNAME: NODE.~ where ~NODE~ + is usually just ~(FILENAME)~. Normally this option only provides the + ~DIRNAME~ part, but if you need more control, it can also be the full + entry (recognized by the presence of parentheses or a leading ~* ~). - =TEXINFO_DIR_TITLE= :: #+cindex: @samp{TEXINFO_DIR_TITLE}, keyword - The directory title of the document. + Old and obsolete name of the =TEXINFO_DIR_NAME= option. - =TEXINFO_DIR_DESC= :: #+cindex: @samp{TEXINFO_DIR_DESC}, keyword The directory description of the document. + Defaults to the title of the document. - =TEXINFO_PRINTED_TITLE= :: @@ -15422,7 +15436,7 @@ Here is an example that writes to the Info directory file: #+begin_example ,#+TEXINFO_DIR_CATEGORY: Emacs -,#+TEXINFO_DIR_TITLE: Org Mode: (org) +,#+TEXINFO_DIR_TITLE: Org Mode ,#+TEXINFO_DIR_DESC: Outline-based notes management and organizer #+end_example @@ -15830,7 +15844,7 @@ Texinfo code. ,#+TEXINFO_HEADER: @syncodeindex pg cp ,#+TEXINFO_DIR_CATEGORY: Texinfo documentation system -,#+TEXINFO_DIR_TITLE: sample: (sample) +,#+TEXINFO_DIR_TITLE: sample ,#+TEXINFO_DIR_DESC: Invoking sample ,#+TEXINFO_PRINTED_TITLE: GNU Sample diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS index d07ce53ab20..b58d2fe6db4 100644 --- a/etc/ORG-NEWS +++ b/etc/ORG-NEWS @@ -431,6 +431,13 @@ following properties: ~:hook~, ~:prepare-finalize~, ~:before-finalize~, ~:after-finalize~. These nullary functions run prior to their global counterparts for the selected template. +*** ox-texinfo always generates a ~@direntry~ +We use defaults based on the file name and title of the document, and +place the entry in the ~Misc~ category if ~TEXINFO_DIR_CATEGORY~ is missing. + +=TEXINFO_DIR_TITLE= is renamed to =TEXINFO_DIR_NAME=. +The old name is obsolete. + ** New options *** A new option for custom setting ~org-refile-use-outline-path~ to show document title in refile targets diff --git a/lisp/org/ox-texinfo.el b/lisp/org/ox-texinfo.el index b3b94511d50..de5f87fa029 100644 --- a/lisp/org/ox-texinfo.el +++ b/lisp/org/ox-texinfo.el @@ -110,7 +110,8 @@ 'texinfo (:subtitle "SUBTITLE" nil nil parse) (:subauthor "SUBAUTHOR" nil nil newline) (:texinfo-dircat "TEXINFO_DIR_CATEGORY" nil nil t) - (:texinfo-dirtitle "TEXINFO_DIR_TITLE" nil nil t) + (:texinfo-dirtitle "TEXINFO_DIR_TITLE" nil nil t) ;Obsolete. + (:texinfo-dirname "TEXINFO_DIR_NAME" nil nil t) (:texinfo-dirdesc "TEXINFO_DIR_DESC" nil nil t) (:texinfo-printed-title "TEXINFO_PRINTED_TITLE" nil nil t) ;; Other variables. @@ -797,25 +798,49 @@ org-texinfo-template (format "@copying\n%s@end copying\n\n" (org-element-normalize-string (org-export-data copying info)))) - ;; Info directory information. Only supply if both title and - ;; category are provided. - (let ((dircat (plist-get info :texinfo-dircat)) - (dirtitle - (let ((title (plist-get info :texinfo-dirtitle))) - (and title - (string-match "^\\(?:\\* \\)?\\(.*?\\)\\(\\.\\)?$" title) - (format "* %s." (match-string 1 title)))))) - (when (and dircat dirtitle) - (concat "@dircategory " dircat "\n" - "@direntry\n" - (let ((dirdesc - (let ((desc (plist-get info :texinfo-dirdesc))) - (cond ((not desc) nil) - ((string-suffix-p "." desc) desc) - (t (concat desc ".")))))) - (if dirdesc (format "%-23s %s" dirtitle dirdesc) dirtitle)) - "\n" - "@end direntry\n\n"))) + (let* ((dircat (or (plist-get info :texinfo-dircat) "Misc")) + (file (file-name-sans-extension + (or (org-strip-quotes (plist-get info :texinfo-filename)) + (plist-get info :output-file)))) + (dn (or (plist-get info :texinfo-dirname) + (plist-get info :texinfo-dirtitle))) ;Obsolete name. + ;; Strip any terminating `.' from `dn'. + (dn (if (string-match "\\.\\'" dn) (substring dn 0 -1) dn)) + ;; The direntry we need to produce has the shape: + ;; * DIRNAME: NODE. DESCRIPTION. + ;; where NODE is usually just `(FILENAME)', and where + ;; `* FILENAME.' is a shorthand for `* FILENAME: (FILENAME).' + (dirname + (cond + ((and dn (string-match + (eval-when-compile + (concat "\\`\\(?:" + "\\* \\(?1:.*\\)" ;Starts with `* ' or + "\\|\\(?1:.*(.*).*\\)" ;contains parens. + "\\)\\'")) + dn)) + ;; When users provide a `dn' that looks like a complete + ;; `* DIRNAME: (FILENAME).' thingy, we just trust them to + ;; provide something valid (just making sure it starts + ;; with `* ' and ends with `.'). + (format "* %s." (match-string 1 dn))) + ;; `dn' is presumed to be just the DIRNAME part, so generate + ;; either `* DIRNAME: (FILENAME).' or `* FILENAME.', whichever + ;; is shortest. + ((and dn (not (equal dn file))) + (format "* %s: (%s)." dn file)) + (t (format "* %s." file))))) + (concat "@dircategory " dircat "\n" + "@direntry\n" + (let ((dirdesc + (let ((desc (or (plist-get info :texinfo-dirdesc) + title))) + (cond ((not desc) nil) + ((string-suffix-p "." desc) desc) + (t (concat desc ".")))))) + (if dirdesc (format "%-23s %s" dirname dirdesc) dirname)) + "\n" + "@end direntry\n\n")) ;; Title "@finalout\n" "@titlepage\n" -- 2.43.0 --=-=-=--