summaryrefslogtreecommitdiff
path: root/lisp/font-lock.el
diff options
context:
space:
mode:
authorRichard M. Stallman <rms@gnu.org>2005-05-11 16:27:25 +0000
committerRichard M. Stallman <rms@gnu.org>2005-05-11 16:27:25 +0000
commita4479657966929ec8b38cb90ed9beb9cb2c8162e (patch)
tree84acb689075f1779930a413fa3e4d4402733fdb7 /lisp/font-lock.el
parentc3f6aa2088306361718a65f26f767f333393ea8c (diff)
downloademacs-a4479657966929ec8b38cb90ed9beb9cb2c8162e.tar.gz
(font-lock-fontify-syntactically-region):
Use font-lock-comment-delimiter-face for comment delimiters.
Diffstat (limited to 'lisp/font-lock.el')
-rw-r--r--lisp/font-lock.el19
1 files changed, 17 insertions, 2 deletions
diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index bd0af57059f..f2a6d244a79 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -1314,7 +1314,10 @@ START should be at the beginning of a line."
(defun font-lock-fontify-syntactically-region (start end &optional loudly ppss)
"Put proper face on each string and comment between START and END.
START should be at the beginning of a line."
- (let (state face beg)
+ (let (state face beg
+ (comment-end-regexp
+ (regexp-quote
+ (replace-regexp-in-string "^ *" "" comment-end))))
(if loudly (message "Fontifying %s... (syntactically...)" (buffer-name)))
(goto-char start)
;;
@@ -1329,7 +1332,19 @@ START should be at the beginning of a line."
(setq beg (max (nth 8 state) start))
(setq state (parse-partial-sexp (point) end nil nil state
'syntax-table))
- (when face (put-text-property beg (point) 'face face)))
+ (when face (put-text-property beg (point) 'face face))
+ (when (eq face 'font-lock-comment-face)
+ ;; Find the comment delimiters
+ ;; and use font-lock-comment-delimiter-face for them.
+ (save-excursion
+ (goto-char beg)
+ (if (and comment-start-skip (looking-at comment-start-skip))
+ (put-text-property beg (match-end 0) 'face
+ 'font-lock-comment-delimiter-face)))
+ (if (and comment-end
+ (looking-back comment-end-regexp (point-at-bol)))
+ (put-text-property (match-beginning 0) (point) 'face
+ 'font-lock-comment-delimiter-face))))
(< (point) end))
(setq state (parse-partial-sexp (point) end nil nil state
'syntax-table)))))