diff options
author | Cameron Desautels <camdez@gmail.com> | 2013-12-05 15:25:54 -0500 |
---|---|---|
committer | Stefan Monnier <monnier@iro.umontreal.ca> | 2013-12-05 15:25:54 -0500 |
commit | bf4906d7ca3833f11f929d0feae0feb622131604 (patch) | |
tree | 1f798df874380c96422754a65e06f59e1cc57d21 /lisp/emacs-lisp/regexp-opt.el | |
parent | c619527c15d2c0c88d5e73f102588f6c3d44ab73 (diff) | |
download | emacs-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.el | 4 |
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) |