+;;; MH-E Customization Support Routines
+
+;; Shush compiler (Emacs 21 and XEmacs).
+(defvar customize-package-emacs-version-alist)
+
+;; Temporary function and data structure used customization.
+;; These will be unbound after the options are defined.
+(defmacro mh-strip-package-version (args)
+ "Strip :package-version keyword and its value from ARGS.
+In Emacs versions that support the :package-version keyword,
+ARGS is returned unchanged."
+ `(if (boundp 'customize-package-emacs-version-alist)
+ ,args
+ (let (seen)
+ (loop for keyword in ,args
+ if (cond ((eq keyword ':package-version) (setq seen t) nil)
+ (seen (setq seen nil) nil)
+ (t t))
+ collect keyword))))
+
+(defmacro defgroup-mh (symbol members doc &rest args)
+ "Declare SYMBOL as a customization group containing MEMBERS.
+See documentation for `defgroup' for a description of the arguments
+SYMBOL, MEMBERS, DOC and ARGS.
+This macro is used by Emacs versions that lack the :package-version
+keyword, introduced in Emacs 22."
+ (declare (doc-string 3))
+ `(defgroup ,symbol ,members ,doc ,@(mh-strip-package-version args)))
+(put 'defgroup-mh 'lisp-indent-function 'defun)
+
+(defmacro defcustom-mh (symbol value doc &rest args)
+ "Declare SYMBOL as a customizable variable that defaults to VALUE.
+See documentation for `defcustom' for a description of the arguments
+SYMBOL, VALUE, DOC and ARGS.
+This macro is used by Emacs versions that lack the :package-version
+keyword, introduced in Emacs 22."
+ (declare (doc-string 3))
+ `(defcustom ,symbol ,value ,doc ,@(mh-strip-package-version args)))
+(put 'defcustom-mh 'lisp-indent-function 'defun)
+
+(defmacro defface-mh (face spec doc &rest args)
+ "Declare FACE as a customizable face that defaults to SPEC.
+See documentation for `defface' for a description of the arguments
+FACE, SPEC, DOC and ARGS.
+This macro is used by Emacs versions that lack the :package-version
+keyword, introduced in Emacs 22."
+ (declare (doc-string 3))
+ `(defface ,face ,spec ,doc ,@(mh-strip-package-version args)))
+(put 'defface-mh 'lisp-indent-function 'defun)
+
+\f
+