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: Sun, 4 Sep 2016 19:11:31 +0200 Message-ID: <06d4a7f1-f116-fb5c-9bd2-c4d1f98934c9@easy-emacs.de> References: <87y437c0qg.fsf@bertrandrussell.Speedport_W_723V_1_40_000> <83oa43d9r8.fsf@gnu.org> NNTP-Posting-Host: blaine.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-Trace: blaine.gmane.org 1473011851 13204 195.159.176.226 (4 Sep 2016 17:57:31 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Sun, 4 Sep 2016 17:57:31 +0000 (UTC) User-Agent: Mozilla/5.0 (X11; Linux i686; rv:45.0) Gecko/20100101 Icedove/45.2.0 To: help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Sun Sep 04 19:57:28 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 1bgbfZ-0002ke-9s for geh-help-gnu-emacs@m.gmane.org; Sun, 04 Sep 2016 19:57:25 +0200 Original-Received: from localhost ([::1]:50696 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bgbfW-0008I3-Do for geh-help-gnu-emacs@m.gmane.org; Sun, 04 Sep 2016 13:57:22 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:36754) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bgaqu-0002s1-D6 for help-gnu-emacs@gnu.org; Sun, 04 Sep 2016 13:05:05 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bgaqq-0006sC-6y for help-gnu-emacs@gnu.org; Sun, 04 Sep 2016 13:05:03 -0400 Original-Received: from mout.kundenserver.de ([212.227.126.130]:58713) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bgaqp-0006s5-TB for help-gnu-emacs@gnu.org; Sun, 04 Sep 2016 13:05:00 -0400 Original-Received: from [192.168.178.35] ([77.3.42.122]) by mrelayeu.kundenserver.de (mreue002) with ESMTPSA (Nemesis) id 0MIDV8-1bdqlA0bIU-003yqX for ; Sun, 04 Sep 2016 19:04:58 +0200 In-Reply-To: <83oa43d9r8.fsf@gnu.org> X-Provags-ID: V03:K0:qh8ipNeUZjaX61HWQahU5DnKgFcAGzG2vaejV3WZMaPkli3bkNc 6HM+tkt8Hr9tfU5zAKw0t/km+CJFpZpk3R30Z2Jc68qxcvsicyM1jIaxGzSNz5EqNp3IUHo aeKbTGAhbRSTzcFB+oSWxwKZCKDk0jrxEemG/xTQAxigHSRyA6cyGTfb2A8N0GACjGKlfXl MDWB2AUqhag4xqZhJIAmA== X-UI-Out-Filterresults: notjunk:1;V01:K0:1c3aPe44pkk=:AaXIuEAQ81YXIOV800PPQo GPt57X7EgvWvKt2vW+R4bzAr1WLsym61FoPuRf9SCOHbkfvFfNITcxUmeYNmsrqAKz8FNKcYE SoSkoHNPmQ3TavkPkTbA85yCa0vONyQygj5WmYQXhTy4ja8vZAF7czEyr1w11lf+j2Kj64JRb tIdymdLtX3a6Lyw9EcVwX2S3zSigfdYOTphjrMmX1cYnFyv55JiDPMKSoWrqLgcPnMgUOKabC Bzv9rK9AKiKDMAuVMynAWQjMt+K84l2VWaFOT3cfV/j/BDUgg37efDhnlmpEdhi7qoDvs4Jfw vUpwzcQS0u9SwrRZX3W7AtlNjAOXXwUqtgmFs2Mprg2GY0qaFiRPtmI1c8doQFXXqMoHLqONc Ib3+Vl0r2yIo/ifZHKRYW2UQemokeIT1Pt0Ug4ziRDv8Z74YsIUrk4M0YGr0gM6mkRK2OrzYN yUJeAypBVkfNZ9h54XXOpP+O7RM9jq4ANtP21kUWw4+bJWH+4BhF+YEqf214M3yax66wZJssu ybquzAYnzLrqmd/OHi6fmZqzpFC65PEiSlCDKykj4BOwWNQVoiaKu/zBTImBapnDZk7xQY7TP X9pDoKeYDzNiBDrwdMywwqJN3CsWSGBlmPZO0jQLlAqrHIW6pXSVUm0IHk9gZKhb+USsTmFie 6utMhiyUOiMWk1P7SZHk86kTp8lMS8OuVcq9vWHhTd2Jo3/O0jd+vK/s9JeQrc67v87nlxum3 kJYdDiIS8ss0LIya X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 212.227.126.130 X-Mailman-Approved-At: Sun, 04 Sep 2016 13:56:57 -0400 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:111250 Archived-At: On 04.09.2016 16:23, Eli Zaretskii wrote: >> Date: Sun, 04 Sep 2016 14:23:35 +0200 >> From: florian@fsavigny.de (Florian v. Savigny) >> >> Naively, I used the numeric conversion of the prefix arg, i.e. >> >> (interactive "p") >> >> which passes the prefix arg converted to a number. However, if I call >> the function with no prefix argument, which is, expectedly, nil in raw >> form, it converts this to the number 1. (This is what >> `prefix-numeric-value' does, as explained in the docstring.) >> >> While I understand that this is how it is done, I am quite puzzled >> about the logic behind this. It would seem intuitive to me to convert >> nil to either the number 0 or, again, nil, but never to the number >> 1. And practically, converting nil to 1 has the consequence that >> calling the command with no prefix arg: >> >> M-x command >> >> is exactly the same as calling it with a prefix arg of 1: >> >> C-u 1 M-x command >> >> because the prefix arg converted to a number is 1 in both cases, which >> reduces the number of possibilities of calling the command by one. >> >> I can circumvent this (and get the behaviour that I would expect) by >> writing the function with >> >> (if current-prefix-arg (prefix-numeric-value current-prefix-arg)) >> >> in an explicit interactive list, but I am still wondering about the >> rationale of representing nil as the number one. Does this make sense, >> or is it useful, in some way? > Yes. Most commands use the argument as a repeat count, so having it > default to one makes perfect sense. > There a difference between "p" sending 1 and nil - which is the result from non-interactive use. If a function needs a repeat count, it should provide some.