diff options
author | Nicolas Goaziou <n.goaziou@gmail.com> | 2011-07-21 00:23:23 +0200 |
---|---|---|
committer | Nicolas Goaziou <n.goaziou@gmail.com> | 2011-07-21 00:23:23 +0200 |
commit | 26ba1b368018786b25dfc2fe2de414556ca16e58 (patch) | |
tree | aca0c34506914f5d682839ade84d43971bbb9c80 | |
parent | fe0c013965bc5a15309cec2e4ab4ad78689bc4af (diff) | |
download | org-mode-26ba1b368018786b25dfc2fe2de414556ca16e58.tar.gz |
org-archive: fix archiving from an indirect buffer
* lisp/org-archive.el (org-extract-archive-file,
org-extract-archive-heading, org-archive-subtree): buffer-file-name
is nil in an indirect buffer. Thus,
use (buffer-file-name (buffer-base-buffer)), which will, in any
case, return the file-name.
Thanks to Ilya Shlyakhter for reporting and analyzing this.
-rw-r--r-- | lisp/org-archive.el | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lisp/org-archive.el b/lisp/org-archive.el index b506449..c08761b 100644 --- a/lisp/org-archive.el +++ b/lisp/org-archive.el @@ -165,10 +165,11 @@ if LOCATION is not given, the value of `org-archive-location' is used." (setq location (or location org-archive-location)) (if (string-match "\\(.*\\)::\\(.*\\)" location) (if (= (match-beginning 1) (match-end 1)) - (buffer-file-name) + (buffer-file-name (buffer-base-buffer)) (expand-file-name (format (match-string 1 location) - (file-name-nondirectory buffer-file-name)))))) + (file-name-nondirectory + (buffer-file-name (buffer-base-buffer)))))))) (defun org-extract-archive-heading (&optional location) "Extract the heading from archive LOCATION. @@ -176,7 +177,8 @@ if LOCATION is not given, the value of `org-archive-location' is used." (setq location (or location org-archive-location)) (if (string-match "\\(.*\\)::\\(.*\\)" location) (format (match-string 2 location) - (file-name-nondirectory buffer-file-name)))) + (file-name-nondirectory + (buffer-file-name (buffer-base-buffer)))))) (defun org-archive-subtree (&optional find-done) "Move the current subtree to the archive. @@ -205,7 +207,7 @@ this heading." (this-buffer (current-buffer)) ;; start of variables that will be used for saving context ;; The compiler complains about them - keep them anyway! - (file (abbreviate-file-name (buffer-file-name))) + (file (abbreviate-file-name (buffer-file-name (buffer-base-buffer)))) (olpath (mapconcat 'identity (org-get-outline-path) "/")) (time (format-time-string (substring (cdr org-time-stamp-formats) 1 -1) |