From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tim Cross Newsgroups: gmane.emacs.devel Subject: Re: more than one prefix argument Date: Wed, 27 Jul 2011 19:25:14 +1000 Message-ID: References: <4E2F1C8C.9010802@easy-emacs.de> <4E2F1F1C.2040100@gmail.com> <850340AFD6324E979275501249A9240C@us.oracle.com> <4E2FAF6D.2050905@online.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: dough.gmane.org 1311758727 7658 80.91.229.12 (27 Jul 2011 09:25:27 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Wed, 27 Jul 2011 09:25:27 +0000 (UTC) Cc: Daniel Colascione , Drew Adams , emacs-devel@gnu.org To: =?ISO-8859-1?Q?Andreas_R=F6hler?= Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Wed Jul 27 11:25:22 2011 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([140.186.70.17]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1Qm0Mi-0005iw-Px for ged-emacs-devel@m.gmane.org; Wed, 27 Jul 2011 11:25:21 +0200 Original-Received: from localhost ([::1]:58368 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qm0Mh-0002Cy-ST for ged-emacs-devel@m.gmane.org; Wed, 27 Jul 2011 05:25:19 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:55512) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qm0Mf-0002Ci-HA for emacs-devel@gnu.org; Wed, 27 Jul 2011 05:25:18 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Qm0Me-0000yO-3X for emacs-devel@gnu.org; Wed, 27 Jul 2011 05:25:17 -0400 Original-Received: from mail-gx0-f169.google.com ([209.85.161.169]:50342) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qm0Md-0000yH-S5 for emacs-devel@gnu.org; Wed, 27 Jul 2011 05:25:16 -0400 Original-Received: by gxk23 with SMTP id 23so1056162gxk.0 for ; Wed, 27 Jul 2011 02:25:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=/s6HxusCOlXo7td3VW9E9xlQJhC5pl+Pt9ArG4yooc4=; b=mL0fMVEMQGBxu9FcTOY3RmCqrqoasZGMF4qtyRBc9AotZRjAaSx49KSs9wLmDA8x2a SaiYp6+ugn+Bl7P/hMj4sXIdpc/iFYZeRsHl+Fycpk+5Km9ACubw3jJjf5iiHIVWoVRY xeyuinUfweU1L9ukTyJ0FgnVOYc3mXIQ0K5OY= Original-Received: by 10.42.133.1 with SMTP id f1mr369972ict.129.1311758714962; Wed, 27 Jul 2011 02:25:14 -0700 (PDT) Original-Received: by 10.231.37.76 with HTTP; Wed, 27 Jul 2011 02:25:14 -0700 (PDT) In-Reply-To: <4E2FAF6D.2050905@online.de> X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2) X-Received-From: 209.85.161.169 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:142364 Archived-At: On Wed, Jul 27, 2011 at 4:25 PM, Andreas R=F6hler 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. =A0You 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. =A0He's not asking ab= out >> being >> able to define alternative "prefix arg"-like things (to be used >> separately). =A0I >> think he wants the same user input to somehow distinguish two different >> things >> (?). >> >> At least that's my understanding. =A0IMO, 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 betwee= n > 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