X-Git-Url: http://cgit.sxemacs.org/?a=blobdiff_plain;f=lisp%2Friece-addon.el;h=9dd1947c0bd1f4255884b6fd0afb1469ceb051ec;hb=e92eb770a18750a405dbcdfb6ab6f3320f082e8c;hp=5ff64ed315b3606b910990a6a1ea03000b8c74a3;hpb=2ab33ab15fea7f999d738bded402898995fd32b0;p=riece diff --git a/lisp/riece-addon.el b/lisp/riece-addon.el index 5ff64ed..9dd1947 100644 --- a/lisp/riece-addon.el +++ b/lisp/riece-addon.el @@ -107,7 +107,7 @@ :group 'riece-addon-list) (defcustom riece-addon-list-font-lock-keywords - '(("^\\([-+! ] [^:]+\\): \\(.*\\)" + '(("^\\([-+!? ] \\S-+\\)\\s-+\\(.*\\)" (1 (cdr (assq (aref (match-string 1) 0) riece-addon-list-mark-face-alist))) (2 riece-addon-list-description-face))) @@ -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)) - (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,18 +362,19 @@ 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 %S: %s\n" + (insert (format "%c %-15S %s\n" (if (not (featurep (car (car pointer)))) ? (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)) @@ -375,17 +384,20 @@ All normal editing commands are turned off." (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 is not insinuated. - The add-on is not loaded. + + 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. ") (insert (substitute-command-keys " Useful keys: - `\\[riece-command-enable-addon]' to enable the current add-on. - `\\[riece-command-disable-addon]' to disable the current add-on. + `\\[riece-command-enable-addon]' to enable the current add-on. + `\\[riece-command-disable-addon]' to disable the current add-on. + `\\[riece-command-insinuate-addon]' to insinuate the add-on. + `\\[riece-command-uninstall-addon]' to uninstall the current add-on. + `\\[riece-command-unload-addon]' to unload the current add-on. ")) (goto-char (point-min)) (pop-to-buffer (current-buffer)) @@ -456,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)))