emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: Jason Dunsmore <jason.public@gmail.com>
To: Carsten Dominik <carsten.dominik@gmail.com>
Cc: Mikael Fornius <mfo@abc.se>, emacs-orgmode@gnu.org
Subject: Re: Re: org-refile bug
Date: Thu, 18 Mar 2010 21:19:55 -0500	[thread overview]
Message-ID: <87y6hpkq7o.fsf@riotblast.dunsmor.com> (raw)
In-Reply-To: <D28D5181-6058-461B-A716-FD9CAABB024E@gmail.com> (Carsten Dominik's message of "Thu, 18 Mar 2010 06:49:36 +0100")

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

  reply	other threads:[~2010-03-19  2:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2010-03-19 13:10           ` Carsten Dominik
2010-03-19 20:39             ` Jason Dunsmore

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87y6hpkq7o.fsf@riotblast.dunsmor.com \
    --to=jason.public@gmail.com \
    --cc=carsten.dominik@gmail.com \
    --cc=emacs-orgmode@gnu.org \
    --cc=mfo@abc.se \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).