From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: storm@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Re: Can we add a check to see if user is using old or obsolete code? Date: 22 Feb 2003 00:20:32 +0100 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <5xel619q67.fsf@kfs2.cua.dk> References: <5xfzqibr72.fsf@kfs2.cua.dk> <200302202026.h1KKQ7924606@rum.cs.yale.edu> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1045866222 18077 80.91.224.249 (21 Feb 2003 22:23:42 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Fri, 21 Feb 2003 22:23:42 +0000 (UTC) Cc: Stefan Monnier Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18mLa0-0004hR-00 for ; Fri, 21 Feb 2003 23:23:40 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 18mLoC-0002CD-00 for ; Fri, 21 Feb 2003 23:38:20 +0100 Original-Received: from localhost ([127.0.0.1] helo=monty-python.gnu.org) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18mLZw-0008IO-03 for emacs-devel@quimby.gnus.org; Fri, 21 Feb 2003 17:23:36 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18mLZQ-00081U-00 for emacs-devel@gnu.org; Fri, 21 Feb 2003 17:23:04 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18mLYo-0007jP-00 for emacs-devel@gnu.org; Fri, 21 Feb 2003 17:22:57 -0500 Original-Received: from mail.filanet.dk ([195.215.206.179]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18mLXv-00076q-00; Fri, 21 Feb 2003 17:21:31 -0500 Original-Received: from kfs2.cua.dk.cua.dk (unknown [10.1.82.3]) by mail.filanet.dk (Postfix) with SMTP id C1BF07C017; Fri, 21 Feb 2003 23:21:27 +0100 (CET) Original-To: rms@gnu.org In-Reply-To: Original-Lines: 72 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 Original-cc: emacs-devel@gnu.org X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1b5 Precedence: list List-Id: Emacs development discussions. List-Help: List-Post: List-Subscribe: , List-Archive: List-Unsubscribe: , Errors-To: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Xref: main.gmane.org gmane.emacs.devel:11828 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:11828 Richard Stallman writes: > You can also use > > (eval-after-load 'cua > '(if (boundp 'CUA-some-obsolete-var) > (error "You are using an obsolete version of CUA."))) > > Does this assume that the old version of cua has some variable > that has been removed? It looks that way. It was just one way to detect older versions; I guess each package would have specific ways to differentiate old and current versions. > > Perhaps in the case of cua this is true; perhaps some variable was > removed from cua. But if we want this to be a general method, it > should not depend on there being a variable or function that was > removed. If there was no other reason to remove one, it would > not be good to remove one just to do this. I agree in general, but for CUA, the current version is more or less a complete rewrite, so there are many variables and functions that were removed in the process. But for CUA, I actually found that the old versions provide `CUA-mode' while the new version doesn't, so I don't need any additional test; just (eval-after-load 'CUA-mode (error ...)) does the trick. > > It would be better to do > > (eval-after-load 'cua > '(unless (fboundp 'CUA-some-new-func) > (error "You are using an obsolete version of CUA"))) > > You can always add a new function in the new version, > and if you do so merely so that you can add this error message, > that is not a problem. But if the user is using CUA version 1.2, it doesn't provide CUA-mode or any other symbol, so the eval-after-load method will only be able to check post 1.2 versions. My original proposal to use a check-compat-hook would be able to check for the 1.2 version too, but it would have to do that by checking for the existence of a variable or function which was defined in 1.2 (and all of 1.x and 2.x), but not in the current rewritten version. > > (Remember that error messages should not end with periods.) I know the general rule, but for a multi-sentence error message, it seems strange not to terminate the last sentence with a period. Since I will except that MANY users upgrading to 21.4 will be using older versions of CUA, I decided to give a more elaborate error message. Here is the complete text: -------------------- CUA-mode is now part of the standard GNU Emacs distribution, so you may now enable and customize CUA via the Options menu. Your .emacs loads an older version of CUA-mode which does not work correctly with this version of GNU Emacs. To correct this, remove the loading and customization of the old version from the /home/kfs/.emacs file. -------------------- Should I remove the final period here? -- Kim F. Storm http://www.cua.dk