From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Subtle bug with capture and refile Date: Thu, 21 Oct 2010 19:38:20 +0200 Message-ID: References: Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from [140.186.70.92] (port=41650 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1P8z66-0001Kg-0l for emacs-orgmode@gnu.org; Thu, 21 Oct 2010 13:38:43 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1P8z5x-00066O-7n for emacs-orgmode@gnu.org; Thu, 21 Oct 2010 13:38:30 -0400 Received: from mail-ew0-f41.google.com ([209.85.215.41]:49350) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1P8z5x-00062Q-1t for emacs-orgmode@gnu.org; Thu, 21 Oct 2010 13:38:29 -0400 Received: by mail-ew0-f41.google.com with SMTP id 25so348557ewy.0 for ; Thu, 21 Oct 2010 10:38:28 -0700 (PDT) In-Reply-To: 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: Christopher Witte Cc: Org Mode Hi Christopher, thank you for taking the time to isolate this bug. Could you please try the following patch? Thanks. - Carsten Modified lisp/org-capture.el diff --git a/lisp/org-capture.el b/lisp/org-capture.el index 7915f7f..537f1a4 100644 --- a/lisp/org-capture.el +++ b/lisp/org-capture.el @@ -548,6 +548,7 @@ already gone." (unless (eq (org-capture-get :type 'local) 'entry) (error "Refiling from a capture buffer makes only sense for `entry'- type templates")) + (if (and (bolp) (eobp)) (backward-char 1)) (let ((pos (point)) (base (buffer-base-buffer (current-buffer))) (org-refile-for-capture t)) On Oct 21, 2010, at 2:27 PM, Christopher Witte wrote: > The new org capture has been working great but I have just come > across a subtle bug that has taken me a while to reliably > reproduce. I have org set up to add TODO captures to the top of my > organiser.org file. If you try and refile the capture TODO and the > cursor is at the bottom of the capture buffer, it will refile the > next item in organiser.org and not the capture TODO. Hmm, that > doesn't sound too clear, let me try and give an example. My > organiser.org looks like this: > > -----organiser.org----- > * Home > ** Home item 1 > ** Home item 2 > * Work > ** Work item 1 > > > I then make a capture TODO > > -----capture buffer----- > * TODO report capture buffer bug > ! > > with the cursor indicated by ! I press C-c C-w and refile to work. > Instead of the capture note being refiled, Home get refiled so I end > up with organiser.org looking like: > > -----organiser.org----- > *TODO report capture buffer bug > * Work > ** Home > *** Home item 1 > *** Home item 2 > ** Work item 1 > > if instead the cursor is on the TODO line when I refile, everything > works as expect and I end up with: > > -----organiser.org----- > * Home > ** Home item 1 > ** Home item 2 > * Work > ** TODO report capture buffer bug > ** Work item 1 > > This has been causing me problems for a while now, but I could never > work out why this only happened some of the time. I hope that > explains the problem with sufficient clarity, let me know if it > doesn't. > > Cheers > Chris Witte. > _______________________________________________ > Emacs-orgmode mailing list > Please use `Reply All' to send replies to the list. > Emacs-orgmode@gnu.org > http://lists.gnu.org/mailman/listinfo/emacs-orgmode