From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Drew Adams" Newsgroups: gmane.emacs.help Subject: RE: [Warning] cl-count (And Other Options) Date: Fri, 30 Nov 2012 14:58:06 -0800 Message-ID: <1C723B4918BC442B97682400DF447633@us.oracle.com> References: <50B92CD6.20809@gmail.com> <87hao6hgwd.fsf@yandex.ru> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: ger.gmane.org 1354316307 4151 80.91.229.3 (30 Nov 2012 22:58:27 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 30 Nov 2012 22:58:27 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: "'Dmitry Gutov'" , "'Eric James Michael Ritz'" Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Nov 30 23:58:39 2012 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane.org Original-Received: from lists.gnu.org ([208.118.235.17]) by plane.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1TeZXX-0003gJ-JQ for geh-help-gnu-emacs@m.gmane.org; Fri, 30 Nov 2012 23:58:35 +0100 Original-Received: from localhost ([::1]:35227 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TeZXM-0000PD-84 for geh-help-gnu-emacs@m.gmane.org; Fri, 30 Nov 2012 17:58:24 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:48477) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TeZXG-0000P8-T6 for help-gnu-emacs@gnu.org; Fri, 30 Nov 2012 17:58:19 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TeZXF-0002Ye-FQ for help-gnu-emacs@gnu.org; Fri, 30 Nov 2012 17:58:18 -0500 Original-Received: from aserp1040.oracle.com ([141.146.126.69]:27034) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TeZXF-0002YZ-8b for help-gnu-emacs@gnu.org; Fri, 30 Nov 2012 17:58:17 -0500 Original-Received: from acsinet21.oracle.com (acsinet21.oracle.com [141.146.126.237]) by aserp1040.oracle.com (Sentrion-MTA-4.2.2/Sentrion-MTA-4.2.2) with ESMTP id qAUMwBL3006101 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Fri, 30 Nov 2012 22:58:14 GMT Original-Received: from acsmt357.oracle.com (acsmt357.oracle.com [141.146.40.157]) by acsinet21.oracle.com (8.14.4+Sun/8.14.4) with ESMTP id qAUMwB1l023401 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Fri, 30 Nov 2012 22:58:11 GMT Original-Received: from abhmt111.oracle.com (abhmt111.oracle.com [141.146.116.63]) by acsmt357.oracle.com (8.12.11.20060308/8.12.11) with ESMTP id qAUMwBTY015284; Fri, 30 Nov 2012 16:58:11 -0600 Original-Received: from dradamslap1 (/10.159.169.89) by default (Oracle Beehive Gateway v4.0) with ESMTP ; Fri, 30 Nov 2012 14:58:10 -0800 X-Mailer: Microsoft Office Outlook 11 In-Reply-To: <87hao6hgwd.fsf@yandex.ru> Thread-Index: Ac3PSPIa2zURjoGyQAOpo1xij4rYHQAAG9MQ X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-Source-IP: acsinet21.oracle.com [141.146.126.237] X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.4.x-2.6.x [generic] X-Received-From: 141.146.126.69 X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.14 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-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.help:87982 Archived-At: > > (let ((count-func (if (fboundp 'cl-count) #'cl-count #'count)()))) > > ... > > (delete-char (* (cl-count ...)... > > > > php-mode.el:436:8:Warning: malformed let binding: > > The warning tries to tell you that ... the let binding is malformed. ;-) > 2) Replace that (cl-count ...) with (funcall count-func ...). Yes. Calling `cl-count' just, well, calls `cl-count'. ;-) The point was to call `cl-count' if it exists, or call `count' if not. `count' is defined if `cl-count' is not defined. Older Emacs uses the name `count'; newer Emacs uses the name `cl-count'. > But what Drew meant, I think, if for you the create a prefixed > function alias, not local value binding. The former would just > look better in code. That's OK too. But all I really meant was to call the function that exists, whether it is named `cl-count' or `count'. One or the other is available, and they presumably do the same thing. Look first for a function with the newer name, `cl-count'. If that does not exist then use `count', which must exist prior to the introduction of `cl-count'. If you have only one or a few occurrences of `cl-count' in your code, you could just replace them with a funcall of the right function, as indicated above. If you have a lot of them, or if you prefer (e.g. to ease maintenance), you can create your own (non-local) function that calls the right one, and then use that everywhere in your code. (defun my-count (&rest args) (if (fboundp 'cl-count) (apply #'cl-count args) (apply #'count args))) Or just: (defalias 'my-count (if (fboundp 'cl-count) #'cl-count #'count)) Then (delete-char (* (my-count ...)... etc.