help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How to detect C-u supplied arguments from other prefix arguments


From: Dieter Wilhelm
Subject: Re: How to detect C-u supplied arguments from other prefix arguments
Date: Thu, 09 Aug 2007 22:16:11 +0200
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.1 (gnu/linux)

Stefan Monnier <monnier@iro.umontreal.ca> 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")
>
> Use (interactive "P") and then `arg' will have different shapes in the
> different cases: either nil, or a number (if entered via C-u N1 N2 N3, or
> via C-N1 C-N2 C-N3), or a one-element list containing a number 4^N
> if

By the way C-N1 N2 N3 works as well as C-N1 C-N2 ...

> entered via sequence of N times C-u.

Sorry, I wasn't precise, I meant to distinguish also when supplying
numbers: Between C-u furnished and C- or M- furnished prefix arguments.
I'll work now with the hint from Johan Bockgård

    (eq ?\C-u (aref (this-command-keys) 0))

Thanks

-- 
    Best wishes

    H. Dieter Wilhelm
    Darmstadt, Germany




reply via email to

[Prev in Thread] Current Thread [Next in Thread]