From 312bb821869adf84c0e0cc3fdfc879dc5b46f0c3 Mon Sep 17 00:00:00 2001 From: ueno Date: Fri, 26 Aug 2005 07:44:15 +0000 Subject: [PATCH] * riece-xface.el (riece-xface-user-list-mode-hook): New function. (riece-xface-insinuate): Use it. (riece-xface-uninstall): New function. * riece-url.el (riece-url-command-mode-hook): New function. (riece-url-insinuate): Use it. (riece-url-uninstall): New function. * riece-unread.el (riece-unread-uninstall): New function. * riece-toolbar.el (riece-toolbar-uninstall): New function. * riece-rdcc.el (riece-rdcc-uninstall): New function. * riece-ndcc.el (riece-ndcc-uninstall): New function. * riece-mini.el (riece-mini-uninstall): New function. * riece-menu.el (riece-menu-uninstall): New function. * riece-lsdb.el: New function. * riece-log.el (riece-log-uninstall): New function. * riece-keyword.el (riece-keyword-uninstall): New function. * riece-keepalive.el (riece-keepalive-uninstall): New function. * riece-kakasi.el (riece-kakasi-uninstall): New function. * riece-ignore.el (riece-ignore-uninstall): New function. * riece-icon.el (riece-icon-user-list-mode-hook): New function. (riece-icon-channel-list-mode-hook): New function. (riece-icon-original-mode-line-buffer-identification): New variable. (riece-icon-insinuate): Use them. (riece-icon-uninstall): New function. * riece-history.el (riece-history-after-switch-to-channel-functions): New function. (riece-history-insinuate): Use it. (riece-history-uninstall): New function. * riece-highlight.el (riece-highlight-uninstall): New function. * riece-hangman.el (riece-hangman-uninstall): New function. * riece-google.el (riece-google-uninstall): New function. * riece-foolproof.el (riece-foolproof-uninstall): New function. * riece-eval.el (riece-eval-uninstall): New function. * riece-eval-ruby.el (riece-eval-ruby-uninstall): New function. * riece-doctor.el (riece-doctor-uninstall): New function. * riece-ctlseq.el (riece-ctlseq-uninstall): New function. * riece-ctcp.el (riece-ctcp-dialogue-font-lock-keywords): New variable. (riece-ctcp-uninstall): New function. * riece-button.el (riece-button-channel-list-mode-hook): New function. * riece-biff.el (riece-biff-uninstall): New function. --- lisp/ChangeLog | 44 +++++++++++++++++++++++++++++++++++++ lisp/riece-biff.el | 7 ++++++ lisp/riece-button.el | 56 +++++++++++++++++++++++++++++++++-------------- lisp/riece-ctcp.el | 18 +++++++++++---- lisp/riece-ctlseq.el | 3 +++ lisp/riece-doctor.el | 3 +++ lisp/riece-eval-ruby.el | 4 ++++ lisp/riece-eval.el | 4 ++++ lisp/riece-foolproof.el | 4 ++++ lisp/riece-google.el | 4 ++++ lisp/riece-hangman.el | 3 +++ lisp/riece-highlight.el | 18 +++++++++++++++ lisp/riece-history.el | 21 ++++++++++++++---- lisp/riece-icon.el | 39 ++++++++++++++++++++++++++------- lisp/riece-ignore.el | 4 ++++ lisp/riece-kakasi.el | 3 +++ lisp/riece-keepalive.el | 8 +++++-- lisp/riece-keyword.el | 3 +++ lisp/riece-log.el | 7 ++++++ lisp/riece-lsdb.el | 8 +++++++ lisp/riece-menu.el | 21 +++++++++++++----- lisp/riece-mini.el | 5 +++++ lisp/riece-ndcc.el | 3 +++ lisp/riece-rdcc.el | 5 +++++ lisp/riece-toolbar.el | 6 +++++ lisp/riece-unread.el | 17 ++++++++++++++ lisp/riece-url.el | 15 +++++++++---- lisp/riece-xface.el | 15 ++++++++++--- 28 files changed, 301 insertions(+), 47 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index ac184ca..800896a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,49 @@ 2005-08-26 Daiki Ueno + * Make add-ons uninstallable. + + * riece-xface.el (riece-xface-user-list-mode-hook): New function. + (riece-xface-insinuate): Use it. + (riece-xface-uninstall): New function. + * riece-url.el (riece-url-command-mode-hook): New function. + (riece-url-insinuate): Use it. + (riece-url-uninstall): New function. + * riece-unread.el (riece-unread-uninstall): New function. + * riece-toolbar.el (riece-toolbar-uninstall): New function. + * riece-rdcc.el (riece-rdcc-uninstall): New function. + * riece-ndcc.el (riece-ndcc-uninstall): New function. + * riece-mini.el (riece-mini-uninstall): New function. + * riece-menu.el (riece-menu-uninstall): New function. + * riece-lsdb.el: New function. + * riece-log.el (riece-log-uninstall): New function. + * riece-keyword.el (riece-keyword-uninstall): New function. + * riece-keepalive.el (riece-keepalive-uninstall): New function. + * riece-kakasi.el (riece-kakasi-uninstall): New function. + * riece-ignore.el (riece-ignore-uninstall): New function. + * riece-icon.el (riece-icon-user-list-mode-hook): New function. + (riece-icon-channel-list-mode-hook): New function. + (riece-icon-original-mode-line-buffer-identification): New variable. + (riece-icon-insinuate): Use them. + (riece-icon-uninstall): New function. + * riece-history.el + (riece-history-after-switch-to-channel-functions): New function. + (riece-history-insinuate): Use it. + (riece-history-uninstall): New function. + * riece-highlight.el (riece-highlight-uninstall): New function. + * riece-hangman.el (riece-hangman-uninstall): New function. + * riece-google.el (riece-google-uninstall): New function. + * riece-foolproof.el (riece-foolproof-uninstall): New function. + * riece-eval.el (riece-eval-uninstall): New function. + * riece-eval-ruby.el (riece-eval-ruby-uninstall): New function. + * riece-doctor.el (riece-doctor-uninstall): New function. + * riece-ctlseq.el (riece-ctlseq-uninstall): New function. + * riece-ctcp.el (riece-ctcp-dialogue-font-lock-keywords): New variable. + (riece-ctcp-uninstall): New function. + * riece-button.el (riece-button-channel-list-mode-hook): New function. + * riece-biff.el (riece-biff-uninstall): New function. + +2005-08-26 Daiki Ueno + * riece-options.el (riece-saved-forms): Added riece-addons. * riece-addon.el: Require 'riece-addon-modules. diff --git a/lisp/riece-biff.el b/lisp/riece-biff.el index 0e26d2f..b05df0e 100644 --- a/lisp/riece-biff.el +++ b/lisp/riece-biff.el @@ -78,6 +78,13 @@ (add-hook 'riece-after-switch-to-channel-functions 'riece-biff-clear) (add-hook 'riece-exit-hook 'riece-biff-disable)) +(defun riece-biff-uninstall () + (remove-hook 'riece-after-display-message-functions + 'riece-biff-after-display-message-function) + (remove-hook 'riece-redisplay-buffers-hook 'riece-biff-clear) + (remove-hook 'riece-after-switch-to-channel-functions 'riece-biff-clear) + (remove-hook 'riece-exit-hook 'riece-biff-disable)) + (defun riece-biff-enable () (setq global-mode-string (cond diff --git a/lisp/riece-button.el b/lisp/riece-button.el index 6cd9dfe..05dff6b 100644 --- a/lisp/riece-button.el +++ b/lisp/riece-button.el @@ -226,28 +226,52 @@ This function is used as a callback for a channel button." (defvar riece-channel-list-mode-map) (defvar riece-user-list-mode-map) (defvar riece-dialogue-mode-map) + +(defun riece-button-channel-list-mode-hook () + (set-keymap-parent riece-channel-list-mode-map widget-keymap) + (set (make-local-variable 'riece-identity-button-map) + (riece-make-identity-button-map)) + (add-hook 'riece-update-buffer-functions + 'riece-button-update-buffer t t)) + +(defun riece-button-user-list-mode-hook () + (set-keymap-parent riece-user-list-mode-map widget-keymap) + (set (make-local-variable 'riece-identity-button-map) + (riece-make-identity-button-map)) + (add-hook 'riece-update-buffer-functions + 'riece-button-update-buffer t t)) + +(defun riece-button-dialogue-mode-hook () + (set-keymap-parent riece-dialogue-mode-map widget-keymap) + (set (make-local-variable 'riece-identity-button-map) + (riece-make-identity-button-map))) + (defun riece-button-insinuate () (add-hook 'riece-channel-list-mode-hook - (lambda () - (set-keymap-parent riece-channel-list-mode-map widget-keymap) - (set (make-local-variable 'riece-identity-button-map) - (riece-make-identity-button-map)) - (add-hook 'riece-update-buffer-functions - 'riece-button-update-buffer t t))) + 'riece-button-channel-list-mode-hook) (add-hook 'riece-user-list-mode-hook - (lambda () - (set-keymap-parent riece-user-list-mode-map widget-keymap) - (set (make-local-variable 'riece-identity-button-map) - (riece-make-identity-button-map)) - (add-hook 'riece-update-buffer-functions - 'riece-button-update-buffer t t))) + 'riece-button-user-list-mode-hook) (add-hook 'riece-dialogue-mode-hook - (lambda () - (set-keymap-parent riece-dialogue-mode-map widget-keymap) - (set (make-local-variable 'riece-identity-button-map) - (riece-make-identity-button-map)))) + 'riece-button-dialogue-mode-hook) (add-hook 'riece-after-insert-functions 'riece-button-add-identity-button)) +(defun riece-button-uninstall () + (let ((buffers riece-buffer-list)) + (save-excursion + (while buffers + (set-buffer (car buffers)) + (remove-hook 'riece-update-buffer-functions + 'riece-button-update-buffer) + (setq buffers (cdr buffers))))) + (remove-hook 'riece-channel-list-mode-hook + 'riece-button-channel-list-mode-hook) + (remove-hook 'riece-user-list-mode-hook + 'riece-button-user-list-mode-hook) + (remove-hook 'riece-dialogue-mode-hook + 'riece-button-dialogue-mode-hook) + (remove-hook 'riece-after-insert-functions + 'riece-button-add-identity-button))) + (defun riece-button-enable () (setq riece-button-enabled t) (let ((pointer riece-buffer-list)) diff --git a/lisp/riece-ctcp.el b/lisp/riece-ctcp.el index 1199dc3..50a4cc4 100644 --- a/lisp/riece-ctcp.el +++ b/lisp/riece-ctcp.el @@ -374,17 +374,27 @@ (if (memq 'riece-highlight riece-addons) '(riece-highlight))) +(defvar riece-ctcp-dialogue-font-lock-keywords + (list (concat "^" riece-time-prefix-regexp "\\(" + (regexp-quote riece-ctcp-action-prefix) + ".*\\)$") + 1 riece-ctcp-action-face t t)) + (defun riece-ctcp-insinuate () (add-hook 'riece-privmsg-hook 'riece-handle-ctcp-request) (add-hook 'riece-notice-hook 'riece-handle-ctcp-response) (if (memq 'riece-highlight riece-addons) (setq riece-dialogue-font-lock-keywords - (cons (list (concat "^" riece-time-prefix-regexp "\\(" - (regexp-quote riece-ctcp-action-prefix) - ".*\\)$") - 1 riece-ctcp-action-face t t) + (cons riece-ctcp-dialogue-font-lock-keywords riece-dialogue-font-lock-keywords)))) +(defun riece-ctcp-uninstall () + (remove-hook 'riece-privmsg-hook 'riece-handle-ctcp-request) + (remove-hook 'riece-notice-hook 'riece-handle-ctcp-response) + (setq riece-dialogue-font-lock-keywords + (delq riece-ctcp-dialogue-font-lock-keywords + riece-dialogue-font-lock-keywords))) + (defun riece-ctcp-enable () (define-key riece-dialogue-mode-map "\C-cv" 'riece-command-ctcp-version) (define-key riece-dialogue-mode-map "\C-cp" 'riece-command-ctcp-ping) diff --git a/lisp/riece-ctlseq.el b/lisp/riece-ctlseq.el index 66492eb..c7a54e0 100644 --- a/lisp/riece-ctlseq.el +++ b/lisp/riece-ctlseq.el @@ -187,6 +187,9 @@ (defun riece-ctlseq-insinuate () (add-hook 'riece-message-filter-functions 'riece-ctlseq-message-filter)) +(defun riece-ctlseq-uninstall () + (remove-hook 'riece-message-filter-functions 'riece-ctlseq-message-filter)) + (defun riece-ctlseq-enable () (setq riece-ctlseq-enabled t)) diff --git a/lisp/riece-doctor.el b/lisp/riece-doctor.el index 3239f0b..1f83c7c 100644 --- a/lisp/riece-doctor.el +++ b/lisp/riece-doctor.el @@ -126,6 +126,9 @@ Please, describe your problems." (defun riece-doctor-insinuate () (add-hook 'riece-after-privmsg-hook 'riece-doctor-after-privmsg-hook)) +(defun riece-doctor-uninstall () + (remove-hook 'riece-after-privmsg-hook 'riece-doctor-after-privmsg-hook)) + (defun riece-doctor-enable () (setq riece-doctor-enabled t)) diff --git a/lisp/riece-eval-ruby.el b/lisp/riece-eval-ruby.el index 7e1cd7f..60d59b1 100644 --- a/lisp/riece-eval-ruby.el +++ b/lisp/riece-eval-ruby.el @@ -84,6 +84,10 @@ (add-hook 'riece-after-display-message-functions 'riece-eval-ruby-display-message-function)) +(defun riece-eval-ruby-uninstall () + (remove-hook 'riece-after-display-message-functions + 'riece-eval-ruby-display-message-function)) + (defun riece-eval-ruby-enable () (setq riece-eval-ruby-enabled t)) diff --git a/lisp/riece-eval.el b/lisp/riece-eval.el index cbd1c85..ce62e71 100644 --- a/lisp/riece-eval.el +++ b/lisp/riece-eval.el @@ -87,6 +87,10 @@ (add-hook 'riece-after-display-message-functions 'riece-eval-display-message-function)) +(defun riece-eval-uninstall () + (remove-hook 'riece-after-display-message-functions + 'riece-eval-display-message-function)) + (defun riece-eval-enable () (setq riece-eval-enabled t)) diff --git a/lisp/riece-foolproof.el b/lisp/riece-foolproof.el index aa7bb86..f1572b2 100644 --- a/lisp/riece-foolproof.el +++ b/lisp/riece-foolproof.el @@ -62,6 +62,10 @@ (add-hook 'riece-command-send-message-hook 'riece-foolproof-command-send-message-function)) +(defun riece-foolproof-uninstall () + (remove-hook 'riece-command-send-message-hook + 'riece-foolproof-command-send-message-function)) + (defun riece-foolproof-enable () (setq riece-foolproof-enabled t)) diff --git a/lisp/riece-google.el b/lisp/riece-google.el index de93b90..80812da 100644 --- a/lisp/riece-google.el +++ b/lisp/riece-google.el @@ -234,6 +234,10 @@ end (add-hook 'riece-after-display-message-functions 'riece-google-display-message-function)) +(defun riece-google-uninstall () + (remove-hook 'riece-after-display-message-functions + 'riece-google-display-message-function)) + (defun riece-google-enable () (setq riece-google-enabled t)) diff --git a/lisp/riece-hangman.el b/lisp/riece-hangman.el index 8865638..d86ed58 100644 --- a/lisp/riece-hangman.el +++ b/lisp/riece-hangman.el @@ -227,6 +227,9 @@ The wordlist is read from `riece-hangman-words-file'." (defun riece-hangman-insinuate () (add-hook 'riece-after-privmsg-hook 'riece-hangman-after-privmsg-hook)) +(defun riece-hangman-uninstall () + (remove-hook 'riece-after-privmsg-hook 'riece-hangman-after-privmsg-hook)) + (defun riece-hangman-enable () (random t) (setq riece-hangman-enabled t)) diff --git a/lisp/riece-highlight.el b/lisp/riece-highlight.el index 7ea6e09..4955a47 100644 --- a/lisp/riece-highlight.el +++ b/lisp/riece-highlight.el @@ -283,6 +283,24 @@ (add-hook 'riece-after-insert-functions 'riece-highlight-put-overlay-faces)) +(defun riece-highlight-uninstall () + (remprop 'riece-channel-mode 'font-lock-defaults) + (remove-hook 'riece-channel-mode-hook + 'riece-highlight-setup-dialogue) + (remprop 'riece-others-mode 'font-lock-defaults) + (remove-hook 'riece-others-mode-hook + 'riece-highlight-setup-dialogue) + (remprop 'riece-dialogue-mode 'font-lock-defaults) + (remove-hook 'riece-dialogue-mode-hook + 'riece-highlight-setup-dialogue) + (remprop 'riece-channel-list-mode 'font-lock-defaults) + (remove-hook 'riece-channel-list-mode-hook + 'riece-highlight-setup-channel-list) + (remove-hook 'riece-format-identity-for-channel-list-indicator-functions + 'riece-highlight-format-identity-for-channel-list-indicator) + (remove-hook 'riece-after-insert-functions + 'riece-highlight-put-overlay-faces)) + (defun riece-highlight-enable () (let ((buffers riece-buffer-list)) (while buffers diff --git a/lisp/riece-history.el b/lisp/riece-history.el index 79dd389..64ed6b9 100644 --- a/lisp/riece-history.el +++ b/lisp/riece-history.el @@ -116,12 +116,14 @@ ;;; (if (memq 'riece-guess riece-addons) ;;; '(riece-guess))) +(defun riece-history-after-switch-to-channel-functions (last) + (if (and riece-history-enabled last + (not (riece-identity-equal last riece-current-channel))) + (ring-insert riece-channel-history last))) + (defun riece-history-insinuate () (add-hook 'riece-after-switch-to-channel-functions - (lambda (last) - (if (and riece-history-enabled last - (not (riece-identity-equal last riece-current-channel))) - (ring-insert riece-channel-history last)))) + 'riece-history-after-switch-to-channel-functions) (add-hook 'riece-format-identity-for-channel-list-buffer-functions 'riece-history-format-identity-for-channel-list-buffer) (add-hook 'riece-format-identity-for-channel-list-indicator-functions @@ -135,6 +137,17 @@ ;;; 'riece-guess-channel-from-history)) ) +(defun riece-history-uninstall () + (remove-hook 'riece-after-switch-to-channel-functions + 'riece-history-after-switch-to-channel-functions) + (remove-hook 'riece-format-identity-for-channel-list-buffer-functions + 'riece-history-format-identity-for-channel-list-buffer) + (remove-hook 'riece-format-identity-for-channel-list-indicator-functions + 'riece-history-format-identity-for-channel-list-indicator) + (setq riece-channel-list-mark-face-alist + (delq (assq ?+ riece-channel-list-mark-face-alist) + riece-channel-list-mark-face-alist))) + (defun riece-history-enable () (setq riece-channel-history (make-ring riece-channel-history-length)) diff --git a/lisp/riece-icon.el b/lisp/riece-icon.el index 890fa95..73792d2 100644 --- a/lisp/riece-icon.el +++ b/lisp/riece-icon.el @@ -308,19 +308,42 @@ Modify whole identification by side effect." (error (defalias 'riece-icon-modeline-buffer-identification 'identity))))) +(defun riece-icon-user-list-mode-hook () + (if (riece-icon-available-p) + (add-hook 'riece-update-buffer-functions + 'riece-icon-update-user-list-buffer t t))) + +(defun riece-icon-channel-list-mode-hook () + (if (riece-icon-available-p) + (add-hook 'riece-update-buffer-functions + 'riece-icon-update-channel-list-buffer t t))) + +(defvar riece-icon-original-mode-line-buffer-identification nil) + (defun riece-icon-insinuate () + (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) (add-hook 'riece-user-list-mode-hook - (lambda () - (if (riece-icon-available-p) - (add-hook 'riece-update-buffer-functions - 'riece-icon-update-user-list-buffer t t)))) + 'riece-icon-user-list-mode-hook) (add-hook 'riece-channel-list-mode-hook - (lambda () - (if (riece-icon-available-p) - (add-hook 'riece-update-buffer-functions - 'riece-icon-update-channel-list-buffer t t))))) + 'riece-icon-channel-list-mode-hook)) + +(defun riece-icon-uninstall () + (fset 'riece-mode-line-buffer-identification + riece-icon-original-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) diff --git a/lisp/riece-ignore.el b/lisp/riece-ignore.el index 6b091d7..c0dc6a1 100644 --- a/lisp/riece-ignore.el +++ b/lisp/riece-ignore.el @@ -133,6 +133,10 @@ Otherwise, they are not removed from IRC buffers, but are hidden with (mapcar #'riece-parse-identity riece-startup-ignored-user-list)) (add-hook 'riece-message-filter-functions 'riece-ignore-message-filter)) +(defun riece-ignore-uninstall () + (setq riece-ignored-user-list nil) + (remove-hook 'riece-message-filter-functions 'riece-ignore-message-filter)) + (defun riece-ignore-enable () (define-key riece-command-mode-map "\C-ck" 'riece-ignore-user) diff --git a/lisp/riece-kakasi.el b/lisp/riece-kakasi.el index d1fc363..0df4d69 100644 --- a/lisp/riece-kakasi.el +++ b/lisp/riece-kakasi.el @@ -58,6 +58,9 @@ (defun riece-kakasi-insinuate () (add-hook 'riece-message-filter-functions 'riece-kakasi-message-filter)) +(defun riece-kakasi-uninstall () + (remove-hook 'riece-message-filter-functions 'riece-kakasi-message-filter)) + (defun riece-kakasi-enable () (setq riece-kakasi-process (start-process "kakasi" (generate-new-buffer " *riece-kakasi*") diff --git a/lisp/riece-keepalive.el b/lisp/riece-keepalive.el index d357297..739d494 100644 --- a/lisp/riece-keepalive.el +++ b/lisp/riece-keepalive.el @@ -63,8 +63,12 @@ (setq riece-keepalive-timer nil))) (defun riece-keepalive-insinuate () - (add-hook 'riece-after-login-hook #'riece-keepalive-after-login-hook) - (add-hook 'riece-after-close-hook #'riece-keepalive-after-close-hook)) + (add-hook 'riece-after-login-hook 'riece-keepalive-after-login-hook) + (add-hook 'riece-after-close-hook 'riece-keepalive-after-close-hook)) + +(defun riece-keepalive-uninstall () + (remove-hook 'riece-after-login-hook 'riece-keepalive-after-login-hook) + (remove-hook 'riece-after-close-hook 'riece-keepalive-after-close-hook)) (provide 'riece-keepalive) diff --git a/lisp/riece-keyword.el b/lisp/riece-keyword.el index 03b1727..20b479d 100644 --- a/lisp/riece-keyword.el +++ b/lisp/riece-keyword.el @@ -115,6 +115,9 @@ and the matched message object." (defun riece-keyword-insinuate () (add-hook 'riece-message-filter-functions 'riece-keyword-message-filter)) +(defun riece-keyword-uninstall () + (remove-hook 'riece-message-filter-functions 'riece-keyword-message-filter)) + (defun riece-keyword-enable () (setq riece-keyword-enabled t)) diff --git a/lisp/riece-log.el b/lisp/riece-log.el index f5ef680..5568996 100644 --- a/lisp/riece-log.el +++ b/lisp/riece-log.el @@ -289,6 +289,13 @@ If LINES is t, insert today's logs entirely." (add-hook 'riece-channel-buffer-create-functions 'riece-log-flashback)) +(defun riece-log-uninstall () + (setq riece-log-lock-file nil) + (remove-hook 'riece-after-display-message-functions + 'riece-log-display-message-function) + (remove-hook 'riece-channel-buffer-create-functions + 'riece-log-flashback)) + (defvar riece-command-mode-map) (defun riece-log-enable () (define-key riece-command-mode-map "\C-cd" 'riece-log-dired) diff --git a/lisp/riece-lsdb.el b/lisp/riece-lsdb.el index 43d88e6..f61a11a 100644 --- a/lisp/riece-lsdb.el +++ b/lisp/riece-lsdb.el @@ -125,6 +125,14 @@ (add-to-list 'lsdb-after-delete-record-functions 'riece-lsdb-delete-cache)) +(defun riece-lsdb-uninstall () + (setq lsdb-secondary-hash-tables + (delq 'riece-lsdb-cache lsdb-secondary-hash-tables) + lsdb-after-update-record-functions + (delq 'riece-lsdb-update-cache lsdb-after-update-record-functions) + lsdb-after-delete-record-functions + (delq 'riece-lsdb-delete-cache lsdb-after-delete-record-functions)) + (defun riece-lsdb-enable () (define-key riece-command-mode-map "\C-c\C-ll" 'riece-lsdb-display-records) diff --git a/lisp/riece-menu.el b/lisp/riece-menu.el index f658600..612b7b0 100644 --- a/lisp/riece-menu.el +++ b/lisp/riece-menu.el @@ -102,14 +102,23 @@ (defvar riece-command-mode-map) (defvar riece-menu) + +(defun riece-menu-command-mode-hook () + (easy-menu-define riece-menu + riece-command-mode-map + "Riece Menu" + riece-menu-items) + (easy-menu-add riece-menu)) + (defun riece-menu-insinuate () (add-hook 'riece-command-mode-hook - (lambda () - (easy-menu-define riece-menu - riece-command-mode-map - "Riece Menu" - riece-menu-items) - (easy-menu-add riece-menu)))) + 'riece-menu-command-mode-hook)) + +(defun riece-menu-uninstall () + (remove-hook 'riece-command-mode-hook + 'riece-menu-command-mode-hook) + ;;FIXME: couldn't uninstall completely. + ) (provide 'riece-menu) diff --git a/lisp/riece-mini.el b/lisp/riece-mini.el index df08384..3d714d8 100644 --- a/lisp/riece-mini.el +++ b/lisp/riece-mini.el @@ -150,6 +150,11 @@ If twice (C-u C-u), then ask the channel." 'riece-mini-display-message-function) (add-hook 'pre-command-hook 'riece-mini-pre-command)) +(defun riece-mini-uninstall () + (remove-hook 'riece-after-display-message-functions + 'riece-mini-display-message-function) + (remove-hook 'pre-command-hook 'riece-mini-pre-command)) + (defun riece-mini-enable () (setq riece-mini-enabled t)) diff --git a/lisp/riece-ndcc.el b/lisp/riece-ndcc.el index 1dad2c9..c865df5 100644 --- a/lisp/riece-ndcc.el +++ b/lisp/riece-ndcc.el @@ -234,6 +234,9 @@ Only used for sending files." (defun riece-ndcc-insinuate () (add-hook 'riece-ctcp-dcc-request-hook 'riece-handle-dcc-request)) +(defun riece-ndcc-uninstall () + (remove-hook 'riece-ctcp-dcc-request-hook 'riece-handle-dcc-request)) + (defun riece-ndcc-enable () (define-key riece-dialogue-mode-map "\C-ds" 'riece-command-dcc-send) (define-key riece-dialogue-mode-map "\C-dr" 'riece-command-dcc-receive)) diff --git a/lisp/riece-rdcc.el b/lisp/riece-rdcc.el index 201fd69..3ff44a4 100644 --- a/lisp/riece-rdcc.el +++ b/lisp/riece-rdcc.el @@ -355,6 +355,11 @@ end (add-to-list 'riece-ctcp-additional-clientinfo "DCC") (add-hook 'riece-ctcp-dcc-request-hook 'riece-handle-dcc-request)) +(defun riece-rdcc-uninstall () + (setq riece-ctcp-additional-clientinfo + (delete "DCC" riece-ctcp-additional-clientinfo)) + (remove-hook 'riece-ctcp-dcc-request-hook 'riece-handle-dcc-request)) + (defun riece-rdcc-enable () (define-key riece-dialogue-mode-map "\C-ds" 'riece-command-dcc-send) (define-key riece-dialogue-mode-map "\C-dr" 'riece-command-dcc-receive) diff --git a/lisp/riece-toolbar.el b/lisp/riece-toolbar.el index ef466ce..dcc104d 100644 --- a/lisp/riece-toolbar.el +++ b/lisp/riece-toolbar.el @@ -112,6 +112,12 @@ 'riece-toolbar-insinuate-in-command-buffer t)) +(defun riece-toolbar-uninstall () + (remove-hook 'riece-command-mode-hook + 'riece-toolbar-insinuate-in-command-buffer) + ;;FIXME: couldn't uninstall completely. + ) + (provide 'riece-toolbar) ;;; riece-toolbar.el ends here \ No newline at end of file diff --git a/lisp/riece-unread.el b/lisp/riece-unread.el index e35c0e3..e776f6a 100644 --- a/lisp/riece-unread.el +++ b/lisp/riece-unread.el @@ -153,6 +153,23 @@ ;;; 'riece-guess-channel-from-unread)) ) +(defun riece-unread-uninstall () + (remove-hook 'riece-after-display-message-functions + 'riece-unread-after-display-message-function) + (remove-hook 'riece-after-switch-to-channel-functions + 'riece-unread-after-switch-to-channel-function) + (remove-hook 'riece-format-identity-for-channel-list-buffer-functions + 'riece-unread-format-identity-for-channel-list-buffer) + (remove-hook 'riece-format-identity-for-channel-list-indicator-functions + 'riece-unread-format-identity-for-channel-list-indicator) + (setq riece-channel-list-mark-face-alist + (delq (assq ?! riece-channel-list-mark-face-alist) + riece-channel-list-mark-face-alist)) +;;; (if (memq 'riece-guess riece-addons) +;;; (add-hook 'riece-guess-channel-try-functions +;;; 'riece-guess-channel-from-unread)) + ) + (defvar riece-command-mode-map) (defvar riece-dialogue-mode-map) (defvar riece-channel-list-mode-map) diff --git a/lisp/riece-url.el b/lisp/riece-url.el index 848d24d..dc1c1aa 100644 --- a/lisp/riece-url.el +++ b/lisp/riece-url.el @@ -122,16 +122,23 @@ This maps a string \"Bug#12345\" to a URL (if (memq 'riece-menu riece-addons) '(riece-menu)))) +(defun riece-url-command-mode-hook () + (easy-menu-add-item + nil (list (car riece-menu-items)) + '("Open URL..." :filter riece-url-create-menu))) + (defun riece-url-insinuate () (add-hook 'riece-after-insert-functions 'riece-url-scan-region) (if (memq 'riece-menu riece-addons) (add-hook 'riece-command-mode-hook - (lambda () - (easy-menu-add-item - nil (list (car riece-menu-items)) - '("Open URL..." :filter riece-url-create-menu))) + 'riece-url-command-mode-hook t))) +(defun riece-url-uninstall () + (remove-hook 'riece-after-insert-functions 'riece-url-scan-region) + (remove-hook 'riece-command-mode-hook + 'riece-url-command-mode-hook))) + (defun riece-url-enable () (define-key riece-dialogue-mode-map "U" 'riece-command-browse-url) (setq riece-url-enabled t)) diff --git a/lisp/riece-xface.el b/lisp/riece-xface.el index 005181b..20b1f4d 100644 --- a/lisp/riece-xface.el +++ b/lisp/riece-xface.el @@ -63,11 +63,20 @@ (defun riece-xface-requires () '(riece-lsdb)) +(defun riece-xface-user-list-mode-hook () + (add-hook 'riece-update-buffer-functions + 'riece-xface-update-user-list-buffer t t)) + (defun riece-xface-insinuate () (add-hook 'riece-user-list-mode-hook - (lambda () - (add-hook 'riece-update-buffer-functions - 'riece-xface-update-user-list-buffer t t)))) + 'riece-xface-user-list-mode-hook)) + +(defun riece-xface-uninstall () + (remove-hook 'riece-user-list-mode-hook + 'riece-xface-user-list-mode-hook) + (with-current-buffer riece-user-list-buffer + (remove-hook 'riece-update-buffer-functions + 'riece-xface-update-user-list-buffer))) (defun riece-xface-enable () (setq riece-xface-enabled t) -- 1.7.10.4