[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[elpa] 35/299: * latex.el (LaTeX-auto-length-regexp-list): New variable.
From: |
Stefan Monnier |
Subject: |
[elpa] 35/299: * latex.el (LaTeX-auto-length-regexp-list): New variable. (LaTeX-auto-regexp-list): Use `LaTeX-auto-length-regexp-list'. ("length"): New type for the parser. (TeX-arg-length): New function. (TeX-arg-define-length): New function. (LaTeX-common-initialization): Initialize some standard LaTeX lengths and use `TeX-arg-length' and `TeX-arg-define-length' for completion of some macros. |
Date: |
Sun, 02 Nov 2014 03:10:05 +0000 |
monnier pushed a commit to branch externals/auctex
in repository elpa.
commit 15071d7633cca4f46dfe4742143d0d968e63c772
Author: Tassilo Horn <address@hidden>
Date: Thu Jan 17 07:20:42 2013 +0000
* latex.el (LaTeX-auto-length-regexp-list): New variable.
(LaTeX-auto-regexp-list): Use `LaTeX-auto-length-regexp-list'.
("length"): New type for the parser.
(TeX-arg-length): New function.
(TeX-arg-define-length): New function.
(LaTeX-common-initialization): Initialize some standard LaTeX
lengths and use `TeX-arg-length' and `TeX-arg-define-length' for
completion of some macros.
---
ChangeLog | 11 +++++++++
latex.el | 75 ++++++++++++++++++++++++++++++++++++++++++++++++------------
2 files changed, 71 insertions(+), 15 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 0377365..b2013e3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2013-01-16 Mos� Giordano <address@hidden>
+
+ * latex.el (LaTeX-auto-length-regexp-list): New variable.
+ (LaTeX-auto-regexp-list): Use `LaTeX-auto-length-regexp-list'.
+ ("length"): New type for the parser.
+ (TeX-arg-length): New function.
+ (TeX-arg-define-length): New function.
+ (LaTeX-common-initialization): Initialize some standard LaTeX
+ lengths and use `TeX-arg-length' and `TeX-arg-define-length' for
+ completion of some macros.
+
2013-01-15 Tassilo Horn <address@hidden>
* doc/auctex.texi: Document that `TeX-arg-counter' does completion
diff --git a/latex.el b/latex.el
index 0dd64ad..4eb80f6 100644
--- a/latex.el
+++ b/latex.el
@@ -1211,6 +1211,10 @@ This is necessary since index entries may contain
commands and stuff.")
("address@hidden([A-Za-z]+\\)}" 1 LaTeX-auto-counter))
"List of regular expressions matching LaTeX counters only.")
+(defvar LaTeX-auto-length-regexp-list
+ '(("\\\\newlength *{?\\\\\\([A-Za-z]+\\)}?" 1 LaTeX-auto-length))
+ "List of regular expressions matching LaTeX lengths only.")
+
(defvar LaTeX-auto-regexp-list
(append
(let ((token TeX-token-char))
@@ -1246,7 +1250,8 @@ This is necessary since index entries may contain
commands and stuff.")
LaTeX-auto-index-regexp-list
LaTeX-auto-minimal-regexp-list
LaTeX-auto-pagestyle-regexp-list
- LaTeX-auto-counter-regexp-list)
+ LaTeX-auto-counter-regexp-list
+ LaTeX-auto-length-regexp-list)
"List of regular expression matching common LaTeX macro definitions.")
(defun LaTeX-split-bibs (match)
@@ -1435,6 +1440,7 @@ The input string may include LaTeX comments and newlines."
(TeX-auto-add-type "index-entry" "LaTeX" "index-entries")
(TeX-auto-add-type "pagestyle" "LaTeX")
(TeX-auto-add-type "counter" "LaTeX")
+(TeX-auto-add-type "length" "LaTeX")
(fset 'LaTeX-add-bibliographies-auto
(symbol-function 'LaTeX-add-bibliographies))
@@ -1615,6 +1621,30 @@ string. DEFINITION is unused."
t))
optional TeX-esc))
+(defun TeX-arg-length (optional &optional prompt initial-input definition)
+ "Prompt for a LaTeX length.
+If OPTIONAL is non-nil, insert the resulting value as an optional
+argument, otherwise as a mandatory one. Use PROMPT as the prompt
+string. If INITIAL-INPUT is non-nil, insert it in the minibuffer
+initially, with point positioned at the end. If DEFINITION is
+non-nil, the length is added to the list of defined length."
+ (let ((length (completing-read (TeX-argument-prompt optional prompt "Length")
+ ;; A valid length can be a macro or a length of
+ ;; the form <value><dimension>. Input starting
+ ;; with a `\' can be completed with length
+ ;; macros.
+ (mapcar (lambda(elt) (concat TeX-esc (car
elt)))
+ (LaTeX-length-list))
+ ;; Some macros takes as argument only a length
+ ;; macro (e.g., `\setlength' in its first
+ ;; argument, and `\newlength'), in this case is
+ ;; convenient to set `\\' as initial input.
+ nil nil initial-input)))
+ (if (and definition (not (zerop (length length))))
+ ;; Strip leading TeX-esc from macro name
+ (LaTeX-add-lengths (substring length 1)))
+ (TeX-argument-insert length optional)))
+
(defun TeX-arg-file (optional &optional prompt)
"Prompt for a filename in the current directory.
If OPTIONAL is non-nil, insert the resulting value as an optional
@@ -1667,6 +1697,13 @@ argument, otherwise as a mandatory one. Use PROMPT as
the prompt
string."
(TeX-arg-savebox optional prompt t))
+(defun TeX-arg-define-length (optional &optional prompt)
+ "Prompt for a LaTeX length.
+If OPTIONAL is non-nil, insert the resulting value as an optional
+argument, otherwise as a mandatory one. Use PROMPT as the prompt
+string."
+ (TeX-arg-length optional prompt "\\" t))
+
(defcustom LaTeX-style-list '(("amsart")
("amsbook")
("article")
@@ -5280,6 +5317,12 @@ i.e. you do _not_ have to cater for this yourself by
adding \\\\' or $."
(LaTeX-add-counters "page" "equation" "enumi" "enumii" "enumiii"
"enumiv" "footnote" "mpfootnote")
+ (LaTeX-add-lengths "baselineskip" "baselinestretch" "columnsep"
+ "columnwidth" "evensidemargin" "linewidth" "oddsidemargin"
+ "paperwidth" "paperheight" "parindent" "parskip"
+ "tabcolsep" "textheight" "textwidth" "topmargin"
+ "unitlength")
+
(TeX-add-symbols
'("addtocounter" TeX-arg-counter "Value")
'("alph" TeX-arg-counter)
@@ -5373,12 +5416,14 @@ i.e. you do _not_ have to cater for this yourself by
adding \\\\' or $."
t)
'("footnotemark"
(TeX-arg-conditional TeX-arg-footnote-number-p ([ "Number" ]) nil))
- '("newlength" TeX-arg-define-macro)
- '("setlength" TeX-arg-macro "Length")
- '("addtolength" TeX-arg-macro "Length")
- '("settowidth" TeX-arg-macro t)
- '("settoheight" TeX-arg-macro t)
- '("settodepth" TeX-arg-macro t)
+ '("newlength" (TeX-arg-define-length "Length macro"))
+ '("setlength" (TeX-arg-length "Length macro" "\\")
+ (TeX-arg-length "Length value"))
+ '("addtolength" (TeX-arg-length "Length macro" "\\")
+ (TeX-arg-length "Length to add"))
+ '("settowidth" (TeX-arg-length "Length macro" "\\") "Text")
+ '("settoheight" (TeX-arg-length "Length macro" "\\") "Text")
+ '("settodepth" (TeX-arg-length "Length macro" "\\") "Text")
'("\\" [ "Space" ])
'("\\*" [ "Space" ])
'("hyphenation" t)
@@ -5410,10 +5455,10 @@ i.e. you do _not_ have to cater for this yourself by
adding \\\\' or $."
'("markboth" t nil)
'("markright" t)
'("thispagestyle" TeX-arg-pagestyle)
- '("addvspace" "Length")
+ '("addvspace" TeX-arg-length)
'("fbox" t)
- '("hspace*" "Length")
- '("hspace" "Length")
+ '("hspace*" TeX-arg-length)
+ '("hspace" TeX-arg-length)
'("mbox" t)
'("newsavebox" TeX-arg-define-savebox)
'("parbox" [ TeX-arg-tb ] [ "Height" ] [ TeX-arg-tb "Inner position" ]
@@ -5422,8 +5467,8 @@ i.e. you do _not_ have to cater for this yourself by
adding \\\\' or $."
'("rule" [ "Raise" ] "Width" "Thickness")
'("sbox" TeX-arg-savebox t)
'("usebox" TeX-arg-savebox)
- '("vspace*" "Length")
- '("vspace" "Length")
+ '("vspace*" TeX-arg-length)
+ '("vspace" TeX-arg-length)
'("documentstyle" TeX-arg-document)
'("include" (TeX-arg-input-file "File" t))
'("includeonly" t)
@@ -5475,9 +5520,9 @@ i.e. you do _not_ have to cater for this yourself by
adding \\\\' or $."
'("filecontents*" LaTeX-env-contents))
(TeX-add-symbols
- '("enlargethispage" "Length")
- '("enlargethispage*" "Length")
- '("tabularnewline" [ "Length" ])
+ '("enlargethispage" TeX-arg-length)
+ '("enlargethispage*" TeX-arg-length)
+ '("tabularnewline" [ TeX-arg-length ])
'("suppressfloats" [ TeX-arg-tb "Suppress floats position" ])
'("ensuremath" "Math commands")
'("textsuperscript" "Text")
- [elpa] 29/299: * style/pstricks.el (LaTeX-pstricks-package-options): New variable., (continued)
- [elpa] 29/299: * style/pstricks.el (LaTeX-pstricks-package-options): New variable., Stefan Monnier, 2014/11/01
- [elpa] 28/299: * Makefile.in (STYLESRC): Enable memoir.el style. * style/memoir.el: New style., Stefan Monnier, 2014/11/01
- [elpa] 32/299: * style/ulem.el (LaTeX-arg-fontdecl, LaTeX-arg-fontcmd): Fix declarations., Stefan Monnier, 2014/11/01
- [elpa] 34/299: Fix previous change to auctex.texi., Stefan Monnier, 2014/11/01
- [elpa] 30/299: * style/varioref.el: Update copyright range. ("varioref"): Add more definitions. (LaTeX-varioref-package-options): Reformat., Stefan Monnier, 2014/11/01
- [elpa] 36/299: * doc/auctex.texi: Document `TeX-arg-length' and `TeX-arg-define-length'., Stefan Monnier, 2014/11/01
- [elpa] 37/299: * doc/todo.texi: Remove the todo concerning completion for counters that was implemented by Mosè Giordano on 2013-01-15., Stefan Monnier, 2014/11/01
- [elpa] 31/299: * style/listings.el: Update copyright range. (LaTeX-listings-key-val-options, "listings") (LaTeX-listings-package-options): Update to recent listings version., Stefan Monnier, 2014/11/01
- [elpa] 38/299: * style/placeins.el: New style., Stefan Monnier, 2014/11/01
- [elpa] 39/299: * texmathp.el (texmathp-tex-commands-default): Add \shortintertext., Stefan Monnier, 2014/11/01
- [elpa] 35/299: * latex.el (LaTeX-auto-length-regexp-list): New variable. (LaTeX-auto-regexp-list): Use `LaTeX-auto-length-regexp-list'. ("length"): New type for the parser. (TeX-arg-length): New function. (TeX-arg-define-length): New function. (LaTeX-common-initialization): Initialize some standard LaTeX lengths and use `TeX-arg-length' and `TeX-arg-define-length' for completion of some macros.,
Stefan Monnier <=
- [elpa] 40/299: * Makefile.in (STYLESRC): Activate new style placeins.el., Stefan Monnier, 2014/11/01
- [elpa] 33/299: * doc/auctex.texi: Document that `TeX-arg-counter' does completion now. * latex.el (LaTeX-auto-pagestyle-regexp-list): Fix typo. (LaTeX-auto-counter-regexp-list): New variable. (LaTeX-auto-regexp-list): Use `LaTeX-auto-counter-regexp-list'. ("counter"): New type for the parser. (TeX-arg-counter): Use `LaTeX-counter-list' function for completion and `definition' argument. (TeX-arg-pagestyle): Use `definition' argument. (LaTeX-common-initialization): Initialize counters., Stefan Monnier, 2014/11/01
- [elpa] 41/299: * tex-buf.el (TeX-output-revert-buffer): New function. (TeX-special-mode, TeX-output-mode): New major modes. (TeX-special-mode-map, TeX-output-mode-map): New variables., Stefan Monnier, 2014/11/01
- [elpa] 43/299: * tex-buf.el (TeX-output-mode): Make revert-buffer-function buffer local before setting it to TeX-output-revert-buffer., Stefan Monnier, 2014/11/01
- [elpa] 42/299: * auctex.texi: Updated documetation about ChkTeX and lacheck. Fixed typos., Stefan Monnier, 2014/11/01
- [elpa] 44/299: * style/siunitx.el ("siunitx"): Add `\gram' and `\SendSettingsToPgf'., Stefan Monnier, 2014/11/01
- [elpa] 46/299: * latex.el (LaTeX-env-contents): Replaced regular expression with `LaTeX-header-end', i.e., filecontents environments must go somewhere in the preamble but not necessarily before the \documentclass., Stefan Monnier, 2014/11/01
- [elpa] 45/299: * latex.el (LaTeX-auto-savebox-regexp-list): New variable. (LaTeX-auto-regexp-list): Use `LaTeX-auto-savebox-regexp-list'. ("savebox"): New type for the parser. (TeX-arg-savebox): Use `LaTeX-savebox-list' for completion and `definition' argument. (LaTeX-common-initialization): Added makeatletter, makeatother, and jobname macros. (LaTeX-default-options): Changed documentstyle to documentclass in docstring., Stefan Monnier, 2014/11/01
- [elpa] 47/299: * doc/todo.texi (Wishlist): Remove "Completion for sboxes"., Stefan Monnier, 2014/11/01
- [elpa] 48/299: * style/biblatex.el: Update copyright range. ("biblatex"): Check `backend' option value in `TeX-active-styles'. * tex-style.el: Update copyright years. (LaTeX-biblatex-use-Biber) Remove unused variable. * tex.el: Update copyright range. (TeX-auto-add-type): Append new type to `TeX-auto-parser' instead of prepending it. (TeX-auto-store): Fix indentation of first lines of parsed file. * latex.el (LaTeX-auto-cleanup): Append options and styles to `TeX-auto-file' instead of prepending them., Stefan Monnier, 2014/11/01