emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] 45/299: * latex.el (LaTeX-auto-savebox-regexp-list): New variable


From: Stefan Monnier
Subject: [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.
Date: Sun, 02 Nov 2014 03:10:10 +0000

monnier pushed a commit to branch externals/auctex
in repository elpa.

commit d80ec1562b02978fabdb3b2af6e7f466c2260bf0
Author: Tassilo Horn <address@hidden>
Date:   Mon Jan 28 08:35:44 2013 +0000

    * 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.
---
 ChangeLog |   12 ++++++++++++
 latex.el  |   32 ++++++++++++++++++++------------
 2 files changed, 32 insertions(+), 12 deletions(-)

diff --git a/ChangeLog b/ChangeLog
index 20eaf04..73b0151 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2013-01-26  Mads Jensen  <address@hidden>
+
+       * 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.
+
 2013-01-25  Mos´┐Ż Giordano  <address@hidden>
 
        * style/siunitx.el ("siunitx"): Add `\gram' and
diff --git a/latex.el b/latex.el
index 4eb80f6..3464ad1 100644
--- a/latex.el
+++ b/latex.el
@@ -48,8 +48,8 @@
   :type 'string)
 
 (defcustom LaTeX-default-options nil
-  "Default options to documentstyle.
-A list of strings."
+  "Default options to documentclass.
+A comma-seperated list of strings."
   :group 'LaTeX-environment
   :type '(repeat (string :format "%v")))
 
@@ -1215,6 +1215,10 @@ This is necessary since index entries may contain 
commands and stuff.")
   '(("\\\\newlength *{?\\\\\\([A-Za-z]+\\)}?" 1 LaTeX-auto-length))
   "List of regular expressions matching LaTeX lengths only.")
 
+(defvar LaTeX-auto-savebox-regexp-list
+  '(("\\\\newsavebox *{?\\\\\\([A-Za-z]+\\)}?" 1 LaTeX-auto-savebox))
+  "List of regular expressions matching LaTeX saveboxes only.")
+
 (defvar LaTeX-auto-regexp-list
   (append
    (let ((token TeX-token-char))
@@ -1251,7 +1255,8 @@ This is necessary since index entries may contain 
commands and stuff.")
    LaTeX-auto-minimal-regexp-list
    LaTeX-auto-pagestyle-regexp-list
    LaTeX-auto-counter-regexp-list
-   LaTeX-auto-length-regexp-list)
+   LaTeX-auto-length-regexp-list
+   LaTeX-auto-savebox-regexp-list)
   "List of regular expression matching common LaTeX macro definitions.")
 
 (defun LaTeX-split-bibs (match)
@@ -1441,6 +1446,7 @@ The input string may include LaTeX comments and newlines."
 (TeX-auto-add-type "pagestyle" "LaTeX")
 (TeX-auto-add-type "counter" "LaTeX")
 (TeX-auto-add-type "length" "LaTeX")
+(TeX-auto-add-type "savebox" "LaTeX" "saveboxes")
 
 (fset 'LaTeX-add-bibliographies-auto
       (symbol-function 'LaTeX-add-bibliographies))
@@ -1608,18 +1614,19 @@ the list of defined counters."
        (LaTeX-add-counters counter))
     (TeX-argument-insert counter optional)))
 
-;; Why is DEFINITION unused?
 (defun TeX-arg-savebox (optional &optional prompt definition)
   "Prompt for a LaTeX savebox.
 If OPTIONAL is non-nil, insert the resulting value as an optional
 argument, otherwise as a mandatory one.  Use PROMPT as the prompt
-string.  DEFINITION is unused."
-  ;; Completion not implemented yet.
-  (TeX-argument-insert
-   (read-string (TeX-argument-prompt optional prompt
-                                    (concat "Savebox: " TeX-esc)
-                                    t))
-   optional TeX-esc))
+string.  If definition is non-nil, the savebox is added to the
+list of defined saveboxes."
+  (let ((savebox (completing-read (TeX-argument-prompt optional prompt
+                                                      (concat "Savebox: "
+                                                              TeX-esc) t)
+                                   (LaTeX-savebox-list))))
+    (if (and definition (not (zerop (length savebox))))
+        (LaTeX-add-saveboxes savebox))
+    (TeX-argument-insert savebox optional TeX-esc)))
 
 (defun TeX-arg-length (optional &optional prompt initial-input definition)
   "Prompt for a LaTeX length.
@@ -5512,7 +5519,8 @@ i.e. you do _not_ have to cater for this yourself by 
adding \\\\' or $."
    "hfil" "hfill" "vfil" "vfill" "hrulefill" "dotfill"
    "indent" "noindent" "today"
    "appendix"
-   "dots")
+   "dots"
+   "makeatletter" "makeatother" "jobname")
 
   (when (string-equal LaTeX-version "2e")
     (LaTeX-add-environments



reply via email to

[Prev in Thread] Current Thread [Next in Thread]