Browse Source

Fix bug with archiving to a subdirectory.

Reported by Wanrong Lin.
Carsten Dominik 17 years ago
parent
commit
9703398065
1 changed files with 6 additions and 1 deletions
  1. 6 1
      lisp/org-archive.el

+ 6 - 1
lisp/org-archive.el

@@ -135,14 +135,19 @@ archive file is."
     files))
 
 (defun org-extract-archive-file (&optional location)
+  "Extract and expand the file name from archive LOCATION.
+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)
 	(expand-file-name
-	 (format (match-string 1 location) buffer-file-name)))))
+	 (format (match-string 1 location)
+		 (file-name-nondirectory buffer-file-name))))))
 
 (defun org-extract-archive-heading (&optional location)
+  "Extract the heading from archive LOCATION.
+if LOCATION is not given, the value of `org-archive-location' is used."
   (setq location (or location org-archive-location))
   (if (string-match "\\(.*\\)::\\(.*\\)" location)
       (match-string 2 location)))