From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Ryan Yeske Newsgroups: gmane.emacs.devel Subject: rcirc problem with customize and define-minor-mode Date: Wed, 15 Feb 2006 20:48:58 -0800 Message-ID: <87lkwb3o3p.fsf@cut.bc.hsia.telus.net> NNTP-Posting-Host: main.gmane.org X-Trace: sea.gmane.org 1140065702 31139 80.91.229.2 (16 Feb 2006 04:55:02 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Thu, 16 Feb 2006 04:55:02 +0000 (UTC) Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Feb 16 05:55:00 2006 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1F9bAH-0001IA-UB for ged-emacs-devel@m.gmane.org; Thu, 16 Feb 2006 05:54:51 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1F9bAH-00016A-0W for ged-emacs-devel@m.gmane.org; Wed, 15 Feb 2006 23:54:49 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1F9b53-00038G-6H for emacs-devel@gnu.org; Wed, 15 Feb 2006 23:49:25 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1F9b4w-00034C-Vu for emacs-devel@gnu.org; Wed, 15 Feb 2006 23:49:24 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1F9b4w-00033D-2k for emacs-devel@gnu.org; Wed, 15 Feb 2006 23:49:18 -0500 Original-Received: from [199.185.220.240] (helo=priv-edtnes46.telusplanet.net) by monty-python.gnu.org with esmtp (Exim 4.52) id 1F9b9y-0007Tw-OD for emacs-devel@gnu.org; Wed, 15 Feb 2006 23:54:31 -0500 Original-Received: from cut.bc.hsia.telus.net ([207.6.239.189]) by priv-edtnes46.telusplanet.net (InterMail vM.6.01.05.04 201-2131-123-105-20051025) with ESMTP id <20060216044915.WRXD3294.priv-edtnes46.telusplanet.net@cut.bc.hsia.telus.net> for ; Wed, 15 Feb 2006 21:49:15 -0700 Original-To: emacs-devel@gnu.org 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:50601 Archived-At: To eliminate the C-c C-SPC global binding in rcirc, I created a global minor mode, rcirc-track-minor-mode. Along with the keymap that includes this binding there is the code to insert `rcirc-activity-string' into `global-mode-string'. Everything works beautifully, except if you M-x customize rcirc-track-minor-mode, set it to `t', and restart emacs and rcirc. In that case, the rcirc-track-minor-mode variable is `t', but the modeline code isnt properly initialized; you need to toggle the minor mode twice to get it to work. I can't figure out how to set this up properly. Do I need an explicit defcustom for rcirc-track-minor-mode that includes some sort of :initialization key? Any help would be appreciated. Here is the current minor mode definition: ;;; FIXME: the code to insert `rcirc-activity-string' into ;;; `global-mode-string' isn't called when the mode is activated by ;;; customize. I don't know how to set that up. (define-minor-mode rcirc-track-minor-mode "Global minor mode for tracking activity in rcirc buffers." :init-value nil :lighter "" :keymap rcirc-track-minor-mode-map :global t :group 'rcirc (or global-mode-string (setq global-mode-string '(""))) ;; toggle the mode-line channel indicator (if rcirc-track-minor-mode (and (not (memq 'rcirc-activity-string global-mode-string)) (setq global-mode-string (append global-mode-string '(rcirc-activity-string)))) (setq global-mode-string (delete 'rcirc-activity-string global-mode-string))))