Mercurial > emacs
comparison lisp/font-lock.el @ 62235:cd487105a05a
(font-lock-fontify-syntactically-region):
Use font-lock-comment-delimiter-face for comment delimiters.
author | Richard M. Stallman <rms@gnu.org> |
---|---|
date | Wed, 11 May 2005 16:27:25 +0000 |
parents | 5dfcab314a42 |
children | 55168ce0d00d |
comparison
equal
deleted
inserted
replaced
62234:b484427cfa6b | 62235:cd487105a05a |
---|---|
1312 ;;; Syntactic fontification functions. | 1312 ;;; Syntactic fontification functions. |
1313 | 1313 |
1314 (defun font-lock-fontify-syntactically-region (start end &optional loudly ppss) | 1314 (defun font-lock-fontify-syntactically-region (start end &optional loudly ppss) |
1315 "Put proper face on each string and comment between START and END. | 1315 "Put proper face on each string and comment between START and END. |
1316 START should be at the beginning of a line." | 1316 START should be at the beginning of a line." |
1317 (let (state face beg) | 1317 (let (state face beg |
1318 (comment-end-regexp | |
1319 (regexp-quote | |
1320 (replace-regexp-in-string "^ *" "" comment-end)))) | |
1318 (if loudly (message "Fontifying %s... (syntactically...)" (buffer-name))) | 1321 (if loudly (message "Fontifying %s... (syntactically...)" (buffer-name))) |
1319 (goto-char start) | 1322 (goto-char start) |
1320 ;; | 1323 ;; |
1321 ;; Find the `start' state. | 1324 ;; Find the `start' state. |
1322 (setq state (or ppss (syntax-ppss start))) | 1325 (setq state (or ppss (syntax-ppss start))) |
1327 (when (or (nth 3 state) (nth 4 state)) | 1330 (when (or (nth 3 state) (nth 4 state)) |
1328 (setq face (funcall font-lock-syntactic-face-function state)) | 1331 (setq face (funcall font-lock-syntactic-face-function state)) |
1329 (setq beg (max (nth 8 state) start)) | 1332 (setq beg (max (nth 8 state) start)) |
1330 (setq state (parse-partial-sexp (point) end nil nil state | 1333 (setq state (parse-partial-sexp (point) end nil nil state |
1331 'syntax-table)) | 1334 'syntax-table)) |
1332 (when face (put-text-property beg (point) 'face face))) | 1335 (when face (put-text-property beg (point) 'face face)) |
1336 (when (eq face 'font-lock-comment-face) | |
1337 ;; Find the comment delimiters | |
1338 ;; and use font-lock-comment-delimiter-face for them. | |
1339 (save-excursion | |
1340 (goto-char beg) | |
1341 (if (and comment-start-skip (looking-at comment-start-skip)) | |
1342 (put-text-property beg (match-end 0) 'face | |
1343 'font-lock-comment-delimiter-face))) | |
1344 (if (and comment-end | |
1345 (looking-back comment-end-regexp (point-at-bol))) | |
1346 (put-text-property (match-beginning 0) (point) 'face | |
1347 'font-lock-comment-delimiter-face)))) | |
1333 (< (point) end)) | 1348 (< (point) end)) |
1334 (setq state (parse-partial-sexp (point) end nil nil state | 1349 (setq state (parse-partial-sexp (point) end nil nil state |
1335 'syntax-table))))) | 1350 'syntax-table))))) |
1336 | 1351 |
1337 ;;; End of Syntactic fontification functions. | 1352 ;;; End of Syntactic fontification functions. |