[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[AUCTeX] Re: TeX-insert-dollar
From: |
Ralf Angeli |
Subject: |
[AUCTeX] Re: TeX-insert-dollar |
Date: |
Fri, 07 Jul 2006 22:33:23 +0200 |
* Ralf Angeli (2006-07-03) writes:
> * David Kastrup (2006-07-03) writes:
>
>> We might leave the current behavior as an option, but for keeping it
>> as a default, I want to hear more than theoretic rationalizations
>> (without them, the feature wouldn't even be there). I want to hear
>> someone actually speaking up for (or against) it who is affected.
>
> Let's deactivate it. I doubt we will get much feedback on this list.
How about the following patch?
--- tex.el 07 Jul 2006 21:06:48 +0200 5.581
+++ tex.el 07 Jul 2006 22:30:20 +0200
@@ -4446,6 +4446,11 @@
(concat "^" (regexp-quote TeX-dollar-string) "\\|[^" TeX-esc "]"
(regexp-quote TeX-dollar-string)))
+(defcustom TeX-math-insert-double-dollar nil
+ "If non-nil close double dollar math by typing a single `$'."
+ :group 'TeX-macro
+ :type 'boolean)
+
(defcustom TeX-math-toggle-off-input-method t
"*If non-nil, auto toggle off CJK input methods when entering math mode."
:group 'TeX-macro
@@ -4478,14 +4483,18 @@
(string-equal (substring (car texmathp-why) 0 1) "\$"))
;; Math mode was turned on with $ or $$ - so finish it accordingly.
(progn
- (insert (car texmathp-why))
- (save-excursion
- (goto-char (cdr texmathp-why))
- (if (pos-visible-in-window-p)
- (sit-for 1)
- (message "Matches %s"
- (buffer-substring (point)
- (progn (end-of-line) (point)))))))
+ (if TeX-math-insert-double-dollar
+ (insert (car texmathp-why))
+ (insert "$"))
+ (when (or (string= (car texmathp-why) "$")
+ (zerop (mod (save-excursion (skip-chars-backward "$")) 2)))
+ (save-excursion
+ (goto-char (cdr texmathp-why))
+ (if (pos-visible-in-window-p)
+ (sit-for 1)
+ (message "Matches %s"
+ (buffer-substring
+ (point) (progn (end-of-line) (point))))))))
;; Math mode was not entered with dollar - we cannot finish it with one.
(message "Math mode started with `%s' cannot be closed with dollar"
(car texmathp-why))
--
Ralf
- [AUCTeX] Re: TeX-insert-dollar, Ralf Angeli, 2006/07/01
- Re: [AUCTeX] Re: TeX-insert-dollar, David Kastrup, 2006/07/01
- [AUCTeX] Re: TeX-insert-dollar, Ralf Angeli, 2006/07/02
- Re: [AUCTeX] Re: TeX-insert-dollar, David Kastrup, 2006/07/02
- [AUCTeX] Re: TeX-insert-dollar, Ralf Angeli, 2006/07/03
- Re: [AUCTeX] Re: TeX-insert-dollar, David Kastrup, 2006/07/03
- Re: [AUCTeX] Re: TeX-insert-dollar, Jean Magnan de Bornier, 2006/07/03
- Re: [AUCTeX] Re: TeX-insert-dollar, Ralf Angeli, 2006/07/03
- [AUCTeX] Re: TeX-insert-dollar,
Ralf Angeli <=