From c7997a04b97e1ce5b42d431f159ded97e7f56b9d Mon Sep 17 00:00:00 2001 From: ueno Date: Mon, 22 Nov 2004 01:07:15 +0000 Subject: [PATCH] * 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. --- lisp/ChangeLog | 9 +++++++++ lisp/riece-alias.el | 26 +++++++++++++------------- lisp/test/test-riece-alias.el | 23 +++++++++++++++++++++++ 3 files changed, 45 insertions(+), 13 deletions(-) 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 -- 1.7.10.4