Index: lisp/doc-view.el =================================================================== RCS file: /sources/emacs/emacs/lisp/doc-view.el,v retrieving revision 1.4 diff -u -r1.4 doc-view.el --- lisp/doc-view.el 3 Oct 2007 23:39:58 -0000 1.4 +++ lisp/doc-view.el 6 Oct 2007 14:14:39 -0000 @@ -5,7 +5,7 @@ ;; Author: Tassilo Horn ;; Maintainer: Tassilo Horn ;; Keywords: files, pdf, ps, dvi -;; Version: <2007-10-02 Tue 18:21> +;; Version: <2007-10-06 Sat 16:14> ;; This file is part of GNU Emacs. @@ -67,8 +67,6 @@ ;; bottom-right corner of the desired slice. To reset the slice use ;; `doc-view-reset-slice' (bound to `s r'). ;; -;; Dired users should have a look at `doc-view-dired'. -;; ;; You can also search within the document. The command `doc-view-search' ;; (bound to `C-s') queries for a search regexp and initializes a list of all ;; matching pages and messages how many match-pages were found. After that you @@ -80,6 +78,10 @@ ;; conversion. When that finishes and you're still viewing the document ;; (i.e. you didn't switch to another buffer) you're queried for the regexp ;; then. +;; +;; Dired users can simply hit `v' on a document file. If it's a PS, PDF or DVI +;; file you're asked to open it with `doc-view' instead of `view-file'. +;; ;;; Configuration: @@ -332,8 +334,7 @@ (defun doc-view-file-name-to-directory-name (file) "Return the directory where the png files of FILE should be saved. - -It'a a subdirectory of `doc-view-cache-directory'." +It's a subdirectory of `doc-view-cache-directory'." (if doc-view-current-cache-dir doc-view-current-cache-dir (file-name-as-directory @@ -735,16 +736,6 @@ (message "DocView: using cached files!") (doc-view-display doc-view-current-doc))))) -(defun doc-view-dired (no-cache) - "View the current dired file with doc-view. -NO-CACHE is the same as in `doc-view'. - -You might want to bind this command to a dired key, e.g. - - (define-key dired-mode-map (kbd \"C-c d\") 'doc-view-dired)" - (interactive "P") - (doc-view no-cache (dired-get-file-for-visit))) - (defun doc-view-clear-cache () "Delete the whole cache (`doc-view-cache-directory')." (interactive) Index: lisp/dired.el =================================================================== RCS file: /sources/emacs/emacs/lisp/dired.el,v retrieving revision 1.369 diff -u -r1.369 dired.el --- lisp/dired.el 25 Sep 2007 10:45:04 -0000 1.369 +++ lisp/dired.el 6 Oct 2007 14:14:42 -0000 @@ -1771,15 +1771,20 @@ (defun dired-view-file () "In Dired, examine a file in view mode, returning to Dired when done. -When file is a directory, show it in this buffer if it is inserted. -Otherwise, display it in another buffer." +When file is a directory, show it in this buffer if it is +inserted. Otherwise, display it in another buffer." (interactive) (let ((file (dired-get-file-for-visit))) (if (file-directory-p file) (or (and (cdr dired-subdir-alist) (dired-goto-subdir file)) (dired file)) - (view-file file)))) + ;; for pdf, ps and dvi files doc-view is an appropriate viewer + (if (and (featurep 'doc-view) + (string-match "\\.\\(pdf\\|ps\\|dvi\\)$" file) + (y-or-n-p "Open the file with `doc-view' instead of `view-file'? ")) + (doc-view (y-or-n-p "Use cached PNG files if possible? ") file) + (view-file file))))) (defun dired-find-file-other-window () "In Dired, visit this file or directory in another window." Index: lisp/ChangeLog =================================================================== RCS file: /sources/emacs/emacs/lisp/ChangeLog,v retrieving revision 1.11865 diff -u -r1.11865 ChangeLog --- lisp/ChangeLog 6 Oct 2007 12:00:40 -0000 1.11865 +++ lisp/ChangeLog 6 Oct 2007 14:14:48 -0000 @@ -1,3 +1,10 @@ +2007-10-06 Tassilo Horn + + * dired.el (dired-view-file): Ask to use doc-view if file is a + pdf/dvi/ps file and doc-view was required by the user. + + * doc-view.el (doc-view-dired): Delete function. + 2007-10-06 Michael Albinus * net/tramp.el (top): Move loading of tramp-util.el and