summaryrefslogtreecommitdiffstats
path: root/Misc
diff options
context:
space:
mode:
authorBarry Warsaw <barry@python.org>2000-10-27 05:00:25 (GMT)
committerBarry Warsaw <barry@python.org>2000-10-27 05:00:25 (GMT)
commit3c34bb33ff6e0f94aa0fb02fa575b3fae7f5ed09 (patch)
treee94d06c0ec69d382d7e4073bc91b3736daccdee0 /Misc
parent08a8a355bebc4905f0bbd211bed4f53294e0d7b2 (diff)
downloadcpython-3c34bb33ff6e0f94aa0fb02fa575b3fae7f5ed09.zip
cpython-3c34bb33ff6e0f94aa0fb02fa575b3fae7f5ed09.tar.gz
cpython-3c34bb33ff6e0f94aa0fb02fa575b3fae7f5ed09.tar.bz2
(py-goto-beginning-of-tqs): When searching backwards for the matching
delimiter, watch out for backslash escaped delimiters. Also use = instead of eq for character comparison (because a character is = to it's integer value, but not eq to it).
Diffstat (limited to 'Misc')
-rw-r--r--Misc/python-mode.el12
1 files changed, 8 insertions, 4 deletions
diff --git a/Misc/python-mode.el b/Misc/python-mode.el
index 8a059f5..332dff7 100644
--- a/Misc/python-mode.el
+++ b/Misc/python-mode.el
@@ -2864,12 +2864,16 @@ If nesting level is zero, return nil."
"Go to the beginning of the triple quoted string we find ourselves in.
DELIM is the TQS string delimiter character we're searching backwards
for."
- (let ((skip (and delim (make-string 1 delim))))
+ (let ((skip (and delim (make-string 1 delim)))
+ (continue t))
(when skip
(save-excursion
- (py-safe (search-backward skip))
- (if (and (eq (char-before) delim)
- (eq (char-before (1- (point))) delim))
+ (while continue
+ (py-safe (search-backward skip))
+ (setq continue (and (not (bobp))
+ (= (char-before) ?\\))))
+ (if (and (= (char-before) delim)
+ (= (char-before (1- (point))) delim))
(setq skip (make-string 3 delim))))
;; we're looking at a triple-quoted string
(py-safe (search-backward skip)))))