From: ueno Date: Fri, 26 Aug 2005 06:29:03 +0000 (+0000) Subject: * riece-addon.el (riece-addon-list-mode-map): Bind riece-command-insinuate-addon... X-Git-Tag: channel-coding-branchpoint~64 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=247595957325933a53365c56b3de24c21d9128ed;p=elisp%2Friece.git * riece-addon.el (riece-addon-list-mode-map): Bind riece-command-insinuate-addon and riece-command-uninstall-addon. (riece-insinuate-addon): Rebuild riece-addon-dependencies. (riece-command-insinuate-addon): New command. (riece-command-uninstall-addon): New command. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index b64b161..03ef591 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -3,6 +3,11 @@ * riece-addon.el: Require 'riece-addon-modules. (riece-command-list-addons): List all available add-ons from riece-addon-modules. + (riece-addon-list-mode-map): Bind riece-command-insinuate-addon + and riece-command-uninstall-addon. + (riece-insinuate-addon): Rebuild riece-addon-dependencies. + (riece-command-insinuate-addon): New command. + (riece-command-uninstall-addon): New command. * COMPILE (riece-examine-modules): New function. (riece-examine): Use it. diff --git a/lisp/riece-addon.el b/lisp/riece-addon.el index ecf476d..168b858 100644 --- a/lisp/riece-addon.el +++ b/lisp/riece-addon.el @@ -111,6 +111,8 @@ (let ((keymap (make-sparse-keymap))) (define-key keymap "+" 'riece-command-enable-addon) (define-key keymap "-" 'riece-command-disable-addon) + (define-key keymap "I" 'riece-command-insinuate-addon) + (define-key keymap "D" 'riece-command-uninstall-addon) (define-key keymap "n" 'next-line) (define-key keymap "p" 'previous-line) (define-key keymap " " 'scroll-up) @@ -195,6 +197,11 @@ (riece-load-and-build-addon-dependencies addons))) (defun riece-insinuate-addon (addon &optional verbose) + (unless (assq addon riece-addon-dependencies) + (setq riece-addon-dependencies (riece-resolve-addons + (cons addon + (mapcar #'car + riece-addon-dependencies))))) (if (get addon 'riece-addon-insinuated) (if verbose (message "Add-on %S is already insinuated" addon)) @@ -396,6 +403,50 @@ Useful keys: (if point (goto-char point))))) +(defun riece-command-insinuate-addon (addon) + (interactive + (list + (or (if (eq major-mode 'riece-addon-list-mode) + (get-text-property (point) 'riece-addon)) + (intern-soft + (completing-read "Add-on: " + (mapcar (lambda (dependency) + (list (symbol-name (car dependency)))) + riece-addon-modules) + (lambda (pointer) + (get (car pointer) 'riece-addon-insinuated)) + t))))) + (riece-insinuate-addon addon t) + (when (eq major-mode 'riece-addon-list-mode) + (riece-command-list-addons) + (let ((point (point-min))) + (while (and (not (eq (get-text-property point 'riece-addon) addon)) + (setq point (next-single-property-change point + 'riece-addon)))) + (if point + (goto-char point))))) + +(defun riece-command-uninstall-addon (addon) + (interactive + (list + (or (if (eq major-mode 'riece-addon-list-mode) + (get-text-property (point) 'riece-addon)) + (intern-soft + (completing-read "Add-on: " + (mapcar (lambda (dependency) + (list (symbol-name (car dependency)))) + riece-addon-dependencies) + nil t))))) + (riece-uninstall-addon addon t) + (when (eq major-mode 'riece-addon-list-mode) + (riece-command-list-addons) + (let ((point (point-min))) + (while (and (not (eq (get-text-property point 'riece-addon) addon)) + (setq point (next-single-property-change point + 'riece-addon)))) + (if point + (goto-char point))))) + (provide 'riece-addon) ;;; riece-addon.el ends here