summaryrefslogtreecommitdiff
path: root/lisp/doc-view.el
diff options
context:
space:
mode:
authorStephen Berman <stephen.berman@gmx.net>2014-07-28 11:07:56 +0200
committerTassilo Horn <tsdh@gnu.org>2014-07-28 11:07:56 +0200
commit414e1537ab09d2f4571e61b420523dcd082f2d3a (patch)
tree946f64e761a3001be5356cdd89c8f92080faa34f /lisp/doc-view.el
parent34c6b847fbad20b026ee878f6c3b97ab481f6a92 (diff)
downloademacs-414e1537ab09d2f4571e61b420523dcd082f2d3a.tar.gz
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).
Diffstat (limited to 'lisp/doc-view.el')
-rw-r--r--lisp/doc-view.el7
1 files changed, 4 insertions, 3 deletions
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)))