瀏覽代碼

Fix bug with insertion of date lines into a tree from the agenda

Reports by Stephen Eglen and Eric S Fraga.
Carsten Dominik 15 年之前
父節點
當前提交
b8a4d004f2
共有 4 個文件被更改,包括 16 次插入6 次删除
  1. 8 0
      lisp/ChangeLog
  2. 1 1
      lisp/org-agenda.el
  3. 1 1
      lisp/org-mac-message.el
  4. 6 4
      lisp/org.el

+ 8 - 0
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.
 

+ 1 - 1
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")

+ 1 - 1
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)

+ 6 - 4
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 "*"))))