]> code.delx.au - gnu-emacs/blobdiff - lisp/iimage.el
(vc-hooks, ewoc): Require.
[gnu-emacs] / lisp / iimage.el
index 12cc7ee3eb04c3827adf3cf8006dbb8328b66300..d2129353ccf7217e60d217f1f364755baf045587 100644 (file)
@@ -1,6 +1,6 @@
 ;;; iimage.el --- Inline image minor mode.
 
 ;;; iimage.el --- Inline image minor mode.
 
-;; Copyright (C) 2004 Free Software Foundation
+;; Copyright (C) 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
 
 ;; Author: KOSEKI Yoshinori <kose@meadowy.org>
 ;; Maintainer: KOSEKI Yoshinori <kose@meadowy.org>
 
 ;; Author: KOSEKI Yoshinori <kose@meadowy.org>
 ;; Maintainer: KOSEKI Yoshinori <kose@meadowy.org>
@@ -8,10 +8,10 @@
 
 ;; This file is part of GNU Emacs.
 
 
 ;; This file is part of GNU Emacs.
 
-;; GNU Emacs is free software; you can redistribute it and/or modify
+;; GNU Emacs is free software: you can redistribute it and/or modify
 ;; it under the terms of the GNU General Public License as published by
 ;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
-;; any later version.
+;; the Free Software Foundation, either version 3 of the License, or
+;; (at your option) any later version.
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
 
 ;; GNU Emacs is distributed in the hope that it will be useful,
 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
 ;; GNU General Public License for more details.
 
 ;; You should have received a copy of the GNU General Public License
-;; along with GNU Emacs; see the file COPYING.  If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.
 
 ;;; Commentary:
 
 
 ;;; 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':
 ;; 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.
 ;;
 ;;
 ;; ** Display images in *Info* buffer.
 ;;
 (eval-when-compile
   (require 'image-file))
 
 (eval-when-compile
   (require 'image-file))
 
-(defconst iimage-version "1.0")
+(defgroup iimage nil
+  "Support for inline images."
+  :version "22.1"
+  :group 'image)
+
+(defconst iimage-version "1.1")
 (defvar iimage-mode nil)
 (defvar iimage-mode-map nil)
 
 (defvar iimage-mode nil)
 (defvar iimage-mode-map nil)
 
@@ -81,7 +85,7 @@
 Each element looks like (REGEXP . NUM).
 NUM specifies which parenthesized expression in the regexp.
 
 Each element looks like (REGEXP . NUM).
 NUM specifies which parenthesized expression in the regexp.
 
-image filename regex exsamples:
+Examples of image filename regexps:
     file://foo.png
     `file://foo.png'
     \\[\\[foo.gif]]
     file://foo.png
     `file://foo.png'
     \\[\\[foo.gif]]
@@ -89,6 +93,10 @@ image filename regex exsamples:
      foo.JPG
 ")
 
      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)
 (defun turn-on-iimage-mode ()
 "Unconditionally turn on iimage mode."
   (interactive)
@@ -99,8 +107,10 @@ image filename regex exsamples:
   (interactive)
   (iimage-mode 0))
 
   (interactive)
   (iimage-mode 0))
 
+(defalias 'iimage-locate-file 'locate-file)
+
 (defun iimage-mode-buffer (arg)
 (defun iimage-mode-buffer (arg)
-"Display/Undisplay Images.
+"Display/undisplay images.
 With numeric ARG, display the images if and only if ARG is positive."
   (interactive)
   (let ((ing (if (numberp arg)
 With numeric ARG, display the images if and only if ARG is positive."
   (interactive)
   (let ((ing (if (numberp arg)
@@ -113,8 +123,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)))
       (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)))
              (if ing
                  (add-text-properties (match-beginning 0) (match-end 0)
                                       (list 'display (create-image file)))
@@ -122,12 +133,14 @@ With numeric ARG, display the images if and only if ARG is positive."
                                        '(display)))))))
     (set-buffer-modified-p modp)))
 
                                        '(display)))))))
     (set-buffer-modified-p modp)))
 
+;;;###autoload
 (define-minor-mode iimage-mode
   "Toggle inline image minor mode."
 (define-minor-mode iimage-mode
   "Toggle inline image minor mode."
-  nil " iImg" iimage-mode-map
+  :group 'iimage :lighter " iImg" :keymap iimage-mode-map
   (run-hooks 'iimage-mode-hook)
   (iimage-mode-buffer iimage-mode))
 
 (provide 'iimage)
 
   (run-hooks 'iimage-mode-hook)
   (iimage-mode-buffer iimage-mode))
 
 (provide 'iimage)
 
+;; arch-tag: f6f8e29a-08f6-4a12-9496-51e67441ce65
 ;;; iimage.el ends here
 ;;; iimage.el ends here