[Top][All Lists]

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

Re: Recognizing obsolete external package versions

From: Glenn Morris
Subject: Re: Recognizing obsolete external package versions
Date: Fri, 10 Aug 2007 17:15:11 -0400
User-agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/)

Richard Stallman wrote:

> Would someone please implement that feature?

Will this do?

(defconst bad-packages-list
  '((semantic (string-equal semantic-version "2.0pre3")
              (format "Semantic 2.0pre3 won't run in Emacs %s.
It causes excessive CPU load.  Update to a newer version."
    ;; Install run-time check for older versions of CUA-mode, which
    ;; does not work with GNU Emacs version 22.1 and newer.
    ;; Except for version 1.2, all of the 1.x and 2.x version of cua-mode
    ;; provided the `CUA-mode' feature.  Since this is no longer true,
    ;; we can warn the user if the `CUA-mode' feature is ever provided.
    (CUA-mode t (format "\n\nCUA-mode is now part of the standard \
GNU Emacs distribution, so you may
now enable CUA via the Options menu or by customizing option `cua-mode'.\n
You have loaded an older version of CUA-mode which does
not work correctly with this version of GNU Emacs.\n\n%s"
                        (if user-init-file
                            (format "To correct this, remove the loading and \
customization of the
old version from the %s file.\n\n" user-init-file)
  "List of packages known to cause problems in this version of Emacs.
Each element has the form (PACKAGE TESTFUNC MSGFUNC).  Upon
loading PACKAGE, evaluate TESTFUNC, and if it returns non-nil
signal an error with message given by evaluating MSGFUNC.")

(defun bad-package-check (package)
  "Run a check using an element from `bad-packages-list'.
Use the element matching the symbol PACKAGE.  This function is
added to `after-load-alist'."
  (let ((list (assoc package bad-packages-list)))
    (and list
         (condition-case nil
             (eval (nth 1 list))
           (error nil))
         (error (eval (nth 2 list))))))

(mapc (lambda (elem)
        (eval-after-load (car elem) `(bad-package-check ',(car elem))))

reply via email to

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