[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [AUCTeX-devel] [PATCH] Various patches
From: |
Arash Esbati |
Subject: |
Re: [AUCTeX-devel] [PATCH] Various patches |
Date: |
Mon, 24 Aug 2015 22:49:12 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.5 |
Mosè Giordano <address@hidden> writes:
Hi Mosè,
> 2015-08-22 12:13 GMT+02:00 Arash Esbati <address@hidden>:
>> As always, any comments welcome.
>
> I reviewed your patches, they're overall fine, as usual, I have only a
> minor concern about captionbox: for the label you could simply call
>
> (TeX-insert-macro "label")
>
> which will do the-right-thing.
Many thanks again for looking at this. Indeed, `TeX-insert-macro' does
the trick. Now I have:
--8<---------------cut here---------------start------------->8---
(defun LaTeX-arg-caption-captionbox (optional &optional star prompt)
"Query for the arguments of `\\captionbox' incl. a label and
insert them. If STAR is t, then do not query for a `\\label' and
insert only a caption."
(let ((caption (TeX-read-string (TeX-argument-prompt optional prompt
"Caption")))
(TeX-arg-opening-brace "{")
(TeX-arg-closing-brace "}"))
(LaTeX-indent-line)
(insert TeX-arg-opening-brace caption)
(unless star (TeX-insert-macro "label"))
(insert TeX-arg-closing-brace))
(let ((width (completing-read (TeX-argument-prompt t prompt "Width")
(mapcar (lambda(elt) (concat TeX-esc (car
elt)))
(LaTeX-length-list))))
(inpos (completing-read (TeX-argument-prompt t prompt "Inner position")
'("c" "l" "r" "s"))))
(cond (;; 2 optional args
(and width (not (string-equal width ""))
inpos (not (string-equal inpos "")))
(insert (format "[%s][%s]" width inpos)))
(;; 1st empty opt. arg, 2nd opt. arg
(and (string-equal width "")
inpos (not (string-equal inpos "")))
(insert (format "[][%s]" inpos)))
(;; 1st opt. arg, 2nd empty opt. arg
(and width (not (string-equal width ""))
(string-equal inpos ""))
(insert (format "[%s]" width)))
(t ; Do nothing if both empty
(ignore))))
(LaTeX-fill-paragraph))
--8<---------------cut here---------------end--------------->8---
I will clean up the code and make a new patch this weekend. Reg. the
other patches, I could also re-submit them as well. Just give me a hint
how you want to proceed.
Best, Arash