Hi Artem, >>>>> Artem Yurchenko <artemyurche...@zoho.com> writes: > However, if we apply it when electricity is on, this option seems > somewhat misleadingly named and documented and doesn't make sense IMO.
I agree that the situation is not totally consistent, because of the historical reason[1]. :-) > First, the name (and the doc) say that the option controls the insert > of a /dollar/ sign. Thus, if the TeX-electric-math is not a dollar, then > technically, this option shouldn't apply? That seems somewhat > inconsistent, because the reasoning behind the option is the same for > any math delimiter: «nested» math mode is invalid. I haven't considered the discrepancy seriously before. :-) But I think you speak right. > 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 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. > 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. >>> +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 $'. and > Otherwise, when in a verbatim construct or escaped with `\\', should also fixed according to the elisp reference direction. > 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? 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. 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. 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. (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. Regards, Ikumi Keita #StandWithUkraine #StopWarInUkraine #Gaza #StopMassiveKilling #CeasefireNOW [1] The option `TeX-electric-math' was added afterwards; the behavior when $ is typed in situation discussed now varied from time to time: https://lists.gnu.org/archive/html/auctex-devel/2005-12/msg00000.html https://git.savannah.gnu.org/cgit/auctex.git/commit/?id=05c78e15cf89ee3cc5828a8decc21a0420729714 https://lists.gnu.org/archive/html/auctex-devel/2020-01/msg00002.html https://git.savannah.gnu.org/cgit/auctex.git/commit/?id=13e6746758abcaf28bc61c2cbafcd52a8c9a6dd1 bug#57626 https://git.savannah.gnu.org/cgit/auctex.git/commit/?id=42150568f1d8ef9a556ecdc3f107e7f4cb02e7a9