[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Can we add a check to see if user is using old or obsolete code?

From: Kim F. Storm
Subject: Can we add a check to see if user is using old or obsolete code?
Date: 20 Feb 2003 22:03:13 +0100
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

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)


Kim F. Storm <address@hidden> http://www.cua.dk

reply via email to

[Prev in Thread] Current Thread [Next in Thread]