summaryrefslogtreecommitdiff
path: root/lisp/progmodes/python.el
diff options
context:
space:
mode:
authorStefan Monnier <monnier@iro.umontreal.ca>2013-08-26 22:41:41 -0400
committerStefan Monnier <monnier@iro.umontreal.ca>2013-08-26 22:41:41 -0400
commit9e89d835b04c20a8cd3dfad452fa827d675b0938 (patch)
treeb074830bb65218bfa455ad3a5d3fb89936f6c239 /lisp/progmodes/python.el
parent12c4970d70ae32fdcc81af55e1b2ff74afe96c93 (diff)
downloademacs-9e89d835b04c20a8cd3dfad452fa827d675b0938.tar.gz
* lisp/progmodes/python.el (python-font-lock-keywords): Don't return nil
from a matcher-function unless there's no more matches. Fixes: debbugs:15161
Diffstat (limited to 'lisp/progmodes/python.el')
-rw-r--r--lisp/progmodes/python.el29
1 files changed, 12 insertions, 17 deletions
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 01833ffd70b..7004836e69f 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -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