emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-25 6280531 1/2: Don’t electrically quote ‘'’ in Pyt


From: Paul Eggert
Subject: [Emacs-diffs] emacs-25 6280531 1/2: Don’t electrically quote ‘'’ in Python
Date: Mon, 02 May 2016 15:59:31 +0000

branch: emacs-25
commit 628053101d65749aecad5cc59d4dc0d0e7a8098d
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    Don’t electrically quote ‘'’ in Python
    
    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 |   11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/lisp/electric.el b/lisp/electric.el
index ab79943..e289601 100644
--- a/lisp/electric.el
+++ b/lisp/electric.el
@@ -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 ?\`)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]