emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-capture: org-capture-place-item needs search bounds
@ 2010-10-13  2:20 sand
       [not found] ` <88711D06-2DF0-4FBF-BD07-5B428227CF65@gmail.com>
  2011-02-03 12:57 ` Bastien
  0 siblings, 2 replies; 4+ messages in thread
From: sand @ 2010-10-13  2:20 UTC (permalink / raw)
  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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: org-capture: org-capture-place-item needs search bounds
       [not found] ` <88711D06-2DF0-4FBF-BD07-5B428227CF65@gmail.com>
@ 2010-10-15 14:28   ` sand
  0 siblings, 0 replies; 4+ messages in thread
From: sand @ 2010-10-15 14:28 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

Carsten Dominik writes:
> Yes.  Thank you for your report and correct analysis.
> 
> This fix was already in the current development version, I guess you
> are using 7.01h or something similar?  If you prefer to use released  
> versions,
> expect this change in 7.02.

I saw the problem in plain 7.01 and verified that it still existed in
7.01h.  But my location at the time didn't allow git:// access, and
the last time I had looked at the website I didn't notice the browsable
git repo.  I'll keep that in mind for next time.

Thanks,

Derek

-- 
Derek Upham
sand@blarg.net

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: org-capture: org-capture-place-item needs search bounds
  2010-10-13  2:20 org-capture: org-capture-place-item needs search bounds sand
       [not found] ` <88711D06-2DF0-4FBF-BD07-5B428227CF65@gmail.com>
@ 2011-02-03 12:57 ` Bastien
  2011-02-03 13:01   ` Bastien
  1 sibling, 1 reply; 4+ messages in thread
From: Bastien @ 2011-02-03 12:57 UTC (permalink / raw)
  To: sand; +Cc: emacs-orgmode

<sand@blarg.net> writes:

> In org-capture-place-item, excerpted here...

>  [...]
>
> 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.

If this is still an issue, can you provide a patch for this?  It will
help me understand what is really at stake.  

Thanks!

-- 
 Bastien

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: org-capture: org-capture-place-item needs search bounds
  2011-02-03 12:57 ` Bastien
@ 2011-02-03 13:01   ` Bastien
  0 siblings, 0 replies; 4+ messages in thread
From: Bastien @ 2011-02-03 13:01 UTC (permalink / raw)
  To: sand; +Cc: emacs-orgmode

Bastien <bastien.guerry@wikimedia.fr> writes:

> If this is still an issue, can you provide a patch for this?  It will
> help me understand what is really at stake.  

Forget about this, I've seen this has been fixed long ago.

Sorry for the noise,

-- 
 Bastien

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2011-02-03 13:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-13  2:20 org-capture: org-capture-place-item needs search bounds sand
     [not found] ` <88711D06-2DF0-4FBF-BD07-5B428227CF65@gmail.com>
2010-10-15 14:28   ` sand
2011-02-03 12:57 ` Bastien
2011-02-03 13:01   ` Bastien

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).