changeset 5812:7b42a97af782

Don't bail out on :package-version in `defcustom'. 2014-09-27 Michael Sperber <mike@xemacs.org> * custom.el (defcustom): (custom-handle-keyword): Handle :package-version without bailing out.
author Mike Sperber <sperber@deinprogramm.de>
date Sat, 27 Sep 2014 14:16:11 +0200
parents b527c25f36ce
children 36dddf9d90d1
files lisp/ChangeLog lisp/custom.el
diffstat 2 files changed, 26 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/ChangeLog	Mon Sep 29 10:44:50 2014 -0600
+++ b/lisp/ChangeLog	Sat Sep 27 14:16:11 2014 +0200
@@ -1,3 +1,8 @@
+2014-09-27  Michael Sperber  <mike@xemacs.org>
+
+	* custom.el (defcustom): 
+	(custom-handle-keyword): Handle :package-version without bailing out.
+
 2014-09-25  Jerry James  <james@xemacs.org>
 
 	* bytecomp.el (byte-compile-insert-header): do not insert
--- a/lisp/custom.el	Mon Sep 29 10:44:50 2014 -0600
+++ b/lisp/custom.el	Sat Sep 27 14:16:11 2014 +0200
@@ -274,6 +274,17 @@
         VALUE should be a string specifying that the variable was
         first introduced, or its default value was changed, in Emacs
         version VERSION.
+:package-version
+        VALUE should be a list with the form (PACKAGE . VERSION),
+        where PACKAGE and VERSION are strings.
+
+        This specifies that the variable was first introduced, or its
+        default value was changed, in PACKAGE version VERSION.  This
+        keyword takes priority over :version.
+
+        Since PACKAGE must be unique and the user might see it in an
+        error message, a good choice is the official name of the
+        package, such as MH-E or Gnus.
 :tag LABEL
         Use LABEL, a string, instead of the item's name, to label the item
         in customization menus and buffers.
@@ -458,6 +469,8 @@
 	 (custom-add-to-group value symbol type))
 	((eq keyword :version)
 	 (custom-add-version symbol value))
+	((eq keyword :package-version)
+	 (custom-add-package-version symbol value))
 	((eq keyword :link)
 	 (custom-add-link symbol value))
 	((eq keyword :load)
@@ -507,6 +520,14 @@
   "To the custom option SYMBOL add the version VERSION."
   (put symbol 'custom-version version))
 
+(defun custom-add-package-version (symbol version)
+  "To the custom option SYMBOL add the package version VERSION."
+  (unless (and (consp version)
+	       (stringp (car version))
+	       (stringp (cdr version)))
+        (error "Invalid package version `%s'" value))
+  (put symbol 'custom-package-version version))
+
 (defun custom-add-load (symbol load)
   "To the custom option SYMBOL add the dependency LOAD.
 LOAD should be either a library file name, or a feature name."