all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: "Drew Adams" <drew.adams@oracle.com>
To: "'Andreas Röhler'" <andreas.roehler@online.de>,
	"'Tim Cross'" <theophilusx@gmail.com>
Cc: 'Daniel Colascione' <dan.colascione@gmail.com>, emacs-devel@gnu.org
Subject: RE: more than one prefix argument
Date: Wed, 27 Jul 2011 08:09:51 -0700	[thread overview]
Message-ID: <EF2212F53EA044C7999CAC477AD9BE1F@us.oracle.com> (raw)
In-Reply-To: <4E2FE6AC.8070706@online.de>

> > 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.




  parent reply	other threads:[~2011-07-27 15:09 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-07-26 19:59 more than one prefix argument Andreas Röhler
2011-07-26 20:10 ` Daniel Colascione
2011-07-26 20:36   ` Andreas Röhler
2011-07-26 20:57     ` Drew Adams
2011-07-26 20:36   ` Drew Adams
2011-07-27  6:25     ` Andreas Röhler
2011-07-27  9:25       ` Tim Cross
2011-07-27  9:37         ` Andreas Röhler
2011-07-27  9:48           ` Tim Cross
2011-07-27 10:21             ` Andreas Röhler
2011-07-27 11:21               ` Andreas Schwab
2011-07-27 11:46                 ` Andreas Röhler
2011-07-27 12:39                   ` Andreas Schwab
2011-07-27 12:51                   ` Tim Cross
2011-07-27 12:46               ` Tim Cross
2011-07-27 15:09               ` Drew Adams [this message]
2011-07-27  9:38         ` Tim Cross

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=EF2212F53EA044C7999CAC477AD9BE1F@us.oracle.com \
    --to=drew.adams@oracle.com \
    --cc=andreas.roehler@online.de \
    --cc=dan.colascione@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=theophilusx@gmail.com \
    /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.