[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: |
Tue, 11 Jan 2011 16:42:58 -0500 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.0.50 (gnu/linux) |
> i've tried tracking down the failed key substitutions, by
> wrapping define-key with some advice that noted when the key defines
> happened, and they do every time the mode is activated, whether or not it's
> via the byte-compiled version of the mode function (when defined
> by define-minor-mode). my function which does the key
> substitutions (allout-setup-mode-map) uses fset to ensure that the mode map
> is properly globally established, so it's already kind of complicated. i'm
> also wondering whether i'm just misunderstanding something about the way
> define-minor-mode is supposed to work.
I think the code is too complex for its own good, so I can't really
track down the problem. But AFAICT, the `allout-mode-map' symbol is
never used as a keymap, so the (fset 'allout-mode-map allout-mode-map)
has no effect: all the rest of the code uses the allout-mode-map
*variable* (i.e. the value stored in the `symbol-value' part of the
allout-mode-map symbol).
Stefan
PS: While I'm here, don't use `setq' at top-level. Either put the right
initial value into `defvar', or if you want that value to be re-set when
rereading the file, use `defconst' instead of defvar, but don't use
`setq' at top-level.
- Re: bizarre problem with minor mode defined using define-minor-mode,
Stefan Monnier <=