summaryrefslogtreecommitdiff
path: root/lisp/font-lock.el
diff options
context:
space:
mode:
authorDaniel Pfeiffer <occitan@esperanto.org>2005-05-19 02:15:09 +0000
committerDaniel Pfeiffer <occitan@esperanto.org>2005-05-19 02:15:09 +0000
commitae0c69273e4d8887db9bb5e7de0d5c6f6ce48d4c (patch)
tree8ed4106398b8141598cac151870b44f903424549 /lisp/font-lock.el
parentcaccc8de140d4e47090c06bc69e0abfa5ddc24a1 (diff)
downloademacs-ae0c69273e4d8887db9bb5e7de0d5c6f6ce48d4c.tar.gz
(lisp-font-lock-keywords-2): Do \\) only in strings, because (eq ... ?\\) is fairly frequent.
Diffstat (limited to 'lisp/font-lock.el')
-rw-r--r--lisp/font-lock.el12
1 files changed, 9 insertions, 3 deletions
diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index ee1fc1a515e..ba42412d8da 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -2053,9 +2053,15 @@ This function could be MATCHER in a MATCH-ANCHORED `font-lock-keywords' item."
("\\<:\\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.