summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Goaziou <mail@nicolasgoaziou.fr>2015-02-08 01:45:38 +0100
committerNicolas Goaziou <mail@nicolasgoaziou.fr>2015-02-08 01:45:38 +0100
commit0be8495d0145e0bbabefa0337e513563d5905a66 (patch)
tree44907a58d11a7cdd8af7e30fd25bfbaf9e7d43f3
parentca0199c7ee7492e794f1663b6e3d84dc6d4edce1 (diff)
downloadorg-mode-0be8495d0145e0bbabefa0337e513563d5905a66.tar.gz
Call `org-insert-heading' instead of (insert "* ")
* lisp/org-agenda.el (org-agenda-insert-diary-as-top-level): * lisp/org.el (org-link-search): Call `org-insert-heading' instead of (insert "* "). This allows, in particular, to run `org-insert-heading-hook' and possibly fix up blank lines around.
-rw-r--r--lisp/org-agenda.el6
-rwxr-xr-xlisp/org.el5
2 files changed, 6 insertions, 5 deletions
diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el
index e7cfd27..1872ca5 100644
--- a/lisp/org-agenda.el
+++ b/lisp/org-agenda.el
@@ -9487,12 +9487,12 @@ Add TEXT as headline, and position the cursor in the second line so that
a timestamp can be added there."
(widen)
(goto-char (point-max))
- (or (bolp) (insert "\n"))
- (org-insert-heading)
+ (unless (bolp) (insert "\n"))
+ (org-insert-heading nil t t)
(insert text)
(org-end-of-meta-data)
(unless (bolp) (insert "\n"))
- (if org-adapt-indentation (org-indent-to-column 2)))
+ (when org-adapt-indentation (org-indent-to-column 2)))
(defun org-agenda-insert-diary-make-new-entry (text)
"Make a new entry with TEXT as the first child of the current subtree.
diff --git a/lisp/org.el b/lisp/org.el
index 2ce909c..d7d9c61 100755
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -11101,8 +11101,9 @@ visibility around point, thus ignoring
(eq org-link-search-must-match-exact-headline 'query-to-create)
(y-or-n-p "No match - create this as a new heading? "))
(goto-char (point-max))
- (or (bolp) (newline))
- (insert "* " s "\n")
+ (unless (bolp) (newline))
+ (org-insert-heading nil t t)
+ (insert s "\n")
(beginning-of-line 0))
(t
(goto-char pos)