From: Dmitry Gutov <dgutov@yandex.ru>
To: Eric James Michael Ritz <lobbyjones@gmail.com>
Cc: help-gnu-emacs@gnu.org
Subject: Re: [Warning] cl-count (And Other Options)
Date: Sat, 01 Dec 2012 02:20:34 +0400 [thread overview]
Message-ID: <87hao6hgwd.fsf@yandex.ru> (raw)
In-Reply-To: <50B92CD6.20809@gmail.com> (Eric James Michael Ritz's message of "Fri, 30 Nov 2012 17:01:58 -0500")
Eric James Michael Ritz <lobbyjones@gmail.com> 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.
next prev parent reply other threads:[~2012-11-30 22:20 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-11-30 22:01 [Warning] cl-count (And Other Options) Eric James Michael Ritz
2012-11-30 22:20 ` Dmitry Gutov [this message]
2012-11-30 22:58 ` Drew Adams
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87hao6hgwd.fsf@yandex.ru \
--to=dgutov@yandex.ru \
--cc=help-gnu-emacs@gnu.org \
--cc=lobbyjones@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.