aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoão Távora2014-04-07 00:09:19 +0100
committerJoão Távora2014-04-07 00:09:19 +0100
commit89f20f76d8fa700d2a534834bf178ac8796d35cf (patch)
tree8b3a2f1a6bd427320ddb303d69a25dfb87ba5b8a
parentaa5ccb01a59901cb15a25995b70a7f49d2b03b57 (diff)
downloademacs-89f20f76d8fa700d2a534834bf178ac8796d35cf.tar.gz
emacs-89f20f76d8fa700d2a534834bf178ac8796d35cf.zip
Fix electric-pair-skip-whitespace with quotes in text-mode
* lisp/elec-pair.el (electric-pair-post-self-insert-function): Don't skip whitespace for quote syntax when `electric-pair-text-pairs' and `electric-pair-pairs' were used. * test/automated/electric-tests.el (electric-pair-define-test-form): More readable test docstrings. (whitespace-skipping-for-quotes-not-ouside) (whitespace-skipping-for-quotes-only-inside) (whitespace-skipping-not-without-proper-syntax): Fixes: debbugs:17183
-rw-r--r--lisp/ChangeLog7
-rw-r--r--lisp/elec-pair.el10
-rw-r--r--test/ChangeLog8
-rw-r--r--test/automated/electric-tests.el29
4 files changed, 48 insertions, 6 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index b082670dc54..7d6436cfafc 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -1,3 +1,10 @@
12014-04-06 João Távora <joaotavora@gmail.com>
2
3 * elec-pair.el (electric-pair-post-self-insert-function): Don't
4 skip whitespace when `electric-pair-text-pairs' and
5 `electric-pair-pairs' were used. syntax to
6 electric-pair--skip-whitespace. (Bug#17183)
7
12014-04-06 Eli Zaretskii <eliz@gnu.org> 82014-04-06 Eli Zaretskii <eliz@gnu.org>
2 9
3 * leim/quail/ipa.el (ipa-x-sampa): Fix the character produced for 10 * leim/quail/ipa.el (ipa-x-sampa): Fix the character produced for
diff --git a/lisp/elec-pair.el b/lisp/elec-pair.el
index 52ad9bc0249..2c1ea7262d3 100644
--- a/lisp/elec-pair.el
+++ b/lisp/elec-pair.el
@@ -485,10 +485,12 @@ happened."
485 (funcall electric-pair-skip-self last-command-event) 485 (funcall electric-pair-skip-self last-command-event)
486 electric-pair-skip-self)) 486 electric-pair-skip-self))
487 (save-excursion 487 (save-excursion
488 (when (setq skip-whitespace-info 488 (when (and (not (and unconditional
489 (if (functionp electric-pair-skip-whitespace) 489 (eq syntax ?\")))
490 (funcall electric-pair-skip-whitespace) 490 (setq skip-whitespace-info
491 electric-pair-skip-whitespace)) 491 (if (functionp electric-pair-skip-whitespace)
492 (funcall electric-pair-skip-whitespace)
493 electric-pair-skip-whitespace)))
492 (electric-pair--skip-whitespace)) 494 (electric-pair--skip-whitespace))
493 (eq (char-after) last-command-event)))) 495 (eq (char-after) last-command-event))))
494 ;; This is too late: rather than insert&delete we'd want to only 496 ;; This is too late: rather than insert&delete we'd want to only
diff --git a/test/ChangeLog b/test/ChangeLog
index 5e5a8ae73af..846da9621fc 100644
--- a/test/ChangeLog
+++ b/test/ChangeLog
@@ -1,3 +1,11 @@
12014-04-06 João Távora <joaotavora@gmail.com>
2
3 * automated/electric-tests.el (electric-pair-define-test-form):
4 More readable test docstrings.
5 (whitespace-skipping-for-quotes-not-ouside)
6 (whitespace-skipping-for-quotes-only-inside)
7 (whitespace-skipping-for-quotes-in-text-mode): New tests.
8
12014-03-24 Barry O'Reilly <gundaetiapo@gmail.com> 92014-03-24 Barry O'Reilly <gundaetiapo@gmail.com>
2 10
3 * automated/undo-tests.el (undo-test-marker-adjustment-nominal): 11 * automated/undo-tests.el (undo-test-marker-adjustment-nominal):
diff --git a/test/automated/electric-tests.el b/test/automated/electric-tests.el
index e3ffd1abd2e..184a91f5105 100644
--- a/test/automated/electric-tests.el
+++ b/test/automated/electric-tests.el
@@ -114,8 +114,8 @@
114 mode 114 mode
115 extra-desc)) 115 extra-desc))
116 () 116 ()
117 ,(format "With \"%s\", try input %c at point %d. \ 117 ,(format "With |%s|, try input %c at point %d. \
118Should %s \"%s\" and point at %d" 118Should %s |%s| and point at %d"
119 fixture 119 fixture
120 char 120 char
121 (1+ pos) 121 (1+ pos)
@@ -341,6 +341,31 @@ Should %s \"%s\" and point at %d"
341 :test-in-code nil 341 :test-in-code nil
342 :test-in-comments t) 342 :test-in-comments t)
343 343
344(define-electric-pair-test whitespace-skipping-for-quotes-not-ouside
345 " \" \"" "\"-----" :expected-string "\"\" \" \""
346 :expected-point 2
347 :bindings '((electric-pair-skip-whitespace . chomp))
348 :test-in-strings nil
349 :test-in-code t
350 :test-in-comments nil)
351
352(define-electric-pair-test whitespace-skipping-for-quotes-only-inside
353 " \" \"" "---\"--" :expected-string " \"\""
354 :expected-point 5
355 :bindings '((electric-pair-skip-whitespace . chomp))
356 :test-in-strings nil
357 :test-in-code t
358 :test-in-comments nil)
359
360(define-electric-pair-test whitespace-skipping-quotes-not-without-proper-syntax
361 " \" \"" "---\"--" :expected-string " \"\"\" \""
362 :expected-point 5
363 :modes '(text-mode)
364 :bindings '((electric-pair-skip-whitespace . chomp))
365 :test-in-strings nil
366 :test-in-code t
367 :test-in-comments nil)
368
344 369
345;;; Pairing arbitrary characters 370;;; Pairing arbitrary characters
346;;; 371;;;