help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

rainbow-delimiters-mode, syntax-begin-function and font-lock-beginning-o


From: fatiparty
Subject: rainbow-delimiters-mode, syntax-begin-function and font-lock-beginning-of-syntax-function
Date: Tue, 25 Jan 2022 09:46:35 +0100 (CET)

Jan 25, 2022, 11:18 by help-gnu-emacs@gnu.org:

>> Have looked for `font-lock-beginning-of-syntax-function' but
>> could not find information of possible obsolescence.
>>
>
> % grep font-lock-beginning-of-syntax-function etc/NEWS*
>  etc/NEWS.19:font-lock-beginning-of-syntax-function and 
> font-lock-keywords-case-fold-search.
>  etc/NEWS.25:Removed 'font-lock-beginning-of-syntax-function' and the 
> SYNTAX-BEGIN
>  %
>
>
> -- Stefan
>


'syntax-begin-function' has also been declared obsolete.

Would this mean that I can remove the following pieces

  (when (bound-and-true-p syntax-begin-function)
       (syntax-ppss-flush-cache 0))
and

   (when (boundp 'syntax-begin-function)        (set (make-local-variable 
'syntax-begin-function) nil)) )


----

Code:

(define-minor-mode richerenkov-minor-mode
  "Colour Brace Marks according to their depth."
  nil
  ""   ; exclude modeline indicator
  nil 
  
  (font-lock-remove-keywords nil test-font-lock)

  (when test-minor-mode
    (font-lock-add-keywords nil test-font-lock 'append)
    (set (make-local-variable 'jit-lock-contextually) t)

    ;; flush-cache to avoid old values when modifying `syntax-begin-function'
    (when (bound-and-true-p syntax-begin-function)
      (syntax-ppss-flush-cache 0))

    ;; Don't use `syntax-begin-function', as it may break the
    ;; assumption that `syntax-ppss' is equivalent to
    ;; `parse-partial-sexp' from `point-min'.

    (when (boundp 'syntax-begin-function)
      (set (make-local-variable 'syntax-begin-function) nil)) )

  (when font-lock-mode
    (if (fboundp 'font-lock-flush)
        (font-lock-flush)
      (with-no-warnings (font-lock-fontify-buffer)))))






reply via email to

[Prev in Thread] Current Thread [Next in Thread]