all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* excluding whole trees on export when subtrees have "select" tags present
@ 2017-01-09  9:48 Eric S Fraga
  2017-01-09 15:46 ` John Kitchin
       [not found] ` <b3655cb7d021410f872939e0fedfee6a@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
  0 siblings, 2 replies; 7+ messages in thread
From: Eric S Fraga @ 2017-01-09  9:48 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1126 bytes --]

Hello all,

In this very minimal example,

#+begin_src org
  ,#+select_tags: wanted
  ,* headline                                                   :notwanted:
  some text
  ,** subhead                                                     :wanted:
  more text
#+end_src

exporting exports the whole tree under /headline/.  I can see why but it
is arguably the wrong thing to do.  If /notwanted/ hasn't been selected,
I would have assumed that all the contents under that headline would be
ignored during export.

My problem is that I want to export a document where certain headlines
(but not all) are included *and* within these, some subheadlines are
also included but not all.  I would be specifying one or two tags for
selection depending on the specific export case.

I can achieve what I want by commenting and uncommenting headlines but
this is very clumsy and error-prone for my use case.

I guess I simply want to confirm that the above noted behaviour is
indeed what is expected from org.  If so, I will find a work-around.

Thanks,
eric

-- 
Eric S Fraga (GnuPG: 0xC89193D8FFFCF67D)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: excluding whole trees on export when subtrees have "select" tags present
  2017-01-09  9:48 excluding whole trees on export when subtrees have "select" tags present Eric S Fraga
@ 2017-01-09 15:46 ` John Kitchin
       [not found] ` <b3655cb7d021410f872939e0fedfee6a@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
  1 sibling, 0 replies; 7+ messages in thread
From: John Kitchin @ 2017-01-09 15:46 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: emacs-orgmode

Based on the docstrings for org-export-select-tags and
org-export-exclude-tags, this looks expected.

It does not look possible to exclude a heading and include a subheading
under it. It is possible to include a heading and exclude some
subheadings though you need a wanted tag in the parent, and notwanted
tags in the subtrees, and to declare the exclude tags.

#+EXCLUDE_TAGS: notwanted

I am surprised you can use comment like this. It looks to me like
commenting a tree makes all the subtrees in it not export too.

I could see somehow an org-export-before-processing-hook function that
deletes headlines and content you do not want, but it will mess with the
outline, e.g. if you delete "* headline" but leave "** subhead".
I thought I would be able to comment headlines with a hook function like
this, but I could not get it to work. Maybe it is a local problem though.


Eric S Fraga writes:

> Hello all,
>
> In this very minimal example,
>
> #+begin_src org
>   ,#+select_tags: wanted
>   ,* headline                                                   :notwanted:
>   some text
>   ,** subhead                                                     :wanted:
>   more text
> #+end_src
>
> exporting exports the whole tree under /headline/.  I can see why but it
> is arguably the wrong thing to do.  If /notwanted/ hasn't been selected,
> I would have assumed that all the contents under that headline would be
> ignored during export.
>
> My problem is that I want to export a document where certain headlines
> (but not all) are included *and* within these, some subheadlines are
> also included but not all.  I would be specifying one or two tags for
> selection depending on the specific export case.
>
> I can achieve what I want by commenting and uncommenting headlines but
> this is very clumsy and error-prone for my use case.
>
> I guess I simply want to confirm that the above noted behaviour is
> indeed what is expected from org.  If so, I will find a work-around.
>
> Thanks,
> eric


-- 
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: excluding whole trees on export when subtrees have "select" tags present
       [not found] ` <b3655cb7d021410f872939e0fedfee6a@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
@ 2017-01-09 21:49   ` Eric S Fraga
  2017-01-10 14:27     ` John Kitchin
       [not found]     ` <617f560207eb41c0888a6f3c6a8df9db@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
  0 siblings, 2 replies; 7+ messages in thread
From: Eric S Fraga @ 2017-01-09 21:49 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1213 bytes --]

On Monday,  9 Jan 2017 at 15:46, John Kitchin wrote:
> Based on the docstrings for org-export-select-tags and
> org-export-exclude-tags, this looks expected.
>
> It does not look possible to exclude a heading and include a subheading
> under it. It is possible to include a heading and exclude some
> subheadings though you need a wanted tag in the parent, and notwanted
> tags in the subtrees, and to declare the exclude tags.

I think I was unclear.  My confusion is that a tree (rooted at a top
level headline) that I do not want exported is nevertheless exported if
a subtree within that tree has a "selected" tag.  I would have thought
the higher level heading would take precedence.

> I am surprised you can use comment like this. It looks to me like
> commenting a tree makes all the subtrees in it not export too.

Yes, it is.  Again, I obviously didn't explain myself well.  I have
resorted to commenting out whole trees (rooted at headlines) to avoid
them being exported because a sub-tree has the selected tag.

In any case, I have found a workaround by inverting my tag usage.

thanks,
eric

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 26.0.50.1, Org release_9.0.3-189-ge46676

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: excluding whole trees on export when subtrees have "select" tags present
  2017-01-09 21:49   ` Eric S Fraga
@ 2017-01-10 14:27     ` John Kitchin
       [not found]     ` <617f560207eb41c0888a6f3c6a8df9db@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
  1 sibling, 0 replies; 7+ messages in thread
From: John Kitchin @ 2017-01-10 14:27 UTC (permalink / raw)
  To: Eric S Fraga; +Cc: emacs-orgmode

This does not sound right to me.

This org file:

#+BEGIN_SRC org
,#+select_tags: wanted
,#+exclude_tags: notwanted

,* headline                                                        :notwanted:
  some text

,** subhead 1
,** subhead2                                                          :wanted:
  more text
#+END_SRC

should not have any thing to export.

In contrast:

#+BEGIN_SRC org
,#+select_tags: wanted
,#+exclude_tags: notwanted
,* headline                                                        :wanted:
  some text

,** subhead 1
,** subhead2                                                          :notwanted:
  more text

#+END_SRC

will export headline and subhead1.

At least, that is what I see.

Eric S Fraga writes:

> On Monday,  9 Jan 2017 at 15:46, John Kitchin wrote:
>> Based on the docstrings for org-export-select-tags and
>> org-export-exclude-tags, this looks expected.
>>
>> It does not look possible to exclude a heading and include a subheading
>> under it. It is possible to include a heading and exclude some
>> subheadings though you need a wanted tag in the parent, and notwanted
>> tags in the subtrees, and to declare the exclude tags.
>
> I think I was unclear.  My confusion is that a tree (rooted at a top
> level headline) that I do not want exported is nevertheless exported if
> a subtree within that tree has a "selected" tag.  I would have thought
> the higher level heading would take precedence.
>
>> I am surprised you can use comment like this. It looks to me like
>> commenting a tree makes all the subtrees in it not export too.
>
> Yes, it is.  Again, I obviously didn't explain myself well.  I have
> resorted to commenting out whole trees (rooted at headlines) to avoid
> them being exported because a sub-tree has the selected tag.
>
> In any case, I have found a workaround by inverting my tag usage.
>
> thanks,
> eric


-- 
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: excluding whole trees on export when subtrees have "select" tags present
       [not found]     ` <617f560207eb41c0888a6f3c6a8df9db@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
@ 2017-01-11 15:26       ` Eric S Fraga
  2017-01-11 20:26         ` Nicolas Goaziou
       [not found]         ` <af9636231a6b44598ee8e17caee8e941@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
  0 siblings, 2 replies; 7+ messages in thread
From: Eric S Fraga @ 2017-01-11 15:26 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 1837 bytes --]

On Tuesday, 10 Jan 2017 at 14:27, John Kitchin wrote:
> This does not sound right to me.
>
> This org file:
>
> #+BEGIN_SRC org
> ,#+select_tags: wanted
> ,#+exclude_tags: notwanted
>
> ,* headline                                                        :notwanted:
>   some text
>
> ,** subhead 1
> ,** subhead2                                                          :wanted:
>   more text
> #+END_SRC
>
>
> should not have any thing to export.

Yes, and it works.  However, if I don't explicitly specify "notwanted"
as excluded, the whole file is exported.  I guess I don't understand the
meaning of "select_tags": I would like this to specify those trees to be
exported only if the given tags are present.  I would expect the
behaviour to be the same whether I specify excluded tags or not when
selected tags are given, other than exclusion of subtrees within
selected trees.

But I guess my understanding is completely wrong.  And re-reading the
documentation doesn't make things clearer for me.  There seems to be a
gap between selected and excluded tags which is, to me, ambiguous.  If
nothing is specified for either, the documentation implies default
values (:export: and :noexport: respectively).  However, the behaviour
is not consistent with this as, if I do not specify any selected or
excluded tags, the default behaviour is to export everything.

I guess I could look at the code to see what the underlying logic really
is.  For another day, when I have some time -- it's start of term and
I'm doing the headless chicken impression getting material ready for the
students.

Anyway, with the proper combination of both select and exclude tags, I
have managed to get what I want.

Thanks,
eric

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 26.0.50.1, Org release_9.0.2-104-gf5b7de

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: excluding whole trees on export when subtrees have "select" tags present
  2017-01-11 15:26       ` Eric S Fraga
@ 2017-01-11 20:26         ` Nicolas Goaziou
       [not found]         ` <af9636231a6b44598ee8e17caee8e941@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
  1 sibling, 0 replies; 7+ messages in thread
From: Nicolas Goaziou @ 2017-01-11 20:26 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

Eric S Fraga <e.fraga@ucl.ac.uk> writes:

> On Tuesday, 10 Jan 2017 at 14:27, John Kitchin wrote:
>> This does not sound right to me.
>>
>> This org file:
>>
>> #+BEGIN_SRC org
>> ,#+select_tags: wanted
>> ,#+exclude_tags: notwanted
>>
>> ,* headline                                                        :notwanted:
>>   some text
>>
>> ,** subhead 1
>> ,** subhead2                                                          :wanted:
>>   more text
>> #+END_SRC
>>
>>
>> should not have any thing to export.
>
> Yes, and it works.  However, if I don't explicitly specify "notwanted"
> as excluded, the whole file is exported.  I guess I don't understand the
> meaning of "select_tags": I would like this to specify those trees to be
> exported only if the given tags are present.

This is what select tags do, but the tree starts at top-level. Any tree
that _contains_ a select tag is exported as a whole. See
`org-export--selected-trees'.

You want to use select tags to get parts of trees, i.e. sub-trees. For
example,

  * H1
  * H2
  ** SH1      :wanted:
  ** SH2
  *** SSH1    :wanted:

would become morally equivalent to

  * SH1       :wanted:
  * SSH1      :wanted:

This is not possible. 

I had a patch for that, but I never got to apply it because it seemed
very hackish. Also, you can do the same in a hook, where a function
would delete any entry not tagged "wanted" prior to export.

Regards,

-- 
Nicolas Goaziou

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: excluding whole trees on export when subtrees have "select" tags present
       [not found]         ` <af9636231a6b44598ee8e17caee8e941@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
@ 2017-01-12  6:50           ` Eric S Fraga
  0 siblings, 0 replies; 7+ messages in thread
From: Eric S Fraga @ 2017-01-12  6:50 UTC (permalink / raw)
  To: emacs-orgmode

[-- Attachment #1: Type: text/plain, Size: 805 bytes --]

On Wednesday, 11 Jan 2017 at 20:26, Nicolas Goaziou wrote:
> This is what select tags do, but the tree starts at top-level. Any tree
> that _contains_ a select tag is exported as a whole. See
> `org-export--selected-trees'.

Yes.

> You want to use select tags to get parts of trees, i.e. sub-trees. For
> example,

But I don't.  What I had expected is that if the tree is not selected at
the top level, then it should not be selected at all regardless of
sub-tree heading tags.  However, if a sub-tree has a selected task, the
whole tree is selected.  I expected nothing.

But this is fine.  I now understand the behaviour and can achieve what I
want with careful combinations of tags.

Thanks,
eric

-- 
: Eric S Fraga (0xFFFCF67D), Emacs 26.0.50.1, Org release_9.0.3-189-ge46676

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 194 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2017-01-12  7:00 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-09  9:48 excluding whole trees on export when subtrees have "select" tags present Eric S Fraga
2017-01-09 15:46 ` John Kitchin
     [not found] ` <b3655cb7d021410f872939e0fedfee6a@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2017-01-09 21:49   ` Eric S Fraga
2017-01-10 14:27     ` John Kitchin
     [not found]     ` <617f560207eb41c0888a6f3c6a8df9db@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2017-01-11 15:26       ` Eric S Fraga
2017-01-11 20:26         ` Nicolas Goaziou
     [not found]         ` <af9636231a6b44598ee8e17caee8e941@HE1PR01MB1898.eurprd01.prod.exchangelabs.com>
2017-01-12  6:50           ` Eric S Fraga

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.