From 414e1537ab09d2f4571e61b420523dcd082f2d3a Mon Sep 17 00:00:00 2001 From: Stephen Berman Date: Mon, 28 Jul 2014 11:07:56 +0200 Subject: [PATCH] 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/ChangeLog | 5 +++++ lisp/doc-view.el | 7 ++++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e00e58c20b5..23e66fe3158 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2014-07-28 Stephen Berman + + * doc-view.el (doc-view-open-text): Don't require that the + document is saved in a file (e.g., email attachment). + 2014-07-28 Fabián Ezequiel Gallina Parse completion input in a iPython friendly way. (Bug#18084) 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))) -- 2.39.2