From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Tassilo Horn Newsgroups: gmane.emacs.devel Subject: Re: Free variable warning about bbdb-version (bug#19678) Date: Fri, 06 Mar 2015 10:09:06 +0100 Message-ID: <87twxyjxvx.fsf@gnu.org> References: NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Trace: ger.gmane.org 1425632996 12642 80.91.229.3 (6 Mar 2015 09:09:56 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Fri, 6 Mar 2015 09:09:56 +0000 (UTC) Cc: emacs-devel@gnu.org To: Thomas Fitzsimmons Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Mar 06 10:09:46 2015 Return-path: Envelope-to: ged-emacs-devel@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 1YToGM-0005wl-H9 for ged-emacs-devel@m.gmane.org; Fri, 06 Mar 2015 10:09:42 +0100 Original-Received: from localhost ([::1]:56888 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YToGL-000736-Rd for ged-emacs-devel@m.gmane.org; Fri, 06 Mar 2015 04:09:41 -0500 Original-Received: from eggs.gnu.org ([2001:4830:134:3::10]:33878) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YToFw-00072K-SM for emacs-devel@gnu.org; Fri, 06 Mar 2015 04:09:17 -0500 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YToFt-0006Ap-BM for emacs-devel@gnu.org; Fri, 06 Mar 2015 04:09:16 -0500 Original-Received: from out2-smtp.messagingengine.com ([66.111.4.26]:54130) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YToFt-0006Aa-4O for emacs-devel@gnu.org; Fri, 06 Mar 2015 04:09:13 -0500 Original-Received: from compute6.internal (compute6.nyi.internal [10.202.2.46]) by mailout.nyi.internal (Postfix) with ESMTP id 5EFFA20C93 for ; Fri, 6 Mar 2015 04:09:11 -0500 (EST) Original-Received: from frontend2 ([10.202.2.161]) by compute6.internal (MEProxy); Fri, 06 Mar 2015 04:09:12 -0500 DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d= messagingengine.com; h=x-sasl-enc:from:to:cc:subject:references :date:in-reply-to:message-id:mime-version:content-type :content-transfer-encoding; s=smtpout; bh=nvxT537TEU6h4f9Kl4wbyI d3N/s=; b=jZr1F4Tk/e5zTul7cGCYnPBWNo78lodvV1eA9D1idWQ2AJ+ziML5xs TV5vha+QIEgK9dsifOAvvVVn9MoIaumP5qc9LNqojLXl/WGALuPR6R7UgOvClmBN kvk3Ak+jxo72fxPpU1DfrgYV64OrgOTaQoRwElQ/64gzjby/QUglY= X-Sasl-enc: V7Z5UC9icZSqr0yrdITLT8F8yY8lvxhRJneJO6+Fbj1t 1425632952 Original-Received: from thinkpad-t440p (unknown [2.160.6.91]) by mail.messagingengine.com (Postfix) with ESMTPA id E2D796801A1; Fri, 6 Mar 2015 04:09:11 -0500 (EST) Mail-Followup-To: Thomas Fitzsimmons , emacs-devel@gnu.org In-Reply-To: (Thomas Fitzsimmons's message of "Fri, 06 Mar 2015 03:48:39 -0500") User-Agent: Gnus/5.130012 (Ma Gnus v0.12) Emacs/25.0.50 (gnu/linux) X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 66.111.4.26 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:183691 Archived-At: Thomas Fitzsimmons writes: Hi Thomas, > I'm trying to make eudcb-bbdb.el compatible with BBDB 2 and BBDB 3. > To check the version, I need something like: > > (if (version<=3D "3" bbdb-version) ...) > > but the byte compiler warns: > > Warning: reference to free variable `bbdb-version' > > I'd rather not introduce a new warning. Is there a good way to handle > this? Adding (defvar bbdb-version) to eudcb-bbdb.el seems wrong, > since the version check is assuming it's a constant defined by the > external BBDB package. (defvar bbdb-version) is exactly what you are looking for. The defvar without init-value just tells the byte-compiler that you make sure this variable will be there at the right time so he hasn't to worry about it. ,----[ (info "(elisp)Warning Tips") ] | =E2=80=A2 Try to avoid compiler warnings about undefined free variable= s, by | adding dummy =E2=80=98defvar=E2=80=99 definitions for these variable= s, like this: |=20 | (defvar foo) |=20 | Such a definition has no effect except to tell the compiler not to | warn about uses of the variable =E2=80=98foo=E2=80=99 in this file. `---- Since you require bbdb on top of the file anyway, you can be sure that `bbdb-version' is correctly initialized from the external bbdb package when the version check takes place. Bye, Tassilo