diff options
| author | Stefan Monnier | 2010-11-08 13:56:10 -0500 |
|---|---|---|
| committer | Stefan Monnier | 2010-11-08 13:56:10 -0500 |
| commit | 73525e726cd917645950e185cbabafda00bc0635 (patch) | |
| tree | a1d9a980325462459c536250333fdaf580f2e921 /lisp | |
| parent | 05539fb32aabb9bf531b70b0ea549314e2446370 (diff) | |
| download | emacs-73525e726cd917645950e185cbabafda00bc0635.tar.gz emacs-73525e726cd917645950e185cbabafda00bc0635.zip | |
* lisp/progmodes/python.el (python-font-lock-syntactic-keywords):
Fix handling of backslash escapes.
(python-quote-syntax): Adjust accordingly.
Fixes: debbugs:7322
Diffstat (limited to 'lisp')
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/progmodes/python.el | 19 |
2 files changed, 11 insertions, 14 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 45066263c5e..0a38a9a6c9f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2010-11-08 Stefan Monnier <monnier@iro.umontreal.ca> | ||
| 2 | |||
| 3 | * progmodes/python.el (python-font-lock-syntactic-keywords): (bug#7322) | ||
| 4 | Fix handling of backslash escapes. | ||
| 5 | (python-quote-syntax): Adjust accordingly. | ||
| 6 | |||
| 1 | 2010-11-08 Richard Levitte <richard@levitte.org> (tiny patch) | 7 | 2010-11-08 Richard Levitte <richard@levitte.org> (tiny patch) |
| 2 | 8 | ||
| 3 | * vc-mtn.el (vc-mtn-working-revision, vc-mtn-after-dir-status) | 9 | * vc-mtn.el (vc-mtn-working-revision, vc-mtn-after-dir-status) |
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index ed2a3236be1..dba8fe5572b 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el | |||
| @@ -170,18 +170,9 @@ | |||
| 170 | ;; Make outer chars of matching triple-quote sequences into generic | 170 | ;; Make outer chars of matching triple-quote sequences into generic |
| 171 | ;; string delimiters. Fixme: Is there a better way? | 171 | ;; string delimiters. Fixme: Is there a better way? |
| 172 | ;; First avoid a sequence preceded by an odd number of backslashes. | 172 | ;; First avoid a sequence preceded by an odd number of backslashes. |
| 173 | `((,(rx (not (any ?\\)) | 173 | `((,(concat "\\(?:\\([RUru]\\)[Rr]?\\|^\\|[^\\]\\(?:\\\\.\\)*\\)" ;Prefix. |
| 174 | ?\\ (* (and ?\\ ?\\)) | 174 | "\\(?:\\('\\)'\\('\\)\\|\\(?2:\"\\)\"\\(?3:\"\\)\\)") |
| 175 | (group (syntax string-quote)) | 175 | (1 (python-quote-syntax 1) nil lax) |
| 176 | (backref 1) | ||
| 177 | (group (backref 1))) | ||
| 178 | (2 ,(string-to-syntax "\""))) ; dummy | ||
| 179 | (,(rx (group (optional (any "uUrR"))) ; prefix gets syntax property | ||
| 180 | (optional (any "rR")) ; possible second prefix | ||
| 181 | (group (syntax string-quote)) ; maybe gets property | ||
| 182 | (backref 2) ; per first quote | ||
| 183 | (group (backref 2))) ; maybe gets property | ||
| 184 | (1 (python-quote-syntax 1)) | ||
| 185 | (2 (python-quote-syntax 2)) | 176 | (2 (python-quote-syntax 2)) |
| 186 | (3 (python-quote-syntax 3))) | 177 | (3 (python-quote-syntax 3))) |
| 187 | ;; This doesn't really help. | 178 | ;; This doesn't really help. |
| @@ -219,9 +210,9 @@ Used for syntactic keywords. N is the match number (1, 2 or 3)." | |||
| 219 | (eval-when-compile (string-to-syntax "|")))))) | 210 | (eval-when-compile (string-to-syntax "|")))))) |
| 220 | ;; Consider property for initial char, accounting for prefixes. | 211 | ;; Consider property for initial char, accounting for prefixes. |
| 221 | ((or (and (= n 2) ; leading quote (not prefix) | 212 | ((or (and (= n 2) ; leading quote (not prefix) |
| 222 | (= (match-beginning 1) (match-end 1))) ; prefix is null | 213 | (not (match-end 1))) ; prefix is null |
| 223 | (and (= n 1) ; prefix | 214 | (and (= n 1) ; prefix |
| 224 | (/= (match-beginning 1) (match-end 1)))) ; non-empty | 215 | (match-end 1))) ; non-empty |
| 225 | (let ((font-lock-syntactic-keywords nil)) | 216 | (let ((font-lock-syntactic-keywords nil)) |
| 226 | (unless (eq 'string (syntax-ppss-context (syntax-ppss))) | 217 | (unless (eq 'string (syntax-ppss-context (syntax-ppss))) |
| 227 | (eval-when-compile (string-to-syntax "|"))))) | 218 | (eval-when-compile (string-to-syntax "|"))))) |