From mboxrd@z Thu Jan 1 00:00:00 1970 From: Carsten Dominik Subject: Re: Re: org-refile bug Date: Fri, 19 Mar 2010 14:10:43 +0100 Message-ID: <48B23393-1D52-44CD-B467-B56AF03CF8DE@gmail.com> References: <87634v3g29.fsf@riotblast.dunsmor.com> <878w9rcm0f.fsf@eee.lan> <87ocin0xsl.fsf@riotblast.dunsmor.com> <87fx3yc3hr.fsf@eee.lan> <87y6hpkq7o.fsf@riotblast.dunsmor.com> Mime-Version: 1.0 (Apple Message framework v936) Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NscoQ-0003Au-NP for emacs-orgmode@gnu.org; Fri, 19 Mar 2010 10:04:30 -0400 Received: from [140.186.70.92] (port=52475 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NscoI-0002sv-TJ for emacs-orgmode@gnu.org; Fri, 19 Mar 2010 10:04:29 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nscbe-0002m5-9d for emacs-orgmode@gnu.org; Fri, 19 Mar 2010 09:51:20 -0400 Received: from fg-out-1718.google.com ([72.14.220.157]:44945) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nscbc-0002l0-OV for emacs-orgmode@gnu.org; Fri, 19 Mar 2010 09:51:18 -0400 Received: by fg-out-1718.google.com with SMTP id d23so207125fga.12 for ; Fri, 19 Mar 2010 06:51:14 -0700 (PDT) In-Reply-To: <87y6hpkq7o.fsf@riotblast.dunsmor.com> 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: Jason Dunsmore Cc: Mikael Fornius , emacs-orgmode@gnu.org 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 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