And the associated ChangeLog entry.  I only found one way to define
savebox, which is the \newsavebox command.

I hope I got everything correct in the ChangeLog entry this time :-)

2013-01-15  Mads Jensen  <[email protected]>

        * 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' function for
        completion and `definition' argument.

Now, the completion wish for sboxes and counters can be removed from the
TODO file.
-- 
Med Venlig Hilsen / Kind Regards,
Mads Jensen
Rubinsteinsvej 31,st.th
DK-2450 Kbh. SV
Denmark
+45 6168 8518
My brain is my second favorite organ.
      -- Woody Allen
Index: latex.el
===================================================================
RCS file: /sources/auctex/auctex/latex.el,v
retrieving revision 5.480
diff -u -u -r5.480 latex.el
--- latex.el	15 Jan 2013 07:39:46 -0000	5.480
+++ latex.el	15 Jan 2013 19:10:19 -0000
@@ -1211,6 +1211,12 @@
     ("\\\\@definecounter{\\([A-Za-z]+\\)}" 1 LaTeX-auto-counter))
   "List of regular expressions matching LaTeX counters only.")
 
+;; `sbox' is just a short form of `savebox'
+(defvar LaTeX-auto-savebox-regexp-list
+  '(("\\\\newsavebox *{\\([A-Za-z]+\\)}" 1 LaTeX-auto-savebox))
+  "List of regular expressions matching LaTeX saveboxes and
+sboxes only.")
+
 (defvar LaTeX-auto-regexp-list
   (append
    (let ((token TeX-token-char))
@@ -1246,7 +1252,8 @@
    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-savebox-regexp-list)
   "List of regular expression matching common LaTeX macro definitions.")
 
 (defun LaTeX-split-bibs (match)
@@ -1435,6 +1442,7 @@
 (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 "savebox" "LaTeX")
 
 (fset 'LaTeX-add-bibliographies-auto
       (symbol-function 'LaTeX-add-bibliographies))
@@ -1602,18 +1610,19 @@
 	(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
+                                                        "Savebox")
+                                   (LaTeX-savebox-list)))))
+    (if (add definition (not (zerop (length savebox))))
+        (LaTeX-add-saveboxes savebox))
+    (TeX-argument-insert savebox optional)))
+     
 
 (defun TeX-arg-file (optional &optional prompt)
   "Prompt for a filename in the current directory.

Attachment: signature.asc
Description: OpenPGP digital signature

_______________________________________________
auctex-devel mailing list
[email protected]
https://lists.gnu.org/mailman/listinfo/auctex-devel

Reply via email to