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 @@ ("address@hidden([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.