erc-commit
[Top][All Lists]
Advanced

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

[Erc-commit] [commit][master] erc-goodies: Tweak Imenu setup and scrollt


From: mwolson
Subject: [Erc-commit] [commit][master] erc-goodies: Tweak Imenu setup and scrolltobottom removal.
Date: Sat, 19 Jan 2008 00:40:10 -0500

commit 1ace236c79d1219c57f5181719e80e7d5f302040
Author: Michael W. Olson <address@hidden>
Date:   Sat Jan 19 00:35:22 2008 -0500

    erc-goodies: Tweak Imenu setup and scrolltobottom removal.

diff --git a/ChangeLog b/ChangeLog
index 5340312..3576e88 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -8,6 +8,10 @@
        * erc-goodies.el (erc-unmorse): Improve regexp for detecting
        morse.  Deal with the morse style that has "/ " at the end of
        every letter.
+       (erc-imenu-setup): New function that sets up Imenu support.  Add
+       it instead of a lambda form to erc-mode-hook.
+       (scrolltobottom): Remove erc-scroll-to-bottom from all ERC buffers
+       when module is removed.
 
        * erc-page.el, erc-replace.el: Fix header and footer.
 
diff --git a/erc-goodies.el b/erc-goodies.el
index 4beedc4..30ee5ec 100644
--- a/erc-goodies.el
+++ b/erc-goodies.el
@@ -33,10 +33,14 @@
 
 (require 'erc)
 
-;; Imenu Autoload
-(add-hook 'erc-mode-hook
-          (lambda ()
-            (setq imenu-create-index-function 'erc-create-imenu-index)))
+;;; Imenu support
+
+(defun erc-imenu-setup ()
+  "Setup Imenu support in an ERC buffer."
+  (set (make-local-variable 'imenu-create-index-function)
+       'erc-create-imenu-index))
+
+(add-hook 'erc-mode-hook 'erc-imenu-setup)
 (autoload 'erc-create-imenu-index "erc-imenu" "Imenu index creation function")
 
 ;;; Automatically scroll to bottom
@@ -55,7 +59,10 @@ argument to `recenter'."
 You have to activate or deactivate it in already created windows
 separately."
   ((add-hook 'erc-mode-hook 'erc-add-scroll-to-bottom))
-  ((remove-hook 'erc-mode-hook 'erc-add-scroll-to-bottom)))
+  ((remove-hook 'erc-mode-hook 'erc-add-scroll-to-bottom)
+   (dolist (buffer (erc-buffer-list))
+     (with-current-buffer buffer
+       (remove-hook 'window-scroll-functions 'erc-scroll-to-bottom t)))))
 
 (defun erc-add-scroll-to-bottom ()
   "A hook function for `erc-mode-hook' to recenter output at bottom of window.




reply via email to

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