[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: problems with splitting and imap
From: |
Richard Riley |
Subject: |
Re: problems with splitting and imap |
Date: |
Thu, 23 Jul 2009 19:01:46 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/23.0.91 (gnu/linux) |
Ted Zlatanov <tzz@lifelogs.com> writes:
> You can catch the offender by redefining rfc822.el functions. This is
> rfc822-addresses:
>
> (defun rfc822-addresses (header-text)
> (if (string-match "\\`[ \t]*\\([^][\000-\037 ()<>@,;:\\\".]+\\)[ \t]*\\'"
> header-text)
> ;; Make very simple case moderately fast.
> (list (substring header-text (match-beginning 1) (match-end 1)))
> (let ((buf (generate-new-buffer " rfc822")))
> (unwind-protect
> (save-excursion
> (set-buffer buf)
> (make-local-variable 'case-fold-search)
> (setq case-fold-search nil) ;For speed(?)
> (insert header-text)
> ;; unfold continuation lines
> (goto-char (point-min))
>
> (while (re-search-forward "\\([^\\]\\(\\\\\\\\\\)*\\)\n[ \t]" nil t)
> (replace-match "\\1 " t))
>
> (goto-char (point-min))
> (let ((list ())
> tem
> ;; This is for rfc822-bad-address. Give it a non-nil
> ;; initial value to prevent rfc822-bad-address from
> ;; raising a wrong-type-argument error
> (rfc822-address-start (point)))
> (catch 'address ; this is for rfc822-bad-address
> (rfc822-nuke-whitespace)
> (while (not (eobp))
> (setq rfc822-address-start (point))
> (setq tem
> (cond ((rfc822-looking-at ?\,)
> nil)
> ((looking-at "[][\000-\037@;:\\.>)]")
> (debug "list so far %s, remaining text %s" list
> (buffer-substring (point) (point-max)) ; *** debug ***
> (forward-char)
> (rfc822-bad-address
> (format "Strange character \\%c found"
> (preceding-char))))
> (t
> (rfc822-addresses-1 t))))
> (cond ((null tem))
> ((stringp tem)
> (setq list (cons tem list)))
> (t
> (setq list (nconc (nreverse tem) list)))))
> (nreverse list))))
> (and buf (kill-buffer buf))))))
>
> Note the single debug statement I inserted. Hit `C-x C-e' after the
> last parenthesis to use this function; copy it into the *scratch* buffer
> to keep playing with it.
Unfortunately I get the following when I evaluate it:
,----
| Debugger entered--Lisp error: (void-variable header-text)
| (string-match "\\`[ ]*\\([^][