summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/regexp-opt.el
diff options
context:
space:
mode:
authorCameron Desautels <camdez@gmail.com>2013-12-05 15:25:54 -0500
committerStefan Monnier <monnier@iro.umontreal.ca>2013-12-05 15:25:54 -0500
commitbf4906d7ca3833f11f929d0feae0feb622131604 (patch)
tree1f798df874380c96422754a65e06f59e1cc57d21 /lisp/emacs-lisp/regexp-opt.el
parentc619527c15d2c0c88d5e73f102588f6c3d44ab73 (diff)
downloademacs-bf4906d7ca3833f11f929d0feae0feb622131604.tar.gz
* lisp/emacs-lisp/regexp-opt.el (regexp-opt-charset): Fix ^.
* test/automated/regexp-tests.el: New file. Fixes: debbugs:16046
Diffstat (limited to 'lisp/emacs-lisp/regexp-opt.el')
-rw-r--r--lisp/emacs-lisp/regexp-opt.el4
1 files changed, 3 insertions, 1 deletions
diff --git a/lisp/emacs-lisp/regexp-opt.el b/lisp/emacs-lisp/regexp-opt.el
index de9966c0af0..cb7828ddd95 100644
--- a/lisp/emacs-lisp/regexp-opt.el
+++ b/lisp/emacs-lisp/regexp-opt.el
@@ -285,7 +285,9 @@ CHARS should be a list of characters."
;;
;; Make sure a caret is not first and a dash is first or last.
(if (and (string-equal charset "") (string-equal bracket ""))
- (concat "[" dash caret "]")
+ (if (string-equal dash "")
+ "\\^" ; [^] is not a valid regexp
+ (concat "[" dash caret "]"))
(concat "[" bracket charset caret dash "]"))))
(provide 'regexp-opt)