From 74d1658c601edc8d25d909aac566c5c1dd0f2e38 Mon Sep 17 00:00:00 2001 From: Bastien Guerry Date: Sun, 26 Aug 2012 11:20:02 +0200 Subject: [PATCH] org-agenda.el (org-agenda-refile): Fix bug when refiling an sticky agenda entry * org-agenda.el (org-agenda-refile): Fix bug when refiling an entry from a sticky agenda. Thanks a lot to Moritz Ulrich for reporting this. --- lisp/org-agenda.el | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lisp/org-agenda.el b/lisp/org-agenda.el index 98fb9e25d..f856a28ea 100644 --- a/lisp/org-agenda.el +++ b/lisp/org-agenda.el @@ -7502,7 +7502,8 @@ If this information is not given, the function uses the tree at point." (interactive "P") (if (equal goto '(16)) (org-refile-goto-last-stored) - (let* ((marker (or (org-get-at-bol 'org-hd-marker) + (let* ((buffer-orig (buffer-name)) + (marker (or (org-get-at-bol 'org-hd-marker) (org-agenda-error))) (buffer (marker-buffer marker)) (pos (marker-position marker)) @@ -7515,7 +7516,8 @@ If this information is not given, the function uses the tree at point." (save-restriction (widen) (goto-char marker) - (org-remove-subtree-entries-from-agenda) + (let ((org-agenda-buffer-name buffer-orig)) + (org-remove-subtree-entries-from-agenda)) (org-refile goto buffer rfloc))))) (unless no-update (org-agenda-redo))))