all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: storm@cua.dk (Kim F. Storm)
Cc: Stefan Monnier <monnier+gnu/emacs@rum.cs.yale.edu>
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	[thread overview]
Message-ID: <5xel619q67.fsf@kfs2.cua.dk> (raw)
In-Reply-To: <E18mKxz-0005v0-00@fencepost.gnu.org>

Richard Stallman <rms@gnu.org> 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 <storm@cua.dk> http://www.cua.dk

  reply	other threads:[~2003-02-21 23:20 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-02-20 21:03 Can we add a check to see if user is using old or obsolete code? Kim F. Storm
2003-02-20 20:26 ` Stefan Monnier
2003-02-20 22:04   ` Kim F. Storm
2003-02-21 21:44   ` Richard Stallman
2003-02-21 23:20     ` Kim F. Storm [this message]
2003-02-22  0:28       ` Miles Bader
2003-02-22 22:37         ` Kim F. Storm
2003-02-22 17:54       ` Richard Stallman
2003-02-20 21:29 ` Kai Großjohann
2003-02-21  0:35   ` Kim F. Storm
2003-02-21 16:41     ` Kai Großjohann
2003-02-22  8:15   ` Richard Stallman
2003-02-23 11:06     ` Kai Großjohann
2003-02-24 16:38       ` Richard Stallman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5xel619q67.fsf@kfs2.cua.dk \
    --to=storm@cua.dk \
    --cc=monnier+gnu/emacs@rum.cs.yale.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.