diff options
Diffstat (limited to 'lisp/font-lock.el')
-rw-r--r-- | lisp/font-lock.el | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/lisp/font-lock.el b/lisp/font-lock.el index c344a612581..c00a62a1607 100644 --- a/lisp/font-lock.el +++ b/lisp/font-lock.el @@ -312,6 +312,9 @@ If a number, only buffers greater than this size have fontification messages." (defvar font-lock-doc-face 'font-lock-doc-face "Face name to use for documentation.") +(defvar font-lock-doc-markup-face 'font-lock-doc-markup-face + "Face name to use for documentation mark-up.") + (defvar font-lock-keyword-face 'font-lock-keyword-face "Face name to use for keywords.") @@ -1120,6 +1123,18 @@ portion of the buffer." (funcall font-lock-ensure-function (or beg (point-min)) (or end (point-max))))) +(defun font-lock-update (&optional arg) + "Updates the syntax highlighting in this buffer. +Refontify the accessible portion of this buffer, or enable Font Lock mode +in this buffer if it is currently disabled. With prefix ARG, toggle Font +Lock mode." + (interactive "P") + (save-excursion + (if (and (not arg) font-lock-mode) + (font-lock-fontify-region (point-min) (point-max)) + (font-lock-unfontify-region (point-min) (point-max)) + (font-lock-mode 'toggle)))) + (defun font-lock-default-fontify-buffer () "Fontify the whole buffer using `font-lock-fontify-region-function'." (let ((verbose (if (numberp font-lock-verbose) @@ -1592,18 +1607,15 @@ START should be at the beginning of a line." "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'.") + "If non-nil, Font Lock mode uses this instead of `comment-end-skip'.") (defun font-lock-fontify-syntactically-region (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)) - (let ((comment-end-regexp - (or font-lock-comment-end-skip - (regexp-quote - (replace-regexp-in-string "^ *" "" comment-end)))) - ;; Find the `start' state. + (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) @@ -1636,7 +1648,9 @@ START should be at the beginning of a line." 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) + (if (looking-back (or font-lock-comment-end-skip + comment-end-skip) + (point-at-bol) t) (put-text-property (match-beginning 0) (point) 'face font-lock-comment-delimiter-face)))) (< (point) end)) @@ -1992,7 +2006,16 @@ Sets various variables using `font-lock-defaults' and (defface font-lock-doc-face '((t :inherit font-lock-string-face)) - "Font Lock mode face used to highlight documentation." + "Font Lock mode face used to highlight documentation embedded in program code. +It is typically used for special documentation comments or strings." + :group 'font-lock-faces) + +(defface font-lock-doc-markup-face + '((t :inherit font-lock-constant-face)) + "Font Lock mode face used to highlight embedded documentation mark-up. +It is meant for mark-up elements in text that uses `font-lock-doc-face', such +as the constructs of Haddock, Javadoc and similar systems." + :version "28.1" :group 'font-lock-faces) (defface font-lock-keyword-face |