emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master a408697: `tex-insert-quote' after single `'' opens


From: João Távora
Subject: [Emacs-diffs] master a408697: `tex-insert-quote' after single `'' opens quotes instead of closing
Date: Sun, 26 Apr 2015 10:48:37 +0000

branch: master
commit a40869789fc5502e3d4e393b7c31d78cb7f29aa1
Author: João Távora <address@hidden>
Commit: João Távora <address@hidden>

    `tex-insert-quote' after single `'' opens quotes instead of closing
    
    Without this, it's very hard to precede double quotes with the
    apostrophe character, i.e. insert the sequence '``
    (quote-backquote-backquote), commonly useful in portuguese, for
    instance.
    
    * tex-mode.el (tex-insert-quote): Add ?' to the list of preceding
    chars making `tex-insert-quote' be in the "opening" context.
---
 lisp/textmodes/tex-mode.el |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/lisp/textmodes/tex-mode.el b/lisp/textmodes/tex-mode.el
index c26c609..274cb4a 100644
--- a/lisp/textmodes/tex-mode.el
+++ b/lisp/textmodes/tex-mode.el
@@ -1331,7 +1331,9 @@ inserts \" characters."
           (goto-char saved)
           (insert (if (> saved (mark)) tex-close-quote tex-open-quote)))
       (if (or (memq (char-syntax (preceding-char)) '(?\( ?> ?\s))
-              (memq (preceding-char) '(?~)))
+              (memq (preceding-char) '(?~ ?')))
+          ;; We're in an "opening" context
+          ;;
           (if electric-pair-mode
               (if (looking-at (regexp-quote tex-close-quote))
                   (forward-char (length tex-close-quote))
@@ -1339,6 +1341,8 @@ inserts \" characters."
                 (insert tex-close-quote)
                 (backward-char (length tex-close-quote)))
             (insert tex-open-quote))
+        ;; We're in a "closing" context.
+        ;;
         (if (looking-at (regexp-quote tex-close-quote))
             (forward-char (length tex-close-quote))
           (insert tex-close-quote))))))



reply via email to

[Prev in Thread] Current Thread [Next in Thread]