diff options
Diffstat (limited to 'lisp/doc-view.el')
-rw-r--r-- | lisp/doc-view.el | 43 |
1 files changed, 19 insertions, 24 deletions
diff --git a/lisp/doc-view.el b/lisp/doc-view.el index c67205fd52b..7bead624cc7 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -1,4 +1,5 @@ -;;; doc-view.el --- View PDF/PostScript/DVI files in Emacs +;;; doc-view.el --- View PDF/PostScript/DVI files in Emacs -*- lexical-binding: t -*- + ;; Copyright (C) 2007-2011 Free Software Foundation, Inc. ;; @@ -155,7 +156,7 @@ (defcustom doc-view-ghostscript-options '("-dSAFER" ;; Avoid security problems when rendering files from untrusted - ;; sources. + ;; sources. "-dNOPAUSE" "-sDEVICE=png16m" "-dTextAlphaBits=4" "-dBATCH" "-dGraphicsAlphaBits=4" "-dQUIET") "A list of options to give to ghostscript." @@ -442,9 +443,7 @@ Can be `dvi', `pdf', or `ps'.") doc-view-current-converter-processes) ;; The PNG file hasn't been generated yet. (doc-view-pdf->png-1 doc-view-buffer-file-name file page - (lexical-let ((page page) - (win (selected-window)) - (file file)) + (let ((win (selected-window))) (lambda () (and (eq (current-buffer) (window-buffer win)) ;; If we changed page in the mean @@ -453,7 +452,7 @@ Can be `dvi', `pdf', or `ps'.") ;; Make sure we don't infloop. (file-readable-p file) (with-selected-window win - (doc-view-goto-page page)))))))) + (doc-view-goto-page page)))))))) (overlay-put (doc-view-current-overlay) 'help-echo (doc-view-current-info)))) @@ -713,8 +712,8 @@ Should be invoked when the cached images aren't up-to-date." (if (and doc-view-dvipdf-program (executable-find doc-view-dvipdf-program)) (doc-view-start-process "dvi->pdf" doc-view-dvipdf-program - (list dvi pdf) - callback) + (list dvi pdf) + callback) (doc-view-start-process "dvi->pdf" doc-view-dvipdfm-program (list "-o" pdf dvi) callback))) @@ -735,7 +734,7 @@ is named like ODF with the extension turned to pdf." (list (format "-r%d" (round doc-view-resolution)) (concat "-sOutputFile=" png) pdf-ps)) - (lexical-let ((resolution doc-view-resolution)) + (let ((resolution doc-view-resolution)) (lambda () ;; Only create the resolution file when it's all done, so it also ;; serves as a witness that the conversion is complete. @@ -780,7 +779,7 @@ Start by converting PAGES, and then the rest." ;; (almost) consecutive, but since in 99% of the cases, there'll be only ;; a single page anyway, and of the remaining 1%, few cases will have ;; consecutive pages, it's not worth the trouble. - (lexical-let ((pdf pdf) (png png) (rest (cdr pages))) + (let ((rest (cdr pages))) (doc-view-pdf->png-1 pdf (format png (car pages)) (car pages) (lambda () @@ -793,8 +792,8 @@ Start by converting PAGES, and then the rest." ;; not sufficient. (dolist (win (get-buffer-window-list (current-buffer) nil 'visible)) (with-selected-window win - (when (stringp (get-char-property (point-min) 'display)) - (doc-view-goto-page (doc-view-current-page))))) + (when (stringp (get-char-property (point-min) 'display)) + (doc-view-goto-page (doc-view-current-page))))) ;; Convert the rest of the pages. (doc-view-pdf/ps->png pdf png))))))) @@ -816,10 +815,8 @@ Start by converting PAGES, and then the rest." (ps ;; Doc is a PS, so convert it to PDF (which will be converted to ;; TXT thereafter). - (lexical-let ((pdf (expand-file-name "doc.pdf" - (doc-view-current-cache-dir))) - (txt txt) - (callback callback)) + (let ((pdf (expand-file-name "doc.pdf" + (doc-view-current-cache-dir)))) (doc-view-ps->pdf doc-view-buffer-file-name pdf (lambda () (doc-view-pdf->txt pdf txt callback))))) (dvi @@ -873,9 +870,7 @@ Those files are saved in the directory given by the function (dvi ;; DVI files have to be converted to PDF before Ghostscript can process ;; it. - (lexical-let - ((pdf (expand-file-name "doc.pdf" doc-view-current-cache-dir)) - (png-file png-file)) + (let ((pdf (expand-file-name "doc.pdf" doc-view-current-cache-dir))) (doc-view-dvi->pdf doc-view-buffer-file-name pdf (lambda () (doc-view-pdf/ps->png pdf png-file))))) (odf @@ -1026,8 +1021,8 @@ have the page we want to view." (and (not (member pagefile prev-pages)) (member pagefile doc-view-current-files))) (with-selected-window win - (assert (eq (current-buffer) buffer)) - (doc-view-goto-page page)))))))) + (assert (eq (current-buffer) buffer)) + (doc-view-goto-page page)))))))) (defun doc-view-buffer-message () ;; Only show this message initially, not when refreshing the buffer (in which @@ -1470,9 +1465,9 @@ See the command `doc-view-mode' for more information on this mode." (when (not (eq major-mode 'doc-view-mode)) (doc-view-toggle-display)) (with-selected-window - (or (get-buffer-window (current-buffer) 0) - (selected-window)) - (doc-view-goto-page page))))) + (or (get-buffer-window (current-buffer) 0) + (selected-window)) + (doc-view-goto-page page))))) (provide 'doc-view) |