From 39df0ecb52644ce40fcb3e9fc3f32d5e5110d12c Mon Sep 17 00:00:00 2001 From: ueno Date: Sat, 27 Aug 2005 00:30:21 +0000 Subject: [PATCH] * riece-toolbar.el (riece-toolbar-original-toolbar) [XEmacs]: New variable. (riece-unset-toolbar): New function. (riece-toolbar-uninstall): Call riece-unset-toolbar. (riece-toolbar-command-mode-hook): Renamed from riece-toolbar-insinuate-in-command-buffer. * riece-icon.el (riece-icon-enable): Update mode-line-buffer-identification here. (riece-icon-disable): Ditto. --- lisp/ChangeLog | 15 +++++++++++++++ lisp/riece-icon.el | 48 ++++++++++++++++++++++++------------------------ lisp/riece-toolbar.el | 27 +++++++++++++++++++-------- 3 files changed, 58 insertions(+), 32 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c954052..5abeab8 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,18 @@ +2005-08-27 Daiki Ueno + + * riece-menu.el (riece-menu-uninstall): Call easy-menu-remove. + + * riece-toolbar.el (riece-toolbar-original-toolbar) [XEmacs]: New + variable. + (riece-unset-toolbar): New function. + (riece-toolbar-uninstall): Call riece-unset-toolbar. + (riece-toolbar-command-mode-hook): Renamed from + riece-toolbar-insinuate-in-command-buffer. + + * riece-icon.el (riece-icon-enable): Update + mode-line-buffer-identification here. + (riece-icon-disable): Ditto. + 2005-08-26 Daiki Ueno * riece-addon.el (riece-uninstall-addon): Update diff --git a/lisp/riece-icon.el b/lisp/riece-icon.el index a417f91..e3232bd 100644 --- a/lisp/riece-icon.el +++ b/lisp/riece-icon.el @@ -318,6 +318,25 @@ Modify whole identification by side effect." (add-hook 'riece-update-buffer-functions 'riece-icon-update-channel-list-buffer t t))) +(defun riece-icon-insinuate () + (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 () + (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))) + (defvar riece-icon-original-mode-line-buffer-identification nil) (defun riece-icon-update-mode-line-buffer-identification () @@ -332,40 +351,21 @@ Modify whole identification by side effect." riece-mode-line-buffer-identification))) (setq buffers (cdr buffers)))))) -(defun riece-icon-insinuate () +(defun riece-icon-enable () (setq riece-icon-original-mode-line-buffer-identification (symbol-function 'riece-mode-line-buffer-identification)) (defalias 'riece-mode-line-buffer-identification - #'riece-icon-modeline-buffer-identification) - (riece-icon-update-mode-line-buffer-identification) - (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 () - (fset 'riece-mode-line-buffer-identification - riece-icon-original-mode-line-buffer-identification) + 'riece-icon-modeline-buffer-identification) (riece-icon-update-mode-line-buffer-identification) - (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)) - (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)) - -(defun riece-icon-enable () (setq riece-icon-enabled t) (if riece-current-channel (riece-emit-signal 'user-list-changed riece-current-channel)) (riece-emit-signal 'channel-list-changed)) (defun riece-icon-disable () + (fset 'riece-mode-line-buffer-identification + riece-icon-original-mode-line-buffer-identification) + (riece-icon-update-mode-line-buffer-identification) (setq riece-icon-enabled nil) (if riece-current-channel (riece-emit-signal 'user-list-changed riece-current-channel)) diff --git a/lisp/riece-toolbar.el b/lisp/riece-toolbar.el index dcc104d..1335eca 100644 --- a/lisp/riece-toolbar.el +++ b/lisp/riece-toolbar.el @@ -79,10 +79,19 @@ (symbol-name (car pointer))))))) (setq pointer (cdr pointer))) toolbar)) + (defvar riece-toolbar-original-toolbar nil) (defun riece-set-toolbar (toolbar) - (set-specifier default-toolbar toolbar (current-buffer)))) + (make-local-variable 'riece-toolbar-original-toolbar) + (setq riece-toolbar-original-toolbar + (specifier-specs default-toolbar (current-buffer))) + (set-specifier default-toolbar toolbar (current-buffer))) + (defun riece-unset-toolbar () + (set-specifier default-toolbar riece-toolbar-original-toolbar + (current-buffer)) + (kill-local-variable 'riece-toolbar-original-toolbar))) (defalias 'riece-make-toolbar-from-menu 'ignore) - (defalias 'riece-set-toolbar 'ignore)) + (defalias 'riece-set-toolbar 'ignore) + (defalias 'riece-unset-toolbar 'ignore)) (defun riece-make-toolbar-from-menu (items menu-items map) (let ((pointer items) (tool-bar-map (make-sparse-keymap))) @@ -94,10 +103,12 @@ tool-bar-map)) (defun riece-set-toolbar (toolbar) (make-local-variable 'tool-bar-map) - (setq tool-bar-map toolbar))) + (setq tool-bar-map toolbar)) + (defun riece-unset-toolbar () + (kill-local-variable 'tool-bar-map))) (defvar riece-command-mode-map) -(defun riece-toolbar-insinuate-in-command-buffer () +(defun riece-toolbar-command-mode-hook () (riece-set-toolbar (riece-make-toolbar-from-menu riece-toolbar-items @@ -109,14 +120,14 @@ (defun riece-toolbar-insinuate () (add-hook 'riece-command-mode-hook - 'riece-toolbar-insinuate-in-command-buffer + 'riece-toolbar-command-mode-hook t)) (defun riece-toolbar-uninstall () (remove-hook 'riece-command-mode-hook - 'riece-toolbar-insinuate-in-command-buffer) - ;;FIXME: couldn't uninstall completely. - ) + 'riece-toolbar-command-mode-hook) + (with-current-buffer riece-command-buffer + (riece-unset-toolbar))) (provide 'riece-toolbar) -- 1.7.10.4