From bf4906d7ca3833f11f929d0feae0feb622131604 Mon Sep 17 00:00:00 2001 From: Cameron Desautels Date: Thu, 5 Dec 2013 15:25:54 -0500 Subject: * lisp/emacs-lisp/regexp-opt.el (regexp-opt-charset): Fix ^. * test/automated/regexp-tests.el: New file. Fixes: debbugs:16046 --- lisp/emacs-lisp/regexp-opt.el | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lisp/emacs-lisp/regexp-opt.el') 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) -- cgit v1.2.3