From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dieter Wilhelm Newsgroups: gmane.emacs.help Subject: Re: How to detect C-u supplied arguments from other prefix arguments Date: Thu, 09 Aug 2007 08:52:58 +0200 Organization: The Church of Emacs Message-ID: <878x8lgpx1.fsf@debby.local.net> References: <1186576048.530383.47680@q75g2000hsh.googlegroups.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1186642337 15283 80.91.229.12 (9 Aug 2007 06:52:17 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 9 Aug 2007 06:52:17 +0000 (UTC) To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Aug 09 08:52:15 2007 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IJ1sU-0002jf-3C for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Aug 2007 08:52:14 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IJ1sT-0002Lb-Do for geh-help-gnu-emacs@m.gmane.org; Thu, 09 Aug 2007 02:52:13 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1IJ1sB-0002LM-A2 for help-gnu-emacs@gnu.org; Thu, 09 Aug 2007 02:51:55 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1IJ1s9-0002LA-Ms for help-gnu-emacs@gnu.org; Thu, 09 Aug 2007 02:51:54 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IJ1s9-0002L7-Gf for help-gnu-emacs@gnu.org; Thu, 09 Aug 2007 02:51:53 -0400 Original-Received: from mx20.gnu.org ([199.232.41.8]) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1IJ1s8-0002B8-QJ for help-gnu-emacs@gnu.org; Thu, 09 Aug 2007 02:51:53 -0400 Original-Received: from moutng.kundenserver.de ([212.227.126.171]) by mx20.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1IJ1s7-0007Sp-Ai for help-gnu-emacs@gnu.org; Thu, 09 Aug 2007 02:51:51 -0400 Original-Received: from [89.13.88.0] (helo=debby.local.net) by mrelayeu.kundenserver.de (node=mrelayeu0) with ESMTP (Nemesis), id 0MKwh2-1IJ1s43yPJ-0003yO; Thu, 09 Aug 2007 08:51:49 +0200 Original-Received: from dieter by debby.local.net with local (Exim 4.63) (envelope-from ) id 1IJ1tC-0001CF-Dg for help-gnu-emacs@gnu.org; Thu, 09 Aug 2007 08:52:58 +0200 In-Reply-To: (Barry Margolin's message of "Thu\, 09 Aug 2007 00\:04\:27 -0400") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux) X-Provags-ID: V01U2FsdGVkX1/NU1K6HEdYMrsvrYxTV88MxkklhJ0QLpPn8HA ryNu44ai3vHjbbRzoJ+BEDVXEbTPhyb9jI7UN5YxnKj0XYK8EW VBd/aiyJm+UOLNpy7sMzn3EIrE4fYG1 X-detected-kernel: Linux 2.6? (barebone, rare!) X-Detected-Kernel: Linux 2.6, seldom 2.4 (older, 4) X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:46430 Archived-At: Barry Margolin writes: > In article <1186576048.530383.47680@q75g2000hsh.googlegroups.com>, > dieter.wilhelm@googlemail.com wrote: > >> On 8 ao?t, 13:55, bojohan+n...@dd.chalmers.se (Johan Bockg?rd) wrote: >> > Dieter Wilhelm writes: >> > > I'd like to detect whether prefix arguments of a command are supplied >> > > by C-u or otherwise. >> > >> > > My idea is to use this-command-keys and compare it to some string, >> > > like the following pseudo code: >> > >> > > (defun bla (arg) >> > > (interactive "p") >> > > (when (string= "C-u" (substring (this-command-keys) 0 2)) >> > > (message "hurray"))) >> > >> > > I just don't understand how to compare key sequences. >> > >> > You want to check for the character ^U, not the three-character string >> > `C - u'. Like >> > >> > (eq ?\C-u (aref (this-command-keys) 0)) >> >> hurray it works, thanks a lot! >> > >> > (The whole idea seems a bit ugly though.) >> >> Why? In Emacs there are just too little short key combinations free. >> I'd like to achieve >> a switch for certain functions depending whether their arguments ARG >> are supplied by C-u or not. >> >> For example: M-d might kill ARG word with the following boundary/ >> whitespace or without, >> or C-t might drag a character ARG chars away and in the other case >> merely transpose neighbouring chars some ARG chars away. > > And what if the user decides to bind a different keystroke to > universal-argument? True, from this point of view it's a very bad idea, C-u would be not customisable any longer. But I think it's only a marginal problem and on the other hand I feel the need to expand the Emacs key-binding space, this is my only idea so far and I will test its feasibility. Thanks -- Best wishes H. Dieter Wilhelm Darmstadt, Germany