summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/regexp-opt.el
diff options
context:
space:
mode:
authorChong Yidong <cyd@gnu.org>2012-04-16 11:47:43 +0800
committerChong Yidong <cyd@gnu.org>2012-04-16 11:47:43 +0800
commitc505aaeb00a1c4f01e79f6e82216f83e33a77426 (patch)
tree0b82af4d177fa555482229d01ae2075ae867b7fd /lisp/emacs-lisp/regexp-opt.el
parentb62a57beb523298caa95c2d85c65eeb6e9af7af9 (diff)
downloademacs-c505aaeb00a1c4f01e79f6e82216f83e33a77426.tar.gz
emacs-c505aaeb00a1c4f01e79f6e82216f83e33a77426.tar.bz2
emacs-c505aaeb00a1c4f01e79f6e82216f83e33a77426.zip
Call imagemagick-register-types automatically.
* lisp/image.el (imagemagick--extension-regexp): New variable. (imagemagick-register-types): Use it. (imagemagick-types-inhibit): Add :set function. Allow new value of t to inhibit all types. * lisp/loadup.el (fboundp): Preload regexp-opt, needed by imagemagick-register-types. * lisp/emacs-lisp/regexp-opt.el (regexp-opt-charset): Avoid cl macros, so we can preload it.
Diffstat (limited to 'lisp/emacs-lisp/regexp-opt.el')
-rw-r--r--lisp/emacs-lisp/regexp-opt.el27
1 files changed, 12 insertions, 15 deletions
diff --git a/lisp/emacs-lisp/regexp-opt.el b/lisp/emacs-lisp/regexp-opt.el
index 6d12fe19277..72e3c398dc0 100644
--- a/lisp/emacs-lisp/regexp-opt.el
+++ b/lisp/emacs-lisp/regexp-opt.el
@@ -136,9 +136,6 @@ This means the number of non-shy regexp grouping constructs
;;; Workhorse functions.
-(eval-when-compile
- (require 'cl))
-
(defun regexp-opt-group (strings &optional paren lax)
"Return a regexp to match a string in the sorted list STRINGS.
If PAREN non-nil, output regexp parentheses around returned regexp.
@@ -248,15 +245,15 @@ Merges keywords to avoid backtracking in Emacs's regexp matcher."
;;
;; Make a character map but extract character set meta characters.
(dolist (char chars)
- (case char
- (?\]
- (setq bracket "]"))
- (?^
- (setq caret "^"))
- (?-
- (setq dash "-"))
- (otherwise
- (aset charmap char t))))
+ (cond
+ ((eq char ?\])
+ (setq bracket "]"))
+ ((eq char ?^)
+ (setq caret "^"))
+ ((eq char ?-)
+ (setq dash "-"))
+ (t
+ (aset charmap char t))))
;;
;; Make a character set from the map using ranges where applicable.
(map-char-table
@@ -268,14 +265,14 @@ Merges keywords to avoid backtracking in Emacs's regexp matcher."
(setq charset (format "%s%c-%c" charset start end))
(while (>= end start)
(setq charset (format "%s%c" charset start))
- (incf start)))
+ (setq start (1+ start))))
(setq start (car c) end (cdr c)))
(if (= (1- c) end) (setq end c)
(if (> end (+ start 2))
(setq charset (format "%s%c-%c" charset start end))
(while (>= end start)
(setq charset (format "%s%c" charset start))
- (incf start)))
+ (setq start (1+ start))))
(setq start c end c)))))
charmap)
(when (>= end start)
@@ -283,7 +280,7 @@ Merges keywords to avoid backtracking in Emacs's regexp matcher."
(setq charset (format "%s%c-%c" charset start end))
(while (>= end start)
(setq charset (format "%s%c" charset start))
- (incf start))))
+ (setq start (1+ start)))))
;;
;; Make sure a caret is not first and a dash is first or last.
(if (and (string-equal charset "") (string-equal bracket ""))