aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Mackenzie2015-04-07 11:01:43 +0000
committerAlan Mackenzie2015-04-07 11:01:43 +0000
commitdb0a3b2c974642d04e763db64fcb49ef3154f5a8 (patch)
treee339e1fe78aa44cc9168f5d9cc32e660a5ed69c7
parent23468561682aea0705249a469f614bb873e4f411 (diff)
downloademacs-db0a3b2c974642d04e763db64fcb49ef3154f5a8.tar.gz
emacs-db0a3b2c974642d04e763db64fcb49ef3154f5a8.zip
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.
-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."
539 (let* ((re (c-make-keywords-re nil 539 (let* ((re (c-make-keywords-re nil
540 (c-lang-const c-cpp-include-directives))) 540 (c-lang-const c-cpp-include-directives)))
541 (re-depth (regexp-opt-depth re))) 541 (re-depth (regexp-opt-depth re)))
542 `((,(concat noncontinued-line-end 542 ;; We used to use a font-lock "anchored matcher" here for
543 (c-lang-const c-opt-cpp-prefix) 543 ;; the paren syntax. This failed when the ">" was at EOL,
544 re 544 ;; since `font-lock-fontify-anchored-keywords' terminated
545 (c-lang-const c-syntactic-ws) 545 ;; its loop at EOL without executing our lambda form at
546 "\\(<[^>\n\r]*>?\\)") 546 ;; all.
547 (,(+ ncle-depth re-depth sws-depth 1) 547 `((,(c-make-font-lock-search-function
548 font-lock-string-face) 548 (concat noncontinued-line-end
549 549 (c-lang-const c-opt-cpp-prefix)
550 ;; Use an anchored matcher to put paren syntax 550 re
551 ;; on the brackets. 551 (c-lang-const c-syntactic-ws)
552 (,(byte-compile 552 "\\(<[^>\n\r]*>?\\)")
553 `(lambda (limit) 553 `(,(+ ncle-depth re-depth sws-depth 1)
554 (let ((beg (match-beginning 554 font-lock-string-face t)
555 ,(+ ncle-depth re-depth sws-depth 1))) 555 `((let ((beg (match-beginning
556 (end (1- (match-end ,(+ ncle-depth re-depth 556 ,(+ ncle-depth re-depth sws-depth 1)))
557 sws-depth 1))))) 557 (end (1- (match-end ,(+ ncle-depth re-depth
558 (if (eq (char-after end) ?>) 558 sws-depth 1)))))
559 (progn 559 (if (eq (char-after end) ?>)
560 (c-mark-<-as-paren beg) 560 (progn
561 (c-mark->-as-paren end)) 561 (c-mark-<-as-paren beg)
562 (c-unmark-<->-as-paren beg))) 562 (c-mark->-as-paren end))
563 nil))))))) 563 (c-unmark-<->-as-paren beg)))
564 nil))))))
564 565
565 ;; #define. 566 ;; #define.
566 ,@(when (c-lang-const c-opt-cpp-macro-define) 567 ,@(when (c-lang-const c-opt-cpp-macro-define)