emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Export subtrees of level n
@ 2017-09-03  8:07 Michael Welle
  2017-09-03  8:12 ` Nicolas Goaziou
  2017-09-03  8:13 ` Adam Porter
  0 siblings, 2 replies; 7+ messages in thread
From: Michael Welle @ 2017-09-03  8:07 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

imagine the following document structure:

* talk1
* talk2
** foo
** bar
** foobaz


Now the point is in section foobaz and I want to export the subtree
talk2. C-c C-e C-s doesn't do exactly what I want. I can move the point
up to * talk2, export the subtree and then move the point back.

Is there an existing way to say that I want to go up to a level n
heading and then export, or do I have to implement that by myself?

Regards
hmw

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

* Re: Export subtrees of level n
  2017-09-03  8:07 Export subtrees of level n Michael Welle
@ 2017-09-03  8:12 ` Nicolas Goaziou
  2017-09-03  8:18   ` Michael Welle
  2017-09-03  8:13 ` Adam Porter
  1 sibling, 1 reply; 7+ messages in thread
From: Nicolas Goaziou @ 2017-09-03  8:12 UTC (permalink / raw)
  To: Michael Welle; +Cc: emacs-orgmode

Hello,

Michael Welle <mwe012008@gmx.net> writes:

> imagine the following document structure:
>
> * talk1
> * talk2
> ** foo
> ** bar
> ** foobaz
>
>
> Now the point is in section foobaz and I want to export the subtree
> talk2. C-c C-e C-s doesn't do exactly what I want. I can move the point
> up to * talk2, export the subtree and then move the point back.

Note that subsequent C-u C-c C-e will re-use the same subtree.

> Is there an existing way to say that I want to go up to a level n
> heading and then export, or do I have to implement that by myself?

The latter, if you want to have this right from the start (and not from
the second call)

Regards,

-- 
Nicolas Goaziou

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

* Re: Export subtrees of level n
  2017-09-03  8:07 Export subtrees of level n Michael Welle
  2017-09-03  8:12 ` Nicolas Goaziou
@ 2017-09-03  8:13 ` Adam Porter
  2017-09-03  8:23   ` Michael Welle
  1 sibling, 1 reply; 7+ messages in thread
From: Adam Porter @ 2017-09-03  8:13 UTC (permalink / raw)
  To: emacs-orgmode

Michael Welle <mwe012008@gmx.net> writes:

> Is there an existing way to say that I want to go up to a level n
> heading and then export, or do I have to implement that by myself?

I think you'll have to do it yourself.  Here are a couple of ideas:

1.  Write a function to export a subtree with a specific Org ID.

2.  Write a function to look up the tree from point and export the first
subtree with a certain property.

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

* Re: Export subtrees of level n
  2017-09-03  8:12 ` Nicolas Goaziou
@ 2017-09-03  8:18   ` Michael Welle
  0 siblings, 0 replies; 7+ messages in thread
From: Michael Welle @ 2017-09-03  8:18 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

Nicolas Goaziou <mail@nicolasgoaziou.fr> writes:

> Hello,
>
> Michael Welle <mwe012008@gmx.net> writes:
>
>> imagine the following document structure:
>>
>> * talk1
>> * talk2
>> ** foo
>> ** bar
>> ** foobaz
>>
>>
>> Now the point is in section foobaz and I want to export the subtree
>> talk2. C-c C-e C-s doesn't do exactly what I want. I can move the point
>> up to * talk2, export the subtree and then move the point back.
>
> Note that subsequent C-u C-c C-e will re-use the same subtree.
ah, learned something new here.


>> Is there an existing way to say that I want to go up to a level n
>> heading and then export, or do I have to implement that by myself?
>
> The latter, if you want to have this right from the start (and not from
> the second call)
I think, I will stick with this, because even if I use C-u C-c C-e I
will forget to move up to the right heading the first time I use it ;).

Regards
hmw

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

* Re: Export subtrees of level n
  2017-09-03  8:13 ` Adam Porter
@ 2017-09-03  8:23   ` Michael Welle
  2017-09-03 17:26     ` Joon Ro
  0 siblings, 1 reply; 7+ messages in thread
From: Michael Welle @ 2017-09-03  8:23 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

Adam Porter <adam@alphapapa.net> writes:

> Michael Welle <mwe012008@gmx.net> writes:
>
>> Is there an existing way to say that I want to go up to a level n
>> heading and then export, or do I have to implement that by myself?
>
> I think you'll have to do it yourself.  Here are a couple of ideas:
>
> 1.  Write a function to export a subtree with a specific Org ID.
>
> 2.  Write a function to look up the tree from point and export the first
> subtree with a certain property.
I thought about implementing the second approach. I have slides for
several talks in the same org file. Since I mostly need this
functionality when I'm developing slides, just going up from point until
reaching the desired heading is easy to implement. 

Regards
hmw

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

* Re: Export subtrees of level n
  2017-09-03  8:23   ` Michael Welle
@ 2017-09-03 17:26     ` Joon Ro
  2017-09-03 18:20       ` Michael Welle
  0 siblings, 1 reply; 7+ messages in thread
From: Joon Ro @ 2017-09-03 17:26 UTC (permalink / raw)
  To: Michael Welle, emacs-orgmode@gnu.org

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

> 2.  Write a function to look up the tree from point and export the first
> subtree with a certain property.
I thought about implementing the second approach. I have slides for
several talks in the same org file. Since I mostly need this
functionality when I'm developing slides, just going up from point until
reaching the desired heading is easy to implement.

If you can implement this, that would be great as I find myself doing this all the time as well. Currently what I do is make sure to export the right subtree first, and then start using "\C-u\C-c\C-e". I bind f5 to "\C-u\C-c\C-e" with the following in my init file:

(fset 'export-last-subtree
      "\C-u\C-c\C-e")

(eval-after-load "org"
  '(progn
     (define-key org-mode-map (kbd "<f5>") 'export-last-subtree)))






[-- Attachment #2: Type: text/html, Size: 3595 bytes --]

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

* Re: Export subtrees of level n
  2017-09-03 17:26     ` Joon Ro
@ 2017-09-03 18:20       ` Michael Welle
  0 siblings, 0 replies; 7+ messages in thread
From: Michael Welle @ 2017-09-03 18:20 UTC (permalink / raw)
  To: emacs-orgmode

Hello,

Joon Ro <joon.ro@outlook.com> writes:

>> 2.  Write a function to look up the tree from point and export the first
>> subtree with a certain property.
> I thought about implementing the second approach. I have slides for
> several talks in the same org file. Since I mostly need this
> functionality when I'm developing slides, just going up from point until
> reaching the desired heading is easy to implement.
>
> If you can implement this, that would be great as I find myself doing
> this all the time as well.
I use this ad hoc implementation:


(defun hmw/org-export (&optional level)
  "Go up to a section of level `level', if there is any, and then call `org-export-dispatch'. `level' defaults to 1."
  (interactive)
  (unless level (setq level 1))
  (save-excursion
  (while (< level (or (org-up-heading-safe) -1)))
  (if (org-at-heading-p)
      (org-export-dispatch))))


That hack could be optimised, but works for me ;).


Regards
hmw

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

end of thread, other threads:[~2017-09-03 18:21 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-03  8:07 Export subtrees of level n Michael Welle
2017-09-03  8:12 ` Nicolas Goaziou
2017-09-03  8:18   ` Michael Welle
2017-09-03  8:13 ` Adam Porter
2017-09-03  8:23   ` Michael Welle
2017-09-03 17:26     ` Joon Ro
2017-09-03 18:20       ` Michael Welle

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