]> git.eshelyaron.com Git - emacs.git/commitdiff
* lisp/progmodes/python.el (python-font-lock-keywords): Don't return nil
authorStefan Monnier <monnier@iro.umontreal.ca>
Tue, 27 Aug 2013 02:41:41 +0000 (22:41 -0400)
committerStefan Monnier <monnier@iro.umontreal.ca>
Tue, 27 Aug 2013 02:41:41 +0000 (22:41 -0400)
from a matcher-function unless there's no more matches.

Fixes: debbugs:15161
lisp/ChangeLog
lisp/progmodes/python.el

index 31538258bb64794804f9da428be348f47d985b92..b8351f11f619cad94e005952964e5f3105cffa37 100644 (file)
@@ -1,3 +1,8 @@
+2013-08-27  Stefan Monnier  <monnier@iro.umontreal.ca>
+
+       * progmodes/python.el (python-font-lock-keywords): Don't return nil
+       from a matcher-function unless there's no more matches (bug#15161).
+
 2013-08-26  Michael Albinus  <michael.albinus@gmx.de>
 
        * minibuffer.el: Revert change from 2013-08-20.
index 01833ffd70b7de903bf38aba36f2c7bad1b4c543..7004836e69f3f07479f0201fdb6ba05bcc59e4e2 100644 (file)
@@ -501,29 +501,24 @@ The type returned can be `comment', `string' or `paren'."
     (,(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