From 120f9bfa9a0faaf574c437150786f164a3d69b6f Mon Sep 17 00:00:00 2001 From: ueno Date: Thu, 25 Aug 2005 09:35:40 +0000 Subject: [PATCH] * riece-addon.el (riece-uninstall-addon): New function. --- lisp/ChangeLog | 1 + lisp/riece-addon.el | 26 +++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 08cc76d..16746a2 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -4,6 +4,7 @@ riece-addon-dependencies instead of riece-addons. (riece-command-enable-addon): Ditto. (riece-command-disable-addon): Ditto. + (riece-uninstall-addon): New function. 2005-08-25 Daiki Ueno diff --git a/lisp/riece-addon.el b/lisp/riece-addon.el index 2f35d5b..68a99b9 100644 --- a/lisp/riece-addon.el +++ b/lisp/riece-addon.el @@ -196,12 +196,36 @@ (defun riece-insinuate-addon (addon &optional verbose) (if (get addon 'riece-addon-insinuated) (if verbose - (message "Add-on %S is alread insinuated" addon)) + (message "Add-on %S is already insinuated" addon)) (funcall (intern (concat (symbol-name addon) "-insinuate"))) (put addon 'riece-addon-insinuated t) (if verbose (message "Add-on %S is insinuated" addon)))) +(defun riece-uninstall-addon (addon &optional verbose) + (if (not (get addon 'riece-addon-insinuated)) + (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")))) + (if entry + (if (cdr entry) + (if (= (length (cdr entry)) 1) + (error "%S depends %S" (car (cdr entry)) addon) + (error "%s depends %S" (mapconcat #'identity (cdr entry) ",") + addon)) + (if (and enabled + (symbol-value enabled)) + (riece-disable-addon addon verbose)) + (funcall (or (intern-soft (concat (symbol-name addon) + "-uninstall")) + #'ignore)) + (setq riece-addon-dependencies + (delq entry riece-addon-dependencies)) + (put addon 'riece-addon-insinuated nil))) + (if verbose + (message "Add-on %S is uninstalled" addon))))) + (defun riece-enable-addon (addon &optional verbose) (let ((enabled (intern-soft (concat (symbol-name addon) "-enabled")))) (if (null enabled) -- 1.7.10.4