X-Git-Url: https://code.delx.au/gnu-emacs/blobdiff_plain/20aa42e8204f8f0139ba3880cb32ddf88acc9bf4..f2536958ec711b50a0cf8714defb921193ea8ae4:/lisp/doc-view.el diff --git a/lisp/doc-view.el b/lisp/doc-view.el index edc001455c..223565cedb 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -1,6 +1,6 @@ ;;; doc-view.el --- View PDF/PostScript/DVI files in Emacs -*- lexical-binding: t -*- -;; Copyright (C) 2007-2015 Free Software Foundation, Inc. +;; Copyright (C) 2007-2016 Free Software Foundation, Inc. ;; ;; Author: Tassilo Horn ;; Maintainer: Tassilo Horn @@ -140,6 +140,7 @@ (require 'dired) (require 'image-mode) (require 'jka-compr) +(require 'subr-x) ;;;; Customization Options @@ -625,7 +626,7 @@ at the bottom edge of the page moves to the next page." (image-bob) (image-bol 1)) (set-window-hscroll (selected-window) hscroll))) - (image-next-line 1))) + (image-next-line arg))) (defun doc-view-previous-line-or-previous-page (&optional arg) "Scroll downward by ARG lines if possible, else goto previous page. @@ -695,14 +696,19 @@ It's a subdirectory of `doc-view-cache-directory'." (setq doc-view--current-cache-dir (file-name-as-directory (expand-file-name - (concat (subst-char-in-string ?% ?_ ;; bug#13679 - (file-name-nondirectory doc-view--buffer-file-name)) - "-" - (let ((file doc-view--buffer-file-name)) - (with-temp-buffer - (set-buffer-multibyte nil) - (insert-file-contents-literally file) - (md5 (current-buffer))))) + (concat (thread-last + (file-name-nondirectory doc-view--buffer-file-name) + ;; bug#13679 + (subst-char-in-string ?% ?_) + ;; arc-mode concatenates archive name and file name + ;; with colon, which isn't allowed on MS-Windows. + (subst-char-in-string ?: ?_)) + "-" + (let ((file doc-view--buffer-file-name)) + (with-temp-buffer + (set-buffer-multibyte nil) + (insert-file-contents-literally file) + (md5 (current-buffer))))) doc-view-cache-directory))))) ;;;###autoload @@ -981,6 +987,11 @@ is named like ODF with the extension turned to pdf." (doc-view-start-process "odf->pdf" doc-view-odf->pdf-converter-program (list (concat "-env:UserInstallation=file://" + ;; The URL must be + ;; file:///C:/tmp/dir on Windows. + ;; https://wiki.documentfoundation.org/UserProfile. + (when (eq system-type 'windows-nt) + "/") tmp-user-install-dir) "--headless" "--convert-to" "pdf" "--outdir" (doc-view--current-cache-dir) odf) @@ -1714,7 +1725,8 @@ If BACKWARD is non-nil, jump to the previous match." ;; window-parameters in the window-state(s) and then restoring this ;; window-state should call us back (to interpret/use those parameters). (doc-view-goto-page page) - (when slice (apply 'doc-view-set-slice slice))))) + (when slice (apply 'doc-view-set-slice slice)) + (current-buffer)))) (add-to-list 'desktop-buffer-mode-handlers '(doc-view-mode . doc-view-restore-desktop-buffer)) @@ -1788,9 +1800,7 @@ toggle between displaying the document or editing it as text. nil t) (add-hook 'clone-indirect-buffer-hook 'doc-view-clone-buffer-hook nil t) (add-hook 'kill-buffer-hook 'doc-view-kill-proc nil t) - (when (and (boundp 'desktop-save-mode) - desktop-save-mode) - (setq-local desktop-save-buffer 'doc-view-desktop-save-buffer)) + (setq-local desktop-save-buffer 'doc-view-desktop-save-buffer) (remove-overlays (point-min) (point-max) 'doc-view t) ;Just in case. ;; Keep track of display info ([vh]scroll, page number, overlay,