GNU bug report logs - #26096
11.90.0; Inversion of macro arguments with active region

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: auctex; Reported by: Didier Verna <didier@HIDDEN>; Keywords: notabug; Done: Arash Esbati <arash@HIDDEN>; Maintainer for auctex is bug-auctex@HIDDEN.
bug closed, send any further explanations to 26096 <at> debbugs.gnu.org and Didier Verna <didier@HIDDEN> Request was from Arash Esbati <arash@HIDDEN> to control <at> debbugs.gnu.org. Full text available.
Added tag(s) notabug. Request was from Arash Esbati <arash@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

Message received at 26096 <at> debbugs.gnu.org:


Received: (at 26096) by debbugs.gnu.org; 21 Mar 2024 18:34:55 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Thu Mar 21 14:34:55 2024
Received: from localhost ([127.0.0.1]:51402 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rnNFe-0006Bh-OT
	for submit <at> debbugs.gnu.org; Thu, 21 Mar 2024 14:34:55 -0400
Received: from eggs.gnu.org ([209.51.188.92]:42162)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <arash@HIDDEN>) id 1rnNFX-00069p-T0
 for 26096 <at> debbugs.gnu.org; Thu, 21 Mar 2024 14:34:48 -0400
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <arash@HIDDEN>)
 id 1rnN6g-0003Wx-LP; Thu, 21 Mar 2024 14:25:38 -0400
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=IYE/2BO1Hl5IDjh8ifYP4Pj/nBwgS17Ou7L5s1tY140=; b=KBECi9RsFL/L03hogzrk
 aRyghm4glbuxWIFh8rcTUyjY4kJI9MgfWl/+AAWaa2BjhsiSL9ijQWlrBLGsVR6P8lI1ZpJYY2HI9
 k0R2obUyWJ7Ko/S8NEdRrtEOFjt22pVpVcgn6kVV13ldGyn8vAbdlHojnt6bsPJEHuwjq3uwPxBaw
 /mORxC64Cdd7vctv4z0iuklHIzHGC9k8Rqi13dS5IJax8pIwSdqQ7h5mktEGvkJ7X7L0CcOyOssvt
 i54IeG7bdyiA/3dADLKnb/zg/rUawnPerGgZEX6azhs0NvFnH17DrA6t+XsTVqfcOncZd2Z6ptuCu
 fZQ1g/AZCUtcEg==;
From: Arash Esbati <arash@HIDDEN>
To: Didier Verna <didier@HIDDEN>
Subject: Re: bug#26096: 11.90.0; Inversion of macro arguments with active
 region
In-Reply-To: <m21q8py706.fsf_-_@HIDDEN> (Arash Esbati's message
 of "Mon, 04 Mar 2024 23:19:53 +0100")
References: <m1o9x4q76m.fsf@HIDDEN> <39423.1489586608@localhost>
 <m21q8py706.fsf_-_@HIDDEN>
Date: Thu, 21 Mar 2024 19:25:32 +0100
Message-ID: <m27chvv3vn.fsf_-_@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 26096
Cc: 26096 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Arash Esbati <arash@HIDDEN> writes:

> Ikumi Keita <ikumi@HIDDEN> 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




Information forwarded to bug-auctex@HIDDEN:
bug#26096; Package auctex. Full text available.

Message received at 26096 <at> debbugs.gnu.org:


Received: (at 26096) by debbugs.gnu.org; 4 Mar 2024 22:20:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Mar 04 17:20:38 2024
Received: from localhost ([127.0.0.1]:45159 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1rhGfl-0001If-Pu
	for submit <at> debbugs.gnu.org; Mon, 04 Mar 2024 17:20:38 -0500
Received: from eggs.gnu.org ([209.51.188.92]:35114)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <arash@HIDDEN>) id 1rhGfj-0001IN-Cy
 for 26096 <at> debbugs.gnu.org; Mon, 04 Mar 2024 17:20:37 -0500
Received: from fencepost.gnu.org ([2001:470:142:3::e])
 by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)
 (Exim 4.90_1) (envelope-from <arash@HIDDEN>)
 id 1rhGf7-0003kU-Ly; Mon, 04 Mar 2024 17:19:57 -0500
DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org;
 s=fencepost-gnu-org; h=MIME-Version:Date:References:In-Reply-To:Subject:To:
 From; bh=pAqPsnJ824Bf5n5/idvGBEjHgr2DQHW73AWvIBMitCQ=; b=O5FbRa6Dt4PXN83uyUEA
 lqWhsH02KiKJivKNUxoDfeoL74gzmfdLwWegLdlvekTtGmXPjCC1GUamcyH9DR7g67lrpSHvxCqGi
 +c0FmjBBWA5K7pFr7tf7Z1UzBWqcU3pv5DlMRfs5U0qY763YUr141XWX06RNcFf6Mv5Ob20emaPVn
 edimeCKuv5pEro9oN36udrMeiCSCehNLx/njleIR4q+ltw9EycPNWF8xDuk8LyUNSTKFQA7XomQ/2
 fgbCLZcU3y6xfDf7QOQ4irPVRnfpNUH4P7B07rfzMhjDtUZ5hSKC+ZNnAkgJG9E4TQUR7ik/kTlcw
 rG2U79jLuCtvHA==;
From: Arash Esbati <arash@HIDDEN>
To: Ikumi Keita <ikumi@HIDDEN>
Subject: Re: bug#26096: 11.90.0; Inversion of macro arguments with active
 region
In-Reply-To: <39423.1489586608@localhost> (Ikumi Keita's message of "Wed, 15
 Mar 2017 23:03:28 +0900")
References: <m1o9x4q76m.fsf@HIDDEN> <39423.1489586608@localhost>
Date: Mon, 04 Mar 2024 23:19:53 +0100
Message-ID: <m21q8py706.fsf_-_@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13)
MIME-Version: 1.0
Content-Type: text/plain
X-Spam-Score: -2.3 (--)
X-Debbugs-Envelope-To: 26096
Cc: 26096 <at> debbugs.gnu.org, Didier Verna <didier@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -3.3 (---)

Ikumi Keita <ikumi@HIDDEN> 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?

Best, Arash




Information forwarded to bug-auctex@HIDDEN:
bug#26096; Package auctex. Full text available.

Message received at 26096 <at> debbugs.gnu.org:


Received: (at 26096) by debbugs.gnu.org; 15 Mar 2017 14:03:38 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 15 10:03:38 2017
Received: from localhost ([127.0.0.1]:57275 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1co9Wc-0004jD-H2
	for submit <at> debbugs.gnu.org; Wed, 15 Mar 2017 10:03:38 -0400
Received: from omx11.esk.m4.zaq.ne.jp ([220.152.48.5]:55404)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <ikumikeita@HIDDEN>) id 1co9WZ-0004j2-Mx
 for 26096 <at> debbugs.gnu.org; Wed, 15 Mar 2017 10:03:36 -0400
Received: from omx11.esk.m4.zaq.ne.jp ([220.152.49.29] [220.152.49.29])
 by omx11.esk.m4.zaq.ne.jp with ESMTP
 id <20170315140330742.WWUZ.3223.omx11.esk.m4.zaq.ne.jp@HIDDEN>;
 Wed, 15 Mar 2017 23:03:30 +0900
Received: from smtpa13.esk.m4.zaq.ne.jp ([42.144.27.116] [42.144.27.116])
 by smtpa13.esk.m4.zaq.ne.jp with ESMTP id
 <20170315140330672.CBTL.14010.smtpa13.esk.m4.zaq.ne.jp@HIDDEN>;
 Wed, 15 Mar 2017 23:03:30 +0900
Received: from localhost (localhost [127.0.0.1])
 by freebsd.vmware (Postfix) with ESMTP id 592FA139800;
 Wed, 15 Mar 2017 23:03:28 +0900 (JST)
To: Didier Verna <didier@HIDDEN>
Subject: Re: bug#26096: 11.90.0;
 Inversion of macro arguments with active region
In-reply-to: Your message of "Tue, 14 Mar 2017 15:11:45 +0100."
 <m1o9x4q76m.fsf@HIDDEN>
X-Mailer: MH-E 8.6; MH 6.8.4.JP-3.05; GNU Emacs 25.1.1
Date: Wed, 15 Mar 2017 23:03:28 +0900
Message-ID: <39423.1489586608@localhost>
From: Ikumi Keita <ikumi@HIDDEN>
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 26096
Cc: 26096 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

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




Information forwarded to bug-auctex@HIDDEN:
bug#26096; Package auctex. Full text available.

Message received at 26096 <at> debbugs.gnu.org:


Received: (at 26096) by debbugs.gnu.org; 15 Mar 2017 13:46:34 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Mar 15 09:46:33 2017
Received: from localhost ([127.0.0.1]:56427 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1co9G5-00046g-Nv
	for submit <at> debbugs.gnu.org; Wed, 15 Mar 2017 09:46:33 -0400
Received: from eggs.gnu.org ([208.118.235.92]:32848)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <arash@HIDDEN>) id 1co9G4-00046R-P7
 for 26096 <at> debbugs.gnu.org; Wed, 15 Mar 2017 09:46:33 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <arash@HIDDEN>) id 1co9Fu-0001TZ-Qa
 for 26096 <at> debbugs.gnu.org; Wed, 15 Mar 2017 09:46:27 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-0.0 required=5.0 tests=BAYES_40,RP_MATCHES_RCVD
 autolearn=disabled version=3.3.2
Received: from fencepost.gnu.org ([2001:4830:134:3::e]:55797)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <arash@HIDDEN>)
 id 1co9Fu-0001TT-NQ; Wed, 15 Mar 2017 09:46:22 -0400
Received: from p54ace45c.dip0.t-ipconnect.de ([84.172.228.92]:53415
 helo=MUTANT)
 by fencepost.gnu.org with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256)
 (Exim 4.82) (envelope-from <arash@HIDDEN>)
 id 1co9Fu-0005bC-4o; Wed, 15 Mar 2017 09:46:22 -0400
From: Arash Esbati <arash@HIDDEN>
To: Didier Verna <didier@HIDDEN>
Subject: Re: bug#26096: 11.90.0;
 Inversion of macro arguments with active  region
References: <m1o9x4q76m.fsf@HIDDEN>
Date: Wed, 15 Mar 2017 14:45:38 +0100
In-Reply-To: <m1o9x4q76m.fsf@HIDDEN> (Didier Verna's message of
 "Tue, 14 Mar 2017 15:11:45 +0100")
Message-ID: <86shmeodq5.fsf@HIDDEN>
User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2
MIME-Version: 1.0
Content-Type: text/plain
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
X-Received-From: 2001:4830:134:3::e
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: 26096
Cc: 26096 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

Didier Verna <didier@HIDDEN> writes:

Hi Didier,

> I'm not sure this is a bug, because I'm not sure TeX-insert-braces can
> actually be used as a hook (it would probably break when enclosed within
> square brackets).

Indeed, `TeX-insert-braces' is not meant to be used inside a hook.
Those functions have by convention a name like `TeX-arg-...'.

> However, I'm supposed to be allowed to define my own hook, so here it
> is:
>
> (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!

The way I understand the code the behavior you describe is by design:
AUCTeX puts the region in the first argument when it parses t.  You can
check the function `TeX-parse-argument' in tex.el, line 3523, ((eq arg
t) ...)  So you have to write your own function, but avoid the t in the
style hook.  You can set the exit-mark in you function to get the same
effect as with t, e.g.:

(defun LaTeX-fixme-arg (optional)
  (insert TeX-grop)
  (set-marker exit-mark (point))
  (insert TeX-grcl)
  (TeX-argument-insert (prog1 (buffer-substring (point) (mark))
			 (delete-region (point) (mark))
                         (TeX-deactivate-mark))
		       optional))

(TeX-add-style-hook "fixme"
  (lambda ()

    (TeX-add-symbols
     '("foo" (TeX-arg-conditional (TeX-active-mark)
				  (LaTeX-fixme-arg)
				(t nil)))))
  LaTeX-dialect)

HTH.

Best, Arash




Information forwarded to bug-auctex@HIDDEN:
bug#26096; Package auctex. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 14 Mar 2017 14:12:02 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Tue Mar 14 10:12:02 2017
Received: from localhost ([127.0.0.1]:55770 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.84_2)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1cnnBB-0000sX-5L
	for submit <at> debbugs.gnu.org; Tue, 14 Mar 2017 10:12:02 -0400
Received: from eggs.gnu.org ([208.118.235.92]:53214)
 by debbugs.gnu.org with esmtp (Exim 4.84_2)
 (envelope-from <didier@HIDDEN>) id 1cnnB9-0000sK-85
 for submit <at> debbugs.gnu.org; Tue, 14 Mar 2017 10:11:59 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <didier@HIDDEN>) id 1cnnB2-0001LW-R3
 for submit <at> debbugs.gnu.org; Tue, 14 Mar 2017 10:11:53 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:37434)
 by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_256_CBC_SHA1:32)
 (Exim 4.71) (envelope-from <didier@HIDDEN>)
 id 1cnnB2-0001LP-Nt
 for submit <at> debbugs.gnu.org; Tue, 14 Mar 2017 10:11:52 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:44179)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <didier@HIDDEN>) id 1cnnB1-0007yU-77
 for bug-auctex@HIDDEN; Tue, 14 Mar 2017 10:11:52 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <didier@HIDDEN>) id 1cnnAx-0001J9-Rd
 for bug-auctex@HIDDEN; Tue, 14 Mar 2017 10:11:51 -0400
Received: from smtp.lrde.epita.fr ([163.5.55.2]:35327
 helo=kaboul.lrde.epita.fr) by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <didier@HIDDEN>) id 1cnnAx-0001IP-LL
 for bug-auctex@HIDDEN; Tue, 14 Mar 2017 10:11:47 -0400
Received: from uzeb.lrde.epita.fr.lrde.epita.fr (uzeb.lrde.epita.fr
 [192.168.101.53])
 by kaboul.lrde.epita.fr (Postfix) with ESMTPS id 1818E47B19
 for <bug-auctex@HIDDEN>; Tue, 14 Mar 2017 15:11:45 +0100 (CET)
From: Didier Verna <didier@HIDDEN>
To: bug-auctex@HIDDEN
Subject: 11.90.0; Inversion of macro arguments with active  region
X-Attribution: dvl
X-Url: http://www.lrde.epita.fr/~didier
X-Web: http://www.lrde.epita.fr/~didier
X-Home-Page: http://www.lrde.epita.fr/~didier
Face: 
Date: Tue, 14 Mar 2017 15:11:45 +0100
Message-ID: <m1o9x4q76m.fsf@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: quoted-printable
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]
 [fuzzy]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.18
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <https://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <https://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <https://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)


  Hello,

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).

I found the function TeX-insert-braces which looked like it could do
what I was looking for. So I tried this:

(TeX-add-symbols '("foo" t TeX-insert-braces))

This works as expected when the region is not active, but otherwise, I
get the two arguments swapped: the contents of the active region appears
first, and then the empty pair of braces with the point inside.

I'm not sure this is a bug, because I'm not sure TeX-insert-braces can
actually be used as a hook (it would probably break when enclosed within
square brackets). However, I'm supposed to be allowed to define my own
hook, so here it is:

(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!




Emacs  : GNU Emacs 25.2.50.1 (x86_64-apple-darwin16.3.0, NS appkit-1504.76 =
Version 10.12.2 (Build 16C67))
 of 2017-01-21
Package: 11.90.0

current state:
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
(setq
 AUCTeX-date "2017-01-11"
 window-system 'ns
 LaTeX-version "2e"
 TeX-style-path '("/usr/local/var/auctex/"
		  "/usr/local/share/emacs/emacs-packages/auctex-11.90.0/style"
		  "~/var/auctex/" "~/etc/auctex/" ".auto/" "style")
 TeX-auto-save t
 TeX-parse-self t
 TeX-master nil
 TeX-command-list '(("TeX"
		     "%(PDF)%(tex) %(file-line-error) %(extraopts) %`%S%(PDFout)%(mode)%'=
 %t"
		     TeX-run-TeX nil
		     (plain-tex-mode ams-tex-mode texinfo-mode) :help
		     "Run plain TeX")
		    ("LaTeX" "%`%l%(mode)%' %t" TeX-run-TeX nil
		     (latex-mode doctex-mode) :help "Run LaTeX")
		    ("Makeinfo" "makeinfo %(extraopts) %t" TeX-run-compile nil
		     (texinfo-mode) :help "Run Makeinfo with Info output")
		    ("Makeinfo HTML" "makeinfo %(extraopts) --html %t"
		     TeX-run-compile nil (texinfo-mode) :help
		     "Run Makeinfo with HTML output")
		    ("AmSTeX" "amstex %(PDFout) %(extraopts) %`%S%(mode)%' %t"
		     TeX-run-TeX nil (ams-tex-mode) :help "Run AMSTeX")
		    ("ConTeXt"
		     "%(cntxcom) --once --texutil %(extraopts) %(execopts)%t"
		     TeX-run-TeX nil (context-mode) :help "Run ConTeXt once")
		    ("ConTeXt Full" "%(cntxcom) %(extraopts) %(execopts)%t"
		     TeX-run-TeX nil (context-mode) :help
		     "Run ConTeXt until completion")
		    ("BibTeX" "bibtex %s" TeX-run-BibTeX nil t :help
		     "Run BibTeX")
		    ("Biber" "biber %s" TeX-run-Biber nil t :help "Run Biber")
		    ("View" "%V" TeX-run-discard-or-function t t :help
		     "Run Viewer")
		    ...)
 )


--=20
Resistance is futile. You will be jazzimilated.

Lisp, Jazz, A=C3=AFkido: http://www.didierverna.info




Acknowledgement sent to Didier Verna <didier@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-auctex@HIDDEN. Full text available.
Report forwarded to bug-auctex@HIDDEN:
bug#26096; Package auctex. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Thu, 21 Mar 2024 18:45:01 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.