[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [AUCTeX-devel] Wrap dollars around active region
From: |
Mosè Giordano |
Subject: |
Re: [AUCTeX-devel] Wrap dollars around active region |
Date: |
Thu, 6 Jun 2013 01:16:31 +0200 |
Hi Tassilo,
2013/6/5 Tassilo Horn <address@hidden>:
> 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
- Re: [AUCTeX-devel] Wrap dollars around active region, (continued)
- Re: [AUCTeX-devel] Wrap dollars around active region, Mosè Giordano, 2013/06/04
- Re: [AUCTeX-devel] Wrap dollars around active region, Tassilo Horn, 2013/06/05
- Re: [AUCTeX-devel] Wrap dollars around active region, Mosè Giordano, 2013/06/05
- Re: [AUCTeX-devel] Wrap dollars around active region, David Kastrup, 2013/06/05
- Re: [AUCTeX-devel] Wrap dollars around active region, Tassilo Horn, 2013/06/05
- Re: [AUCTeX-devel] Wrap dollars around active region, David Kastrup, 2013/06/05
- Re: [AUCTeX-devel] Wrap dollars around active region, Tassilo Horn, 2013/06/05
- Re: [AUCTeX-devel] Wrap dollars around active region,
Mosè Giordano <=
- Re: [AUCTeX-devel] Wrap dollars around active region, Tassilo Horn, 2013/06/06
- Re: [AUCTeX-devel] Wrap dollars around active region, Mosè Giordano, 2013/06/06
- Re: [AUCTeX-devel] Wrap dollars around active region, Tassilo Horn, 2013/06/06
- Re: [AUCTeX-devel] Wrap dollars around active region, Mosè Giordano, 2013/06/07
- Re: [AUCTeX-devel] Wrap dollars around active region, Tassilo Horn, 2013/06/07
- Re: [AUCTeX-devel] Wrap dollars around active region, Mosè Giordano, 2013/06/07
- Re: [AUCTeX-devel] Wrap dollars around active region, Tassilo Horn, 2013/06/07
- Re: [AUCTeX-devel] Wrap dollars around active region, Mosè Giordano, 2013/06/07
- Re: [AUCTeX-devel] Wrap dollars around active region, David Kastrup, 2013/06/06
- Re: [AUCTeX-devel] Wrap dollars around active region, Mosè Giordano, 2013/06/06