--- Begin Message ---
Subject: |
[PATCH] Highlight typed variables in python |
Date: |
Wed, 3 Jun 2020 14:51:03 +0300 |
* progmodes/python.el (python-font-lock-keywords-maximum-decoration):
recognize typed variables like "foo: int = 1" as well.
---
Hello! This is the patch originally posted here
https://lists.gnu.org/archive/html/emacs-devel/2020-06/msg00033.html
I forgot in Emacs patches has to be sent to bugtracker. So here's the
resend.
lisp/progmodes/python.el | 1 +
1 file changed, 1 insertion(+)
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index ae5aff351c0..0263f4cc291 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -634,6 +634,7 @@ python-font-lock-keywords-maximum-decoration
(,(lambda (limit)
(let ((re (python-rx (group (+ (any word ?. ?_)))
(? ?\[ (+ (not (any ?\]))) ?\]) (* space)
+ (? ?: (* space) (+ (any word ?. ?_)) (* space))
;; a type, like " : int "
assignment-operator))
(res nil))
(while (and (setq res (re-search-forward re limit t))
--
2.26.2
--- End Message ---
--- Begin Message ---
Subject: |
Re: bug#41684: [PATCH] Highlight typed variables in python |
Date: |
Sat, 13 Jun 2020 10:35:34 +0300 |
> From: Konstantin Kharlamov <Hi-Angel@yandex.ru>
> Date: Wed, 3 Jun 2020 14:51:03 +0300
>
> * progmodes/python.el (python-font-lock-keywords-maximum-decoration):
> recognize typed variables like "foo: int = 1" as well.
> ---
Thanks, I installed this on the master branch.
For the future, please note a couple of minor stylistic nits:
. it is better to submit patches in "git format-patch" format, as
that makes it easier to apply the patch
. the description in the log message should start with a capital
letter after the function's name
. if a comment or a code line exceeds 80 columns, break them into
several lines
--- End Message ---