emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* Subtle bug with capture and refile
@ 2010-10-21 12:27 Christopher Witte
  2010-10-21 16:05 ` John Rakestraw
  2010-10-21 17:38 ` Carsten Dominik
  0 siblings, 2 replies; 6+ messages in thread
From: Christopher Witte @ 2010-10-21 12:27 UTC (permalink / raw)
  To: Org Mode


[-- Attachment #1.1: Type: text/plain, Size: 1395 bytes --]

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.

[-- Attachment #1.2: Type: text/html, Size: 1708 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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

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

* Re: Subtle bug with capture and refile
  2010-10-21 12:27 Subtle bug with capture and refile Christopher Witte
@ 2010-10-21 16:05 ` John Rakestraw
  2010-10-21 17:38 ` Carsten Dominik
  1 sibling, 0 replies; 6+ messages in thread
From: John Rakestraw @ 2010-10-21 16:05 UTC (permalink / raw)
  To: Christopher Witte; +Cc: Org Mode

Hi, list --

On Thu, 21 Oct 2010, 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.  

Two points --

- First, thanks to Christopher for diagnosing this bug, which has been
  biting me, but only occasionally (and now I see why)

- Second, to add the additional data point that if I'm trying to refile to
  the item following the point where the new captures are added, I get the
  error message "Cannot refile to position inside the tree or region."

Thanks --

-- 
John Rakestraw

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

* Re: Subtle bug with capture and refile
  2010-10-21 12:27 Subtle bug with capture and refile Christopher Witte
  2010-10-21 16:05 ` John Rakestraw
@ 2010-10-21 17:38 ` Carsten Dominik
  2010-10-21 18:29   ` John Rakestraw
  1 sibling, 1 reply; 6+ messages in thread
From: Carsten Dominik @ 2010-10-21 17:38 UTC (permalink / raw)
  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

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

* Re: Subtle bug with capture and refile
  2010-10-21 17:38 ` Carsten Dominik
@ 2010-10-21 18:29   ` John Rakestraw
  2010-10-21 20:27     ` Carsten Dominik
  0 siblings, 1 reply; 6+ messages in thread
From: John Rakestraw @ 2010-10-21 18:29 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode

Hi, Carsten --

On Thu, 21 Oct 2010, Carsten Dominik wrote:
> Hi Christopher,
>
> thank you for taking the time to isolate this bug.  Could
> you please try the following patch?
>

Your patch seems to fix the problem.

Thanks --

John

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

-- 
John Rakestraw

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

* Re: Subtle bug with capture and refile
  2010-10-21 18:29   ` John Rakestraw
@ 2010-10-21 20:27     ` Carsten Dominik
  2010-10-22 14:13       ` Christopher Witte
  0 siblings, 1 reply; 6+ messages in thread
From: Carsten Dominik @ 2010-10-21 20:27 UTC (permalink / raw)
  To: John Rakestraw; +Cc: emacs-orgmode

Thanks for doing the testing.

- Carsten

On Oct 21, 2010, at 8:29 PM, John Rakestraw wrote:

> Hi, Carsten --
>
> On Thu, 21 Oct 2010, Carsten Dominik wrote:
>> Hi Christopher,
>>
>> thank you for taking the time to isolate this bug.  Could
>> you please try the following patch?
>>
>
> Your patch seems to fix the problem.
>
> Thanks --
>
> John
>
>> 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))
>>
>
> -- 
> John Rakestraw

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

* Re: Subtle bug with capture and refile
  2010-10-21 20:27     ` Carsten Dominik
@ 2010-10-22 14:13       ` Christopher Witte
  0 siblings, 0 replies; 6+ messages in thread
From: Christopher Witte @ 2010-10-22 14:13 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: emacs-orgmode


[-- Attachment #1.1: Type: text/plain, Size: 1637 bytes --]

Work for me too, thanks for the quick fix!

Cheers
Chris.

On 21 October 2010 22:27, Carsten Dominik <carsten.dominik@gmail.com> wrote:

> Thanks for doing the testing.
>
> - Carsten
>
>
> On Oct 21, 2010, at 8:29 PM, John Rakestraw wrote:
>
>  Hi, Carsten --
>>
>> On Thu, 21 Oct 2010, Carsten Dominik wrote:
>>
>>> Hi Christopher,
>>>
>>> thank you for taking the time to isolate this bug.  Could
>>> you please try the following patch?
>>>
>>>
>> Your patch seems to fix the problem.
>>
>> Thanks --
>>
>> John
>>
>>  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))
>>>
>>>
>> --
>> John Rakestraw
>>
>
>
> _______________________________________________
> 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
>



-- 
Postdoctoral Research Fellow
Molecular Imaging Group
 Leibniz-Institut für Molekulare Pharmakologie (FMP)
Campus Berlin-Buch
Robert-Roessle-Str. 10
13125 Berlin, Germany
Phone: 00493094793-279

[-- Attachment #1.2: Type: text/html, Size: 3263 bytes --]

[-- Attachment #2: Type: text/plain, Size: 201 bytes --]

_______________________________________________
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

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

end of thread, other threads:[~2010-10-22 14:13 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-10-21 12:27 Subtle bug with capture and refile Christopher Witte
2010-10-21 16:05 ` John Rakestraw
2010-10-21 17:38 ` Carsten Dominik
2010-10-21 18:29   ` John Rakestraw
2010-10-21 20:27     ` Carsten Dominik
2010-10-22 14:13       ` Christopher Witte

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