summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYork Zhao <gtdplatform@gmail.com>2013-11-17 18:48:55 -0500
committerCarsten Dominik <carsten.dominik@gmail.com>2013-11-26 06:28:07 +0100
commitf1583aab467fff999f25eff6a03e771d11139a93 (patch)
tree48b2996a48734876874a2fa1a6ceea36b7194129
parent48db3292968d5288b5f7c61ac1d7dbd31175cf36 (diff)
downloadorg-mode-f1583aab467fff999f25eff6a03e771d11139a93.tar.gz
Fix problem with :exact-positions in capture
* lisp/org-capture.el (org-capture-place-entry): Set :exact-position before doing other stuff, to allow function with other target settings TINYCHANGE Assuming file "test.org" has a single headline "* Level 1" (ended with newline character), when trying to use function type capture target in an org-capture template, as shown in the example: (setq org-capture-templates `(("t" "Test function type target" entry (function (lambda () (set-buffer (org-capture-target-buffer "test.org")) (goto-char (point-max)))) "* Level 2"))) When this template gets filled, file "test.org" becomes: * Level 1 * Level 2 Instead of: * Level 1 ** Level 2 This is because when using function type target, `:exact-position' is used to store buffer position returned by user's function (the lambda function here), and function `org-capture-place-entry' will never insert template as a child of current entry when `:exact-position' is used. The problem is addressed by not special casing for `:exact-position' in function `org-capture-place-entry'. York
-rw-r--r--lisp/org-capture.el4
1 files changed, 2 insertions, 2 deletions
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index 39804ac..f47a2c5 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -1021,9 +1021,9 @@ may have been stored before."
(target-entry-p (org-capture-get :target-entry-p))
level beg end file)
+ (and (org-capture-get :exact-position)
+ (goto-char (org-capture-get :exact-position)))
(cond
- ((org-capture-get :exact-position)
- (goto-char (org-capture-get :exact-position)))
((not target-entry-p)
;; Insert as top-level entry, either at beginning or at end of file
(setq level 1)