X-Git-Url: http://cgit.sxemacs.org/?a=blobdiff_plain;f=lisp%2Friece-addon.el;h=9dd1947c0bd1f4255884b6fd0afb1469ceb051ec;hb=e92eb770a18750a405dbcdfb6ab6f3320f082e8c;hp=fb5022a2d35e34d2060b1bab88bb4d2adcb8372e;hpb=ef0319955ba65f02a02fcb065b4267639762bb34;p=riece diff --git a/lisp/riece-addon.el b/lisp/riece-addon.el index fb5022a..9dd1947 100644 --- a/lisp/riece-addon.el +++ b/lisp/riece-addon.el @@ -227,20 +227,29 @@ riece-addon-dependencies (riece-resolve-addons (cons addon (mapcar #'car riece-addon-dependencies))))) - (let ((pointer riece-addon-dependencies)) + (let ((pointer riece-addon-dependencies) + addons) (while pointer (unless (get (car (car pointer)) 'riece-addon-insinuated) - (riece-insinuate-addon-1 (car (car pointer)) verbose)) + (setq addons (cons (car (car pointer)) addons))) (if (eq (car (car pointer)) addon) (setq pointer nil) - (setq pointer (cdr pointer)))))) + (setq pointer (cdr pointer)))) + (setq addons (nreverse addons)) + (if (and (> (length addons) 1) + (eq verbose 'ask) + (not (y-or-n-p (format "%s will be insinuated. Continue?" + (mapconcat #'symbol-name addons ", "))))) + (error "Insinuate operation was cancelled")) + (while addons + (riece-insinuate-addon-1 (car addons) verbose) + (setq addons (cdr addons))))) (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"))) (uninstall (intern-soft (concat (symbol-name addon) "-uninstall")))) (if entry (if (cdr entry) @@ -249,16 +258,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 +276,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 +336,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 +362,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 +371,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 +386,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: @@ -459,7 +468,7 @@ Useful keys: (lambda (pointer) (not (get (car pointer) 'riece-addon-insinuated))) t))))) - (riece-insinuate-addon addon t) + (riece-insinuate-addon addon 'ask) (when (eq major-mode 'riece-addon-list-mode) (riece-command-list-addons) (riece-addon-list-set-point addon)))