unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] Enable customisation for electric-quote-mode chars
@ 2016-08-27 14:22 Göktuğ Kayaalp
  2016-08-27 14:38 ` Eli Zaretskii
  0 siblings, 1 reply; 49+ messages in thread
From: Göktuğ Kayaalp @ 2016-08-27 14:22 UTC (permalink / raw)
  To: emacs-devel; +Cc: self

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

This patch enables the user to decide which quote characters to use for
curved quotes.  Styles change from script to script and from language to
language, so it's nicer not to impose any one of the options (for
example in Italy and France ‘guillemets’ are used, which are («) and
(»), and in German speaking world („) and (“)).

I'm not subscribed to the -devel list, so please keep me in the CC;
thanks in advance.

-- 
İ. Göktuğ Kayaalp.
http://gkayaalp.com/


[-- Attachment #2: [PATCH] Enable customisation for electric-quote-mode chars --]
[-- Type: text/x-diff, Size: 3936 bytes --]

diff --git a/lisp/electric.el b/lisp/electric.el
index e289601..f748c55 100644
--- a/lisp/electric.el
+++ b/lisp/electric.el
@@ -425,6 +425,14 @@ The variable `electric-layout-rules' says when and how to insert newlines."
   :version "25.1"
   :type 'boolean :safe 'booleanp :group 'electricity)
 
+(defcustom electric-quote-chars '(?‘ ?’ ?“ ?”)
+  "List of characters to use as replacements for `electric-quote-mode'.
+
+The first and the second elements are single quotes, and the
+third and the fourth elements are double quotes."
+  :version "25.1"
+  :type 'list :safe 'listp :group 'electricity)
+
 (defcustom electric-quote-paragraph t
   "Non-nil means to use electric quoting in text paragraphs."
   :version "25.1"
@@ -441,7 +449,11 @@ The variable `electric-layout-rules' says when and how to insert newlines."
 This requotes when a quoting key is typed."
   (when (and electric-quote-mode
              (memq last-command-event '(?\' ?\`)))
-    (let ((start
+    (let ((q1 (car electric-quote-chars))
+          (q2 (cadr electric-quote-chars))
+          (q3 (caddr electric-quote-chars))
+          (q4 (cadddr electric-quote-chars))
+          (start
            (if (and comment-start comment-use-syntax)
                (when (or electric-quote-comment electric-quote-string)
                  (let* ((syntax (syntax-ppss))
@@ -460,27 +472,27 @@ This requotes when a quoting key is typed."
       (when start
         (save-excursion
           (if (eq last-command-event ?\`)
-              (cond ((and (electric--insertable-p "“")
+              (cond ((and (electric--insertable-p (string q3))
                           (search-backward "‘`" (- (point) 2) t))
-                     (replace-match "“")
+                     (replace-match (string q3))
                      (when (and electric-pair-mode
                                 (eq (cdr-safe
-                                     (assq ?‘ electric-pair-text-pairs))
+                                     (assq q1 electric-pair-text-pairs))
                                     (char-after)))
                        (delete-char 1))
-                     (setq last-command-event ?“))
-                    ((and (electric--insertable-p "‘")
+                     (setq last-command-event q3))
+                    ((and (electric--insertable-p (string q1))
                           (search-backward "`" (1- (point)) t))
-                     (replace-match "‘")
-                     (setq last-command-event ?‘)))
-            (cond ((and (electric--insertable-p "”")
+                     (replace-match (string q1))
+                     (setq last-command-event q1)))
+            (cond ((and (electric--insertable-p (string q4))
                         (search-backward "’'" (- (point) 2) t))
-                   (replace-match "”")
-                   (setq last-command-event ?”))
-                  ((and (electric--insertable-p "’")
+                   (replace-match (string q4))
+                   (setq last-command-event q4))
+                  ((and (electric--insertable-p (string q2))
                         (search-backward "'" (1- (point)) t))
-                   (replace-match "’")
-                   (setq last-command-event ?’)))))))))
+                   (replace-match (string q2))
+                   (setq last-command-event q2)))))))))
 
 (put 'electric-quote-post-self-insert-function 'priority 10)
 
@@ -497,6 +509,9 @@ and text paragraphs, and these are selectively controlled with
 `electric-quote-comment', `electric-quote-string', and
 `electric-quote-paragraph'.
 
+Customize `electric-quote-chars' in order to determine which
+quote characters to use.
+
 This is a global minor mode.  To toggle the mode in a single buffer,
 use `electric-quote-local-mode'."
   :global t :group 'electricity

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

* Re: [PATCH] Enable customisation for electric-quote-mode chars
  2016-08-27 14:22 [PATCH] Enable customisation for electric-quote-mode chars Göktuğ Kayaalp
@ 2016-08-27 14:38 ` Eli Zaretskii
  2016-08-27 15:23   ` Göktuğ Kayaalp
  0 siblings, 1 reply; 49+ messages in thread
From: Eli Zaretskii @ 2016-08-27 14:38 UTC (permalink / raw)
  To: Göktuğ Kayaalp; +Cc: emacs-devel

> From: Göktuğ Kayaalp <self@gkayaalp.com>
> Date: Sat, 27 Aug 2016 17:22:31 +0300
> Cc: self@gkayaalp.com
> 
> This patch enables the user to decide which quote characters to use for
> curved quotes.  Styles change from script to script and from language to
> language, so it's nicer not to impose any one of the options (for
> example in Italy and France ‘guillemets’ are used, which are («) and
> (»), and in German speaking world („) and (“)).

Thanks, but please include in the patch the necessary changes for
etc/NEWS and for the user manual.



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

* Re: [PATCH] Enable customisation for electric-quote-mode chars
  2016-08-27 14:38 ` Eli Zaretskii
@ 2016-08-27 15:23   ` Göktuğ Kayaalp
  2016-08-27 19:16     ` Paul Eggert
  0 siblings, 1 reply; 49+ messages in thread
From: Göktuğ Kayaalp @ 2016-08-27 15:23 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

On Cts, Ağu 27 2016 at 05:38:24 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>> From: Göktuğ Kayaalp <self@gkayaalp.com>
>> Date: Sat, 27 Aug 2016 17:22:31 +0300
>> Cc: self@gkayaalp.com
>> 
>> This patch enables the user to decide which quote characters to use for
>> curved quotes.  Styles change from script to script and from language to
>> language, so it's nicer not to impose any one of the options (for
>> example in Italy and France ‘guillemets’ are used, which are («) and
>> (»), and in German speaking world („) and (“)).
>
> Thanks, but please include in the patch the necessary changes for
> etc/NEWS and for the user manual.
>

You're welcome, I'll be able to send that in tomorrow, on this thread.

-- 
İ. Göktuğ Kayaalp.
http://gkayaalp.com/



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

* Re: [PATCH] Enable customisation for electric-quote-mode chars
  2016-08-27 15:23   ` Göktuğ Kayaalp
@ 2016-08-27 19:16     ` Paul Eggert
  2016-08-28  1:00       ` Göktuğ Kayaalp
  0 siblings, 1 reply; 49+ messages in thread
From: Paul Eggert @ 2016-08-27 19:16 UTC (permalink / raw)
  To: Göktuğ Kayaalp, Eli Zaretskii; +Cc: emacs-devel

Göktuğ Kayaalp wrote:
> You're welcome, I'll be able to send that in tomorrow, on this thread.

Thanks. Also, please change the argument of electric--insertable-p from string 
to character. This function is private so it's OK to change the API.



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

* Re: [PATCH] Enable customisation for electric-quote-mode chars
  2016-08-27 19:16     ` Paul Eggert
@ 2016-08-28  1:00       ` Göktuğ Kayaalp
  2016-08-29  1:55         ` Paul Eggert
  2016-08-29  2:33         ` [PATCH] Enable customisation for electric-quote-mode chars Eli Zaretskii
  0 siblings, 2 replies; 49+ messages in thread
From: Göktuğ Kayaalp @ 2016-08-28  1:00 UTC (permalink / raw)
  To: Paul Eggert; +Cc: eliz, emacs-devel

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


On  Sat, 27 Aug 2016 17:38:24 +0300, Eli Zaretskii <eliz@gnu.org> wrote:
> Thanks, but please include in the patch the necessary changes for
> etc/NEWS and for the user manual.

On Cts, Ağu 27 2016 at 12:16:39 PM, Paul Eggert <eggert@cs.ucla.edu> wrote:
> Göktuğ Kayaalp wrote:
>> You're welcome, I'll be able to send that in tomorrow, on this thread.
>
> Thanks. Also, please change the argument of electric--insertable-p from string 
> to character. This function is private so it's OK to change the API.

This new (attached) patch satisfies both of your requests, and fixes my
use of functions from cl.el.  ‘electric--insertable-p’ now accepts
either a string or a character, and makes a one-char string if given a
single character, as inside the function the argument is passed to
another function that needs a string.

On a side note, I guess the build system should require a certain
minimum version for the texinfo compiler (I only read info, so IDK which
program), as while the build goes fine with the default texinfo 4.8 on
my FreeBSD 10.3, the end result renders multibyte characters as octal
escape sequences (all okay when I installed 6.1 from ports).
‘doc/emacs/docstyle.texi’ from 25.1-rc2 has this:

    @c Emacs documentation style settings
    @documentencoding UTF-8
    @c These two require Texinfo 5.0 or later, so we use the older
    @c equivalent @set variables supported in 4.11 and hence

Build doesn't fail but says "unrecognised encoding UTF-8".

-- 
İ. Göktuğ Kayaalp.
http://gkayaalp.com/


[-- Attachment #2: updated patch --]
[-- Type: text/x-diff, Size: 6211 bytes --]

diff --git a/doc/emacs/text.texi b/doc/emacs/text.texi
index 579f788..ac899d6 100644
--- a/doc/emacs/text.texi
+++ b/doc/emacs/text.texi
@@ -412,6 +412,7 @@
 @cindex mode, Electric Quote
 @cindex curly quotes
 @cindex curved quotes
+@cindex guillemets
 @findex electric-quote-mode
   One common way to quote is the typewriter convention, which quotes
 using straight apostrophes @t{'like this'} or double-quotes @t{"like
@@ -436,7 +437,15 @@
 non-@code{nil}, and in programming-language strings if
 @code{electric-quote-string} is non-@code{nil}.  The default is
 @code{nil} for @code{electric-quote-string} and @code{t} for the other
-variables.
+variables.
+
+@vindex electric-quote-chars
+  By default @code{electric-quote-mode} inserts curvy double quotes,
+but it is possible to customize what characters are used.  The
+variable @code{electric-quote-chars} contains a list of four
+characters, where the first two are used for left single quotes, and
+the last two is used for double quotes.  This variable may be modified
+to determine what types of quote characters to use.
 
   Electric Quote mode is disabled by default.  To toggle it, type
 @kbd{M-x electric-quote-mode}.  To toggle it in a single buffer, use
diff --git a/etc/NEWS b/etc/NEWS
index 1290fa4..4746710 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -56,6 +56,11 @@
 * Changes in Emacs 25.2
 
 +++
+** The new user variable 'electric-quote-chars' provides a list
+of curvy quotes for 'electric-quote-mode', allowing user to choose
+the types of quotes to be used.
+
++++
 ** The new funtion 'call-shell-region' executes a command in an
 inferior shell with the buffer region as input.
 
diff --git a/lisp/electric.el b/lisp/electric.el
index e289601..0cd9e34 100644
--- a/lisp/electric.el
+++ b/lisp/electric.el
@@ -425,23 +425,38 @@
   :version "25.1"
   :type 'boolean :safe 'booleanp :group 'electricity)
 
+(defcustom electric-quote-chars '(?‘ ?’ ?“ ?”)
+  "List of characters to use as replacements for `electric-quote-mode'.
+
+The first and the second elements are single quotes, and the
+third and the fourth elements are double quotes."
+  :version "25.1"
+  :type 'list :safe 'listp :group 'electricity)
+
 (defcustom electric-quote-paragraph t
   "Non-nil means to use electric quoting in text paragraphs."
   :version "25.1"
   :type 'boolean :safe 'booleanp :group 'electricity)
 
-(defun electric--insertable-p (string)
-  (or (not buffer-file-coding-system)
-      (eq (coding-system-base buffer-file-coding-system) 'undecided)
-      (not (unencodable-char-position nil nil buffer-file-coding-system
-                                      nil string))))
+(defun electric--insertable-p (string-or-char)
+  (let ((str (if (characterp string-or-char)
+                 (string string-or-char)
+               string-or-char)))
+    (or (not buffer-file-coding-system)
+        (eq (coding-system-base buffer-file-coding-system) 'undecided)
+        (not (unencodable-char-position nil nil buffer-file-coding-system
+                                        nil str)))))
 
 (defun electric-quote-post-self-insert-function ()
   "Function that `electric-quote-mode' adds to `post-self-insert-hook'.
 This requotes when a quoting key is typed."
   (when (and electric-quote-mode
              (memq last-command-event '(?\' ?\`)))
-    (let ((start
+    (let ((q1 (nth 0 electric-quote-chars))
+          (q2 (nth 1 electric-quote-chars))
+          (q3 (nth 2 electric-quote-chars))
+          (q4 (nth 3 electric-quote-chars))
+          (start
            (if (and comment-start comment-use-syntax)
                (when (or electric-quote-comment electric-quote-string)
                  (let* ((syntax (syntax-ppss))
@@ -460,27 +475,27 @@
       (when start
         (save-excursion
           (if (eq last-command-event ?\`)
-              (cond ((and (electric--insertable-p "“")
+              (cond ((and (electric--insertable-p q3)
                           (search-backward "‘`" (- (point) 2) t))
-                     (replace-match "“")
+                     (replace-match (string q3))
                      (when (and electric-pair-mode
                                 (eq (cdr-safe
-                                     (assq ?‘ electric-pair-text-pairs))
+                                     (assq q1 electric-pair-text-pairs))
                                     (char-after)))
                        (delete-char 1))
-                     (setq last-command-event ?“))
-                    ((and (electric--insertable-p "‘")
+                     (setq last-command-event q3))
+                    ((and (electric--insertable-p q1)
                           (search-backward "`" (1- (point)) t))
-                     (replace-match "‘")
-                     (setq last-command-event ?‘)))
-            (cond ((and (electric--insertable-p "”")
+                     (replace-match (string q1))
+                     (setq last-command-event q1)))
+            (cond ((and (electric--insertable-p q4)
                         (search-backward "’'" (- (point) 2) t))
-                   (replace-match "”")
-                   (setq last-command-event ?”))
-                  ((and (electric--insertable-p "’")
+                   (replace-match (string q4))
+                   (setq last-command-event q4))
+                  ((and (electric--insertable-p q2)
                         (search-backward "'" (1- (point)) t))
-                   (replace-match "’")
-                   (setq last-command-event ?’)))))))))
+                   (replace-match (string q2))
+                   (setq last-command-event q2)))))))))
 
 (put 'electric-quote-post-self-insert-function 'priority 10)
 
@@ -497,6 +512,9 @@
 `electric-quote-comment', `electric-quote-string', and
 `electric-quote-paragraph'.
 
+Customize `electric-quote-chars' in order to determine which
+quote characters to use.
+
 This is a global minor mode.  To toggle the mode in a single buffer,
 use `electric-quote-local-mode'."
   :global t :group 'electricity

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

* Re: [PATCH] Enable customisation for electric-quote-mode chars
  2016-08-28  1:00       ` Göktuğ Kayaalp
@ 2016-08-29  1:55         ` Paul Eggert
  2016-08-29  5:28           ` Göktuğ Kayaalp
  2016-08-29 16:15           ` tarball builds (was: [PATCH] Enable customisation for electric-quote-mode chars) Stefan Monnier
  2016-08-29  2:33         ` [PATCH] Enable customisation for electric-quote-mode chars Eli Zaretskii
  1 sibling, 2 replies; 49+ messages in thread
From: Paul Eggert @ 2016-08-29  1:55 UTC (permalink / raw)
  To: Göktuğ Kayaalp; +Cc: eliz, emacs-devel

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

Göktuğ Kayaalp wrote:

> I guess the build system should require a certain
> minimum version for the texinfo compiler

It's a bit tricky as we don't want to require texinfo for ordinary installs. 
Probably worth documenting for Git builds, though. I added the attached.

> the default texinfo 4.8 on my FreeBSD 10.3,

4.8 is pretty old; I don't think we want to bother with porting to it.

> (all okay when I installed 6.1 from ports)

Yes, that's the way to go.

As for the patch itself:

* Part of the code still assumes English-style single quoting, and won't work if 
electric-quote-chars is set appropriately for (say) French. Look for instances 
of the two characters ‘ and ’ in the string constants. More generally, I'd look 
for any non-ASCII character in that file.

* The documentation should say "curved" rather than "curvy" for consistency with 
what's there now.

* The documentation is a bit sloppy about which quotes are used for what, e.g., 
"the first two are used for left single quotes" is not correct and the doc 
string is a bit hard to follow. For the documentation I suggest specifying the 
default value in the manual, as that should make it easier to explain the format 
of the variable.

* Perhaps use pcase instead of 4 calls to nth? It'd make the code easier to read.

* Finally, it's a nontrivial patch so I assume you're OK with assigning 
copyright to the FSF? If so, I can start the ball rolling on the paperwork for you.

Thanks again.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-INSTALL.REPO-Suggest-Texinfo-4.13-or-later.patch --]
[-- Type: text/x-diff; name="0001-INSTALL.REPO-Suggest-Texinfo-4.13-or-later.patch", Size: 934 bytes --]

From 90f4f206f2d687cb98e13810fe39f82a6bcd4937 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sun, 28 Aug 2016 18:23:25 -0700
Subject: [PATCH] * INSTALL.REPO: Suggest Texinfo 4.13 or later.

---
 INSTALL.REPO | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/INSTALL.REPO b/INSTALL.REPO
index 7497f1f..6fc9857 100644
--- a/INSTALL.REPO
+++ b/INSTALL.REPO
@@ -15,7 +15,7 @@ automake  - at least the version specified near the start of
 git - at least Git 1.7.1.  If your repository was created by an older
   Git version, you may need to reclone it.
 makeinfo  - not strictly necessary, but highly recommended, so that
-  you can build the manuals.
+  you can build the manuals.  GNU Texinfo 4.13 or later should work.
 
 To use the autotools, run the following shell command to generate the
 'configure' script and some related files, and to set up your git
-- 
2.7.4


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

* Re: [PATCH] Enable customisation for electric-quote-mode chars
  2016-08-28  1:00       ` Göktuğ Kayaalp
  2016-08-29  1:55         ` Paul Eggert
@ 2016-08-29  2:33         ` Eli Zaretskii
  1 sibling, 0 replies; 49+ messages in thread
From: Eli Zaretskii @ 2016-08-29  2:33 UTC (permalink / raw)
  To: Göktuğ Kayaalp; +Cc: eggert, emacs-devel

> From: Göktuğ Kayaalp <self@gkayaalp.com>
> Cc: eliz@gnu.org, emacs-devel@gnu.org
> Date: Sun, 28 Aug 2016 04:00:48 +0300
> 
> On a side note, I guess the build system should require a certain
> minimum version for the texinfo compiler (I only read info, so IDK which
> program)

The build process already does that: it requires Texinfo 4.7 ore
later.

> as while the build goes fine with the default texinfo 4.8 on
> my FreeBSD 10.3, the end result renders multibyte characters as octal
> escape sequences (all okay when I installed 6.1 from ports).
> ‘doc/emacs/docstyle.texi’ from 25.1-rc2 has this:
> 
>     @c Emacs documentation style settings
>     @documentencoding UTF-8
>     @c These two require Texinfo 5.0 or later, so we use the older
>     @c equivalent @set variables supported in 4.11 and hence
> 
> Build doesn't fail but says "unrecognised encoding UTF-8".

The only problem with that is that the produced Info files don't have
a coding cookie in them, so Emacs doesn't set up the decoding
correctly.  That's not a fatal problem, and doesn't cause trouble with
other Info readers, so I think we can still stick with 4.7.



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

* Re: [PATCH] Enable customisation for electric-quote-mode chars
  2016-08-29  1:55         ` Paul Eggert
@ 2016-08-29  5:28           ` Göktuğ Kayaalp
  2016-08-29  6:14             ` Paul Eggert
  2016-08-29 15:08             ` Eli Zaretskii
  2016-08-29 16:15           ` tarball builds (was: [PATCH] Enable customisation for electric-quote-mode chars) Stefan Monnier
  1 sibling, 2 replies; 49+ messages in thread
From: Göktuğ Kayaalp @ 2016-08-29  5:28 UTC (permalink / raw)
  To: Paul Eggert; +Cc: eliz, emacs-devel

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

On Paz, Ağu 28 2016 at 06:55:06 PM, Paul Eggert <eggert@cs.ucla.edu> wrote:
> Göktuğ Kayaalp wrote:
> [...]
>
> * Part of the code still assumes English-style single quoting, and won't work if 
> electric-quote-chars is set appropriately for (say) French. Look for instances 
> of the two characters ‘ and ’ in the string constants. More generally, I'd look 
> for any non-ASCII character in that file.
>
> * The documentation should say "curved" rather than "curvy" for consistency with 
> what's there now.
>
> * The documentation is a bit sloppy about which quotes are used for what, e.g., 
> "the first two are used for left single quotes" is not correct and the doc 
> string is a bit hard to follow. For the documentation I suggest specifying the 
> default value in the manual, as that should make it easier to explain the format 
> of the variable.
>
> * Perhaps use pcase instead of 4 calls to nth? It'd make the code easier to read.

All done, I hope that's okay to apply now.  The new patch is attached.
I'll try to improve it if need be.

> * Finally, it's a nontrivial patch so I assume you're OK with assigning 
> copyright to the FSF? If so, I can start the ball rolling on the paperwork for you.

Allright, I'm okay with that, please go ahead.  BTW I also have a patch
submitted recently to the bug-gnu-emacs@ for bug#24082, should I post it
here instead?

> Thanks again.

You're welcome, I'm glad if this is helpful.

-- 
İ. Göktuğ Kayaalp.
http://gkayaalp.com/


[-- Attachment #2: fixed patch --]
[-- Type: text/x-diff, Size: 7697 bytes --]

diff --git a/doc/emacs/text.texi b/doc/emacs/text.texi
index 579f788..74b68dd 100644
--- a/doc/emacs/text.texi
+++ b/doc/emacs/text.texi
@@ -412,6 +412,7 @@ beginning of a line.
 @cindex mode, Electric Quote
 @cindex curly quotes
 @cindex curved quotes
+@cindex guillemets
 @findex electric-quote-mode
   One common way to quote is the typewriter convention, which quotes
 using straight apostrophes @t{'like this'} or double-quotes @t{"like
@@ -420,11 +421,17 @@ left and right single or double quotation marks @t{‘like this’} or
 @t{“like this”}.  In text files, typewriter quotes are simple and
 portable; curved quotes are less ambiguous and typically look nicer.
 
+@vindex electric-quote-chars
   Electric Quote mode makes it easier to type curved quotes.  As you
 type characters it optionally converts @t{`} to @t{‘}, @t{'} to @t{’},
 @t{``} to @t{“}, and @t{''} to @t{”}.  These conversions are
 suppressed in buffers whose coding systems cannot represent curved
-quote characters.
+quote characters.  It's possible to change the default quotes listed
+above, by customizing the variable @code{electric-quote-chars}, a list
+of four characters, where the items correspond to the left single
+quote, the right single quote, the left double quote and the right
+double quote, respectively, whose default value is
+@code{'(?‘ ?’ ?“ ?”)}.
 
 @vindex electric-quote-paragraph
 @vindex electric-quote-comment
@@ -445,7 +452,10 @@ type @kbd{C-q `} or @kbd{C-q '} instead of @kbd{`} or @kbd{'}.  To
 insert a curved quote even when Electric Quote is disabled or
 inactive, you can type @kbd{C-x 8 [} for @t{‘}, @kbd{C-x 8 ]} for
 @t{’}, @kbd{C-x 8 @{} for @t{“}, and @kbd{C-x 8 @}} for @t{”}.
-@xref{Inserting Text}.
+@xref{Inserting Text}.  Note that the value of
+@code{electric-quote-chars} does not affect these keybindings, they
+are not keybindings of @code{electric-quote-mode} but bound in
+@code{global-map}.
 
 @node Filling
 @section Filling Text
diff --git a/etc/NEWS b/etc/NEWS
index 1290fa4..e7682fb 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -56,6 +56,11 @@ affected by this, as SGI stopped supporting IRIX in December 2013.
 * Changes in Emacs 25.2
 
 +++
+** The new user variable 'electric-quote-chars' provides a list
+of curved quotes for 'electric-quote-mode', allowing user to choose
+the types of quotes to be used.
+
++++
 ** The new funtion 'call-shell-region' executes a command in an
 inferior shell with the buffer region as input.
 
diff --git a/lisp/electric.el b/lisp/electric.el
index e289601..c0c4b47 100644
--- a/lisp/electric.el
+++ b/lisp/electric.el
@@ -425,16 +425,26 @@ The variable `electric-layout-rules' says when and how to insert newlines."
   :version "25.1"
   :type 'boolean :safe 'booleanp :group 'electricity)
 
+(defcustom electric-quote-chars '(?‘ ?’ ?“ ?”)
+  "Curved quote characters for `electric-quote-mode'.
+The items correspond to the left single quote, the right single
+quote, the left double quote, and the right double quote, respectively."
+  :version "25.1"
+  :type 'list :safe 'listp :group 'electricity)
+
 (defcustom electric-quote-paragraph t
   "Non-nil means to use electric quoting in text paragraphs."
   :version "25.1"
   :type 'boolean :safe 'booleanp :group 'electricity)
 
-(defun electric--insertable-p (string)
-  (or (not buffer-file-coding-system)
-      (eq (coding-system-base buffer-file-coding-system) 'undecided)
-      (not (unencodable-char-position nil nil buffer-file-coding-system
-                                      nil string))))
+(defun electric--insertable-p (string-or-char)
+  (let ((str (if (characterp string-or-char)
+                 (string string-or-char)
+               string-or-char)))
+    (or (not buffer-file-coding-system)
+        (eq (coding-system-base buffer-file-coding-system) 'undecided)
+        (not (unencodable-char-position nil nil buffer-file-coding-system
+                                        nil str)))))
 
 (defun electric-quote-post-self-insert-function ()
   "Function that `electric-quote-mode' adds to `post-self-insert-hook'.
@@ -457,30 +467,33 @@ This requotes when a quoting key is typed."
                   (derived-mode-p 'text-mode)
                   (or (eq last-command-event ?\`)
                       (save-excursion (backward-paragraph) (point)))))))
-      (when start
-        (save-excursion
-          (if (eq last-command-event ?\`)
-              (cond ((and (electric--insertable-p "“")
-                          (search-backward "‘`" (- (point) 2) t))
-                     (replace-match "“")
-                     (when (and electric-pair-mode
-                                (eq (cdr-safe
-                                     (assq ?‘ electric-pair-text-pairs))
-                                    (char-after)))
-                       (delete-char 1))
-                     (setq last-command-event ?“))
-                    ((and (electric--insertable-p "‘")
-                          (search-backward "`" (1- (point)) t))
-                     (replace-match "‘")
-                     (setq last-command-event ?‘)))
-            (cond ((and (electric--insertable-p "”")
-                        (search-backward "’'" (- (point) 2) t))
-                   (replace-match "”")
-                   (setq last-command-event ?”))
-                  ((and (electric--insertable-p "’")
-                        (search-backward "'" (1- (point)) t))
-                   (replace-match "’")
-                   (setq last-command-event ?’)))))))))
+      (pcase electric-quote-chars
+        (`(,q1 ,q2 ,q3 ,q4) 
+         (when start
+           (save-excursion
+             (if (eq last-command-event ?\`)
+                 (cond ((and (electric--insertable-p q3)
+                             (search-backward (string q1 ?`) (- (point) 2) t))
+                        (replace-match (string q3))
+                        (when (and electric-pair-mode
+                                   (eq (cdr-safe
+                                        (assq q1 electric-pair-text-pairs))
+                                       (char-after)))
+                          (delete-char 1))
+                        (setq last-command-event q3))
+                       ((and (electric--insertable-p q1)
+                             (search-backward "`" (1- (point)) t))
+                        (replace-match (string q1))
+                        (setq last-command-event q1)))
+               (cond ((and (electric--insertable-p q4)
+                           (search-backward (string q2 ?') (- (point) 2) t))
+                      (replace-match (string q4))
+                      (setq last-command-event q4))
+                     ((and (electric--insertable-p q2)
+                           (search-backward "'" (1- (point)) t))
+                      (replace-match (string q2))
+                      (setq last-command-event q2)))))))
+        (_ (error "‘electric-quote-chars’ must contain exactly 4 characters."))))))
 
 (put 'electric-quote-post-self-insert-function 'priority 10)
 
@@ -497,6 +510,9 @@ and text paragraphs, and these are selectively controlled with
 `electric-quote-comment', `electric-quote-string', and
 `electric-quote-paragraph'.
 
+Customize `electric-quote-chars' in order to use quote chars
+other than the ones listed here.
+
 This is a global minor mode.  To toggle the mode in a single buffer,
 use `electric-quote-local-mode'."
   :global t :group 'electricity

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

* Re: [PATCH] Enable customisation for electric-quote-mode chars
  2016-08-29  5:28           ` Göktuğ Kayaalp
@ 2016-08-29  6:14             ` Paul Eggert
  2016-10-05 18:53               ` Göktuğ Kayaalp
  2016-08-29 15:08             ` Eli Zaretskii
  1 sibling, 1 reply; 49+ messages in thread
From: Paul Eggert @ 2016-08-29  6:14 UTC (permalink / raw)
  To: Göktuğ Kayaalp; +Cc: eliz, emacs-devel

Göktuğ Kayaalp wrote:

> BTW I also have a patch
> submitted recently to the bug-gnu-emacs@ for bug#24082, should I post it
> here instead?

No, typically patches should be sent via bug-gnu-emacs.

> Allright, I'm okay with that, please go ahead.

Thanks, I'll follow up privately.




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

* Re: [PATCH] Enable customisation for electric-quote-mode chars
  2016-08-29  5:28           ` Göktuğ Kayaalp
  2016-08-29  6:14             ` Paul Eggert
@ 2016-08-29 15:08             ` Eli Zaretskii
  2016-08-29 15:54               ` Yuri Khan
  2016-08-29 16:27               ` Göktuğ Kayaalp
  1 sibling, 2 replies; 49+ messages in thread
From: Eli Zaretskii @ 2016-08-29 15:08 UTC (permalink / raw)
  To: Göktuğ Kayaalp; +Cc: eggert, emacs-devel

> From: Göktuğ Kayaalp <self@gkayaalp.com>
> Cc: eliz@gnu.org, emacs-devel@gnu.org
> Date: Mon, 29 Aug 2016 08:28:19 +0300
> 
> +@vindex electric-quote-chars
>    Electric Quote mode makes it easier to type curved quotes.  As you
>  type characters it optionally converts @t{`} to @t{‘}, @t{'} to @t{’},
>  @t{``} to @t{“}, and @t{''} to @t{”}.  These conversions are
>  suppressed in buffers whose coding systems cannot represent curved
> -quote characters.
> +quote characters.  It's possible to change the default quotes listed
> +above, by customizing the variable @code{electric-quote-chars}, a list
> +of four characters, where the items correspond to the left single
> +quote, the right single quote, the left double quote and the right
> +double quote, respectively, whose default value is
> +@code{'(?‘ ?’ ?“ ?”)}.

There's no need to go to such detail when describing a customizable
option.  The Customize interface should be enough for the user to
figure out what to do.

Which brings me to this:

> +(defcustom electric-quote-chars '(?‘ ?’ ?“ ?”)
> +  "Curved quote characters for `electric-quote-mode'.
> +The items correspond to the left single quote, the right single
> +quote, the left double quote, and the right double quote, respectively."
> +  :version "25.1"
> +  :type 'list :safe 'listp :group 'electricity)
> +

Making it a list with minimal explanations sounds like not very
user-friendly.  How about offering several ready out-of-the-box sets,
each one for some culture we know about?  We could also allow a raw
list, for the power users, but I think less advanced Emacs users will
appreciate something like

  Default (‘..’ “..”)
  Arabic (".." ”..“)
  German  (‚..‛ „..“)
  French (‹..› «..»)
  Cyrillic (‚..‘ «..»)

etc.  WDYT?  (See https://en.wikipedia.org/wiki/Quotation_mark for
some more.)

Thanks.



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

* Re: [PATCH] Enable customisation for electric-quote-mode chars
  2016-08-29 15:08             ` Eli Zaretskii
@ 2016-08-29 15:54               ` Yuri Khan
  2016-08-29 16:23                 ` Eli Zaretskii
  2016-08-29 16:27               ` Göktuğ Kayaalp
  1 sibling, 1 reply; 49+ messages in thread
From: Yuri Khan @ 2016-08-29 15:54 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Göktuğ Kayaalp, Paul Eggert, Emacs developers

On Mon, Aug 29, 2016 at 10:08 PM, Eli Zaretskii <eliz@gnu.org> wrote:

> Making it a list with minimal explanations sounds like not very
> user-friendly.  How about offering several ready out-of-the-box sets,
> each one for some culture we know about?

>   Default (‘..’ “..”)
>   Arabic (".." ”..“)
>   German  (‚..‛ „..“)
>   French (‹..› «..»)
>   Cyrillic (‚..‘ «..»)
>
> etc.  WDYT?  (See https://en.wikipedia.org/wiki/Quotation_mark for
> some more.)

Single quotes are exceedingly rare as quotation marks in Russian, and
likely Ukrainian and Belorussian. (I cannot speak for other Cyrillic
languages.) German-style „…“ or English-style “…” curved double quotes
are used as second level quotations.

On the other hand, I cannot see anyone expecting to get a double quote
by typing a character looking like a single quote.

On the third hand, the default Russian keyboard layout does not
contain any single-quote-like characters at all. (Unless you count the
comma.) A typographic assistance feature that requires two layout
switches per occurrence is not likely to see any significant use.



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

* tarball builds (was: [PATCH] Enable customisation for electric-quote-mode chars)
  2016-08-29  1:55         ` Paul Eggert
  2016-08-29  5:28           ` Göktuğ Kayaalp
@ 2016-08-29 16:15           ` Stefan Monnier
  2016-08-30 15:14             ` Eli Zaretskii
  2016-08-30 15:59             ` Paul Eggert
  1 sibling, 2 replies; 49+ messages in thread
From: Stefan Monnier @ 2016-08-29 16:15 UTC (permalink / raw)
  To: emacs-devel

> It's a bit tricky as we don't want to require texinfo for ordinary installs.

I wonder how important this is, tho.

I have the impression that nowadays it is at least as common to build
from Git as it is to build from the tarball.  And building from the
tarball will usually involve installing stuff anyway.
E.g. to build Emacs from the tarball in a "typical" GNU/Linux install,
a common recommendation is to do something like:

    apt-get build-deps emacs24

in which case, adding texinfo as a requirement is no big deal.

I have the impression that the same holds for Mac OS X and for Windows
(tho the tools involved are similar) where users also already have to
install a bunch of dependencies and "one more or one less" doesn't make
much difference because those dependencies are provided by a packaging
tool (Macport's, Mingw's, you name it).
[ Not sure about the FreeDOS case, OTOH.  ]

So I think we should consider getting rid (maybe progressively) of the
special tarball format, and just put a plain Git checkout in the
tarballs.  This will also simplify our general build procedure and
instructions since there'll only be one case to consider rather
than two.


        Stefan




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

* Re: [PATCH] Enable customisation for electric-quote-mode chars
  2016-08-29 15:54               ` Yuri Khan
@ 2016-08-29 16:23                 ` Eli Zaretskii
  0 siblings, 0 replies; 49+ messages in thread
From: Eli Zaretskii @ 2016-08-29 16:23 UTC (permalink / raw)
  To: Yuri Khan; +Cc: self, eggert, emacs-devel

> From: Yuri Khan <yuri.v.khan@gmail.com>
> Date: Mon, 29 Aug 2016 21:54:27 +0600
> Cc: Göktuğ Kayaalp <self@gkayaalp.com>, 
> 	Paul Eggert <eggert@cs.ucla.edu>, Emacs developers <emacs-devel@gnu.org>
> 
> >   Default (‘..’ “..”)
> >   Arabic (".." ”..“)
> >   German  (‚..‛ „..“)
> >   French (‹..› «..»)
> >   Cyrillic (‚..‘ «..»)
> >
> > etc.  WDYT?  (See https://en.wikipedia.org/wiki/Quotation_mark for
> > some more.)
> 
> Single quotes are exceedingly rare as quotation marks in Russian, and
> likely Ukrainian and Belorussian. (I cannot speak for other Cyrillic
> languages.) German-style „…“ or English-style “…” curved double quotes
> are used as second level quotations.
> 
> On the other hand, I cannot see anyone expecting to get a double quote
> by typing a character looking like a single quote.
> 
> On the third hand, the default Russian keyboard layout does not
> contain any single-quote-like characters at all. (Unless you count the
> comma.) A typographic assistance feature that requires two layout
> switches per occurrence is not likely to see any significant use.

I don't insist on the details, they were just intended to serve as
examples of what I meant, and need to be figured out before we
finalize the change.



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

* Re: [PATCH] Enable customisation for electric-quote-mode chars
  2016-08-29 15:08             ` Eli Zaretskii
  2016-08-29 15:54               ` Yuri Khan
@ 2016-08-29 16:27               ` Göktuğ Kayaalp
  2016-08-29 16:39                 ` Eli Zaretskii
  2016-08-29 17:30                 ` Paul Eggert
  1 sibling, 2 replies; 49+ messages in thread
From: Göktuğ Kayaalp @ 2016-08-29 16:27 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: eggert, emacs-devel

> From: Eli Zaretskii <eliz@gnu.org>
> Date: 2016-08-29 06:08:25 PM +0300
> Eli Zaretskii wrote:
>> From: Göktuğ Kayaalp <self@gkayaalp.com>
>> Cc: eliz@gnu.org, emacs-devel@gnu.org
>> Date: Mon, 29 Aug 2016 08:28:19 +0300

(I'm sorry for /borrowing/ your citation style, but it's very nice, I
couldn't refuse.  Hope that doesn't annoy you :)  I've made it a bit
different though.)

>> +@vindex electric-quote-chars
>>    Electric Quote mode makes it easier to type curved quotes.  As you
>>  type characters it optionally converts @t{`} to @t{‘}, @t{'} to @t{’},
>>  @t{``} to @t{“}, and @t{''} to @t{”}.  These conversions are
>>  suppressed in buffers whose coding systems cannot represent curved
>> -quote characters.
>> +quote characters.  It's possible to change the default quotes listed
>> +above, by customizing the variable @code{electric-quote-chars}, a list
>> +of four characters, where the items correspond to the left single
>> +quote, the right single quote, the left double quote and the right
>> +double quote, respectively, whose default value is
>> +@code{'(?‘ ?’ ?“ ?”)}.
>
> There's no need to go to such detail when describing a customizable
> option.  The Customize interface should be enough for the user to
> figure out what to do.

Then I can remove the part after reference to the variable name, and
improve the defcustom's documentation (see below).  Is that okay?

> Which brings me to this:
>
>> +(defcustom electric-quote-chars '(?‘ ?’ ?“ ?”)
>> +  "Curved quote characters for `electric-quote-mode'.
>> +The items correspond to the left single quote, the right single
>> +quote, the left double quote, and the right double quote, respectively."
>> +  :version "25.1"
>> +  :type 'list :safe 'listp :group 'electricity)
>> +
>
> Making it a list with minimal explanations sounds like not very
> user-friendly.  How about offering several ready out-of-the-box sets,
> each one for some culture we know about?  We could also allow a raw
> list, for the power users, but I think less advanced Emacs users will
> appreciate something like
>
>   Default (‘..’ “..”)
>   Arabic (".." ”..“)
>   German  (‚..‛ „..“)
>   French (‹..› «..»)
>   Cyrillic (‚..‘ «..»)
>
> etc.  WDYT?  (See https://en.wikipedia.org/wiki/Quotation_mark for
> some more.)

Well I think we'd rather not do that but improve the docstring instead,
because, looking at the big summary table on the page you linked [1]
there's not only a lot of variance among languages, but some of them
have multiple standard and alternative forms, and some don't have single
quotes (e.g. Persian).  I think we'd better keep the defaults and
improve the documentation, and not have implement all the languages nor
have to pick a subset.

Maybe we could leave setting these variables to the language environment
if that's possible?  Though I'm not familiar with that feature, but
maybe we apply this as is after I update the documentation and
developers of that feature would extend it as need appears.

Please direct me on how to proceed, and I'll update the patch as soon as
I can (I'll mail my copyright assignment tomorrow, which'll take one to
two weeks to arrive).  This is my first patch to Emacs, so I'm sorry if
I'm making newbie mistakes.

[1] https://en.wikipedia.org/wiki/Quotation_mark#Summary_table

> Thanks.
>

Best,
-goktug.

-- 
İ. Göktuğ Kayaalp.
http://gkayaalp.com/



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

* Re: [PATCH] Enable customisation for electric-quote-mode chars
  2016-08-29 16:27               ` Göktuğ Kayaalp
@ 2016-08-29 16:39                 ` Eli Zaretskii
  2016-08-29 17:19                   ` Göktuğ Kayaalp
  2016-08-29 17:30                 ` Paul Eggert
  1 sibling, 1 reply; 49+ messages in thread
From: Eli Zaretskii @ 2016-08-29 16:39 UTC (permalink / raw)
  To: Göktuğ Kayaalp; +Cc: eggert, emacs-devel

> From: Göktuğ Kayaalp <self@gkayaalp.com>
> Cc: eggert@cs.ucla.edu, emacs-devel@gnu.org
> Date: Mon, 29 Aug 2016 19:27:42 +0300
> 
> > From: Eli Zaretskii <eliz@gnu.org>
> > Date: 2016-08-29 06:08:25 PM +0300
> > Eli Zaretskii wrote:
> >> From: Göktuğ Kayaalp <self@gkayaalp.com>
> >> Cc: eliz@gnu.org, emacs-devel@gnu.org
> >> Date: Mon, 29 Aug 2016 08:28:19 +0300
> 
> (I'm sorry for /borrowing/ your citation style, but it's very nice, I
> couldn't refuse.  Hope that doesn't annoy you :)  I've made it a bit
> different though.)

It's not me, it's Rmail that's doing this.  (No, I'm not annoyed, of
course not.)

> >> +quote characters.  It's possible to change the default quotes listed
> >> +above, by customizing the variable @code{electric-quote-chars}, a list
> >> +of four characters, where the items correspond to the left single
> >> +quote, the right single quote, the left double quote and the right
> >> +double quote, respectively, whose default value is
> >> +@code{'(?‘ ?’ ?“ ?”)}.
> >
> > There's no need to go to such detail when describing a customizable
> > option.  The Customize interface should be enough for the user to
> > figure out what to do.
> 
> Then I can remove the part after reference to the variable name, and
> improve the defcustom's documentation (see below).  Is that okay?

Yes.

> >   Default (‘..’ “..”)
> >   Arabic (".." ”..“)
> >   German  (‚..‛ „..“)
> >   French (‹..› «..»)
> >   Cyrillic (‚..‘ «..»)
> >
> > etc.  WDYT?  (See https://en.wikipedia.org/wiki/Quotation_mark for
> > some more.)
> 
> Well I think we'd rather not do that but improve the docstring instead,
> because, looking at the big summary table on the page you linked [1]
> there's not only a lot of variance among languages, but some of them
> have multiple standard and alternative forms, and some don't have single
> quotes (e.g. Persian).  I think we'd better keep the defaults and
> improve the documentation, and not have implement all the languages nor
> have to pick a subset.

If no one else thinks my suggestion is a significant improvement, I
won't insist.  (And of course, we don't need to implement the entire
Wikipedia list, I'm not even sure it's accurate.)

It could be enough to mention some of the possibilities in the doc
string, together with their cultural affiliations.

> Maybe we could leave setting these variables to the language environment
> if that's possible?

I think it's too early for that, we haven't yet figured out how to set
up language dependent settings.  One problem with the idea you raise
is that a user can reside in a certain locale, but use universal
settings commonly used in multilingual environments.

> Please direct me on how to proceed, and I'll update the patch as soon as
> I can

I would suggest to wait for a couple of days for more comments.  If no
one supports my suggestions about language-tagged alternatives, you
can disregard them, and only make the documentation changes already
mentioned.

Thanks.



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

* Re: [PATCH] Enable customisation for electric-quote-mode chars
  2016-08-29 16:39                 ` Eli Zaretskii
@ 2016-08-29 17:19                   ` Göktuğ Kayaalp
  0 siblings, 0 replies; 49+ messages in thread
From: Göktuğ Kayaalp @ 2016-08-29 17:19 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: eggert, emacs-devel

> From: Eli Zaretskii <eliz@gnu.org>
> Date: 2016-08-29 07:39:32 PM +0300
> Eli Zaretskii wrote:
>> From: Göktuğ Kayaalp <self@gkayaalp.com>
>> Cc: eggert@cs.ucla.edu, emacs-devel@gnu.org
>> Date: Mon, 29 Aug 2016 19:27:42 +0300
>> 
>> > From: Eli Zaretskii <eliz@gnu.org>
>> > Date: 2016-08-29 06:08:25 PM +0300
>> > Eli Zaretskii wrote:
>> >> From: Göktuğ Kayaalp <self@gkayaalp.com>
>> >> Cc: eliz@gnu.org, emacs-devel@gnu.org
>> >> Date: Mon, 29 Aug 2016 08:28:19 +0300
>> 
>> (I'm sorry for /borrowing/ your citation style, but it's very nice, I
>> couldn't refuse.  Hope that doesn't annoy you :)  I've made it a bit
>> different though.)
>
> It's not me, it's Rmail that's doing this.  (No, I'm not annoyed, of
> course not.)

I use rmail too, but I had already my cit. line customized some time ago
when I used Gnus, so I didn't se this format until now.

I'll wait and follow the thread for at least a couple days for comments,
and if I don't have the chance earlier, I'll post an updated patch on
Saturday.

>> >> +quote characters.  It's possible to change the default quotes listed
>> >> +above, by customizing the variable @code{electric-quote-chars}, a list
>> >> +of four characters, where the items correspond to the left single
>> >> +quote, the right single quote, the left double quote and the right
>> >> +double quote, respectively, whose default value is
>> >> +@code{'(?‘ ?’ ?“ ?”)}.
>> >
>> > There's no need to go to such detail when describing a customizable
>> > option.  The Customize interface should be enough for the user to
>> > figure out what to do.
>> 
>> Then I can remove the part after reference to the variable name, and
>> improve the defcustom's documentation (see below).  Is that okay?
>
> Yes.
>
>> >   Default (‘..’ “..”)
>> >   Arabic (".." ”..“)
>> >   German  (‚..‛ „..“)
>> >   French (‹..› «..»)
>> >   Cyrillic (‚..‘ «..»)
>> >
>> > etc.  WDYT?  (See https://en.wikipedia.org/wiki/Quotation_mark for
>> > some more.)
>> 
>> Well I think we'd rather not do that but improve the docstring instead,
>> because, looking at the big summary table on the page you linked [1]
>> there's not only a lot of variance among languages, but some of them
>> have multiple standard and alternative forms, and some don't have single
>> quotes (e.g. Persian).  I think we'd better keep the defaults and
>> improve the documentation, and not have implement all the languages nor
>> have to pick a subset.
>
> If no one else thinks my suggestion is a significant improvement, I
> won't insist.  (And of course, we don't need to implement the entire
> Wikipedia list, I'm not even sure it's accurate.)
>
> It could be enough to mention some of the possibilities in the doc
> string, together with their cultural affiliations.
>
>> Maybe we could leave setting these variables to the language environment
>> if that's possible?
>
> I think it's too early for that, we haven't yet figured out how to set
> up language dependent settings.  One problem with the idea you raise
> is that a user can reside in a certain locale, but use universal
> settings commonly used in multilingual environments.
>
>> Please direct me on how to proceed, and I'll update the patch as soon as
>> I can
>
> I would suggest to wait for a couple of days for more comments.  If no
> one supports my suggestions about language-tagged alternatives, you
> can disregard them, and only make the documentation changes already
> mentioned.
>
> Thanks.
>

Best,
-goktug.

-- 
İ. Göktuğ Kayaalp.
http://gkayaalp.com/



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

* Re: [PATCH] Enable customisation for electric-quote-mode chars
  2016-08-29 16:27               ` Göktuğ Kayaalp
  2016-08-29 16:39                 ` Eli Zaretskii
@ 2016-08-29 17:30                 ` Paul Eggert
  2016-08-29 17:44                   ` Eli Zaretskii
  1 sibling, 1 reply; 49+ messages in thread
From: Paul Eggert @ 2016-08-29 17:30 UTC (permalink / raw)
  To: Göktuğ Kayaalp, Eli Zaretskii; +Cc: emacs-devel

Göktuğ Kayaalp wrote:
> Well I think we'd rather not do that but improve the docstring instead,
> because, looking at the big summary table on the page you linked [1]
> there's not only a lot of variance among languages, but some of them
> have multiple standard and alternative forms, and some don't have single
> quotes (e.g. Persian).

I tend to agree. Quoting styles are controversial in many languages. This is 
true even aside from choice of quote characters. For example in French « is 
widely agreed to be the left quote, but some follow it with a quarter-em space, 
some with a non-breaking space, some with an ordinary space, and some with no 
space at all.



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

* Re: [PATCH] Enable customisation for electric-quote-mode chars
  2016-08-29 17:30                 ` Paul Eggert
@ 2016-08-29 17:44                   ` Eli Zaretskii
  2016-08-29 18:43                     ` Paul Eggert
  0 siblings, 1 reply; 49+ messages in thread
From: Eli Zaretskii @ 2016-08-29 17:44 UTC (permalink / raw)
  To: Paul Eggert; +Cc: self, emacs-devel

> From: Paul Eggert <eggert@cs.ucla.edu>
> Date: Mon, 29 Aug 2016 10:30:30 -0700
> Cc: emacs-devel@gnu.org
> 
> Göktuğ Kayaalp wrote:
> > Well I think we'd rather not do that but improve the docstring instead,
> > because, looking at the big summary table on the page you linked [1]
> > there's not only a lot of variance among languages, but some of them
> > have multiple standard and alternative forms, and some don't have single
> > quotes (e.g. Persian).
> 
> I tend to agree. Quoting styles are controversial in many languages. This is 
> true even aside from choice of quote characters. For example in French « is 
> widely agreed to be the left quote, but some follow it with a quarter-em space, 
> some with a non-breaking space, some with an ordinary space, and some with no 
> space at all.

Then how about giving the various alternatives language-neutral names?

The important aspect, IMO, is to try to let the users select the
alternative they like without having to know how to type the quote
characters, something many users might find difficult.  If there are
no pre-cooked alternatives for them to choose from, they will actually
have to type each character, and as a Lisp list on top of that.  Don't
you think this is sub-optimal?



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

* Re: [PATCH] Enable customisation for electric-quote-mode chars
  2016-08-29 17:44                   ` Eli Zaretskii
@ 2016-08-29 18:43                     ` Paul Eggert
  2016-08-29 19:30                       ` Eli Zaretskii
  0 siblings, 1 reply; 49+ messages in thread
From: Paul Eggert @ 2016-08-29 18:43 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: self, emacs-devel

Eli Zaretskii wrote:
> The important aspect, IMO, is to try to let the users select the
> alternative they like without having to know how to type the quote
> characters

It would be reasonable to come up with an interface for that, perhaps listing 
the quoting styles and options. It's not clear that the UI should list languages 
too -- although that might help, the controversies might be more trouble than 
they're worth.

Out of curiosity, in good-quality Hebrew text do you prefer top-level quoting 
with " and " or with „ and “? (I'm writing left-to-right here; of course the 
quotes are reversed when displaying right-to-left.)



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

* Re: [PATCH] Enable customisation for electric-quote-mode chars
  2016-08-29 18:43                     ` Paul Eggert
@ 2016-08-29 19:30                       ` Eli Zaretskii
  2016-08-30 17:38                         ` Paul Eggert
  2016-09-01 18:56                         ` Göktuğ Kayaalp
  0 siblings, 2 replies; 49+ messages in thread
From: Eli Zaretskii @ 2016-08-29 19:30 UTC (permalink / raw)
  To: Paul Eggert; +Cc: self, emacs-devel

> Cc: self@gkayaalp.com, emacs-devel@gnu.org
> From: Paul Eggert <eggert@cs.ucla.edu>
> Date: Mon, 29 Aug 2016 11:43:47 -0700
> 
> Eli Zaretskii wrote:
> > The important aspect, IMO, is to try to let the users select the
> > alternative they like without having to know how to type the quote
> > characters
> 
> It would be reasonable to come up with an interface for that, perhaps listing 
> the quoting styles and options. It's not clear that the UI should list languages 
> too -- although that might help, the controversies might be more trouble than 
> they're worth.

We can come up with labels that don't reference languages.

> Out of curiosity, in good-quality Hebrew text do you prefer top-level quoting 
> with " and " or with „ and “?

The former, mostly, AFAIK.  Sometimes I see “this” (in the logical
order), but never „this“.  Wikipedia says „this”, but it's wrong, the
alternative variant is actually the primary one I see here almost
exclusively.



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

* Re: tarball builds (was: [PATCH] Enable customisation for electric-quote-mode chars)
  2016-08-29 16:15           ` tarball builds (was: [PATCH] Enable customisation for electric-quote-mode chars) Stefan Monnier
@ 2016-08-30 15:14             ` Eli Zaretskii
  2016-08-30 15:53               ` tarball builds Stefan Monnier
  2016-08-30 15:59             ` Paul Eggert
  1 sibling, 1 reply; 49+ messages in thread
From: Eli Zaretskii @ 2016-08-30 15:14 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

> From: Stefan Monnier <monnier@iro.umontreal.ca>
> Date: Mon, 29 Aug 2016 12:15:58 -0400
> 
> I have the impression that nowadays it is at least as common to build
> from Git as it is to build from the tarball.  And building from the
> tarball will usually involve installing stuff anyway.
> E.g. to build Emacs from the tarball in a "typical" GNU/Linux install,
> a common recommendation is to do something like:
> 
>     apt-get build-deps emacs24
> 
> in which case, adding texinfo as a requirement is no big deal.
> 
> I have the impression that the same holds for Mac OS X and for Windows
> (tho the tools involved are similar) where users also already have to
> install a bunch of dependencies and "one more or one less" doesn't make
> much difference because those dependencies are provided by a packaging
> tool (Macport's, Mingw's, you name it).

It's not "one more or one less", it would require Autoconf and
Automake as well, at least.  It will also make the build much longer:
the release tarball currently builds in about 30 sec, whereas a full
bootstrap takes 20 times that.



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

* Re: tarball builds
  2016-08-30 15:14             ` Eli Zaretskii
@ 2016-08-30 15:53               ` Stefan Monnier
  0 siblings, 0 replies; 49+ messages in thread
From: Stefan Monnier @ 2016-08-30 15:53 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: emacs-devel

>> I have the impression that nowadays it is at least as common to build
>> from Git as it is to build from the tarball.  And building from the
>> tarball will usually involve installing stuff anyway.
>> E.g. to build Emacs from the tarball in a "typical" GNU/Linux install,
>> a common recommendation is to do something like:
>>
>> apt-get build-deps emacs24
>>
>> in which case, adding texinfo as a requirement is no big deal.
>>
>> I have the impression that the same holds for Mac OS X and for Windows
>> (tho the tools involved are similar) where users also already have to
>> install a bunch of dependencies and "one more or one less" doesn't make
>> much difference because those dependencies are provided by a packaging
>> tool (Macport's, Mingw's, you name it).
> It's not "one more or one less", it would require Autoconf and
> Automake as well, at least.

It's not "one", indeed, but the idea stands: a single "apt-get
build-deps" will bring them all in, whether they're 5 packages or 100.

> It will also make the build much longer: the release tarball currently
> builds in about 30 sec, whereas a full bootstrap takes 20 times that.

That's true.  My impression is that it wouldn't matter, but that's just
a gut feeling backed by no evidence at all.


        Stefan



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

* Re: tarball builds
  2016-08-29 16:15           ` tarball builds (was: [PATCH] Enable customisation for electric-quote-mode chars) Stefan Monnier
  2016-08-30 15:14             ` Eli Zaretskii
@ 2016-08-30 15:59             ` Paul Eggert
  2016-08-30 17:00               ` Stefan Monnier
  1 sibling, 1 reply; 49+ messages in thread
From: Paul Eggert @ 2016-08-30 15:59 UTC (permalink / raw)
  To: Stefan Monnier, emacs-devel

Stefan Monnier wrote:
> I have the impression that the same holds for Mac OS X and for Windows

I don't use either OS, but I do still use Solaris 10 and the default installs on 
Solaris 10 (which is still shipping!) lack many developer tools like Autoconf.

I expect you're right that an "install from Git" approach would work for major 
distributors like Debian, or for Emacs developers. It's not so clear that it 
would work as well for people who want to install Emacs themselves because they 
want to try Emacs out on a less-common platform, or they want to use the latest 
version of Emacs when their distribution has an earlier version.



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

* Re: tarball builds
  2016-08-30 15:59             ` Paul Eggert
@ 2016-08-30 17:00               ` Stefan Monnier
  2016-08-30 17:58                 ` Paul Eggert
  0 siblings, 1 reply; 49+ messages in thread
From: Stefan Monnier @ 2016-08-30 17:00 UTC (permalink / raw)
  To: Paul Eggert; +Cc: emacs-devel

>> I have the impression that the same holds for Mac OS X and for Windows
> I don't use either OS, but I do still use Solaris 10 and the default
> installs on Solaris 10 (which is still shipping!) lack many developer tools
> like Autoconf.

But does it come with the other things we require (libgnutls, libpng, ...)?
If not, what steps are usually used to bring those dependencies?

If they're usually brought from some kind of package management system
like Fink/Macports/APT/RPM then adding more dependencies shouldn't make
much difference.

> because they want to try Emacs out on a less-common platform, or they want
> to use the latest version of Emacs when their distribution has an
> earlier version.

For GNU/Linux, as mentioned, compiling the latest is easy because you
just need a single command to bring in all the needed packages (no
matter how many there are).


        Stefan



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

* Re: [PATCH] Enable customisation for electric-quote-mode chars
  2016-08-29 19:30                       ` Eli Zaretskii
@ 2016-08-30 17:38                         ` Paul Eggert
  2016-08-30 17:49                           ` Eli Zaretskii
  2016-09-01 18:56                         ` Göktuğ Kayaalp
  1 sibling, 1 reply; 49+ messages in thread
From: Paul Eggert @ 2016-08-30 17:38 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: self, emacs-devel

Eli Zaretskii wrote:
> We can come up with labels that don't reference languages.

Yes, that sounds right.

>> > Out of curiosity, in good-quality Hebrew text do you prefer top-level quoting
>> > with " and " or with „ and “?
> The former, mostly, AFAIK.  Sometimes I see “this” (in the logical
> order), but never „this“.  Wikipedia says „this”, but it's wrong

Yes, and it's amusing that Wikipedia cites a source[1] that agrees with you! The 
source does say „this” style is used in traditional printing, so I guess it's a 
now-obsolescent style derived from German. The user who wants that style could 
simply choose it from the labels you mention.

Rambling a bit: it might be nice to have a Hebrew-oriented mode that makes it 
easy to type proper gershayim instead of " for the users who are picky about 
gershayim (are there any?). This is probably beyond the scope of electric-quote, 
though.

[1] http://hebrew-academy.org.il/topic/hahlatot/punctuation/



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

* Re: [PATCH] Enable customisation for electric-quote-mode chars
  2016-08-30 17:38                         ` Paul Eggert
@ 2016-08-30 17:49                           ` Eli Zaretskii
  2016-08-31 11:08                             ` Richard Stallman
  0 siblings, 1 reply; 49+ messages in thread
From: Eli Zaretskii @ 2016-08-30 17:49 UTC (permalink / raw)
  To: Paul Eggert; +Cc: self, emacs-devel

> Cc: self@gkayaalp.com, emacs-devel@gnu.org
> From: Paul Eggert <eggert@cs.ucla.edu>
> Date: Tue, 30 Aug 2016 10:38:44 -0700
> 
> > The former, mostly, AFAIK.  Sometimes I see “this” (in the logical
> > order), but never „this“.  Wikipedia says „this”, but it's wrong
> 
> Yes, and it's amusing that Wikipedia cites a source[1] that agrees with you!

I guess that's another indication that Wikipedia should be taken with
a grain of salt.

> Rambling a bit: it might be nice to have a Hebrew-oriented mode that makes it 
> easy to type proper gershayim instead of " for the users who are picky about 
> gershayim (are there any?). This is probably beyond the scope of electric-quote, 
> though.

Such usage is very rare IME.  Most people don't even know that
character exists.  It is not a quoting character, however.  You will
see that I used it in TUTORIAL.he, but mainly because it avoids the
mixed directionality problem, and I started using it after someone
pointed me to it.



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

* Re: tarball builds
  2016-08-30 17:00               ` Stefan Monnier
@ 2016-08-30 17:58                 ` Paul Eggert
  0 siblings, 0 replies; 49+ messages in thread
From: Paul Eggert @ 2016-08-30 17:58 UTC (permalink / raw)
  To: Stefan Monnier; +Cc: emacs-devel

Stefan Monnier wrote:
>>> I have the impression that the same holds for Mac OS X and for Windows
>> I don't use either OS, but I do still use Solaris 10 and the default
>> installs on Solaris 10 (which is still shipping!) lack many developer tools
>> like Autoconf.
>
> But does it come with the other things we require (libgnutls, libpng, ...)?

No.

> If not, what steps are usually used to bring those dependencies?

I usually just configure --without-gnutls, etc.

> If they're usually brought from some kind of package management system
> like Fink/Macports/APT/RPM then adding more dependencies shouldn't make
> much difference.

I often deal with systems where those packages must be installed by people with 
superuser privileges, which I lack. Sure, I can (and do) ask admins to install 
or upgrade stuff, but there's often a delay involved. The delays can often 
stretch for months, due to concerns that the changes may negatively affect other 
users. (That's life in the big-bureaucracy world....)

Also, traditional platforms like Solaris 10 don't have some of those packages, 
even as options. So as a user I would have to build and install them myself, 
which would be an obstacle.

> For GNU/Linux, as mentioned, compiling the latest is easy because you
> just need a single command to bring in all the needed packages (no
> matter how many there are).

If only things were that simple! Unfortunately:

1. The "single command" is distribution-dependent. You'd need a different 
command on Debian vs Fedora vs etc., and you might even need a different command 
on Fedora 23 vs Fedora 24. This sort of thing is OK for the Debian, Fedora, etc. 
distributors (they can maintain their prebuild scripts themselves) but it would 
be painful for us to maintain all this stuff upstream.

2. The needed developer packages can sometimes conflict. Just last week I ran 
into such a problem on Fedora 24 where the x86-64 and x86 packages conflicted 
with each other and I was thrust into dependency hell. I regularly run into such 
problems on Fedora, and it's understandable because developer package 
dependencies are not debugged as thoroughly.



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

* Re: [PATCH] Enable customisation for electric-quote-mode chars
  2016-08-30 17:49                           ` Eli Zaretskii
@ 2016-08-31 11:08                             ` Richard Stallman
  0 siblings, 0 replies; 49+ messages in thread
From: Richard Stallman @ 2016-08-31 11:08 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: self, eggert, emacs-devel

[[[ To any NSA and FBI agents reading my email: please consider    ]]]
[[[ whether defending the US Constitution against all enemies,     ]]]
[[[ foreign or domestic, requires you to follow Snowden's example. ]]]

  > > Yes, and it's amusing that Wikipedia cites a source[1] that agrees with you!

  > I guess that's another indication that Wikipedia should be taken with
  > a grain of salt.

You could fix it in Wikipedia.

-- 
Dr Richard Stallman
President, Free Software Foundation (gnu.org, fsf.org)
Internet Hall-of-Famer (internethalloffame.org)
Skype: No way! See stallman.org/skype.html.




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

* Re: [PATCH] Enable customisation for electric-quote-mode chars
  2016-08-29 19:30                       ` Eli Zaretskii
  2016-08-30 17:38                         ` Paul Eggert
@ 2016-09-01 18:56                         ` Göktuğ Kayaalp
  2016-09-01 19:15                           ` Paul Eggert
  1 sibling, 1 reply; 49+ messages in thread
From: Göktuğ Kayaalp @ 2016-09-01 18:56 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: eggert, emacs-devel

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

> From: Eli Zaretskii <eliz@gnu.org>
> Date: 2016-08-29 10:30:01 PM +0300
> Eli Zaretskii wrote:
>
>> Cc: self@gkayaalp.com, emacs-devel@gnu.org
>> From: Paul Eggert <eggert@cs.ucla.edu>
>> Date: Mon, 29 Aug 2016 11:43:47 -0700
>> 
>> Eli Zaretskii wrote:
>> > The important aspect, IMO, is to try to let the users select the
>> > alternative they like without having to know how to type the quote
>> > characters
>> 
>> It would be reasonable to come up with an interface for that, perhaps listing 
>> the quoting styles and options. It's not clear that the UI should list languages 
>> too -- although that might help, the controversies might be more trouble than 
>> they're worth.
>
> We can come up with labels that don't reference languages.

If this is agreed upon (I think this would be the better approach
myself), I can update the patch in the weekend.  These are the most
eminent styles I found:

                     +-------------------+---------+
                     | label             | quotes  |
                     +-------------------+---------+
                     | curved69          | “‘’”    |
                     | curved99          | ”’’”    |
                     | guillemets        | «‹›»    |
                     | guillemets+curved | «“”»    |
                     | guillemets+lo9hi6 | «„“»    |
                     | reverseguillemets | »›‹«    |
                     | lo9hi6            | „‚‘“    |
                     | lo9hi9            | „‚’”    |
                     | japan             | 「『』」 |
                     | korean            | 《〈〉》 |
                     +-------------------+---------+
                        table 1: various frequent
                            quoting styles.
                     
Looking at the relevant section previously-referenced Wikipedia
article [1], these are the ones that appear the most frequently, except
the last two, which proper of their respective languages.  I felt the
incentive to include them as they were the most unique ones, but maybe
they're unnecessary if the respective keyboards for the languages allow
typing them easily (IDK, please comment).  I also lack knowledge of and
experience with right-to-left writing systems, so I'd appreciate advice
on that too.

[1] https://en.wikipedia.org/wiki/Quotation_mark#Quotation_marks_in_English

Best,
-gk.

-- 
İ. Göktuğ Kayaalp.
http://gkayaalp.com/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

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

* Re: [PATCH] Enable customisation for electric-quote-mode chars
  2016-09-01 18:56                         ` Göktuğ Kayaalp
@ 2016-09-01 19:15                           ` Paul Eggert
  2016-09-01 21:13                             ` Göktuğ Kayaalp
  0 siblings, 1 reply; 49+ messages in thread
From: Paul Eggert @ 2016-09-01 19:15 UTC (permalink / raw)
  To: Göktuğ Kayaalp; +Cc: Eli Zaretskii, emacs-devel

Göktuğ Kayaalp wrote:
>                      +-------------------+---------+
>                      | label             | quotes  |
>                      +-------------------+---------+
>                      | curved69          | “‘’”    |
>                      | curved99          | ”’’”    |
>                      | guillemets        | «‹›»    |
>                      | guillemets+curved | «“”»    |
>                      | guillemets+lo9hi6 | «„“»    |
>                      | reverseguillemets | »›‹«    |
>                      | lo9hi6            | „‚‘“    |
>                      | lo9hi9            | „‚’”    |
>                      | japan             | 「『』」 |
>                      | korean            | 《〈〉》 |
>                      +-------------------+---------+

Thanks for cataloging these, but why bother with inventing names? Just use the 
"quotes" column as the label. That's more intuitive.

If we must use names I suggest "angle" over "guillemets" as it's too easy to 
misspell "guillemets".

The "japan" entry has single- and double-quotes interchanged.

I would avoid labels like "japan" or "korean". In Korea the abovementioned 
quotation style is not common (and the common style differs in North vs South 
Korea -- we really don't want to get into that mess!).

Not sure what to do about require spaces in some languages; perhaps an 
independent setting?

> maybe
> they're unnecessary if the respective keyboards for the languages allow
> typing them easily (IDK, please comment)

Typically CJK keyboards do not contain those sorts of quote characters. I assume 
they can be entered more-awkwardly via input methods but do not know the details.




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

* Re: [PATCH] Enable customisation for electric-quote-mode chars
  2016-09-01 19:15                           ` Paul Eggert
@ 2016-09-01 21:13                             ` Göktuğ Kayaalp
  2016-09-01 21:30                               ` Paul Eggert
  0 siblings, 1 reply; 49+ messages in thread
From: Göktuğ Kayaalp @ 2016-09-01 21:13 UTC (permalink / raw)
  To: Paul Eggert; +Cc: eliz, emacs-devel

> From: Paul Eggert <eggert@cs.ucla.edu>
> Date: 2016-09-01 12:15:53 PM -0700
> Paul Eggert wrote:
>
> Göktuğ Kayaalp wrote:
>>                      +-------------------+---------+
>>                      | label             | quotes  |
>>                      +-------------------+---------+
>>                      | curved69          | “‘’”    |
>>                      | curved99          | ”’’”    |
>>                      | guillemets        | «‹›»    |
>>                      | guillemets+curved | «“”»    |
>>                      | guillemets+lo9hi6 | «„“»    |
>>                      | reverseguillemets | »›‹«    |
>>                      | lo9hi6            | „‚‘“    |
>>                      | lo9hi9            | „‚’”    |
>>                      | japan             | 「『』」 |
>>                      | korean            | 《〈〉》 |
>>                      +-------------------+---------+
>
> Thanks for cataloging these, but why bother with inventing names? Just use the 
> "quotes" column as the label. That's more intuitive.

Fair.  I was thinking of an alist

    (defvar electric-quotes-predefined-styles '((label . (quotes))...))

in my head.  I also think of renaming the variable
‘electric-quotes-chars’ to ‘electric-quotes-style’, as that's a bit more
intuitive.  Comments?

> If we must use names I suggest "angle" over "guillemets" as it's too easy to 
> misspell "guillemets".
>
> The "japan" entry has single- and double-quotes interchanged.

Sure? I got that straight out of the linked wiki page.  Though I'm
quite unfamiliar with Japanese.

> I would avoid labels like "japan" or "korean". In Korea the abovementioned 
> quotation style is not common (and the common style differs in North vs South 
> Korea -- we really don't want to get into that mess!).

Avoiding labels altogether would solve this.

> Not sure what to do about require spaces in some languages; perhaps an 
> independent setting?

I don't think the space count as part of the quotation, but it be a
different part of general punctuation.  So I believe it's out of the
scope of this minor mode.  However maybe we can have a separate
‘electric-punctuation-mode’ which would add these NBSP to where it may
be required according to a defined style, as their use is not
limited to quotation:

,----
|  It is [...] required for big punctuation in French, [...] (before
|  " ; ? ! » › " and after " « ‹ "; today often also before " : ") and
|  Russian (before " — "), and in German between multi-part abbreviations
|  (z. B., d. h., v. l. n. r.).
`---- https://en.wikipedia.org/wiki/Non-breaking_space


>> maybe
>> they're unnecessary if the respective keyboards for the languages allow
>> typing them easily (IDK, please comment)
>
> Typically CJK keyboards do not contain those sorts of quote characters. I assume 
> they can be entered more-awkwardly via input methods but do not know the details.

By the shallow research that I can do now, that seems right, dumb quotes
and the backtick are there only.  I think we should have them then.

Best,
-gk.

-- 
İ. Göktuğ Kayaalp.
http://gkayaalp.com/



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

* Re: [PATCH] Enable customisation for electric-quote-mode chars
  2016-09-01 21:13                             ` Göktuğ Kayaalp
@ 2016-09-01 21:30                               ` Paul Eggert
  2016-09-02  5:06                                 ` Yuri Khan
  0 siblings, 1 reply; 49+ messages in thread
From: Paul Eggert @ 2016-09-01 21:30 UTC (permalink / raw)
  To: Göktuğ Kayaalp; +Cc: eliz, emacs-devel

Göktuğ Kayaalp wrote:
>>> >>                      | lo9hi9            | „‚’”    |
>>> >>                      | japan             | 「『』」 |
>>> >>                      | korean            | 《〈〉》 |
>>> >>                      +-------------------+---------+
...
>> > The "japan" entry has single- and double-quotes interchanged.
> Sure? I got that straight out of the linked wiki page.

Although there's no official standard as far as I know, in common practice the 
corner brackets correspond to single quotes whereas the white corner brackets 
correspond to double quotes. See, for example:

https://www.tofugu.com/japanese/japanese-punctuation/

Perhaps I should mention that electric-quote is about single vs double 
quotation, not primary vs secondary quotation. People type `` and '' to get 
primary (double) quotes in American English, and type ` and ' to get primary 
(single) quotes in UK English. I'd expect Japanese to be like UK English in this 
respect.



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

* Re: [PATCH] Enable customisation for electric-quote-mode chars
  2016-09-01 21:30                               ` Paul Eggert
@ 2016-09-02  5:06                                 ` Yuri Khan
  2016-09-02  7:30                                   ` Eli Zaretskii
  0 siblings, 1 reply; 49+ messages in thread
From: Yuri Khan @ 2016-09-02  5:06 UTC (permalink / raw)
  To: Paul Eggert; +Cc: Göktuğ Kayaalp, Eli Zaretskii, Emacs developers

On Fri, Sep 2, 2016 at 4:30 AM, Paul Eggert <eggert@cs.ucla.edu> wrote:
> Göktuğ Kayaalp wrote:

>>>> >>                      | japan             | 「『』」 |
>>> > The "japan" entry has single- and double-quotes interchanged.
> Although there's no official standard as far as I know, in common practice
> the corner brackets correspond to single quotes whereas the white corner
> brackets correspond to double quotes. See, for example:

I think at least some confusion may stem from conflating two issues:

* single vs double quotation marks (visual);
* outer vs inner quotation marks (semantic).

The presentation of the table upthread strongly suggests the
outer/inner semantic, while the user-faced feature itself is about
mapping single and double quote-like key presses to typographic
quotation marks.



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

* Re: [PATCH] Enable customisation for electric-quote-mode chars
  2016-09-02  5:06                                 ` Yuri Khan
@ 2016-09-02  7:30                                   ` Eli Zaretskii
  2016-09-02 10:37                                     ` Yuri Khan
  0 siblings, 1 reply; 49+ messages in thread
From: Eli Zaretskii @ 2016-09-02  7:30 UTC (permalink / raw)
  To: Yuri Khan; +Cc: self, eggert, emacs-devel

> From: Yuri Khan <yuri.v.khan@gmail.com>
> Date: Fri, 2 Sep 2016 11:06:25 +0600
> Cc: Göktuğ Kayaalp <self@gkayaalp.com>,
> 	Eli Zaretskii <eliz@gnu.org>, Emacs developers <emacs-devel@gnu.org>
> 
> The presentation of the table upthread strongly suggests the
> outer/inner semantic, while the user-faced feature itself is about
> mapping single and double quote-like key presses to typographic
> quotation marks.

IOW, you would like to see the below instead?

                     +-------------------+---------+
                     | label             | quotes  |
                     +-------------------+---------+
                     | curved69          | “” ‘’   |
                     | curved99          | ”” ’’   |
                     | guillemets        | «» ‹›   |
                     | guillemets+curved | «» “”   |
                     | guillemets+lo9hi6 | «» „“   |
                     | reverseguillemets | »« ›‹   |
                     | lo9hi6            | „“ ‚‘   |
                     | lo9hi9            | „” ‚’   |
                     | japan             | 『』 「」 |
                     | korean            | 《》 〈〉 |
                     +-------------------+---------+



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

* Re: [PATCH] Enable customisation for electric-quote-mode chars
  2016-09-02  7:30                                   ` Eli Zaretskii
@ 2016-09-02 10:37                                     ` Yuri Khan
  2016-09-02 13:24                                       ` Göktuğ Kayaalp
  0 siblings, 1 reply; 49+ messages in thread
From: Yuri Khan @ 2016-09-02 10:37 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Göktuğ Kayaalp, Paul Eggert, Emacs developers

On Fri, Sep 2, 2016 at 2:30 PM, Eli Zaretskii <eliz@gnu.org> wrote:

>> The presentation of the table upthread strongly suggests the
>> outer/inner semantic, while the user-faced feature itself is about
>> mapping single and double quote-like key presses to typographic
>> quotation marks.
>
> IOW, you would like to see the below instead?
>
>                      | curved69          | “” ‘’   |
>                      | japan             | 『』 「」 |

At least this option should be considered, yes.

(I’m still unsure how useful the whole feature would be for users of
layouts that do not include ` or ' or only feature them as dead keys,
but my view of the prevalence of such layouts is necessarily skewed.)



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

* Re: [PATCH] Enable customisation for electric-quote-mode chars
  2016-09-02 10:37                                     ` Yuri Khan
@ 2016-09-02 13:24                                       ` Göktuğ Kayaalp
  0 siblings, 0 replies; 49+ messages in thread
From: Göktuğ Kayaalp @ 2016-09-02 13:24 UTC (permalink / raw)
  To: Yuri Khan; +Cc: eliz, eggert, emacs-devel

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

> From: Yuri Khan <yuri.v.khan@gmail.com>
> Date: 2016-09-02 04:37:03 PM +0600
> Yuri Khan wrote:
>
> On Fri, Sep 2, 2016 at 2:30 PM, Eli Zaretskii <eliz@gnu.org> wrote:
>
>>> The presentation of the table upthread strongly suggests the
>>> outer/inner semantic, while the user-faced feature itself is about
>>> mapping single and double quote-like key presses to typographic
>>> quotation marks.
>>
>> IOW, you would like to see the below instead?
>>
>>                      | curved69          | “” ‘’   |
>>                      | japan             | 『』 「」 |
>
> At least this option should be considered, yes.

At this point what I think is that maybe we shouldn't be this
prescriptive about the use of this feature, given that there have been
three different semantic groupings of quotation marks already in this
thread: inner/outer, primary/secondary, double/single.  Each of these
cause subtle variations, and in predefining alternatives we're having to
choose one of them, and make tradeoffs.  And predefined values will
strongly /suggest/ our choice of groupings, limiting the user.  I think
the best option is to stick to the default (“” ‘’), improve the
documentation and let the users interpret what this is (as inner/outer,
primary/secondary or double/single, or sth. else) and accordingly
exploit it freely.

> (I’m still unsure how useful the whole feature would be for users of
> layouts that do not include ` or ' or only feature them as dead keys,
> but my view of the prevalence of such layouts is necessarily skewed.)

-- 
İ. Göktuğ Kayaalp.
http://gkayaalp.com/

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 818 bytes --]

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

* Re: [PATCH] Enable customisation for electric-quote-mode chars
  2016-08-29  6:14             ` Paul Eggert
@ 2016-10-05 18:53               ` Göktuğ Kayaalp
  2016-10-05 19:06                 ` Paul Eggert
  0 siblings, 1 reply; 49+ messages in thread
From: Göktuğ Kayaalp @ 2016-10-05 18:53 UTC (permalink / raw)
  To: Paul Eggert; +Cc: eliz, emacs-devel

Hi, I just wanted to check in on the status of this patch, I was a bit
late sending in my assignment papers because of familial matters and a
long bank holiday in my country (twelve-flippin'-days!), so I caused
this to stall a little bit -- I'm sorry, please excuse the delay.  Today
I was notified that my papers were reviewed by the FSF staff and
approved, so this patch can be merged (or improved if necessary).

All the best,
-Göktuğ.

On 2016-08-28 11:14:04 PM -0700, Paul Eggert <eggert@cs.ucla.edu> wrote:
> Göktuğ Kayaalp wrote:
>
>> BTW I also have a patch
>> submitted recently to the bug-gnu-emacs@ for bug#24082, should I post it
>> here instead?
>
> No, typically patches should be sent via bug-gnu-emacs.
>
>> Allright, I'm okay with that, please go ahead.
>
> Thanks, I'll follow up privately.
>

-- 
İ. Göktuğ Kayaalp.
http://gkayaalp.com/



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

* Re: [PATCH] Enable customisation for electric-quote-mode chars
  2016-10-05 18:53               ` Göktuğ Kayaalp
@ 2016-10-05 19:06                 ` Paul Eggert
  2016-10-06  6:40                   ` Eli Zaretskii
  0 siblings, 1 reply; 49+ messages in thread
From: Paul Eggert @ 2016-10-05 19:06 UTC (permalink / raw)
  To: Göktuğ Kayaalp; +Cc: Emacs development discussions

On 10/05/2016 11:53 AM, Göktuğ Kayaalp wrote:
> Today
> I was notified that my papers were reviewed by the FSF staff and
> approved, so this patch can be merged (or improved if necessary).

Thanks, that info doesn't seem to have hit the master 
copyright-assignment list at gnu.org yet (most recent update for Emacs 
is 2016-09-02), but I assume this will happen soon. Please ping us again 
in a week or so. Also, it would be helpful to know the current version 
of your patch to the master branch.




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

* Re: [PATCH] Enable customisation for electric-quote-mode chars
  2016-10-05 19:06                 ` Paul Eggert
@ 2016-10-06  6:40                   ` Eli Zaretskii
  2016-10-06 21:31                     ` Paul Eggert
  0 siblings, 1 reply; 49+ messages in thread
From: Eli Zaretskii @ 2016-10-06  6:40 UTC (permalink / raw)
  To: Paul Eggert; +Cc: self, emacs-devel

> From: Paul Eggert <eggert@cs.ucla.edu>
> Date: Wed, 5 Oct 2016 12:06:27 -0700
> Cc: Emacs development discussions <emacs-devel@gnu.org>
> 
> On 10/05/2016 11:53 AM, Göktuğ Kayaalp wrote:
> > Today
> > I was notified that my papers were reviewed by the FSF staff and
> > approved, so this patch can be merged (or improved if necessary).
> 
> Thanks, that info doesn't seem to have hit the master 
> copyright-assignment list at gnu.org yet (most recent update for Emacs 
> is 2016-09-02), but I assume this will happen soon.

His assignment is complete, so we can proceed with using the patch.

Thanks.



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

* Re: [PATCH] Enable customisation for electric-quote-mode chars
  2016-10-06  6:40                   ` Eli Zaretskii
@ 2016-10-06 21:31                     ` Paul Eggert
  2016-10-07 18:33                       ` Göktuğ Kayaalp
  0 siblings, 1 reply; 49+ messages in thread
From: Paul Eggert @ 2016-10-06 21:31 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: Göktuğ Kayaalp, emacs-devel

On 10/05/2016 11:40 PM, Eli Zaretskii wrote:
> His assignment is complete, so we can proceed with using the patch.

Thanks. Göktuğ, can you please point me at the latest version of this 
patch? I've lost context.




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

* Re: [PATCH] Enable customisation for electric-quote-mode chars
  2016-10-06 21:31                     ` Paul Eggert
@ 2016-10-07 18:33                       ` Göktuğ Kayaalp
  2016-10-10  3:57                         ` Paul Eggert
  0 siblings, 1 reply; 49+ messages in thread
From: Göktuğ Kayaalp @ 2016-10-07 18:33 UTC (permalink / raw)
  To: Paul Eggert; +Cc: eliz, emacs-devel

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

On 2016-10-06 02:31:44 PM -0700, Paul Eggert <eggert@cs.ucla.edu> wrote:
> On 10/05/2016 11:40 PM, Eli Zaretskii wrote:
>> His assignment is complete, so we can proceed with using the patch.
>
> Thanks. Göktuğ, can you please point me at the latest version of this 
> patch? I've lost context.
>

Hello, I'll attach the next version of the patch.  The only change (to
the patch) is in the ‘etc/NEWS’ file, the rest is the same.  I'm rather
uninitiated about the conventions regarding that file, so please warn me
if anything's wrong, I'll fix ASAP.

The majority of this thread is on the end of september BTW, and there
are some messages on 1st october (just noting in case you want to
review).

-- 
İ. Göktuğ Kayaalp.
http://gkayaalp.com/


[-- Attachment #2: electric-quote-mode patch --]
[-- Type: text/x-diff, Size: 7649 bytes --]

diff --git a/doc/emacs/text.texi b/doc/emacs/text.texi
index 579f788..74b68dd 100644
--- a/doc/emacs/text.texi
+++ b/doc/emacs/text.texi
@@ -412,6 +412,7 @@ beginning of a line.
 @cindex mode, Electric Quote
 @cindex curly quotes
 @cindex curved quotes
+@cindex guillemets
 @findex electric-quote-mode
   One common way to quote is the typewriter convention, which quotes
 using straight apostrophes @t{'like this'} or double-quotes @t{"like
@@ -420,11 +421,17 @@ left and right single or double quotation marks @t{‘like this’} or
 @t{“like this”}.  In text files, typewriter quotes are simple and
 portable; curved quotes are less ambiguous and typically look nicer.
 
+@vindex electric-quote-chars
   Electric Quote mode makes it easier to type curved quotes.  As you
 type characters it optionally converts @t{`} to @t{‘}, @t{'} to @t{’},
 @t{``} to @t{“}, and @t{''} to @t{”}.  These conversions are
 suppressed in buffers whose coding systems cannot represent curved
-quote characters.
+quote characters.  It's possible to change the default quotes listed
+above, by customizing the variable @code{electric-quote-chars}, a list
+of four characters, where the items correspond to the left single
+quote, the right single quote, the left double quote and the right
+double quote, respectively, whose default value is
+@code{'(?‘ ?’ ?“ ?”)}.
 
 @vindex electric-quote-paragraph
 @vindex electric-quote-comment
@@ -445,7 +452,10 @@ type @kbd{C-q `} or @kbd{C-q '} instead of @kbd{`} or @kbd{'}.  To
 insert a curved quote even when Electric Quote is disabled or
 inactive, you can type @kbd{C-x 8 [} for @t{‘}, @kbd{C-x 8 ]} for
 @t{’}, @kbd{C-x 8 @{} for @t{“}, and @kbd{C-x 8 @}} for @t{”}.
-@xref{Inserting Text}.
+@xref{Inserting Text}.  Note that the value of
+@code{electric-quote-chars} does not affect these keybindings, they
+are not keybindings of @code{electric-quote-mode} but bound in
+@code{global-map}.
 
 @node Filling
 @section Filling Text
diff --git a/etc/NEWS b/etc/NEWS
index bd94c94..323f0b1 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -60,6 +60,10 @@ affected by this, as SGI stopped supporting IRIX in December 2013.
 
 \f
 * Changes in Emacs 26.1
++++
+** The new user variable 'electric-quote-chars' provides a list
+of curved quotes for 'electric-quote-mode', allowing user to choose
+the types of quotes to be used.
 
 +++
 ** The new function 'call-shell-region' executes a command in an
diff --git a/lisp/electric.el b/lisp/electric.el
index 0ec0a1e..a846a78 100644
--- a/lisp/electric.el
+++ b/lisp/electric.el
@@ -425,16 +425,26 @@ The variable `electric-layout-rules' says when and how to insert newlines."
   :version "25.1"
   :type 'boolean :safe 'booleanp :group 'electricity)
 
+(defcustom electric-quote-chars '(?‘ ?’ ?“ ?”)
+  "Curved quote characters for `electric-quote-mode'.
+The items correspond to the left single quote, the right single
+quote, the left double quote, and the right double quote, respectively."
+  :version "25.1"
+  :type 'list :safe 'listp :group 'electricity)
+
 (defcustom electric-quote-paragraph t
   "Non-nil means to use electric quoting in text paragraphs."
   :version "25.1"
   :type 'boolean :safe 'booleanp :group 'electricity)
 
-(defun electric--insertable-p (string)
-  (or (not buffer-file-coding-system)
-      (eq (coding-system-base buffer-file-coding-system) 'undecided)
-      (not (unencodable-char-position nil nil buffer-file-coding-system
-                                      nil string))))
+(defun electric--insertable-p (string-or-char)
+  (let ((str (if (characterp string-or-char)
+                 (string string-or-char)
+               string-or-char)))
+    (or (not buffer-file-coding-system)
+        (eq (coding-system-base buffer-file-coding-system) 'undecided)
+        (not (unencodable-char-position nil nil buffer-file-coding-system
+                                        nil str)))))
 
 (defun electric-quote-post-self-insert-function ()
   "Function that `electric-quote-mode' adds to `post-self-insert-hook'.
@@ -457,30 +467,33 @@ This requotes when a quoting key is typed."
                   (derived-mode-p 'text-mode)
                   (or (eq last-command-event ?\`)
                       (save-excursion (backward-paragraph) (point)))))))
-      (when start
-        (save-excursion
-          (if (eq last-command-event ?\`)
-              (cond ((and (electric--insertable-p "“")
-                          (search-backward "‘`" (- (point) 2) t))
-                     (replace-match "“")
-                     (when (and electric-pair-mode
-                                (eq (cdr-safe
-                                     (assq ?‘ electric-pair-text-pairs))
-                                    (char-after)))
-                       (delete-char 1))
-                     (setq last-command-event ?“))
-                    ((and (electric--insertable-p "‘")
-                          (search-backward "`" (1- (point)) t))
-                     (replace-match "‘")
-                     (setq last-command-event ?‘)))
-            (cond ((and (electric--insertable-p "”")
-                        (search-backward "’'" (- (point) 2) t))
-                   (replace-match "”")
-                   (setq last-command-event ?”))
-                  ((and (electric--insertable-p "’")
-                        (search-backward "'" (1- (point)) t))
-                   (replace-match "’")
-                   (setq last-command-event ?’)))))))))
+      (pcase electric-quote-chars
+        (`(,q1 ,q2 ,q3 ,q4) 
+         (when start
+           (save-excursion
+             (if (eq last-command-event ?\`)
+                 (cond ((and (electric--insertable-p q3)
+                             (search-backward (string q1 ?`) (- (point) 2) t))
+                        (replace-match (string q3))
+                        (when (and electric-pair-mode
+                                   (eq (cdr-safe
+                                        (assq q1 electric-pair-text-pairs))
+                                       (char-after)))
+                          (delete-char 1))
+                        (setq last-command-event q3))
+                       ((and (electric--insertable-p q1)
+                             (search-backward "`" (1- (point)) t))
+                        (replace-match (string q1))
+                        (setq last-command-event q1)))
+               (cond ((and (electric--insertable-p q4)
+                           (search-backward (string q2 ?') (- (point) 2) t))
+                      (replace-match (string q4))
+                      (setq last-command-event q4))
+                     ((and (electric--insertable-p q2)
+                           (search-backward "'" (1- (point)) t))
+                      (replace-match (string q2))
+                      (setq last-command-event q2)))))))
+        (_ (error "‘electric-quote-chars’ must contain exactly 4 characters."))))))
 
 (put 'electric-quote-post-self-insert-function 'priority 10)
 
@@ -497,6 +510,9 @@ and text paragraphs, and these are selectively controlled with
 `electric-quote-comment', `electric-quote-string', and
 `electric-quote-paragraph'.
 
+Customize `electric-quote-chars' in order to use quote chars
+other than the ones listed here.
+
 This is a global minor mode.  To toggle the mode in a single buffer,
 use `electric-quote-local-mode'."
   :global t :group 'electricity

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

* Re: [PATCH] Enable customisation for electric-quote-mode chars
  2016-10-07 18:33                       ` Göktuğ Kayaalp
@ 2016-10-10  3:57                         ` Paul Eggert
  2016-10-13 18:28                           ` Göktuğ Kayaalp
  0 siblings, 1 reply; 49+ messages in thread
From: Paul Eggert @ 2016-10-10  3:57 UTC (permalink / raw)
  To: Göktuğ Kayaalp; +Cc: emacs-devel

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

Göktuğ Kayaalp wrote:
> I'm rather
> uninitiated about the conventions regarding that file, so please warn me
> if anything's wrong

It's helpful to use 'git format-patch' to prepare patches, and to prepare 
ChangeLog entries in the style suggested in the CONTRIBUTE file. Also, I think 
some of the checking can be done at variable-setting time rather than at 
run-time. How about the attached patches instead? The first one is yours with a 
ChangeLog entry; the second one contains some proposed minor fixups.

You can apply these patches to a fresh checkout from 'master' by using the 
command 'git am'.

[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-New-user-variable-electric-quote-chars.patch --]
[-- Type: text/x-diff; name="0001-New-user-variable-electric-quote-chars.patch", Size: 8130 bytes --]

From d63be0394bc94c8b763f4869759f2f2603ff6981 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=B6ktu=C4=9F=20Kayaalp?= <self@gkayaalp.com>
Date: Sun, 9 Oct 2016 11:29:50 -0700
Subject: [PATCH 1/2] New user variable 'electric-quote-chars'

* doc/emacs/text.texi (Quotation Marks), etc/NEWS: Document this.
* lisp/electric.el (electric-quote-chars): New defcustom.
(electric-quote-post-self-insert-function): Use it.
(electric--insertable-p): Arg can now be a char, too.
---
 doc/emacs/text.texi | 14 ++++++++--
 etc/NEWS            |  4 +++
 lisp/electric.el    | 74 ++++++++++++++++++++++++++++++++---------------------
 3 files changed, 61 insertions(+), 31 deletions(-)

diff --git a/doc/emacs/text.texi b/doc/emacs/text.texi
index 579f788..74b68dd 100644
--- a/doc/emacs/text.texi
+++ b/doc/emacs/text.texi
@@ -412,6 +412,7 @@ Quotation Marks
 @cindex mode, Electric Quote
 @cindex curly quotes
 @cindex curved quotes
+@cindex guillemets
 @findex electric-quote-mode
   One common way to quote is the typewriter convention, which quotes
 using straight apostrophes @t{'like this'} or double-quotes @t{"like
@@ -420,11 +421,17 @@ Quotation Marks
 @t{“like this”}.  In text files, typewriter quotes are simple and
 portable; curved quotes are less ambiguous and typically look nicer.
 
+@vindex electric-quote-chars
   Electric Quote mode makes it easier to type curved quotes.  As you
 type characters it optionally converts @t{`} to @t{‘}, @t{'} to @t{’},
 @t{``} to @t{“}, and @t{''} to @t{”}.  These conversions are
 suppressed in buffers whose coding systems cannot represent curved
-quote characters.
+quote characters.  It's possible to change the default quotes listed
+above, by customizing the variable @code{electric-quote-chars}, a list
+of four characters, where the items correspond to the left single
+quote, the right single quote, the left double quote and the right
+double quote, respectively, whose default value is
+@code{'(?‘ ?’ ?“ ?”)}.
 
 @vindex electric-quote-paragraph
 @vindex electric-quote-comment
@@ -445,7 +452,10 @@ Quotation Marks
 insert a curved quote even when Electric Quote is disabled or
 inactive, you can type @kbd{C-x 8 [} for @t{‘}, @kbd{C-x 8 ]} for
 @t{’}, @kbd{C-x 8 @{} for @t{“}, and @kbd{C-x 8 @}} for @t{”}.
-@xref{Inserting Text}.
+@xref{Inserting Text}.  Note that the value of
+@code{electric-quote-chars} does not affect these keybindings, they
+are not keybindings of @code{electric-quote-mode} but bound in
+@code{global-map}.
 
 @node Filling
 @section Filling Text
diff --git a/etc/NEWS b/etc/NEWS
index 14450a6..d52dbe6 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -60,6 +60,10 @@ affected by this, as SGI stopped supporting IRIX in December 2013.
 
 \f
 * Changes in Emacs 26.1
++++
+** The new user variable 'electric-quote-chars' provides a list
+of curved quotes for 'electric-quote-mode', allowing user to choose
+the types of quotes to be used.
 
 ---
 The group 'wp', whose label was "text", is now deprecated.
diff --git a/lisp/electric.el b/lisp/electric.el
index 0ec0a1e..5c7be35 100644
--- a/lisp/electric.el
+++ b/lisp/electric.el
@@ -425,16 +425,26 @@ electric-quote-string
   :version "25.1"
   :type 'boolean :safe 'booleanp :group 'electricity)
 
+(defcustom electric-quote-chars '(?‘ ?’ ?“ ?”)
+  "Curved quote characters for `electric-quote-mode'.
+The items correspond to the left single quote, the right single
+quote, the left double quote, and the right double quote, respectively."
+  :version "25.1"
+  :type 'list :safe 'listp :group 'electricity)
+
 (defcustom electric-quote-paragraph t
   "Non-nil means to use electric quoting in text paragraphs."
   :version "25.1"
   :type 'boolean :safe 'booleanp :group 'electricity)
 
-(defun electric--insertable-p (string)
-  (or (not buffer-file-coding-system)
-      (eq (coding-system-base buffer-file-coding-system) 'undecided)
-      (not (unencodable-char-position nil nil buffer-file-coding-system
-                                      nil string))))
+(defun electric--insertable-p (string-or-char)
+  (let ((str (if (characterp string-or-char)
+                 (string string-or-char)
+               string-or-char)))
+    (or (not buffer-file-coding-system)
+        (eq (coding-system-base buffer-file-coding-system) 'undecided)
+        (not (unencodable-char-position nil nil buffer-file-coding-system
+                                        nil str)))))
 
 (defun electric-quote-post-self-insert-function ()
   "Function that `electric-quote-mode' adds to `post-self-insert-hook'.
@@ -457,30 +467,33 @@ electric-quote-post-self-insert-function
                   (derived-mode-p 'text-mode)
                   (or (eq last-command-event ?\`)
                       (save-excursion (backward-paragraph) (point)))))))
-      (when start
-        (save-excursion
-          (if (eq last-command-event ?\`)
-              (cond ((and (electric--insertable-p "“")
-                          (search-backward "‘`" (- (point) 2) t))
-                     (replace-match "“")
-                     (when (and electric-pair-mode
-                                (eq (cdr-safe
-                                     (assq ?‘ electric-pair-text-pairs))
-                                    (char-after)))
-                       (delete-char 1))
-                     (setq last-command-event ?“))
-                    ((and (electric--insertable-p "‘")
-                          (search-backward "`" (1- (point)) t))
-                     (replace-match "‘")
-                     (setq last-command-event ?‘)))
-            (cond ((and (electric--insertable-p "”")
-                        (search-backward "’'" (- (point) 2) t))
-                   (replace-match "”")
-                   (setq last-command-event ?”))
-                  ((and (electric--insertable-p "’")
-                        (search-backward "'" (1- (point)) t))
-                   (replace-match "’")
-                   (setq last-command-event ?’)))))))))
+      (pcase electric-quote-chars
+        (`(,q1 ,q2 ,q3 ,q4)
+         (when start
+           (save-excursion
+             (if (eq last-command-event ?\`)
+                 (cond ((and (electric--insertable-p q3)
+                             (search-backward (string q1 ?`) (- (point) 2) t))
+                        (replace-match (string q3))
+                        (when (and electric-pair-mode
+                                   (eq (cdr-safe
+                                        (assq q1 electric-pair-text-pairs))
+                                       (char-after)))
+                          (delete-char 1))
+                        (setq last-command-event q3))
+                       ((and (electric--insertable-p q1)
+                             (search-backward "`" (1- (point)) t))
+                        (replace-match (string q1))
+                        (setq last-command-event q1)))
+               (cond ((and (electric--insertable-p q4)
+                           (search-backward (string q2 ?') (- (point) 2) t))
+                      (replace-match (string q4))
+                      (setq last-command-event q4))
+                     ((and (electric--insertable-p q2)
+                           (search-backward "'" (1- (point)) t))
+                      (replace-match (string q2))
+                      (setq last-command-event q2)))))))
+        (_ (error "‘electric-quote-chars’ must contain exactly 4 characters."))))))
 
 (put 'electric-quote-post-self-insert-function 'priority 10)
 
@@ -497,6 +510,9 @@ electric-quote-mode
 `electric-quote-comment', `electric-quote-string', and
 `electric-quote-paragraph'.
 
+Customize `electric-quote-chars' in order to use quote chars
+other than the ones listed here.
+
 This is a global minor mode.  To toggle the mode in a single buffer,
 use `electric-quote-local-mode'."
   :global t :group 'electricity
-- 
2.7.4


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-electric-quote-chars-fixups.patch --]
[-- Type: text/x-diff; name="0002-electric-quote-chars-fixups.patch", Size: 5846 bytes --]

From b3467c27c31ca2034f67f56438cfc8576c8f38b2 Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sun, 9 Oct 2016 11:29:50 -0700
Subject: [PATCH 2/2] electric-quote-chars fixups
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* lisp/electric.el (electric-quote-chars): Check types and safety
more carefully.
(electric--insertable-p): Don’t bother with string argument, as
that is no longer used.  Don’t call ‘string’ unless needed.
(electric-quote-post-self-insert-function): Use more-mnemonic locals.
Omit no-longer-necessary runtime error diagnostic.
---
 lisp/electric.el | 64 +++++++++++++++++++++++++++++---------------------------
 1 file changed, 33 insertions(+), 31 deletions(-)

diff --git a/lisp/electric.el b/lisp/electric.el
index 5c7be35..b15e8ab 100644
--- a/lisp/electric.el
+++ b/lisp/electric.el
@@ -427,24 +427,27 @@ electric-quote-string
 
 (defcustom electric-quote-chars '(?‘ ?’ ?“ ?”)
   "Curved quote characters for `electric-quote-mode'.
-The items correspond to the left single quote, the right single
-quote, the left double quote, and the right double quote, respectively."
-  :version "25.1"
-  :type 'list :safe 'listp :group 'electricity)
+This list's members correspond to left single quote, right single
+quote, left double quote, and right double quote, respectively."
+  :version "26.1"
+  :type '(list character character character character)
+  :safe #'(lambda (x)
+            (pcase x
+              (`(,(pred characterp) ,(pred characterp)
+		 ,(pred characterp) ,(pred characterp))
+               t)))
+  :group 'electricity)
 
 (defcustom electric-quote-paragraph t
   "Non-nil means to use electric quoting in text paragraphs."
   :version "25.1"
   :type 'boolean :safe 'booleanp :group 'electricity)
 
-(defun electric--insertable-p (string-or-char)
-  (let ((str (if (characterp string-or-char)
-                 (string string-or-char)
-               string-or-char)))
-    (or (not buffer-file-coding-system)
-        (eq (coding-system-base buffer-file-coding-system) 'undecided)
-        (not (unencodable-char-position nil nil buffer-file-coding-system
-                                        nil str)))))
+(defun electric--insertable-p (char)
+  (or (not buffer-file-coding-system)
+      (eq (coding-system-base buffer-file-coding-system) 'undecided)
+      (not (unencodable-char-position nil nil buffer-file-coding-system
+                                      nil (string char)))))
 
 (defun electric-quote-post-self-insert-function ()
   "Function that `electric-quote-mode' adds to `post-self-insert-hook'.
@@ -468,32 +471,31 @@ electric-quote-post-self-insert-function
                   (or (eq last-command-event ?\`)
                       (save-excursion (backward-paragraph) (point)))))))
       (pcase electric-quote-chars
-        (`(,q1 ,q2 ,q3 ,q4)
+        (`(,l ,r ,ll ,rr)
          (when start
            (save-excursion
              (if (eq last-command-event ?\`)
-                 (cond ((and (electric--insertable-p q3)
-                             (search-backward (string q1 ?`) (- (point) 2) t))
-                        (replace-match (string q3))
+                 (cond ((and (electric--insertable-p ll)
+                             (search-backward (string l ?`) (- (point) 2) t))
+                        (replace-match (string ll))
                         (when (and electric-pair-mode
                                    (eq (cdr-safe
-                                        (assq q1 electric-pair-text-pairs))
+                                        (assq l electric-pair-text-pairs))
                                        (char-after)))
                           (delete-char 1))
-                        (setq last-command-event q3))
-                       ((and (electric--insertable-p q1)
+                        (setq last-command-event ll))
+                       ((and (electric--insertable-p l)
                              (search-backward "`" (1- (point)) t))
-                        (replace-match (string q1))
-                        (setq last-command-event q1)))
-               (cond ((and (electric--insertable-p q4)
-                           (search-backward (string q2 ?') (- (point) 2) t))
-                      (replace-match (string q4))
-                      (setq last-command-event q4))
-                     ((and (electric--insertable-p q2)
+                        (replace-match (string l))
+                        (setq last-command-event l)))
+               (cond ((and (electric--insertable-p rr)
+                           (search-backward (string r ?') (- (point) 2) t))
+                      (replace-match (string rr))
+                      (setq last-command-event rr))
+                     ((and (electric--insertable-p r)
                            (search-backward "'" (1- (point)) t))
-                      (replace-match (string q2))
-                      (setq last-command-event q2)))))))
-        (_ (error "‘electric-quote-chars’ must contain exactly 4 characters."))))))
+                      (replace-match (string r))
+                      (setq last-command-event r)))))))))))
 
 (put 'electric-quote-post-self-insert-function 'priority 10)
 
@@ -510,8 +512,8 @@ electric-quote-mode
 `electric-quote-comment', `electric-quote-string', and
 `electric-quote-paragraph'.
 
-Customize `electric-quote-chars' in order to use quote chars
-other than the ones listed here.
+Customize `electric-quote-chars' to use characters other than the
+ones listed here.
 
 This is a global minor mode.  To toggle the mode in a single buffer,
 use `electric-quote-local-mode'."
-- 
2.7.4


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

* Re: [PATCH] Enable customisation for electric-quote-mode chars
  2016-10-10  3:57                         ` Paul Eggert
@ 2016-10-13 18:28                           ` Göktuğ Kayaalp
  2016-10-13 18:35                             ` Paul Eggert
  0 siblings, 1 reply; 49+ messages in thread
From: Göktuğ Kayaalp @ 2016-10-13 18:28 UTC (permalink / raw)
  To: Paul Eggert; +Cc: emacs-devel

On 2016-10-09 20:57 -0700, Paul Eggert <eggert@cs.ucla.edu> wrote:
> How about the attached patches instead? The first one is yours with a
> ChangeLog entry; the second one contains some proposed minor fixups.

Hi Paul,

I'm totally fine with your modifications, though unfortunately I'm
unable to test until weekend.  One thing that can be improved is the
naming of the variables ‘l’ and ‘ll’ because with some fonts (most?)
they look terribly like numbers one and eleven (admittedly not all that
important though).  Maybe (q< q> q<< q>>) instead?

I'll be able to work on this in the weekend if need be.

-gk.

-- 
İ. V. Göktuğ Kayaalp                           <http://www.gkayaalp.com>
                        PGP pubkey: <http://www.gkayaalp.com/pubkey.asc>



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

* Re: [PATCH] Enable customisation for electric-quote-mode chars
  2016-10-13 18:28                           ` Göktuğ Kayaalp
@ 2016-10-13 18:35                             ` Paul Eggert
  2016-10-22 14:00                               ` Göktuğ Kayaalp
  0 siblings, 1 reply; 49+ messages in thread
From: Paul Eggert @ 2016-10-13 18:35 UTC (permalink / raw)
  To: Göktuğ Kayaalp; +Cc: emacs-devel

On 10/13/2016 11:28 AM, Göktuğ Kayaalp wrote:
> Maybe (q< q> q<< q>>) instead?

Sure, that should work. I originally renamed them to (‘ ’ “ ”), which 
also works, but decided that was too extreme....




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

* Re: [PATCH] Enable customisation for electric-quote-mode chars
  2016-10-13 18:35                             ` Paul Eggert
@ 2016-10-22 14:00                               ` Göktuğ Kayaalp
  2016-10-23 10:25                                 ` Paul Eggert
  0 siblings, 1 reply; 49+ messages in thread
From: Göktuğ Kayaalp @ 2016-10-22 14:00 UTC (permalink / raw)
  To: Paul Eggert; +Cc: emacs-devel

Hi,

I'm messaging just to ping about the status of this patch.  Will be
applied or not?  Need improvements?

Thanks,
-gk.

-- 
İ. V. Göktuğ Kayaalp                           <http://www.gkayaalp.com>
                        PGP pubkey: <http://www.gkayaalp.com/pubkey.asc>



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

* Re: [PATCH] Enable customisation for electric-quote-mode chars
  2016-10-22 14:00                               ` Göktuğ Kayaalp
@ 2016-10-23 10:25                                 ` Paul Eggert
  2016-10-23 15:09                                   ` Göktuğ Kayaalp
  0 siblings, 1 reply; 49+ messages in thread
From: Paul Eggert @ 2016-10-23 10:25 UTC (permalink / raw)
  To: Göktuğ Kayaalp; +Cc: emacs-devel

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

Göktuğ Kayaalp wrote:
> I'm messaging just to ping about the status of this patch.  Will be
> applied or not?  Need improvements?

The intent is to apply it, yes. I had been waiting for Bug#24759 to settle down 
first; see

http://bugs.gnu.org/24759

That bug was closed recently. To help move things along I merged emacs-25 to 
master and rebased the patch, arriving at the attached patches. Do these look 
good to you?


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #2: 0001-New-user-variable-electric-quote-chars.patch --]
[-- Type: text/x-diff; name="0001-New-user-variable-electric-quote-chars.patch", Size: 6644 bytes --]

From 96c18709151a422c7dbad6bcfdebe06dc50c4f3b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?G=C3=B6ktu=C4=9F=20Kayaalp?= <self@gkayaalp.com>
Date: Sun, 23 Oct 2016 03:14:52 -0700
Subject: [PATCH 1/2] New user variable 'electric-quote-chars'

* doc/emacs/text.texi (Quotation Marks), etc/NEWS: Document this.
* lisp/electric.el (electric-quote-chars): New defcustom.
(electric-quote-post-self-insert-function): Use it.
(electric--insertable-p): Arg can now be a char, too.
---
 doc/emacs/text.texi | 14 ++++++++++++--
 etc/NEWS            |  4 ++++
 lisp/electric.el    | 53 +++++++++++++++++++++++++++++++++--------------------
 3 files changed, 49 insertions(+), 22 deletions(-)

diff --git a/doc/emacs/text.texi b/doc/emacs/text.texi
index 7fa0804..4c6a1ff 100644
--- a/doc/emacs/text.texi
+++ b/doc/emacs/text.texi
@@ -412,6 +412,7 @@ Quotation Marks
 @cindex mode, Electric Quote
 @cindex curly quotes
 @cindex curved quotes
+@cindex guillemets
 @findex electric-quote-mode
   One common way to quote is the typewriter convention, which quotes
 using straight apostrophes @t{'like this'} or double-quotes @t{"like
@@ -420,9 +421,15 @@ Quotation Marks
 @t{“like this”}.  In text files, typewriter quotes are simple and
 portable; curved quotes are less ambiguous and typically look nicer.
 
+@vindex electric-quote-chars
   Electric Quote mode makes it easier to type curved quotes.  As you
 type characters it optionally converts @t{`} to @t{‘}, @t{'} to @t{’},
-@t{``} to @t{“}, and @t{''} to @t{”}.
+@t{``} to @t{“}, and @t{''} to @t{”}.  It's possible to change the
+default quotes listed above, by customizing the variable
+@code{electric-quote-chars}, a list of four characters, where the
+items correspond to the left single quote, the right single quote, the
+left double quote and the right double quote, respectively, whose
+default value is @code{'(?‘ ?’ ?“ ?”)}.
 
 @vindex electric-quote-paragraph
 @vindex electric-quote-comment
@@ -443,7 +450,10 @@ Quotation Marks
 insert a curved quote even when Electric Quote is disabled or
 inactive, you can type @kbd{C-x 8 [} for @t{‘}, @kbd{C-x 8 ]} for
 @t{’}, @kbd{C-x 8 @{} for @t{“}, and @kbd{C-x 8 @}} for @t{”}.
-@xref{Inserting Text}.
+@xref{Inserting Text}.  Note that the value of
+@code{electric-quote-chars} does not affect these keybindings, they
+are not keybindings of @code{electric-quote-mode} but bound in
+@code{global-map}.
 
 @node Filling
 @section Filling Text
diff --git a/etc/NEWS b/etc/NEWS
index d9973c0..1271466 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -60,6 +60,10 @@ affected by this, as SGI stopped supporting IRIX in December 2013.
 
 \f
 * Changes in Emacs 26.1
++++
+** The new user variable 'electric-quote-chars' provides a list
+of curved quotes for 'electric-quote-mode', allowing user to choose
+the types of quotes to be used.
 
 ---
 The group 'wp', whose label was "text", is now deprecated.
diff --git a/lisp/electric.el b/lisp/electric.el
index f35f8b9..19cded2 100644
--- a/lisp/electric.el
+++ b/lisp/electric.el
@@ -425,6 +425,13 @@ electric-quote-string
   :version "25.1"
   :type 'boolean :safe 'booleanp :group 'electricity)
 
+(defcustom electric-quote-chars '(?‘ ?’ ?“ ?”)
+  "Curved quote characters for `electric-quote-mode'.
+The items correspond to the left single quote, the right single
+quote, the left double quote, and the right double quote, respectively."
+  :version "25.1"
+  :type 'list :safe 'listp :group 'electricity)
+
 (defcustom electric-quote-paragraph t
   "Non-nil means to use electric quoting in text paragraphs."
   :version "25.1"
@@ -451,26 +458,29 @@ electric-quote-post-self-insert-function
                   (derived-mode-p 'text-mode)
                   (or (eq last-command-event ?\`)
                       (save-excursion (backward-paragraph) (point)))))))
-      (when start
-        (save-excursion
-          (if (eq last-command-event ?\`)
-              (cond ((search-backward "‘`" (- (point) 2) t)
-                     (replace-match "“")
-                     (when (and electric-pair-mode
-                                (eq (cdr-safe
-                                     (assq ?‘ electric-pair-text-pairs))
-                                    (char-after)))
-                       (delete-char 1))
-                     (setq last-command-event ?“))
-                    ((search-backward "`" (1- (point)) t)
-                     (replace-match "‘")
-                     (setq last-command-event ?‘)))
-            (cond ((search-backward "’'" (- (point) 2) t)
-                   (replace-match "”")
-                   (setq last-command-event ?”))
-                  ((search-backward "'" (1- (point)) t)
-                   (replace-match "’")
-                   (setq last-command-event ?’)))))))))
+      (pcase electric-quote-chars
+        (`(,q1 ,q2 ,q3 ,q4)
+         (when start
+           (save-excursion
+             (if (eq last-command-event ?\`)
+                 (cond ((search-backward (string q1 ?`) (- (point) 2) t)
+                        (replace-match (string q3))
+                        (when (and electric-pair-mode
+                                   (eq (cdr-safe
+                                        (assq q1 electric-pair-text-pairs))
+                                       (char-after)))
+                          (delete-char 1))
+                        (setq last-command-event q3))
+                       ((search-backward "`" (1- (point)) t)
+                        (replace-match (string q1))
+                        (setq last-command-event q1)))
+               (cond ((search-backward (string q2 ?') (- (point) 2) t)
+                      (replace-match (string q4))
+                      (setq last-command-event q4))
+                     ((search-backward "'" (1- (point)) t)
+                      (replace-match (string q2))
+                      (setq last-command-event q2)))))))
+        (_ (error "‘electric-quote-chars’ must contain exactly 4 characters."))))))
 
 (put 'electric-quote-post-self-insert-function 'priority 10)
 
@@ -487,6 +497,9 @@ electric-quote-mode
 `electric-quote-comment', `electric-quote-string', and
 `electric-quote-paragraph'.
 
+Customize `electric-quote-chars' in order to use quote chars
+other than the ones listed here.
+
 This is a global minor mode.  To toggle the mode in a single buffer,
 use `electric-quote-local-mode'."
   :global t :group 'electricity
-- 
2.7.4


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #3: 0002-electric-quote-chars-fixups.patch --]
[-- Type: text/x-diff; name="0002-electric-quote-chars-fixups.patch", Size: 4188 bytes --]

From 7ba2590f3753157ca078250c09598dce48aaa3cd Mon Sep 17 00:00:00 2001
From: Paul Eggert <eggert@cs.ucla.edu>
Date: Sun, 23 Oct 2016 03:22:06 -0700
Subject: [PATCH 2/2] electric-quote-chars fixups

* lisp/electric.el (electric-quote-chars): Check types and safety
more carefully.
(electric-quote-post-self-insert-function): Use more-mnemonic locals.
Omit no-longer-necessary runtime error diagnostic.
---
 lisp/electric.el | 43 ++++++++++++++++++++++++-------------------
 1 file changed, 24 insertions(+), 19 deletions(-)

diff --git a/lisp/electric.el b/lisp/electric.el
index 19cded2..3e48737 100644
--- a/lisp/electric.el
+++ b/lisp/electric.el
@@ -427,10 +427,16 @@ electric-quote-string
 
 (defcustom electric-quote-chars '(?‘ ?’ ?“ ?”)
   "Curved quote characters for `electric-quote-mode'.
-The items correspond to the left single quote, the right single
-quote, the left double quote, and the right double quote, respectively."
-  :version "25.1"
-  :type 'list :safe 'listp :group 'electricity)
+This list's members correspond to left single quote, right single
+quote, left double quote, and right double quote, respectively."
+  :version "26.1"
+  :type '(list character character character character)
+  :safe #'(lambda (x)
+	    (pcase x
+	      (`(,(pred characterp) ,(pred characterp)
+		 ,(pred characterp) ,(pred characterp))
+	       t)))
+  :group 'electricity)
 
 (defcustom electric-quote-paragraph t
   "Non-nil means to use electric quoting in text paragraphs."
@@ -459,28 +465,27 @@ electric-quote-post-self-insert-function
                   (or (eq last-command-event ?\`)
                       (save-excursion (backward-paragraph) (point)))))))
       (pcase electric-quote-chars
-        (`(,q1 ,q2 ,q3 ,q4)
+        (`(,q< ,q> ,q<< ,q>>)
          (when start
            (save-excursion
              (if (eq last-command-event ?\`)
-                 (cond ((search-backward (string q1 ?`) (- (point) 2) t)
-                        (replace-match (string q3))
+                 (cond ((search-backward (string q< ?`) (- (point) 2) t)
+                        (replace-match (string q<<))
                         (when (and electric-pair-mode
                                    (eq (cdr-safe
-                                        (assq q1 electric-pair-text-pairs))
+                                        (assq q< electric-pair-text-pairs))
                                        (char-after)))
                           (delete-char 1))
-                        (setq last-command-event q3))
+                        (setq last-command-event q<<))
                        ((search-backward "`" (1- (point)) t)
-                        (replace-match (string q1))
-                        (setq last-command-event q1)))
-               (cond ((search-backward (string q2 ?') (- (point) 2) t)
-                      (replace-match (string q4))
-                      (setq last-command-event q4))
+                        (replace-match (string q<))
+                        (setq last-command-event q<)))
+               (cond ((search-backward (string q> ?') (- (point) 2) t)
+                      (replace-match (string q>>))
+                      (setq last-command-event q>>))
                      ((search-backward "'" (1- (point)) t)
-                      (replace-match (string q2))
-                      (setq last-command-event q2)))))))
-        (_ (error "‘electric-quote-chars’ must contain exactly 4 characters."))))))
+                      (replace-match (string q>))
+                      (setq last-command-event q>)))))))))))
 
 (put 'electric-quote-post-self-insert-function 'priority 10)
 
@@ -497,8 +502,8 @@ electric-quote-mode
 `electric-quote-comment', `electric-quote-string', and
 `electric-quote-paragraph'.
 
-Customize `electric-quote-chars' in order to use quote chars
-other than the ones listed here.
+Customize `electric-quote-chars' to use characters other than the
+ones listed here.
 
 This is a global minor mode.  To toggle the mode in a single buffer,
 use `electric-quote-local-mode'."
-- 
2.7.4


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

* Re: [PATCH] Enable customisation for electric-quote-mode chars
  2016-10-23 10:25                                 ` Paul Eggert
@ 2016-10-23 15:09                                   ` Göktuğ Kayaalp
  2016-10-27 15:12                                     ` Paul Eggert
  0 siblings, 1 reply; 49+ messages in thread
From: Göktuğ Kayaalp @ 2016-10-23 15:09 UTC (permalink / raw)
  To: Paul Eggert; +Cc: emacs-devel

On 2016-10-23 03:25 -0700, Paul Eggert <eggert@cs.ucla.edu> wrote:
> Göktuğ Kayaalp wrote:
>> I'm messaging just to ping about the status of this patch.  Will be
>> applied or not?  Need improvements?
>
> The intent is to apply it, yes. I had been waiting for Bug#24759 to settle down 
> first; see
>
> http://bugs.gnu.org/24759
>
> That bug was closed recently. To help move things along I merged emacs-25 to 
> master and rebased the patch, arriving at the attached patches. Do these look 
> good to you?
>

Perfect, thanks.  Though I think the first patch need not mention
‘electric--insertable-p’ in its comment, as it doesn't modify that
function (which I guess is removed anyways).

-- 
İ. V. Göktuğ Kayaalp                           <http://www.gkayaalp.com>
                        PGP pubkey: <http://www.gkayaalp.com/pubkey.asc>



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

* Re: [PATCH] Enable customisation for electric-quote-mode chars
  2016-10-23 15:09                                   ` Göktuğ Kayaalp
@ 2016-10-27 15:12                                     ` Paul Eggert
  2016-10-27 17:21                                       ` Göktuğ Kayaalp
  0 siblings, 1 reply; 49+ messages in thread
From: Paul Eggert @ 2016-10-27 15:12 UTC (permalink / raw)
  To: Göktuğ Kayaalp; +Cc: emacs-devel

On 10/23/2016 08:09 AM, Göktuğ Kayaalp wrote:
> I think the first patch need not mention
> ‘electric--insertable-p’ in its comment

Right you are. I fixed that and installed into master. Thanks again.




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

* Re: [PATCH] Enable customisation for electric-quote-mode chars
  2016-10-27 15:12                                     ` Paul Eggert
@ 2016-10-27 17:21                                       ` Göktuğ Kayaalp
  0 siblings, 0 replies; 49+ messages in thread
From: Göktuğ Kayaalp @ 2016-10-27 17:21 UTC (permalink / raw)
  To: Paul Eggert; +Cc: emacs-devel

On 2016-10-27 08:12 -0700, Paul Eggert <eggert@cs.ucla.edu> wrote:
> On 10/23/2016 08:09 AM, Göktuğ Kayaalp wrote:
>> I think the first patch need not mention
>> ‘electric--insertable-p’ in its comment
>
> Right you are. I fixed that and installed into master. Thanks again.
>

It was my pleasure, thank you.

-- 
İ. V. Göktuğ Kayaalp                           <http://www.gkayaalp.com>
                        PGP pubkey: <http://www.gkayaalp.com/pubkey.asc>



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

end of thread, other threads:[~2016-10-27 17:21 UTC | newest]

Thread overview: 49+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-27 14:22 [PATCH] Enable customisation for electric-quote-mode chars Göktuğ Kayaalp
2016-08-27 14:38 ` Eli Zaretskii
2016-08-27 15:23   ` Göktuğ Kayaalp
2016-08-27 19:16     ` Paul Eggert
2016-08-28  1:00       ` Göktuğ Kayaalp
2016-08-29  1:55         ` Paul Eggert
2016-08-29  5:28           ` Göktuğ Kayaalp
2016-08-29  6:14             ` Paul Eggert
2016-10-05 18:53               ` Göktuğ Kayaalp
2016-10-05 19:06                 ` Paul Eggert
2016-10-06  6:40                   ` Eli Zaretskii
2016-10-06 21:31                     ` Paul Eggert
2016-10-07 18:33                       ` Göktuğ Kayaalp
2016-10-10  3:57                         ` Paul Eggert
2016-10-13 18:28                           ` Göktuğ Kayaalp
2016-10-13 18:35                             ` Paul Eggert
2016-10-22 14:00                               ` Göktuğ Kayaalp
2016-10-23 10:25                                 ` Paul Eggert
2016-10-23 15:09                                   ` Göktuğ Kayaalp
2016-10-27 15:12                                     ` Paul Eggert
2016-10-27 17:21                                       ` Göktuğ Kayaalp
2016-08-29 15:08             ` Eli Zaretskii
2016-08-29 15:54               ` Yuri Khan
2016-08-29 16:23                 ` Eli Zaretskii
2016-08-29 16:27               ` Göktuğ Kayaalp
2016-08-29 16:39                 ` Eli Zaretskii
2016-08-29 17:19                   ` Göktuğ Kayaalp
2016-08-29 17:30                 ` Paul Eggert
2016-08-29 17:44                   ` Eli Zaretskii
2016-08-29 18:43                     ` Paul Eggert
2016-08-29 19:30                       ` Eli Zaretskii
2016-08-30 17:38                         ` Paul Eggert
2016-08-30 17:49                           ` Eli Zaretskii
2016-08-31 11:08                             ` Richard Stallman
2016-09-01 18:56                         ` Göktuğ Kayaalp
2016-09-01 19:15                           ` Paul Eggert
2016-09-01 21:13                             ` Göktuğ Kayaalp
2016-09-01 21:30                               ` Paul Eggert
2016-09-02  5:06                                 ` Yuri Khan
2016-09-02  7:30                                   ` Eli Zaretskii
2016-09-02 10:37                                     ` Yuri Khan
2016-09-02 13:24                                       ` Göktuğ Kayaalp
2016-08-29 16:15           ` tarball builds (was: [PATCH] Enable customisation for electric-quote-mode chars) Stefan Monnier
2016-08-30 15:14             ` Eli Zaretskii
2016-08-30 15:53               ` tarball builds Stefan Monnier
2016-08-30 15:59             ` Paul Eggert
2016-08-30 17:00               ` Stefan Monnier
2016-08-30 17:58                 ` Paul Eggert
2016-08-29  2:33         ` [PATCH] Enable customisation for electric-quote-mode chars Eli Zaretskii

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).