[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#26096: 11.90.0; Inversion of macro arguments with active region
From: |
Ikumi Keita |
Subject: |
bug#26096: 11.90.0; Inversion of macro arguments with active region |
Date: |
Wed, 15 Mar 2017 23:03:28 +0900 |
Hi Didier,
> I'm trying to define a macro using the active region (when available) as
> its second argument. There is no general facility for using the active
> region as an argument value (to the best of my knowledge, there's only
> the -1 specification, but it encompasses the macro name itself).
(snip)
> (defun LaTeX-fixme-active-region (optional)
> (TeX-argument-insert (if (TeX-active-mark)
> (prog1 (buffer-substring (point) (mark))
> (delete-region (point) (mark))
> (deactivate-mark))
> "")
> optional))
> Now defining my macro as follows:
> (TeX-add-symbols `("foo" t LaTeX-fixme-active-region))
> will entail the same behavior as with TeX-insert-braces, so I'm enclined
> to call that a bug (saving the excursion won't change anything BTW).
> Any comment appreciated, thanks!
How about this one? With very breif testing, it seems to work:
(defun LaTeX-fixme-active-region (optional)
(TeX-argument-insert "" nil)
(TeX-parse-argument optional nil))
(TeX-add-symbols '("foo" LaTeX-fixme-active-region))
The idea is very crude and ad hoc, but it does the required job anyway,
at the cost that it looks as if the macro "foo" took only one argument.
Regards,
Ikumi Keita