>>>>> Richard Stanton writes:

RS> Hi Martin.
RS> A couple of things:

RS> 1) What does sc-consult actually do? I have it in my
RS>    sc-preferred-attribution-list:

RS> (setq sc-preferred-attribution-list
RS>       '("sc-lastchoice"
RS>     "x-attribution"
RS>     "sc-consult"
RS>     "bbdb-attribution"
RS>     "initials"
RS>     "firstname"
RS>     "lastname"))

a small clip from the info page:

`"sc-consult"'
     consults the customizable list `sc-attrib-selection-list' which can
     be used to select special attributions based on the value of any
     info key.  See below for details.

The value `"sc-consult"' in `sc-preferred-attribution-list' has a
special meaning during attribution selection.  When Supercite encounters
this preference, it begins processing a customizable list of
attributions, contained in the variable `sc-attrib-selection-list'.
Each element in this list contains lists of the following form:

     (INFOKEY ((REGEXP . ATTRIBUTION)
              (REGEXP . ATTRIBUTION)
              (...)))

where INFOKEY is a key for `sc-mail-field' and REGEXP is a regular
expression to match against the INFOKEY's value. If REGEXP matches the
INFOKEY's value, the ATTRIBUTION is used as the attribution string.
Actually, ATTRIBUTION can be a string or a list; if it is a list, it is
`eval'uated and the return value (which must be a string), is used as
the attribution.

This can be very useful for when you are replying to net acquaintances
who do not use the `X-Attribution:' mail header.  You may know what
nickname they would prefer to use, and you can set up this list to match
against a specific mail field, e.g., `From:', allowing you to cite your
friend's message with the appropriate attribution.

-- end quote
and from a posting from supercite list:

(setq sc-attrib-selection-list
      '(("From"  (("Jonathan Foobar"          . "Fooboy")
                  ("[EMAIL PROTECTED]"      . "Jamboy")
                  ("Defunkt Products Support" . "Helpdroid")
                  ("[EMAIL PROTECTED]"   . "Eric")
                  ("tstanford"                . "MyBoss")
                  ))
        )) 

RS> but I notice that it's not in the one you posted.

right, i'm not using that (yet). Thus, question i put was if
the interface used for getting attributions from bbdb should use
the "sc-consult" plus sc-attrib-selection-list instead of the
somewhat crummy current design.

>>>>> Regarding Re: BBDB and SUPERCITE ... bugfix,  I wrote:

rhs> [ ... ]  For example, suppose my default attribution is initials,
rhs> and I have a BBDB entry with the person's name in it. When I
rhs> reply and use supercite, if the message didn't contain the
rhs> sender's name, it suggests rubbish as the initials. It seems to
rhs> me it would make sense that, if there isn't a name in the
rhs> message, SC should consult BBDB to see if it can help provide a
rhs> name.

seems like a good idea, why not use the database if it there.

RS> The code as it currently stands doesn't do this. 

Below is a first hack at doing this .... i do not like do muck around
within supercite this way. If somebody has a better way (== cleaner)
for adding a faked from entry to sc-mail-info without changing
sc-mail-glom-fram (notice that this has to be during the end of
process since we need the from e-mail for lookup in BBDB).


(setq sc-mail-glom-frame
  '((begin                        (setq sc-mail-headers-start (point)))
    ("^x-attribution:[ \t]+.*$"   (sc-mail-fetch-field t) nil t)
    ("^\\S +:.*$"                 (sc-mail-fetch-field) nil t)
    ("^$"                         (bbdb/supercite-default))
    ("^[ \t]+"                    (sc-mail-append-field))
    (sc-mail-warn-if-non-rfc822-p (sc-mail-error-in-mail-field))
    (end                          (setq sc-mail-headers-end (point)))))

(defun bbdb/supercite-default ()
  "If the current \"from\" field in sc-mail-info alist 
contains only an e-mail address, lookup e-mail address in
BBDB, and prepend a new \"from\" field to sc-mail-info."
  (let* ((from   (sc-mail-field "from"))
         (pair   (and from (mail-extract-address-components from))))
    (if (and pair (not (car pair)))
        (let* ((record (bbdb-annotate-message-sender from nil nil nil))
               (name   (and record (bbdb-record-name record))))
          (if name        
              (setq sc-mail-info 
                    (cons (cons "from" 
                                (format "%s (%s)" (car (cdr pair)) name))
                          sc-mail-info))))))
  (list 'abort '(step . 0)))
--
Martin Sj\"olin | http://www.ida.liu.se/labs/iislab/people/marsj
Department of Computer Science, LiTH, S-581 83 Link\"oping, SWEDEN 
phone : +46 13 28 24 10 | fax : +46 13 28 26 66 | e-mail: [EMAIL PROTECTED] 

Reply via email to