* rainbow-delimiters-mode and syntax-begin-function @ 2022-01-23 7:58 fatiparty--- via Users list for the GNU Emacs text editor [not found] ` <Mu4wPqh--3-2@tutanota.com-Mu4wX4B----2> 0 siblings, 1 reply; 9+ messages in thread From: fatiparty--- via Users list for the GNU Emacs text editor @ 2022-01-23 7:58 UTC (permalink / raw) To: Help Gnu Emacs I am going through (define-minor-mode rainbow-delimiters-mode There is for instance ;; 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)) ) What is this about? And how is one modifying `syntax-begin-function' ? ^ permalink raw reply [flat|nested] 9+ messages in thread
[parent not found: <Mu4wPqh--3-2@tutanota.com-Mu4wX4B----2>]
* rainbow-delimiters-mode, syntax-begin-function and font-lock-beginning-of-syntax-function [not found] ` <Mu4wPqh--3-2@tutanota.com-Mu4wX4B----2> @ 2022-01-24 9:55 ` fatiparty--- via Users list for the GNU Emacs text editor 2022-01-24 23:18 ` Stefan Monnier via Users list for the GNU Emacs text editor 0 siblings, 1 reply; 9+ messages in thread From: fatiparty--- via Users list for the GNU Emacs text editor @ 2022-01-24 9:55 UTC (permalink / raw) To: Fatiparty; +Cc: Help Gnu Emacs 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))))) ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: rainbow-delimiters-mode, syntax-begin-function and font-lock-beginning-of-syntax-function 2022-01-24 9:55 ` rainbow-delimiters-mode, syntax-begin-function and font-lock-beginning-of-syntax-function fatiparty--- via Users list for the GNU Emacs text editor @ 2022-01-24 23:18 ` Stefan Monnier via Users list for the GNU Emacs text editor 2022-01-25 8:46 ` fatiparty--- via Users list for the GNU Emacs text editor 0 siblings, 1 reply; 9+ messages in thread From: Stefan Monnier via Users list for the GNU Emacs text editor @ 2022-01-24 23:18 UTC (permalink / raw) To: help-gnu-emacs > 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 ^ permalink raw reply [flat|nested] 9+ messages in thread
* rainbow-delimiters-mode, syntax-begin-function and font-lock-beginning-of-syntax-function 2022-01-24 23:18 ` Stefan Monnier via Users list for the GNU Emacs text editor @ 2022-01-25 8:46 ` fatiparty--- via Users list for the GNU Emacs text editor 2022-01-25 13:04 ` Stefan Monnier 0 siblings, 1 reply; 9+ messages in thread From: fatiparty--- via Users list for the GNU Emacs text editor @ 2022-01-25 8:46 UTC (permalink / raw) To: Stefan Monnier; +Cc: Help Gnu Emacs 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))))) ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: rainbow-delimiters-mode, syntax-begin-function and font-lock-beginning-of-syntax-function 2022-01-25 8:46 ` fatiparty--- via Users list for the GNU Emacs text editor @ 2022-01-25 13:04 ` Stefan Monnier 2022-01-25 13:37 ` fatiparty--- via Users list for the GNU Emacs text editor 0 siblings, 1 reply; 9+ messages in thread From: Stefan Monnier @ 2022-01-25 13:04 UTC (permalink / raw) To: fatiparty; +Cc: Help Gnu Emacs fatiparty@tutanota.com [2022-01-25 09:46:35] wrote: > 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 >> % > 'syntax-begin-function' has also been declared obsolete. "Also" isn't quite right here: the above grep shows the other var has been *removed* which is different from being declared obsolete. > Would this mean that I can remove the following pieces It means those pieces of code only have an effect for packages that still use that obsolete variable. Whether you want to remove it or not is a choice I can't make for you. Stefan ^ permalink raw reply [flat|nested] 9+ messages in thread
* rainbow-delimiters-mode, syntax-begin-function and font-lock-beginning-of-syntax-function 2022-01-25 13:04 ` Stefan Monnier @ 2022-01-25 13:37 ` fatiparty--- via Users list for the GNU Emacs text editor 2022-01-25 13:55 ` Stefan Monnier 0 siblings, 1 reply; 9+ messages in thread From: fatiparty--- via Users list for the GNU Emacs text editor @ 2022-01-25 13:37 UTC (permalink / raw) To: Stefan Monnier; +Cc: Help Gnu Emacs Jan 26, 2022, 01:04 by monnier@iro.umontreal.ca: > fatiparty@tutanota.com [2022-01-25 09:46:35] wrote: > >> 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 >>> % >>> >> 'syntax-begin-function' has also been declared obsolete. >> In `etc/NEWS.25' there is the comment ** 'syntax-begin-function' is declared obsolete. I guess that if one stops using 'syntax-begin-function', it would help remove a dependency which would not be required in future. > "Also" isn't quite right here: the above grep shows the other var has > been *removed* which is different from being declared obsolete. > >> Would this mean that I can remove the following pieces >> > > It means those pieces of code only have an effect for packages that > still use that obsolete variable. Whether you want to remove it or not > is a choice I can't make for you. > > > Stefan > Right, if the version of emacs has `syntax-begin-function', then one could use that, as has been done. I am making a new version without calls to things that would, be obsolete, but without breaking the colouring functionality. There is a call to flush the cache `(syntax-ppss-flush-cache 0' with `(boundp 'syntax-begin-function)'. Would this still be necessary? ^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: rainbow-delimiters-mode, syntax-begin-function and font-lock-beginning-of-syntax-function 2022-01-25 13:37 ` fatiparty--- via Users list for the GNU Emacs text editor @ 2022-01-25 13:55 ` Stefan Monnier 2022-01-25 15:05 ` fatiparty--- via Users list for the GNU Emacs text editor 2022-01-25 15:12 ` fatiparty--- via Users list for the GNU Emacs text editor 0 siblings, 2 replies; 9+ messages in thread From: Stefan Monnier @ 2022-01-25 13:55 UTC (permalink / raw) To: fatiparty; +Cc: Help Gnu Emacs > Right, if the version of emacs has `syntax-begin-function', then one could use that, > as has been done. I am making a new version without calls to things that would, > be obsolete, but without breaking the colouring functionality. > > There is a call to flush the cache `(syntax-ppss-flush-cache 0' with > `(boundp 'syntax-begin-function)'. Would this still be necessary? I recommend you read a bit more to understand a bit what these things do (e.g. what does it mean for `syntax-begin-function` to be nil) because changing code which you don't understand at all is just not fun. Stefan ^ permalink raw reply [flat|nested] 9+ messages in thread
* rainbow-delimiters-mode, syntax-begin-function and font-lock-beginning-of-syntax-function 2022-01-25 13:55 ` Stefan Monnier @ 2022-01-25 15:05 ` fatiparty--- via Users list for the GNU Emacs text editor 2022-01-25 15:12 ` fatiparty--- via Users list for the GNU Emacs text editor 1 sibling, 0 replies; 9+ messages in thread From: fatiparty--- via Users list for the GNU Emacs text editor @ 2022-01-25 15:05 UTC (permalink / raw) To: Stefan Monnier; +Cc: Help Gnu Emacs Jan 26, 2022, 01:55 by monnier@iro.umontreal.ca: >> Right, if the version of emacs has `syntax-begin-function', then one could use that, >> as has been done. I am making a new version without calls to things that would, >> be obsolete, but without breaking the colouring functionality. >> >> There is a call to flush the cache `(syntax-ppss-flush-cache 0' with >> `(boundp 'syntax-begin-function)'. Would this still be necessary? >> > > I recommend you read a bit more to understand a bit what these things do > (e.g. what does it mean for `syntax-begin-function` to be nil) because > changing code which you don't understand at all is just not fun. > > Stefan > If I completely remove the section (in Emacs 27.2): (when (or (bound-and-true-p syntax-begin-function) (bound-and-true-p font-lock-beginning-of-syntax-function)) (syntax-ppss-flush-cache 0)) (when (boundp 'syntax-begin-function) (set (make-local-variable 'syntax-begin-function) nil)) (when (boundp 'font-lock-beginning-of-syntax-function) (set (make-local-variable 'font-lock-beginning-of-syntax-function) nil)) I don't see any obvious adverse effects. What was syntax-begin-function obsoleted in favour of? ^ permalink raw reply [flat|nested] 9+ messages in thread
* rainbow-delimiters-mode, syntax-begin-function and font-lock-beginning-of-syntax-function 2022-01-25 13:55 ` Stefan Monnier 2022-01-25 15:05 ` fatiparty--- via Users list for the GNU Emacs text editor @ 2022-01-25 15:12 ` fatiparty--- via Users list for the GNU Emacs text editor 1 sibling, 0 replies; 9+ messages in thread From: fatiparty--- via Users list for the GNU Emacs text editor @ 2022-01-25 15:12 UTC (permalink / raw) To: Stefan Monnier; +Cc: Help Gnu Emacs Jan 26, 2022, 01:55 by monnier@iro.umontreal.ca: >> Right, if the version of emacs has `syntax-begin-function', then one could use that, >> as has been done. I am making a new version without calls to things that would, >> be obsolete, but without breaking the colouring functionality. >> >> There is a call to flush the cache `(syntax-ppss-flush-cache 0' with >> `(boundp 'syntax-begin-function)'. Would this still be necessary? >> > > I recommend you read a bit more to understand a bit what these things do > (e.g. what does it mean for `syntax-begin-function` to be nil) because > changing code which you don't understand at all is just not fun. > > Stefan > syntax-begin-function is now always nil though. ^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2022-01-25 15:12 UTC | newest] Thread overview: 9+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2022-01-23 7:58 rainbow-delimiters-mode and syntax-begin-function fatiparty--- via Users list for the GNU Emacs text editor [not found] ` <Mu4wPqh--3-2@tutanota.com-Mu4wX4B----2> 2022-01-24 9:55 ` rainbow-delimiters-mode, syntax-begin-function and font-lock-beginning-of-syntax-function fatiparty--- via Users list for the GNU Emacs text editor 2022-01-24 23:18 ` Stefan Monnier via Users list for the GNU Emacs text editor 2022-01-25 8:46 ` fatiparty--- via Users list for the GNU Emacs text editor 2022-01-25 13:04 ` Stefan Monnier 2022-01-25 13:37 ` fatiparty--- via Users list for the GNU Emacs text editor 2022-01-25 13:55 ` Stefan Monnier 2022-01-25 15:05 ` fatiparty--- via Users list for the GNU Emacs text editor 2022-01-25 15:12 ` fatiparty--- via Users list for the GNU Emacs text editor
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.