From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Alan Mackenzie Newsgroups: gmane.emacs.devel Subject: Interactive hat. [Was: CUA-like stuff spuriously enables transient-mark-mode] Date: Wed, 25 Mar 2009 10:16:50 +0000 Message-ID: <20090325101650.GA1487@muc.de> References: <20090323223703.GA5650@muc.de> <20090324135210.GA4657@muc.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: ger.gmane.org 1237976273 30249 80.91.229.12 (25 Mar 2009 10:17:53 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Wed, 25 Mar 2009 10:17:53 +0000 (UTC) Cc: emacs-devel@gnu.org To: Stefan Monnier Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Mar 25 11:19:10 2009 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1LmQCU-0001x0-Ee for ged-emacs-devel@m.gmane.org; Wed, 25 Mar 2009 11:19:10 +0100 Original-Received: from localhost ([127.0.0.1]:49691 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LmQB7-0006bA-EQ for ged-emacs-devel@m.gmane.org; Wed, 25 Mar 2009 06:17:45 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1LmQB1-0006b5-SH for emacs-devel@gnu.org; Wed, 25 Mar 2009 06:17:39 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1LmQAx-0006aD-0Z for emacs-devel@gnu.org; Wed, 25 Mar 2009 06:17:39 -0400 Original-Received: from [199.232.76.173] (port=53583 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1LmQAw-0006Zu-Qn for emacs-devel@gnu.org; Wed, 25 Mar 2009 06:17:34 -0400 Original-Received: from colin.muc.de ([193.149.48.1]:1089 helo=mail.muc.de) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1LmQAw-00061o-7v for emacs-devel@gnu.org; Wed, 25 Mar 2009 06:17:34 -0400 Original-Received: (qmail 39517 invoked by uid 3782); 25 Mar 2009 10:17:31 -0000 Original-Received: from acm.muc.de (pD9E50975.dip.t-dialin.net [217.229.9.117]) by colin2.muc.de (tmda-ofmipd) with ESMTP; Wed, 25 Mar 2009 11:17:29 +0100 Original-Received: (qmail 1722 invoked by uid 1000); 25 Mar 2009 10:16:50 -0000 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.9i X-Delivery-Agent: TMDA/1.1.5 (Fettercairn) X-Primary-Address: acm@muc.de X-detected-operating-system: by monty-python.gnu.org: FreeBSD 4.6-4.9 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:109815 Archived-At: Hi, Stefan, On Tue, Mar 24, 2009 at 09:38:29PM -0400, Stefan Monnier wrote: > >> Where do you see it hardcoded in the command loop? > > In Fcall_interactively, Lines 207 and 231, where it is interpreting the > > interactive string: > > else if (*string == '^') > > { > > if (! NILP (Vshift_select_mode)) > > call1 (Qhandle_shift_selection, Qnil); <================ > > /* Even if shift-select-mode is off, temporarily active > > regions could be set using the mouse, and should be > > deactivated. */ > > else if (CONSP (Vtransient_mark_mode) > > && EQ (XCAR (Vtransient_mark_mode), Qonly)) > > call1 (Qhandle_shift_selection, Qt); <================ > > string++; > > } > > . > I see. I guess we just disagree on what is meant by "hardcoded in the > command loop": this code is explicitly requested by the "^" code in the > `interactive' string of a command, so it seems (to me) pretty far from > "hardcoded in the command loop". It's hard-coded to the shift-key, rather than using the normal Emacs mechanism of putting the "shifted" versions of movement commands into a minor mode map. Interactive strings which use "^" are incompatible with other Emacs versions. This will cause problems. How is an external library writer going to use the interactive "^"? Assuming that the library should also work under XEmacs and Emacs 22, just using the "^" won't work; an interactive string with "^" throws an error in Emacs 22. The next try is to use a macro which will generate an appropriate interactive string. Something like: (defmacro foo-interactive (s-22 s-23) "doc string" `(interactive ,(if (emacs-got-interactive-hat) s-23 s22))) , but I can't get defun to take a macro-generated interactive string. I suspect it's not possible. It seems to work, sort of, in byte-compiled defuns. Could we supply some sort of macro which will add "^" to an interactive string? Then at least each external library author won't have to figure it out himself. > Stefan -- Alan Mackenzie (Nuremberg, Germany).