From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kaushal Modi Subject: Re: Add ability to force-enable TOC Date: Tue, 19 Sep 2017 15:00:17 +0000 Message-ID: References: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary="001a1141e7989c964405598c1ec4" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46969) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1duK0m-0005RJ-EH for emacs-orgmode@gnu.org; Tue, 19 Sep 2017 11:00:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1duK0i-0001Wa-M2 for emacs-orgmode@gnu.org; Tue, 19 Sep 2017 11:00:32 -0400 Received: from mail-yw0-x22d.google.com ([2607:f8b0:4002:c05::22d]:43942) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1duK0i-0001WT-Hd for emacs-orgmode@gnu.org; Tue, 19 Sep 2017 11:00:28 -0400 Received: by mail-yw0-x22d.google.com with SMTP id s62so211928ywg.0 for ; Tue, 19 Sep 2017 08:00:28 -0700 (PDT) In-Reply-To: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: "Emacs-orgmode" To: emacs-org list --001a1141e7989c964405598c1ec4 Content-Type: text/plain; charset="UTF-8" On Tue, Sep 19, 2017 at 10:49 AM Kaushal Modi wrote: > Can we enforce the TOC generation using the "toc:" option. Below does not > work at the moment, but would like that to work. > > #+OPTIONS: num:nil H:4 toc:4 > Above works after the below patch: diff --git a/lisp/ox.el b/lisp/ox.el index 2be77a87b33..1831432df87 100644 --- a/lisp/ox.el +++ b/lisp/ox.el @@ -5227,7 +5227,8 @@ Footnote sections and unnumbered headlines are ignored." (org-element-map (org-element-contents scope) 'headline (lambda (headline) (unless (or (org-element-property :footnote-section-p headline) - (not (org-export-numbered-headline-p headline info))) + (and (null (plist-get info :with-toc)) + (not (org-export-numbered-headline-p headline info)))) (let ((level (org-export-get-relative-level headline info))) (and (<= level n) headline)))) info))) But I am pretty sure that's not the right way as the default value of org-export-with-toc is t. -- Kaushal Modi --001a1141e7989c964405598c1ec4 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
On Tue, Sep 19= , 2017 at 10:49 AM Kaushal Modi <kaushal.modi@gmail.com> wrote:
Can we enforce the TOC generation using the &qu= ot;toc:" option. Below does not work at the moment, but would like tha= t to work.

#+OPTIONS: num:nil H:4 toc:4 =C2=A0=

Above works after the below pa= tch:

diff --git a/lisp/ox.el b/lisp/ox.el
index 2be77a87b33..1831432df87 100644
--- a/lisp/ox.el
+++ b/lisp/ox.el
@@ -5227,7 +5227,8 @@ Footnote sections and un= numbered headlines are ignored."
=C2=A0 =C2=A0 =C2=A0(org-el= ement-map (org-element-contents scope) 'headline
=C2=A0 =C2= =A0 =C2=A0 =C2=A0(lambda (headline)
=C2=A0 (unless (or (org-element-property :footnote-section-p head= line)
- =C2=A0 =C2=A0(no= t (org-export-numbered-headline-p headline info)))
+ =C2=A0 =C2=A0(and (null (plist-get info :wit= h-toc))
+ (not (org-exp= ort-numbered-headline-p headline info))))
=C2=A0 =C2=A0(let ((level (org-export-get-relative-level h= eadline info)))
=C2=A0 = =C2=A0 =C2=A0(and (<=3D level n) headline))))
=C2=A0 =C2=A0 = =C2=A0 =C2=A0info)))

But I am pretty sure that'= ;s not the right way as the default value of org-export-with-toc is t.=C2= =A0
--

Kaushal Modi

--001a1141e7989c964405598c1ec4--