Browse Source

org-archive: error when buffer isn't visiting a file

* lisp/org-archive.el (org-archive-subtree): while it might be
  possible to archive an headline of a temporary buffer (i.e. not
  visiting a file), it wouldn't be really sensical.
Nicolas Goaziou 6 years ago
parent
commit
0b4b66b302
1 changed files with 3 additions and 1 deletions
  1. 3 1
      lisp/org-archive.el

+ 3 - 1
lisp/org-archive.el

@@ -207,7 +207,9 @@ 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 (buffer-base-buffer))))
+	   (file (abbreviate-file-name
+		  (or (buffer-file-name (buffer-base-buffer))
+		      (error "No file associated to buffer"))))
 	   (olpath (mapconcat 'identity (org-get-outline-path) "/"))
 	   (time (format-time-string
 		  (substring (cdr org-time-stamp-formats) 1 -1)