From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.io/gmane.emacs.gnus.general/25931 Path: main.gmane.org!not-for-mail From: d.bell@motorola.com (E. David Bell) Newsgroups: gmane.emacs.gnus.general Subject: Re: Supercite, BBDB, Gnus, and attributions Date: 17 Oct 1999 18:16:36 +0200 Sender: owner-ding@hpc.uh.edu Message-ID: References: NNTP-Posting-Host: coloc-standby.netfonds.no Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: main.gmane.org 1035163235 16813 80.91.224.250 (21 Oct 2002 01:20:35 GMT) X-Complaints-To: usenet@main.gmane.org NNTP-Posting-Date: Mon, 21 Oct 2002 01:20:35 +0000 (UTC) Return-Path: Original-Received: from spinoza.math.uh.edu (spinoza.math.uh.edu [129.7.128.18]) by sclp3.sclp.com (8.8.5/8.8.5) with ESMTP id MAA22073 for ; Sun, 17 Oct 1999 12:20:59 -0400 (EDT) Original-Received: from sina.hpc.uh.edu (lists@Sina.HPC.UH.EDU [129.7.3.5]) by spinoza.math.uh.edu (8.9.1/8.9.1) with ESMTP id LAB20265; Sun, 17 Oct 1999 11:17:23 -0500 (CDT) Original-Received: by sina.hpc.uh.edu (TLB v0.09a (1.20 tibbs 1996/10/09 22:03:07)); Sun, 17 Oct 1999 11:17:44 -0500 (CDT) Original-Received: from sclp3.sclp.com (root@sclp3.sclp.com [204.252.123.139]) by sina.hpc.uh.edu (8.9.3/8.9.3) with ESMTP id LAA29714 for ; Sun, 17 Oct 1999 11:17:30 -0500 (CDT) Original-Received: from motgate.mot.com (motgate.mot.com [129.188.136.100]) by sclp3.sclp.com (8.8.5/8.8.5) with ESMTP id MAA22063 for ; Sun, 17 Oct 1999 12:16:52 -0400 (EDT) Original-Received: [from pobox.mot.com (pobox.mot.com [129.188.137.100]) by motgate.mot.com (MOT-motgate 1.0) with ESMTP id LAA03402 for ; Sun, 17 Oct 1999 11:16:51 -0500 (CDT)] Original-Received: [from msgtel1.sps.mot.com (msgtel1.sps.mot.com [216.2.95.1]) by pobox.mot.com (MOT-pobox 2.0) with ESMTP id LAA12048 for ; Sun, 17 Oct 1999 11:16:45 -0500 (CDT)] Original-Received: from kent ([223.41.95.102]) by msgtel1.sps.mot.com (Netscape Messaging Server 3.61) with SMTP id AAA1839 for ; Sun, 17 Oct 1999 18:16:38 +0200 Original-To: ding@gnus.org In-Reply-To: john s jacobs anderson's message of "Sat, 16 Oct 1999 23:13:43 MST" Original-Lines: 104 User-Agent: Gnus/5.070091 (Pterodactyl Gnus v0.91) XEmacs/21.1 (20 Minutes to Nikko) Precedence: list X-Majordomo: 1.94.jlt7 Xref: main.gmane.org gmane.emacs.gnus.general:25931 X-Report-Spam: http://spam.gmane.org/gmane.emacs.gnus.general:25931 >>>>> "john" == john s jacobs anderson writes: john> I can tell (or at least I think) that I need to set john> "sc-consult" as the first (or second) entry in john> sc-preferred-attribution-list, and that I should set up john> sc-attrib-selection-list to return the value from BBDB. I also john> think that bbdb/sc-consult-attr is going to be in there john> somewhere. It took me a while to get this working. This is what I've got: In my .emacsrc: (custom-set-variables '(sc-preferred-attribution-list (quote ("sc-consult" "x-attribution" "firstname" "lastname" "initials"))) '(sc-attrib-selection-list '(("sc-from-address" ((".*" (bbdb/sc-consult-attr (sc-mail-field "sc-from-address"))))))) '(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) ("^$" (progn (bbdb/sc-default) (list 'abort '(step . 0)))) ("^[ \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))))) '(sc-citation-leader "")) (bbdb-initialize 'gnus 'message 'sc) (bbdb-insinuate-sc) And in my gnus: ;; Not sure where these two functions came from originally... ;; Override sc-get-address with something that's less picky about what it's ;; willing to consider an address (supercite's default truncates the address ;; at the first odd-looking character). (defun sc-get-address (from author) "Get the full email address path from FROM. AUTHOR is the author's name (which is removed from the address)." (let ((eos (length from))) (if (string-match (concat "\\(^\\|^\"\\)" (regexp-quote author) "\\(\\s +\\|\"\\s +\\)") from 0) (let ((address (substring from (match-end 0) eos))) (if (and (= (aref address 0) ?<) (= (aref address (1- (length address))) ?>)) (substring address 1 (1- (length address))) address)) (if (string-match "[ ]*]+@[^ (>]+\\)" from 0) (sc-submatch 1 from) "")))) ;; Override sc-attribs-extract-namestring so that it will correctly cope ;; with From headers that contain no address (which is becoming more common ;; with munging, even if it's technically illegal). (defun sc-attribs-extract-namestring (from) "Extract the name string from FROM. This should be the author's full name minus an optional title." (let ((namestring (or ;; If there is a <...> in the name, ;; treat everything before that as the full name. ;; Even if it contains parens, use the whole thing. ;; On the other hand, we do look for quotes in the usual way. (and (string-match " *<.*>" from 0) (let ((before-angles (sc-name-substring from 0 (match-beginning 0) 0))) (if (string-match "\".*\"" before-angles 0) (sc-name-substring before-angles (match-beginning 0) (match-end 0) 1) before-angles))) (sc-name-substring from (string-match "(.*)" from 0) (match-end 0) 1) (sc-name-substring from (string-match "\".*\"" from 0) (match-end 0) 1) (sc-name-substring from (string-match "\\([-.a-zA-Z0-9_]+\\s *\\)+" from 0) (match-end 0) 0) (sc-attribs-emailname from)))) ;; strip off any leading or trailing whitespace (if namestring (let ((bos 0) (eos (1- (length namestring)))) (while (and (<= bos eos) (memq (aref namestring bos) '(32 ?\t))) (setq bos (1+ bos))) (while (and (> eos bos) (memq (aref namestring eos) '(32 ?\t))) (setq eos (1- eos))) (substring namestring bos (1+ eos)))))) ;;; End Supercite stuff