changeset 64357:25d7b8b15748

(define-minor-mode): Avoid constructing a defcustom with two :set or :type keywords.
author Luc Teirlinck <teirllm@auburn.edu>
date Sat, 16 Jul 2005 02:25:48 +0000
parents 1721aefddad6
children a673f66d6156
files lisp/emacs-lisp/easy-mmode.el
diffstat 1 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/emacs-lisp/easy-mmode.el	Sat Jul 16 02:24:21 2005 +0000
+++ b/lisp/emacs-lisp/easy-mmode.el	Sat Jul 16 02:25:48 2005 +0000
@@ -142,8 +142,10 @@
   (let* ((mode-name (symbol-name mode))
 	 (pretty-name (easy-mmode-pretty-mode-name mode lighter))
 	 (globalp nil)
+	 (set nil)
 	 (initialize nil)
 	 (group nil)
+	 (type nil)
 	 (extra-args nil)
 	 (extra-keywords nil)
 	 (require t)
@@ -160,8 +162,10 @@
 	(:lighter (setq lighter (pop body)))
 	(:global (setq globalp (pop body)))
 	(:extra-args (setq extra-args (pop body)))
+	(:set (setq set (list :set (pop body))))
 	(:initialize (setq initialize (list :initialize (pop body))))
 	(:group (setq group (nconc group (list :group (pop body)))))
+	(:type (setq type (list :type (pop body))))
 	(:require (setq require (pop body)))
 	(:keymap (setq keymap (pop body)))
 	(t (push keyw extra-keywords) (push (pop body) extra-keywords))))
@@ -169,9 +173,10 @@
     (setq keymap-sym (if (and keymap (symbolp keymap)) keymap
 		       (intern (concat mode-name "-map"))))
 
+    (unless set (setq set '(:set 'custom-set-minor-mode)))
+
     (unless initialize
-      (setq initialize
-	    '(:initialize 'custom-initialize-default)))
+      (setq initialize '(:initialize 'custom-initialize-default)))
 
     (unless group
       ;; We might as well provide a best-guess default group.
@@ -179,6 +184,8 @@
 	    `(:group ',(intern (replace-regexp-in-string
 				"-mode\\'" "" mode-name)))))
 
+    (unless type (setq type '(:type 'boolean)))
+
     `(progn
        ;; Define the variable to enable or disable the mode.
        ,(if (not globalp)
@@ -201,10 +208,10 @@
 
 	    `(defcustom ,mode ,init-value
 	       ,(format base-doc-string pretty-name mode mode)
-	       :set 'custom-set-minor-mode
+	       ,@set
 	       ,@initialize
 	       ,@group
-	       :type 'boolean
+	       ,@type
 	       ,@(cond
 		  ((not (and curfile require)) nil)
 		  ((not (eq require t)) `(:require ,require)))