From: Liu Hui <liuhui1610@gmail.com>
To: emacs-orgmode@gnu.org
Subject: Problem of refile in the org capture buffer
Date: Mon, 6 Feb 2017 20:08:14 +0800 [thread overview]
Message-ID: <d1d7712f-1f82-602f-fa37-45eea1b10173@gmail.com> (raw)
Hello,
I find C-c C-w (refine) in the org capture buffer doesn't work correctly
when there are empty lines (containing the point) in the end of buffer.
Steps to reproduce:
1. echo -e "* A\n* B" > /tmp/test.org; cat /tmp/test.org
* A
* B
2. Emacs -Q, and evaluate the code:
(setq org-capture-templates
'(("t" "Todo" entry (file+headline "/tmp/test.org" "A")
"** test1 %?")))
3. M-x org-capture, and press t to open the org capture buffer
4. In the capture buffer, press C-j to insert a newline, then C-c C-w:
=> the subtree "B" will be refiled rather than the "test1".
The problem is caused by org-capture-finalize, which deletes empty lines
and, as a result, makes the point saved by org-capture-refile invalid.
The following patch should fix the problem:
diff --git a/lisp/org-capture.el b/lisp/org-capture.el
index 1a1a500..27cb60b 100644
--- a/lisp/org-capture.el
+++ b/lisp/org-capture.el
@@ -827,6 +827,9 @@ already gone. Any prefix argument will be passed to
the refile command."
(base (buffer-base-buffer (current-buffer)))
(org-capture-is-refiling t)
(kill-buffer (org-capture-get :kill-buffer 'local)))
+ (and (< (skip-chars-backward " \t\n") 0)
+ (not (bobp))
+ (setq pos (point)))
(org-capture-put :kill-buffer nil)
(org-capture-finalize)
(save-window-excursion
Emacs : GNU Emacs 26.0.50.2 (x86_64-pc-linux-gnu, GTK+ Version 3.18.9)
of 2016-12-17
Package: Org mode version 9.0.4 (release_9.0.4-283-g2064b0 @
~/org-mode/lisp/)
next reply other threads:[~2017-02-06 12:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-06 12:08 Liu Hui [this message]
2017-02-19 14:40 ` Problem of refile in the org capture buffer Nicolas Goaziou
-- strict thread matches above, loose matches on Subject: below --
2017-02-08 7:42 Liu Hui
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
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=d1d7712f-1f82-602f-fa37-45eea1b10173@gmail.com \
--to=liuhui1610@gmail.com \
--cc=emacs-orgmode@gnu.org \
/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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.