changeset 62502:8f934f346603

(lisp-font-lock-keywords-2): Do \\) only in strings, because (eq ... ?\\) is fairly frequent.
author Daniel Pfeiffer <occitan@esperanto.org>
date Thu, 19 May 2005 02:15:09 +0000
parents 50ba01c61e5c
children c50200e8e7e8
files lisp/font-lock.el
diffstat 1 files changed, 9 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/font-lock.el	Thu May 19 01:56:04 2005 +0000
+++ b/lisp/font-lock.el	Thu May 19 02:15:09 2005 +0000
@@ -2053,9 +2053,15 @@
        ("\\<:\\sw+\\>" 0 font-lock-builtin-face)
        ;; ELisp and CLisp `&' keywords as types.
        ("\\&\\sw+\\>" . font-lock-type-face)
-       ;; Make regexp grouping constructs bold, so they stand out.
-       ("\\([\\][\\]\\)\\([(|)]\\)\\(\\?:\\)?"
-	(1 font-lock-comment-face prepend)
+       ;; Make regexp grouping constructs bold, so they stand out, but only in strings.
+       ((lambda (bound)
+	  (if (re-search-forward "\\([\\][\\]\\)\\([(|)]\\)\\(\\?:\\)?" bound)
+	       (let ((face (get-text-property (1- (point)) 'face)))
+		 (if (listp face)
+		     (memq 'font-lock-string-face face)
+		   (eq 'font-lock-string-face face)))))
+	(1 font-lock-comment-face prepend) ; Should we introduce a lowlight face for this?
+					; Ideally that would retain the color, dimmed 50%.
 	(2 'bold prepend)
 	(3 font-lock-type-face prepend t))
        ;; Underline innermost grouping, so that you can more easily see what belongs together.