From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Dmitry Gutov Newsgroups: gmane.emacs.help Subject: Re: [Warning] cl-count (And Other Options) Date: Sat, 01 Dec 2012 02:20:34 +0400 Message-ID: <87hao6hgwd.fsf@yandex.ru> References: <50B92CD6.20809@gmail.com> NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain X-Trace: ger.gmane.org 1354314046 18177 80.91.229.3 (30 Nov 2012 22:20:46 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 30 Nov 2012 22:20:46 +0000 (UTC) Cc: help-gnu-emacs@gnu.org To: Eric James Michael Ritz Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane.org@gnu.org Fri Nov 30 23:20:58 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 1TeYx7-0008Lf-8D for geh-help-gnu-emacs@m.gmane.org; Fri, 30 Nov 2012 23:20:57 +0100 Original-Received: from localhost ([::1]:56886 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TeYwv-0002WU-Ni for geh-help-gnu-emacs@m.gmane.org; Fri, 30 Nov 2012 17:20:45 -0500 Original-Received: from eggs.gnu.org ([208.118.235.92]:37656) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TeYwq-0002WD-3z for help-gnu-emacs@gnu.org; Fri, 30 Nov 2012 17:20:41 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1TeYwo-0001y1-Sc for help-gnu-emacs@gnu.org; Fri, 30 Nov 2012 17:20:40 -0500 Original-Received: from mail-la0-f41.google.com ([209.85.215.41]:49595) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1TeYwo-0001xf-Kf for help-gnu-emacs@gnu.org; Fri, 30 Nov 2012 17:20:38 -0500 Original-Received: by mail-la0-f41.google.com with SMTP id m15so874558lah.0 for ; Fri, 30 Nov 2012 14:20:37 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:references:date:in-reply-to:message-id :user-agent:mime-version:content-type; bh=jsscqBpDXHnPedCrDrrEm7YfheCATVBoNQ+hxrPdb/8=; b=nuKYsh9sjES/E3FjQC3vjd2LtIDYbOXLY/0+BYH8z/DxF3qPC2EUVmVcVEZ+sxo3Ho lz1Ni8EepmxbepywGn9xuEgDjLM4fVrdYQim//Ddr0ajY/juLdXIjRnr6U+QZJzg1c1k 6X2qAF99Xr1C+0i4VnONOtBNgeMPOGtSSwN8UsERVxUWq6AHuooMmrg8Y0dfpYXTTfdB WVM7/hrWHJ9j9QAQtlIejDkmK2xKS2SjNmQdRQ9Q5UTc0lfCRyhVxkINtRyO3cymYNm+ /H+UUG9YNBM/CI73eTqajBkpamixA+acqnW9p/T/HagpPjQibX3li1yDOyWlVzEMaYSx 0V8w== Original-Received: by 10.112.25.161 with SMTP id d1mr1428722lbg.118.1354314037652; Fri, 30 Nov 2012 14:20:37 -0800 (PST) Original-Received: from SOL ([178.252.98.87]) by mx.google.com with ESMTPS id jk8sm2437056lab.7.2012.11.30.14.20.34 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 30 Nov 2012 14:20:35 -0800 (PST) In-Reply-To: <50B92CD6.20809@gmail.com> (Eric James Michael Ritz's message of "Fri, 30 Nov 2012 17:01:58 -0500") User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3.50 (windows-nt) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [fuzzy] X-Received-From: 209.85.215.41 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:87981 Archived-At: Eric James Michael Ritz writes: > First my apologies if this email would be more appropriate elsewhere. > > I am currently using GNU Emacs 24.2.90.1 (i686-pc-linux-gnu, GTK+ > Version 2.24.13), compiled on the 24th of November 2012. In a > function in my php-mode [1] I have the following function definition: > > (defun php-unindent-closure () > (let ((syntax (mapcar 'car c-syntactic-context))) > (if (and (member 'arglist-cont-nonempty syntax) > (or > (member 'statement-block-intro syntax) > (member 'brace-list-intro syntax) > (member 'brace-list-close syntax) > (member 'block-close syntax))) > (save-excursion > (let ((count-func (if (fboundp 'cl-count) #'cl-count #'count)()))) > (beginning-of-line) > (delete-char (* (cl-count 'arglist-cont-nonempty syntax) > c-basic-offset)))))) > > The key thing to note (unless you see something glaringly wrong with > it) is the call to `cl-count`. When I compile the file containing the > function I receive the following warning: > > Compiling file /home/eric/Projects/php-mode/php-mode.el at Fri Nov 30 > 16:49:05 2012 > > In php-unindent-closure: > php-mode.el:436:8:Warning: malformed let binding: `(count-func (if (fboundp > (quote cl-count)) (function cl-count) (function count)) nil) > > The warning leads me to believe that use of `cl-count` is not > encouraged. Is that the case? And if so, what would be my best > alternative which would not trigger a warning? The warning tries to tell you that you have a spurious "()" in the let binding form, after the value you are assigning to count-func. It doesn't mention the actual problems: 1) The let form's body is empty, while it should contain the code that goes after it. 2) Replace that (cl-count ...) with (funcall count-func ...). 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.