From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bingo UV Subject: how to add some features in a newly added headline? Date: Sat, 16 Jan 2016 18:44:12 +0530 Message-ID: <20160116184412.22e45a7b@dhcppc15> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:58724) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aKQgU-0003CI-9P for emacs-orgmode@gnu.org; Sat, 16 Jan 2016 08:14:27 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aKQgP-0006qe-A0 for emacs-orgmode@gnu.org; Sat, 16 Jan 2016 08:14:26 -0500 Received: from mail-pa0-x242.google.com ([2607:f8b0:400e:c03::242]:34147) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aKQgP-0006qQ-3Y for emacs-orgmode@gnu.org; Sat, 16 Jan 2016 08:14:21 -0500 Received: by mail-pa0-x242.google.com with SMTP id yy13so30556526pab.1 for ; Sat, 16 Jan 2016 05:14:20 -0800 (PST) Received: from dhcppc15 ([122.166.95.204]) by smtp.gmail.com with ESMTPSA id fi16sm22063075pac.12.2016.01.16.05.14.18 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 16 Jan 2016 05:14:19 -0800 (PST) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Hi, 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 problems: (add-hook 'org-insert-heading-hook '(lambda() (org-id-get-create) ;-> Adds ID property (insert-char 48) ;-> required for next 2 org-cycles to collapse the properties drawer (org-cycle) (org-cycle) (save-excursion ;-> add time stamp (org-end-of-meta-data t) (org-time-stamp-inactive '(16)) (newline) ) ) ) This makes org-insert-heading create an entry like the following: * 0 -> cursur after this 0 :PROPERTIES: [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