From: ueno Date: Sat, 27 Aug 2005 09:43:20 +0000 (+0000) Subject: * riece-addon.el (riece-uninstall-addon): Don't check the add-on X-Git-Tag: channel-coding-branchpoint~14 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=895e17ef4cc7d08dc3e30c37c7c06fab3e6d1a6d;p=elisp%2Friece.git * riece-addon.el (riece-uninstall-addon): Don't check the add-on is enabled. (riece-uninstall-addon): Don't use riece-remprop. (riece-enable-addon): Put 'riece-addon-enabled property on the add-on feature. (riece-disable-addon): Ditto. (riece-command-list-addons): Check 'riece-addon-enabled property instead of riece-*-enabled variables. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e92f700..4340871 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,16 @@ 2005-08-27 Daiki Ueno + * riece-addon.el (riece-uninstall-addon): Don't check the add-on + is enabled. + (riece-uninstall-addon): Don't use riece-remprop. + (riece-enable-addon): Put 'riece-addon-enabled property on the + add-on feature. + (riece-disable-addon): Ditto. + (riece-command-list-addons): Check 'riece-addon-enabled property + instead of riece-*-enabled variables. + +2005-08-27 Daiki Ueno + * riece-options.el (riece-shrink-buffer-idle-time-delay): Abolished; moved to riece-shrink-buffer.el. (riece-max-buffer-size): Ditto. diff --git a/lisp/riece-addon.el b/lisp/riece-addon.el index fb5022a..4c474c7 100644 --- a/lisp/riece-addon.el +++ b/lisp/riece-addon.el @@ -240,7 +240,6 @@ (if verbose (message "Add-on %S is not insinuated" addon)) (let ((entry (assq addon riece-addon-dependencies)) - (enabled (intern-soft (concat (symbol-name addon) "-enabled"))) (uninstall (intern-soft (concat (symbol-name addon) "-uninstall")))) (if entry (if (cdr entry) @@ -249,16 +248,13 @@ (error "%s depend on %S" (mapconcat #'symbol-name (cdr entry) ", ") addon)) - (if (and enabled - (boundp enabled) - (symbol-value enabled)) - (riece-disable-addon addon verbose)) + (riece-disable-addon addon verbose) (if (and uninstall (fboundp uninstall)) (funcall uninstall)) (setq riece-addon-dependencies (delq entry riece-addon-dependencies)) - (riece-remprop addon 'riece-addon-insinuated) + (put addon 'riece-addon-insinuated nil) (setq riece-addons (delq addon riece-addons) riece-save-variables-are-dirty t riece-addon-dependencies @@ -270,29 +266,31 @@ (defun riece-enable-addon (addon &optional verbose) (unless (get addon 'riece-addon-insinuated) (error "Add-on %S is not insinuated" addon)) - (let ((enabled (intern-soft (concat (symbol-name addon) "-enabled")))) - (if (or (null enabled) - (not (boundp enabled))) + (let ((enable (intern-soft (concat (symbol-name addon) "-enable")))) + (if (or (null enable) + (not (fboundp enable))) (if verbose (message "Add-on %S doesn't support enable/disable" addon)) - (if (symbol-value enabled) + (if (get addon 'riece-addon-enabled) (if verbose (message "Add-on %S is already enabled" addon)) - (funcall (intern (concat (symbol-name addon) "-enable"))) + (funcall enable) + (put addon 'riece-addon-enabled t) (if verbose (message "Add-on %S enabled" addon)))))) (defun riece-disable-addon (addon &optional verbose) (unless (get addon 'riece-addon-insinuated) (error "Add-on %S is not insinuated" addon)) - (let ((enabled (intern-soft (concat (symbol-name addon) "-enabled")))) - (if (or (null enabled) - (not (boundp enabled))) + (let ((disable (intern-soft (concat (symbol-name addon) "-disable")))) + (if (or (null disable) + (not (fboundp disable))) (if verbose (message "Add-on %S doesn't support enable/disable" addon)) - (if (symbol-value enabled) + (if (get addon 'riece-addon-enabled) (progn - (funcall (intern (concat (symbol-name addon) "-disable"))) + (funcall disable) + (put addon 'riece-addon-enabled nil) (if verbose (message "Add-on %S disabled" addon))) (if verbose @@ -328,7 +326,7 @@ All normal editing commands are turned off." buffer-read-only (pointer riece-addon-dependencies) module-description-alist - description enabled point) + description enable point) (while pointer (setq description (intern-soft (concat (symbol-name (car (car pointer))) "-description")) @@ -354,8 +352,8 @@ All normal editing commands are turned off." (string-lessp (symbol-name (car entry1)) (symbol-name (car entry2)))))) (while pointer - (setq enabled (intern-soft (concat (symbol-name (car (car pointer))) - "-enabled"))) + (setq enable (intern-soft (concat (symbol-name (car (car pointer))) + "-enable"))) (setq point (point)) (insert (format "%c %-15S %s\n" (if (not (featurep (car (car pointer)))) @@ -363,9 +361,10 @@ All normal editing commands are turned off." (if (not (get (car (car pointer)) 'riece-addon-insinuated)) ?? - (if (null enabled) + (if (or (null enable) + (not (fboundp enable))) ?! - (if (symbol-value enabled) + (if (get (car (car pointer)) 'riece-addon-enabled) ?+ ?-)))) (car (car pointer)) @@ -377,9 +376,9 @@ Symbols in the leftmost column: + The add-on is enabled. - The add-on is disabled. - ! The add-on doesn't support enable/disable operation. - ? The add-on is not insinuated. - The add-on is not loaded. + ! The add-on doesn't support enable/disable operation. + ? The add-on is not insinuated. + The add-on is not loaded. ") (insert (substitute-command-keys " Useful keys: diff --git a/lisp/riece-alias.el b/lisp/riece-alias.el index aa1266d..dc11b52 100644 --- a/lisp/riece-alias.el +++ b/lisp/riece-alias.el @@ -61,8 +61,6 @@ :type 'list :group 'riece-alias) -(defvar riece-alias-enabled nil) - (defconst riece-alias-description "Define aliases for IRC names.") @@ -167,14 +165,12 @@ #'riece-alias-abbrev-identity-string riece-expand-identity-string-function #'riece-alias-expand-identity-string) - (riece-emit-signal 'channel-list-changed) - (setq riece-alias-enabled t)) + (riece-emit-signal 'channel-list-changed)) (defun riece-alias-disable () (setq riece-abbrev-identity-string-function nil riece-expand-identity-string-function nil) - (riece-emit-signal 'channel-list-changed) - (setq riece-alias-enabled nil)) + (riece-emit-signal 'channel-list-changed)) (provide 'riece-alias) diff --git a/lisp/riece-biff.el b/lisp/riece-biff.el index b05df0e..62c306c 100644 --- a/lisp/riece-biff.el +++ b/lisp/riece-biff.el @@ -51,13 +51,11 @@ (defvar riece-biff-mode-string 'riece-biff-default-mode-string) -(defvar riece-biff-enabled nil) - (defconst riece-biff-description "Be notified if messages arrives.") (defun riece-biff-after-display-message-function (message) - (when (and riece-biff-enabled + (when (and (get 'riece-biff 'riece-addon-enabled) (not (or (eq (window-buffer (selected-window)) (get-buffer riece-command-buffer)) (riece-message-own-p message) @@ -68,7 +66,7 @@ (setq riece-biff-mode-string 'riece-biff-biff-mode-string)))) (defun riece-biff-clear (&optional dummy) - (when riece-biff-enabled + (when (get 'riece-biff 'riece-addon-enabled) (setq riece-biff-mode-string 'riece-biff-default-mode-string))) (defun riece-biff-insinuate () @@ -94,8 +92,7 @@ (append '("" riece-biff-mode-string) (remove "" global-mode-string))) (t - global-mode-string))) - (setq riece-biff-enabled t)) + global-mode-string)))) (defun riece-biff-disable () (setq global-mode-string @@ -105,8 +102,7 @@ (remq 'riece-biff-mode-string global-mode-string)) (t global-mode-string))) - (riece-biff-clear) - (setq riece-biff-enabled nil)) + (riece-biff-clear)) (provide 'riece-biff) diff --git a/lisp/riece-button.el b/lisp/riece-button.el index b7ebbc8..7f78388 100644 --- a/lisp/riece-button.el +++ b/lisp/riece-button.el @@ -48,8 +48,6 @@ ["Set +v" riece-user-button-set-speakers]) "Menu for user buttons.") -(defvar riece-button-enabled nil) - (defconst riece-button-description "Display useful buttons in IRC buffers.") @@ -206,7 +204,7 @@ This function is used as a callback for a channel button." (defvar riece-identity-button-map) (defun riece-button-add-identity-button (start end) - (if riece-button-enabled + (if (get 'riece-button 'riece-addon-enabled) (riece-scan-property-region 'riece-identity start end @@ -290,7 +288,6 @@ This function is used as a callback for a channel button." 'riece-button-add-identity-button)) (defun riece-button-enable () - (setq riece-button-enabled t) (let ((pointer riece-buffer-list)) (while pointer (with-current-buffer (car pointer) @@ -303,7 +300,6 @@ This function is used as a callback for a channel button." (riece-emit-signal 'channel-list-changed))) (defun riece-button-disable () - (setq riece-button-enabled nil) (save-excursion (let ((pointer riece-buffer-list)) (while pointer diff --git a/lisp/riece-ctcp.el b/lisp/riece-ctcp.el index 50a4cc4..0afefe8 100644 --- a/lisp/riece-ctcp.el +++ b/lisp/riece-ctcp.el @@ -54,13 +54,11 @@ (defvar riece-dialogue-mode-map) -(defvar riece-ctcp-enabled nil) - (defconst riece-ctcp-description "CTCP (Client To Client Protocol) support.") (defun riece-handle-ctcp-request (prefix string) - (when (and riece-ctcp-enabled prefix string + (when (and (get 'riece-ctcp 'riece-addon-enabled) prefix string (riece-prefix-nickname prefix)) (let* ((parameters (riece-split-parameters string)) (targets (split-string (car parameters) ",")) @@ -221,7 +219,7 @@ "\n")))) (defun riece-handle-ctcp-response (prefix string) - (when (and riece-ctcp-enabled prefix string + (when (and (get 'riece-ctcp 'riece-addon-enabled) prefix string (riece-prefix-nickname prefix)) (let* ((parameters (riece-split-parameters string)) (targets (split-string (car parameters) ",")) @@ -400,16 +398,14 @@ (define-key riece-dialogue-mode-map "\C-cp" 'riece-command-ctcp-ping) (define-key riece-dialogue-mode-map "\C-ca" 'riece-command-ctcp-action) (define-key riece-dialogue-mode-map "\C-cc" 'riece-command-ctcp-clientinfo) - (define-key riece-dialogue-mode-map "\C-ct" 'riece-command-ctcp-time) - (setq riece-ctcp-enabled t)) + (define-key riece-dialogue-mode-map "\C-ct" 'riece-command-ctcp-time)) (defun riece-ctcp-disable () (define-key riece-dialogue-mode-map "\C-cv" nil) (define-key riece-dialogue-mode-map "\C-cp" nil) (define-key riece-dialogue-mode-map "\C-ca" nil) (define-key riece-dialogue-mode-map "\C-cc" nil) - (define-key riece-dialogue-mode-map "\C-ct" nil) - (setq riece-ctcp-enabled nil)) + (define-key riece-dialogue-mode-map "\C-ct" nil)) (provide 'riece-ctcp) diff --git a/lisp/riece-ctlseq.el b/lisp/riece-ctlseq.el index c7a54e0..842c6a1 100644 --- a/lisp/riece-ctlseq.el +++ b/lisp/riece-ctlseq.el @@ -57,8 +57,6 @@ (defvar riece-ctlseq-face-cache nil) (defvar riece-ctlseq-face-counter 0) -(defvar riece-ctlseq-enabled nil) - (defconst riece-ctlseq-description "Mark up control sequences in IRC buffers.") @@ -156,7 +154,7 @@ attrs))) (defun riece-ctlseq-message-filter (message) - (if riece-ctlseq-enabled + (if (get 'riece-ctlseq 'riece-addon-enabled) (let ((start 0) (end (length (riece-message-text message))) attrs) @@ -191,10 +189,10 @@ (remove-hook 'riece-message-filter-functions 'riece-ctlseq-message-filter)) (defun riece-ctlseq-enable () - (setq riece-ctlseq-enabled t)) + ) (defun riece-ctlseq-disable () - (setq riece-ctlseq-enabled nil)) + ) (provide 'riece-ctlseq) diff --git a/lisp/riece-doctor.el b/lisp/riece-doctor.el index 1f83c7c..941841d 100644 --- a/lisp/riece-doctor.el +++ b/lisp/riece-doctor.el @@ -49,8 +49,6 @@ (defvar riece-doctor-patients nil) -(defvar riece-doctor-enabled nil) - (defconst riece-doctor-description "Pretend to be a psychotherapist.") @@ -73,7 +71,7 @@ (riece-send-string (format "NOTICE %s :%s\r\n" target string))) (defun riece-doctor-after-privmsg-hook (prefix string) - (if riece-doctor-enabled + (if (get 'riece-doctor 'riece-addon-enabled) (let* ((user (riece-prefix-nickname prefix)) (parameters (riece-split-parameters string)) (targets (split-string (car parameters) ",")) @@ -130,10 +128,10 @@ Please, describe your problems." (remove-hook 'riece-after-privmsg-hook 'riece-doctor-after-privmsg-hook)) (defun riece-doctor-enable () - (setq riece-doctor-enabled t)) + ) (defun riece-doctor-disable () - (setq riece-doctor-enabled nil)) + ) (provide 'riece-doctor) diff --git a/lisp/riece-eval-ruby.el b/lisp/riece-eval-ruby.el index 60d59b1..a6c2315 100644 --- a/lisp/riece-eval-ruby.el +++ b/lisp/riece-eval-ruby.el @@ -41,8 +41,6 @@ :type 'string :group 'riece-eval-ruby) -(defvar riece-eval-ruby-enabled nil) - (defconst riece-eval-ruby-description "Evaluate input string as a Ruby program.") @@ -67,7 +65,7 @@ 'notice)))) (defun riece-eval-ruby-display-message-function (message) - (if (and riece-eval-ruby-enabled + (if (and (get 'riece-eval-ruby 'riece-addon-enabled) (riece-message-own-p message) (string-match riece-eval-ruby-prefix-regexp (riece-message-text message))) @@ -89,10 +87,10 @@ 'riece-eval-ruby-display-message-function)) (defun riece-eval-ruby-enable () - (setq riece-eval-ruby-enabled t)) + ) (defun riece-eval-ruby-disable () - (setq riece-eval-ruby-enabled nil)) + ) (provide 'riece-eval-ruby) diff --git a/lisp/riece-eval.el b/lisp/riece-eval.el index ce62e71..71b308e 100644 --- a/lisp/riece-eval.el +++ b/lisp/riece-eval.el @@ -45,13 +45,11 @@ :type 'boolean :group 'riece-eval) -(defvar riece-eval-enabled nil) - (defconst riece-eval-description "Evaluate an input string as an elisp form.") (defun riece-eval-display-message-function (message) - (when (and riece-eval-enabled + (when (and (get 'riece-eval 'riece-addon-enabled) (riece-message-own-p message) (string-match riece-eval-regexp (riece-message-text message))) (let* ((form (match-string 1 (riece-message-text message))) @@ -92,10 +90,10 @@ 'riece-eval-display-message-function)) (defun riece-eval-enable () - (setq riece-eval-enabled t)) + ) (defun riece-eval-disable () - (setq riece-eval-enabled nil)) + ) (provide 'riece-eval) diff --git a/lisp/riece-foolproof.el b/lisp/riece-foolproof.el index bc606ea..6c1a352 100644 --- a/lisp/riece-foolproof.el +++ b/lisp/riece-foolproof.el @@ -31,8 +31,6 @@ (require 'riece-identity) (require 'riece-display)) -(defvar riece-foolproof-enabled nil) - (defconst riece-foolproof-description "Prevent miss-operation in the command buffer.") @@ -42,7 +40,7 @@ identity riece-channel-buffer-alist)))) (defun riece-foolproof-command-send-message-function () - (when riece-foolproof-enabled + (when (get 'riece-foolproof 'riece-addon-enabled) (unless (or (not riece-channel-buffer-mode) (riece-foolproof-get-channel-window riece-current-channel)) @@ -67,10 +65,10 @@ 'riece-foolproof-command-send-message-function)) (defun riece-foolproof-enable () - (setq riece-foolproof-enabled t)) + ) (defun riece-foolproof-disable () - (setq riece-foolproof-enabled nil)) + ) (provide 'riece-foolproof) diff --git a/lisp/riece-google.el b/lisp/riece-google.el index 80812da..368d431 100644 --- a/lisp/riece-google.el +++ b/lisp/riece-google.el @@ -154,15 +154,13 @@ end (defconst riece-google-regexp "^go\\(o+\\)gle\\(:\\([a-z]+\\)\\)?>\\s-*\\(.*\\)") -(defvar riece-google-enabled nil) - (defconst riece-google-description "Search keywords by Google.") (defvar riece-google-target nil) (defun riece-google-display-message-function (message) - (when (and riece-google-enabled + (when (and (get 'riece-google 'riece-addon-enabled) (stringp riece-google-license-key) (string-match riece-google-regexp (riece-message-text message))) (let ((keywords (match-string 4 (riece-message-text message))) @@ -239,10 +237,10 @@ end 'riece-google-display-message-function)) (defun riece-google-enable () - (setq riece-google-enabled t)) + ) (defun riece-google-disable () - (setq riece-google-enabled nil)) + ) (provide 'riece-google) diff --git a/lisp/riece-guess.el b/lisp/riece-guess.el index 7c54a05..c5c3270 100644 --- a/lisp/riece-guess.el +++ b/lisp/riece-guess.el @@ -41,8 +41,6 @@ :type '(repeat function) :group 'riece-guess) -(defvar riece-guess-enabled nil) - (defconst riece-guess-description "Guess the next channel, using multiple methods.") @@ -103,8 +101,7 @@ merge the results." (define-key riece-dialogue-mode-map "g" 'riece-command-guess-switch-to-channel) (define-key riece-channel-list-mode-map - "g" 'riece-command-guess-switch-to-channel) - (setq riece-guess-enabled t)) + "g" 'riece-command-guess-switch-to-channel)) (defun riece-guess-disable () (define-key riece-command-mode-map @@ -112,8 +109,7 @@ merge the results." (define-key riece-dialogue-mode-map "g" nil) (define-key riece-channel-list-mode-map - "g" nil) - (setq riece-guess-enabled nil)) + "g" nil)) (provide 'riece-guess) diff --git a/lisp/riece-hangman.el b/lisp/riece-hangman.el index d86ed58..a559c36 100644 --- a/lisp/riece-hangman.el +++ b/lisp/riece-hangman.el @@ -55,8 +55,6 @@ (defvar riece-hangman-player-context-alist nil) (defvar riece-hangman-words-buffer nil) -(defvar riece-hangman-enabled nil) - (defconst riece-hangman-description "Allow channel members to play the hangman game.") @@ -140,7 +138,7 @@ The wordlist is read from `riece-hangman-words-file'." ""))))) (defun riece-hangman-after-privmsg-hook (prefix string) - (if riece-hangman-enabled + (if (get 'riece-hangman 'riece-addon-enabled) (let* ((user (riece-prefix-nickname prefix)) (parameters (riece-split-parameters string)) (targets (split-string (car parameters) ",")) @@ -231,11 +229,10 @@ The wordlist is read from `riece-hangman-words-file'." (remove-hook 'riece-after-privmsg-hook 'riece-hangman-after-privmsg-hook)) (defun riece-hangman-enable () - (random t) - (setq riece-hangman-enabled t)) + (random t)) (defun riece-hangman-disable () - (setq riece-hangman-enabled nil)) + ) (provide 'riece-hangman) diff --git a/lisp/riece-highlight.el b/lisp/riece-highlight.el index a0bc93c..7758627 100644 --- a/lisp/riece-highlight.el +++ b/lisp/riece-highlight.el @@ -201,8 +201,6 @@ (set-face-foreground 'riece-modeline-current-face (face-foreground 'riece-channel-list-current-face))) -(defvar riece-highlight-enabled nil) - (defconst riece-highlight-description "Highlight IRC buffers.") @@ -219,7 +217,7 @@ (make-local-hook 'after-change-functions) (add-hook 'after-change-functions 'riece-highlight-hide-prefix nil t) - (if riece-highlight-enabled + (if (get 'riece-highlight 'riece-addon-enabled) (font-lock-mode 1))) (defun riece-highlight-setup-channel-list () @@ -228,7 +226,7 @@ ;; In XEmacs, auto-initialization of font-lock is not affective ;; when buffer-file-name is not set. (font-lock-set-defaults) - (if riece-highlight-enabled + (if (get 'riece-highlight 'riece-addon-enabled) (font-lock-mode 1))) (defun riece-highlight-hide-prefix (start end length) @@ -238,7 +236,7 @@ (put-text-property (match-beginning 1) (match-end 1) 'invisible t)))) (defun riece-highlight-put-overlay-faces (start end) - (if riece-highlight-enabled + (if (get 'riece-highlight 'riece-addon-enabled) (riece-scan-property-region 'riece-overlay-face start end @@ -249,7 +247,7 @@ (defun riece-highlight-format-identity-for-channel-list-indicator (index identity) - (if (and riece-highlight-enabled + (if (and (get 'riece-highlight 'riece-addon-enabled) (riece-identity-equal identity riece-current-channel)) (let ((string (riece-format-identity identity)) (start 0)) @@ -311,8 +309,7 @@ '(riece-dialogue-mode riece-channel-list-mode)) (with-current-buffer (car buffers) (font-lock-mode 1))) - (setq buffers (cdr buffers)))) - (setq riece-highlight-enabled t)) + (setq buffers (cdr buffers))))) (defun riece-highlight-disable () (let ((buffers riece-buffer-list)) @@ -323,8 +320,7 @@ '(riece-dialogue-mode riece-channel-list-mode)) (with-current-buffer (car buffers) (font-lock-mode 0))) - (setq buffers (cdr buffers)))) - (setq riece-highlight-enabled nil)) + (setq buffers (cdr buffers))))) (provide 'riece-highlight) diff --git a/lisp/riece-history.el b/lisp/riece-history.el index 497a272..d9e309f 100644 --- a/lisp/riece-history.el +++ b/lisp/riece-history.el @@ -76,8 +76,6 @@ (defvar riece-channel-history nil) -(defvar riece-history-enabled nil) - (defconst riece-history-description "Manage history of channel shifting.") @@ -91,7 +89,7 @@ (nreverse result))) (defun riece-history-format-identity-for-channel-list-buffer (index identity) - (if (and riece-history-enabled + (if (and (get 'riece-history 'riece-addon-enabled) (not (ring-empty-p riece-channel-history)) (riece-identity-equal identity (ring-ref riece-channel-history 0))) (concat (format "%2d:+" index) @@ -99,7 +97,7 @@ (defun riece-history-format-identity-for-channel-list-indicator (index identity) - (if (and riece-history-enabled + (if (and (get 'riece-history 'riece-addon-enabled) (not (ring-empty-p riece-channel-history)) (riece-identity-equal identity (ring-ref riece-channel-history 0))) (let ((string (riece-format-identity identity)) @@ -117,7 +115,7 @@ ;;; '(riece-guess))) (defun riece-history-after-switch-to-channel-functions (last) - (if (and riece-history-enabled last + (if (and (get 'riece-history 'riece-addon-enabled) last (not (riece-identity-equal last riece-current-channel))) (ring-insert riece-channel-history last))) @@ -155,12 +153,10 @@ (defun riece-history-enable () (setq riece-channel-history (make-ring riece-channel-history-length)) - (setq riece-history-enabled t) (riece-emit-signal 'channel-list-changed)) (defun riece-history-disable () - (setq riece-channel-history nil - riece-history-enabled nil) + (setq riece-channel-history nil) (riece-emit-signal 'channel-list-changed)) (provide 'riece-history) diff --git a/lisp/riece-icon.el b/lisp/riece-icon.el index 76e3aef..2f9bab2 100644 --- a/lisp/riece-icon.el +++ b/lisp/riece-icon.el @@ -181,8 +181,6 @@ static char * a_xpm[] = { \" @@@@@@@@@@@ \", \" \"};") -(defvar riece-icon-enabled nil) - (defconst riece-icon-description "Display icons in IRC buffers.") @@ -236,7 +234,7 @@ static char * a_xpm[] = { 'rear-nonsticky (list 'display))))))) (defun riece-icon-update-user-list-buffer () - (if riece-icon-enabled + (if (get 'riece-icon 'riece-addon-enabled) (let ((images (riece-icon-make-images riece-user-list-icons))) (save-excursion (goto-char (point-min)) @@ -246,7 +244,7 @@ static char * a_xpm[] = { (1- (point)) (point))))))) (defun riece-icon-update-channel-list-buffer () - (if riece-icon-enabled + (if (get 'riece-icon 'riece-addon-enabled) (let ((images (riece-icon-make-images riece-channel-list-icons))) (save-excursion (goto-char (point-min)) @@ -366,7 +364,6 @@ Modify whole identification by side effect." (defalias 'riece-mode-line-buffer-identification 'riece-icon-modeline-buffer-identification) (riece-icon-update-mode-line-buffer-identification) - (setq riece-icon-enabled t) (if riece-current-channel (riece-emit-signal 'user-list-changed riece-current-channel)) (riece-emit-signal 'channel-list-changed)) @@ -375,7 +372,6 @@ Modify whole identification by side effect." (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)) (riece-emit-signal 'channel-list-changed)) diff --git a/lisp/riece-ignore.el b/lisp/riece-ignore.el index c0dc6a1..7beea30 100644 --- a/lisp/riece-ignore.el +++ b/lisp/riece-ignore.el @@ -60,8 +60,6 @@ Otherwise, they are not removed from IRC buffers, but are hidden with (defvar riece-ignore-buffer nil) -(defvar riece-ignore-enabled nil) - (defconst riece-ignore-description "Ignore messages from some users.") (defvar riece-ignored-user-list nil) @@ -103,7 +101,7 @@ Otherwise, they are not removed from IRC buffers, but are hidden with (eval-when-compile (autoload 'riece-dialogue-mode "riece")) (defun riece-ignore-message-filter (message) - (if (and riece-ignore-enabled + (if (and (get 'riece-ignore 'riece-addon-enabled) (riece-identity-member (riece-message-speaker message) riece-ignored-user-list)) (if riece-ignore-discard-message @@ -139,13 +137,11 @@ Otherwise, they are not removed from IRC buffers, but are hidden with (defun riece-ignore-enable () (define-key riece-command-mode-map - "\C-ck" 'riece-ignore-user) - (setq riece-ignore-enabled t)) + "\C-ck" 'riece-ignore-user)) (defun riece-ignore-disable () (define-key riece-command-mode-map - "\C-ck" nil) - (setq riece-ignore-enabled nil)) + "\C-ck" nil)) (provide 'riece-ignore) diff --git a/lisp/riece-kakasi.el b/lisp/riece-kakasi.el index 0df4d69..fd018c7 100644 --- a/lisp/riece-kakasi.el +++ b/lisp/riece-kakasi.el @@ -28,8 +28,6 @@ ;;; Code: -(defvar riece-kakasi-enabled nil) - (defconst riece-kakasi-description "Convert Japanese to roman string by KAKASI.") @@ -49,7 +47,7 @@ (delete-region (point-min) (point))))) (defun riece-kakasi-message-filter (message) - (if riece-kakasi-enabled + (if (get 'riece-kakasi 'riece-addon-enabled) (riece-message-set-text message (riece-kakasi-convert-string (riece-message-text message)))) @@ -67,12 +65,10 @@ "kakasi" "-Ha" "-Ka" "-Ja" "-Ea" "-ka")) (with-current-buffer (process-buffer riece-kakasi-process) (buffer-disable-undo) - (erase-buffer)) - (setq riece-kakasi-enabled t)) + (erase-buffer))) (defun riece-kakasi-disable () - (kill-buffer (process-buffer riece-kakasi-process)) - (setq riece-kakasi-enabled nil)) + (kill-buffer (process-buffer riece-kakasi-process))) (provide 'riece-kakasi) diff --git a/lisp/riece-keyword.el b/lisp/riece-keyword.el index 20b479d..53415f6 100644 --- a/lisp/riece-keyword.el +++ b/lisp/riece-keyword.el @@ -66,15 +66,13 @@ and the matched message object." :group 'riece-highlight-faces) (defvar riece-keyword-face 'riece-keyword-face) -(defvar riece-keyword-enabled nil) - (defconst riece-keyword-description "Detect keywords in IRC buffers.") ;;; The old XEmacs package doesn't have autoload setting for regexp-opt. (autoload 'regexp-opt "regexp-opt") (defun riece-keyword-message-filter (message) - (if (and riece-keyword-enabled + (if (and (get 'riece-keyword 'riece-addon-enabled) riece-keywords ;; Ignore messages which belongs to myself. (not (riece-message-own-p message))) @@ -119,10 +117,10 @@ and the matched message object." (remove-hook 'riece-message-filter-functions 'riece-keyword-message-filter)) (defun riece-keyword-enable () - (setq riece-keyword-enabled t)) + ) (defun riece-keyword-disable () - (setq riece-keyword-enabled nil)) + ) (provide 'riece-keyword) diff --git a/lisp/riece-log.el b/lisp/riece-log.el index 5568996..6c3ae7c 100644 --- a/lisp/riece-log.el +++ b/lisp/riece-log.el @@ -89,13 +89,11 @@ It is created if there is at least one instance of Emacs running riece-log.") (defconst riece-log-file-name-regexp (concat (riece-make-interval-regexp "[0-9]" 8) "\\.txt\\(\\.\\(.*\\)\\)?$")) -(defvar riece-log-enabled nil) - (defconst riece-log-description "Save IRC logs.") (defun riece-log-display-message-function (message) - (if riece-log-enabled + (if (get 'riece-log 'riece-addon-enabled) (let* ((coding-system-for-write (if (featurep 'mule) (or riece-log-coding-system @@ -298,12 +296,10 @@ If LINES is t, insert today's logs entirely." (defvar riece-command-mode-map) (defun riece-log-enable () - (define-key riece-command-mode-map "\C-cd" 'riece-log-dired) - (setq riece-log-enabled t)) + (define-key riece-command-mode-map "\C-cd" 'riece-log-dired)) (defun riece-log-disable () - (define-key riece-command-mode-map "\C-cd" nil) - (setq riece-log-enabled nil)) + (define-key riece-command-mode-map "\C-cd" nil)) (provide 'riece-log) diff --git a/lisp/riece-lsdb.el b/lisp/riece-lsdb.el index 17ee802..cd620a8 100644 --- a/lisp/riece-lsdb.el +++ b/lisp/riece-lsdb.el @@ -42,8 +42,6 @@ (defvar riece-lsdb-cache nil) -(defvar riece-lsdb-enabled nil) - (defconst riece-lsdb-description "Help register nicknames in LSDB rolodex program.") @@ -140,15 +138,13 @@ (define-key riece-command-mode-map "\C-c\C-ll" 'riece-lsdb-display-records) (define-key riece-command-mode-map - "\C-c\C-la" 'riece-lsdb-add-user) - (setq riece-lsdb-enabled t)) + "\C-c\C-la" 'riece-lsdb-add-user)) (defun riece-lsdb-disable () (define-key riece-command-mode-map "\C-c\C-ll" nil) (define-key riece-command-mode-map - "\C-c\C-la" nil) - (setq riece-lsdb-enabled nil)) + "\C-c\C-la" nil)) (provide 'riece-lsdb) diff --git a/lisp/riece-mini.el b/lisp/riece-mini.el index 3d714d8..99d4f33 100644 --- a/lisp/riece-mini.el +++ b/lisp/riece-mini.el @@ -58,8 +58,6 @@ (defvar riece-mini-backlog-history nil) (defvar riece-mini-backlog-shown nil) -(defvar riece-mini-enabled nil) - (defconst riece-mini-description "Use Riece only on the minibuffer.") @@ -84,7 +82,7 @@ (cdr riece-mini-backlog-history))) (setq riece-mini-backlog-history (reverse (cons string (reverse riece-mini-backlog-history)))) - (when (and riece-mini-enabled + (when (and (get 'riece-mini 'riece-addon-enabled) (not (or (eq (window-buffer (selected-window)) (get-buffer riece-command-buffer)) (riece-message-own-p message) @@ -130,7 +128,7 @@ If twice (C-u C-u), then ask the channel." (resize-mini-windows t)) (setq riece-mini-backlog-shown t) (when (and (memq 'riece-biff riece-addons) - riece-biff-enabled) + (get 'riece-biff 'riece-addon-enabled)) (riece-biff-clear)) (riece-mini-message-no-log "%s" (mapconcat #'identity riece-mini-backlog-history "\n")))))) @@ -156,10 +154,10 @@ If twice (C-u C-u), then ask the channel." (remove-hook 'pre-command-hook 'riece-mini-pre-command)) (defun riece-mini-enable () - (setq riece-mini-enabled t)) + ) (defun riece-mini-disable () - (setq riece-mini-enabled nil)) + ) (provide 'riece-mini) diff --git a/lisp/riece-ndcc.el b/lisp/riece-ndcc.el index 72301f8..cd553ae 100644 --- a/lisp/riece-ndcc.el +++ b/lisp/riece-ndcc.el @@ -48,8 +48,6 @@ Only used for sending files." (defvar riece-ndcc-request-user nil) (defvar riece-ndcc-request-size nil) -(defvar riece-ndcc-enabled nil) - (defconst riece-ndcc-description "DCC file sending protocol support (written in elisp.)") @@ -196,7 +194,7 @@ Only used for sending files." (defun riece-handle-dcc-request (prefix target message) (let ((case-fold-search t)) - (when (and riece-ndcc-enabled + (when (and (get 'riece-ndcc 'riece-addon-enabled) (string-match "SEND \\([^ ]+\\) \\([^ ]+\\) \\([^ ]+\\) \\([^ ]+\\)" message)) diff --git a/lisp/riece-rdcc.el b/lisp/riece-rdcc.el index 3ff44a4..7af34af 100644 --- a/lisp/riece-rdcc.el +++ b/lisp/riece-rdcc.el @@ -102,8 +102,6 @@ end (defvar riece-rdcc-temp-file nil) (defvar riece-rdcc-received-size nil) -(defvar riece-rdcc-enabled nil) - (defconst riece-rdcc-description "DCC file sending protocol support (written in Ruby.)") @@ -305,7 +303,7 @@ end (defun riece-handle-dcc-request (prefix target message) (let ((case-fold-search t)) - (when (and riece-rdcc-enabled + (when (and (get 'riece-rdcc 'riece-addon-enabled) (string-match "SEND \\(\\([^ ]+\\)\\|\"\\(.+\\)\"\\) \\([^ ]+\\) \\([^ ]+\\) \\([^ ]+\\)" message)) @@ -362,13 +360,11 @@ end (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) - (setq riece-rdcc-enabled t)) + (define-key riece-dialogue-mode-map "\C-dr" 'riece-command-dcc-receive)) (defun riece-rdcc-disable () (define-key riece-dialogue-mode-map "\C-ds" nil) - (define-key riece-dialogue-mode-map "\C-dr" nil) - (setq riece-rdcc-enabled nil)) + (define-key riece-dialogue-mode-map "\C-dr" nil)) (provide 'riece-rdcc) diff --git a/lisp/riece-shrink-buffer.el b/lisp/riece-shrink-buffer.el index 020d06f..8fc0bfc 100644 --- a/lisp/riece-shrink-buffer.el +++ b/lisp/riece-shrink-buffer.el @@ -56,12 +56,10 @@ (defconst riece-shrink-buffer-description "Free old IRC messages to save memory usage.") -(defvar riece-shrink-buffer-enabled nil) - (defun riece-shrink-buffer-idle-timer () (let ((buffers riece-buffer-list)) (while buffers - (if (and riece-shrink-buffer-enabled + (if (and (get 'riece-shrink-buffer 'riece-addon-enabled) (buffer-live-p (car buffers)) (eq (derived-mode-class (with-current-buffer (car buffers) @@ -115,10 +113,10 @@ 'riece-shrink-buffer-exit-hook)) (defun riece-shrink-buffer-enable () - (setq riece-shrink-buffer-enabled t)) + ) (defun riece-shrink-buffer-disable () - (setq riece-shrink-buffer-enabled nil)) + ) (provide 'riece-shrink-buffer) diff --git a/lisp/riece-skk-kakutei.el b/lisp/riece-skk-kakutei.el index 6e79db9..a861c7a 100644 --- a/lisp/riece-skk-kakutei.el +++ b/lisp/riece-skk-kakutei.el @@ -29,8 +29,6 @@ (eval-when-compile (require 'riece)) -(defvar riece-skk-kakutei-enabled nil) - (defconst riece-skk-kakutei-description "Remove SKK's preedit mark before sending messages.") @@ -68,14 +66,12 @@ (defun riece-skk-kakutei-enable () (riece-define-keys riece-command-mode-map "\r" riece-skk-kakutei-command-enter-message - [(control return)] riece-skk-kakutei-command-enter-message-as-notice) - (setq riece-skk-kakutei-enabled t)) + [(control return)] riece-skk-kakutei-command-enter-message-as-notice)) (defun riece-skk-kakutei-disable () (riece-define-keys riece-command-mode-map "\r" riece-command-enter-message - [(control return)] riece-command-enter-message-as-notice) - (setq riece-skk-kakutei-enabled nil)) + [(control return)] riece-command-enter-message-as-notice)) (provide 'riece-skk-kakutei) diff --git a/lisp/riece-unread.el b/lisp/riece-unread.el index 9283cd7..f0355a9 100644 --- a/lisp/riece-unread.el +++ b/lisp/riece-unread.el @@ -69,13 +69,11 @@ (defvar riece-unread-channels nil) -(defvar riece-unread-enabled nil) - (defconst riece-unread-description "Mark channels where new messages arrived.") (defun riece-unread-after-display-message-function (message) - (if riece-unread-enabled + (if (get 'riece-unread 'riece-addon-enabled) (let ((target (if (riece-message-private-p message) (riece-message-speaker message) (riece-message-target message)))) @@ -87,20 +85,20 @@ (riece-emit-signal 'channel-list-changed))))) (defun riece-unread-after-switch-to-channel-function (last) - (if riece-unread-enabled + (if (get 'riece-unread 'riece-addon-enabled) (setq riece-unread-channels (delq (car (riece-identity-member riece-current-channel riece-unread-channels)) riece-unread-channels)))) (defun riece-unread-format-identity-for-channel-list-buffer (index identity) - (if (and riece-unread-enabled + (if (and (get 'riece-unread 'riece-addon-enabled) (riece-identity-member identity riece-unread-channels)) (concat (format "%2d:!" index) (riece-format-identity identity)))) (defun riece-unread-format-identity-for-channel-list-indicator (index identity) - (if (and riece-unread-enabled + (if (and (get 'riece-unread 'riece-addon-enabled) (riece-identity-member identity riece-unread-channels)) (let ((string (riece-format-identity identity)) (start 0)) @@ -178,8 +176,7 @@ (define-key riece-dialogue-mode-map "u" 'riece-unread-switch-to-channel) (define-key riece-channel-list-mode-map - "u" 'riece-unread-switch-to-channel) - (setq riece-unread-enabled t) + "u" 'riece-unread-switch-to-channel) (riece-emit-signal 'channel-list-changed)) (defun riece-unread-disable () @@ -189,8 +186,7 @@ "u" nil) (define-key riece-channel-list-mode-map "u" nil) - (setq riece-unread-channels nil - riece-unread-enabled nil) + (setq riece-unread-channels nil) (riece-emit-signal 'channel-list-changed)) (provide 'riece-unread) diff --git a/lisp/riece-url.el b/lisp/riece-url.el index ae96aae..9ec45f5 100644 --- a/lisp/riece-url.el +++ b/lisp/riece-url.el @@ -59,8 +59,6 @@ This maps a string \"Bug#12345\" to a URL (defvar riece-urls nil "A list of URL which appears in Riece buffers.") -(defvar riece-url-enabled nil) - (defconst riece-url-description "Collect URL in IRC buffers.") @@ -143,12 +141,10 @@ This maps a string \"Bug#12345\" to a URL '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)) + (define-key riece-dialogue-mode-map "U" 'riece-command-browse-url)) (defun riece-url-disable () - (define-key riece-dialogue-mode-map "U" nil) - (setq riece-url-enabled nil)) + (define-key riece-dialogue-mode-map "U" nil)) (provide 'riece-url) diff --git a/lisp/riece-xface.el b/lisp/riece-xface.el index f47f969..a4fd4ae 100644 --- a/lisp/riece-xface.el +++ b/lisp/riece-xface.el @@ -33,15 +33,13 @@ (require 'riece-display) (require 'riece-lsdb) -(defvar riece-xface-enabled nil) - (defconst riece-xface-description "Display X-Face in IRC buffers.") (defvar lsdb-insert-x-face-function) (defun riece-xface-update-user-list-buffer () - (if riece-xface-enabled + (if (get 'riece-xface 'riece-addon-enabled) (riece-scan-property-region 'riece-identity (point-min)(point-max) (lambda (start end) @@ -83,12 +81,10 @@ 'riece-xface-user-list-mode-hook)) (defun riece-xface-enable () - (setq riece-xface-enabled t) (if riece-current-channel (riece-emit-signal 'user-list-changed riece-current-channel))) (defun riece-xface-disable () - (setq riece-xface-enabled nil) (if riece-current-channel (riece-emit-signal 'user-list-changed riece-current-channel))) diff --git a/lisp/riece-yank.el b/lisp/riece-yank.el index 3775f50..b6a2115 100644 --- a/lisp/riece-yank.el +++ b/lisp/riece-yank.el @@ -46,18 +46,14 @@ before/after the first/last non-blank line." (defconst riece-yank-description "Enter the element of kill-ring.") -(defvar riece-yank-enabled nil) - (defun riece-yank-insinuate () ) (defvar riece-command-mode-map) (defun riece-yank-enable () - (define-key riece-command-mode-map "\C-cy" 'riece-command-yank) - (setq riece-yank-enabled t)) + (define-key riece-command-mode-map "\C-cy" 'riece-command-yank)) (defun riece-yank-disable () - (define-key riece-command-mode-map "\C-cy" 'undefined) - (setq riece-yank-enabled nil)) + (define-key riece-command-mode-map "\C-cy" 'undefined)) (defun riece-yank-strip-space (string) (with-temp-buffer