emacs-devel
[Top][All Lists]
Advanced

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

rcirc problem with customize and define-minor-mode


From: Ryan Yeske
Subject: rcirc problem with customize and define-minor-mode
Date: Wed, 15 Feb 2006 20:48:58 -0800

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))))




reply via email to

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