aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lisp/dired.el29
1 files changed, 26 insertions, 3 deletions
diff --git a/lisp/dired.el b/lisp/dired.el
index 75cc631c0a4..8bf10e0cef8 100644
--- a/lisp/dired.el
+++ b/lisp/dired.el
@@ -1373,17 +1373,38 @@ Creates a buffer if necessary."
1373 (select-window (posn-window (event-end event))) 1373 (select-window (posn-window (event-end event)))
1374 (find-file-other-window (file-name-sans-versions file t)))) 1374 (find-file-other-window (file-name-sans-versions file t))))
1375 1375
1376(defcustom dired-view-command-alist
1377 '(("[.]ps\\'" . "gv -spartan -color -watch")
1378 ("[.]pdf\\'" . "xpdf")
1379 ("[.]dvi\\'" . "xdvi -sidemargin 0.5 -topmargin 1"))
1380 "Alist specifying how to view special types of files.
1381Each element has the form (REGEXP . SHELL-COMMAND).
1382When the file name matches REGEXP, `dired-view-file'
1383invokes SHELL-COMMAND to view the file, putting the file name
1384at the end of the command."
1385 :group 'dired
1386 :type '(alist :key-type regexp :value-type string)
1387 :version 21.4)
1388
1376(defun dired-view-file () 1389(defun dired-view-file ()
1377 "In Dired, examine a file in view mode, returning to dired when done. 1390 "In Dired, examine a file in view mode, returning to dired when done.
1378When file is a directory, show it in this buffer if it is inserted; 1391When file is a directory, show it in this buffer if it is inserted.
1379otherwise, display it in another buffer." 1392Some kinds of files are displayed using external viewer programs;
1393see `dired-view-command-alist'. Otherwise, display it in another buffer."
1380 (interactive) 1394 (interactive)
1381 (let ((file (dired-get-file-for-visit))) 1395 (let ((file (dired-get-file-for-visit)))
1382 (if (file-directory-p file) 1396 (if (file-directory-p file)
1383 (or (and (cdr dired-subdir-alist) 1397 (or (and (cdr dired-subdir-alist)
1384 (dired-goto-subdir file)) 1398 (dired-goto-subdir file))
1385 (dired file)) 1399 (dired file))
1386 (view-file file)))) 1400 (let (cmd)
1401 ;; Look for some other way to view a certain file.
1402 (dolist (elt dired-view-command-alist)
1403 (if (string-match (car elt) file)
1404 (setq cmd (cdr elt))))
1405 (if cmd
1406 (dired-run-shell-command (concat cmd " " file))
1407 (view-file file))))))
1387 1408
1388(defun dired-find-file-other-window () 1409(defun dired-find-file-other-window ()
1389 "In Dired, visit this file or directory in another window." 1410 "In Dired, visit this file or directory in another window."
@@ -2983,6 +3004,8 @@ Use \\[dired-hide-subdir] to (un)hide a particular subdirectory."
2983If FILE is a symbolic link and the optional argument DEREF-SYMLINKS is 3004If FILE is a symbolic link and the optional argument DEREF-SYMLINKS is
2984true then the type of the file linked to by FILE is printed instead." 3005true then the type of the file linked to by FILE is printed instead."
2985 t) 3006 t)
3007
3008(autoload 'dired-run-shell-command "dired-aux")
2986 3009
2987(if (eq system-type 'vax-vms) 3010(if (eq system-type 'vax-vms)
2988 (load "dired-vms")) 3011 (load "dired-vms"))