Variable: filesets-external-viewers

filesets-external-viewers is a customizable variable defined in filesets.el.gz.

Value

((".\\..?html?\\'" browse-url
  ((:ignore-on-open-all t)))
 (".\\.pdf\\'" "xpdf"
  ((:ignore-on-open-all t)
   (:ignore-on-read-text t)))
 (".\\.e?ps\\(?:\\.gz\\)?\\'" "ggv"
  ((:ignore-on-open-all t)
   (:ignore-on-read-text t)))
 (".\\.dvi\\'" "xdvi"
  ((:ignore-on-open-all t)
   (:ignore-on-read-text t)))
 (".\\.doc\\'" "antiword"
  ((:capture-output t)
   (:ignore-on-read-text t)))
 (".\\.\\(tiff\\|xpm\\|gif\\|pgn\\)\\'" "gqview"
  ((:ignore-on-open-all t)
   (:ignore-on-read-text t))))

Documentation

Alist of file patterns and external viewers.

This is intended for use with filesets-find-or-display-file.

Has the form ((FILE-PATTERN VIEWER PROPERTIES) ...), VIEWER being either a function or a command name as string.

Properties is an association list determining filesets' behavior in several conditions. Choose one from this list:

:ignore-on-open-all ... Don't open files of this type automatically --
i.e. on open-all-files-events or when running commands

:capture-output ... capture an external viewer output

:constraintp FUNCTION ... use this viewer only if FUNCTION returns non-nil

:open-hook FUNCTIONs ... run FUNCTIONs after spawning the viewer -- mainly
useful in conjunction with :capture-output

:args (FORMAT-STRING or SYMBOL or FUNCTION) ... a list of arguments
(defaults to (list "%S")) when using shell commands

Avoid modifying this variable and achieve minor speed-ups by setting the variables my-ps-viewer, my-pdf-viewer, my-dvi-viewer, my-pic-viewer.

In order to view pdf or rtf files in an Emacs buffer, you could use these:


      ("^.+\\\\.pdf\\\\\\='" "pdftotext"
       ((:capture-output t)
(:args ("%S - | fmt -w " window-width))
(:ignore-on-read-text t)
(:constraintp (lambda ()
(and (filesets-which-command-p "pdftotext")
(filesets-which-command-p "fmt"))))))
      ("^.+\\\\.rtf\\\\\\='" "rtf2htm"
       ((:capture-output t)
(:args ("%S 2> /dev/null | w3m -dump -T text/html"))
(:ignore-on-read-text t)
(:constraintp (lambda ()
(and (filesets-which-command-p "rtf2htm")
(filesets-which-command-p "w3m"))))))

Source Code

;; Defined in /usr/src/emacs/lisp/filesets.el.gz
(defcustom filesets-external-viewers
  (let
      ;; ((ps-cmd  (or (and (boundp 'my-ps-viewer) my-ps-viewer)
      ;;            (filesets-select-command "ggv gv")))
      ;;  (pdf-cmd (or (and (boundp 'my-ps-viewer) my-pdf-viewer)
      ;;            (filesets-select-command "xpdf acroread")))
      ;;  (dvi-cmd (or (and (boundp 'my-ps-viewer) my-dvi-viewer)
      ;;            (filesets-select-command "xdvi tkdvi")))
      ;;  (doc-cmd (or (and (boundp 'my-ps-viewer) my-doc-viewer)
      ;;            (filesets-select-command "antiword")))
      ;;  (pic-cmd (or (and (boundp 'my-ps-viewer) my-pic-viewer)
      ;;            (filesets-select-command "gqview ee display"))))
      ((ps-cmd  "ggv")
       (pdf-cmd "xpdf")
       (dvi-cmd "xdvi")
       (doc-cmd "antiword")
       (pic-cmd "gqview"))
    `((".\\..?html?\\'" browse-url
       ((:ignore-on-open-all t)))
      (".\\.pdf\\'" ,pdf-cmd
       ((:ignore-on-open-all t)
	(:ignore-on-read-text t)
	;; (:constraintp ,pdf-cmd)
	))
      (".\\.e?ps\\(?:\\.gz\\)?\\'" ,ps-cmd
       ((:ignore-on-open-all t)
	(:ignore-on-read-text t)
	;; (:constraintp ,ps-cmd)
	))
      (".\\.dvi\\'" ,dvi-cmd
       ((:ignore-on-open-all t)
	(:ignore-on-read-text t)
	;; (:constraintp ,dvi-cmd)
	))
      (".\\.doc\\'" ,doc-cmd
       ((:capture-output t)
	(:ignore-on-read-text t)
	;; (:constraintp ,doc-cmd)
	))
      (".\\.\\(tiff\\|xpm\\|gif\\|pgn\\)\\'" ,pic-cmd
       ((:ignore-on-open-all t)
	(:ignore-on-read-text t)
	;; (:constraintp ,pic-cmd)
	))))
  "Alist of file patterns and external viewers.
This is intended for use with `filesets-find-or-display-file'.

Has the form ((FILE-PATTERN VIEWER PROPERTIES) ...), VIEWER being either a
function or a command name as string.

Properties is an association list determining filesets' behavior in
several conditions.  Choose one from this list:

:ignore-on-open-all ... Don't open files of this type automatically --
i.e. on open-all-files-events or when running commands

:capture-output ... capture an external viewer output

:constraintp FUNCTION ... use this viewer only if FUNCTION returns non-nil

:open-hook FUNCTIONs ... run FUNCTIONs after spawning the viewer -- mainly
useful in conjunction with :capture-output

:args (FORMAT-STRING or SYMBOL or FUNCTION) ... a list of arguments
\(defaults to (list \"%S\")) when using shell commands

Avoid modifying this variable and achieve minor speed-ups by setting the
variables my-ps-viewer, my-pdf-viewer, my-dvi-viewer, my-pic-viewer.

In order to view pdf or rtf files in an Emacs buffer, you could use these:


      (\"^.+\\\\.pdf\\\\\\='\" \"pdftotext\"
       ((:capture-output t)
	(:args (\"%S - | fmt -w \" window-width))
	(:ignore-on-read-text t)
	(:constraintp (lambda ()
			(and (filesets-which-command-p \"pdftotext\")
			     (filesets-which-command-p \"fmt\"))))))
      (\"^.+\\\\.rtf\\\\\\='\" \"rtf2htm\"
       ((:capture-output t)
	(:args (\"%S 2> /dev/null | w3m -dump -T text/html\"))
	(:ignore-on-read-text t)
	(:constraintp (lambda ()
			(and (filesets-which-command-p \"rtf2htm\")
			     (filesets-which-command-p \"w3m\"))))))"
  :set #'filesets-set-default
  :risky t
  :type '(repeat :tag "Viewer"
		 (list :tag "Definition"
		       :value ("^.+\\.suffix$" "")
		       (regexp :tag "Pattern")
		       (choice :tag "Viewer"
			       (symbol :tag "Function" :value nil)
			       (string :tag "Program" :value ""))
		       (repeat :tag "Properties"
			       (choice
				(list :tag ":constraintp"
				      :value (:constraintp)
				      (const :format ""
					     :value :constraintp)
				      (function :tag "Function"))
				(list :tag ":constraint-flag (obsolete)"
				      :value (:constraint-flag)
				      (const :format ""
					     :value :constraint-flag)
				      (sexp :tag "Symbol"))
				(list :tag ":ignore-on-open-all"
				      :value (:ignore-on-open-all t)
				      (const  :format ""
					      :value :ignore-on-open-all)
				      (boolean :tag "Boolean"))
				(list :tag ":ignore-on-read-text"
				      :value (:ignore-on-read-text t)
				      (const  :format ""
					      :value :ignore-on-read-text)
				      (boolean :tag "Boolean"))
				(list :tag ":args"
				      :value (:args)
				      (const :format ""
					     :value :args)
				      (repeat :tag "List"
					      (choice :tag "Arguments"
						      (string :tag "String"
							      :value "")
						      (symbol :tag "Symbol"
							      :value nil)
						      (function :tag "Function"
								:value nil))))
				(list :tag ":open-hook"
				      :value (:open-hook)
				      (const :format ""
					     :value :open-hook)
				      (hook :tag "Hook"))
;				(list :tag ":close-hook"
;				      :value (:close-hook)
;				      (const :format ""
;					     :value :close-hook)
;				      (hook :tag "Hook"))
				(list :tag ":capture-output"
				      :value (:capture-output t)
				      (const  :format ""
					      :value :capture-output)
				      (boolean :tag "Boolean")))))))