[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: |
Arash Esbati |
Subject: |
bug#26096: 11.90.0; Inversion of macro arguments with active region |
Date: |
Thu, 21 Mar 2024 19:25:32 +0100 |
User-agent: |
Gnus/5.13 (Gnus v5.13) |
Arash Esbati <arash@gnu.org> writes:
> Ikumi Keita <ikumi@ikumi.que.jp> writes:
>
>> 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.
>
> (I'm going through old bug reports that unfortunately weren't resolved
> at the time.)
>
> Bonjour Didier,
>
> there were 2 responses to your query. Is there anything else we can do,
> or can we mark this report as done close it?
No further comments, therefore I'm closing this.
Best, Arash