[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

define-minor-mode doesn't use LIGHTER argument as documented

From: Kevin Rodgers
Subject: define-minor-mode doesn't use LIGHTER argument as documented
Date: Mon, 01 Nov 2004 13:08:53 -0700
User-agent: Mozilla Thunderbird 0.8 (X11/20040916)

GNU Emacs 21.3.2 (i386-pc-solaris2.8, X toolkit) of 2003-05-22 on zeus

,----[ C-h f define-minor-mode RET ]
| define-minor-mode is a Lisp macro in `easy-mmode'.
| (define-minor-mode MODE DOC &optional INIT-VALUE LIGHTER KEYMAP &rest BODY)
| Define a new minor mode MODE.
| This function defines the associated control variable MODE, keymap MODE-map,
| toggle command MODE, and hook MODE-hook.
| DOC is the documentation for the mode toggle command.
| Optional INIT-VALUE is the initial value of the mode's variable.
| Optional LIGHTER is displayed in the modeline when the mode is on.

But easy-mmode.el doesn't update minor-mode-alist, so LIGHTER is not
displayed in the mode line when MODE is on.  Wouldn't it make sense for
define-minor-mode to do something like this (so the user doesn't have

(or (assq MODE minor-mode-alist)
    (setq minor-mode-alist
          (cons (list MODE (concat " " LIGHTER)) minor-mode-alist)))

And why is the argument called LIGHTER anyway?

| Optional KEYMAP is the default (defvar) keymap bound to the mode keymap.
|   If it is a list, it is passed to `easy-mmode-define-keymap'
|   in order to build a valid keymap.  It's generally better to use
|   a separate MODE-map variable than to use this argument.
| The above three arguments can be skipped if keyword arguments are
| used (see below).
| BODY contains code that will be executed each time the mode is (dis)activated.
|   It will be executed after any toggling but before running the hooks.
| BODY can start with a list of CL-style keys specifying additional arguments.
|   The following keyword arguments are supported:
| :group   Followed by the group name to use for any generated `defcustom'.
| :global  If non-nil specifies that the minor mode is not meant to be
|          buffer-local.  By default, the variable is made buffer-local.
| :init-value  Same as the INIT-VALUE argument.
| :lighter  Same as the LIGHTER argument.

Kevin Rodgers

reply via email to

[Prev in Thread] Current Thread [Next in Thread]