[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[O] how to add some features in a newly added headline?

From: Bingo UV
Subject: [O] how to add some features in a newly added headline?
Date: Sat, 16 Jan 2016 18:44:12 +0530


   When I create a new headline, I want a set of features in it:
1. The ID property in the properties drawer
2. The properties drawer should be collapsed
3. An inactive timestamp at the beginning of text
4. Cursor at the beginning of heading

Currently, I have a hook for org-insert-heading-hook, after learning
and experimenting with emacs lisp for a while, but it has serious

(add-hook 'org-insert-heading-hook
         (org-id-get-create) ;-> Adds ID property
         (insert-char 48) ;-> required for next 2 org-cycles to collapse the 
properties drawer
         (save-excursion ;-> add time stamp
           (org-end-of-meta-data t)
           (org-time-stamp-inactive '(16))

This makes org-insert-heading create an entry like the following:

* 0 -> cursur after this 0
[2016-01-16 Sat 08:40]

Most of the problems stem from the insert-char. First of all, it enters a 
useless "0" character
which I have to manually remove by backspace. Secondly, when I read from 
mobile-org, it converts
TODO into 0TODO, which is to say it converts useful into useless. But I cannot 
live without it
because without this 0, org-cycle doesn't collapse the entry but instead, 
indents the subtree.

Can someone show a simple way to achieve the 4 features automatically in a new 
entry? I used
to strongly feel it should be very easy, but I am at my wits' end now.

thanks a lot

reply via email to

[Prev in Thread] Current Thread [Next in Thread]