[Top][All Lists]

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

Re: bizarre problem with minor mode defined using define-minor-mode

From: Stefan Monnier
Subject: Re: bizarre problem with minor mode defined using define-minor-mode
Date: Sat, 15 Jan 2011 23:48:40 -0500
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux)

> i agree that the code is painfully complicated.  however, the fset
> actually is effective and necessary to impose the minor-mode keymap
> adjustments allout does.

I really can't understand who it could be effective.  My reading of the
code tells me that function binding is never used.

> in fact, removing the fset leads to the same problems with the
> regular, defun'ed allout-mode that i have been seeing with the
> byte-compiled define-minor-mode defined allout mode.

That's what I would expect, since I think this fset is a no-op.

> the problem with switching to define-minor-mode is that
> define-minor-mode apparently associates the mode name with the keymap
> value, itself, on minor-mode-map-alist.

That's because that's what you told it:

  :keymap <exp>

says to use the value of <exp> as the keymap, so ":keymap
allout-mode-map" says to use the value of the variable as the keymap.
If you want to use a symbol, then you need to quote it.

This said, you can modify a keymap after the fact: as long as you don't
do a (setq allout-mode-map <newmap>), you can modify allout-mode-map on
the fly and those changes will take effect immediately without having to
use an indirection through the allout-mode-map symbol.


reply via email to

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