summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Maus <dmaus@ictsoc.de>2012-01-24 06:41:49 +0100
committerDavid Maus <dmaus@ictsoc.de>2012-01-24 06:41:49 +0100
commitcda38d182a4e33d4f377f7df09f39c8f35d31d3d (patch)
tree21074e93739548be9460c60fc1de059f08bc5d97
parentfce92180d162c2c2d4487a719c078c5b33f941b3 (diff)
downloadorg-mode-cda38d182a4e33d4f377f7df09f39c8f35d31d3d.tar.gz
Don't search for position in existing list if :exact-position
* org-capture.el (org-capture-place-item): Don't search for position in existing list if :exact-position was supplied. This fixes a bug reported by François Pinard in <http://thread.gmane.org/gmane.emacs.orgmode/49995>.
-rw-r--r--lisp/org-capture.el46
1 files changed, 23 insertions, 23 deletions
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index 31694d4..01ec85d 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -911,30 +911,30 @@ it. When it is a variable, retrieve the value. Return whatever we get."
(target-entry-p (org-capture-get :target-entry-p))
(ind 0)
beg end)
- (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 beg (point-min) end (point-max)))
- (t
- (setq beg (1+ (point-at-eol))
- end (save-excursion (outline-next-heading) (point)))))
- (if (org-capture-get :prepend)
- (progn
- (goto-char beg)
- (if (org-list-search-forward (org-item-beginning-re) end t)
- (progn
- (goto-char (match-beginning 0))
- (setq ind (org-get-indentation)))
- (goto-char end)
- (setq ind 0)))
- (goto-char end)
- (if (org-list-search-backward (org-item-beginning-re) beg t)
+ (if (org-capture-get :exact-position)
+ (goto-char (org-capture-get :exact-position))
+ (cond
+ ((not target-entry-p)
+ ;; Insert as top-level entry, either at beginning or at end of file
+ (setq beg (point-min) end (point-max)))
+ (t
+ (setq beg (1+ (point-at-eol))
+ end (save-excursion (outline-next-heading) (point)))))
+ (if (org-capture-get :prepend)
(progn
- (setq ind (org-get-indentation))
- (org-end-of-item))
- (setq ind 0)))
+ (goto-char beg)
+ (if (org-list-search-forward (org-item-beginning-re) end t)
+ (progn
+ (goto-char (match-beginning 0))
+ (setq ind (org-get-indentation)))
+ (goto-char end)
+ (setq ind 0)))
+ (goto-char end)
+ (if (org-list-search-backward (org-item-beginning-re) beg t)
+ (progn
+ (setq ind (org-get-indentation))
+ (org-end-of-item))
+ (setq ind 0))))
;; Remove common indentation
(setq txt (org-remove-indentation txt))
;; Make sure this is indeed an item