From mboxrd@z Thu Jan 1 00:00:00 1970 From: Subject: org-capture: org-capture-place-item needs search bounds Date: Tue, 12 Oct 2010 19:20:23 -0700 Message-ID: <19637.5991.631077.826124@priss.frightenedpiglet.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Return-path: Received: from [140.186.70.92] (port=54974 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P5qxK-0003Dn-Lx for emacs-orgmode@gnu.org; Tue, 12 Oct 2010 22:20:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P5qxJ-0006eT-AJ for emacs-orgmode@gnu.org; Tue, 12 Oct 2010 22:20:38 -0400 Received: from v-static-143-234.avvanta.com ([206.124.143.234]:54057 helo=priss.frightenedpiglet.com) by eggs.gnu.org with smtp (Exim 4.71) (envelope-from ) id 1P5qxI-0006dt-V6 for emacs-orgmode@gnu.org; Tue, 12 Oct 2010 22:20:37 -0400 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode In org-capture-place-item, excerpted here... (defun org-capture-place-item () "Place the template as a new plain list item." (let* ((txt (org-capture-get :template)) (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 (re-search-forward (concat "^" (org-item-re)) nil t) (progn (goto-char (match-beginning 0)) (setq ind (org-get-indentation))) (goto-char end) (setq ind 0))) (goto-char end) (if (re-search-backward (concat "^" (org-item-re)) nil t) (progn (setq ind (org-get-indentation)) (org-end-of-item)) (setq ind 0))) [...] the function needs to bound re-search-forward by END, and it needs to bound re-search-backward by BEG. As it stands right now, if the target location doesn't contain an item already, the function will happily pick the nearest list in a preceeding or following entry. Derek -- Derek Upham sand@blarg.net