Mercurial > emacs
changeset 106467:0314d1c68b88
Make it work for non-file buffers (bug#5102).
* doc-view.el (doc-view-current-cache-dir):
Use doc-view-buffer-file-name rather than buffer-file-name.
(doc-view-mode): Use buffer-name when buffer-file-name is nil.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Mon, 07 Dec 2009 02:37:42 +0000 |
parents | 5b7b3cac58c5 |
children | 838914b06ad0 |
files | lisp/ChangeLog lisp/doc-view.el |
diffstat | 2 files changed, 17 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/ChangeLog Sun Dec 06 23:27:55 2009 +0000 +++ b/lisp/ChangeLog Mon Dec 07 02:37:42 2009 +0000 @@ -1,3 +1,10 @@ +2009-12-07 Stefan Monnier <monnier@iro.umontreal.ca> + + Make it work for non-file buffers (bug#5102). + * doc-view.el (doc-view-current-cache-dir): + Use doc-view-buffer-file-name rather than buffer-file-name. + (doc-view-mode): Use buffer-name when buffer-file-name is nil. + 2009-12-06 Óscar Fuentes <ofv@wanadoo.es> * vc-bzr.el (vc-bzr-annotate-command): Handle the case where the @@ -5,8 +12,8 @@ 2009-12-06 Dan Nicolaescu <dann@ics.uci.edu> - * vc-git.el (vc-git-print-log): Handle a limit argument. Display - the short log in graph form and with labels. + * vc-git.el (vc-git-print-log): Handle a limit argument. + Display the short log in graph form and with labels. (vc-git-log-view-mode): Handle labels. Make vc-revert change VC state from 'added to 'unregistered.
--- a/lisp/doc-view.el Sun Dec 06 23:27:55 2009 +0000 +++ b/lisp/doc-view.el Mon Dec 07 02:37:42 2009 +0000 @@ -563,7 +563,7 @@ (setq doc-view-current-cache-dir (file-name-as-directory (expand-file-name - (concat (file-name-nondirectory buffer-file-name) + (concat (file-name-nondirectory doc-view-buffer-file-name) "-" (let ((file doc-view-buffer-file-name)) (with-temp-buffer @@ -1228,6 +1228,7 @@ (set (make-local-variable 'doc-view-buffer-file-name) (cond (jka-compr-really-do-compress + ;; FIXME: there's a risk of name conflicts here. (expand-file-name (file-name-nondirectory (file-name-sans-extension buffer-file-name)) @@ -1237,10 +1238,13 @@ ;; supposed to return nil for things like local files accessed via ;; `su' or via file://... ((let ((file-name-handler-alist nil)) - (not (file-readable-p buffer-file-name))) + (not (and buffer-file-name (file-readable-p buffer-file-name)))) + ;; FIXME: there's a risk of name conflicts here. (expand-file-name - (file-name-nondirectory buffer-file-name) - doc-view-cache-directory)) + (if buffer-file-name + (file-name-nondirectory buffer-file-name) + (buffer-name)) + doc-view-cache-directory)) (t buffer-file-name))) (when (not (string= doc-view-buffer-file-name buffer-file-name)) (write-region nil nil doc-view-buffer-file-name))