emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* org-refile bug
@ 2010-03-17  1:14 Jason Dunsmore
  2010-03-17  9:53 ` Mikael Fornius
  0 siblings, 1 reply; 8+ messages in thread
From: Jason Dunsmore @ 2010-03-17  1:14 UTC (permalink / raw)
  To: emacs-orgmode

Whenever I run org-remember, enter a single item, type "C-1 C-c C-c",
and select a heading to file it under, the entry is lost.  Is this a
bug?  I'm using Org-mode version 6.34trans (release_6.34c.210.g6976).

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

* Re: org-refile bug
  2010-03-17  1:14 org-refile bug Jason Dunsmore
@ 2010-03-17  9:53 ` Mikael Fornius
  2010-03-17 15:31   ` Jason Dunsmore
  0 siblings, 1 reply; 8+ messages in thread
From: Mikael Fornius @ 2010-03-17  9:53 UTC (permalink / raw)
  To: Jason Dunsmore; +Cc: emacs-orgmode


I can non reproduce this problem. 

I Also use current release_6.34c.210.g6976 and tried with basic
completion, ido-completion and iswitchb.

Can you give some more information? Warnings in *Messages* and maybe
M-x toggle-debug-on-error gives backtrace?

-- 
Mikael Fornius

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

* Re: org-refile bug
  2010-03-17  9:53 ` Mikael Fornius
@ 2010-03-17 15:31   ` Jason Dunsmore
  2010-03-17 16:33     ` Mikael Fornius
  0 siblings, 1 reply; 8+ messages in thread
From: Jason Dunsmore @ 2010-03-17 15:31 UTC (permalink / raw)
  To: Mikael Fornius; +Cc: emacs-orgmode

Mikael Fornius <mfo@abc.se> writes:

> I can non reproduce this problem. 
>
> I Also use current release_6.34c.210.g6976 and tried with basic
> completion, ido-completion and iswitchb.
>
> Can you give some more information? Warnings in *Messages* and maybe
> M-x toggle-debug-on-error gives backtrace?

Thanks for looking into this.

There were no warnings or errors.  It just silently failed to file the
entry in my org file.  Only status messages were shown in *Messages*.

It has to do with the contents of my ~/.emacs.d/bookmarks file.  When it
wasn't working, my bookmarks file contained the following:


$ cat .emacs.d/bookmarks
;;;; Emacs Bookmark Format Version 1 ;;;;
;;; This format is meant to be slightly human-readable;
;;; nevertheless, you probably don't want to edit it.
;;; -*- End Of Bookmark File Format Version Stamp -*-
(("org-refile-last-stored"
 (filename . "~/repo/org/todo.org")
 (front-context-string . "*** Buy some tom")
 (rear-context-string . "se\n** Gardening\n")
 (position . 1030))
("org-remember-last-stored"
 (filename . "~/repo/org/todo.org")
 (front-context-string . "*** TODO Buy som")
 (rear-context-string . "se\n** Gardening\n")
 (position . 874))
)


I removed the file and then refiling from org-remember using "C-1 C-c
C-c" began working.  After a successful test, the contents were:


$ cat .emacs.d/bookmarks
;;;; Emacs Bookmark Format Version 1 ;;;;
;;; This format is meant to be slightly human-readable;
;;; nevertheless, you probably don't want to edit it.
;;; -*- End Of Bookmark File Format Version Stamp -*-
(("org-refile-last-stored"
 (filename . "~/repo/org/todo.org")
 (front-context-string . "** test\n* Misc\n*")
 (rear-context-string . "SEARCH\n\n* Inbox\n")
 (position . 318))
("org-remember-last-stored"
 (filename . "~/repo/org/todo.org")
 (front-context-string . "** test\n* Misc\n*")
 (rear-context-string . "SEARCH\n\n* Inbox\n")
 (position . 318))
)


Any idea what the problem is?

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

* Re: org-refile bug
  2010-03-17 15:31   ` Jason Dunsmore
@ 2010-03-17 16:33     ` Mikael Fornius
  2010-03-18  5:49       ` Carsten Dominik
  0 siblings, 1 reply; 8+ messages in thread
From: Mikael Fornius @ 2010-03-17 16:33 UTC (permalink / raw)
  To: Jason Dunsmore; +Cc: emacs-orgmode


This goes beyond my knowledge of org-remember.

Maybe it has something to do with corrupt org-*-last-stored data if the
last org-entry data is removed or changed? Just guessing here...

I tried to corrupt the data myself, then did bookmark-load and
org-remember C-1 C-c C-c but then it worked.

When looking briefly in org-remember.el I could not find any bookmark-*
function call that looked like it was depending on its success.

Just so you have not forgotten: did you search all your org-agenda-files
if the entry was misplaced somewhere?

Someone with better knowledge of org-remember then me can sort this out?

-- 
Mikael Fornius

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

* Re: Re: org-refile bug
  2010-03-17 16:33     ` Mikael Fornius
@ 2010-03-18  5:49       ` Carsten Dominik
  2010-03-19  2:19         ` Jason Dunsmore
  0 siblings, 1 reply; 8+ messages in thread
From: Carsten Dominik @ 2010-03-18  5:49 UTC (permalink / raw)
  To: Mikael Fornius; +Cc: emacs-orgmode


On Mar 17, 2010, at 5:33 PM, Mikael Fornius wrote:

>
> This goes beyond my knowledge of org-remember.
>
> Maybe it has something to do with corrupt org-*-last-stored data if  
> the
> last org-entry data is removed or changed? Just guessing here...
>
> I tried to corrupt the data myself, then did bookmark-load and
> org-remember C-1 C-c C-c but then it worked.
>
> When looking briefly in org-remember.el I could not find any  
> bookmark-*
> function call that looked like it was depending on its success.
>
> Just so you have not forgotten: did you search all your org-agenda- 
> files
> if the entry was misplaced somewhere?
>
> Someone with better knowledge of org-remember then me can sort this  
> out?

I think your analysis is correct.  The bookmark-set function is always  
called *after* the note has been inserted at the target location.  So  
even if it fails, the note should not disappear.

Without a reproducible test case, it is difficult to do more here.

- Carsten

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

* Re: Re: org-refile bug
  2010-03-18  5:49       ` Carsten Dominik
@ 2010-03-19  2:19         ` Jason Dunsmore
  2010-03-19 13:10           ` Carsten Dominik
  0 siblings, 1 reply; 8+ messages in thread
From: Jason Dunsmore @ 2010-03-19  2:19 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Mikael Fornius, emacs-orgmode

Carsten Dominik <carsten.dominik@gmail.com> writes:

> I think your analysis is correct.  The bookmark-set function is always
> called *after* the note has been inserted at the target location.  So
> even if it fails, the note should not disappear.
>
> Without a reproducible test case, it is difficult to do more here.

I was mistaken.  It doesn't have to do with the bookmark function.  It
looks like org-refile-get-location was failing to handle the case where
the refile entry was invalid.  I was used to typing just the header name
at the refile prompt and I didn't realize the file name was in
parenthesis.

Here is a quick fix to prevent the entry from being lost:

--8<---------------cut here---------------start------------->8---
diff --git a/lisp/org.el b/lisp/org.el
index 4876173..feb13db 100644
--- a/lisp/org.el
+++ b/lisp/org.el
@@ -9481,15 +9481,17 @@ See also `org-refile-use-outline-path' and `org-completion
            (if (equal (car org-refile-history) (nth 1 org-refile-history))
                (pop org-refile-history)))
          pa)   
-      (when (string-match "\\`\\(.*\\)/\\([^/]+\\)\\'" answ)
-       (setq parent (match-string 1 answ)
-             child (match-string 2 answ))
-       (setq parent-target (or (assoc parent tbl) (assoc (concat parent "/") tbl)
-       (when (and parent-target
-                  (or (eq new-nodes t)
-                      (and (eq new-nodes 'confirm)
-                           (y-or-n-p (format "Create new node \"%s\"? " child))))
-         (org-refile-new-child parent-target child))))))
+      (if (string-match "\\`\\(.*\\)/\\([^/]+\\)\\'" answ)
+         (progn
+           (setq parent (match-string 1 answ)
+                 child (match-string 2 answ))
+           (setq parent-target (or (assoc parent tbl) (assoc (concat parent "/") 
+           (when (and parent-target
+                      (or (eq new-nodes t)
+                          (and (eq new-nodes 'confirm)
+                               (y-or-n-p (format "Create new node \"%s\"? " child
+             (org-refile-new-child parent-target child)))
+       (error "Invalid location.")))))

 (defun org-refile-new-child (parent-target child)
   "Use refile target PARENT-TARGET to add new CHILD below it."
--8<---------------cut here---------------end--------------->8---

A better solution would be to do a tab completion when trying to enter
an invalid entry, but this is beyond my current knowledge of elisp.

Regards,
Jason

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

* Re: Re: org-refile bug
  2010-03-19  2:19         ` Jason Dunsmore
@ 2010-03-19 13:10           ` Carsten Dominik
  2010-03-19 20:39             ` Jason Dunsmore
  0 siblings, 1 reply; 8+ messages in thread
From: Carsten Dominik @ 2010-03-19 13:10 UTC (permalink / raw)
  To: Jason Dunsmore; +Cc: Mikael Fornius, emacs-orgmode

I applied your patch, thanks.

I am not sure if I understand you correctly, but there *is*
completion support at that prompt.

- Carsten

On Mar 19, 2010, at 3:19 AM, Jason Dunsmore wrote:

> Carsten Dominik <carsten.dominik@gmail.com> writes:
>
>> I think your analysis is correct.  The bookmark-set function is  
>> always
>> called *after* the note has been inserted at the target location.  So
>> even if it fails, the note should not disappear.
>>
>> Without a reproducible test case, it is difficult to do more here.
>
> I was mistaken.  It doesn't have to do with the bookmark function.  It
> looks like org-refile-get-location was failing to handle the case  
> where
> the refile entry was invalid.  I was used to typing just the header  
> name
> at the refile prompt and I didn't realize the file name was in
> parenthesis.
>
> Here is a quick fix to prevent the entry from being lost:
>
> --8<---------------cut here---------------start------------->8---
> diff --git a/lisp/org.el b/lisp/org.el
> index 4876173..feb13db 100644
> --- a/lisp/org.el
> +++ b/lisp/org.el
> @@ -9481,15 +9481,17 @@ See also `org-refile-use-outline-path' and  
> `org-completion
>            (if (equal (car org-refile-history) (nth 1 org-refile- 
> history))
>                (pop org-refile-history)))
>          pa)
> -      (when (string-match "\\`\\(.*\\)/\\([^/]+\\)\\'" answ)
> -       (setq parent (match-string 1 answ)
> -             child (match-string 2 answ))
> -       (setq parent-target (or (assoc parent tbl) (assoc (concat  
> parent "/") tbl)
> -       (when (and parent-target
> -                  (or (eq new-nodes t)
> -                      (and (eq new-nodes 'confirm)
> -                           (y-or-n-p (format "Create new node \"%s 
> \"? " child))))
> -         (org-refile-new-child parent-target child))))))
> +      (if (string-match "\\`\\(.*\\)/\\([^/]+\\)\\'" answ)
> +         (progn
> +           (setq parent (match-string 1 answ)
> +                 child (match-string 2 answ))
> +           (setq parent-target (or (assoc parent tbl) (assoc  
> (concat parent "/")
> +           (when (and parent-target
> +                      (or (eq new-nodes t)
> +                          (and (eq new-nodes 'confirm)
> +                               (y-or-n-p (format "Create new node  
> \"%s\"? " child
> +             (org-refile-new-child parent-target child)))
> +       (error "Invalid location.")))))
>
> (defun org-refile-new-child (parent-target child)
>   "Use refile target PARENT-TARGET to add new CHILD below it."
> --8<---------------cut here---------------end--------------->8---
>
> A better solution would be to do a tab completion when trying to enter
> an invalid entry, but this is beyond my current knowledge of elisp.
>
> Regards,
> Jason

- Carsten

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

* Re: Re: org-refile bug
  2010-03-19 13:10           ` Carsten Dominik
@ 2010-03-19 20:39             ` Jason Dunsmore
  0 siblings, 0 replies; 8+ messages in thread
From: Jason Dunsmore @ 2010-03-19 20:39 UTC (permalink / raw)
  To: Carsten Dominik; +Cc: Mikael Fornius, emacs-orgmode

Carsten Dominik <carsten.dominik@gmail.com> writes:

>>> A better solution would be to do a tab completion when trying to enter
>>> an invalid entry
>
> I am not sure if I understand you correctly, but there *is*
> completion support at that prompt.

What I meant was: show the possible completions whenever an incomplete
entry is entered.  Here is an example of this in Emacs:

- Type "M-x Info RET".
- The prompt shows "M-x Info-".
- Type RET again.
- A *Completions* buffer shows a list of all choices starting with
  "Info-".
- Type "M-x Info-asdf RET".
- The prompt shows "M-x Info-asdf [No match]" and continues to prompt
  the user.

This prevents invalid input.  Can something like this be used in the
org refile prompts?

Regards,
Jason

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

end of thread, other threads:[~2010-03-19 20:39 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2010-03-17  1:14 org-refile bug Jason Dunsmore
2010-03-17  9:53 ` Mikael Fornius
2010-03-17 15:31   ` Jason Dunsmore
2010-03-17 16:33     ` Mikael Fornius
2010-03-18  5:49       ` Carsten Dominik
2010-03-19  2:19         ` Jason Dunsmore
2010-03-19 13:10           ` Carsten Dominik
2010-03-19 20:39             ` Jason Dunsmore

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