From xemacs-m  Mon Feb 17 12:25:10 1997
Received: from loiosh.kei.com (ckd@loiosh.kei.com [192.88.144.32])
	by xemacs.org (8.8.5/8.8.5) with ESMTP id MAA22080
	for <xemacs-beta@xemacs.org>; Mon, 17 Feb 1997 12:25:09 -0600 (CST)
Received: (from ckd@localhost)
	by loiosh.kei.com (8.8.5/8.8.5) id NAA26882;
	Mon, 17 Feb 1997 13:24:01 -0500 (EST)
To: Steven L Baur <steve@miranova.com>
Cc: xemacs-beta@xemacs.org
Subject: Re: Loose ends -- tm in-line image patch/fun with glyphs
References: <199702071027.TAA18076@mikan.jaist.ac.jp> <m2vi7wkluf.fsf@altair.xemacs.org>
X-Attribution: ckd
Mime-Version: 1.0 (generated by tm-edit 7.105)
Content-Type: text/plain; charset=US-ASCII
From: Christopher Davis <ckd@loiosh.kei.com>
Date: 17 Feb 1997 13:24:01 -0500
In-Reply-To: Steven L Baur's message of 13 Feb 1997 21:17:28 -0800
Message-ID: <w4lo8nb8am.fsf@loiosh.kei.com>
Lines: 31
X-Mailer: Gnus v5.4.12/XEmacs 19.15

sb> == Steven L Baur <steve@miranova.com>

 sb> + basic things like find-file... should have the option of rendering
 sb>   images (jpeg-mode).

;;; now *this* is cool

(defun view-image (file) "\
Interactively view image \"file\" in view-mode. \"q\" exits view-mode
and kills the buffer to free up colormap entries.\n\ 
Author: Holger Franz <hfranz@physik.rwth-aachen.de>"
  (interactive "fFile: ")
  (switch-to-buffer (generate-new-buffer (generate-new-buffer-name file)))
  (make-annotation 
     (set-glyph-property (make-glyph-internal) 'image file) nil 'text)
  (view-mode nil '(lambda (buf) (kill-buffer buf)))
  )

(defun view-image-mode () "\
Display buffer contents as an annotation glyph in view-mode. \"q\"
exits view-mode and kills the buffer to free up colormap entries.\n\
Author: Holger Franz <hfranz@physik.rwth-aachen.de>"
  (interactive "")
  (let ((file buffer-file-truename))
    (make-annotation (set-glyph-property (make-glyph-internal) 'image
                        file) nil 'text) 
    (view-mode nil '(lambda (buf) (kill-buffer buf)
		      (garbage-collect)))))

(setq auto-mode-alist (cons '("\\.\\(png\\|gif\\|jpg\\|xpm\\|xbm\\)$"
                              . view-image-mode) auto-mode-alist))

