From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!.POSTED!not-for-mail From: Kaushal Modi Newsgroups: gmane.emacs.help Subject: Re: Rationale behind conversion of a nil prefix arg to numeric 1 Date: Tue, 06 Sep 2016 14:20:02 +0000 Message-ID: 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 Content-Transfer-Encoding: quoted-printable X-Trace: blaine.gmane.org 1473171717 20043 195.159.176.226 (6 Sep 2016 14:21:57 GMT) X-Complaints-To: usenet@blaine.gmane.org NNTP-Posting-Date: Tue, 6 Sep 2016 14:21:57 +0000 (UTC) To: =?UTF-8?Q?Andreas_R=C3=B6hler?= , help-gnu-emacs@gnu.org Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Tue Sep 06 16:21: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 1bhHFm-0003HR-8n for geh-help-gnu-emacs@m.gmane.org; Tue, 06 Sep 2016 16:21:34 +0200 Original-Received: from localhost ([::1]:33854 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhHFk-000892-51 for geh-help-gnu-emacs@m.gmane.org; Tue, 06 Sep 2016 10:21:32 -0400 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:45322) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhHEd-0007wX-S6 for help-gnu-emacs@gnu.org; Tue, 06 Sep 2016 10:20:29 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bhHEY-0004Y6-H2 for help-gnu-emacs@gnu.org; Tue, 06 Sep 2016 10:20:23 -0400 Original-Received: from mail-vk0-x232.google.com ([2607:f8b0:400c:c05::232]:35164) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhHEY-0004Xy-Bn for help-gnu-emacs@gnu.org; Tue, 06 Sep 2016 10:20:18 -0400 Original-Received: by mail-vk0-x232.google.com with SMTP id j189so91860348vkc.2 for ; Tue, 06 Sep 2016 07:20:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:references:in-reply-to:from:date:message-id:subject:to; bh=lI/3BPJSr8D9TiHi2eHLxYdWDpEF/RC8duGow0dIh8E=; b=yuMzp9U3fn9UIAUj8ooaxNJ94a5/6qv/FaShf3TJ07XFLa3qZ36kSqJh224Gfvu+e+ We9qeqG9Svydg7zVD8ZKkoE+Qpc6QYHBkvbIh8egZSBYBjaajfSQ/F2qOKuidH4z7bA3 St+ENHeLbSc8o4lBsT68VY5F8zqJOWo7VhMeOaj1zfBQhoZ0W29I5FcXkGwCVgPudMby S7VLP/+J6DLcQN773bY3ifKbJBuV3cUHzcsOv2QCGij6n49bGBTxZUQ6e8TmzwkrZ1e3 LNb81iZeT0Ue+l7CkNmBi3WPpBTCXp7LSKFO4sLezhtPeuRFR5Rguuj4/JAzf9AxlCeT OJzQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to; bh=lI/3BPJSr8D9TiHi2eHLxYdWDpEF/RC8duGow0dIh8E=; b=FIBjVjiWirAcSa0PXkbJQ+I5A0WEjn4zwKAbfe4mA7iUdpTJYXZjS6lD+fFzqWZRg7 uurLQSs9ZVYTv0vEwMyXv7Br2yhUaouS3l1N3TDDOyjpqLHWT3Qq3FTHzFpvH8rxGS1J jWPZ4/topQ8tsldxhJT+s35Q5C7WJIB3cGG233mIQpOOZoIR6Q5B2ynB9zvC9qdAoOZu HU2TTIXmg85cRg7wVc1JT8NeTyTPa4ncKLWqMNC0xXGEIDD6plK2cwom6HVp8yHVlSik MakVcxGCUD1exih+3kDNp4CciDI842pRKt9QxSSlzGUbqktKCb413h72w8SKvZXhpnia kBEA== X-Gm-Message-State: AE9vXwMmpPZ+jxopf1MHMmRxGbHZjxfUBKfIxuoS1z7CKyjMnOLgCTFHlEpEux6CHmUyMUnd63jsVnO+zPD4Dw== X-Received: by 10.31.102.135 with SMTP id a129mr22485815vkc.112.1473171617853; Tue, 06 Sep 2016 07:20:17 -0700 (PDT) In-Reply-To: X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 2607:f8b0:400c:c05::232 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:111285 Archived-At: On Tue, Sep 6, 2016, 7:22 AM Andreas R=C3=B6hler 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=E2=84=85 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. 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