From: Tim Cross <theophilusx@gmail.com>
To: "Andreas Röhler" <andreas.roehler@online.de>
Cc: Daniel Colascione <dan.colascione@gmail.com>,
Drew Adams <drew.adams@oracle.com>,
emacs-devel@gnu.org
Subject: Re: more than one prefix argument
Date: Wed, 27 Jul 2011 19:25:14 +1000 [thread overview]
Message-ID: <CAC=50j8Qnbn5afqAwqSjYGNy_jxUCoBpTnm7-rJPom3LV9oLnQ@mail.gmail.com> (raw)
In-Reply-To: <4E2FAF6D.2050905@online.de>
On Wed, Jul 27, 2011 at 4:25 PM, Andreas Röhler
<andreas.roehler@online.de> wrote:
> Am 26.07.2011 22:36, schrieb Drew Adams:
>>>>
>>>> what about allowing more than one prefix argument
>>>> by making interactive codes "p" and "P" sending
>>>> truly separated.
>>>
>>> We already have more than one kind of prefix argument: see
>>> universal-coding-system-argument for an example. You can
>>> already define as many kinds of "prefix argument" as you'd
>>> like: just define a global flag and a command to set that
>>> flag, and have post-command-hook clear the flag unless (eq
>>> this-command 'my-prefix-setting-function).
>>
>> I don't think that's what Andreas is asking about. He's not asking about
>> being
>> able to define alternative "prefix arg"-like things (to be used
>> separately). I
>> think he wants the same user input to somehow distinguish two different
>> things
>> (?).
>>
>> At least that's my understanding. IMO, he is simply confused,
>
> Hi Drew,
>
> maybe you are right. Then we must wait. I'll try to sum up the matter for
> the moment:
>
> current use of "p" and "P" might be enhanced. There is an intermix between
> both, doing nearly, but not precisely, the same.
>
> "P" quite often is used for completely different things than sending a
> number.
>
> (if (eq 4 (prefix-numeric-value))
>
> is used as a branch command. That's the interesting about it indeed.
>
> However, that's not clean. It's bad to read, because the fact of "4" has no
> meaning by themselves here. That's obscure programming style.
>
> In general let me stress: I'm living very well with Emacs as it is. Just
> saying: we can live still better.
>
> Cheers and thanks,
>
> Andreas
>
While P and p are similar, I'm not sure they are as similar as you
imply. Consider a very simple example. You have a function and you
want it to use a prefix arg and you want the raw form because you want
to distinguish between no prefix arg and C-u 1 or M-1. You then define
a second function, but this time, you want it to default to 1 if no
prefix arg or whatever the value is if one is provided, then the 'p'
numeric version is what you want. In each case, the P and p support
what you need without you having to do additional code. Yes, you could
solve this with just the P version, but then you would have to do more
code to handle the common case of just wanting to process the prefix
arg as a number.
This additional code would likely make the reading of the source even
more difficult than your example issue with the use of '4' in your
example. I would also suggest that if you don't like the literal 4 as
it doesn't make it clear what is going on (why 4?) you could define a
variable, such as
next prev parent reply other threads:[~2011-07-27 9:25 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 [this message]
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
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='CAC=50j8Qnbn5afqAwqSjYGNy_jxUCoBpTnm7-rJPom3LV9oLnQ@mail.gmail.com' \
--to=theophilusx@gmail.com \
--cc=andreas.roehler@online.de \
--cc=dan.colascione@gmail.com \
--cc=drew.adams@oracle.com \
--cc=emacs-devel@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.