emacs-devel
[Top][All Lists]
Advanced

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

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


From: Kim F. Storm
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
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

Richard Stallman <address@hidden> 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 <address@hidden> http://www.cua.dk





reply via email to

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