[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: |
Mon, 24 Jan 2022 10:55:47 +0100 (CET) |
Jan 23, 2022, 19:58 by help-gnu-emacs@gnu.org:
Would sections [1] and [2] still be relevant in this code?
It includes the claim of not using `syntax-begin-function' and
that `font-lock-beginning-of-syntax-function' could be obsolete.
Have looked for `font-lock-beginning-of-syntax-function' but
could not find information of possible obsolescence.
(define-minor-mode rainbow-delimiters-minor-mode
"Colour Brace Marks according to their depth."
nil
"" ; exclude modeline indicator
nil
(font-lock-remove-keywords nil my-font-lock)
(when rainbow-delimiters-minor-mode
(font-lock-add-keywords nil rainbow-delimiters-font-lock 'append)
(set (make-local-variable 'jit-lock-contextually) t)
;; flush-cache to avoid old values when modifying `syntax-begin-function'
(when (or (bound-and-true-p syntax-begin-function)
(bound-and-true-p font-lock-beginning-of-syntax-function))
(syntax-ppss-flush-cache 0))
;; [1] 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))
;; [2] Obsolete equivalent of `syntax-begin-function'.
(when (boundp 'font-lock-beginning-of-syntax-function)
(set (make-local-variable
'font-lock-beginning-of-syntax-function) nil)) )
(when font-lock-mode
(if (fboundp 'font-lock-flush)
(font-lock-flush)
(with-no-warnings (font-lock-fontify-buffer)))))
- rainbow-delimiters-mode and syntax-begin-function, fatiparty, 2022/01/23
- Message not available
- rainbow-delimiters-mode, syntax-begin-function and font-lock-beginning-of-syntax-function,
fatiparty <=
- Re: rainbow-delimiters-mode, syntax-begin-function and font-lock-beginning-of-syntax-function, Stefan Monnier, 2022/01/24
- rainbow-delimiters-mode, syntax-begin-function and font-lock-beginning-of-syntax-function, fatiparty, 2022/01/25
- Re: rainbow-delimiters-mode, syntax-begin-function and font-lock-beginning-of-syntax-function, Stefan Monnier, 2022/01/25
- rainbow-delimiters-mode, syntax-begin-function and font-lock-beginning-of-syntax-function, fatiparty, 2022/01/25
- Re: rainbow-delimiters-mode, syntax-begin-function and font-lock-beginning-of-syntax-function, Stefan Monnier, 2022/01/25
- rainbow-delimiters-mode, syntax-begin-function and font-lock-beginning-of-syntax-function, fatiparty, 2022/01/25
- rainbow-delimiters-mode, syntax-begin-function and font-lock-beginning-of-syntax-function, fatiparty, 2022/01/25