Commit f07c325d authored by Philipp Stephani's avatar Philipp Stephani
Browse files

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.
parent 151496a4
......@@ -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
(and electric-quote-replace-double
(eq last-command-event ?\")))
(or (bobp) (bolp)
......@@ -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
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment