Hi, Nicolas Goaziou <m...@nicolasgoaziou.fr> writes: > Samuel Loury <konubi...@gmail.com> writes: > >> I suggest to provide a helper that would move point after the meta-data >> part to avoid code duplication. Something like (no surprise :-)): >> (defun org-goto-after-metadata-part () >> (when (org-looking-at-p org-planning-line-re) (forward-line)) >> (when (looking-at org-property-drawer-re) >> (goto-char (match-end 0)) >> (forward-line))) > > Indeed. > >> I would have gladly provided a patch myself but I couldn't find neither >> a good name for the function nor a correct location to store it. Should >> it be in org.el? It is already 24850 lines long... > > I changed `org-end-of-meta-data-and-drawers' into > `org-end-of-meta-data'. > > Could you merge your other patch and the use of this function? Please find attached the merged patch, as asked for.
From 02dd79b12d6f19551d1d9648a3a84e53c4cee984 Mon Sep 17 00:00:00 2001 From: Konubinix <konubi...@gmail.com> Date: Thu, 6 Nov 2014 11:02:23 +0100 Subject: [PATCH] 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. --- lisp/org-agenda.el | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 5f7c9ac..164e2d5 100644 --- a/lisp/org-agenda.el +++ b/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) -- 2.1.4
Thank you for you support. -- Konubinix GPG Key : 7439106A Fingerprint: 5993 BE7A DA65 E2D9 06CE 5C36 75D2 3CED 7439 106A
signature.asc
Description: PGP signature