• Home
  • History
  • Annotate
  • Raw
  • Download
  • only in /macosx-10.9.5/emacs-92/emacs/lisp/

Lines Matching defs:image

0 ;;; image-file.el --- support for visiting image files
29 ;; inserted) image files so that they are displayed by Emacs as
31 ;; image data, with the image-data still present underneath; if the
33 ;; the image data to the new file.
37 (require 'image)
41 (defcustom image-file-name-extensions
43 "*A list of image-file filename extensions.
44 Filenames having one of these extensions are considered image files,
45 in addition to those matching `image-file-name-regexps'.
47 See `auto-image-file-mode'; if `auto-image-file-mode' is enabled,
49 `auto-image-file-mode' is re-enabled; this happens automatically when
54 (when auto-image-file-mode
55 ;; Re-initialize the image-file handler
56 (auto-image-file-mode t)))
58 :group 'image)
61 (defcustom image-file-name-regexps nil
62 "*List of regexps matching image-file filenames.
63 Filenames matching one of these regexps are considered image files,
64 in addition to those with an extension in `image-file-name-extensions'.
66 See function `auto-image-file-mode'; if `auto-image-file-mode' is
68 `auto-image-file-mode' is re-enabled; this happens automatically when
73 (when auto-image-file-mode
74 ;; Re-initialize the image-file handler
75 (auto-image-file-mode t)))
77 :group 'image)
81 (defun image-file-name-regexp ()
82 "Return a regular expression matching image-file filenames."
84 (and image-file-name-extensions
87 image-file-name-extensions)
88 image-file-name-extensions)
91 (if image-file-name-regexps
94 (cons exts-regexp image-file-name-regexps)
95 image-file-name-regexps)
101 (defun insert-image-file (file &optional visit beg end replace)
102 "Insert the image file FILE into the current buffer.
106 (image-file-call-underlying #'insert-file-contents-literally
109 ;; Turn the image data into a real image, but only if the whole file
118 (image
119 (create-image data nil t))
121 `(display ,image
123 (image-file-yank-handler nil t)
124 intangible ,image
133 ;; Inhibit the cursor when the buffer contains only an image,
137 ;; area look correct when the image is wider than the window.
142 ;; yanking two copies of the same image next to each other are
144 (defun image-file-yank-handler (string)
145 "Yank handler for inserting an image into a buffer."
147 (image (get-text-property 0 'display string)))
149 (if (consp image)
151 (or (next-single-property-change 0 'image-counter string)
154 ,(cons (car image) (cdr image))
156 ,(cons 'image-file-yank-handler '(nil t)))
160 (put 'image-file-handler 'safe-magic t)
161 (defun image-file-handler (operation &rest args)
162 "Filename handler for inserting image files.
166 auto-image-file-mode)
167 (apply #'insert-image-file args)
169 (apply #'image-file-call-underlying operation operation args)))
171 (defun image-file-call-underlying (function operation &rest args)
172 "Call FUNCTION with `image-file-handler' and OPERATION inhibited.
175 (cons 'image-file-handler
183 (define-minor-mode auto-image-file-mode
184 "Toggle visiting of image files as images.
189 `image-file-name-extensions', or matches a regexp in
190 `image-file-name-regexps'."
192 :group 'image
195 (rassq 'image-file-handler file-name-handler-alist)))
200 (when auto-image-file-mode
201 (push (cons (image-file-name-regexp) 'image-file-handler)
205 (provide 'image-file)
208 ;;; image-file.el ends here