# HG changeset patch # User Stefan Monnier # Date 1054245275 0 # Node ID 418f1ce2a14ee6b8d1e0615f7f1ac444b194d7b9 # Parent d91863669383321b8ce155ec446671cf957883ed (define-minor-mode): Add edebug spec. Accept a :keymap argument, as you'd expect. diff -r d91863669383 -r 418f1ce2a14e lisp/emacs-lisp/easy-mmode.el --- a/lisp/emacs-lisp/easy-mmode.el Thu May 29 21:34:15 2003 +0000 +++ b/lisp/emacs-lisp/easy-mmode.el Thu May 29 21:54:35 2003 +0000 @@ -1,6 +1,6 @@ ;;; easy-mmode.el --- easy definition for major and minor modes -;; Copyright (C) 1997, 2000, 2001 Free Software Foundation, Inc. +;; Copyright (C) 1997, 2000, 2001, 2003 Free Software Foundation, Inc. ;; Author: Georges Brun-Cottan ;; Maintainer: Stefan Monnier @@ -98,12 +98,19 @@ By default, the mode is buffer-local. :init-value VAL Same as the INIT-VALUE argument. :lighter SPEC Same as the LIGHTER argument. +:keymap MAP Same as the KEYMAP argument. :require SYM Same as in `defcustom'. For example, you could write (define-minor-mode foo-mode \"If enabled, foo on you!\" :lighter \" Foo\" :require 'foo :global t :group 'hassle :version \"27.5\" ...BODY CODE...)" + (declare (debug (&define name stringp + [&optional [¬ keywordp] sexp + &optional [¬ keywordp] sexp + &optional [¬ keywordp] sexp] + [&rest [keywordp sexp]] + def-body))) ;; Allow skipping the first three args. (cond @@ -121,12 +128,10 @@ (extra-args nil) (extra-keywords nil) (require t) - (keymap-sym (if (and keymap (symbolp keymap)) keymap - (intern (concat mode-name "-map")))) (hook (intern (concat mode-name "-hook"))) (hook-on (intern (concat mode-name "-on-hook"))) (hook-off (intern (concat mode-name "-off-hook"))) - keyw) + keyw keymap-sym) ;; Check keys. (while (keywordp (setq keyw (car body))) @@ -138,8 +143,12 @@ (:extra-args (setq extra-args (pop body))) (:group (setq group (nconc group (list :group (pop body))))) (:require (setq require (pop body))) + (:keymap (setq keymap (pop body))) (t (push keyw extra-keywords) (push (pop body) extra-keywords)))) + (setq keymap-sym (if (and keymap (symbolp keymap)) keymap + (intern (concat mode-name "-map")))) + (unless group ;; We might as well provide a best-guess default group. (setq group @@ -204,11 +213,12 @@ (progn ,(if globalp `(customize-mark-as-set ',mode)) (unless (current-message) - (message ,(format "%s %%sabled" pretty-name) + (message ,(format "%s %%sabled" pretty-name) (if ,mode "en" "dis"))))) (force-mode-line-update) ;; Return the new setting. ,mode) + ;; Autoloading an easy-mmode-define-minor-mode autoloads ;; everything up-to-here. :autoload-end