From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jason Dunsmore Subject: Re: Re: org-refile bug Date: Thu, 18 Mar 2010 21:19:55 -0500 Message-ID: <87y6hpkq7o.fsf@riotblast.dunsmor.com> References: <87634v3g29.fsf@riotblast.dunsmor.com> <878w9rcm0f.fsf@eee.lan> <87ocin0xsl.fsf@riotblast.dunsmor.com> <87fx3yc3hr.fsf@eee.lan> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NsRol-0002g8-Ih for emacs-orgmode@gnu.org; Thu, 18 Mar 2010 22:20:07 -0400 Received: from [140.186.70.92] (port=35938 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NsRoh-0002YV-4u for emacs-orgmode@gnu.org; Thu, 18 Mar 2010 22:20:06 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1NsRob-0007Hd-7k for emacs-orgmode@gnu.org; Thu, 18 Mar 2010 22:20:03 -0400 Received: from deathroller.dunsmor.com ([98.129.169.48]:45403) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1NsRoa-0007HS-Sh for emacs-orgmode@gnu.org; Thu, 18 Mar 2010 22:19:57 -0400 In-Reply-To: (Carsten Dominik's message of "Thu, 18 Mar 2010 06:49:36 +0100") 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: Carsten Dominik Cc: Mikael Fornius , emacs-orgmode@gnu.org Carsten Dominik 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