* riece-addon.el (riece-addon-list-mode-map): Bind riece-command-insinuate-addon...
authorueno <ueno>
Fri, 26 Aug 2005 06:29:03 +0000 (06:29 +0000)
committerueno <ueno>
Fri, 26 Aug 2005 06:29:03 +0000 (06:29 +0000)
(riece-insinuate-addon): Rebuild riece-addon-dependencies.
(riece-command-insinuate-addon): New command.
(riece-command-uninstall-addon): New command.

lisp/ChangeLog
lisp/riece-addon.el

index b64b161..03ef591 100644 (file)
@@ -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.
index ecf476d..168b858 100644 (file)
   (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)
    (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