Hi Tassilo, 2013/6/5 Tassilo Horn <[email protected]>: > Ups, and in the meantime I've "git reset --hard origin/master". But it > was easy to reproduce, but keep in mind that the attached version is > even less tested (not at all!) than the version I've meant to send you > before. Thank you, that works. David's "[^z-a]" works as well (it's really smart!) and is shorter, I prefer this if there are no contraindications, e.g., if "[^z-a]" is treated as an invalid regex in some Emacs versions.
I'd like to match the regex exactly from point to mark position, much
like \`...\' in `string-match'. `re-search-forward' treats `\'' as
"end of the buffer" also when the `bound' argument is used. `\='
matches the empty string at point, but I found no ways to match the
empty string at `bound' position. Anyway, this isn't essential, `\='
does at least half of the job.
After some testing I'm not persuaded it's a good idea to remove
`TeX-math-close-double-dollar'. E.g., a plain TeX user probably want
to set `TeX-electric-inline-math' to '("$" . "$"), but if point is
after the third dollar in the following line
$$ a+b=c $
pressing another time `$' will insert a couple of dollars because
there (texmathp) returns nil. This isn't the expected behavior and
`TeX-math-close-double-dollar' does a better job.
I'm sending the full patch for `tex.el'. I'll update `doc/auctex.texi' as well.
In my .emacs I define the following function
--8<---------------cut here---------------start------------->8---
(defun TeX-toggle-electric-inline-math ()
"Toggle the value of `TeX-electric-inline-math'."
(interactive)
(cond
;; "\(...\)" to "$...$"
((equal TeX-electric-inline-math '("\\(" . "\\)"))
(setq TeX-electric-inline-math '("$" . "$"))
(message "`TeX-insert-dollar' now inserts \"$...$\"."))
;; "$...$" to "$"
((equal TeX-electric-inline-math '("$" . "$"))
(setq TeX-electric-inline-math nil)
(message "`TeX-insert-dollar' now inserts \"$\"."))
;; Anything else to "\(...\)"
(t
(setq TeX-electric-inline-math '("\\(" . "\\)"))
(message "`TeX-insert-dollar' now inserts \"\\(...\\)\"."))))
--8<---------------cut here---------------end--------------->8---
I don't know if it's worth adding it to AUCTeX, I hope it will be
useful to someone reading this message.
Completely unrelated, can I reference gmane threads in ChangeLog?
Bye,
Mosè
tex-insert-dollar.patch
Description: Binary data
_______________________________________________ auctex-devel mailing list [email protected] https://lists.gnu.org/mailman/listinfo/auctex-devel
