Subject: Re: bug#19356: electric-pair-mode painful quotes in latex-mode

From: Stefan Monnier <[email-masked]>
Date: Sat, 13 Dec 2014 23:53:06 -0500

> What kind of surrounding should take place? Should it be
>   ``wordityped''
> or should it be
>   "wordityped"
> ?

I think either way would be OK.
I guess ideally

   C-M-SPC "

should do

   ``wordityped''

and

   C-M-SPC " "

should do

   "wordityped"

but it's OK if we don't reach this ideal.

> Anyway, without having anlysed the problem thoroughly, I lean towards
> making tex-mode.el's `tex-insert-quote' aware of `electric-pair-mode',
> possibly downgrading and/or not respecting stuff like
> `electric-pair-preserve-balance', instead of overloading the latter with
> abstractions to deal with multi-character metamorphosing quotes.  Do you
> agree? Or do you have any other solution in mind?

I don't see the need to extend electric-pair's code for this use
case, indeed, except if it can be done with a well-placed hook.

> Also, independent of `electric-pair-mode', typing a double quote
> (`tex-insert-quote') with only whitespace preceding point gives me a
> "Beginning of buffer" error.  Should I also fix it?

I wouldn't punish you for it.

> If it seems OK, I'll add some tests and commit it to the emacs-24 branch
> (someone else will cherry-pick it to the master, right?).

The patch looks OK.  Installing it on emacs-24 sounds good, thank you
(and no, it won't be cherry picked: it'll be merged instead).

        Stefan