Browse Source

Make use of `org-insert-heading' instead of inserting the * character

* lisp/org-agenda.el (org-agenda-insert-diary-as-top-level): Make
  use of `org-insert-heading' instead of inserting the * character

Therefore, the hooks associated to the insertion of a heading will be
triggered.  Since those hooks may cause the creation of some
metadata.  `org-end-of-meta-data' is used afterward.
Konubinix 10 years ago
parent
commit
2ebb14d746
1 changed files with 4 additions and 1 deletions
  1. 4 1
      lisp/org-agenda.el

+ 4 - 1
lisp/org-agenda.el

@@ -9488,7 +9488,10 @@ a timestamp can be added there."
   (widen)
   (goto-char (point-max))
   (or (bolp) (insert "\n"))
-  (insert "* " text "\n")
+  (org-insert-heading)
+  (insert text)
+  (org-end-of-meta-data)
+  (unless (bolp) (insert "\n"))
   (if org-adapt-indentation (org-indent-to-column 2)))
 
 (defun org-agenda-insert-diary-make-new-entry (text)