* lisp/hi-lock.el (hi-lock-process-phrase): Try to make it less fragile.
authorGlenn Morris <rgm@gnu.org>
Sun, 7 Oct 2012 00:27:31 +0000 (17:27 -0700)
committerGlenn Morris <rgm@gnu.org>
Sun, 7 Oct 2012 00:27:31 +0000 (17:27 -0700)
Fixes: debbugs:7161

lisp/ChangeLog
lisp/hi-lock.el

index 4469c61..b91d971 100644 (file)
@@ -1,5 +1,8 @@
 2012-10-07  Glenn Morris  <rgm@gnu.org>
 
+       * hi-lock.el (hi-lock-process-phrase):
+       Try to make it less fragile.  (Bug#7161)
+
        * hi-lock.el (hi-lock-face-phrase-buffer): Doc fix.
 
 2012-10-06  Glenn Morris  <rgm@gnu.org>
index 0bbb315..5974312 100644 (file)
@@ -547,7 +547,11 @@ and initial lower-case letters made case insensitive."
     ;; FIXME fragile; better to just bind case-fold-search?  (Bug#7161)
     (setq mod-phrase
           (replace-regexp-in-string
-           "\\<[a-z]" (lambda (m) (format "[%s%s]" (upcase m) m)) phrase))
+           "\\(^\\|\\s-\\)\\([a-z]\\)"
+           (lambda (m) (format "%s[%s%s]"
+                               (match-string 1 m)
+                               (upcase (match-string 2 m))
+                               (match-string 2 m))) phrase))
     ;; FIXME fragile; better to use search-spaces-regexp?
     (setq mod-phrase
           (replace-regexp-in-string