summaryrefslogtreecommitdiff
path: root/lisp
diff options
context:
space:
mode:
authorAlan Mackenzie <acm@muc.de>2015-04-07 11:01:43 +0000
committerAlan Mackenzie <acm@muc.de>2015-04-07 11:01:43 +0000
commitdb0a3b2c974642d04e763db64fcb49ef3154f5a8 (patch)
treee339e1fe78aa44cc9168f5d9cc32e660a5ed69c7 /lisp
parent23468561682aea0705249a469f614bb873e4f411 (diff)
downloademacs-db0a3b2c974642d04e763db64fcb49ef3154f5a8.tar.gz
Always mark "<" and ">" in #include directives with text properties.
* lisp/progmodes/c-fonts.el (c-cpp-matchers): Replace a font-lock "anchored matcher" with an invocation of c-make-font-lock-search-function to allow fontification when there's no trailing space on an "#include <..>" line.
Diffstat (limited to 'lisp')
-rw-r--r--lisp/progmodes/cc-fonts.el45
1 files changed, 23 insertions, 22 deletions
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el
index 9a1273ddcce..44172b05a56 100644
--- a/lisp/progmodes/cc-fonts.el
+++ b/lisp/progmodes/cc-fonts.el
@@ -539,28 +539,29 @@ stuff. Used on level 1 and higher."
(let* ((re (c-make-keywords-re nil
(c-lang-const c-cpp-include-directives)))
(re-depth (regexp-opt-depth re)))
- `((,(concat noncontinued-line-end
- (c-lang-const c-opt-cpp-prefix)
- re
- (c-lang-const c-syntactic-ws)
- "\\(<[^>\n\r]*>?\\)")
- (,(+ ncle-depth re-depth sws-depth 1)
- font-lock-string-face)
-
- ;; Use an anchored matcher to put paren syntax
- ;; on the brackets.
- (,(byte-compile
- `(lambda (limit)
- (let ((beg (match-beginning
- ,(+ ncle-depth re-depth sws-depth 1)))
- (end (1- (match-end ,(+ ncle-depth re-depth
- sws-depth 1)))))
- (if (eq (char-after end) ?>)
- (progn
- (c-mark-<-as-paren beg)
- (c-mark->-as-paren end))
- (c-unmark-<->-as-paren beg)))
- nil)))))))
+ ;; We used to use a font-lock "anchored matcher" here for
+ ;; the paren syntax. This failed when the ">" was at EOL,
+ ;; since `font-lock-fontify-anchored-keywords' terminated
+ ;; its loop at EOL without executing our lambda form at
+ ;; all.
+ `((,(c-make-font-lock-search-function
+ (concat noncontinued-line-end
+ (c-lang-const c-opt-cpp-prefix)
+ re
+ (c-lang-const c-syntactic-ws)
+ "\\(<[^>\n\r]*>?\\)")
+ `(,(+ ncle-depth re-depth sws-depth 1)
+ font-lock-string-face t)
+ `((let ((beg (match-beginning
+ ,(+ ncle-depth re-depth sws-depth 1)))
+ (end (1- (match-end ,(+ ncle-depth re-depth
+ sws-depth 1)))))
+ (if (eq (char-after end) ?>)
+ (progn
+ (c-mark-<-as-paren beg)
+ (c-mark->-as-paren end))
+ (c-unmark-<->-as-paren beg)))
+ nil))))))
;; #define.
,@(when (c-lang-const c-opt-cpp-macro-define)