From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bastien Subject: Re: bug: "Please save the buffer to a file before refiling" when the buffer is already saved" Date: Wed, 29 Jan 2014 11:21:19 +0100 Message-ID: <87d2jb142o.fsf@bzg.ath.cx> References: <877gcb6ena.fsf@bzg.ath.cx> <87wqkb4zso.fsf@bzg.ath.cx> <87iot6jt0i.fsf@bzg.ath.cx> <87k3dktrg7.fsf@bzg.ath.cx> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:37863) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W8SH0-0002VS-2y for emacs-orgmode@gnu.org; Wed, 29 Jan 2014 05:21:42 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1W8SGo-0008QE-SY for emacs-orgmode@gnu.org; Wed, 29 Jan 2014 05:21:34 -0500 Received: from mail-ea0-x22b.google.com ([2a00:1450:4013:c01::22b]:55221) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1W8SGo-0008QA-LY for emacs-orgmode@gnu.org; Wed, 29 Jan 2014 05:21:22 -0500 Received: by mail-ea0-f171.google.com with SMTP id f15so793694eak.16 for ; Wed, 29 Jan 2014 02:21:21 -0800 (PST) In-Reply-To: (Samuel Wales's message of "Tue, 28 Jan 2014 12:13:08 -0700") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Samuel Wales Cc: emacs-orgmode --=-=-= Content-Type: text/plain Hi Samuel, Samuel Wales writes: > Would this also get rid of the current-file special case? If so, this > sounds good to me and I will test it. Please test the attached patch against maint and let me know what issues it fixes for you. Thanks, --=-=-= Content-Type: text/x-diff Content-Disposition: attachment; filename=refile-fixes.patch diff --git a/lisp/org.el b/lisp/org.el index 23126b3..9a648dd 100644 --- a/lisp/org.el +++ b/lisp/org.el @@ -11308,7 +11308,7 @@ on the system \"/user@host:\"." txt (org-link-display-format (match-string 4)) txt (replace-regexp-in-string "\\( *\[[0-9]+/?[0-9]*%?\]\\)+$" "" txt) re (format org-complex-heading-regexp-format - (regexp-quote (match-string 4)))) + (regexp-quote (match-string-no-properties 4)))) (when org-refile-use-outline-path (setq txt (mapconcat 'org-protect-slash @@ -11641,6 +11641,12 @@ prefix argument (`C-u C-u C-u C-c C-w')." (bookmark-jump "org-refile-last-stored") (message "This is the location of the last refile")) +(defsubst org-refile--get-location (answ tbl) + (or (assoc answ tbl) + (assoc (concat answ "/") tbl) + (assoc answ org-refile-target-table) + (assoc (concat answ "/") org-refile-target-table))) + (defun org-refile-get-location (&optional prompt default-buffer new-nodes no-exclude) "Prompt the user for a refile location, using PROMPT. @@ -11692,10 +11698,9 @@ this is used for the GOTO interface." (concat " (default " cbnex ")"))) ": ")) pa answ parent-target child parent old-hist) (setq old-hist org-refile-history) - (setq answ (funcall cfunc prompt tbl nil (not new-nodes) + (setq answ (funcall cfunc prompt tbl nil (if new-nodes 'confirm t) nil 'org-refile-history (or cdef (car org-refile-history)))) - (setq pa (or (assoc answ tbl) (assoc (concat answ "/") tbl))) - (if pa + (if (setq pa (org-refile--get-location answ tbl)) (progn (org-refile-check-position pa) (when (or (not org-refile-history) @@ -11712,8 +11717,7 @@ this is used for the GOTO interface." (progn (setq parent (match-string 1 answ) child (match-string 2 answ)) - (setq parent-target (or (assoc parent tbl) - (assoc (concat parent "/") tbl))) + (setq parent-target (org-refile--get-location parent tbl)) (when (and parent-target (or (eq new-nodes t) (and (eq new-nodes 'confirm) --=-=-= Content-Type: text/plain -- Bastien --=-=-=--