Hi Artem, > This is my first time contributing and I expect to have made mistakes. I am > willing to react to comments and fix any deficiencies.
Commentaries on the second patch follow. I think the two incompatibilities discussed there are permissible: (1) The special case where > If [[`TeX-electric-math']] non-nil and point is inside math ... (2) We've changed `C-u $' to insert four dollars as opposed to one. They are reasonable and we can announce work arounds for them. On the other hand, I'm afraid another incompatibility, due to refactoring of the electric logic of `TeX-insert-dollar', can be bad. Suppose that `TeX-electric-math' is "$...$" or "\(...\)" and `TeX-refuse-unmatched-dollar' is t. Then the current `TeX-insert-dollar' refuses to insert anything if the point is in math-mode which doesn't begin with "$" nor "$$". However, after your patch is applied, it just shows ordinary electric behavior; it inserts pair of "$...$" or "\(...\)". I'm not sure how this feature is important; maybe very few users concern about it. But I ask you to try to keep the compatibility first. If it is extremely difficult, let's discuss what to do. > +(TeX--put-electric-delete-selection > + #'TeX-newline (lambda () nil)) Is it right to inherit `delete-selection' property from `self-insert-command' for the command associated with RET key? I'm not familiar with delete selection mode, so I cannot tell. (By the way, (lambda () nil) can just be #'ignore .) > +(defun TeX-insert-dollar-electric-p () > + "Non-nil if `TeX-insert-dollar' should use the electric behaviour." This doc string looks like to explain a variable because it starts with "Non-nil if...". A doc string for a function should tell what this function does. > +(defun TeX-insert-dollar-electric-p () > + "Non-nil if `TeX-insert-dollar' should use the electric behaviour." > + (and (not current-prefix-arg) > + (not (TeX-escaped-p)) > + (not (TeX-verbatim-p)) > + TeX-electric-math)) It would be slightly efficient if it refers to `TeX-electric-math' before evaluation of `TeX-escaped-p' and `TeX-verbatim-p'. > +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) ...’. `---- In addition, the same node discourages to use "e.g." in the doc string: ,---- | • Try to avoid using abbreviations such as “e.g.” (for “for | example”), “i.e.” (for “that is”), “no.” (for “number”), “cf.” (for | “compare”/“see also”) and “w.r.t.” (for “with respect to”) as much | as possible. It is almost always clearer and easier to read the | expanded version.(1) `---- > +Otherwise, when in a verbatim or an escaped (with `\\') > +environment, insert one literal `$'. The term "environment" is ambiguous in this context because it's difficult to distinguish from "LaTeX environment". How about Otherwise, when in a verbatim construct or escaped with \"\\\",... instead? > +(TeX--put-electric-delete-selection > + #'TeX-insert-dollar TeX-insert-dollar-electric-p) The second argument must be quoted. Regards, Ikumi Keita #StandWithUkraine #StopWarInUkraine #Gaza #StopMassiveKilling #CeasefireNOW