Hi, Ikumi,
>>>> 2. Suppose that TeX-electric-math is a pair of dollars. Then typing $
>>>> at
>>>> $E = mc^2-!-
>>>> inserts two dollars, not one dollar.
>
>> I am personally still not a fan for special casing of dollars in a
>> situation like that.
>
>> While it can happen in some situations as you've pointed out, we're
>> supporting this «insert the matching sign» behaviour only for the
>> dollar sign. All other electric math options do not get this benefit.
>> Furthermore, it's easily amended by typing C-d.
>
>> Furthemore, if we had
>> $E = mc^2-!- bar-bar $ foo-foo
>> and typed $, we would get
>> $E = mc^2$-!- bar-bar $ foo-foo
>> which moves previously math-mode «bar-bar» into text-mode and
>> previously text-mode «foo-foo» into (an unclosed) math-mode.
>
>> With the new behaviour from my previous pacthes, it would turn into
>> $E = mc^2$-!-$ bar-bar $ foo-foo,
>> preserving the modes.
>
>> All in all, given that neither solution is without flaws, I lean in
>> favour of the consistent one.
>
>Your argument makes sense, so I think AUCTeX can accept that suggestion.
>Are there anyone who object to this new behavior? (It is only relevant
>for users who customized `TeX-refuse-unmatched-dollar' to non-nil.)
I haven't seen any objections, so I moved on with restoring the old
behaviour.
>> +(define-obsolete-variable-alias 'TeX-refuse-unmatched-dollar
>> + 'TeX-refuse-nested-math "13.4"
>
>The next AUCTeX version would be 14. (The ELPA releases already reached
>14.) So the version should be "14" or "14.1".
Since I've restored the old behaviour, it makes sense to preserve the
old variable name.
>> +(defun TeX-insert-dollar-mode (arg)
>
>In general, an elisp function whose name ends with "-mode" is a major or
>minor mode function, or is expected to do something related to major or
>minor modes, at least within AUCTeX source. Thus I'd like you to change
>this name `TeX-insert-dollar-mode' to `TeX-insert-dollar-action' or
>something like that for coherency. (Since it can be considered as a
>private helper function, you might as well assign it a name
>"TeX--insert-..."; but that isn't much important.)
Done. However, I don't want to make it private, since the helper could
be useful to other electric modes, which can enable or disable
features based on the operation mode.
>In addition, I'd request to provide appropriate patches for
>doc/auctex.texi and doc/changes.texi, too. :-)
Done.
Best,
Artem