diff options
author | Kyle Meyer <kyle@kyleam.com> | 2020-02-21 00:42:38 -0500 |
---|---|---|
committer | Kyle Meyer <kyle@kyleam.com> | 2020-02-21 22:19:09 -0500 |
commit | 8e8db653aa3a1ddf0afd19f2eea8656ce6c76c61 (patch) | |
tree | 50bf2c33bdabddc215521d85ebbef0c394b0b4e2 /snakemake-mode.el | |
parent | 4d4be15415a4f592e67ce6237e493f22adff8ba6 (diff) | |
download | snakemake-mode-8e8db653aa3a1ddf0afd19f2eea8656ce6c76c61.tar.gz |
font-lock: Pull python-font-lock-keywords into snakemake's
This will make it easier to work around a change to
python-font-lock-keywords in Emacs 27.
Diffstat (limited to 'snakemake-mode.el')
-rw-r--r-- | snakemake-mode.el | 32 |
1 files changed, 17 insertions, 15 deletions
diff --git a/snakemake-mode.el b/snakemake-mode.el index 2c15e9e..7987304 100644 --- a/snakemake-mode.el +++ b/snakemake-mode.el @@ -431,20 +431,23 @@ embedded R, you need to set mmm-global-mode to a non-nil value such as 'maybe.") ;;; Mode +(defvar snakemake--font-lock-keywords + `((,snakemake-rule-or-subworkflow-re + (1 font-lock-keyword-face nil 'lax) + (2 font-lock-function-name-face nil 'lax) + (3 font-lock-keyword-face nil 'lax)) + (,(snakemake-rx line-start (one-or-more space) + (group field-key) + (zero-or-more space) ":") + 1 font-lock-type-face) + (,(snakemake-rx line-start (zero-or-more space) + (group sm-command) + (zero-or-more space) ":") + 1 font-lock-keyword-face) + (,(snakemake-rx (group sm-builtin)) 1 font-lock-builtin-face))) + (defvar snakemake-font-lock-keywords - `((,snakemake-rule-or-subworkflow-re - (1 font-lock-keyword-face nil 'lax) - (2 font-lock-function-name-face nil 'lax) - (3 font-lock-keyword-face nil 'lax)) - (,(snakemake-rx line-start (one-or-more space) - (group field-key) - (zero-or-more space) ":") - 1 font-lock-type-face) - (,(snakemake-rx line-start (zero-or-more space) - (group sm-command) - (zero-or-more space) ":") - 1 font-lock-keyword-face) - (,(snakemake-rx (group sm-builtin)) 1 font-lock-builtin-face))) + (append snakemake--font-lock-keywords python-font-lock-keywords)) ;;;###autoload (define-derived-mode snakemake-mode python-mode "Snakemake" @@ -462,8 +465,7 @@ embedded R, you need to set mmm-global-mode to a non-nil value such as 'maybe.") #'snakemake-block-or-defun-name) (set (make-local-variable 'font-lock-defaults) - (cons (append snakemake-font-lock-keywords python-font-lock-keywords) - (cdr font-lock-defaults)))) + (cons snakemake-font-lock-keywords (cdr font-lock-defaults)))) ;;;###autoload (add-to-list 'auto-mode-alist '("Snakefile\\'" . snakemake-mode)) |