]> git.eshelyaron.com Git - emacs.git/commitdiff
(turn-on-iimage-mode, iimage-mode): Add autoload cookies.
authorEli Zaretskii <eliz@gnu.org>
Sat, 3 Jul 2004 09:54:20 +0000 (09:54 +0000)
committerEli Zaretskii <eliz@gnu.org>
Sat, 3 Jul 2004 09:54:20 +0000 (09:54 +0000)
(iimage-mode-image-search-path): New user option to search the
image file.
(iimage-locate-file): New funcion.  Emacs21.3 or earlier does not
have locate-file.
(iimage-mode-buffer): Use it.

lisp/ChangeLog
lisp/iimage.el

index b6ab8ca604c121d5e67d1013c421b3a243fd0a19..19ecb15cf2d082a4f8aa67e6dd24c1b3b6a60593 100644 (file)
@@ -1,3 +1,13 @@
+2004-07-03  KOSEKI Yoshinori  <kose@meadowy.org>
+
+       * iimage.el (turn-on-iimage-mode, iimage-mode): Add autoload
+       cookies.
+       (iimage-mode-image-search-path): New user option to search the
+       image file.
+       (iimage-locate-file): New funcion.  Emacs21.3 or earlier does not
+       have locate-file.
+       (iimage-mode-buffer): Use it.
+
 2004-07-03  Nick Roberts  <nickrob@gnu.org>
 
        * progmodes/gdb-ui.el (gdb-goto-breakpoint): String match more
index d138498ca3ae3398f7d99c69a2caa3f3c20abb7c..9b183ebb01d2006ebd8dfcf3d308deb569bb6e67 100644 (file)
 
 ;;; Commentary:
 
-;; Iimage is a minor mode that display a images, when image-filename
-;; exists in buffer.
+;; Iimage is a minor mode that displays images, when image-filename
+;; exists in the buffer.
 ;; 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." t)
 ;;
 ;; ** Display images in *Info* buffer.
 ;;
@@ -50,7 +51,7 @@
 (eval-when-compile
   (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 @@ image filename regex exsamples:
      foo.JPG
 ")
 
+(defvar iimage-mode-image-search-path nil
+"*List of directories to search for image files for iimage-mode.")
+
+;;;###autoload
 (defun turn-on-iimage-mode ()
 "Unconditionally turn on iimage mode."
   (interactive)
@@ -99,6 +104,12 @@ image filename regex exsamples:
   (interactive)
   (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 @@ With numeric ARG, display the images if and only if ARG is positive."
       (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 @@ With numeric ARG, display the images if and only if ARG is positive."
                                        '(display)))))))
     (set-buffer-modified-p modp)))
 
+;;;###autoload
 (define-minor-mode iimage-mode
   "Toggle inline image minor mode."
   nil " iImg" iimage-mode-map