From: Bastien <bzg@gnu.org>
To: Samuel Wales <samologist@gmail.com>
Cc: emacs-orgmode <emacs-orgmode@gnu.org>
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 [thread overview]
Message-ID: <87d2jb142o.fsf@bzg.ath.cx> (raw)
In-Reply-To: <CAJcAo8ttt0vDfLmRCXD2B1D12WoOnny7yrvWD8cMfb2JcggRTg@mail.gmail.com> (Samuel Wales's message of "Tue, 28 Jan 2014 12:13:08 -0700")
[-- Attachment #1: Type: text/plain, Size: 272 bytes --]
Hi Samuel,
Samuel Wales <samologist@gmail.com> 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,
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: refile-fixes.patch --]
[-- Type: text/x-diff, Size: 2104 bytes --]
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)
[-- Attachment #3: Type: text/plain, Size: 14 bytes --]
--
Bastien
next prev parent reply other threads:[~2014-01-29 10:21 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-13 19:42 bug: "Please save the buffer to a file before refiling" when the buffer is already saved" Samuel Wales
2013-11-13 23:55 ` Bastien
2013-11-13 23:59 ` Samuel Wales
2013-11-14 0:01 ` Bastien
2013-11-14 0:05 ` Samuel Wales
2014-01-25 21:57 ` Samuel Wales
2014-01-25 21:59 ` Samuel Wales
2014-01-26 22:08 ` Bastien
2014-01-27 2:16 ` Samuel Wales
2014-01-28 8:56 ` Bastien
2014-01-28 19:13 ` Samuel Wales
2014-01-29 10:21 ` Bastien [this message]
2014-01-29 22:02 ` Samuel Wales
2014-01-29 23:49 ` Bastien
2014-01-30 1:13 ` Samuel Wales
2014-01-30 6:52 ` Bastien
2014-02-05 21:22 ` Samuel Wales
2014-02-05 23:37 ` Bastien
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=87d2jb142o.fsf@bzg.ath.cx \
--to=bzg@gnu.org \
--cc=emacs-orgmode@gnu.org \
--cc=samologist@gmail.com \
/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).