diff options
| author | Richard M. Stallman | 2003-08-29 16:10:45 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2003-08-29 16:10:45 +0000 |
| commit | 55a87770f5a9fa72eb58405615b6a5dc3d078d7f (patch) | |
| tree | da245acf11d26870574efdbcf2bca23c559733a5 | |
| parent | 508f27a0e807b81a5f29a63392a2a47fc20890ad (diff) | |
| download | emacs-55a87770f5a9fa72eb58405615b6a5dc3d078d7f.tar.gz emacs-55a87770f5a9fa72eb58405615b6a5dc3d078d7f.zip | |
(dired-mouse-find-file-other-window):
Use dired-view-command-alist here, as in dired-view-file.
(dired-view-command-alist): Use %s to substitute file name.
Handle .ps_pages, .eps, .jpg, .gif, .png.
| -rw-r--r-- | lisp/dired.el | 50 |
1 files changed, 33 insertions, 17 deletions
diff --git a/lisp/dired.el b/lisp/dired.el index e01299f5eba..b4c0dda9ed2 100644 --- a/lisp/dired.el +++ b/lisp/dired.el | |||
| @@ -192,6 +192,20 @@ with the buffer narrowed to the listing." | |||
| 192 | ;; Note this can't simply be run inside function `dired-ls' as the hook | 192 | ;; Note this can't simply be run inside function `dired-ls' as the hook |
| 193 | ;; functions probably depend on the dired-subdir-alist to be OK. | 193 | ;; functions probably depend on the dired-subdir-alist to be OK. |
| 194 | 194 | ||
| 195 | (defcustom dired-view-command-alist | ||
| 196 | '(("[.]\\(ps\\|ps_pages\\|eps\\)\\'" . "gv -spartan -color -watch %s") | ||
| 197 | ("[.]pdf\\'" . "xpdf %s") | ||
| 198 | ("[.]\\(jpe?g\\|gif\\|png\\)\\'" . "eog %s") | ||
| 199 | ("[.]dvi\\'" . "xdvi -sidemargin 0.5 -topmargin 1 %s")) | ||
| 200 | "Alist specifying how to view special types of files. | ||
| 201 | Each element has the form (REGEXP . SHELL-COMMAND). | ||
| 202 | When the file name matches REGEXP, `dired-view-file' | ||
| 203 | invokes SHELL-COMMAND to view the file, processing it through `format'. | ||
| 204 | Use `%s' in SHELL-COMMAND to specify where to put the file name." | ||
| 205 | :group 'dired | ||
| 206 | :type '(alist :key-type regexp :value-type string) | ||
| 207 | :version "21.4") | ||
| 208 | |||
| 195 | ;; Internal variables | 209 | ;; Internal variables |
| 196 | 210 | ||
| 197 | (defvar dired-marker-char ?* ; the answer is 42 | 211 | (defvar dired-marker-char ?* ; the answer is 42 |
| @@ -1392,21 +1406,24 @@ Creates a buffer if necessary." | |||
| 1392 | (set-buffer (window-buffer window)) | 1406 | (set-buffer (window-buffer window)) |
| 1393 | (goto-char pos) | 1407 | (goto-char pos) |
| 1394 | (setq file (dired-get-file-for-visit))) | 1408 | (setq file (dired-get-file-for-visit))) |
| 1395 | (select-window window) | 1409 | (if (file-directory-p file) |
| 1396 | (find-file-other-window (file-name-sans-versions file t)))) | 1410 | (or (and (cdr dired-subdir-alist) |
| 1397 | 1411 | (dired-goto-subdir file)) | |
| 1398 | (defcustom dired-view-command-alist | 1412 | (progn |
| 1399 | '(("[.]ps\\'" . "gv -spartan -color -watch") | 1413 | (select-window window) |
| 1400 | ("[.]pdf\\'" . "xpdf") | 1414 | (dired-other-window file))) |
| 1401 | ("[.]dvi\\'" . "xdvi -sidemargin 0.5 -topmargin 1")) | 1415 | (let (cmd) |
| 1402 | "Alist specifying how to view special types of files. | 1416 | ;; Look for some other way to view a certain file. |
| 1403 | Each element has the form (REGEXP . SHELL-COMMAND). | 1417 | (dolist (elt dired-view-command-alist) |
| 1404 | When the file name matches REGEXP, `dired-view-file' | 1418 | (if (string-match (car elt) file) |
| 1405 | invokes SHELL-COMMAND to view the file, putting the file name | 1419 | (setq cmd (cdr elt)))) |
| 1406 | at the end of the command." | 1420 | (if cmd |
| 1407 | :group 'dired | 1421 | (call-process shell-file-name nil 0 nil |
| 1408 | :type '(alist :key-type regexp :value-type string) | 1422 | "-c" |
| 1409 | :version "21.4") | 1423 | (concat (format cmd (shell-quote-argument file)) |
| 1424 | " &")) | ||
| 1425 | (select-window window) | ||
| 1426 | (find-file-other-window (file-name-sans-versions file t))))))) | ||
| 1410 | 1427 | ||
| 1411 | (defun dired-view-file () | 1428 | (defun dired-view-file () |
| 1412 | "In Dired, examine a file in view mode, returning to dired when done. | 1429 | "In Dired, examine a file in view mode, returning to dired when done. |
| @@ -1427,8 +1444,7 @@ see `dired-view-command-alist'. Otherwise, display it in another buffer." | |||
| 1427 | (if cmd | 1444 | (if cmd |
| 1428 | (call-process shell-file-name nil 0 nil | 1445 | (call-process shell-file-name nil 0 nil |
| 1429 | "-c" | 1446 | "-c" |
| 1430 | (concat cmd " " | 1447 | (concat (format cmd (shell-quote-argument file)) |
| 1431 | (shell-quote-argument file) | ||
| 1432 | " &")) | 1448 | " &")) |
| 1433 | (view-file file)))))) | 1449 | (view-file file)))))) |
| 1434 | 1450 | ||