2051 |
then use square brackets instead of curly braces. |
then use square brackets instead of curly braces. |
2052 |
|
|
2053 |
See `TeX-parse-macro' for details." |
See `TeX-parse-macro' for details." |
2054 |
(cond ((stringp arg) |
(let (insert-flag) |
2055 |
(TeX-arg-string optional arg)) |
(cond ((stringp arg) |
2056 |
((numberp arg) |
(TeX-arg-string optional arg) |
2057 |
(unless (< arg 1) |
(setq insert-flag t)) |
2058 |
(TeX-parse-argument optional t) |
((numberp arg) |
2059 |
(while (> arg 1) |
(unless (< arg 1) |
2060 |
(TeX-parse-argument optional nil) |
(TeX-parse-argument optional t) |
2061 |
(setq arg (- arg 1))))) |
(while (> arg 1) |
2062 |
((null arg) |
(TeX-parse-argument optional nil) |
2063 |
(insert TeX-arg-opening-brace) |
(setq arg (- arg 1))))) |
2064 |
(when (and (not optional) (TeX-active-mark)) |
((null arg) |
2065 |
(exchange-point-and-mark)) |
(insert TeX-arg-opening-brace) |
2066 |
(insert TeX-arg-closing-brace)) |
(when (and (not optional) (TeX-active-mark)) |
2067 |
((eq arg t) |
(exchange-point-and-mark)) |
2068 |
(insert TeX-arg-opening-brace) |
(insert TeX-arg-closing-brace) |
2069 |
(if (and (not optional) (TeX-active-mark)) |
(setq insert-flag t)) |
2070 |
(progn |
((eq arg t) |
2071 |
(exchange-point-and-mark)) |
(insert TeX-arg-opening-brace) |
2072 |
(set-marker exit-mark (point))) |
(if (and (not optional) (TeX-active-mark)) |
2073 |
(insert TeX-arg-closing-brace)) |
(progn |
2074 |
((symbolp arg) |
(exchange-point-and-mark)) |
2075 |
(funcall arg optional)) |
(set-marker exit-mark (point))) |
2076 |
((listp arg) |
(insert TeX-arg-closing-brace) |
2077 |
(let ((head (car arg)) |
(setq insert-flag t)) |
2078 |
(tail (cdr arg))) |
((symbolp arg) |
2079 |
(cond ((stringp head) |
(funcall arg optional)) |
2080 |
(apply 'TeX-arg-string optional arg)) |
((listp arg) |
2081 |
((symbolp head) |
(let ((head (car arg)) |
2082 |
(apply head optional tail)) |
(tail (cdr arg))) |
2083 |
(t (error "Unknown list argument type %s" |
(cond ((stringp head) |
2084 |
(prin1-to-string head)))))) |
(apply 'TeX-arg-string optional arg)) |
2085 |
(t (error "Unknown argument type %s" (prin1-to-string arg)))) |
((symbolp head) |
2086 |
(when (and (not optional) (TeX-active-mark)) |
(apply head optional tail)) |
2087 |
(if (featurep 'xemacs) |
(t (error "Unknown list argument type %s" |
2088 |
(zmacs-deactivate-region) |
(prin1-to-string head)))))) |
2089 |
(deactivate-mark)))) |
(t (error "Unknown argument type %s" (prin1-to-string arg)))) |
2090 |
|
(when (and insert-flag (not optional) (TeX-active-mark)) |
2091 |
|
(if (featurep 'xemacs) |
2092 |
|
(zmacs-deactivate-region) |
2093 |
|
(deactivate-mark))))) |
2094 |
|
|
2095 |
(defun TeX-argument-insert (name optional &optional prefix) |
(defun TeX-argument-insert (name optional &optional prefix) |
2096 |
"Insert NAME surrounded by curly braces. |
"Insert NAME surrounded by curly braces. |