From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Chong Yidong Newsgroups: gmane.emacs.devel Subject: Re: How global is a define-global-minor-mode mode? Date: Sat, 20 Jan 2007 14:34:58 -0500 Message-ID: <87y7nxmqzh.fsf@stupidchicken.com> References: <4581996F.3050700@student.lu.se> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1169321745 5488 80.91.229.12 (20 Jan 2007 19:35:45 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sat, 20 Jan 2007 19:35:45 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Jan 20 20:35:42 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1H8Lzx-0002bN-Ms for ged-emacs-devel@m.gmane.org; Sat, 20 Jan 2007 20:35:34 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H8Lzy-0006UR-96 for ged-emacs-devel@m.gmane.org; Sat, 20 Jan 2007 14:35:34 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1H8Lzn-0006SL-DP for emacs-devel@gnu.org; Sat, 20 Jan 2007 14:35:23 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1H8Lzl-0006P3-Um for emacs-devel@gnu.org; Sat, 20 Jan 2007 14:35:23 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1H8Lzl-0006Oy-QR for emacs-devel@gnu.org; Sat, 20 Jan 2007 14:35:21 -0500 Original-Received: from [80.91.229.2] (helo=ciao.gmane.org) by monty-python.gnu.org with esmtps (TLS-1.0:RSA_AES_256_CBC_SHA:32) (Exim 4.52) id 1H8Lzl-0005ga-8s for emacs-devel@gnu.org; Sat, 20 Jan 2007 14:35:21 -0500 Original-Received: from list by ciao.gmane.org with local (Exim 4.43) id 1H8LzV-0006tK-2v for emacs-devel@gnu.org; Sat, 20 Jan 2007 20:35:05 +0100 Original-Received: from cyd.mit.edu ([18.19.1.138]) by main.gmane.org with esmtp (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 20 Jan 2007 20:35:05 +0100 Original-Received: from cyd by cyd.mit.edu with local (Gmexim 0.1 (Debian)) id 1AlnuQ-0007hv-00 for ; Sat, 20 Jan 2007 20:35:05 +0100 X-Injected-Via-Gmane: http://gmane.org/ Original-To: emacs-devel@gnu.org Original-Lines: 35 Original-X-Complaints-To: usenet@sea.gmane.org X-Gmane-NNTP-Posting-Host: cyd.mit.edu User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.92 (gnu/linux) Cancel-Lock: sha1:RhOtBsYc5lTTEHljazLILJA3S4o= X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:65325 Archived-At: Lennart Borgman 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.