all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Ryan Yeske <rcyeske@gmail.com>
Subject: rcirc problem with customize and define-minor-mode
Date: Wed, 15 Feb 2006 20:48:58 -0800	[thread overview]
Message-ID: <87lkwb3o3p.fsf@cut.bc.hsia.telus.net> (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))))

                 reply	other threads:[~2006-02-16  4:48 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87lkwb3o3p.fsf@cut.bc.hsia.telus.net \
    --to=rcyeske@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.