diff options
| author | Richard M. Stallman | 2005-05-15 14:28:55 +0000 |
|---|---|---|
| committer | Richard M. Stallman | 2005-05-15 14:28:55 +0000 |
| commit | 7435a76be7a6dd9f09c777b68a33024a2dc48867 (patch) | |
| tree | 13fde2edaa2424939cf6582280ebf745beed9d39 | |
| parent | 820f92e199756d240b94ae9e646440f307df8a4d (diff) | |
| download | emacs-7435a76be7a6dd9f09c777b68a33024a2dc48867.tar.gz emacs-7435a76be7a6dd9f09c777b68a33024a2dc48867.zip | |
(font-lock-comment-start-skip): New variable.
(font-lock-comment-end-skip): New variable.
(font-lock-fontify-syntactically-region): Use them if non-nil.
| -rw-r--r-- | lisp/font-lock.el | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/lisp/font-lock.el b/lisp/font-lock.el index eb3ad97d7ce..b71e5a3136f 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el | |||
| @@ -1311,12 +1311,19 @@ START should be at the beginning of a line." | |||
| 1311 | 1311 | ||
| 1312 | ;;; Syntactic fontification functions. | 1312 | ;;; Syntactic fontification functions. |
| 1313 | 1313 | ||
| 1314 | (defvar font-lock-comment-start-skip nil | ||
| 1315 | "If non-nil, Font Lock mode uses this instead of `comment-start-skip'.") | ||
| 1316 | |||
| 1317 | (defvar font-lock-comment-end-skip nil | ||
| 1318 | "If non-nil, Font Lock mode uses this instead of `comment-end'.") | ||
| 1319 | |||
| 1314 | (defun font-lock-fontify-syntactically-region (start end &optional loudly ppss) | 1320 | (defun font-lock-fontify-syntactically-region (start end &optional loudly ppss) |
| 1315 | "Put proper face on each string and comment between START and END. | 1321 | "Put proper face on each string and comment between START and END. |
| 1316 | START should be at the beginning of a line." | 1322 | START should be at the beginning of a line." |
| 1317 | (let ((comment-end-regexp | 1323 | (let ((comment-end-regexp |
| 1318 | (regexp-quote | 1324 | (or font-lock-comment-end-skip |
| 1319 | (replace-regexp-in-string "^ *" "" comment-end))) | 1325 | (regexp-quote |
| 1326 | (replace-regexp-in-string "^ *" "" comment-end)))) | ||
| 1320 | state face beg) | 1327 | state face beg) |
| 1321 | (if loudly (message "Fontifying %s... (syntactically...)" (buffer-name))) | 1328 | (if loudly (message "Fontifying %s... (syntactically...)" (buffer-name))) |
| 1322 | (goto-char start) | 1329 | (goto-char start) |
| @@ -1334,12 +1341,14 @@ START should be at the beginning of a line." | |||
| 1334 | 'syntax-table)) | 1341 | 'syntax-table)) |
| 1335 | (when face (put-text-property beg (point) 'face face)) | 1342 | (when face (put-text-property beg (point) 'face face)) |
| 1336 | (when (and (eq face 'font-lock-comment-face) | 1343 | (when (and (eq face 'font-lock-comment-face) |
| 1337 | comment-start-skip) | 1344 | (or font-lock-comment-start-skip |
| 1345 | comment-start-skip)) | ||
| 1338 | ;; Find the comment delimiters | 1346 | ;; Find the comment delimiters |
| 1339 | ;; and use font-lock-comment-delimiter-face for them. | 1347 | ;; and use font-lock-comment-delimiter-face for them. |
| 1340 | (save-excursion | 1348 | (save-excursion |
| 1341 | (goto-char beg) | 1349 | (goto-char beg) |
| 1342 | (if (looking-at comment-start-skip) | 1350 | (if (looking-at (or font-lock-comment-start-skip |
| 1351 | comment-start-skip)) | ||
| 1343 | (put-text-property beg (match-end 0) 'face | 1352 | (put-text-property beg (match-end 0) 'face |
| 1344 | font-lock-comment-delimiter-face))) | 1353 | font-lock-comment-delimiter-face))) |
| 1345 | (if (looking-back comment-end-regexp (point-at-bol)) | 1354 | (if (looking-back comment-end-regexp (point-at-bol)) |