From: Lars Ingebrigtsen Date: Wed, 30 Oct 2019 11:32:20 +0000 (+0100) Subject: Indent font-lock-fontify-syntactically-region X-Git-Tag: emacs-27.0.90~824 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=40c787ff4e9162d6f1a9a0abac3c83f1d0389810;p=emacs.git Indent font-lock-fontify-syntactically-region * lisp/font-lock.el (font-lock-fontify-syntactically-region): Indent function. --- diff --git a/lisp/font-lock.el b/lisp/font-lock.el index 3991a4ee8ef..9ae082736cc 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el @@ -1590,41 +1590,41 @@ START should be at the beginning of a line." 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)) - (let ((comment-end-regexp - (or font-lock-comment-end-skip - (regexp-quote - (replace-regexp-in-string "^ *" "" comment-end)))) - ;; Find the `start' state. - (state (syntax-ppss 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 comment-end-regexp (point-at-bol) 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)))))) + (let ((comment-end-regexp + (or font-lock-comment-end-skip + (regexp-quote + (replace-regexp-in-string "^ *" "" comment-end)))) + ;; Find the `start' state. + (state (syntax-ppss 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 comment-end-regexp (point-at-bol) 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)))))) ;;; End of Syntactic fontification functions.