bug-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

bug#41684: [PATCH] Highlight typed variables in python


From: Konstantin Kharlamov
Subject: bug#41684: [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






reply via email to

[Prev in Thread] Current Thread [Next in Thread]