John Kitchin writes: >> (setq python-font-lock-keywords >> (append python-font-lock-keywords >> '(;; this is the full string. >> ;; group 1 is the quote type and a closing quote is matched >> ;; group 2 is the string part >> ( >> ;; "f\\(['\"]\\{1,3\\}\\)\\([^\\1]+?\\)\\1" >> "f\\(['\"]\\{1,3\\}\\)\\(.+?\\)\\1" >> ;; these are the {keywords} >> ("{[^}]*?}" >> ;; Pre-match form >> (progn (goto-char (match-beginning 0)) (match-end 0)) >> ;; Post-match form >> (goto-char (match-end 0)) >> ;; face for this match >> (0 font-lock-variable-name-face t))))))
> Does anyone see anything wrong with that snippet? All it should do is > improve font-lock on Python f-strings, and it used to work fine, but now it > doesn't. It isn't real critical for me, so I don't mind commenting it out, > but I neither understand why it stopped working! I haven't tested to confirm, but I'd guess that is due to the restructuring of python-font-lock-keywords in 36b64e087e (Add 'font-lock-maximum-decoration' levels for Python, 2018-07-19), which was included in Emacs 27. In case it's helpful, here's the compatibility kludge I used in snakemake-mode: https://git.kyleam.com/snakemake-mode/commit/snakemake-mode.el?id=5d5bb0109f6a84c0c191559ab71670fae4650e6a