]> git.eshelyaron.com Git - emacs.git/commitdiff
Don’t electrically quote ‘'’ in Python
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 2 May 2016 15:56:02 +0000 (08:56 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 2 May 2016 15:59:24 +0000 (08:59 -0700)
Problem reported by Philipp Stephani (Bug#23387).
* lisp/electric.el (electric-quote-post-self-insert-function):
Do not requote a string starter or ender.

lisp/electric.el

index ab79943c9dd92b150bf18067e16e2c2c9b44d1de..e2896010405e1665d50084ab369ef7cd4068111b 100644 (file)
@@ -444,10 +444,15 @@ This requotes when a quoting key is typed."
     (let ((start
            (if (and comment-start comment-use-syntax)
                (when (or electric-quote-comment electric-quote-string)
-                 (let ((syntax (syntax-ppss)))
-                   (and (or (and electric-quote-comment (nth 4 syntax))
+                 (let* ((syntax (syntax-ppss))
+                        (beg (nth 8 syntax)))
+                   (and beg
+                        (or (and electric-quote-comment (nth 4 syntax))
                             (and electric-quote-string (nth 3 syntax)))
-                        (nth 8 syntax))))
+                        ;; Do not requote a quote that starts or ends
+                        ;; a comment or string.
+                        (eq beg (nth 8 (save-excursion
+                                         (syntax-ppss (1- (point)))))))))
              (and electric-quote-paragraph
                   (derived-mode-p 'text-mode)
                   (or (eq last-command-event ?\`)