diff Misc/python-mode.el @ 15353:f480d52c0760 legacy-trunk

(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).
author Barry Warsaw <barry@python.org>
date Fri, 27 Oct 2000 05:00:25 +0000
parents 01ce89fc745f
children 8b4ca5da7dc2
line wrap: on
line diff
--- a/Misc/python-mode.el	Fri Oct 27 04:56:28 2000 +0000
+++ b/Misc/python-mode.el	Fri Oct 27 05:00:25 2000 +0000
@@ -2864,12 +2864,16 @@
   "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)))))