From: ueno Date: Mon, 22 Nov 2004 01:07:15 +0000 (+0000) Subject: * test/test-riece-alias.el (test-riece-alias-alist-1): New test case. X-Git-Tag: riece-1_0_6~29 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c7997a04b97e1ce5b42d431f159ded97e7f56b9d;p=elisp%2Friece.git * test/test-riece-alias.el (test-riece-alias-alist-1): New test case. (test-riece-alias-alist-2): New test case. * riece-alias.el (riece-alias-abbrev-identity-string): Fixed riece-alias-alist handling. (riece-alias-expand-identity-string): Ditto. --- diff --git a/lisp/ChangeLog b/lisp/ChangeLog index e90ab81..1afb87f 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,12 @@ +2004-11-22 Daiki Ueno + + * test/test-riece-alias.el (test-riece-alias-alist-1): New test case. + (test-riece-alias-alist-2): New test case. + + * riece-alias.el (riece-alias-abbrev-identity-string): Fixed + riece-alias-alist handling. + (riece-alias-expand-identity-string): Ditto. + 2004-11-21 Daiki Ueno * riece-options.el (riece-shrink-buffer-remove-lines): New user option. diff --git a/lisp/riece-alias.el b/lisp/riece-alias.el index 81362e7..d94ae85 100644 --- a/lisp/riece-alias.el +++ b/lisp/riece-alias.el @@ -138,25 +138,25 @@ (if riece-alias-alternate-separator (setq string (riece-alias-abbrev-alternate-separator string))) (let ((alist riece-alias-alist)) - (catch 'done - (while alist - (if (equal (car (car alist)) string) - (throw 'done (cdr (car alist)))) - (setq alist (cdr alist))) - string))) + (while alist + (if (equal (car (car alist)) string) + (setq string (cdr (car alist)) + alist nil) + (setq alist (cdr alist))))) + string) (defun riece-alias-expand-identity-string (string) (let ((alist riece-alias-alist)) - (catch 'done - (while alist - (if (equal (cdr (car alist)) string) - (throw 'done (car (car alist)))) - (setq alist (cdr alist))) - string)) + (while alist + (if (equal (cdr (car alist)) string) + (setq string (car (car alist)) + alist nil) + (setq alist (cdr alist))))) (if riece-alias-alternate-separator (setq string (riece-alias-expand-alternate-separator string))) (if riece-alias-enable-percent-hack - (setq string (riece-alias-expand-percent-hack string)))) + (setq string (riece-alias-expand-percent-hack string))) + string) (defun riece-alias-insinuate () ) diff --git a/lisp/test/test-riece-alias.el b/lisp/test/test-riece-alias.el index b9e363d..a2da219 100644 --- a/lisp/test/test-riece-alias.el +++ b/lisp/test/test-riece-alias.el @@ -13,6 +13,29 @@ (riece-alias-expand-percent-hack "%riece") "#riece:*.jp")))) +(luna-define-method test-riece-alias-alist-1 ((case test-riece-alias)) + (let ((riece-alias-alist '(("#riece" . "#r")))) + (lunit-assert + (equal + (riece-alias-abbrev-identity-string "#riece") + "#r")) + (lunit-assert + (equal + (riece-alias-expand-identity-string "#r") + "#riece")))) + +(luna-define-method test-riece-alias-alist-2 ((case test-riece-alias)) + (let ((riece-alias-alist '(("%riece" . "%r"))) + (riece-alias-percent-hack-mask "*.jp")) + (lunit-assert + (equal + (riece-alias-abbrev-identity-string "#riece:*.jp") + "%r")) + (lunit-assert + (equal + (riece-alias-expand-identity-string "%r") + "#riece:*.jp")))) + (luna-define-method test-riece-alias-altsep-1 ((case test-riece-alias)) (let ((riece-alias-alternate-separator "@")) (lunit-assert