From: Dieter Wilhelm <dieter@duenenhof-wilhelm.de>
To: help-gnu-emacs@gnu.org
Subject: Re: How to detect C-u supplied arguments from other prefix arguments
Date: Thu, 09 Aug 2007 08:52:58 +0200 [thread overview]
Message-ID: <878x8lgpx1.fsf@debby.local.net> (raw)
In-Reply-To: <barmar-33A19E.00042709082007@comcast.dca.giganews.com> (Barry Margolin's message of "Thu\, 09 Aug 2007 00\:04\:27 -0400")
Barry Margolin <barmar@alum.mit.edu> 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 <die...@duenenhof-wilhelm.de> 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
next prev parent reply other threads:[~2007-08-09 6:52 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <mailman.4504.1186523154.32220.help-gnu-emacs@gnu.org>
2007-08-08 11:55 ` How to detect C-u supplied arguments from other prefix arguments Johan Bockgård
2007-08-08 12:27 ` dieter.wilhelm
2007-08-09 4:04 ` Barry Margolin
2007-08-09 6:52 ` Dieter Wilhelm [this message]
2007-08-09 17:49 ` Stefan Monnier
2007-08-09 20:16 ` Dieter Wilhelm
2007-08-07 21:46 Dieter Wilhelm
2007-08-08 5:06 ` Kevin Rodgers
[not found] ` <mailman.4513.1186549602.32220.help-gnu-emacs@gnu.org>
2007-08-08 8:32 ` dieter.wilhelm
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=878x8lgpx1.fsf@debby.local.net \
--to=dieter@duenenhof-wilhelm.de \
--cc=help-gnu-emacs@gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.