[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Orgmode] Re: org-refile bug
From: |
Jason Dunsmore |
Subject: |
Re: [Orgmode] Re: org-refile bug |
Date: |
Thu, 18 Mar 2010 21:19:55 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.1.91 (gnu/linux) |
Carsten Dominik <address@hidden> 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