summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Dominik <carsten.dominik@gmail.com>2010-02-01 14:30:36 +0100
committerCarsten Dominik <carsten.dominik@gmail.com>2010-02-01 14:30:36 +0100
commitb8a4d004f241e08ab4b3cc0d8448857d83b03318 (patch)
tree5eec41eaa8644476096ba150c91a164dcf1451cb
parent6329881a1b96b7305b21179cfe40f112a958db43 (diff)
downloadorg-mode-b8a4d004f241e08ab4b3cc0d8448857d83b03318.tar.gz
Fix bug with insertion of date lines into a tree from the agenda
Reports by Stephen Eglen and Eric S Fraga.
-rwxr-xr-xlisp/ChangeLog8
-rw-r--r--lisp/org-agenda.el2
-rw-r--r--lisp/org-mac-message.el2
-rw-r--r--lisp/org.el10
4 files changed, 16 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 73da3a7..a48f49b 100755
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,5 +1,13 @@
2010-02-01 Carsten Dominik <carsten.dominik@gmail.com>
+ * org-agenda.el (org-agenda-insert-diary-make-new-entry): Call
+ `org-insert-heading' with the INVISIBLE-OK argument.
+
+ * org-mac-message.el (org-mac-message-insert-flagged): Call
+ `org-insert-heading' with the INVISIBLE-OK argument.
+
+ * org.el (org-insert-heading): New argument INVISIBLE-OK.
+
* org-agenda.el (org-agenda-view-mode-dispatch): Improve the
prompt message.
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index 769438d..5010144 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -6946,7 +6946,7 @@ a timestamp can be added there."
(org-back-over-empty-lines)
(or (looking-at "[ \t]*$")
(progn (insert "\n") (backward-char 1)))
- (org-insert-heading)
+ (org-insert-heading nil t)
(org-do-demote)
(setq col (current-column))
(insert text "\n")
diff --git a/lisp/org-mac-message.el b/lisp/org-mac-message.el
index fab1b73..dd2a772 100644
--- a/lisp/org-mac-message.el
+++ b/lisp/org-mac-message.el
@@ -209,7 +209,7 @@ list of message:// links to flagged mail after heading."
(insert "\n" (org-mac-message-get-links "f")))
(goto-char (point-max))
(insert "\n")
- (org-insert-heading)
+ (org-insert-heading nil t)
(insert org-heading "\n" (org-mac-message-get-links "f"))))))
(provide 'org-mac-message)
diff --git a/lisp/org.el b/lisp/org.el
index ae734f3..dad02fd 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -6087,15 +6087,17 @@ frame is not changed."
(save-match-data
(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."
+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))
+ (and (not (save-excursion (and (ignore-errors (org-back-to-heading invisible-ok))
(org-on-heading-p))))
(not (org-in-item-p))))
(insert "\n* ")
@@ -6104,7 +6106,7 @@ but create the new headline after the current line."
(head (save-excursion
(condition-case nil
(progn
- (org-back-to-heading)
+ (org-back-to-heading invisible-ok)
(setq empty-line-p (org-previous-line-empty-p))
(match-string 0))
(error "*"))))