From f678c05c1778dfd649276c44f0772aecaf99c4be Mon Sep 17 00:00:00 2001 From: morioka Date: Fri, 16 Aug 1996 05:57:27 +0000 Subject: [PATCH] (rfc822/analyze-domain-literal): New implementation. --- tl-822.el | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/tl-822.el b/tl-822.el index 7a5e164..cdd5c67 100644 --- a/tl-822.el +++ b/tl-822.el @@ -29,7 +29,7 @@ (defconst rfc822/RCS-ID - "$Id: tl-822.el,v 7.33 1996-08-16 05:44:47 morioka Exp $") + "$Id: tl-822.el,v 7.34 1996-08-16 05:57:27 morioka Exp $") (defconst rfc822/version (get-version-string rfc822/RCS-ID)) @@ -227,7 +227,7 @@ (defconst rfc822/space-chars " \t\n") (defconst rfc822/non-atom-chars (concat rfc822/special-chars rfc822/space-chars)) -(defconst rfc822/non-dtext-chars "[]") +(defconst rfc822/non-dtext-chars "][") (defconst rfc822/non-ctext-chars "()") (defun rfc822/analyze-spaces (str) @@ -291,22 +291,16 @@ (defun rfc822/analyze-domain-literal (str) (if (and (> (length str) 0) - (eq (elt str 0) ?\[) + (eq (aref str 0) ?\[) ) - (let* ((i (position-mismatched - (function - (lambda (elt) - (not (find elt rfc822/non-dtext-chars)) - )) - (setq str (substring str 1)) - )) - (rest (substring str i)) + (let* ((i (string-match (concat "[" rfc822/non-dtext-chars "]") str 1)) + (rest (and i (substring str i))) ) - (if (and (> i 0) + (if (and i (> (length rest) 0) - (eq (elt rest 0) ?\]) + (eq (aref rest 0) ?\]) ) - (cons (cons 'domain-literal (substring str 0 i)) + (cons (cons 'domain-literal (substring str 1 i)) (substring rest 1) ) )))) -- 1.7.10.4