Merge branch 'master' into next
This commit is contained in:
commit
796a7c4c0e
|
@ -1128,20 +1128,20 @@ may have been stored before."
|
||||||
(unless (org-at-heading-p) (outline-next-heading)))
|
(unless (org-at-heading-p) (outline-next-heading)))
|
||||||
;; Otherwise, insert as a top-level entry at the end of the file.
|
;; Otherwise, insert as a top-level entry at the end of the file.
|
||||||
(t (goto-char (point-max))))
|
(t (goto-char (point-max))))
|
||||||
(unless (bolp) (insert "\n"))
|
|
||||||
(org-capture-empty-lines-before)
|
|
||||||
(let ((beg (point))
|
(let ((beg (point))
|
||||||
(template (org-capture-get :template)))
|
(template (org-capture-get :template)))
|
||||||
|
(unless (bolp) (insert "\n"))
|
||||||
|
(org-capture-empty-lines-before)
|
||||||
(org-capture-verify-tree template)
|
(org-capture-verify-tree template)
|
||||||
(org-paste-subtree level template 'for-yank)
|
(org-paste-subtree level template 'for-yank)
|
||||||
(org-capture-empty-lines-after)
|
(org-capture-empty-lines-after)
|
||||||
(org-capture-position-for-last-stored beg)
|
(org-capture-position-for-last-stored beg)
|
||||||
(unless (org-at-heading-p) (outline-next-heading))
|
(unless (org-at-heading-p) (outline-next-heading))
|
||||||
(let ((end (point)))
|
(org-capture-mark-kill-region beg (point))
|
||||||
(org-capture-mark-kill-region beg end)
|
(let ((end (if (org-at-heading-p) (line-end-position 0) (point))))
|
||||||
(org-capture-narrow beg end)
|
(org-capture-narrow beg end)
|
||||||
(when (or (re-search-backward "%\\?" beg t)
|
(when (or (search-backward "%?" beg t)
|
||||||
(re-search-forward "%\\?" end t))
|
(search-forward "%?" end t))
|
||||||
(replace-match ""))))))
|
(replace-match ""))))))
|
||||||
|
|
||||||
(defun org-capture-place-item ()
|
(defun org-capture-place-item ()
|
||||||
|
|
|
@ -145,7 +145,7 @@
|
||||||
(org-capture-refile)
|
(org-capture-refile)
|
||||||
(list file1 file2 (buffer-file-name)))))))))
|
(list file1 file2 (buffer-file-name)))))))))
|
||||||
|
|
||||||
(ert-deftest test-org-capture/insert-at-end-abort ()
|
(ert-deftest test-org-capture/abort ()
|
||||||
"Test that capture can be aborted after inserting at end of capture buffer."
|
"Test that capture can be aborted after inserting at end of capture buffer."
|
||||||
(should
|
(should
|
||||||
(equal
|
(equal
|
||||||
|
@ -160,6 +160,22 @@
|
||||||
(org-capture-kill))
|
(org-capture-kill))
|
||||||
(buffer-string)))))
|
(buffer-string)))))
|
||||||
|
|
||||||
|
(ert-deftest test-org-caputre/entry ()
|
||||||
|
"Test `entry' type in capture template."
|
||||||
|
;; Do not break next headline.
|
||||||
|
(should
|
||||||
|
(equal
|
||||||
|
"* A\n** H1 Capture text\n* B\n"
|
||||||
|
(org-test-with-temp-text-in-file "* A\n* B\n"
|
||||||
|
(let* ((file (buffer-file-name))
|
||||||
|
(org-capture-templates
|
||||||
|
`(("t" "Todo" entry (file+headline ,file "A") "** H1 %?"))))
|
||||||
|
(org-capture nil "t")
|
||||||
|
(goto-char (point-max))
|
||||||
|
(insert "Capture text")
|
||||||
|
(org-capture-finalize))
|
||||||
|
(buffer-string)))))
|
||||||
|
|
||||||
(ert-deftest test-org-capture/table-line ()
|
(ert-deftest test-org-capture/table-line ()
|
||||||
"Test `table-line' type in capture template."
|
"Test `table-line' type in capture template."
|
||||||
;; When a only file is specified, use the first table available.
|
;; When a only file is specified, use the first table available.
|
||||||
|
|
Loading…
Reference in New Issue