emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Carsten Dominik <dominik@science.uva.nl>
To: Sebastian Rose <sebastian_rose@gmx.de>
Cc: emacs-orgmode Org-Mode <emacs-orgmode@gnu.org>
Subject: Re: org-id: always add IDs
Date: Sun, 1 Mar 2009 17:11:36 +0100	[thread overview]
Message-ID: <6D1E4E86-E0C2-4B26-9DF2-2BE9951FEEA1@uva.nl> (raw)
In-Reply-To: <877i392qki.fsf@kassiopeya.MSHEIMNETZ>


On Feb 27, 2009, at 10:30 AM, Sebastian Rose wrote:

> Hi,
>
>
> I have several questions concerning IDs.
>
>
> Is there a prefered method to _always_ add an org-id to an entry?

(add-hook 'org-insert-heading-hook
	(lambda () (org-id-get-create)))


> The IDs would become _realy_ usefull, if I could add them  
> automatically
> whenever a new entry is created (a headline) that is _not_ below
> `org-export-headline-levels'.

You need to do more work if you want to have id' only for the top
few levels, then you first need to find out what the level is.
You can look at the dynamically scoped variable `head' which will
contain the stars to be inserted (and, maybe, also a space,
careful there)

On the other hand, I don't see why it it would be a problem
to have ids in headlines below the limit.  But I do not yet know
how well my ID mechanism will scale.  Should be pretty good, actually.

> Is it possible to have an ID added, even if the headline is added by
> hand (i.e. typing `* headline')?

No easily.  The fastest way to get one added by hand is to store
a link to the heading with `C-c l'.  If `org-link-to-org-use-id' is t
or 'create-if-interactive', an id will be added.

> Can this be achieved using an advice? How to do that?

Since no special function is called when you type a headline,
it would have to be advice to org-self-insert-command.
Very likely that would significantly slow down typing, I strongly
advice against doing that.

> Is it possible to tell Org-mode to add IDs to all the entries that  
> have
> none yet?

(org-map-entries '(org-id-get-create) "LEVEL<5" 'agenda)

Make sure the scope (here `agenda') is so that you will reach the files
you want.

> How would I tell emacs to update Org-mode's ID database?

M-x org-id-update-id-locations RET

See the docstring to make sure it will reach the right files

> Could the org-id be added when publishing?

> Like
>    <h2 id="sec-2"> HEADLINE
>     <span class="org-id" id="THE-ORG-ID-ITSELF">THE-ORG-ID-ITSELF</ 
> span>
>    </h2>
> or similar?

They already are in the HTML, I am surprised you never noticed.

- Carsten

  reply	other threads:[~2009-03-01 16:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-27  9:30 Sebastian Rose
2009-03-01 16:11 ` Carsten Dominik [this message]
2009-03-01 16:34   ` Sebastian Rose

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6D1E4E86-E0C2-4B26-9DF2-2BE9951FEEA1@uva.nl \
    --to=dominik@science.uva.nl \
    --cc=emacs-orgmode@gnu.org \
    --cc=sebastian_rose@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).