[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Erc-commit] [commit][master] erc-track: Activate erc-track-minor-mode a
From: |
mwolson |
Subject: |
[Erc-commit] [commit][master] erc-track: Activate erc-track-minor-mode as soon as connection is attempted. |
Date: |
Sat, 19 Jan 2008 03:40:12 -0500 |
commit e01bea08551eb7f856933fb7db02f4972fbf4844
Author: Michael W. Olson <address@hidden>
Date: Sat Jan 19 03:22:01 2008 -0500
erc-track: Activate erc-track-minor-mode as soon as connection is attempted.
diff --git a/ChangeLog b/ChangeLog
index cdb10b9..882c945 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -19,6 +19,13 @@
* erc-page.el, erc-replace.el: Fix header and footer.
+ * erc-track.el (erc-track-minor-mode-maybe): Take an optional
+ buffer arg so that we can put this in erc-connect-pre-hook. If
+ given this argument, include it in the check to determine whether
+ to activate erc-track-minor-mode.
+ (track): Add erc-track-minor-mode-maybe to erc-connect-pre-hook,
+ so that we can use it as soon as a connection is attempted.
+
* erc.el (erc-format-network, erc-format-target-and/or-network):
Use erc-network-name function instead, and check to see whether
that function is bound. This fixes an error in process filter for
diff --git a/erc-track.el b/erc-track.el
index 4512be2..267da1c 100644
--- a/erc-track.el
+++ b/erc-track.el
@@ -560,13 +560,15 @@ module, otherwise the keybindings will not do anything
useful."
:global t
:group 'erc-track)
-(defun erc-track-minor-mode-maybe ()
+(defun erc-track-minor-mode-maybe (&optional buffer)
"Enable `erc-track-minor-mode', depending on `erc-track-enable-keybindings'."
- (unless (or erc-track-minor-mode
- ;; don't start the minor mode until we have an ERC
- ;; process running, because we don't want to prompt the
- ;; user while starting Emacs
- (null (erc-buffer-list)))
+ (when (and (not erc-track-minor-mode)
+ ;; don't start the minor mode until we have an ERC
+ ;; process running, because we don't want to prompt the
+ ;; user while starting Emacs
+ (or (and (buffer-live-p buffer)
+ (with-current-buffer buffer (eq major-mode 'erc-mode)))
+ (erc-buffer-list)))
(cond ((eq erc-track-enable-keybindings 'ask)
(let ((key (or (and (key-binding (kbd "C-c C-SPC")) "C-SPC")
(and (key-binding (kbd "C-c C-@")) "C-@"))))
@@ -616,6 +618,7 @@ module, otherwise the keybindings will not do anything
useful."
(add-hook 'erc-insert-post-hook 'erc-track-modified-channels)
(add-hook 'erc-disconnected-hook 'erc-modified-channels-update))
;; enable the tracking keybindings
+ (add-hook 'erc-connect-pre-hook 'erc-track-minor-mode-maybe)
(erc-track-minor-mode-maybe)))
;; Disable:
((when (boundp 'erc-track-when-inactive)
@@ -637,6 +640,7 @@ module, otherwise the keybindings will not do anything
useful."
(remove-hook 'erc-disconnected-hook 'erc-modified-channels-update)
(remove-hook 'erc-insert-post-hook 'erc-track-modified-channels))
;; disable the tracking keybindings
+ (remove-hook 'erc-connect-pre-hook 'erc-track-minor-mode-maybe)
(when erc-track-minor-mode
(erc-track-minor-mode -1)))))
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Erc-commit] [commit][master] erc-track: Activate erc-track-minor-mode as soon as connection is attempted.,
mwolson <=