diff lisp/cus-edit.el @ 90384:c156f6a9e7b5

Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-56 Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 204-225) - Update from CVS - Sync from erc--emacs--0 - Merge from gnus--rel--5.10 - Improve tq.el. - Update from CVS: src/puresize.h (PURESIZE_RATIO): Reduce to 10/6. * gnus--rel--5.10 (patch 81-85) - Update from CVS - Merge from emacs--devo--0
author Miles Bader <miles@gnu.org>
date Mon, 17 Apr 2006 08:41:12 +0000
parents e6bf73e43cf4 8991a6461375
children 2ecafc6d5db7
line wrap: on
line diff
--- a/lisp/cus-edit.el	Sun Apr 09 01:43:22 2006 +0000
+++ b/lisp/cus-edit.el	Mon Apr 17 08:41:12 2006 +0000
@@ -786,7 +786,7 @@
     (if (or (and (= 1 (length children))
 		 (memq (widget-type (car children))
 		       '(custom-variable custom-face)))
-	    (y-or-n-p "Reset all settings' buffer text to show current values?  "))
+	    (y-or-n-p "Reset all settings' buffer text to show current values? "))
 	(mapc (lambda (widget)
 		(if (memq (widget-get widget :custom-state)
 			  '(modified changed))
@@ -1079,6 +1079,33 @@
 (defvar customize-changed-options-previous-release "21.1"
   "Version for `customize-changed-options' to refer back to by default.")
 
+;; Packages will update this variable, so make it available.
+;;;###autoload
+(defvar customize-package-emacs-version-alist nil
+  "Alist mapping versions of Emacs to versions of a package.
+These package versions are listed in the :package-version
+keyword used in `defcustom', `defgroup', and `defface'. Its
+elements look like this:
+
+     (PACKAGE (PVERSION . EVERSION)...)
+
+For each PACKAGE, which is a symbol, there are one or more
+elements that contain a package version PVERSION with an
+associated Emacs version EVERSION.  These versions are strings.
+For example, the MH-E package updates this alist with the
+following:
+
+     (add-to-list 'customize-package-emacs-version-alist
+                  '(MH-E (\"6.0\" . \"22.1\") (\"6.1\" . \"22.1\")
+                         (\"7.0\" . \"22.1\") (\"7.1\" . \"22.1\")
+                         (\"7.2\" . \"22.1\") (\"7.3\" . \"22.1\")
+                         (\"7.4\" . \"22.1\") (\"8.0\" . \"22.1\")))
+
+The value of PACKAGE needs to be unique and it needs to match the
+PACKAGE value appearing in the :package-version keyword.  Since
+the user might see the value in a error message, a good choice is
+the official name of the package, such as MH-E or Gnus.")
+
 ;;;###autoload
 (defalias 'customize-changed 'customize-changed-options)
 
@@ -1119,7 +1146,12 @@
   (let (found)
     (mapatoms
      (lambda (symbol)
-       (let ((version (get symbol 'custom-version)))
+        (let* ((package-version (get symbol 'custom-package-version))
+               (version
+                (or (and package-version
+                         (customize-package-emacs-version symbol
+                                                          package-version))
+                    (get symbol 'custom-version))))
 	 (if version
 	     (when (customize-version-lessp since-version version)
 	       (if (or (get symbol 'custom-group)
@@ -1135,6 +1167,32 @@
       (error "No user option defaults have been changed since Emacs %s"
 	     since-version))))
 
+(defun customize-package-emacs-version (symbol package-version)
+  "Return Emacs version of SYMBOL.
+PACKAGE-VERSION has the form (PACKAGE . VERSION).  The VERSION of
+PACKAGE is looked up in the associated list
+`customize-package-emacs-version-alist' to find the version of
+Emacs that is associated with it."
+  (let (package-versions emacs-version)
+    ;; Use message instead of error since we want user to be able to
+    ;; see the rest of the symbols even if a package author has
+    ;; botched things up.
+    (cond ((not (listp package-version))
+           (message "Invalid package-version value for %s" symbol))
+          ((setq package-versions (assq (car package-version)
+                                        customize-package-emacs-version-alist))
+           (setq emacs-version
+                 (cdr (assoc (cdr package-version) package-versions)))
+           (unless emacs-version
+             (message "%s version %s not found in %s" symbol
+                      (cdr package-version)
+                      "customize-package-emacs-version-alist")))
+          (t
+           (message "Package %s neglected to update %s"
+                    (car package-version)
+                    "customize-package-emacs-version-alist")))
+    emacs-version))
+
 (defun customize-version-lessp (version1 version2)
   ;; Why are the versions strings, and given that they are, why aren't
   ;; they converted to numbers and compared as such here?  -- fx