From 50f4b03342670a917dc7b60fa72285ab5881427f Mon Sep 17 00:00:00 2001 From: ueno Date: Sat, 27 Aug 2005 01:25:24 +0000 Subject: [PATCH] Support re-insinuate. --- lisp/riece-button.el | 18 +++++++++--------- lisp/riece-icon.el | 25 +++++++++++++++++-------- lisp/riece-menu.el | 10 +++++++--- lisp/riece-toolbar.el | 13 ++++++++----- 4 files changed, 41 insertions(+), 25 deletions(-) diff --git a/lisp/riece-button.el b/lisp/riece-button.el index 9d85a14..f53fb09 100644 --- a/lisp/riece-button.el +++ b/lisp/riece-button.el @@ -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 () diff --git a/lisp/riece-icon.el b/lisp/riece-icon.el index e3232bd..ab1a07f 100644 --- a/lisp/riece-icon.el +++ b/lisp/riece-icon.el @@ -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) diff --git a/lisp/riece-menu.el b/lisp/riece-menu.el index 180792d..4023b7d 100644 --- a/lisp/riece-menu.el +++ b/lisp/riece-menu.el @@ -111,14 +111,18 @@ (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) diff --git a/lisp/riece-toolbar.el b/lisp/riece-toolbar.el index fdad370..21f722d 100644 --- a/lisp/riece-toolbar.el +++ b/lisp/riece-toolbar.el @@ -121,15 +121,18 @@ '(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) -- 1.7.10.4