GNU bug report logs - #15161
24.3; python mode highlight annoyance

Previous Next

Package: emacs;

Reported by: Alexis Roda <alexis.roda.villalonga <at> gmail.com>

Date: Thu, 22 Aug 2013 15:46:01 UTC

Severity: minor

Found in version 24.3

Done: Stefan Monnier <monnier <at> iro.umontreal.ca>

Bug is archived. No further changes may be made.

Full log


Message #10 received at 15161-done <at> debbugs.gnu.org (full text, mbox):

From: Stefan Monnier <monnier <at> iro.umontreal.ca>
To: Alexis Roda <alexis.roda.villalonga <at> gmail.com>
Cc: "Fabián E. Gallina" <fabian <at> anue.biz>,
 15161-done <at> debbugs.gnu.org
Subject: Re: bug#15161: 24.3; python mode highlight annoyance
Date: Mon, 26 Aug 2013 22:42:39 -0400
> # a ==
> variable = "value"

> save, close and open the file again, the variable identifier isn't
> properly highlighted.

Thanks.  I installed the patch below which should fix it,


        Stefan


=== modified file 'lisp/progmodes/python.el'
--- lisp/progmodes/python.el	2013-08-16 05:15:51 +0000
+++ lisp/progmodes/python.el	2013-08-27 02:37:53 +0000
@@ -501,29 +501,24 @@
     (,(lambda (limit)
         (let ((re (python-rx (group (+ (any word ?. ?_)))
                              (? ?\[ (+ (not (any  ?\]))) ?\]) (* space)
-                             assignment-operator)))
-          (when (re-search-forward re limit t)
-            (while (and (python-syntax-context 'paren)
-                        (re-search-forward re limit t)))
-            (if (not (or (python-syntax-context 'paren)
-                         (equal (char-after (point-marker)) ?=)))
-                t
-              (set-match-data nil)))))
+                             assignment-operator))
+              (res nil))
+          (while (and (setq res (re-search-forward re limit t))
+                      (or (python-syntax-context 'paren)
+                          (equal (char-after (point-marker)) ?=))))
+          res))
      (1 font-lock-variable-name-face nil nil))
     ;; support for a, b, c = (1, 2, 3)
     (,(lambda (limit)
         (let ((re (python-rx (group (+ (any word ?. ?_))) (* space)
                              (* ?, (* space) (+ (any word ?. ?_)) (* space))
                              ?, (* space) (+ (any word ?. ?_)) (* space)
-                             assignment-operator)))
-          (when (and (re-search-forward re limit t)
-                     (goto-char (nth 3 (match-data))))
-            (while (and (python-syntax-context 'paren)
-                        (re-search-forward re limit t))
-              (goto-char (nth 3 (match-data))))
-            (if (not (python-syntax-context 'paren))
-                t
-              (set-match-data nil)))))
+                             assignment-operator))
+              (res nil))
+          (while (and (setq res (re-search-forward re limit t))
+                      (goto-char (match-end 1))
+                      (python-syntax-context 'paren)))
+          res))
      (1 font-lock-variable-name-face nil nil))))
 
 (defconst python-syntax-propertize-function





This bug report was last modified 11 years and 363 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.