all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
* rcirc problem with customize and define-minor-mode
@ 2006-02-16  4:48 Ryan Yeske
  0 siblings, 0 replies; only message in thread
From: Ryan Yeske @ 2006-02-16  4:48 UTC (permalink / raw)



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

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2006-02-16  4:48 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-02-16  4:48 rcirc problem with customize and define-minor-mode Ryan Yeske

Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.