Hi, I have an org file with lots of notes for myself. I sometimes export it to html for reading on the browser. I also have a subtree where I wrote beamer presentation about the project. I would like to exclude this from the html export, so I tag it with noexport. Now when I do a subtree export to get the beamer presentation, my presentation has the title: "Text in headline :noexport:". Is there any way to exclude the tag from the exported title short of toggling the tag before export or setting the EXPORT_TITLE property? I was expecting this to work out of the box since I already have tags:nil in the file header. Would this be considered as a bug? -- Suvayu Open source is the future. It sets us free.
suvayu ali <fatkasuvayu+linux@gmail.com> writes: Hi, Suvayu, > > I also have a subtree where I > wrote beamer presentation about the project. I would like to exclude > this from the html export, so I tag it with noexport. > > Now when I do a subtree export ^^^^^^^^^^^^^^^^^ > to get the beamer presentation, my > presentation has the title: "Text in headline :noexport:". Is there > any way to exclude the tag from the exported title short of toggling > the tag before export or setting the EXPORT_TITLE property? > > I was expecting this to work out of the box since I already have > tags:nil in the file header. ^^^^^^^^^^^^^^^^^^^^ > Would this be considered as a bug? I don't think so. Options for *the* specific subtree have to be defined in the subtree: * file ** beamer :noexport: :PROPERTIES: :EXPORT_TITLE: beamer :EXPORT_FILE_NAME: test.html :EXPORT_OPTIONS: H:3 num:nil toc:nil \n:t @:t ::t |:t ^:t f:nil *:t tags:nil TeX:t LaTeX:nil skip:t p:nil author:nil email:nil creator:nil timestamp:nil :END: beamer 2 *** beamer 3 hth Giovanni
Hi Giovanni, On Thu, 27 Oct 2011 11:06:00 +0200 Giovanni Ridolfi <giovanni.ridolfi@yahoo.it> wrote: > suvayu ali <fatkasuvayu+linux@gmail.com> writes: > > Hi, Suvayu, > > > > I also have a subtree where I > > wrote beamer presentation about the project. I would like to exclude > > this from the html export, so I tag it with noexport. > > > > Now when I do a subtree export > ^^^^^^^^^^^^^^^^^ > > to get the beamer presentation, my > > presentation has the title: "Text in headline :noexport:". Is there > > any way to exclude the tag from the exported title short of toggling > > the tag before export or setting the EXPORT_TITLE property? > > > > > I was expecting this to work out of the box since I already have > > tags:nil in the file header. > ^^^^^^^^^^^^^^^^^^^^ > > Would this be considered as a bug? > I don't think so. > > Options for *the* specific subtree have to be defined in the subtree: > > * file > ** beamer :noexport: > :PROPERTIES: > :EXPORT_TITLE: beamer > :EXPORT_FILE_NAME: test.html > :EXPORT_OPTIONS: H:3 num:nil toc:nil \n:t @:t ::t |:t ^:t f:nil *:t > tags:nil TeX:t LaTeX:nil skip:t p:nil author:nil email:nil > creator:nil timestamp:nil :END: beamer 2 > *** beamer 3 > As far as I know, the subtree inherits export and other options from the file header, e.g. ^:{}. I have that set in my file header, and subtree export respects that. That said, I tried your work around, I still get :noexport: in my title with the EXPORT_OPTIONS property set to tags:nil. I tried it with both latex and html export. Now I am pretty much convinced this is a genuine bug. > hth > Giovanni -- Suvayu Open source is the future. It sets us free.
On Thu, 27 Oct 2011 13:42:20 +0200
Suvayu Ali <fatkasuvayu+linux@gmail.com> wrote:
> Hi Giovanni,
>
> On Thu, 27 Oct 2011 11:06:00 +0200
> Giovanni Ridolfi <giovanni.ridolfi@yahoo.it> wrote:
>
> > suvayu ali <fatkasuvayu+linux@gmail.com> writes:
> >
> > Hi, Suvayu,
> > >
> > > I also have a subtree where I
> > > wrote beamer presentation about the project. I would like to
> > > exclude this from the html export, so I tag it with noexport.
> > >
> > > Now when I do a subtree export
> > ^^^^^^^^^^^^^^^^^
> > > to get the beamer presentation, my
> > > presentation has the title: "Text in headline :noexport:". Is
> > > there any way to exclude the tag from the exported title short of
> > > toggling the tag before export or setting the EXPORT_TITLE
> > > property?
> >
> > >
> > > I was expecting this to work out of the box since I already have
> > > tags:nil in the file header.
> > ^^^^^^^^^^^^^^^^^^^^
> > > Would this be considered as a bug?
> > I don't think so.
> >
> > Options for *the* specific subtree have to be defined in the
> > subtree:
> >
> > * file
> > ** beamer :noexport:
> > :PROPERTIES:
> > :EXPORT_TITLE: beamer
> > :EXPORT_FILE_NAME: test.html
> > :EXPORT_OPTIONS: H:3 num:nil toc:nil \n:t @:t ::t |:t ^:t f:nil *:t
> > tags:nil TeX:t LaTeX:nil skip:t p:nil author:nil email:nil
> > creator:nil timestamp:nil :END: beamer 2
> > *** beamer 3
> >
>
> As far as I know, the subtree inherits export and other options from
> the file header, e.g. ^:{}. I have that set in my file header, and
> subtree export respects that. That said, I tried your work around, I
> still get :noexport: in my title with the EXPORT_OPTIONS property set
> to tags:nil. I tried it with both latex and html export. Now I am
> pretty much convinced this is a genuine bug.
>
org-exp.el:2155:(defun org-export-get-title-from-subtree ()
This might be the guilty function. I don't see any checks for tags. I
don't understand the internals here. Maybe someone more well versed can
take a look?
--
Suvayu
Open source is the future. It sets us free.
Hi Suvayu,
Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
> org-exp.el:2155:(defun org-export-get-title-from-subtree ()
Can you instrument this function with edbug-defun and see what might
be wrong with it?
I tried this file:
,----
| * file
|
| ** beamer :noexport:
| :PROPERTIES:
| :EXPORT_TITLE: beamertitle
| :EXPORT_FILE_NAME: test.html
| :EXPORT_OPTIONS: H:3 num:nil toc:nil \n:t @:t ::t |:t ^:t f:nil *:t tags:nil TeX:t LaTeX:nil skip:nil p:nil author:nil email:nil creator:nil timestamp:nil
| :END:
|
| beamer 2
|
| *** beamer 3 :bla:
`----
and exporting the subtree named "beamer :noexport" uses the correct
title here, i.e. "beamertitle".
So I can't reproduce this...
--
Bastien
[-- Attachment #1: Type: text/plain, Size: 1578 bytes --] Hi Bastien, On Sat, 29 Oct 2011 15:08:44 +0200 Bastien <bzg@altern.org> wrote: > Hi Suvayu, > > Suvayu Ali <fatkasuvayu+linux@gmail.com> writes: > > > org-exp.el:2155:(defun org-export-get-title-from-subtree () > > Can you instrument this function with edbug-defun and see what might > be wrong with it? > Lines: 2170: (looking-at org-todo-line-regexp) 2171: (setq title (match-string 3)) I tried using edebug-defun on the above function. I see that it reads the title _with the tags_ no matter what are in the export options. With the attached minimal test file, and starting Emacs as: $ emacs -Q -l ~/.emacs.d/minimal-org.el subtree-test.org I could export the entire file to html correctly (meaning the subtree with the noexport tag is exported correctly). But When exporting the subtree to pdf the noexport tag is included in the presentation title. > I tried this file: > ... > > and exporting the subtree named "beamer :noexport" uses the correct > title here, i.e. "beamertitle". > Sorry I should have provided an example file in the first place. I am not setting the EXPORT_TITLE property. The bug is the tags:nil option is not respected whether it is present in the file header or it is set by the EXPORT_OPTIONS property for the exported subtree. This is puzzling since other export options (e.g. ^:{}) is respected irrespective of whether it is present in the file header or the EXPORT_OPTIONS property. > So I can't reproduce this... > I hope this clearly describes the bug. -- Suvayu Open source is the future. It sets us free. [-- Attachment #2: subtree-test.org --] [-- Type: text/plain, Size: 1169 bytes --] #+TITLE: Subtree export bug #+AUTHOR: Suvayu Ali #+EMAIL: #+DATE: 2011-10-29 Fri #+DESCRIPTION: #+KEYWORDS: #+LANGUAGE: en #+OPTIONS: H:3 num:nil toc:t \n:nil @:t ::t |:t ^:{} -:t f:t *:t <:t #+OPTIONS: TeX:t LaTeX:t skip:nil d:nil todo:t pri:nil tags:nil #+EXPORT_SELECT_TAGS: export #+EXPORT_EXCLUDE_TAGS: noexport * Top level header Irrespective of whether I have =^:{}= in the subtree =EXPORT_OPTIONS=, the subscript/superscript settings are respected. I was expecting the same for =tags:nil=. Not only does that not happen, even setting the option hs no effect on the exported title. This text is not going to be exported to beamer. ** Subtree export tags in title bug :noexport: :PROPERTIES: :EXPORT_FILE_NAME: subtree-test.pdf :EXPORT_DATE: 29 Oct 2011 :LaTeX_CLASS: beamer :LaTeX_CLASS_OPTIONS: [smaller] :BEAMER_FRAME_LEVEL: 1 :EXPORT_AUTHOR: Suvayu Ali :EXPORT_OPTIONS: tags:nil :END: *** Subscript/Superscript + Subscript/Superscript within braces: B^{0}_{s} + Subscript/Superscript without braces: B^0_s *** Acknowledgements + Thanks to XYZ, Foo and Bar [-- Attachment #3: subtree-test.tex --] [-- Type: text/plain, Size: 1026 bytes --] % Created 2011-10-29 Sat 16:38 \documentclass[smaller]{beamer} \usepackage[utf8]{inputenc} \usepackage[T1]{fontenc} \usepackage{fixltx2e} \usepackage{graphicx} \usepackage{longtable} \usepackage{float} \usepackage{wrapfig} \usepackage{soul} \usepackage{textcomp} \usepackage{marvosym} \usepackage{wasysym} \usepackage{latexsym} \usepackage{amssymb} \usepackage{hyperref} \tolerance=1000 \providecommand{\alert}[1]{\textbf{#1}} \title{Subtree export tags in title bug \textbf{:noexport:}} \author{Suvayu Ali} \date{29 Oct 2011} \hypersetup{ pdfkeywords={}, pdfsubject={}, pdfcreator={Emacs Org-mode version 7.7}} \begin{document} \maketitle \begin{frame} \frametitle{Subscript/Superscript} \label{sec-1} \begin{itemize} \item Subscript/Superscript within braces: B$^{0}$$_{s}$ \item Subscript/Superscript without braces: B\^{}0\_{}s \end{itemize} \end{frame} \begin{frame} \frametitle{Acknowledgements} \label{sec-2} \begin{itemize} \item Thanks to XYZ, Foo and Bar \end{itemize} \end{frame} \end{document}
Hi Suvayu,
Suvayu Ali <fatkasuvayu+linux@gmail.com> writes:
> Sorry I should have provided an example file in the first place. I am
> not setting the EXPORT_TITLE property. The bug is the tags:nil option
> is not respected whether it is present in the file header or it is set
> by the EXPORT_OPTIONS property for the exported subtree. This is
> puzzling since other export options (e.g. ^:{}) is respected
> irrespective of whether it is present in the file header or the
> EXPORT_OPTIONS property.
>
>> So I can't reproduce this...
>
> I hope this clearly describes the bug.
Yes it does, thanks a lot.
Note that EXPORT_OPTIONS is well respected for the children of the
subtree: tags:nil will prevent tags to be displayed (tested in both HTML
and LaTeX.)
Setting EXPORT_TITLE works as a workaround.
If you have time to fix `org-export-get-title-from-subtree' so that it
is aware of the options and removes the tags when needed, that'd be
nice. I put it on my todo list otherwise, but that's not very urgent.
Thanks!
--
Bastien
[-- Attachment #1: Type: text/plain, Size: 1745 bytes --] Hi Bastien and others, On Sat, 29 Oct 2011 18:13:49 +0200 Bastien <bzg@altern.org> wrote: > Hi Suvayu, > > Suvayu Ali <fatkasuvayu+linux@gmail.com> writes: > > > Sorry I should have provided an example file in the first place. I > > am not setting the EXPORT_TITLE property. The bug is the tags:nil > > option is not respected whether it is present in the file header or > > it is set by the EXPORT_OPTIONS property for the exported subtree. > > This is puzzling since other export options (e.g. ^:{}) is respected > > irrespective of whether it is present in the file header or the > > EXPORT_OPTIONS property. > > > >> So I can't reproduce this... > > > > I hope this clearly describes the bug. > > Yes it does, thanks a lot. > > Note that EXPORT_OPTIONS is well respected for the children of the > subtree: tags:nil will prevent tags to be displayed (tested in both > HTML and LaTeX.) > > Setting EXPORT_TITLE works as a workaround. > > If you have time to fix `org-export-get-title-from-subtree' so that it > is aware of the options and removes the tags when needed, that'd be > nice. I put it on my todo list otherwise, but that's not very urgent. > I worked up a (somewhat working) patch, but I am stuck at one little point. I was wondering if someone could help me. In the attached patch, I use the variable org-export-with-tags to check whether tags should be included or skipped in the export title. However irrespective of the export options I get the value not-in-toc. As a result, the tags are not included even if tags:t is set. Is my use of org-export-with-tags incorrect? Is there something else I need to do before I can use it? Thanks for any pointers. -- Suvayu Open source is the future. It sets us free. [-- Attachment #2: 0001-Respect-export-options-for-subtree-export-title.patch --] [-- Type: text/plain, Size: 1118 bytes --] From efae8fc1eaa8bdfbc8cf36aa2ae8ab0a3ec91c40 Mon Sep 17 00:00:00 2001 From: Suvayu Ali <fatkasuvayu+linux@gmail.com> Date: Sun, 30 Oct 2011 00:54:25 +0200 Subject: [PATCH] Respect export options for subtree export title * org-exp.el (org-solidify-link-text): Respect org-export-with-tags when forming the export title during subtree export. TINY CHANGE --- lisp/org-exp.el | 6 ++++-- 1 files changed, 4 insertions(+), 2 deletions(-) diff --git a/lisp/org-exp.el b/lisp/org-exp.el index fa54242..4a69be8 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -2167,8 +2167,10 @@ (defun org-export-get-title-from-subtree () (>= (org-end-of-subtree t t) rend)) ;; This is a subtree, we take the title from the first heading (goto-char rbeg) - (looking-at org-todo-line-regexp) - (setq title (match-string 3)) + (looking-at org-todo-line-tags-regexp) + (setq title (if (eq org-export-with-tags t) + (format "%s\t%s" (match-string 3) (match-string 4)) + (match-string 3))) (org-unmodified (add-text-properties (point) (1+ (point-at-eol)) (list :org-license-to-kill t))) -- 1.7.7
Suvayu Ali <fatkasuvayu+linux@gmail.com> wrote:
> In the attached patch, I use the variable org-export-with-tags to check
> whether tags should be included or skipped in the export title. However
> irrespective of the export options I get the value not-in-toc. As a
> result, the tags are not included even if tags:t is set.
>
> Is my use of org-export-with-tags incorrect? Is there something else I
> need to do before I can use it?
>
Try changing the test to just
+ (setq title (if org-export-with-tags
+ (format "%s\t%s" (match-string 3) (match-string 4))
+ (match-string 3)))
This checks whether org-export-with-tags is non-nil, rather than checking
that it is exactly t. In general, checking for nil or non-nil is probably
a better way to go, unless there are specific reasons to be more specific.
Nick
Hi Nick, On Sat, 29 Oct 2011 21:07:27 -0400 Nick Dokos <nicholas.dokos@hp.com> wrote: > Suvayu Ali <fatkasuvayu+linux@gmail.com> wrote: > > > In the attached patch, I use the variable org-export-with-tags to > > check whether tags should be included or skipped in the export > > title. However irrespective of the export options I get the value > > not-in-toc. As a result, the tags are not included even if tags:t > > is set. > > > > Is my use of org-export-with-tags incorrect? Is there something > > else I need to do before I can use it? > > > > Try changing the test to just > > + (setq title (if org-export-with-tags > + (format "%s\t%s" (match-string 3) > (match-string 4)) > + (match-string 3))) > > This checks whether org-export-with-tags is non-nil, rather than > checking that it is exactly t. In general, checking for nil or > non-nil is probably a better way to go, unless there are specific > reasons to be more specific. > That was my original attempt. But I went with the eq test since I thought tags:not-in-toc would also imply the user doesn't want the tags to be included in the export title. That said, the problem I am facing is org-export-with-tags evaluates to not-in-toc irrespective of what is set by the tags: option (see for example the test file earlier in the thread). So effectively the test is not checking what it is supposed to check. So I was wondering whether I missed something I should be doing. > Nick -- Suvayu Open source is the future. It sets us free.
[-- Attachment #1: Type: text/plain, Size: 880 bytes --] Hi Suvayu, Suvayu Ali <fatkasuvayu+linux@gmail.com> writes: > That said, the problem I am facing is org-export-with-tags evaluates to > not-in-toc irrespective of what is set by the tags: option (see for > example the test file earlier in the thread). So effectively the test > is not checking what it is supposed to check. So I was wondering > whether I missed something I should be doing. The problem is that `org-export-with-tags' is a global option, storing the default value for any buffer (and _a fortiori_ any subtree) -- while you want to check local options, which may be different at export time. Local options are stored in a `org-export-opt-plist'. You get the value of the "tags:" option by checking the property list like this: (plist-get org-export-opt-plist :tags)) Hence the patch below, which you can try to make sure it does what you want. Thanks! [-- Warning: decoded text below may be mangled, UTF-8 assumed --] [-- Attachment #2: correct_title_with_no_tags.patch --] [-- Type: text/x-patch, Size: 1233 bytes --] diff --git a/lisp/org-exp.el b/lisp/org-exp.el index fa54242..b4f6338 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -2160,20 +2160,24 @@ can work correctly." (defun org-export-get-title-from-subtree () "Return subtree title and exclude it from export." (let ((rbeg (region-beginning)) (rend (region-end)) - (inhibit-read-only t) title) + (inhibit-read-only t) + (tags (plist-get org-export-opt-plist :tags)) + title) (save-excursion (goto-char rbeg) (when (and (org-at-heading-p) (>= (org-end-of-subtree t t) rend)) ;; This is a subtree, we take the title from the first heading (goto-char rbeg) - (looking-at org-todo-line-regexp) - (setq title (match-string 3)) + (looking-at org-todo-line-tags-regexp) + (setq title (if (eq tags t) + (format "%s\t%s" (match-string 3) (match-string 4)) + (match-string 3))) (org-unmodified (add-text-properties (point) (1+ (point-at-eol)) (list :org-license-to-kill t))) - (setq title (or (org-entry-get nil "EXPORT_TITLE") title)))) - title)) + (setq title (or (org-entry-get nil "EXPORT_TITLE") title)) + title)))) (defun org-solidify-link-text (s &optional alist) "Take link text and make a safe target out of it." [-- Attachment #3: Type: text/plain, Size: 14 bytes --] -- Bastien
[-- Attachment #1: Type: text/plain, Size: 1372 bytes --] Hi Bastien and all, On Sun, 30 Oct 2011 09:48:06 +0100 Bastien <bzg@altern.org> wrote: > Suvayu Ali <fatkasuvayu+linux@gmail.com> writes: > > > That said, the problem I am facing is org-export-with-tags > > evaluates to not-in-toc irrespective of what is set by the tags: > > option (see for example the test file earlier in the thread). So > > effectively the test is not checking what it is supposed to check. > > So I was wondering whether I missed something I should be doing. > > The problem is that `org-export-with-tags' is a global option, > storing the default value for any buffer (and _a fortiori_ any > subtree) -- while you want to check local options, which may > be different at export time. > > Local options are stored in a `org-export-opt-plist'. You get > the value of the "tags:" option by checking the property list > like this: > > (plist-get org-export-opt-plist :tags)) > > Hence the patch below, which you can try to make sure it does > what you want. > That seems to work only when the EXPORT_OPTIONS property is set for the subtree. Without the property, it doesn't pick up the tags:nil option from the file header. Actually, the property list doesn't even have the tags: property in it. However I did find a solution along those lines and the final patch is attached. :) Cheers, -- Suvayu Open source is the future. It sets us free. [-- Attachment #2: 0001-Respect-export-options-for-subtree-export-title.patch --] [-- Type: text/x-patch, Size: 1577 bytes --] From dac022f103f8498de96fa5d0e40e0b840ae9c7fb Mon Sep 17 00:00:00 2001 From: Suvayu Ali <fatkasuvayu+linux@gmail.com> Date: Wed, 2 Nov 2011 00:26:07 +0100 Subject: [PATCH] Respect export options for subtree export title * org-exp.el (org-solidify-link-text): Respect org-export-with-tags when forming the export title during subtree export. TINY CHANGE --- lisp/org-exp.el | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lisp/org-exp.el b/lisp/org-exp.el index fa54242..e8ad0b9 100644 --- a/lisp/org-exp.el +++ b/lisp/org-exp.el @@ -2160,15 +2160,21 @@ (defun org-export-grab-title-from-buffer () (defun org-export-get-title-from-subtree () "Return subtree title and exclude it from export." (let ((rbeg (region-beginning)) (rend (region-end)) - (inhibit-read-only t) title) + (inhibit-read-only t) + (tags (plist-get (org-infile-export-plist) :tags)) + title) (save-excursion (goto-char rbeg) (when (and (org-at-heading-p) (>= (org-end-of-subtree t t) rend)) + (when (plist-member org-export-opt-plist :tags) + (setq tags (or (plist-get org-export-opt-plist :tags) tags))) ;; This is a subtree, we take the title from the first heading (goto-char rbeg) - (looking-at org-todo-line-regexp) - (setq title (match-string 3)) + (looking-at org-todo-line-tags-regexp) + (setq title (if (eq tags t) + (format "%s\t%s" (match-string 3) (match-string 4)) + (match-string 3))) (org-unmodified (add-text-properties (point) (1+ (point-at-eol)) (list :org-license-to-kill t))) -- 1.7.7
Hi Suvayu,
suvayu ali <fatkasuvayu+linux@gmail.com> writes:
> However I did find a solution along those lines and the final patch is
> attached. :)
Great. I've applied this patch now, thanks for your work on this!
Best,
--
Bastien