Function: auto-image-file-mode

auto-image-file-mode is an autoloaded, interactive and byte-compiled function defined in image-file.el.gz.

Signature

(auto-image-file-mode &optional ARG)

Documentation

Toggle visiting of image files as images (Auto Image File mode).

This is a minor mode. If called interactively, toggle the Auto-Image-File mode mode. If the prefix argument is positive, enable the mode, and if it is zero or negative, disable the mode.

If called from Lisp, toggle the mode if ARG is toggle. Enable the mode if ARG is nil, omitted, or is a positive number. Disable the mode if ARG is a negative number.

To check whether the minor mode is enabled in the current buffer, evaluate (default-value \=auto-image-file-mode)'.

The mode's hook is called both when the mode is enabled and when it is disabled.

An image file is one whose name has an extension in image-file-name-extensions, or matches a regexp in image-file-name-regexps.

Probably introduced at or before Emacs version 21.1.

Key Bindings

Source Code

;; Defined in /usr/src/emacs/lisp/image-file.el.gz
;;;###autoload
(define-minor-mode auto-image-file-mode
  "Toggle visiting of image files as images (Auto Image File mode).

An image file is one whose name has an extension in
`image-file-name-extensions', or matches a regexp in
`image-file-name-regexps'."
  :global t
  :group 'image
  ;; Remove existing handler
  (let ((existing-entry
	 (rassq 'image-file-handler file-name-handler-alist)))
    (when existing-entry
      (setq file-name-handler-alist
	    (delq existing-entry file-name-handler-alist))))
  ;; Add new handler, if enabled
  (when auto-image-file-mode
    (push (cons (image-file-name-regexp) 'image-file-handler)
	  file-name-handler-alist)))