From: <sand@blarg.net>
To: emacs-orgmode <emacs-orgmode@gnu.org>
Subject: org-capture: org-capture-place-item needs search bounds
Date: Tue, 12 Oct 2010 19:20:23 -0700 [thread overview]
Message-ID: <19637.5991.631077.826124@priss.frightenedpiglet.com> (raw)
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
next reply other threads:[~2010-10-13 2:20 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-13 2:20 sand [this message]
[not found] ` <88711D06-2DF0-4FBF-BD07-5B428227CF65@gmail.com>
2010-10-15 14:28 ` org-capture: org-capture-place-item needs search bounds sand
2011-02-03 12:57 ` Bastien
2011-02-03 13:01 ` Bastien
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: https://www.orgmode.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=19637.5991.631077.826124@priss.frightenedpiglet.com \
--to=sand@blarg.net \
--cc=emacs-orgmode@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).