From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: =?UTF-8?Q?Andreas_R=c3=b6hler?= Newsgroups: gmane.emacs.help Subject: Re: Rationale behind conversion of a nil prefix arg to numeric 1 Date: Tue, 6 Sep 2016 18:44:16 +0200 Message-ID: <9b1324d4-ec20-5924-907e-601af94622fc@easy-emacs.de> 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> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-Trace: blaine.gmane.org 1473179935 9887 195.159.176.226 (6 Sep 2016 16:38:55 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 6 Sep 2016 16:38:55 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux i686; rv:45.0) Gecko/20100101 Icedove/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 Tue Sep 06 18:38:47 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 1bhJOT-0001FC-6H for geh-help-gnu-emacs@m.gmane.org; Tue, 06 Sep 2016 18:38:41 +0200 Original-Received: from localhost ([::1]:34986 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhJOR-00011F-42 for geh-help-gnu-emacs@m.gmane.org; Tue, 06 Sep 2016 12:38:39 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:60976) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhJNe-0000yj-RG for help-gnu-emacs@gnu.org; Tue, 06 Sep 2016 12:37:51 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bhJNX-0004HJ-LG for help-gnu-emacs@gnu.org; Tue, 06 Sep 2016 12:37:49 -0400 Original-Received: from mout.kundenserver.de ([217.72.192.75]:54069) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhJNX-0004H6-AG for help-gnu-emacs@gnu.org; Tue, 06 Sep 2016 12:37:43 -0400 Original-Received: from [192.168.178.35] ([77.12.16.203]) by mrelayeu.kundenserver.de (mreue103) with ESMTPSA (Nemesis) id 0MM06e-1biPIv2l1o-007iO9; Tue, 06 Sep 2016 18:37:41 +0200 In-Reply-To: X-Provags-ID: V03:K0:21sWTnGV55wAcqPPxWU22vDEoddvikmWTuSl8pN35/tRhCxIAem jJceVePB5Um1liFJ+zKQaYsk69+heFAcNtIy5PNrf1KmWBTd9scHiRY/bLeKZBbwzpLKYiI XxRjLe+IW7vm3r9azAtzb1iTSCStKaLdzY4MB1RmWbHQ5XxHvZc5Vmch1nrqQUlEbq3kBHg Q7Na8R44KdQKoo0kl9sgg== X-UI-Out-Filterresults: notjunk:1;V01:K0:/0+zZNNc6/o=:eYEi2T+c1Q1LQmz9Ue/0wP Ayv9YP4zCACUf6D4fqS7/qcw36T9jdarTzePTHnRemypXoWv1AWdjef6DG/PMkydWt43f8swX 1CoQ/7zRAYMv389I6Hu76lBW9GUJP/xnaxhsMsYZz6MAaH0m7wtaLBnvns2Ivs3oyxscAgzrz vN0006E75Ka/eU1mnVUC0zjktAk+1ndnm6OrKUpyBc8ckcj3hPCdDPSjhkGYSFJviGq3cKbiv LtQoqfIhD0ILVPmcNdxFgKQLBnGQ6AsPng07VZxI6AGqBoJCWuP4Yi4QcgQ2ab1swgGvtElnT QDLPfAzyrjtJ0k+mmBJI2NJ7mAUL8HHumd9aEXlxtiEPRY0txzK5Jd9iAxxqcqRDYwUHVKpyH XrAU0Nv9F6DWaxp1k/UmDCFWYDOS/d7UzbzfspxLd/IRw4gzaQhX0MhFa5bl/b1qxo0F/OP2u KakXWhq3MxkYXvK6y4LozeydqIbh2Jn6C1ACPUgNKqOS0I8EsjFtrLhwm4L3cmfsq7nInFOjb B95mGOV+lmMucFHyay8MNZZO6PNu9Ttpyl2OAt5Ww8yraXc5bNmStcvvkyjdC5SRgNsxvg//N fKGn/zzLWP6TNDYVq/nqZOjJ2mLdviwceqx5iZ+2K67oUt15XJs8ZEEXuCDmnJE+IkqUZGTiS /KcQ7/lGoLRtu41x3sxbitwNr9nGm0apGm5EOMZYY8T4ZaYeaxIz4D9MdOdHXnaB13b5/FKpj r2TSpYMhaQIyb8jG X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 217.72.192.75 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:111293 Archived-At: On 06.09.2016 16:20, Kaushal Modi wrote: > On Tue, Sep 6, 2016, 7:22 AM Andreas Röhler > > > wrote: > > But let's go back to the simplest case of lower p in interactive spec: > > What is easier to read/grasp > > (setq counter (or arg 1) > > or > > (setq counter (prefix-numeric-value arg)) > > IOW: in favor of avoiding these complex, tricky things. Let's have the > code as explicit as possible. > > > Those 2 forms are not 100℅ equivalent. The equivalence goes only as > far as setting the default value of counter. > > If the user used (interactive "p"), counter need to be set to 4 > regardless of whether the user used "C-4" as prefix or "C-u". In the > former case, arg would be "4", but in the latter case, it would be > "(4)", I.e. a list, not a number. Not sure IIUC (defun whatarg-p (arg) (interactive "p") (message "%s" arg)) Called with simply C-u without numeric argument gives me "4" (4) would be the result with uppercase P > Your simpler representation would not take care of the C-u case. If > the counter variable is used where a numeric arg is strictly required, > you will get an error. Here, prefix-numeric-value returns "4" when arg > is "(4)". > > -- > > Kaushal Modi >