From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: [PATCH] Always run org-insert-heading-hook when creating headlines Date: Wed, 29 Sep 2010 16:44:48 +0200 Message-ID: <30F91C5F-07A4-400F-AA94-60DEB88BD77B@gmail.com> References: <1285510512-31684-1-git-send-email-bernt@norang.ca> Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from [140.186.70.92] (port=34134 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P0xu2-0007PC-9m for emacs-orgmode@gnu.org; Wed, 29 Sep 2010 10:45:12 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1P0xtt-0005bh-IB for emacs-orgmode@gnu.org; Wed, 29 Sep 2010 10:45:02 -0400 Received: from mail-ew0-f41.google.com ([209.85.215.41]:61455) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1P0xtt-0005bb-CY for emacs-orgmode@gnu.org; Wed, 29 Sep 2010 10:44:53 -0400 Received: by ewy19 with SMTP id 19so300649ewy.0 for ; Wed, 29 Sep 2010 07:44:52 -0700 (PDT) In-Reply-To: <1285510512-31684-1-git-send-email-bernt@norang.ca> 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: Bernt Hansen Cc: emacs-orgmode@gnu.org Hi Bernt, this patch does not work, it calls the hook also after inserting a new item. Please fix it by first reverting, and then call the hook also inside the if clause, right after (insert "\n") - you need progn then, of course. Thanks. - Carsten On Sep 26, 2010, at 4:15 PM, Bernt Hansen wrote: > * 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 > > > _______________________________________________ > Emacs-orgmode mailing list > Please use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode