Hi, Ikumi
>> Now, suppose that the user sets TeX-electric-math to dollars. Then,
>> that option is not going to be applicable in many cases, as the user
>> is likely using «$» and «$$» as math delimiters. There are however
>> other environments, «equation», «align» etc where this option works.
>> There are also environments where this option breaks, which is why
>> this behaviour was made optional in the first place.
>
>Sorry, I can't follow. Can you elaborate?
Suppose that TeX-electric-math is set to dollar and
TeX-refuse-unmatched-dollar is set to true. I am thinking, when is the
«refuse the dollar» behaviour going to happen? It's not going to
happen in inline math or display math — the user uses dollars for math
and we never «refuse the dollar» when enclosed by dollars. It's /only/
going to apply in some environments that don't explicitly use dollars,
such as «equation», «align», «cases*» and so on. However, in some of
those environments this behaviour is going to be /incorrect/, as noted
in bug#57626, for example.
So, the only environment (sorry for the pun) where we «refuse the
dollar» is also the environment where that feature breaks
occasionally.
>> Suppose that the user sets TeX-electric-math to non-nil, and not
>> dollars. Then, this option is not going to be applicable at all, as
>> the dollar key never inserts a dollar. In fact, the very name
>> «unmatched-dollar» no longer makes sense, because we are automatically
>> inserting two matching delimiters which are not dollars.
>
>If we follow the name «unmatched-dollar» rigorously, your argument makes
>sense.
Yeah, but if we change the semantics from «unmatched-dollar» to
something else, it could work.
>> So, the options I see are:
>
>> 1. Extend semantics of TeX-refuse-unmatched-dollar to other
>> delimiters, change the documentation, possibly change the name, create
>> the deprecated alias with the old name.
>
>> 2. Keep semantics and docs of TeX-refuse-unmatched-dollar, but confine
>> to when electricity is off.
>
>I don't have strong opinion about it. If you want to sort out the
>confusion and provide a consistent solution, I'm fine with either way.
Will reply later, when I have time to sort out the thoughts.
>>>> +When ARG is given, insert a literal `$' ARG times. E.g., if you
>>> The elisp reference node "(elisp) Documentation Tips" directs not to use
>>> single quotes in the doc string in that way:
>>> ,----
>>> | • In documentation strings, do not quote expressions that are not
>>> | Lisp symbols, as these expressions can stand for themselves. For
>>> | example, write ‘Return the list (NAME TYPE RANGE) ...’ instead of
>>> | ‘Return the list `(NAME TYPE RANGE)' ...’ or ‘Return the list
>>> | \\='(NAME TYPE RANGE) ...’.
>>> `----
>
>> Fixed.
>
>I think other occurrence of single quotes in
>> you need exactly one $, you can use `C-1 $'.
I think I should use `C-1 \\[TeX-insert-dollar]' according to the help
entry on «Keys in Documentation»?
>and
>> Otherwise, when in a verbatim construct or escaped with `\\',
>should also fixed according to the elisp reference direction.
Oh, yes, missed that.
>> The blinking probably should also be removed due to being very
>> inconsistent. Or fixed, if worth it.
>
>I wasn't aware of that inconsistency. Could you explain it?
I had an impression that it should blink to the closing paren when
applied to a region in the electric mode, but per docs it's not
required. However, it doesn't respect the behaviour of
blink-matching-paren, which allows the user to choose between jumping
onscreen, jumping offscreen or just blinking.
>By the way...
>> It is not extremely difficult to keep that feature, and I have already
>> written a patch to do it.
>
>I noticed two incompatibilities with the current behavior.
Okay, I guess it is more difficult than I felt initially :D
>1. In math environment (including \[...\]), it no longer allows to
>insert a escaped dollar sign (in other words, users cannot write
>"\$" by typing backslash followed by dollar.)
>Similarly, it no longer allows to insert dollar sign inside
>\verb|...| in math environment.
>This was introduced anew in the revised patch.
Will fix.
>2. Suppose that TeX-electric-math is a pair of dollars. Then typing $
>at
>$E = mc^2-!-
>inserts two dollars, not one dollar.
>This behavior existed prior to the revised patch.
That is indeed a regression, however, I feel that it might be not very
serious. An electric user will almost always have balanced dollars.
> (This is optional) The revised patch increases calls to `texmathp'. It
> doesn't make much difference anyway, it is preferable if you can reduce
> them.
Will consider the best approach to this. My first idea is actually to
«cache» texmathp. That is, when we see that the buffer is unmodified
since the last call, we just don't do anything.
Unfortunately, I am not well-versed in Emacs practices, so if you have
any notes on the viability of this idea, I'd be happy to hear them.
Best,
Artem