# HG changeset patch # User Richard M. Stallman # Date 782519644 0 # Node ID d352bebc910310a6b3f189707244629e0daec7a6 # Parent 134f7085c56b5f075da7ae6b611be0a8f64ab163 (font-lock-after-change-function): If inside a comment, don't scan for keywords. (font-lock-fontify-region): Discard leading spaces from comment-end. diff -r 134f7085c56b -r d352bebc9103 lisp/font-lock.el --- a/lisp/font-lock.el Tue Oct 18 21:53:19 1994 +0000 +++ b/lisp/font-lock.el Tue Oct 18 22:34:04 1994 +0000 @@ -337,7 +337,15 @@ (concat "\\s\"\\|" comment-start-skip) "\\s\"")) (cend (if comment-end - (concat "\\s>\\|" (regexp-quote comment-end)) + (concat "\\s>\\|" + (regexp-quote + ;; Discard leading spaces from comment-end. + ;; In C mode, it is " */" + ;; and we don't want to fail to notice a */ + ;; just because there's no space there. + (if (string-match "^ +" comment-end) + (substring comment-end (match-end 0)) + comment-end))) "\\s>")) (startline (point)) state prev prevstate) @@ -462,8 +470,12 @@ (if font-lock-no-comments (remove-text-properties beg end '(face nil)) (font-lock-fontify-region beg end)) - ;; Now scan for keywords. - (font-lock-hack-keywords beg end)))) + ;; Now scan for keywords, but not if we are inside a comment now. + (or (and (not font-lock-no-comments) + (let ((state (parse-partial-sexp beg end nil nil + font-lock-cache-state))) + (or (nth 4 state) (nth 7 state)))) + (font-lock-hack-keywords beg end))))) ;;; Fontifying arbitrary patterns