diff options
| author | Bill Wohler | 2006-04-10 23:43:34 +0000 |
|---|---|---|
| committer | Bill Wohler | 2006-04-10 23:43:34 +0000 |
| commit | 4e9c705e50b4e6ee733e0134703b00253cc4cf7c (patch) | |
| tree | 5d3b92a29d6c6dd057ce3f0605488a22f9ed9119 | |
| parent | 1d22fabd46ebbb3e2af5cdea011b42c7a0331463 (diff) | |
| download | emacs-4e9c705e50b4e6ee733e0134703b00253cc4cf7c.tar.gz emacs-4e9c705e50b4e6ee733e0134703b00253cc4cf7c.zip | |
* custom.el (defcustom, custom-handle-keyword): Add :package-version
keyword.
(custom-add-package-version): New function. Sets value of new property
'custom-package-version from :package-version keyword.
* cus-edit.el (customize-package-emacs-version-alist): New variable.
(customize-changed-options): Add check for custom-package-version.
(customize-package-emacs-version): New function to look up Emacs
version corresponding to the given package version.
| -rw-r--r-- | lisp/ChangeLog | 11 | ||||
| -rw-r--r-- | lisp/cus-edit.el | 46 | ||||
| -rw-r--r-- | lisp/custom.el | 12 |
3 files changed, 67 insertions, 2 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 59d12a7f41b..8a205081fa5 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,5 +1,16 @@ | |||
| 1 | 2006-04-10 Bill Wohler <wohler@newt.com> | 1 | 2006-04-10 Bill Wohler <wohler@newt.com> |
| 2 | 2 | ||
| 3 | * custom.el (defcustom, custom-handle-keyword): Add | ||
| 4 | :package-version keyword. | ||
| 5 | (custom-add-package-version): New function. Sets value of new | ||
| 6 | property 'custom-package-version from :package-version keyword. | ||
| 7 | |||
| 8 | * cus-edit.el (customize-package-emacs-version-alist): New | ||
| 9 | variable. | ||
| 10 | (customize-changed-options): Add check for custom-package-version. | ||
| 11 | (customize-package-emacs-version): New function to look up Emacs | ||
| 12 | version corresponding to the given package version. | ||
| 13 | |||
| 3 | * emacs-lisp/find-func.el (find-function-regexp): Allow dashes in | 14 | * emacs-lisp/find-func.el (find-function-regexp): Allow dashes in |
| 4 | defun name, in similar fashion to find-variable-regexp. | 15 | defun name, in similar fashion to find-variable-regexp. |
| 5 | 16 | ||
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el index e2275ce356d..4de2a431392 100644 --- a/lisp/cus-edit.el +++ b/lisp/cus-edit.el | |||
| @@ -786,7 +786,7 @@ when the action is chosen.") | |||
| 786 | (if (or (and (= 1 (length children)) | 786 | (if (or (and (= 1 (length children)) |
| 787 | (memq (widget-type (car children)) | 787 | (memq (widget-type (car children)) |
| 788 | '(custom-variable custom-face))) | 788 | '(custom-variable custom-face))) |
| 789 | (y-or-n-p "Reset all settings' buffer text to show current values? ")) | 789 | (y-or-n-p "Reset all settings' buffer text to show current values? ")) |
| 790 | (mapc (lambda (widget) | 790 | (mapc (lambda (widget) |
| 791 | (if (memq (widget-get widget :custom-state) | 791 | (if (memq (widget-get widget :custom-state) |
| 792 | '(modified changed)) | 792 | '(modified changed)) |
| @@ -1079,6 +1079,18 @@ Show the buffer in another window, but don't select it." | |||
| 1079 | (defvar customize-changed-options-previous-release "21.1" | 1079 | (defvar customize-changed-options-previous-release "21.1" |
| 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. | ||
| 1083 | ;;;###autoload | ||
| 1084 | (defvar customize-package-emacs-version-alist nil | ||
| 1085 | "Alist that maps packages to alists of package to Emacs versions. | ||
| 1086 | The value alists map all package versions used with | ||
| 1087 | the :package-version keyword to Emacs versions. Packages are | ||
| 1088 | symbols and versions are strings. | ||
| 1089 | |||
| 1090 | For example: | ||
| 1091 | '((MH-E (\"7.4\" \"22.1\") (\"8.0\" \"22.1\")) | ||
| 1092 | (Gnus (\"5.11\" \"22.1\")))") | ||
| 1093 | |||
| 1082 | ;;;###autoload | 1094 | ;;;###autoload |
| 1083 | (defalias 'customize-changed 'customize-changed-options) | 1095 | (defalias 'customize-changed 'customize-changed-options) |
| 1084 | 1096 | ||
| @@ -1119,7 +1131,12 @@ that were added or redefined since that version." | |||
| 1119 | (let (found) | 1131 | (let (found) |
| 1120 | (mapatoms | 1132 | (mapatoms |
| 1121 | (lambda (symbol) | 1133 | (lambda (symbol) |
| 1122 | (let ((version (get symbol 'custom-version))) | 1134 | (let* ((package-version (get symbol 'custom-package-version)) |
| 1135 | (version | ||
| 1136 | (or (and package-version | ||
| 1137 | (customize-package-emacs-version symbol | ||
| 1138 | package-version)) | ||
| 1139 | (get symbol 'custom-version)))) | ||
| 1123 | (if version | 1140 | (if version |
| 1124 | (when (customize-version-lessp since-version version) | 1141 | (when (customize-version-lessp since-version version) |
| 1125 | (if (or (get symbol 'custom-group) | 1142 | (if (or (get symbol 'custom-group) |
| @@ -1135,6 +1152,31 @@ that were added or redefined since that version." | |||
| 1135 | (error "No user option defaults have been changed since Emacs %s" | 1152 | (error "No user option defaults have been changed since Emacs %s" |
| 1136 | since-version)))) | 1153 | since-version)))) |
| 1137 | 1154 | ||
| 1155 | (defun customize-package-emacs-version (symbol package-version) | ||
| 1156 | "Return Emacs version of SYMBOL. | ||
| 1157 | PACKAGE-VERSION has the form (PACKAGE VERSION). The VERSION of | ||
| 1158 | PACKAGE is looked up in the associated list | ||
| 1159 | `customize-package-emacs-version-alist' to find the version of | ||
| 1160 | Emacs that is associated with it." | ||
| 1161 | (let (package-versions emacs-version) | ||
| 1162 | ;; Use message instead of error since we want user to be able to | ||
| 1163 | ;; see the rest of the symbols even if a package author has | ||
| 1164 | ;; botched things up. | ||
| 1165 | (cond ((not (listp package-version)) | ||
| 1166 | (message "Invalid package-version value for %s" symbol)) | ||
| 1167 | ((setq package-versions (assq (car package-version) | ||
| 1168 | customize-package-emacs-version-alist)) | ||
| 1169 | (setq emacs-version | ||
| 1170 | (cadr (assoc (cadr package-version) package-versions))) | ||
| 1171 | (unless emacs-version | ||
| 1172 | (message "Package version of %s not found in %s" symbol | ||
| 1173 | "customize-package-emacs-version-alist"))) | ||
| 1174 | (t | ||
| 1175 | (message "Package %s neglected to update %s" | ||
| 1176 | (car package-version) | ||
| 1177 | "customize-package-emacs-version-alist"))) | ||
| 1178 | emacs-version)) | ||
| 1179 | |||
| 1138 | (defun customize-version-lessp (version1 version2) | 1180 | (defun customize-version-lessp (version1 version2) |
| 1139 | ;; Why are the versions strings, and given that they are, why aren't | 1181 | ;; Why are the versions strings, and given that they are, why aren't |
| 1140 | ;; they converted to numbers and compared as such here? -- fx | 1182 | ;; they converted to numbers and compared as such here? -- fx |
diff --git a/lisp/custom.el b/lisp/custom.el index c67f3b06272..42872ca761c 100644 --- a/lisp/custom.el +++ b/lisp/custom.el | |||
| @@ -268,6 +268,12 @@ The following keywords are meaningful: | |||
| 268 | VALUE should be a string specifying that the variable was | 268 | VALUE should be a string specifying that the variable was |
| 269 | first introduced, or its default value was changed, in Emacs | 269 | first introduced, or its default value was changed, in Emacs |
| 270 | version VERSION. | 270 | version VERSION. |
| 271 | :package-version | ||
| 272 | VALUE should be a list with the form (PACKAGE VERSION) | ||
| 273 | specifying that the variable was first introduced, or its | ||
| 274 | default value was changed, in PACKAGE version VERSION. This | ||
| 275 | keyword takes priority over :version. The PACKAGE and VERSION | ||
| 276 | must appear in the alist `customize-package-emacs-version-alist'. | ||
| 271 | :tag LABEL | 277 | :tag LABEL |
| 272 | Use LABEL, a string, instead of the item's name, to label the item | 278 | Use LABEL, a string, instead of the item's name, to label the item |
| 273 | in customization menus and buffers. | 279 | in customization menus and buffers. |
| @@ -489,6 +495,8 @@ Fourth argument TYPE is the custom option type." | |||
| 489 | (custom-add-to-group value symbol type)) | 495 | (custom-add-to-group value symbol type)) |
| 490 | ((eq keyword :version) | 496 | ((eq keyword :version) |
| 491 | (custom-add-version symbol value)) | 497 | (custom-add-version symbol value)) |
| 498 | ((eq keyword :package-version) | ||
| 499 | (custom-add-package-version symbol value)) | ||
| 492 | ((eq keyword :link) | 500 | ((eq keyword :link) |
| 493 | (custom-add-link symbol value)) | 501 | (custom-add-link symbol value)) |
| 494 | ((eq keyword :load) | 502 | ((eq keyword :load) |
| @@ -540,6 +548,10 @@ For other custom types, this has no effect." | |||
| 540 | "To the custom option SYMBOL add the version VERSION." | 548 | "To the custom option SYMBOL add the version VERSION." |
| 541 | (put symbol 'custom-version (purecopy version))) | 549 | (put symbol 'custom-version (purecopy version))) |
| 542 | 550 | ||
| 551 | (defun custom-add-package-version (symbol version) | ||
| 552 | "To the custom option SYMBOL add the package version VERSION." | ||
| 553 | (put symbol 'custom-package-version (purecopy version))) | ||
| 554 | |||
| 543 | (defun custom-add-load (symbol load) | 555 | (defun custom-add-load (symbol load) |
| 544 | "To the custom option SYMBOL add the dependency LOAD. | 556 | "To the custom option SYMBOL add the dependency LOAD. |
| 545 | LOAD should be either a library file name, or a feature name." | 557 | LOAD should be either a library file name, or a feature name." |