From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.devel Subject: RE: more than one prefix argument Date: Tue, 26 Jul 2011 13:57:52 -0700 Message-ID: References: <4E2F1C8C.9010802@easy-emacs.de> <4E2F1F1C.2040100@gmail.com> <4E2F2546.3010704@easy-emacs.de> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Trace: dough.gmane.org 1311713897 2101 80.91.229.12 (26 Jul 2011 20:58:17 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Tue, 26 Jul 2011 20:58:17 +0000 (UTC) Cc: 'Emacs developers' To: "=?iso-8859-1?Q?'Andreas_R=F6hler'?=" , "'Daniel Colascione'" Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Tue Jul 26 22:58:13 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 1Qlohc-0002hI-RY for ged-emacs-devel@m.gmane.org; Tue, 26 Jul 2011 22:58:09 +0200 Original-Received: from localhost ([::1]:36239 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Qlohc-0007Ax-FT for ged-emacs-devel@m.gmane.org; Tue, 26 Jul 2011 16:58:08 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:60117) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QlohZ-0007Ag-7R for emacs-devel@gnu.org; Tue, 26 Jul 2011 16:58:06 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QlohY-0003C4-5m for emacs-devel@gnu.org; Tue, 26 Jul 2011 16:58:05 -0400 Original-Received: from acsinet15.oracle.com ([141.146.126.227]:21876) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QlohX-0003Bz-PH for emacs-devel@gnu.org; Tue, 26 Jul 2011 16:58:04 -0400 Original-Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by acsinet15.oracle.com (Switch-3.4.4/Switch-3.4.4) with ESMTP id p6QKvwLU002839 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Tue, 26 Jul 2011 20:58:00 GMT Original-Received: from acsmt358.oracle.com (acsmt358.oracle.com [141.146.40.158]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id p6QKvwiU023458 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 26 Jul 2011 20:57:58 GMT Original-Received: from abhmt110.oracle.com (abhmt110.oracle.com [141.146.116.62]) by acsmt358.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id p6QKvq8B005013; Tue, 26 Jul 2011 15:57:52 -0500 Original-Received: from dradamslap1 (/10.159.42.138) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Tue, 26 Jul 2011 13:57:52 -0700 X-Mailer: Microsoft Office Outlook 11 x-mimeole: Produced By Microsoft MimeOLE V6.00.2900.6109 In-Reply-To: <4E2F2546.3010704@easy-emacs.de> Thread-Index: AcxL07yGjkC1ICdvRg+7TvsFv/0qWgAAIikA X-Source-IP: acsinet21.oracle.com [141.146.126.237] X-Auth-Type: Internal IP X-CT-RefId: str=0001.0A090209.4E2F2A58.0098:SCFMA922111,ss=1,re=-4.000,fgs=0 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 1) X-Received-From: 141.146.126.227 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:142327 Archived-At: > Indeed: (prefix-numeric-value nil) -->1 > But does this make sense in a lisp-environement? Dunno what that means. nil is not 1. But (foo nil) might well be 1. (length nil) is 0, but that doesn't mean that nil is zero. `prefix-numeric-value' is just a function that returns a number (always). If its arg is nil then it returns 1. Nothing more to be said about it, really. > Booleans treat nil and 1 different: > (when 1 (message "%s" "1"))-->1 > (when nil (message "%s" "1"))-->nil Yes. `prefix-numeric-value' is not a Boolean function. The numeric value of the prefix arg is just that: a numeric value. It is a number, never nil, so it is useless as a (Lisp) Boolean value: it is always non-nil (true). (Well, you could decide that some particular number or set of numbers represented false, and then test that way, but you get the idea: it will not return `nil'.) The _raw_ value of a prefix arg can be nil, so you can use that as a Lisp Boolean value (nil vs non-nil). The raw value distinguishes presence and absence: whether or not the user specified a prefix argument when invoking the command. It also distinguishes other things, however. The raw arg is richer than its reduction to a numeric value. The raw prefix arg tells you pretty much what the user did - whether s?he hit `C-u C-u C-u' or `C-u 3 2 9' or `M--' etc. If you want to let the user distinguish several cases using a prefix arg, then you want to do it using the raw arg. You can test whether the arg is a cons or nil or `-'; you can test its numeric value; etc. And you can test it in different ways at the same time: both a cons and numeric value = 16, etc.