]> code.delx.au - gnu-emacs/commitdiff
Merge from origin/emacs-25
authorPaul Eggert <eggert@cs.ucla.edu>
Mon, 2 May 2016 17:46:53 +0000 (10:46 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Mon, 2 May 2016 17:46:53 +0000 (10:46 -0700)
bf21c84 Fix quoting problem in cc-engine debug message
8f36614 Add electric-quote-string unit test
6280531 Don’t electrically quote ‘'’ in Python
fd7b430 `nreverse' Grep hits before passing them to xref--convert-hits

lisp/electric.el
lisp/progmodes/cc-engine.el
lisp/progmodes/xref.el
test/lisp/electric-tests.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 ?\`)
index 76a0b201816743235973542e30ec6eb25b5e2aab..d19d2dacda12ab9d1c1a7e573763a9a16277a059 100644 (file)
@@ -3527,7 +3527,7 @@ comment at the start of cc-engine.el for more info."
           c-state-old-cpp-end
           c-parse-state-point))))
 (defun c-replay-parse-state-state ()
-  (message
+  (message "%s"
    (concat "(setq "
     (mapconcat
      (lambda (arg)
index f674c70b104c9ef0d3530d79cb10b9820d3e3f03..b5632af13abfe20896da48e3b5823ff841a4a1dc 100644 (file)
@@ -902,7 +902,7 @@ IGNORES is a list of glob patterns."
                     (match-string 1)
                     (buffer-substring-no-properties (point) (line-end-position)))
               hits)))
-    (xref--convert-hits hits regexp)))
+    (xref--convert-hits (nreverse hits) regexp)))
 
 (defun xref--rgrep-command (regexp files dir ignores)
   (require 'find-dired)      ; for `find-name-arg'
index 107b2e79fb61ed707b72d230c65f80191205c4d6..afd707667b8586352841f4f5206c3f5174dea4c4 100644 (file)
@@ -584,5 +584,13 @@ baz\"\""
                   (skip-chars-backward "\"")
                   (mark-sexp -1)))
 
+\f
+;;; Electric quotes
+(define-electric-pair-test electric-quote-string
+  "" "'" :expected-string "'" :expected-point 2
+  :fixture-fn #'electric-quote-local-mode
+  :bindings '((electric-quote-string . t))
+  :test-in-comments nil :test-in-strings nil)
+
 (provide 'electric-tests)
 ;;; electric-tests.el ends here