Function: gnus-dired-find-file-mailcap

gnus-dired-find-file-mailcap is an interactive and byte-compiled function defined in gnus-dired.el.gz.

Signature

(gnus-dired-find-file-mailcap &optional FILE-NAME ARG)

Documentation

In dired, visit FILE-NAME according to the mailcap file.

If ARG is non-nil, open it in a new buffer.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/gnus-dired.el.gz
(defun gnus-dired-find-file-mailcap (&optional file-name arg)
  "In dired, visit FILE-NAME according to the mailcap file.
If ARG is non-nil, open it in a new buffer."
  (interactive (list
		(file-name-sans-versions (dired-get-filename) t)
		current-prefix-arg)
	       dired-mode)
  (mailcap-parse-mailcaps)
  (if (file-exists-p file-name)
      (let (mime-type method)
	(if (and (not arg)
		 (not (file-directory-p file-name))
		 (string-match "\\.[^\\.]+$" file-name)
		 (setq mime-type
		       (mailcap-extension-to-mime
			(match-string 0 file-name)))
		 (stringp
		  (setq method
			(cdr (assoc 'viewer
				    (car (mailcap-mime-info mime-type
							    'all
							    'no-decode)))))))
	    (let ((view-command (mm-mailcap-command method file-name nil)))
	      (message "viewing via %s" view-command)
	      (start-process "*display*"
			     nil
			     shell-file-name
			     shell-command-switch
			     view-command))
	  (find-file file-name)))
    (if (file-symlink-p file-name)
	(error "File is a symlink to a nonexistent target")
      (error (substitute-command-keys
              "File no longer exists; type \\`g' to update Dired buffer")))))