From mboxrd@z Thu Jan 1 00:00:00 1970 Path: main.gmane.org!not-for-mail From: no-spam@cua.dk (Kim F. Storm) Newsgroups: gmane.emacs.devel Subject: Can we add a check to see if user is using old or obsolete code? Date: 20 Feb 2003 22:03:13 +0100 Sender: emacs-devel-bounces+emacs-devel=quimby.gnus.org@gnu.org Message-ID: <5xfzqibr72.fsf@kfs2.cua.dk> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1045771735 30829 80.91.224.249 (20 Feb 2003 20:08:55 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Thu, 20 Feb 2003 20:08:55 +0000 (UTC) Return-path: Original-Received: from quimby.gnus.org ([80.91.224.244]) by main.gmane.org with esmtp (Exim 3.35 #1 (Debian)) id 18lx02-000817-00 for ; Thu, 20 Feb 2003 21:08:54 +0100 Original-Received: from monty-python.gnu.org ([199.232.76.173]) by quimby.gnus.org with esmtp (Exim 3.12 #1 (Debian)) id 18lxDh-00046J-00 for ; Thu, 20 Feb 2003 21:23:01 +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 18lwyp-0006iM-00 for emacs-devel@quimby.gnus.org; Thu, 20 Feb 2003 15:07:39 -0500 Original-Received: from list by monty-python.gnu.org with tmda-scanned (Exim 4.10.13) id 18lwxw-0006B6-00 for emacs-devel@gnu.org; Thu, 20 Feb 2003 15:06:44 -0500 Original-Received: from mail by monty-python.gnu.org with spam-scanned (Exim 4.10.13) id 18lwxe-0005sz-00 for emacs-devel@gnu.org; Thu, 20 Feb 2003 15:06:27 -0500 Original-Received: from mail.filanet.dk ([195.215.206.179]) by monty-python.gnu.org with esmtp (Exim 4.10.13) id 18lwvS-0004k2-00 for emacs-devel@gnu.org; Thu, 20 Feb 2003 15:04:10 -0500 Original-Received: from kfs2.cua.dk.cua.dk (unknown [10.1.82.3]) by mail.filanet.dk (Postfix) with SMTP id 537CA7C017 for ; Thu, 20 Feb 2003 21:04:08 +0100 (CET) Original-To: emacs-devel@gnu.org Original-Lines: 51 User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50 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:11795 X-Report-Spam: http://spam.gmane.org/gmane.emacs.devel:11795 I have a specific problem with CUA-mode in CVS head, but the solution might be useful for other packages as well. Many users of emacs 20.7 or 21.1 or 21.2 have fetched the cua.el package from my web site, and installed it according to the instructions found in that file, i.e. they have included the following lines in their .emacs file: (require 'cua) ;; or (require 'cua-mode) ;; or (load "cua-mode") (CUA-mode t) Now, emacs 21.4 includes a newer version of CUA-mode, and the old version actually doesn't work very well with 21.4 (due to changes in the way the key-translation-map works). So if a user upgrade from, say, 21.2 with the old version of cua.el in the load-path to release 21.4, CUA-mode will appear to be broken, but there is no indication that anything is wrong. So, the problem is: When a user upgrades to 21.4 (once it is released), can we prevent the loading and activation of the old cua-mode package (which is most likely still in the user's load-path). Actually, I don't see how it would be possible to prevent loading and activation of the obsolete (and non-functioning) CUA-mode. But it would be a good service to the user if emacs would at least warn the user that he is using an obsolete package, and recommend that he should use the included version instead. I suggest that we create a new hook, `check-compat-hook', which is run at the end of `normal-top-level' (i.e. after all normal user-setup actions have been performed). Packages which need to check that the user doesn't use an obsolete version of the package may then use a suitable block of autoloads like this: ;;;###autoload (defun XXX-compat-check () ;;;###autoload (if (boundp 'XXX-some-obsolete-var) ;;;###autoload (error "You are using an obsolete version of XXX."))) ;;;###autoload (add-hook 'check-compat-hook 'XXX-compat-check) WDYT? -- Kim F. Storm http://www.cua.dk