[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [AUCTeX-devel] [PATCH] Various patches
From: |
Mosè Giordano |
Subject: |
Re: [AUCTeX-devel] [PATCH] Various patches |
Date: |
Mon, 24 Aug 2015 23:13:04 +0200 |
Hi Arash,
2015-08-24 22:49 GMT+02:00 Arash Esbati <address@hidden>:
> 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---
Regarding `TeX-arg-{opening,closing}-brace' values, we have
`TeX-gr{op,cl}' variables, avoid using hardcoded "{" and "}". In
addition, since there is an `optional' argument you may want to bind
`TeX-arg-{opening,closing}-brace' to `LaTeX-opt{op,cl}' when
`optional' is non-nil, but that argument is actually always mandatory
in real cases so this could be an overkill.
> 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.
It would be great if you manage to resend a full changeset, but
working with ChangeLog conflicts is a bit tedious. You could create a
branch from current AUCTeX master HEAD and cherry-pick one by one your
commits and fix one by one ChangeLog conflicts. This should work.
Bye,
Mosè