From 414e1537ab09d2f4571e61b420523dcd082f2d3a Mon Sep 17 00:00:00 2001 From: Stephen Berman Date: Mon, 28 Jul 2014 11:07:56 +0200 Subject: Open doc text also if it's not saved to a file. * doc-view.el (doc-view-open-text): Don't require that the document is saved in a file (e.g., email attachment). --- lisp/doc-view.el | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'lisp/doc-view.el') diff --git a/lisp/doc-view.el b/lisp/doc-view.el index 5d2c897e4f9..9458cace74e 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -1396,11 +1396,12 @@ For now these keys are useful: (interactive) (if doc-view--current-converter-processes (message "DocView: please wait till conversion finished.") - (let ((txt (expand-file-name "doc.txt" (doc-view--current-cache-dir)))) + (let ((txt (expand-file-name "doc.txt" (doc-view--current-cache-dir))) + (bname (or buffer-file-name (buffer-name)))) (if (file-readable-p txt) (let ((name (concat "Text contents of " - (file-name-nondirectory buffer-file-name))) - (dir (file-name-directory buffer-file-name))) + (file-name-nondirectory bname))) + (dir (or (file-name-directory bname) default-directory))) (with-current-buffer (find-file txt) (rename-buffer name) (setq default-directory dir))) -- cgit v1.2.1