diff options
-rw-r--r-- | NEWS | 3 | ||||
-rw-r--r-- | snakemake-mode.el | 23 |
2 files changed, 24 insertions, 2 deletions
@@ -4,6 +4,9 @@ NEWS -- history of user-visible changes -*- mode: org; -*- - The 'multiext' built-in (new in Snakemake v5.8.2) is now recognized. +- The font-lock handling has been updated to be compatible with + python.el changes in Emacs 27. + * v1.6.0 - Checkpoints (new in Snakemake v5.4) are now recognized. diff --git a/snakemake-mode.el b/snakemake-mode.el index 7987304..255985c 100644 --- a/snakemake-mode.el +++ b/snakemake-mode.el @@ -446,8 +446,27 @@ embedded R, you need to set mmm-global-mode to a non-nil value such as 'maybe.") 1 font-lock-keyword-face) (,(snakemake-rx (group sm-builtin)) 1 font-lock-builtin-face))) -(defvar snakemake-font-lock-keywords - (append snakemake--font-lock-keywords python-font-lock-keywords)) +(if (bound-and-true-p python-font-lock-keywords-level-1) + (with-no-warnings + ;; In Emacs 27 `python-font-lock-keywords' was split up into + ;; different decoration levels. + (defvar snakemake-font-lock-keywords-level-1 + (append snakemake--font-lock-keywords + python-font-lock-keywords-level-1)) + (defvar snakemake-font-lock-keywords-level-2 + (append snakemake--font-lock-keywords + python-font-lock-keywords-level-2)) + (defvar snakemake-font-lock-keywords-maximum-decoration + (append snakemake--font-lock-keywords + python-font-lock-keywords-maximum-decoration)) + (defvar snakemake-font-lock-keywords + ;; Mirrors `python-font-lock-keywords'. + '(snakemake-font-lock-keywords-level-1 + snakemake-font-lock-keywords-level-1 + snakemake-font-lock-keywords-level-2 + snakemake-font-lock-keywords-maximum-decoration))) + (defvar snakemake-font-lock-keywords + (append snakemake--font-lock-keywords python-font-lock-keywords))) ;;;###autoload (define-derived-mode snakemake-mode python-mode "Snakemake" |