From fd7b430afdd7ddea40cad7d231f634ff8bd536d8 Mon Sep 17 00:00:00 2001 From: Dmitry Gutov Date: Mon, 2 May 2016 02:38:01 +0300 Subject: [PATCH 1/4] `nreverse' Grep hits before passing them to xref--convert-hits * lisp/progmodes/xref.el (xref-collect-matches): `nreverse' hits before passing them to xref--convert-hits. Fixes a regression from cc0b7132. --- lisp/progmodes/xref.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/progmodes/xref.el b/lisp/progmodes/xref.el index f674c70b104..b5632af13ab 100644 --- a/lisp/progmodes/xref.el +++ b/lisp/progmodes/xref.el @@ -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' From 628053101d65749aecad5cc59d4dc0d0e7a8098d Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 2 May 2016 08:56:02 -0700 Subject: [PATCH 2/4] =?UTF-8?q?Don=E2=80=99t=20electrically=20quote=20?= =?UTF-8?q?=E2=80=98'=E2=80=99=20in=20Python?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 ab79943c9dd..e2896010405 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 ?\`) From 8f36614512d479fb76764bf013ad23550696c5a6 Mon Sep 17 00:00:00 2001 From: Philipp Stephani Date: Mon, 2 May 2016 08:57:30 -0700 Subject: [PATCH 3/4] Add electric-quote-string unit test * test/automated/electric-tests.el (electric-quote-string): New test. --- test/automated/electric-tests.el | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test/automated/electric-tests.el b/test/automated/electric-tests.el index 107b2e79fb6..afd707667b8 100644 --- a/test/automated/electric-tests.el +++ b/test/automated/electric-tests.el @@ -584,5 +584,13 @@ baz\"\"" (skip-chars-backward "\"") (mark-sexp -1))) + +;;; 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 From bf21c84f0d3dab33b4836098b789eaddf9492b2a Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Mon, 2 May 2016 10:06:04 -0700 Subject: [PATCH 4/4] Fix quoting problem in cc-engine debug message MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * lisp/progmodes/cc-engine.el (c-replay-parse-state-state): Use "%s" format to pass through ‘'’ unscathed (Bug#23425), and likewise for ‘`’, and ‘%’. --- lisp/progmodes/cc-engine.el | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 2010515ce5c..eb015acf320 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -3498,7 +3498,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)