From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bernt Hansen Subject: [PATCH] Always run org-insert-heading-hook when creating headlines Date: Sun, 26 Sep 2010 10:15:12 -0400 Message-ID: <1285510512-31684-1-git-send-email-bernt@norang.ca> Return-path: Received: from [140.186.70.92] (port=34765 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Ozs0p-0004Bg-Hn for emacs-orgmode@gnu.org; Sun, 26 Sep 2010 10:15:32 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Ozs0n-0000o7-NX for emacs-orgmode@gnu.org; Sun, 26 Sep 2010 10:15:31 -0400 Received: from mho-02-ewr.mailhop.org ([204.13.248.72]:57345) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Ozs0n-0000n5-Lx for emacs-orgmode@gnu.org; Sun, 26 Sep 2010 10:15:29 -0400 Received: from cpe000102d0fe75-cm0012256ecbde.cpe.net.cable.rogers.com ([99.239.148.180] helo=mail.norang.ca) by mho-02-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.68) (envelope-from ) id 1Ozs0g-0001Fh-1U for emacs-orgmode@gnu.org; Sun, 26 Sep 2010 14:15:22 +0000 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org Cc: Bernt Hansen * lisp/org.el (org-insert-heading): Run org-insert-heading-hook when creating the first heading in a file The org-insert-heading-hook was skipped when creating the first heading in a new org file. --- I use an hook which creates an inactive timestamp for new headings. This was reported by k-man on the mailing list stating it doesn't work for empty org files when creating the first heading. I use the following hook: (defun bh/insert-inactive-timestamp () (interactive) (org-insert-time-stamp nil t t nil nil nil)) (defun bh/insert-heading-inactive-timestamp () (save-excursion (org-return) (org-cycle) (bh/insert-inactive-timestamp))) (add-hook 'org-insert-heading-hook 'bh/insert-heading-inactive-timestamp) -Bernt lisp/org.el | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lisp/org.el b/lisp/org.el index 75ee798..667a4e4 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -6752,8 +6752,8 @@ This is important for non-interactive uses of the command." (when (and org-insert-heading-respect-content hide-previous) (save-excursion (goto-char previous-pos) - (hide-subtree))) - (run-hooks 'org-insert-heading-hook))))) + (hide-subtree)))))) + (run-hooks 'org-insert-heading-hook)) (defun org-get-heading (&optional no-tags) "Return the heading of the current entry, without the stars." -- 1.7.3