[Top][All Lists]

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

[Orgmode] patch from master branch attached (was: C-RET errs)

From: Leo
Subject: [Orgmode] patch from master branch attached (was: C-RET errs)
Date: Wed, 03 Mar 2010 16:41:54 +0000
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/23.1.93 (darwin)

> Only if debian fixed this bug.
> I can reproduce this bug on Gnu/Linux with these steps.
> 1. git clone --depth 1 git://repo.or.cz/org-mode.git
> 2. go into the lisp dir and start emacs like this: emacs -q -L .
> 3. goto the scratch buffer and 'M-x org-mode' and then 'C-RET'

The following patch from the master branch should fix this bug. Carsten,
would you be able to fix it in Emacs upstream? Many thanks. Leo.

--- a/org.el    2010-03-03 16:36:22.000000000 +0000
+++ b/org.el    2010-03-03 16:37:09.000000000 +0000
@@ -5965,21 +5965,26 @@
           (looking-at "[ \t]*$")))))
-(defun org-insert-heading (&optional force-heading)
+(defun org-insert-heading (&optional force-heading invisible-ok)
   "Insert a new heading or item with same depth at point.
 If point is in a plain list and FORCE-HEADING is nil, create a new list item.
 If point is at the beginning of a headline, insert a sibling before the
 current headline.  If point is not at the beginning, do not split the line,
-but create the new headline after the current line."
-  (interactive "P")
-  (if (= (buffer-size) 0)
+but create the new headline after the current line.
+When INVISIBLE-OK is set, stop at invisible headlines when going back.
+This is important for non-interactive uses of the command."
+  (interactive "P")
+  (if (or (= (buffer-size) 0)
+         (and (not (save-excursion (and (ignore-errors (org-back-to-heading 
+                                        (org-on-heading-p))))
+              (not (org-in-item-p))))
       (insert "\n* ")
     (when (or force-heading (not (org-insert-item)))
       (let* ((empty-line-p nil)
             (head (save-excursion
                     (condition-case nil
-                          (org-back-to-heading)
+                          (org-back-to-heading invisible-ok)
                           (setq empty-line-p (org-previous-line-empty-p))
                           (match-string 0))
                       (error "*"))))

Diff finished.  Wed Mar  3 16:37:49 2010

H A P P Y  H O L I D A Y S!

reply via email to

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