Browse Source

Put multiline diary entries on a single line.

* org-agenda.el (org-get-entries-from-diary): Put multiline
diary entries on a single line when lines don't start with a
diary time.

This was requested by Suvayu Ali.
Bastien Guerry 14 years ago
parent
commit
6d6d24581d
1 changed files with 8 additions and 1 deletions
  1. 8 1
      lisp/org-agenda.el

+ 8 - 1
lisp/org-agenda.el

@@ -4323,7 +4323,14 @@ of what a project is and how to check if it stuck, customize the variable
 	  ;; Add prefix to each line and extend the text properties
 	  (if (zerop (buffer-size))
 	      (setq entries nil)
-	    (setq entries (buffer-substring (point-min) (- (point-max) 1)))))
+	    (setq entries (buffer-substring (point-min) (- (point-max) 1)))
+	    (setq entries 
+		  (with-temp-buffer
+		    (insert entries) (goto-char (point-min))
+		    (while (re-search-forward "\n[ \t]+\\(.+\\)$" nil t)
+		      (unless (save-match-data (string-match diary-time-regexp (match-string 1)))
+			(replace-match (concat "; " (match-string 1)))))
+		    (buffer-string)))))
 	(set-buffer-modified-p nil)
 	(kill-buffer diary-fancy-buffer)))
     (when entries