[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Bug-mit-scheme] imail summary not displaying sender
From: |
Taylor R Campbell |
Subject: |
Re: [Bug-mit-scheme] imail summary not displaying sender |
Date: |
Sun, 31 Aug 2008 18:13:49 -0400 |
User-agent: |
IMAIL/1.21; Edwin/3.116; MIT-Scheme/7.7.90.+ |
Date: Sun, 31 Aug 2008 15:02:08 -0400
From: Julie Sussman <address@hidden>
In messages that are
From: address@hidden ()
no sender is displayed in the imail summary.
I have no idea why the empty parens are there, but it looks as
if they're indicating a blank sender to display?
There is a pile of regexp kludgery to extract the name. It accepted
an empty name in the parenthesis. I've changed it to require a
non-empty name there. Probably it should do the actual tokenization
and require non-whitespace parenthesis contents, but for now, here's a
patch that you can evaluate with `C-x C-e':
((lambda (expression)
(eval expression (->environment '(edwin imail front-end summary))))
'(define (message-summary-from-string message)
(let* ((s
(decorated-string-append
"" " " ""
(map string-trim
(string->lines
(or (get-first-header-field-value message "from" #f) "")))))
(field (lambda (n) (lambda (regs) (re-match-extract s regs n)))))
(cond ((re-string-search-forward "[ \t\"]*\\<\\(.*\\)\\>[\" \t]*<.*>" s)
=> (field 1))
;; Chris VanHaren (Athena User Consultant) <vanharen>
((re-string-search-forward "[ \t\"]*\\<\\(.*\\)\\>.*(.*).*<.*>.*" s)
=> (field 1))
((re-string-search-forward ".*(\\(.+\\))" s) ; The + was a *.
=> (field 1))
((re-string-search-forward ".*<\\(.*\\)>.*" s)
=> (field 1))
((re-string-search-forward " *\\<\\(.*\\)\\> *" s)
=> (field 1))
(else s)))))