Function: font-lock-default-fontify-syntactically

font-lock-default-fontify-syntactically is a byte-compiled function defined in font-lock.el.gz.

Signature

(font-lock-default-fontify-syntactically START END &optional LOUDLY)

Documentation

Put proper face on each string and comment between START and END.

START should be at the beginning of a line.

Source Code

;; Defined in /usr/src/emacs/lisp/font-lock.el.gz
(defun font-lock-default-fontify-syntactically (start end &optional loudly)
  "Put proper face on each string and comment between START and END.
START should be at the beginning of a line."
  (syntax-propertize end)  ; Apply any needed syntax-table properties.
  (with-syntax-table (or syntax-ppss-table (syntax-table))
    (when (and comment-start (not comment-end-skip)) (comment-normalize-vars))
    (let (;; Find the `start' state.
          (state (if (or syntax-ppss-table
                         (not font-lock--syntax-table-affects-ppss))
                     (syntax-ppss start)
                   ;; If `syntax-ppss' doesn't have its own syntax-table and
                   ;; we have installed our own syntax-table which
                   ;; differs from the standard one in ways which affects PPSS,
                   ;; then we can't use `syntax-ppss' since that would pollute
                   ;; and be polluted by its cache.
                   (parse-partial-sexp (point-min) start)))
          face beg)
      (if loudly (message "Fontifying %s... (syntactically...)" (buffer-name)))
      ;;
      ;; Find each interesting place between here and `end'.
      (while
	  (progn
	    (when (or (nth 3 state) (nth 4 state))
	      (setq face (funcall font-lock-syntactic-face-function state))
	      (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 (and (eq face 'font-lock-comment-face)
                         (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 (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 (or font-lock-comment-end-skip
				      comment-end-skip)
                                  (line-beginning-position) t)
		    (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))))))