From 6f38f33d87c13e401686756d4612071d17d6cf2a Mon Sep 17 00:00:00 2001 From: ueno Date: Fri, 30 May 2003 20:13:38 +0000 Subject: [PATCH] * Riece: Version 0.0.2 released. * riece-version.el (riece-version-number): Bump up to 0.0.2. * riece.el (riece-load-and-build-addon-dependencies): Fixed. * riece-url.el (riece-url-requires): Don't assert dependency on riece-highlight unless it appears in riece-addons. --- lisp/ChangeLog | 7 +++++++ lisp/riece-url.el | 19 ++++++++++++++----- lisp/riece-version.el | 2 +- lisp/riece.el | 42 +++++++++++++++++++++++++++--------------- 4 files changed, 49 insertions(+), 21 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bcccf99..ff9f01a 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,5 +1,12 @@ 2003-05-30 Daiki Ueno + * Riece: Version 0.0.2 released. + * riece-version.el (riece-version-number): Bump up to 0.0.2. + + * riece.el (riece-load-and-build-addon-dependencies): Fixed. + * riece-url.el (riece-url-requires): Don't assert dependency on + riece-highlight unless it appears in riece-addons. + * riece-url.el: New add-on. * COMPILE (riece-modules): Add riece-url. diff --git a/lisp/riece-url.el b/lisp/riece-url.el index 105098d..191bce5 100644 --- a/lisp/riece-url.el +++ b/lisp/riece-url.el @@ -22,8 +22,15 @@ ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, ;; Boston, MA 02111-1307, USA. +;;; Commentary: + +;; To use, add the following line to your ~/.riece/init.el: +;; (add-to-list 'riece-addons 'riece-url) + ;;; Code: +(require 'riece-options) + (defvar browse-url-browser-function) (defgroup riece-url nil @@ -40,13 +47,14 @@ (autoload 'widget-convert-button "wid-edit") -(defun riece-url-add-buttons (start end) +(defun riece-url-scan-region (start end) (save-excursion (goto-char start) (while (re-search-forward riece-url-regexp end t) (let ((url (match-string 0))) - (widget-convert-button - 'url-link (match-beginning 0) (match-end 0) url) + (if (memq 'riece-highlight riece-addons) + (widget-convert-button + 'url-link (match-beginning 0) (match-end 0) url)) (unless (member url riece-urls) (setq riece-urls (cons url riece-urls))))))) @@ -58,10 +66,11 @@ (defvar riece-dialogue-mode-map) (defun riece-url-requires () - '(riece-highlight)) + (if (memq 'riece-highlight riece-addons) + '(riece-highlight))) (defun riece-url-insinuate () - (add-hook 'riece-after-insert-functions 'riece-url-add-buttons) + (add-hook 'riece-after-insert-functions 'riece-url-scan-region) (define-key riece-dialogue-mode-map "U" 'riece-command-browse-url)) (provide 'riece-url) diff --git a/lisp/riece-version.el b/lisp/riece-version.el index ecab4ff..b4bdc32 100644 --- a/lisp/riece-version.el +++ b/lisp/riece-version.el @@ -48,7 +48,7 @@ string, be sure to use a valid format, see RFC 2616." (defconst riece-product-name "Riece") -(defconst riece-version-number "0.0.1" +(defconst riece-version-number "0.0.2" "Version number for this version of Riece.") (defconst riece-version (format "Riece v%s" riece-version-number) diff --git a/lisp/riece.el b/lisp/riece.el index 5236676..bfa411f 100644 --- a/lisp/riece.el +++ b/lisp/riece.el @@ -417,32 +417,44 @@ Instead, these commands are available: (defun riece-load-and-build-addon-dependencies (addons) (let ((load-path (cons riece-addon-directory load-path)) - dependencies) + dependencies + pointer) (while addons (require (car addons)) ;error will be reported here (let* ((requires - (funcall (or (intern-soft (concat (symbol-name (car addons)) - "-requires")) + (funcall (or (intern-soft + (concat (symbol-name (car addons)) "-requires")) #'ignore))) (pointer requires) entry) + ;; Increment succs' pred count. + (if (setq entry (assq (car addons) dependencies)) + (setcar (cdr entry) (+ (length requires) (nth 1 entry))) + (setq dependencies (cons (list (car addons) (length requires)) + dependencies))) + ;; Merge pred's succs. (while pointer (if (setq entry (assq (car pointer) dependencies)) - (setcar (cdr entry) (1+ (nth 1 entry))) - (setq dependencies (cons (list (car pointer) 1 nil) + (setcdr (cdr entry) + (cons (car addons) (nthcdr 2 entry))) + (setq dependencies (cons (list (car pointer) 0 (car addons)) dependencies))) - (setq pointer (cdr pointer))) - (if (setq entry (assq (car addons) dependencies)) - (setcar (nthcdr 2 entry) requires) - (setq dependencies (cons (list (car addons) 0 requires) - dependencies)))) + (setq pointer (cdr pointer)))) (setq addons (cdr addons))) dependencies)) (defun riece-insinuate-addons (addons) - (let* ((dependencies (riece-load-and-build-addon-dependencies addons)) - (pointer dependencies) - queue) + (let ((pointer addons) + dependencies queue) + ;; Uniquify, first. + (while pointer + (if (memq (car pointer) (cdr pointer)) + (setcar pointer nil)) + (setq pointer (cdr pointer))) + (setq dependencies (riece-load-and-build-addon-dependencies + (delq nil addons)) + pointer dependencies) + ;; Sort them. (while pointer (if (zerop (nth 1 (car pointer))) (setq dependencies (delq (car pointer) dependencies) @@ -451,7 +463,7 @@ Instead, these commands are available: (setq addons nil) (while queue (setq addons (cons (car (car queue)) addons) - pointer (nth 2 (car queue))) + pointer (nthcdr 2 (car queue))) (while pointer (let* ((entry (assq (car pointer) dependencies)) (count (1- (nth 1 entry)))) @@ -463,7 +475,7 @@ Instead, these commands are available: (setq pointer (cdr pointer))) (setq queue (cdr queue))) (if dependencies - (error "Circular dependency found")) + (error "Circular add-on dependency found")) (while addons (require (car addons)) ;implicit dependency (funcall (intern (concat (symbol-name (car addons)) "-insinuate"))) -- 1.7.10.4