emacs-devel
[Top][All Lists]
Advanced

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

RE: more than one prefix argument


From: Drew Adams
Subject: RE: more than one prefix argument
Date: Wed, 27 Jul 2011 08:09:51 -0700

> > Essentially, we would need the raw form.
> 
> why?  We need a number or a boolean.
> "p" should send a number, 1 as default.
> "P" a boolean, nil as default.

I answered this, I think.  The raw arg provides a way to distinguish in the code
pretty much whatever the user did.  You can distinguish `C-u C-u' from `C-u 1 6'
and `M-1 6', and so on.

You cannot distinguish every user prefix-arg action using the raw arg (e.g. `C-u
1 6' and `M-1 6' are indistinguishable), but it is still pretty good.  (There
are some ways to get the keys that were pressed in order to distinguish them,
but they don't have to do with the prefix arg per se.)

You might or might not take advantage of this fine-grained distinction in any
given command definition.  But you can if you want.  Your command can let the
user use different prefix-arg actions to get different behaviors for the same
command.

Yes, integers alone would be sufficient to give users an unlimited number of
ways to invoke a command.  You could distinguish the numeric prefix values 1, 2,
3, 4 (or other) instead of distinguishing, say, nil, plain C-u, zero, and
non-zero.

And integers alone obviate needing a separate Boolean distinction.  And there is
not necessarily any _need_ to distinguish user actions such as `M-1 6' vs `C-u
C-u'.

But other prefix-arg combinations can be handier for users to use or easier to
remember.  Vive la difference.  You have choices when writing a command.

If you are confused about "p" and "P" and want to avoid confusion, you can limit
yourself to using one or the other.  For example, always use just "p" and have
your users always distinguish behavior only by number.  Nothing wrong with that
if that's what you prefer.




reply via email to

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