From: ueno Date: Fri, 21 May 2004 06:25:15 +0000 (+0000) Subject: * riece-ctcp.el (riece-ctcp-enable): Fixed typo. X-Git-Tag: riece-1_0_0~34 X-Git-Url: http://git.chise.org/gitweb/?a=commitdiff_plain;h=10a3ce8048d3ce1946892aaa3d5c1f836b4107b3;p=elisp%2Friece.git * riece-ctcp.el (riece-ctcp-enable): Fixed typo. * riece-addon.el (riece-addon-list-mode-map): New keymap. (riece-addon-list-mode): New function. (riece-command-list-addons): New command. (riece-command-enable-addon): New command. (riece-command-disable-addon): New command. (riece-disable-addon): Fixed typo. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 87d8b4e..8cd72ae 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,16 @@ 2004-05-21 Daiki Ueno + * riece-ctcp.el (riece-ctcp-enable): Fixed typo. + + * riece-addon.el (riece-addon-list-mode-map): New keymap. + (riece-addon-list-mode): New function. + (riece-command-list-addons): New command. + (riece-command-enable-addon): New command. + (riece-command-disable-addon): New command. + (riece-disable-addon): Fixed typo. + +2004-05-21 Daiki Ueno + * riece-mini.el (riece-mini-enabled): New flag. (riece-mini-display-message-function): Check riece-mini-enabled. (riece-mini-enable): New function. diff --git a/lisp/riece-addon.el b/lisp/riece-addon.el index 6ad7f7f..33b9bb4 100644 --- a/lisp/riece-addon.el +++ b/lisp/riece-addon.el @@ -24,6 +24,12 @@ ;;; Code: +(defvar riece-addon-list-mode-map + (let ((keymap (make-sparse-keymap))) + (define-key keymap "+" 'riece-command-enable-addon) + (define-key keymap "-" 'riece-command-disable-addon) + keymap)) + (defun riece-load-and-build-addon-dependencies (addons) (let ((load-path (cons riece-addon-directory load-path)) dependencies) @@ -111,12 +117,99 @@ (message "Add-on %S doesn't support enable/disable" addon)) (if (symbol-value enabled) (progn - (funcall (intern (concat (symbol-name (car addons)) "-disable"))) + (funcall (intern (concat (symbol-name addon) "-disable"))) (if riece-debug - (message "Add-on %S disabled" (car addons)))) + (message "Add-on %S disabled" addon))) (if riece-debug (message "Can't disable add-on %S" addon)))))) +(defun riece-addon-list-mode () + "Major mode for displaying addon list. +All normal editing commands are turned off." + (kill-all-local-variables) + (buffer-disable-undo) + (setq major-mode 'riece-addon-list-mode + mode-name "AddOns" + mode-line-buffer-identification + (riece-mode-line-buffer-identification '("Riece: ")) + truncate-lines t + buffer-read-only t) + (use-local-map riece-addon-list-mode-map) + (run-hooks 'riece-addon-list-mode-hook)) + +(defun riece-command-list-addons () + (interactive) + (save-excursion + (set-buffer (riece-get-buffer-create "*AddOns*" 'riece-addon-list-mode)) + (riece-addon-list-mode) + (let ((inhibit-read-only t) + buffer-read-only + (pointer riece-addons) + enabled description point) + (erase-buffer) + (riece-kill-all-overlays) + (while pointer + (setq enabled (intern-soft (concat (symbol-name (car pointer)) + "-enabled")) + description (intern-soft (concat (symbol-name (car pointer)) + "-description"))) + (setq point (point)) + (insert (format "%c %S: %s\n" + (if (not (featurep (car pointer))) + ?? + (if (null enabled) + ?= + (if (symbol-value enabled) + ?+ + ?-))) + (car pointer) + (if description + (symbol-value description) + "no description"))) + (put-text-property point (point) 'riece-addon (car pointer)) + (setq pointer (cdr pointer))) + (insert " +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 status is not known. +")) + (pop-to-buffer (current-buffer)))) + +(defun riece-command-enable-addon (addon) + (interactive + (list + (or (if (eq major-mode 'riece-addon-list-mode) + (get-text-property (point) 'riece-addon)) + (completing-read "Add-on: " + (mapcar #'list riece-addons) + (lambda (pointer) + (setq enabled (intern-soft (concat (car pointer) + "-enabled"))) + (and enabled + (null (symbol-value enabled)))) + t)))) + (riece-enable-addon addon) + (riece-command-list-addons)) + +(defun riece-command-disable-addon (addon) + (interactive + (list + (or (if (eq major-mode 'riece-addon-list-mode) + (get-text-property (point) 'riece-addon)) + (completing-read "Add-on: " + (mapcar #'list riece-addons) + (lambda (pointer) + (setq enabled (intern-soft (concat (car pointer) + "-enabled"))) + (and enabled + (symbol-value enabled))) + t)))) + (riece-disable-addon addon) + (riece-command-list-addons)) + (provide 'riece-addon) ;;; riece-addon.el ends here diff --git a/lisp/riece-ctcp.el b/lisp/riece-ctcp.el index 79d64ba..b3bec43 100644 --- a/lisp/riece-ctcp.el +++ b/lisp/riece-ctcp.el @@ -347,7 +347,7 @@ (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) - (setq riece-ctcp-enable t)) + (setq riece-ctcp-enabled t)) (defun riece-ctcp-disable () (define-key riece-dialogue-mode-map "\C-cv" nil)