[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

iimage.el patch

From: KOSEKI Yoshinori
Subject: iimage.el patch
Date: Sat, 26 Jun 2004 08:57:05 +0900
User-agent: T-gnus/6.17.3 (based on No Gnus v0.3) SEMI/1.14.6 (Maruoka) FLIM/1.14.6 (Marutamachi) APEL/10.6 Emacs/21.1 (i386-mingw-nt5.1.2600) MULE/5.0 (賢木) Meadow/2.00pre2 (KIKYOU)

Please commit this patch.

2004-06-25  KOSEKI Yoshinori  <address@hidden>

        * iimage.el (turn-on-iimage-mode, iimage-mode): add autoload.

        * iimage.el (iimage-mode-image-search-path): New user option to
        search the image file.
        (iimage-locate-file): New fun. Emacs21.3 or earlier does not heve
        (iimage-mode-buffer): Use it.
        Suggested by Masayuki Ataka.
--- iimage.el   (revision 7)
+++ iimage.el   (working copy)
@@ -30,7 +30,8 @@
 ;; http://www.netlaputa.ne.jp/~kose/Emacs/iimage.html
 ;; Add to your `~/.emacs':
-;; (autoload 'iimage-mode "iimage" "SUpport Inline image minor mode." t)
+;; (autoload 'iimage-mode "iimage" "Support Inline image minor mode." t)
+;; (autoload 'turn-on-iimage-mode "iimage" "Turn on Inline image minor mode." 
 ;; ** Display images in *Info* buffer.
@@ -50,7 +51,7 @@
   (require 'image-file))
-(defconst iimage-version "1.0")
+(defconst iimage-version "1.1")
 (defvar iimage-mode nil)
 (defvar iimage-mode-map nil)
@@ -89,6 +90,10 @@
+(defvar iimage-mode-image-search-path nil
+"*List of directories to search for image files for iimage-mode.")
 (defun turn-on-iimage-mode ()
 "Unconditionally turn on iimage mode."
@@ -99,6 +104,12 @@
   (iimage-mode 0))
+;; Emacs21.3 or earlier does not heve locate-file.
+(if (fboundp 'locate-file)
+    (defalias 'iimage-locate-file 'locate-file)
+  (defun iimage-locate-file (filename path)
+    (locate-library filename t path)))
 (defun iimage-mode-buffer (arg)
 "Display/Undisplay Images.
 With numeric ARG, display the images if and only if ARG is positive."
@@ -113,8 +124,9 @@
       (dolist (pair iimage-mode-image-regex-alist)
        (while (re-search-forward (car pair) nil t)
          (if (and (setq file (match-string (cdr pair)))
-                  (setq file (expand-file-name file default-directory))
-                  (file-exists-p file))
+                  (setq file (iimage-locate-file file 
+                                  (cons default-directory 
+                                        iimage-mode-image-search-path))))
              (if ing
                  (add-text-properties (match-beginning 0) (match-end 0)
                                       (list 'display (create-image file)))
@@ -122,6 +134,7 @@
     (set-buffer-modified-p modp)))
 (define-minor-mode iimage-mode
   "Toggle inline image minor mode."
   nil " iImg" iimage-mode-map

reply via email to

[Prev in Thread] Current Thread [Next in Thread]