From: Richard M. Stallman Date: Sun, 15 May 2005 14:28:55 +0000 (+0000) Subject: (font-lock-comment-start-skip): New variable. X-Git-Tag: ttn-vms-21-2-B4~281 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=7435a76be7a6dd9f09c777b68a33024a2dc48867;p=emacs.git (font-lock-comment-start-skip): New variable. (font-lock-comment-end-skip): New variable. (font-lock-fontify-syntactically-region): Use them if non-nil. --- 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." ;;; Syntactic fontification functions. +(defvar font-lock-comment-start-skip nil + "If non-nil, Font Lock mode uses this instead of `comment-start-skip'.") + +(defvar font-lock-comment-end-skip nil + "If non-nil, Font Lock mode uses this instead of `comment-end'.") + (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 ((comment-end-regexp - (regexp-quote - (replace-regexp-in-string "^ *" "" comment-end))) + (or font-lock-comment-end-skip + (regexp-quote + (replace-regexp-in-string "^ *" "" comment-end)))) state face beg) (if loudly (message "Fontifying %s... (syntactically...)" (buffer-name))) (goto-char start) @@ -1334,12 +1341,14 @@ START should be at the beginning of a line." 'syntax-table)) (when face (put-text-property beg (point) 'face face)) (when (and (eq face 'font-lock-comment-face) - comment-start-skip) + (or font-lock-comment-start-skip + comment-start-skip)) ;; Find the comment delimiters ;; and use font-lock-comment-delimiter-face for them. (save-excursion (goto-char beg) - (if (looking-at comment-start-skip) + (if (looking-at (or font-lock-comment-start-skip + comment-start-skip)) (put-text-property beg (match-end 0) 'face font-lock-comment-delimiter-face))) (if (looking-back comment-end-regexp (point-at-bol))