Support re-insinuate.
authorueno <ueno>
Sat, 27 Aug 2005 01:25:24 +0000 (01:25 +0000)
committerueno <ueno>
Sat, 27 Aug 2005 01:25:24 +0000 (01:25 +0000)
lisp/riece-button.el
lisp/riece-icon.el
lisp/riece-menu.el
lisp/riece-toolbar.el

index 9d85a14..f53fb09 100644 (file)
@@ -247,26 +247,26 @@ This function is used as a callback for a channel button."
        (riece-make-identity-button-map)))
 
 (defun riece-button-insinuate ()
-  (add-hook 'riece-channel-list-mode-hook
-           'riece-button-channel-list-mode-hook)
-  (add-hook 'riece-user-list-mode-hook
-           'riece-button-user-list-mode-hook)
-  (add-hook 'riece-dialogue-mode-hook
-           'riece-button-dialogue-mode-hook)
   (save-excursion
     (when riece-channel-list-buffer
       (set-buffer riece-channel-list-buffer)
-      (riece-button-channel-list-mode-hook))
+      (riece-channel-list-mode-hook)
     (when riece-user-list-buffer
       (set-buffer riece-user-list-buffer)
-      (riece-button-user-list-mode-hook))
+      (riece-user-list-mode-hook)
     (let ((buffers riece-buffer-list))
       (while buffers
        (set-buffer (car buffers))
        (if (eq (derived-mode-class major-mode)
                'riece-dialogue-mode)
-           (riece-button-dialogue-mode-hook))
+           (riece-dialogue-mode-hook))
        (setq buffers (cdr buffers)))))
+  (add-hook 'riece-channel-list-mode-hook
+           'riece-button-channel-list-mode-hook)
+  (add-hook 'riece-user-list-mode-hook
+           'riece-button-user-list-mode-hook)
+  (add-hook 'riece-dialogue-mode-hook
+           'riece-button-dialogue-mode-hook)
   (add-hook 'riece-after-insert-functions 'riece-button-add-identity-button))
 
 (defun riece-button-uninstall ()
index e3232bd..ab1a07f 100644 (file)
@@ -319,23 +319,32 @@ Modify whole identification by side effect."
                'riece-icon-update-channel-list-buffer t t)))
 
 (defun riece-icon-insinuate ()
+  (save-excursion
+    (when riece-user-list-buffer
+      (set-buffer riece-user-list-buffer)
+      (riece-icon-user-list-mode-hook))
+    (when riece-channel-list-buffer
+      (set-buffer riece-channel-list-buffer)
+      (riece-icon-channel-list-mode-hook)))
   (add-hook 'riece-user-list-mode-hook
            'riece-icon-user-list-mode-hook)
   (add-hook 'riece-channel-list-mode-hook
            'riece-icon-channel-list-mode-hook))
 
 (defun riece-icon-uninstall ()
+  (save-excursion
+    (when riece-user-list-buffer
+      (set-buffer riece-user-list-buffer)
+      (remove-hook 'riece-update-buffer-functions
+                  'riece-icon-update-user-list-buffer))
+    (when riece-channel-list-buffer
+      (set-buffer riece-channel-list-buffer)
+      (remove-hook 'riece-update-buffer-functions
+                  'riece-icon-update-user-list-buffer)))
   (remove-hook 'riece-user-list-mode-hook
               'riece-icon-user-list-mode-hook)
   (remove-hook 'riece-channel-list-mode-hook
-              'riece-icon-channel-list-mode-hook)
-  (save-excursion
-    (set-buffer riece-user-list-buffer)
-    (remove-hook 'riece-update-buffer-functions
-                'riece-icon-update-user-list-buffer)
-    (set-buffer riece-channel-list-buffer)
-    (remove-hook 'riece-update-buffer-functions
-                'riece-icon-update-user-list-buffer)))
+              'riece-icon-channel-list-mode-hook))
 
 (defvar riece-icon-original-mode-line-buffer-identification nil)
 
index 180792d..4023b7d 100644 (file)
   (easy-menu-add riece-menu))
 
 (defun riece-menu-insinuate ()
+  (if riece-command-buffer
+      (with-current-buffer riece-command-buffer
+       (riece-menu-command-mode-hook)))
   (add-hook 'riece-command-mode-hook
            'riece-menu-command-mode-hook))
 
 (defun riece-menu-uninstall ()
+  (if riece-command-buffer
+      (with-current-buffer riece-command-buffer
+       (easy-menu-remove riece-menu)))
   (remove-hook 'riece-command-mode-hook
-              'riece-menu-command-mode-hook)
-  (with-current-buffer riece-command-buffer
-    (easy-menu-remove riece-menu)))
+              'riece-menu-command-mode-hook))
 
 (provide 'riece-menu)
 
index fdad370..21f722d 100644 (file)
   '(riece-menu))
 
 (defun riece-toolbar-insinuate ()
+  (if riece-command-buffer
+      (with-current-buffer riece-command-buffer
+       (riece-toolbar-command-mode-hook)))
   (add-hook 'riece-command-mode-hook
-           'riece-toolbar-command-mode-hook
-           t))
+           'riece-toolbar-command-mode-hook))
 
 (defun riece-toolbar-uninstall ()
+  (if riece-command-buffer
+      (with-current-buffer riece-command-buffer
+       (riece-unset-toolbar))
   (remove-hook 'riece-command-mode-hook
-              'riece-toolbar-command-mode-hook)
-  (with-current-buffer riece-command-buffer
-    (riece-unset-toolbar)))
+              'riece-toolbar-command-mode-hook))
 
 (provide 'riece-toolbar)