[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master f07c325: Fix a small bug in electric quoting.
From: |
Philipp Stephani |
Subject: |
[Emacs-diffs] master f07c325: Fix a small bug in electric quoting. |
Date: |
Sun, 7 Jan 2018 07:50:41 -0500 (EST) |
branch: master
commit f07c325d1f49e4b722f76aa730ac5d084bd0e77a
Author: Philipp Stephani <address@hidden>
Commit: Philipp Stephani <address@hidden>
Fix a small bug in electric quoting.
Before this commit, if 'electric-quote-replace-double' is non-nil,
typing " '" turned into " ‘" even if
'electric-quote-context-sensitive' was nil.
* lisp/electric.el (electric-quote-post-self-insert-function): Insert
context-sensitive double quote only if the last character is actually
a double quote character.
* test/lisp/electric-tests.el
(electric-quote-replace-double-no-context-single): New unit test.
---
lisp/electric.el | 3 ++-
test/lisp/electric-tests.el | 7 +++++++
2 files changed, 9 insertions(+), 1 deletion(-)
diff --git a/lisp/electric.el b/lisp/electric.el
index a694665..8343d8c 100644
--- a/lisp/electric.el
+++ b/lisp/electric.el
@@ -501,7 +501,8 @@ This requotes when a quoting key is typed."
(let ((backtick ?\`))
(if (or (eq last-command-event ?\`)
(and (or electric-quote-context-sensitive
- electric-quote-replace-double)
+ (and electric-quote-replace-double
+ (eq last-command-event ?\")))
(save-excursion
(backward-char)
(or (bobp) (bolp)
diff --git a/test/lisp/electric-tests.el b/test/lisp/electric-tests.el
index 83e0c67..44bdbc7 100644
--- a/test/lisp/electric-tests.el
+++ b/test/lisp/electric-tests.el
@@ -735,6 +735,13 @@ baz\"\""
:bindings '((electric-quote-replace-double . t))
:test-in-comments nil :test-in-strings nil)
+(define-electric-pair-test electric-quote-replace-double-no-context-single
+ " " "-'" :expected-string " ’" :expected-point 3
+ :modes '(text-mode)
+ :fixture-fn #'electric-quote-local-mode
+ :bindings '((electric-quote-replace-double . t))
+ :test-in-comments nil :test-in-strings nil)
+
;; Simulate ‘markdown-mode’: it sets both ‘comment-start’ and
;; ‘comment-use-syntax’, but derives from ‘text-mode’.
(define-electric-pair-test electric-quote-markdown-in-text
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master f07c325: Fix a small bug in electric quoting.,
Philipp Stephani <=