emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* include file contents in org files?
@ 2007-08-21 21:47 Rainer Stengele
  2007-08-21 23:44 ` Bastien
  2007-08-22  1:30 ` Eddward DeVilla
  0 siblings, 2 replies; 14+ messages in thread
From: Rainer Stengele @ 2007-08-21 21:47 UTC (permalink / raw)
  To: emacs-orgmode

Dear list,

I'd like to have the initial lines (configuration) of any org file be
the same. Yes, I could configure everything in my .emacs file - but I
want to see my configuration - TAGS etc. - at the beginning of my org
files.
If I change anything in for example the TAGS section I have to do the
change in each and every org files I use - which is stupid.
Is there a possibility to include a file and show it maybe between a
ruler set?

Maybe something like:

#INLCUDEFROM <file path>
#INCLUDEDCONTENTS START
#+STARTUP: overview
#+TAGS: @HOME(h) @IGN @KUNDE(k) @UNTERWEGS(u)
#+TAGS: BESORGEN(b) COMPUTER(c) EMAIL(e) IGNORE(r) INFO(i)
#+STARTUP: hidestars
#+SEQ_TODO: TODO INARBEIT | DONE CANCELED DELEGATED
#INCLUDEDCONTENTS END

comments? bad/good idea?

Rainer

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

* Re: include file contents in org files?
  2007-08-21 21:47 include file contents in org files? Rainer Stengele
@ 2007-08-21 23:44 ` Bastien
  2007-08-22  9:10   ` Adam Spiers
  2007-08-22  1:30 ` Eddward DeVilla
  1 sibling, 1 reply; 14+ messages in thread
From: Bastien @ 2007-08-21 23:44 UTC (permalink / raw)
  To: emacs-orgmode

Rainer Stengele <rainer.stengele@yahoo.de> writes:

> I'd like to have the initial lines (configuration) of any org file be
> the same.

Perhaps we can use Tempo [1] or Templates [2] for this?

Here is an example using Tempo:

--8<---------------cut here---------------start------------->8---
(require 'tempo)

(tempo-define-template "org-initial-options"
		       '("#+STARTUP: overview
#+TAGS: @HOME(h) @IGN @KUNDE(k) @UNTERWEGS(u)
#+TAGS: BESORGEN(b) COMPUTER(c) EMAIL(e) IGNORE(r) INFO(i)
#+STARTUP: hidestars
#+SEQ_TODO: TODO INARBEIT | DONE CANCELED DELEGATED")
		       nil
		       "Insert initial options in Org files.")

(define-abbrev org-mode-abbrev-table "options" ""
  'tempo-template-org-initial-options)
--8<---------------cut here---------------end--------------->8---

Then just type "options" at the very beginning of a new Org file, then
press C-x a e, it will expand into the desired options.

Regards,

Notes: 
[1]  http://www.emacswiki.org/cgi-bin/wiki/TempoMode
[2]  http://www.emacswiki.org/cgi-bin/wiki/TemplatesMode

-- 
Bastien

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

* Re: include file contents in org files?
  2007-08-21 21:47 include file contents in org files? Rainer Stengele
  2007-08-21 23:44 ` Bastien
@ 2007-08-22  1:30 ` Eddward DeVilla
  1 sibling, 0 replies; 14+ messages in thread
From: Eddward DeVilla @ 2007-08-22  1:30 UTC (permalink / raw)
  To: Rainer Stengele; +Cc: emacs-orgmode

On 8/21/07, Rainer Stengele <rainer.stengele@yahoo.de> wrote:
> Dear list,
>
> I'd like to have the initial lines (configuration) of any org file be
> the same. Yes, I could configure everything in my .emacs file - but I
> want to see my configuration - TAGS etc. - at the beginning of my org
> files.
> If I change anything in for example the TAGS section I have to do the
> change in each and every org files I use - which is stupid.
> Is there a possibility to include a file and show it maybe between a
> ruler set?

I've wanted something like that myself so that my org files /could/
stand on their own, but so I would need to edit them all if my
preferred defaults were to change.  Ultimately, I've settled on having
an emacs config that I can move with my files.  At some point I want
to use a package (I can't remember the name) that can split custom
configuration into multiple files.

What might be nice is to be able to put a token at the top of the file
to export the config from custom (or as much as reasonable) into the
file using a config name.  So in custom you set a configuration name
(say eddwards-org-config) and at the top of your file you put

#+INLINE_CONFIG: eddwards-org-config

and org-mode would insert the configuration after it, replace any
config line that might already be there.  If the keyword in the file
doesn't match what is in custom or if there isn't a name given in the
file or custom, then do not insert anything in the file.  Org could
maybe update all of the agenda files as appropriate.

The reason for the name is so I can receive a file from someone else
(say my brother) and not have the config info in his file overlaid
with mine, distorting how he intended the file to be seen.  That would
cover my needs for org, but I'll still probably get a custom splitter
since I'm starting to use emace for more things and I have at least
three separate machine I use it on and I'd like to share some of the
customizations.

Edd

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

* Re: include file contents in org files?
  2007-08-21 23:44 ` Bastien
@ 2007-08-22  9:10   ` Adam Spiers
  2007-08-22  9:32     ` Rainer Stengele
  0 siblings, 1 reply; 14+ messages in thread
From: Adam Spiers @ 2007-08-22  9:10 UTC (permalink / raw)
  To: emacs-orgmode

Bastien (bzg@altern.org) wrote:
> Rainer Stengele <rainer.stengele@yahoo.de> writes:
> 
> > I'd like to have the initial lines (configuration) of any org file be
> > the same.
> 
> Perhaps we can use Tempo [1] or Templates [2] for this?

If I understand Rainer's original requirements, that wouldn't work,
because once expansion had been performed across multiple files, you
would still need to edit them all if you needed to make a change to
the common component.  An include mechanism sounds like a nice idea to
me.

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

* Re: include file contents in org files?
  2007-08-22  9:10   ` Adam Spiers
@ 2007-08-22  9:32     ` Rainer Stengele
  2007-08-22  9:42       ` Carsten Dominik
  0 siblings, 1 reply; 14+ messages in thread
From: Rainer Stengele @ 2007-08-22  9:32 UTC (permalink / raw)
  To: emacs-orgmode

Adam Spiers schrieb:
> Bastien (bzg@altern.org) wrote:
>> Rainer Stengele <rainer.stengele@yahoo.de> writes:
>>
>>> I'd like to have the initial lines (configuration) of any org file be
>>> the same.
>> Perhaps we can use Tempo [1] or Templates [2] for this?
> 
> If I understand Rainer's original requirements, that wouldn't work,
> because once expansion had been performed across multiple files, you
> would still need to edit them all if you needed to make a change to
> the common component.  An include mechanism sounds like a nice idea to
> me.

Adam, you've got it right.
I would like to have something like a #include under C but also see the 
contents of the included file.
The include "update" could take place whenever the org file is opened or 
maybe by request "org-update-includes" or whatever.


Rainer

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

* Re: Re: include file contents in org files?
  2007-08-22  9:32     ` Rainer Stengele
@ 2007-08-22  9:42       ` Carsten Dominik
  2007-08-22 10:44         ` Rainer Stengele
  0 siblings, 1 reply; 14+ messages in thread
From: Carsten Dominik @ 2007-08-22  9:42 UTC (permalink / raw)
  To: Rainer Stengele; +Cc: emacs-orgmode


On Aug 22, 2007, at 11:32, Rainer Stengele wrote:

> Adam Spiers schrieb:
>> Bastien (bzg@altern.org) wrote:
>>> Rainer Stengele <rainer.stengele@yahoo.de> writes:
>>>
>>>> I'd like to have the initial lines (configuration) of any org file 
>>>> be
>>>> the same.
>>> Perhaps we can use Tempo [1] or Templates [2] for this?
>> If I understand Rainer's original requirements, that wouldn't work,
>> because once expansion had been performed across multiple files, you
>> would still need to edit them all if you needed to make a change to
>> the common component.  An include mechanism sounds like a nice idea to
>> me.
>
> Adam, you've got it right.
> I would like to have something like a #include under C but also see 
> the contents of the included file.
> The include "update" could take place whenever the org file is opened 
> or maybe by request "org-update-includes" or whatever.

While I maybe can see the use of having an #include mechanism,
I don't see why you'd want to *see* the included stuff.
It is just as easy to look at the include file itself, and if it is
the same for every file you use, you'd have it memorized soon enough.

- Carsten

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

* Re: include file contents in org files?
  2007-08-22  9:42       ` Carsten Dominik
@ 2007-08-22 10:44         ` Rainer Stengele
  2007-08-22 10:54           ` Rainer Stengele
  0 siblings, 1 reply; 14+ messages in thread
From: Rainer Stengele @ 2007-08-22 10:44 UTC (permalink / raw)
  To: emacs-orgmode

Carsten Dominik schrieb:
> 
...
> 
> While I maybe can see the use of having an #include mechanism,
> I don't see why you'd want to *see* the included stuff.
> It is just as easy to look at the include file itself, and if it is
> the same for every file you use, you'd have it memorized soon enough.
> 
> - Carsten

Well - thinking hard about it I have to agree it's not really necessary 
to see the contents of the file.

Seeing it at the beginning of any org file was just quite convenient 
when I started using org-mode and was still modifying my used TAG set etc.

Agreed, a simple "standard" include mechanism would do it very well!

Rainer

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

* Re: include file contents in org files?
  2007-08-22 10:44         ` Rainer Stengele
@ 2007-08-22 10:54           ` Rainer Stengele
  2007-08-22 11:07             ` Carsten Dominik
  0 siblings, 1 reply; 14+ messages in thread
From: Rainer Stengele @ 2007-08-22 10:54 UTC (permalink / raw)
  To: emacs-orgmode

Rainer Stengele schrieb:
> Carsten Dominik schrieb:
>>
> ...
>>
>> While I maybe can see the use of having an #include mechanism,
>> I don't see why you'd want to *see* the included stuff.
>> It is just as easy to look at the include file itself, and if it is
>> the same for every file you use, you'd have it memorized soon enough.
>>
>> - Carsten
> 
> Well - thinking hard about it I have to agree it's not really necessary 
> to see the contents of the file.
> 
> Seeing it at the beginning of any org file was just quite convenient 
> when I started using org-mode and was still modifying my used TAG set etc.
> 
> Agreed, a simple "standard" include mechanism would do it very well!
> 
> Rainer

Taking the idea a little "around the corner" I wonder if it would be 
possible to hide everything that begins with a "#" before the first heading.
Application: I have my org files under subversion control and carry 
around this line at the beginning of my files:


# SVN $Revision: 385 $  $Date: 2007-08-21 23:50:43 +0200 (Di, 21 Aug 2007) $

I would like to hide that and similar lines unless showing all with "C-c 
C-a". Also a possible "#include" line could be hidden. If somebody wants 
to see the lines - of course - a config option would do it.

Rainer

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

* Re: Re: include file contents in org files?
  2007-08-22 10:54           ` Rainer Stengele
@ 2007-08-22 11:07             ` Carsten Dominik
  2007-08-22 20:25               ` Rainer Stengele
  2007-08-23 23:32               ` Daniel J. Sinder
  0 siblings, 2 replies; 14+ messages in thread
From: Carsten Dominik @ 2007-08-22 11:07 UTC (permalink / raw)
  To: Rainer Stengele; +Cc: emacs-orgmode

On Aug 22, 2007, at 12:54, Rainer Stengele wrote:
>
> Taking the idea a little "around the corner" I wonder if it would be 
> possible to hide everything that begins with a "#" before the first 
> heading.
> Application: I have my org files under subversion control and carry 
> around this line at the beginning of my files:
>
>
> # SVN $Revision: 385 $  $Date: 2007-08-21 23:50:43 +0200 (Di, 21 Aug 
> 2007) $
>
> I would like to hide that and similar lines unless showing all with 
> "C-c C-a". Also a possible "#include" line could be hidden. If 
> somebody wants to see the lines - of course - a config option would do 
> it.
>
> Rainer

The easiest way is this:

    * COMMENT setup section
    #+STARTUP: overview
    more stuff that should be hidden

    * The first "real" headline in the file.

Another possibility woud be to use a drawer for this,
for example a SETUP drawer.

    (setq org-drawers '("PROPERTIES" "SETUP"))

Then you could write

    :SETUP:
    #+STARTUP: overview
    more stuff that should be hidden
    :END:

    * The first "real" headline in the file.

All you then need to do is to make sure that the drawer will
be closed when first visiting the file, for example

    (add-hook 'org-mode-hook
       (lambda () (org-cycle-hide-drawers 'all)))

- Carsten

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

* Re: include file contents in org files?
  2007-08-22 11:07             ` Carsten Dominik
@ 2007-08-22 20:25               ` Rainer Stengele
  2007-08-23 17:55                 ` Carsten Dominik
  2007-08-23 23:32               ` Daniel J. Sinder
  1 sibling, 1 reply; 14+ messages in thread
From: Rainer Stengele @ 2007-08-22 20:25 UTC (permalink / raw)
  To: emacs-orgmode

Carsten Dominik schrieb:
> On Aug 22, 2007, at 12:54, Rainer Stengele wrote:
>>
>> Taking the idea a little "around the corner" I wonder if it would be 
>> possible to hide everything that begins with a "#" before the first 
>> heading.
>> Application: I have my org files under subversion control and carry 
>> around this line at the beginning of my files:
>>
>>
>> # SVN $Revision: 385 $  $Date: 2007-08-21 23:50:43 +0200 (Di, 21 Aug 
>> 2007) $
>>
>> I would like to hide that and similar lines unless showing all with 
>> "C-c C-a". Also a possible "#include" line could be hidden. If 
>> somebody wants to see the lines - of course - a config option would do 
>> it.
>>
>> Rainer
> 
> The easiest way is this:
> 
>    * COMMENT setup section
>    #+STARTUP: overview
>    more stuff that should be hidden
> 
>    * The first "real" headline in the file.
> 
> Another possibility woud be to use a drawer for this,
> for example a SETUP drawer.
> 
>    (setq org-drawers '("PROPERTIES" "SETUP"))
> 
> Then you could write
> 
>    :SETUP:
>    #+STARTUP: overview
>    more stuff that should be hidden
>    :END:
> 
>    * The first "real" headline in the file.
> 
> All you then need to do is to make sure that the drawer will
> be closed when first visiting the file, for example
> 
>    (add-hook 'org-mode-hook
>       (lambda () (org-cycle-hide-drawers 'all)))
> 
> - Carsten

I use the drawers. Works perfect. Thanks a lot!

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

* Re: Re: include file contents in org files?
  2007-08-22 20:25               ` Rainer Stengele
@ 2007-08-23 17:55                 ` Carsten Dominik
  0 siblings, 0 replies; 14+ messages in thread
From: Carsten Dominik @ 2007-08-23 17:55 UTC (permalink / raw)
  To: Rainer Stengele; +Cc: org-mode mailing list


On Aug 22, 2007, at 22:25, Rainer Stengele wrote:
>> All you then need to do is to make sure that the drawer will
>> be closed when first visiting the file, for example
>>    (add-hook 'org-mode-hook
>>       (lambda () (org-cycle-hide-drawers 'all)))
>> - Carsten
>
> I use the drawers. Works perfect. Thanks a lot!

Hiding drawers will be automatic upon visiting a file in
version 5.06 - this means that you can and should remove this
from your hook again once you get 5.06.

- Carsten

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

* Re: Re: include file contents in org files?
  2007-08-22 11:07             ` Carsten Dominik
  2007-08-22 20:25               ` Rainer Stengele
@ 2007-08-23 23:32               ` Daniel J. Sinder
  2007-08-24  2:57                 ` Carsten Dominik
  1 sibling, 1 reply; 14+ messages in thread
From: Daniel J. Sinder @ 2007-08-23 23:32 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode, Rainer Stengele

> Then you could write
> 
>    :SETUP:
>    #+STARTUP: overview
>    more stuff that should be hidden
>    :END:
> 
>    * The first "real" headline in the file.

I like this, but here's a word of caution.... I had previously
started my setup on the first line of the file.  But, if you put the
:SETUP: drawer the first line, using TAB when point is on the first
character of the file only does global visibility cycling (as it
should).  To open the :SETUP: drawer, you need to move point off the
first character.

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

* Re: Re: include file contents in org files?
  2007-08-23 23:32               ` Daniel J. Sinder
@ 2007-08-24  2:57                 ` Carsten Dominik
  2007-08-24 11:30                   ` Rainer Stengele
  0 siblings, 1 reply; 14+ messages in thread
From: Carsten Dominik @ 2007-08-24  2:57 UTC (permalink / raw)
  To: Daniel J. Sinder; +Cc: Rainer Stengele, emacs-orgmode


On Aug 24, 2007, at 1:32, Daniel J. Sinder wrote:

>> Then you could write
>>
>>    :SETUP:
>>    #+STARTUP: overview
>>    more stuff that should be hidden
>>    :END:
>>
>>    * The first "real" headline in the file.
>
> I like this, but here's a word of caution.... I had previously
> started my setup on the first line of the file.  But, if you put the
> :SETUP: drawer the first line, using TAB when point is on the first
> character of the file only does global visibility cycling (as it
> should).  To open the :SETUP: drawer, you need to move point off the
> first character.

or configure the variable `org-cycle-global-at-bob'.  Maybe we should
acatually change the default of this variable.  Is there anyone
relying on the behavior that TAB behaves specially at the beginning
of the buffer?

- Carsten

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

* Re: include file contents in org files?
  2007-08-24  2:57                 ` Carsten Dominik
@ 2007-08-24 11:30                   ` Rainer Stengele
  0 siblings, 0 replies; 14+ messages in thread
From: Rainer Stengele @ 2007-08-24 11:30 UTC (permalink / raw)
  To: emacs-orgmode

Carsten Dominik schrieb:
> 
> On Aug 24, 2007, at 1:32, Daniel J. Sinder wrote:
> 
>>> Then you could write
>>>
>>>    :SETUP:
>>>    #+STARTUP: overview
>>>    more stuff that should be hidden
>>>    :END:
>>>
>>>    * The first "real" headline in the file.
>>
>> I like this, but here's a word of caution.... I had previously
>> started my setup on the first line of the file.  But, if you put the
>> :SETUP: drawer the first line, using TAB when point is on the first
>> character of the file only does global visibility cycling (as it
>> should).  To open the :SETUP: drawer, you need to move point off the
>> first character.
> 
> or configure the variable `org-cycle-global-at-bob'.  Maybe we should
> acatually change the default of this variable.  Is there anyone
> relying on the behavior that TAB behaves specially at the beginning
> of the buffer?
> 
> - Carsten

Actually I stumbled over this thing. I now switched 
org-cycle-global-at-bob off.
I opt to change the default.

Rainer

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

end of thread, other threads:[~2007-08-24 11:31 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-08-21 21:47 include file contents in org files? Rainer Stengele
2007-08-21 23:44 ` Bastien
2007-08-22  9:10   ` Adam Spiers
2007-08-22  9:32     ` Rainer Stengele
2007-08-22  9:42       ` Carsten Dominik
2007-08-22 10:44         ` Rainer Stengele
2007-08-22 10:54           ` Rainer Stengele
2007-08-22 11:07             ` Carsten Dominik
2007-08-22 20:25               ` Rainer Stengele
2007-08-23 17:55                 ` Carsten Dominik
2007-08-23 23:32               ` Daniel J. Sinder
2007-08-24  2:57                 ` Carsten Dominik
2007-08-24 11:30                   ` Rainer Stengele
2007-08-22  1:30 ` Eddward DeVilla

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