comparison lisp/cus-edit.el @ 70021:8991a6461375

* cus-edit.el (customize-package-emacs-version-alist): Update docstring. (customize-package-emacs-version): Use cdr instead of cadr now that alists use dotted pairs. * custom.el (defcustom): Fix docstring for :package-version.
author Bill Wohler <wohler@newt.com>
date Fri, 14 Apr 2006 00:46:39 +0000
parents dc1f0ab7e276
children bdc0573597a9 c156f6a9e7b5
comparison
equal deleted inserted replaced
70020:2578326defd6 70021:8991a6461375
1080 "Version for `customize-changed-options' to refer back to by default.") 1080 "Version for `customize-changed-options' to refer back to by default.")
1081 1081
1082 ;; Packages will update this variable, so make it available. 1082 ;; Packages will update this variable, so make it available.
1083 ;;;###autoload 1083 ;;;###autoload
1084 (defvar customize-package-emacs-version-alist nil 1084 (defvar customize-package-emacs-version-alist nil
1085 "Alist that maps packages to alists of package to Emacs versions. 1085 "Alist mapping versions of Emacs to versions of a package.
1086 The value alists map all package versions used with 1086 These package versions are listed in the :package-version
1087 the :package-version keyword to Emacs versions. Packages are 1087 keyword used in `defcustom', `defgroup', and `defface'. Its
1088 symbols and versions are strings. 1088 elements look like this:
1089 1089
1090 For example: 1090 (PACKAGE (PVERSION . EVERSION)...)
1091 '((MH-E (\"7.4\" \"22.1\") (\"8.0\" \"22.1\")) 1091
1092 (Gnus (\"5.11\" \"22.1\")))") 1092 For each PACKAGE, which is a symbol, there are one or more
1093 elements that contain a package version PVERSION with an
1094 associated Emacs version EVERSION. These versions are strings.
1095 For example, the MH-E package updates this alist with the
1096 following:
1097
1098 (add-to-list 'customize-package-emacs-version-alist
1099 '(MH-E (\"6.0\" . \"22.1\") (\"6.1\" . \"22.1\")
1100 (\"7.0\" . \"22.1\") (\"7.1\" . \"22.1\")
1101 (\"7.2\" . \"22.1\") (\"7.3\" . \"22.1\")
1102 (\"7.4\" . \"22.1\") (\"8.0\" . \"22.1\")))
1103
1104 The value of PACKAGE needs to be unique and it needs to match the
1105 PACKAGE value appearing in the :package-version keyword. Since
1106 the user might see the value in a error message, a good choice is
1107 the official name of the package, such as MH-E or Gnus.")
1093 1108
1094 ;;;###autoload 1109 ;;;###autoload
1095 (defalias 'customize-changed 'customize-changed-options) 1110 (defalias 'customize-changed 'customize-changed-options)
1096 1111
1097 ;;;###autoload 1112 ;;;###autoload
1152 (error "No user option defaults have been changed since Emacs %s" 1167 (error "No user option defaults have been changed since Emacs %s"
1153 since-version)))) 1168 since-version))))
1154 1169
1155 (defun customize-package-emacs-version (symbol package-version) 1170 (defun customize-package-emacs-version (symbol package-version)
1156 "Return Emacs version of SYMBOL. 1171 "Return Emacs version of SYMBOL.
1157 PACKAGE-VERSION has the form (PACKAGE VERSION). The VERSION of 1172 PACKAGE-VERSION has the form (PACKAGE . VERSION). The VERSION of
1158 PACKAGE is looked up in the associated list 1173 PACKAGE is looked up in the associated list
1159 `customize-package-emacs-version-alist' to find the version of 1174 `customize-package-emacs-version-alist' to find the version of
1160 Emacs that is associated with it." 1175 Emacs that is associated with it."
1161 (let (package-versions emacs-version) 1176 (let (package-versions emacs-version)
1162 ;; Use message instead of error since we want user to be able to 1177 ;; Use message instead of error since we want user to be able to
1165 (cond ((not (listp package-version)) 1180 (cond ((not (listp package-version))
1166 (message "Invalid package-version value for %s" symbol)) 1181 (message "Invalid package-version value for %s" symbol))
1167 ((setq package-versions (assq (car package-version) 1182 ((setq package-versions (assq (car package-version)
1168 customize-package-emacs-version-alist)) 1183 customize-package-emacs-version-alist))
1169 (setq emacs-version 1184 (setq emacs-version
1170 (cadr (assoc (cadr package-version) package-versions))) 1185 (cdr (assoc (cdr package-version) package-versions)))
1171 (unless emacs-version 1186 (unless emacs-version
1172 (message "Package version of %s not found in %s" symbol 1187 (message "%s version %s not found in %s" symbol
1188 (cdr package-version)
1173 "customize-package-emacs-version-alist"))) 1189 "customize-package-emacs-version-alist")))
1174 (t 1190 (t
1175 (message "Package %s neglected to update %s" 1191 (message "Package %s neglected to update %s"
1176 (car package-version) 1192 (car package-version)
1177 "customize-package-emacs-version-alist"))) 1193 "customize-package-emacs-version-alist")))