From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Charles Millar Newsgroups: gmane.emacs.help Subject: Re: Rationale behind conversion of a nil prefix arg to numeric 1 Date: Thu, 08 Sep 2016 10:42:56 -0400 Message-ID: <489a1e03-5586-be35-51dc-d5b667aa068e@verizon.net> References: <87y437c0qg.fsf@bertrandrussell.Speedport_W_723V_1_40_000> <83oa43d9r8.fsf@gnu.org> <06d4a7f1-f116-fb5c-9bd2-c4d1f98934c9@easy-emacs.de> <83k2ercy5u.fsf@gnu.org> <83bn02cs54.fsf@gnu.org> <83ed1411-dbc1-2fe1-5fe9-4fdc7a4d1b21@online.de> <83shteb26t.fsf@gnu.org> <20160906071015.GB15537@tuxteam.de> <87inu98ipz.fsf@bertrandrussell.Speedport_W_723V_1_40_000> <6512cbf9-e702-bc96-7489-54fa23f9bfe8@verizon.net> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: QUOTED-PRINTABLE X-Trace: blaine.gmane.org 1473360805 5731 195.159.176.226 (8 Sep 2016 18:53:25 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Thu, 8 Sep 2016 18:53:25 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.2.0 To: Kaushal Modi , help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Thu Sep 08 20:53:21 2016 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by blaine.gmane.org with esmtp (Exim 4.84_2) (envelope-from ) id 1bi4Rh-000813-3M for geh-help-gnu-emacs@m.gmane.org; Thu, 08 Sep 2016 20:53:09 +0200 Original-Received: from localhost ([::1]:50642 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bi4Rh-00066i-1o for geh-help-gnu-emacs@m.gmane.org; Thu, 08 Sep 2016 14:53:09 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:34465) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bi0Y6-0007C4-BA for help-gnu-emacs@gnu.org; Thu, 08 Sep 2016 10:43:31 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bi0Y2-0006i7-1U for help-gnu-emacs@gnu.org; Thu, 08 Sep 2016 10:43:29 -0400 Original-Received: from vms173017pub.verizon.net ([206.46.173.17]:45948) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bi0Y1-0006cc-OY for help-gnu-emacs@gnu.org; Thu, 08 Sep 2016 10:43:25 -0400 Original-Received: from vz-proxy-l005.mx.aol.com ([64.236.82.152]) by vms173017.mailsrvcs.net (Oracle Communications Messaging Server 7.0.5.32.0 64bit (built Jul 16 2014)) with ESMTPA id <0OD600F4TWVPSAA0@vms173017.mailsrvcs.net> for help-gnu-emacs@gnu.org; Thu, 08 Sep 2016 09:43:02 -0500 (CDT) Original-Received: by 70.209.160.173 with SMTP id 77a110c1; Thu, 08 Sep 2016 14:43:02 GMT In-reply-to: X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=btqxfxui c=1 sm=1 tr=0 a=a3t/a0oOYlYu/nGe1mf8ZA==:117 a=GW1xBdLrtEIA:10 a=r77TgQKjGQsHNAKrUKIA:9 a=o1OHuDzbAAAA:8 a=MoxwzuEtRpiJfN8mQUIA:9 a=QEXdDO2ut3YA:10 a=pGLkceISAAAA:8 a=Hzl_nD7z_L3Lb8d9wfsA:9 a=_LHJ4nugdMh7otK0:21 a=_W_S_7VecoQA:10 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 206.46.173.17 X-Mailman-Approved-At: Thu, 08 Sep 2016 14:11:47 -0400 X-Content-Filtered-By: Mailman/MimeDel 2.1.21 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.org gmane.emacs.help:111313 Archived-At: On 09/08/2016 09:10 AM, Kaushal Modi wrote: > On Wed, Sep 7, 2016 at 10:41 PM Charles Millar > wrote: > > I have read this thread as well as the other suggested readings= .=20 > > If the > purpose of either p or P is to pass arguments, I do not underst= and the > rationale of allowing C-u when using the interactive upper case= P.=20 > > > That's useful if the user wants the function to behave different ba= sed=20 > on if the arg is a list or not. > > As > noted above, It returns an integer as the only element in a lis= t, > which > if evaluated returns an error. > > > If the arg is a list (C-u), you have to treat it as a list.. e.g. u= se=20 > (car arg). > > Is there a use for this?=20 > > > It's up to the user on how they want to treat different arg values. > > Such as you may > want an error? > > > Here's a dummy example: > > (defun foo (arg) > (interactive "P") > (message (concat "Arg is " > (cond > ((null arg) > "nil") > ((listp arg) > (format "a list with element %d" (car arg))) > (t > (format "a number %d" arg)))))) > (global-set-key (kbd "C-c '") #'foo)'''' > > > After evaluating the above, do > > - C-c ' > - C-0 C-c ' or M-0 C-c ' > - C-1 C-c ' or M-1 C-c ' > - .. > - C-u C-c ' > - C-4 C-c ' or M-4 C-c ' > - C-u C-u C-c ' > - C-1 C-6 C-c ' or M-1 M-6 C-c ' > > If the user wishes, they can make the foo function behave different= ly=20 > for each of the above bullets. > > So it eventually boils down to what the user wants.. do they want t= he=20 > default arg to be nil or 1, do they want to support C-u and C-4 arg= s=20 > in different manner, etc. Based on that, they can choose to use the= =20 > "p" or "P" version of interactive. > --=20 Thank you, Kaushal! I suspect that the following has been said many times on this and oth= er=20 lists - "An example, as is a picture, is worth a 1000 words." Charlie Millar