all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* Improved way to include some headlines from an external org file
@ 2014-09-11 14:24 Xavier Garrido
  2014-09-12  0:45 ` Andrea Rossetti
  2014-09-30 19:55 ` Andrea Rossetti
  0 siblings, 2 replies; 8+ messages in thread
From: Xavier Garrido @ 2014-09-11 14:24 UTC (permalink / raw)
  To: emacs-orgmode@gnu.org

Dear Orgers,

By following discussions on this list, I think I have understood that 
the inclusion mechanism through =#+INCLUDE= directive is a bit rough and 
only allows a limited range of use. I know how to include only lines 
using =:lines= parameter but what I would like to achieve is to only 
include some headlines from an external org file. Is there a way using 
babel for example (like this function 
https://github.com/thesoftwarebin/the-emacs-software-bin/blob/master/include-many-files/include-many-files.org) 
to write something like that

#+BEGIN_SRC org
#+INCLUDE: "./base.org" :headline "First base chapter"
,* A more personal chapter
#+INCLUDE: "./base.org" :headline "Second base chapter"
,* Another personal chapter
#+END_SRC

Of course, I can achieve that by using =:lines= and calculating how many 
lines embeds the given headline. But every time the "First base chapter" 
length changes I will have to change all the subsequent =#INCLUDE:= 
commands. I do not know how hard it is to implement this but I think it 
will be a nice addition (at least one I will use a lot).

Thanks for your answer,
Xavier

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

* Re: Improved way to include some headlines from an external org file
  2014-09-11 14:24 Improved way to include some headlines from an external org file Xavier Garrido
@ 2014-09-12  0:45 ` Andrea Rossetti
  2014-09-13  9:40   ` Xavier Garrido
  2014-09-30 19:55 ` Andrea Rossetti
  1 sibling, 1 reply; 8+ messages in thread
From: Andrea Rossetti @ 2014-09-12  0:45 UTC (permalink / raw)
  To: Xavier Garrido; +Cc: emacs-orgmode@gnu.org

Xavier Garrido <xavier.garrido@gmail.com> writes:
> Of course, I can achieve that by using =:lines= and calculating how many 
> lines embeds the given headline. 

  Hi Xavier, another possible approach (maybe less handy, but in
some cases it might fit): the user could keep one .org file
per headline, and #+INCLUDE one headline (= one entire file)
when needed.

  Kindest regards,

    Andrea

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

* Re: Improved way to include some headlines from an external org file
  2014-09-12  0:45 ` Andrea Rossetti
@ 2014-09-13  9:40   ` Xavier Garrido
  2014-09-30 23:10     ` Rasmus
  0 siblings, 1 reply; 8+ messages in thread
From: Xavier Garrido @ 2014-09-13  9:40 UTC (permalink / raw)
  To: Andrea Rossetti; +Cc: emacs-orgmode@gnu.org

Hi Andrea,

Le 12/09/2014 02:45, Andrea Rossetti a écrit :
> Xavier Garrido <xavier.garrido@gmail.com> writes:
>> Of course, I can achieve that by using =:lines= and calculating how many
>> lines embeds the given headline.
>
>    Hi Xavier, another possible approach (maybe less handy, but in
> some cases it might fit): the user could keep one .org file
> per headline, and #+INCLUDE one headline (= one entire file)
> when needed.
>

This is something I use when dealing with a book or report with 
basically one big file per chapter. Here the problem is slightly 
different : I have 4 org/Beamer presentations that almost 80% of them 
are the same. So instead of maintening this 80% in 4 different places, 
I'd like to write them and change them in one place and then include the 
needed headlines at the right place in each of the 4 presentations.

I know this can't be done with #+INCLUDE maybe with a nice babel 
function or a bit of elisp. So maybe someone already did that. Otherwise 
this may be a nice addition for further release of org ;)

Cheers,
Xavier

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

* Re: Improved way to include some headlines from an external org file
  2014-09-11 14:24 Improved way to include some headlines from an external org file Xavier Garrido
  2014-09-12  0:45 ` Andrea Rossetti
@ 2014-09-30 19:55 ` Andrea Rossetti
  2014-10-01  5:06   ` Xavier Garrido
  1 sibling, 1 reply; 8+ messages in thread
From: Andrea Rossetti @ 2014-09-30 19:55 UTC (permalink / raw)
  To: Xavier Garrido; +Cc: emacs-orgmode@gnu.org

Xavier Garrido <xavier.garrido@gmail.com> writes:
> Is there a way ...
...
> to write something like that
...
> #+BEGIN_SRC org
> #+INCLUDE: "./base.org" :headline "First base chapter"
> ,* A more personal chapter
> #+INCLUDE: "./base.org" :headline "Second base chapter"
> ,* Another personal chapter
> #+END_SRC

Hi! today I crossed into Sacha's weekly links
( http://sachachua.com/blog/#post-27515 ).

One of the proposed link suggests a solution not too far
from your initial question:

http://endlessparentheses.com/updating-org-mode-include-statements-on-the-fly.html?source=rss

Kindest regards, 

  Andrea

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

* Re: Improved way to include some headlines from an external org file
  2014-09-13  9:40   ` Xavier Garrido
@ 2014-09-30 23:10     ` Rasmus
  2014-10-01  5:29       ` Xavier Garrido
  0 siblings, 1 reply; 8+ messages in thread
From: Rasmus @ 2014-09-30 23:10 UTC (permalink / raw)
  To: emacs-orgmode

Hi Xavier,

Xavier Garrido <xavier.garrido@gmail.com> writes:

> Le 12/09/2014 02:45, Andrea Rossetti a écrit :
>> Xavier Garrido <xavier.garrido@gmail.com> writes:
>>> Of course, I can achieve that by using =:lines= and calculating how many
>>> lines embeds the given headline.
>>
>>    Hi Xavier, another possible approach (maybe less handy, but in
>> some cases it might fit): the user could keep one .org file
>> per headline, and #+INCLUDE one headline (= one entire file)
>> when needed.
>>
>
> This is something I use when dealing with a book or report with
> basically one big file per chapter. Here the problem is slightly
> different : I have 4 org/Beamer presentations that almost 80% of them
> are the same. So instead of maintening this 80% in 4 different places,
> I'd like to write them and change them in one place and then include
> the needed headlines at the right place in each of the 4
> presentations.
>
> I know this can't be done with #+INCLUDE maybe with a nice babel
> function or a bit of elisp. So maybe someone already did
> that. Otherwise this may be a nice addition for further release of org
> ;)

You could test the patch here:

    http://permalink.gmane.org/gmane.emacs.orgmode/91307

I think it introduces something close to what you are looking for.

> #+BEGIN_SRC org
> #+INCLUDE: "./base.org" :headline "First base chapter"
> ,* A more personal chapter
> #+INCLUDE: "./base.org" :headline "Second base chapter"
> ,* Another personal chapter
> #+END_SRC

You'd be able to do

* first chapter
  Note how we're renaming /first base chapter/ on the fly.
* In this book /first base chapter/ is my second chapter
#+INCLUDE: "./base.org::*First base chapter" :only-contents t

Of course, you can also include other named objects such as tables and
probably code blocks.

—Rasmus 

-- 
Hvor meget poesi tror De kommer ud af et glas isvand?

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

* Re: Improved way to include some headlines from an external org file
  2014-09-30 19:55 ` Andrea Rossetti
@ 2014-10-01  5:06   ` Xavier Garrido
  2014-10-01 21:31     ` Andrea Rossetti
  0 siblings, 1 reply; 8+ messages in thread
From: Xavier Garrido @ 2014-10-01  5:06 UTC (permalink / raw)
  To: Andrea Rossetti; +Cc: emacs-orgmode@gnu.org

Hi Andrea,

Le 30/09/2014 21:55, Andrea Rossetti a écrit :
> Xavier Garrido <xavier.garrido@gmail.com> writes:
>> Is there a way ...
> ...
>> to write something like that
> ...
>> #+BEGIN_SRC org
>> #+INCLUDE: "./base.org" :headline "First base chapter"
>> ,* A more personal chapter
>> #+INCLUDE: "./base.org" :headline "Second base chapter"
>> ,* Another personal chapter
>> #+END_SRC
>
> Hi! today I crossed into Sacha's weekly links
> ( http://sachachua.com/blog/#post-27515 ).
>
> One of the proposed link suggests a solution not too far
> from your initial question:
>
> http://endlessparentheses.com/updating-org-mode-include-statements-on-the-fly.html?source=rss
>

Thanks for the follow-up. Actually I am waiting this patch 
http://article.gmane.org/gmane.emacs.orgmode/90932/match=include+resolve+links 
to be pushed by Rasmus (see the comment in the endlessparentheses article).

Thanks again,
Xavier



> Kindest regards,
>
>    Andrea
>

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

* Re: Improved way to include some headlines from an external org file
  2014-09-30 23:10     ` Rasmus
@ 2014-10-01  5:29       ` Xavier Garrido
  0 siblings, 0 replies; 8+ messages in thread
From: Xavier Garrido @ 2014-10-01  5:29 UTC (permalink / raw)
  To: Rasmus, emacs-orgmode

Hi Rasmus,

Le 01/10/2014 01:10, Rasmus a écrit :
> Hi Xavier,
>
> You could test the patch here:
>
>      http://permalink.gmane.org/gmane.emacs.orgmode/91307
>

I am following the discussion since the beginning (and all your exchange 
with Nicolas)

> I think it introduces something close to what you are looking for.
>

This is exactly what I needed and I will try to test it today.

>> #+BEGIN_SRC org
>> #+INCLUDE: "./base.org" :headline "First base chapter"
>> ,* A more personal chapter
>> #+INCLUDE: "./base.org" :headline "Second base chapter"
>> ,* Another personal chapter
>> #+END_SRC
>
> You'd be able to do
>
> * first chapter
>    Note how we're renaming /first base chapter/ on the fly.
> * In this book /first base chapter/ is my second chapter
> #+INCLUDE: "./base.org::*First base chapter" :only-contents t
>
> Of course, you can also include other named objects such as tables and
> probably code blocks.
>

Reading the discussion, I didn't get this last feature of including 
named code blocks and tables ! I have another use case that can benefit 
from this patch. So thanks a lot for all the hard work.

Cheers,
Xavier

> —Rasmus
>

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

* Re: Improved way to include some headlines from an external org file
  2014-10-01  5:06   ` Xavier Garrido
@ 2014-10-01 21:31     ` Andrea Rossetti
  0 siblings, 0 replies; 8+ messages in thread
From: Andrea Rossetti @ 2014-10-01 21:31 UTC (permalink / raw)
  To: Xavier Garrido; +Cc: emacs-orgmode@gnu.org

Xavier Garrido <xavier.garrido@gmail.com> writes:
> Thanks for the follow-up. Actually I am waiting this patch
> http://article.gmane.org/gmane.emacs.orgmode/90932/match=include+resolve+links
> to be pushed by Rasmus (see the comment in the endlessparentheses

Ahem... sincere apologies for the noise. I got confused by
those words "resolve links" in the topic title, it sounded
like a HTML-specific thing. Kindest regards, Andrea

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

end of thread, other threads:[~2014-10-01 21:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-09-11 14:24 Improved way to include some headlines from an external org file Xavier Garrido
2014-09-12  0:45 ` Andrea Rossetti
2014-09-13  9:40   ` Xavier Garrido
2014-09-30 23:10     ` Rasmus
2014-10-01  5:29       ` Xavier Garrido
2014-09-30 19:55 ` Andrea Rossetti
2014-10-01  5:06   ` Xavier Garrido
2014-10-01 21:31     ` Andrea Rossetti

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.