emacs-devel
[Top][All Lists]
Advanced

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

Re: How global is a define-global-minor-mode mode?


From: Chong Yidong
Subject: Re: How global is a define-global-minor-mode mode?
Date: Sat, 20 Jan 2007 14:34:58 -0500
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.92 (gnu/linux)

Lennart Borgman <address@hidden> writes:

> I am trying to use define-global-minor-mode, see below. I have
> customized the global mode to be t, but when I open new buffers the
> minor mode is not set in them. Is this a bug in
> define-global-minor-mode?

Seems to be working fine.  Your recipe is a little vague, but here is
a simple example:

1.  Evaluate the following in *scratch* buffer:

  (define-minor-mode foo-mode
   "Foo."
   nil
   " foo"
   :group 'foo)

  (define-global-minor-mode html-site-global-mode foo-mode
    (lambda () (foo-mode 1))
    :group 'foo)

2. M-x customize-option RET foo RET
3. Click on "Toggle" (global-foo-mode is turned on)
4. Click on "Set for Current Session"
5. C-x C-f asdf RET (open a new file)
6. Observe the presence of the " foo" lighter in the modeline.

There is one subtlety, which is that if you save the custom option for
future sessions, it won't activate foo-mode in future sessions unless
the above code defining foo-mode and global-foo-mode is already
loaded.  But I don't think that's necessary a bug; it's a flaw but not
one that's easily avoidable.

In short, I don't think there's anything that needs to be done here.





reply via email to

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