[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/emacs-24 r108438: Split off imagemagick-fil
From: |
Glenn Morris |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/emacs-24 r108438: Split off imagemagick-filter-types from imagemagick-register-types |
Date: |
Fri, 02 Nov 2012 02:29:05 -0000 |
User-agent: |
Bazaar (2.5.0) |
------------------------------------------------------------
revno: 108438
committer: Glenn Morris <address@hidden>
branch nick: trunk
timestamp: Thu 2012-05-31 13:14:46 -0400
message:
Split off imagemagick-filter-types from imagemagick-register-types
* lisp/image.el: (imagemagick-filter-types): New function. (Bug#7406)
(imagemagick-register-types): Use imagemagick-filter-types.
* etc/NEWS: Mention this.
modified:
etc/NEWS
lisp/ChangeLog
lisp/image.el
=== modified file 'etc/NEWS'
--- a/etc/NEWS 2012-05-31 07:22:33 +0000
+++ b/etc/NEWS 2012-05-31 17:14:46 +0000
@@ -68,7 +68,9 @@
afterwards if you do not use customize to change this.
*** The new variable `imagemagick-types-enable' also affects which
-ImageMagick types are treated as images.
+ImageMagick types are treated as images. The function
+`imagemagick-filter-types' returns the list of types that will be
+treated as images.
** String values for `initial-buffer-choice' also apply to emacsclient
frames, if emacsclient is only told to open a new frame without
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog 2012-05-31 07:22:33 +0000
+++ b/lisp/ChangeLog 2012-05-31 17:14:46 +0000
@@ -3,7 +3,8 @@
* image.el: For clarity, call imagemagick-register-types at
top-level, rather than relying on a custom :initialize.
(imagemagick-types-enable): New option. (Bug#11557)
- (imagemagick-register-types): Respect imagemagick-types-inhibit.
+ (imagemagick-filter-types): New function. (Bug#7406)
+ (imagemagick-register-types): Use imagemagick-filter-types.
If disabling support, remove elements altogether rather
than using an impossible regexp.
(imagemagick-types-inhibit): Give it the default init function.
=== modified file 'lisp/image.el'
--- a/lisp/image.el 2012-05-31 07:22:33 +0000
+++ b/lisp/image.el 2012-05-31 17:14:46 +0000
@@ -687,21 +687,41 @@
image n count time-elapsed limit))))
+(defvar imagemagick-types-inhibit)
+(defvar imagemagick-types-enable)
+
+(defun imagemagick-filter-types ()
+ "Return a list of the ImageMagick types to be treated as images, or nil.
+This is the result of `imagemagick-types', including only elements
+that match `imagemagick-types-enable' and do not match
+`imagemagick-types-inhibit'."
+ (when (fboundp 'imagemagick-types)
+ (cond ((null imagemagick-types-enable) nil)
+ ((eq imagemagick-types-inhibit t) nil)
+ ((eq imagemagick-types-enable t) (imagemagick-types))
+ (t
+ (delq nil
+ (mapcar
+ (lambda (type)
+ (unless (memq type imagemagick-types-inhibit)
+ (catch 'found
+ (dolist (enable imagemagick-types-enable nil)
+ (if (cond ((symbolp enable) (eq enable type))
+ ((stringp enable)
+ (string-match enable (symbol-name type))))
+ (throw 'found type))))))
+ (imagemagick-types)))))))
+
(defvar imagemagick--file-regexp nil
"File extension regexp for ImageMagick files, if any.
This is the extension installed into `auto-mode-alist' and
`image-type-file-name-regexps' by `imagemagick-register-types'.")
-(defvar imagemagick-types-inhibit)
-(defvar imagemagick-types-enable)
-
;;;###autoload
(defun imagemagick-register-types ()
"Register file types that can be handled by ImageMagick.
This function is called at startup, after loading the init file.
-It registers the ImageMagick types returned by `imagemagick-types',
-including only those from `imagemagick-types-enable', and excluding
-those from `imagemagick-types-inhibit'.
+It registers the ImageMagick types returned by `imagemagick-filter-types'.
Registered image types are added to `auto-mode-alist', so that
Emacs visits them in Image mode. They are also added to
@@ -710,27 +730,9 @@
If Emacs is compiled without ImageMagick support, this does nothing."
(when (fboundp 'imagemagick-types)
- (let* ((include
- (cond ((null imagemagick-types-enable) nil)
- ((eq imagemagick-types-inhibit t) nil)
- ((eq imagemagick-types-enable t) (imagemagick-types))
- (t
- (delq nil
- (mapcar
- (lambda (type)
- (catch 'found
- (dolist (enable imagemagick-types-enable nil)
- (if (cond ((symbolp enable) (eq enable type))
- ((stringp enable)
- (string-match enable
- (symbol-name type))))
- (throw 'found type)))))
- (imagemagick-types))))))
- (re (let (types)
- (dolist (type include)
- (unless (memq type imagemagick-types-inhibit)
- (push (downcase (symbol-name type)) types)))
- (if types (concat "\\." (regexp-opt types) "\\'"))))
+ (let* ((types (mapcar (lambda (type) (downcase (symbol-name type)))
+ (imagemagick-filter-types)))
+ (re (if types (concat "\\." (regexp-opt types) "\\'")))
(ama-elt (car (member (cons imagemagick--file-regexp 'image-mode)
auto-mode-alist)))
(itfnr-elt (car (member (cons imagemagick--file-regexp 'imagemagick)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/emacs-24 r108438: Split off imagemagick-filter-types from imagemagick-register-types,
Glenn Morris <=