diff options
author | Jordan Wilson <jordan.t.wilson@gmx.com> | 2018-10-10 11:45:57 +0100 |
---|---|---|
committer | Eli Zaretskii <eliz@gnu.org> | 2018-11-03 10:30:33 +0200 |
commit | 88ef31abd4716fad14889b08686d42ebbb7dc6c0 (patch) | |
tree | 13ff61c3c19e8893a1beb0d218886f188f3d105a | |
parent | c9390423d609969193de1ea3228e259e22451719 (diff) | |
download | emacs-88ef31abd4716fad14889b08686d42ebbb7dc6c0.tar.gz |
Avoid file-name errors when viewing PDF from Gnus
* lisp/doc-view.el (doc-view-mode): Run the output file name
through 'convert-standard-filename', to avoid problems with
characters that are not allowed in file names on some
systems. (Bug#32989)
Copyright-paperwork-exempt: yes
-rw-r--r-- | lisp/doc-view.el | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/lisp/doc-view.el b/lisp/doc-view.el index 4a4862f8280..6ad47fc792d 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -1772,27 +1772,28 @@ toggle between displaying the document or editing it as text. (doc-view-make-safe-dir doc-view-cache-directory) ;; Handle compressed files, remote files, files inside archives (setq-local 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)) - doc-view-cache-directory)) - ;; Is the file readable by local processes? - ;; We used to use `file-remote-p' but it's unclear what it's - ;; supposed to return nil for things like local files accessed - ;; via `su' or via file://... - ((let ((file-name-handler-alist nil)) - (not (and buffer-file-name - (file-readable-p buffer-file-name)))) - ;; FIXME: there's a risk of name conflicts here. - (expand-file-name - (if buffer-file-name - (file-name-nondirectory buffer-file-name) - (buffer-name)) - doc-view-cache-directory)) - (t buffer-file-name))) + (convert-standard-filename + (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)) + doc-view-cache-directory)) + ;; Is the file readable by local processes? + ;; We used to use `file-remote-p' but it's unclear what it's + ;; supposed to return nil for things like local files accessed + ;; via `su' or via file://... + ((let ((file-name-handler-alist nil)) + (not (and buffer-file-name + (file-readable-p buffer-file-name)))) + ;; FIXME: there's a risk of name conflicts here. + (expand-file-name + (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)) |