all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* [PATCH] Fix a small bug in electric quoting.
@ 2017-12-31 17:06 Philipp Stephani
  2018-01-07 12:51 ` Philipp Stephani
  0 siblings, 1 reply; 2+ messages in thread
From: Philipp Stephani @ 2017-12-31 17:06 UTC (permalink / raw)
  To: emacs-devel; +Cc: Philipp Stephani

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 cee3562139..e277e2963d 100644
--- a/lisp/electric.el
+++ b/lisp/electric.el
@@ -501,7 +501,8 @@ electric-quote-post-self-insert-function
          (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 7df2449b9e..a8d3688a6d 100644
--- a/test/lisp/electric-tests.el
+++ b/test/lisp/electric-tests.el
@@ -735,6 +735,13 @@ electric-quote-replace-double-after-paren
   :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
-- 
2.15.1




^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] Fix a small bug in electric quoting.
  2017-12-31 17:06 [PATCH] Fix a small bug in electric quoting Philipp Stephani
@ 2018-01-07 12:51 ` Philipp Stephani
  0 siblings, 0 replies; 2+ messages in thread
From: Philipp Stephani @ 2018-01-07 12:51 UTC (permalink / raw)
  To: emacs-devel; +Cc: Philipp Stephani

[-- Attachment #1: Type: text/plain, Size: 312 bytes --]

Philipp Stephani <p.stephani2@gmail.com> schrieb am So., 31. Dez. 2017 um
18:07 Uhr:

> Before this commit, if 'electric-quote-replace-double' is non-nil,
> typing " '" turned into " ‘" even if
> 'electric-quote-context-sensitive' was nil.
>

No comments, so I've pushed this to master as f07c325d1f.

[-- Attachment #2: Type: text/html, Size: 642 bytes --]

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-01-07 12:51 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-31 17:06 [PATCH] Fix a small bug in electric quoting Philipp Stephani
2018-01-07 12:51 ` Philipp Stephani

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.