Function: iimage-mode-buffer

iimage-mode-buffer is a byte-compiled function defined in iimage.el.gz.

Signature

(iimage-mode-buffer ARG)

Documentation

Display images if ARG is non-nil, undisplay them otherwise.

Source Code

;; Defined in /usr/src/emacs/lisp/iimage.el.gz
(defun iimage-mode-buffer (arg)
  "Display images if ARG is non-nil, undisplay them otherwise."
  (let ((image-path (cons default-directory iimage-mode-image-search-path))
        (edges (window-inside-pixel-edges (get-buffer-window)))
	file)
    (with-silent-modifications
      (save-excursion
        (dolist (pair iimage-mode-image-regex-alist)
          (goto-char (point-min))
          (while (re-search-forward (car pair) nil t)
            (when (and (setq file (match-string (cdr pair)))
                       (setq file (locate-file file image-path)))
              ;; FIXME: we don't mark our images, so we can't reliably
              ;; remove them either (we may leave some of ours, and we
              ;; may remove other packages's display properties).
              (if arg
                  (add-text-properties
                   (match-beginning 0) (match-end 0)
                   `(display
                     ,(create-image file nil nil
                                    :max-width (- (nth 2 edges) (nth 0 edges))
				    :max-height (- (nth 3 edges) (nth 1 edges)))
                     keymap ,image-map
                     context-menu-functions (image-context-menu)
                     modification-hooks
                     (iimage-modification-hook)))
                (remove-list-of-text-properties
                 (match-beginning 0) (match-end 0)
                 '(display modification-hooks))))))))))