[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 114/299: Wrap dollars around active region typing `$'.
From: |
Stefan Monnier |
Subject: |
[elpa] 114/299: Wrap dollars around active region typing `$'. |
Date: |
Sun, 02 Nov 2014 03:10:44 +0000 |
monnier pushed a commit to branch externals/auctex
in repository elpa.
commit d59628f1ee02abccc179c463214baddb5a17bf71
Author: Mosè Giordano <address@hidden>
Date: Tue May 7 23:48:56 2013 +0200
Wrap dollars around active region typing `$'.
* tex.el (TeX-electric-dollar): New variable.
(TeX-insert-dollar): Use it.
* doc/auctex.texi (Quotes): Document `TeX-electric-dollar'.
---
ChangeLog | 7 +++++++
doc/auctex.texi | 9 ++++++++-
tex.el | 33 +++++++++++++++++++++++----------
3 files changed, 38 insertions(+), 11 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index ca2086e..62e96e9 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2013-05-07 Mos� Giordano <address@hidden>
+
+ * tex.el (TeX-electric-dollar): New variable.
+ (TeX-insert-dollar): Use it.
+
+ * doc/auctex.texi (Quotes): Document `TeX-electric-dollar'.
+
2013-04-28 Mos� Giordano <address@hidden>
* tex-bar.el: Update copyright range.
diff --git a/doc/auctex.texi b/doc/auctex.texi
index fbf37fb..be12d8e 100644
--- a/doc/auctex.texi
+++ b/doc/auctex.texi
@@ -12,7 +12,7 @@ This manual is for @AUCTeX{}
(version @value{VERSION} from @value{UPDATED}),
a sophisticated TeX environment for Emacs.
-Copyright @copyright{} 1992-1995, 2001, 2002, 2004-2012
+Copyright @copyright{} 1992-1995, 2001, 2002, 2004-2013
Free Software Foundation, Inc.
@quotation
@@ -435,6 +435,13 @@ and put the point between them. If the variable
@code{blink-matching-paren} is non-nil the opening dollar will blink.
@end defopt
address@hidden TeX-electric-dollar
+Control the insertion of dollar signs when there is an active region
+outside math mode. If the variable is non-nil, typing @samp{$} will put
+a pair of single dollar around the active region and leave point after
+the closing dollar.
address@hidden defopt
+
@subheading Braces
To avoid unbalanced braces, it is useful to insert them pairwise. You
diff --git a/tex.el b/tex.el
index 329ad12..f18719d 100644
--- a/tex.el
+++ b/tex.el
@@ -5169,6 +5169,13 @@ typing a single `$'."
:group 'TeX-macro
:type 'boolean)
+(defcustom TeX-electric-dollar nil
+ "When outside math mode, if non-nil and there is an active
+region, typing `$' will put a pair of single dollar around it and
+leave point after the closing dollar."
+ :group 'TeX-macro
+ :type 'boolean)
+
(defun TeX-insert-dollar (&optional arg)
"Insert dollar sign.
@@ -5217,16 +5224,23 @@ sign. With optional ARG, insert that many dollar
signs."
(insert "$")))
(t
;; Just somewhere in the text.
- (if TeX-math-close-single-dollar
+ (if (and TeX-electric-dollar (TeX-active-mark))
(progn
- (insert "$$")
- (if blink-matching-paren
- (progn
- (backward-char 2)
- (sit-for blink-matching-delay)
- (forward-char))
- (backward-char)))
- (insert "$"))))
+ (if (> (point) (mark))
+ (exchange-point-and-mark))
+ (insert "$")
+ (exchange-point-and-mark)
+ (insert "$"))
+ (if TeX-math-close-single-dollar
+ (progn
+ (insert "$$")
+ (if blink-matching-paren
+ (progn
+ (backward-char 2)
+ (sit-for blink-matching-delay)
+ (forward-char))
+ (backward-char)))
+ (insert "$")))))
(TeX-math-input-method-off))
(defvar TeX-math-input-method-off-regexp
@@ -5701,7 +5715,6 @@ NAME may be a package, a command, or a document."
;; delsel.el, `delete-selection-mode'
(put 'TeX-newline 'delete-selection t)
-(put 'TeX-insert-dollar 'delete-selection t)
(put 'TeX-insert-quote 'delete-selection t)
(put 'TeX-insert-backslash 'delete-selection t)
- [elpa] 100/299: Better unbinding of SPC in LaTeX-arg-acro-key-val and LaTeX-arg-siunitx-unit., (continued)
- [elpa] 100/299: Better unbinding of SPC in LaTeX-arg-acro-key-val and LaTeX-arg-siunitx-unit., Stefan Monnier, 2014/11/01
- [elpa] 106/299: Add beamer class options., Stefan Monnier, 2014/11/01
- [elpa] 95/299: Add new style files acro.el and acronym.el., Stefan Monnier, 2014/11/01
- [elpa] 108/299: Some improvements to amsthm style file., Stefan Monnier, 2014/11/01
- [elpa] 107/299: Add counters and pagestyle to some class styles., Stefan Monnier, 2014/11/01
- [elpa] 110/299: Set default environment for some class styles., Stefan Monnier, 2014/11/01
- [elpa] 113/299: Change BibTeX button to Biber when LaTeX-using-biber is non-nil., Stefan Monnier, 2014/11/01
- [elpa] 112/299: Add new variable `LaTeX-default-document-environment'., Stefan Monnier, 2014/11/01
- [elpa] 111/299: Add history variables in some style files., Stefan Monnier, 2014/11/01
- [elpa] 115/299: Document LaTeX-default-document-environment., Stefan Monnier, 2014/11/01
- [elpa] 114/299: Wrap dollars around active region typing `$'.,
Stefan Monnier <=
- [elpa] 119/299: Fixes to TeX-arg-index-tag, TeX-arg-cite, TeX-parse-arguments., Stefan Monnier, 2014/11/01
- [elpa] 117/299: Insert one $ when point is in a verbatim construct., Stefan Monnier, 2014/11/01
- [elpa] 109/299: Fix in TeX-arg-insert-braces., Stefan Monnier, 2014/11/01
- [elpa] 121/299: Silence some compilation warning., Stefan Monnier, 2014/11/01
- [elpa] 124/299: Make forward PDF search with Okular work., Stefan Monnier, 2014/11/01
- [elpa] 123/299: Fix docstring of `TeX-source-correlate-sync-source'., Stefan Monnier, 2014/11/01
- [elpa] 116/299: Temporary fix for font-latex-jit-lock-force-redisplay., Stefan Monnier, 2014/11/01
- [elpa] 126/299: Fix for autogen.sh., Stefan Monnier, 2014/11/01
- [elpa] 118/299: Add new style files fancyvrb.el and xparse.el., Stefan Monnier, 2014/11/01
- [elpa] 125/299: Simplify LaTeX-env-figure function., Stefan Monnier, 2014/11/01