emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* export subtree
@ 2015-12-10 18:24 Skip Collins
  2015-12-10 20:06 ` Andreas Leha
  0 siblings, 1 reply; 11+ messages in thread
From: Skip Collins @ 2015-12-10 18:24 UTC (permalink / raw)
  To: emacs-org list

The export dispatcher allows me to export only the current subtree.
This is nice, but I would like to avoid having to put point in just
the right place before invoking the dispatcher. I have a document with
lots of things in it. One of the top-level headlines contains the
content of what I want to export. Is there a way to flag this heading
and its contents as the main export document so that wherever my
cursor is, when I export the document it only processes the correct
heading, treating its text as the title of the document?

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

* Re: export subtree
  2015-12-10 18:24 Skip Collins
@ 2015-12-10 20:06 ` Andreas Leha
  2015-12-10 22:06   ` Skip Collins
  0 siblings, 1 reply; 11+ messages in thread
From: Andreas Leha @ 2015-12-10 20:06 UTC (permalink / raw)
  To: emacs-orgmode

Hi Skip,

Skip Collins <skip.collins@gmail.com> writes:
> The export dispatcher allows me to export only the current subtree.
> This is nice, but I would like to avoid having to put point in just
> the right place before invoking the dispatcher. I have a document with
> lots of things in it. One of the top-level headlines contains the
> content of what I want to export. Is there a way to flag this heading
> and its contents as the main export document so that wherever my
> cursor is, when I export the document it only processes the correct
> heading, treating its text as the title of the document?

Try to run `org-export-dispatch' with a prefix from the second time
onwards (so, do C-u C-c C-e).

From its docstring:

,----
| When ARG is C-u, repeat the last export action, with the same set
| of options used back then, on the current buffer.
`----

This might do what you want already.

Regards,
Andreas

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

* Re: export subtree
  2015-12-10 20:06 ` Andreas Leha
@ 2015-12-10 22:06   ` Skip Collins
  2015-12-10 22:43     ` Andreas Leha
  0 siblings, 1 reply; 11+ messages in thread
From: Skip Collins @ 2015-12-10 22:06 UTC (permalink / raw)
  To: Andreas Leha; +Cc: emacs-org list

Andreas Leha <andreas.leha@med.uni-goettingen.de> wrote:
>> The export dispatcher allows me to export only the current subtree.
>> This is nice, but I would like to avoid having to put point in just
>> the right place before invoking the dispatcher. I have a document with
>> lots of things in it. One of the top-level headlines contains the
>> content of what I want to export. Is there a way to flag this heading
>> and its contents as the main export document so that wherever my
>> cursor is, when I export the document it only processes the correct
>> heading, treating its text as the title of the document?
>
> Try to run `org-export-dispatch' with a prefix from the second time
> onwards (so, do C-u C-c C-e).

Good try, but it does not do what I want. It selects the subtree
currently at point, just as if I ran the dispatcher again and selected
the same options. It might be a nice enhancement if the dispatcher
remembered which subtree it used last time so that it really could
repeat a subtree export with the same options and from the same
subtree.

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

* Re: export subtree
  2015-12-10 22:06   ` Skip Collins
@ 2015-12-10 22:43     ` Andreas Leha
  2015-12-11  0:10       ` Skip Collins
  0 siblings, 1 reply; 11+ messages in thread
From: Andreas Leha @ 2015-12-10 22:43 UTC (permalink / raw)
  To: emacs-orgmode

Hi Skip,

Skip Collins <skip.collins@gmail.com> writes:
> Andreas Leha <andreas.leha@med.uni-goettingen.de> wrote:
>>> The export dispatcher allows me to export only the current subtree.
>>> This is nice, but I would like to avoid having to put point in just
>>> the right place before invoking the dispatcher. I have a document with
>>> lots of things in it. One of the top-level headlines contains the
>>> content of what I want to export. Is there a way to flag this heading
>>> and its contents as the main export document so that wherever my
>>> cursor is, when I export the document it only processes the correct
>>> heading, treating its text as the title of the document?
>>
>> Try to run `org-export-dispatch' with a prefix from the second time
>> onwards (so, do C-u C-c C-e).
>
> Good try, but it does not do what I want. It selects the subtree
> currently at point, just as if I ran the dispatcher again and selected
> the same options. It might be a nice enhancement if the dispatcher
> remembered which subtree it used last time so that it really could
> repeat a subtree export with the same options and from the same
> subtree.

That is what it does for me.  As I said, you have to do the first export
the normal way.

What is your Org version (M-x org-version)?

Regards,
Andreas

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

* Re: export subtree
  2015-12-10 22:43     ` Andreas Leha
@ 2015-12-11  0:10       ` Skip Collins
  0 siblings, 0 replies; 11+ messages in thread
From: Skip Collins @ 2015-12-11  0:10 UTC (permalink / raw)
  To: emacs-org list

Andreas Leha <andreas.leha@med.uni-goettingen.de> wrote:
> Skip Collins <skip.collins@gmail.com> writes:
>>> Try to run `org-export-dispatch' with a prefix from the second time
>>> onwards (so, do C-u C-c C-e).
>>
>> Good try, but it does not do what I want. It selects the subtree
>> currently at point, just as if I ran the dispatcher again and selected
>> the same options. It might be a nice enhancement if the dispatcher
>> remembered which subtree it used last time so that it really could
>> repeat a subtree export with the same options and from the same
>> subtree.
>
> That is what it does for me.  As I said, you have to do the first export
> the normal way.

Okay, it works now. I had confused org by trying to get it to work
from an INCLUDEd file. When that did not work, I had gone back to the
parent file and it did not work there. If I stick within a single
buffer and do not try to export from another buffer, it works as you
describe.
Thanks.

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

* Re: export subtree
@ 2015-12-11  0:27 Herbert Sitz
  2015-12-11  0:40 ` John Hendy
  2015-12-11  2:50 ` Skip Collins
  0 siblings, 2 replies; 11+ messages in thread
From: Herbert Sitz @ 2015-12-11  0:27 UTC (permalink / raw)
  To: emacs-orgmode

Not a perfect solution, buy I think you can use the #+SELECT_TAGS option to
set which tress will be exported by default, then tag your desired export
tree with that tag.  Then when you export the full buffer (not just a
subtree) it will choose the tree with that tag.

E.g.,
---------------------------------
#+SELECT_TAGS: myexporttree

* Main tree     :myexporttree:
fkjaldfk
** subhead
** subhead
* anoher heading 1
* another heading level 1
** subhead
** subhead
--------------------------------

In org buffer above it will export only the first subtree now when you
export the entire buffer.  You should be able to export the others
selectively if you choose scope as 'subtree'.  And you can always comment
out or delete the SELECT_TAGS line if you want to export entire buffer.

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

* Re: export subtree
  2015-12-11  0:27 export subtree Herbert Sitz
@ 2015-12-11  0:40 ` John Hendy
       [not found]   ` <CA+iLYJsj=gMvRQXO+h8GKwNvdXzTcZ7vqT_6eYSDnNdbHyJxwg@mail.gmail.com>
  2015-12-11  2:50 ` Skip Collins
  1 sibling, 1 reply; 11+ messages in thread
From: John Hendy @ 2015-12-11  0:40 UTC (permalink / raw)
  To: Herbert Sitz; +Cc: emacs-orgmode

On Thu, Dec 10, 2015 at 6:27 PM, Herbert Sitz <hesitz@gmail.com> wrote:
> Not a perfect solution, buy I think you can use the #+SELECT_TAGS option to
> set which tress will be exported by default, then tag your desired export
> tree with that tag.  Then when you export the full buffer (not just a
> subtree) it will choose the tree with that tag.
>

This was going to be my suggestion as well! In the case that a
majority of the document is desired for export, #+EXCLUDE_TAGS is
helpful as well. For reference:
- http://orgmode.org/manual/Export-settings.html

Export tags are fantastic, as one can add as many as desired and then
simply change the #+select_tags/#+exclude_tags target to generate a
bunch of variations from the same single .org file.

Maybe a little extreme and irrelevant to the OP need(s), but I've also
programmatically generated Org heading syntax with R, spit out
headlines with data driven content, inserted a \newpage at the end of
each, and then split them apart with stapler.[1] I was serving as a
financials secretary for a group at work, managing the budgets of many
chapter entities. This allowed me to start with a .csv with the target
spend for the next year, use R to create a document for each chapter,
and then send the chairs their tailored document vs. manually changing
figures and generating ~40 documents by hand. Worked slick! If any of
that sounds appealing/relevant, let me know and I can share an
example.


Best regards,
John

> E.g.,
> ---------------------------------
> #+SELECT_TAGS: myexporttree
>
> * Main tree     :myexporttree:
> fkjaldfk
> ** subhead
> ** subhead
> * anoher heading 1
> * another heading level 1
> ** subhead
> ** subhead
> --------------------------------
>
> In org buffer above it will export only the first subtree now when you
> export the entire buffer.  You should be able to export the others
> selectively if you choose scope as 'subtree'.  And you can always comment
> out or delete the SELECT_TAGS line if you want to export entire buffer.
>
>

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

* Re: export subtree
  2015-12-11  0:27 export subtree Herbert Sitz
  2015-12-11  0:40 ` John Hendy
@ 2015-12-11  2:50 ` Skip Collins
  2015-12-11  3:53   ` John Hendy
  1 sibling, 1 reply; 11+ messages in thread
From: Skip Collins @ 2015-12-11  2:50 UTC (permalink / raw)
  To: emacs-org list

Herbert Sitz <hesitz@gmail.com> wrote:
> * Main tree     :myexporttree:
> fkjaldfk
> ** subhead
> ** subhead
> * anoher heading 1
> * another heading level 1
> ** subhead
> ** subhead

I did try using the default SELECT_TAG :export: on my main document
subtree. The problem is that the subtree is not "promoted" to the main
level. In your example, the title would not become "Main tree" as it
would if I selected subtree export in the dispatcher.

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

* Re: export subtree
  2015-12-11  2:50 ` Skip Collins
@ 2015-12-11  3:53   ` John Hendy
  2015-12-11 13:56     ` Skip Collins
  0 siblings, 1 reply; 11+ messages in thread
From: John Hendy @ 2015-12-11  3:53 UTC (permalink / raw)
  To: Skip Collins; +Cc: emacs-org list

On Thu, Dec 10, 2015 at 8:50 PM, Skip Collins <skip.collins@gmail.com> wrote:
> Herbert Sitz <hesitz@gmail.com> wrote:
>> * Main tree     :myexporttree:
>> fkjaldfk
>> ** subhead
>> ** subhead
>> * anoher heading 1
>> * another heading level 1
>> ** subhead
>> ** subhead
>
> I did try using the default SELECT_TAG :export: on my main document
> subtree. The problem is that the subtree is not "promoted" to the main
> level. In your example, the title would not become "Main tree" as it
> would if I selected subtree export in the dispatcher.
>

Ah. Agreed on the behavior. I missed your specific request and agree
this doesn't work.

Thinking about it more, using select_tags as a potential solution to
your export of a subtree without navigating to it, problems could
arise if more than one were tagged. If multiple same-level headlines
were tagged with the select_tag, which one should Org use as the
"master" for the document title/level structure?

It sounds like the C-u option did work for you, correct? If so, glad
you found a solution!


John

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

* Re: export subtree
  2015-12-11  3:53   ` John Hendy
@ 2015-12-11 13:56     ` Skip Collins
  0 siblings, 0 replies; 11+ messages in thread
From: Skip Collins @ 2015-12-11 13:56 UTC (permalink / raw)
  To: emacs-org list

John Hendy wrote:
> Thinking about it more, using select_tags as a potential solution to
> your export of a subtree without navigating to it, problems could
> arise if more than one were tagged. If multiple same-level headlines
> were tagged with the select_tag, which one should Org use as the
> "master" for the document title/level structure?

Nevertheless, I like the idea of a special tag to designate the top
level export. Call it :master:. The first headline with the tag
:master: would cause export actions to default to that subtree. That
way one would be able to edit deep inside the master subtree or
outside of it and still easily and consistently generate the correct
document. It would also help with exporting from emacs/org in batch
mode without a user to put point at the correct subtree location.

> It sounds like the C-u option did work for you, correct?

Correct. C-u works and I have what I need for now. What I ended up
doing is placing the contents of the export tree into an INCLUDE file.
I duplicate all of the export header options in that file. So my
workflow is simply to edit that document and process it for export
without using the subtree option from the parent. It does break the
convenience of keeping everything together in one file.

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

* Re: export subtree
       [not found]   ` <CA+iLYJsj=gMvRQXO+h8GKwNvdXzTcZ7vqT_6eYSDnNdbHyJxwg@mail.gmail.com>
@ 2015-12-16  4:43     ` John Hendy
  0 siblings, 0 replies; 11+ messages in thread
From: John Hendy @ 2015-12-16  4:43 UTC (permalink / raw)
  To: scot junkin; +Cc: emacs-orgmode

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

Hi Scott,
(Also adding in the group, just in case anyone else might want to see
this; no point typing a message twice!)


Took me a little bit to make good on my offer! This was for work, and
while it's probably not *that* sensitive (especially with anonymized
names), I took the time to change all the links away from our intranet
address. Never know who would care about some link between a company
and one of its employees on a mailing list... The rest is fairly
original to illustrate the use case. I was generating financial "cheat
sheets" for the equivalent of college clubs we have at work organized
around various technology interests. There's a chair, they're assigned
a budget, and need to charge expenses to a particular account number.
While all of this information exists in a wiki, our workplace is a bit
"old school" and people wanted some type of hard copy. Not being too
excited to hand generate 40+ of these

I attached a zip of what should be a fairly reproducible example if
you have R functionality enabled. If you go the whole document +
stapler route to split it, you'll need stapler installed and in your
path to run the bash code at the end. There's a link in the document.

I forgot that I'd programatically generated an EXPORT_FILE_NAME
property for each headline as well. That ended up tying back into
Skip's original issue, as I discovered by looking at my generated
documents that I went the manual subtree export route. I preferred the
headlines as the document title vs. just a headline, and couldn't get
there with a bulk export + split. I'd completely forgotten, yet ended
up in the same conundrum :)


Let me know if you run into issues, and hope you find it helpful!
John

P.S. I zipped these from within the directory, so you'll want to
create a folder and unzip them into it.





On Sun, Dec 13, 2015 at 9:25 AM, scot junkin <junkin@gmail.com> wrote:
> This sounds awesome, would enjoy an exampme
>
> On Dec 10, 2015 5:41 PM, "John Hendy" <jw.hendy@gmail.com> wrote:
>>
>> On Thu, Dec 10, 2015 at 6:27 PM, Herbert Sitz <hesitz@gmail.com> wrote:
>> > Not a perfect solution, buy I think you can use the #+SELECT_TAGS option
>> > to
>> > set which tress will be exported by default, then tag your desired
>> > export
>> > tree with that tag.  Then when you export the full buffer (not just a
>> > subtree) it will choose the tree with that tag.
>> >
>>
>> This was going to be my suggestion as well! In the case that a
>> majority of the document is desired for export, #+EXCLUDE_TAGS is
>> helpful as well. For reference:
>> - http://orgmode.org/manual/Export-settings.html
>>
>> Export tags are fantastic, as one can add as many as desired and then
>> simply change the #+select_tags/#+exclude_tags target to generate a
>> bunch of variations from the same single .org file.
>>
>> Maybe a little extreme and irrelevant to the OP need(s), but I've also
>> programmatically generated Org heading syntax with R, spit out
>> headlines with data driven content, inserted a \newpage at the end of
>> each, and then split them apart with stapler.[1] I was serving as a
>> financials secretary for a group at work, managing the budgets of many
>> chapter entities. This allowed me to start with a .csv with the target
>> spend for the next year, use R to create a document for each chapter,
>> and then send the chairs their tailored document vs. manually changing
>> figures and generating ~40 documents by hand. Worked slick! If any of
>> that sounds appealing/relevant, let me know and I can share an
>> example.
>>
>>
>> Best regards,
>> John
>>
>> > E.g.,
>> > ---------------------------------
>> > #+SELECT_TAGS: myexporttree
>> >
>> > * Main tree     :myexporttree:
>> > fkjaldfk
>> > ** subhead
>> > ** subhead
>> > * anoher heading 1
>> > * another heading level 1
>> > ** subhead
>> > ** subhead
>> > --------------------------------
>> >
>> > In org buffer above it will export only the first subtree now when you
>> > export the entire buffer.  You should be able to export the others
>> > selectively if you choose scope as 'subtree'.  And you can always
>> > comment
>> > out or delete the SELECT_TAGS line if you want to export entire buffer.
>> >
>> >
>>
>

[-- Attachment #2: prog-ex.zip --]
[-- Type: application/zip, Size: 295032 bytes --]

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

end of thread, other threads:[~2015-12-16  4:43 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-12-11  0:27 export subtree Herbert Sitz
2015-12-11  0:40 ` John Hendy
     [not found]   ` <CA+iLYJsj=gMvRQXO+h8GKwNvdXzTcZ7vqT_6eYSDnNdbHyJxwg@mail.gmail.com>
2015-12-16  4:43     ` John Hendy
2015-12-11  2:50 ` Skip Collins
2015-12-11  3:53   ` John Hendy
2015-12-11 13:56     ` Skip Collins
  -- strict thread matches above, loose matches on Subject: below --
2015-12-10 18:24 Skip Collins
2015-12-10 20:06 ` Andreas Leha
2015-12-10 22:06   ` Skip Collins
2015-12-10 22:43     ` Andreas Leha
2015-12-11  0:10       ` Skip Collins

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).