From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Stephen J. Turnbull" Newsgroups: gmane.emacs.devel Subject: Re: How to fix Emacs24 compiler warning w/o breaking code for previous versions Date: Fri, 17 Jun 2011 15:34:27 +0900 Message-ID: <8762o5klu4.fsf@uwakimon.sk.tsukuba.ac.jp> References: <87oc1xd62s.fsf@gmail.com> <811uytyvgc.fsf@gmail.com> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1308292500 7572 80.91.229.12 (17 Jun 2011 06:35:00 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 17 Jun 2011 06:35:00 +0000 (UTC) Cc: emacs-devel@gnu.org To: Jambunathan K Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Fri Jun 17 08:34:57 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 1QXSds-00010G-Re for ged-emacs-devel@m.gmane.org; Fri, 17 Jun 2011 08:34:56 +0200 Original-Received: from localhost ([::1]:34198 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QXSdr-0004CB-Tw for ged-emacs-devel@m.gmane.org; Fri, 17 Jun 2011 02:34:56 -0400 Original-Received: from eggs.gnu.org ([140.186.70.92]:40551) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QXSdb-0004C4-F7 for emacs-devel@gnu.org; Fri, 17 Jun 2011 02:34:40 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1QXSda-0008Jk-Gs for emacs-devel@gnu.org; Fri, 17 Jun 2011 02:34:39 -0400 Original-Received: from mgmt1.sk.tsukuba.ac.jp ([130.158.97.223]:44909) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1QXSda-0008JK-8i for emacs-devel@gnu.org; Fri, 17 Jun 2011 02:34:38 -0400 Original-Received: from uwakimon.sk.tsukuba.ac.jp (uwakimon.sk.tsukuba.ac.jp [130.158.99.156]) by mgmt1.sk.tsukuba.ac.jp (Postfix) with ESMTP id 98EA43FA0711; Fri, 17 Jun 2011 15:34:24 +0900 (JST) Original-Received: by uwakimon.sk.tsukuba.ac.jp (Postfix, from userid 1000) id 4C9261A316C; Fri, 17 Jun 2011 15:34:27 +0900 (JST) In-Reply-To: <811uytyvgc.fsf@gmail.com> X-Mailer: VM 8.1.93a under 21.5 (beta31) "ginger" 6b3caa55668c XEmacs Lucid (x86_64-unknown-linux) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-Received-From: 130.158.97.223 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:140588 Archived-At: Jambunathan K writes: > I was hoping that there is an elisp equivalent for C-like > > #if emacs-version > a First, I don't think this is generally a very good idea. I prefer actual feature tests where new features matter, and let the byte compiler warnings fall where they may in older versions. That said: XEmacs has `emacs-version>=', although my local Emacs (21.2.1) doesn't seem to (not with any spelling starting with "emacs-version", anyway). I didn't write it and offhand don't know who did, so I can't contribute it, but it's not hard to write. You just have to take care to handle the lexicographic comparison correctly (eg, w.r.t. null arguments, which is why actually having it is useful vs. homebrew -- homebrew functions often got that wrong). If you want to check XEmacs compatibility, I'll be happy to compare anyone's version to the XEmacs algorithm (to avoid legal issues, the programmer shouldn't do it himself of course). We don't have `emacs-version=' or `emacs-version>'. I don't think they're very useful, though, compared to the ">=" variety. Nor has anybody asked for them or tried to contribute them that I can recall. Here's our doctring: `emacs-version>=' is a compiled Lisp function -- loaded from "/playpen/src/XEmacs/xemacs/lisp/version.elc" (emacs-version>= MAJOR &optional MINOR PATCH) Documentation: Return true if the Emacs version is >= to the given MAJOR, MINOR, and PATCH numbers. The MAJOR version number argument is required, but the other arguments are optional. Only the Non-nil arguments are used in the test.