* lisp/emacs-lisp/regexp-opt.el (regexp-opt-charset): Fix ^.

* test/automated/regexp-tests.el: New file.

Fixes: debbugs:16046
This commit is contained in:
Cameron Desautels 2013-12-05 15:25:54 -05:00 committed by Stefan Monnier
parent c619527c15
commit bf4906d7ca
4 changed files with 47 additions and 9 deletions

View file

@ -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)