Gnus development mailing list
 help / color / mirror / Atom feed
* Supercite, BBDB, Gnus, and attributions
@ 1999-10-17  6:12 john s jacobs anderson
  1999-10-17 16:16 ` E. David Bell
  0 siblings, 1 reply; 4+ messages in thread
From: john s jacobs anderson @ 1999-10-17  6:12 UTC (permalink / raw)


Greetings.

I'm trying to get Supercite, BBDB, and Gnus to play together nicely so 
that if I have an 'attribution' field in a BBDB entry it is used, if
not then choice should fall through the entries in
sc-preferred-attribution-list, like normal. Having entries without
attributions pick one up on reply would be nice too.

I can tell (or at least I think) that I need to set "sc-consult" as
the first (or second) entry in sc-preferred-attribution-list, and that
I should set up sc-attrib-selection-list to return the value from
BBDB. I also think that bbdb/sc-consult-attr is going to be in there
somewhere.

Unfortunately, I can't seem to make the pieces fit together. Info does
a nice job of defining the functions and variables, but doesn't talk
so much about how to make them go.

XEmacs 21.2.19, Gnus 5.6.45, Supercite 3.1, BBDB 2.00.06.

Thanks for any help.

john.

-- 
------------------------------------------------------------------------
John S Jacobs Anderson                                   Apprentice Geek
jacobs@genehack.org                       Journeyman Molecular Biologist
<URL:http://genehack.org/>   <-------    GeneHack: bioinfo*linux*opinion



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Supercite, BBDB, Gnus, and attributions
  1999-10-17  6:12 Supercite, BBDB, Gnus, and attributions john s jacobs anderson
@ 1999-10-17 16:16 ` E. David Bell
  1999-10-17 21:28   ` john s jacobs anderson
  0 siblings, 1 reply; 4+ messages in thread
From: E. David Bell @ 1999-10-17 16:16 UTC (permalink / raw)


>>>>> "john" == john s jacobs anderson <jacobs@genehack.org> 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:

\f
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)  

\f
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





^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Supercite, BBDB, Gnus, and attributions
  1999-10-17 16:16 ` E. David Bell
@ 1999-10-17 21:28   ` john s jacobs anderson
  1999-10-17 23:19     ` Jack Twilley
  0 siblings, 1 reply; 4+ messages in thread
From: john s jacobs anderson @ 1999-10-17 21:28 UTC (permalink / raw)


>>>>> "EDB" == E David Bell <d.bell@motorola.com> writes:
EDB> It took me a while to get this working.  This is what I've got:

Thanks; that did the trick. Maybe one more thing you can help me with: 
SC used to insert quoted text with a few spaces in front of it. With
the code from you, now SC inserts quoted text flush left.

What is the variable to set to control this?

Thanks again,
john.


-- 
------------------------------------------------------------------------
John S Jacobs Anderson                                   Apprentice Geek
jacobs@genehack.org                       Journeyman Molecular Biologist
<URL:http://genehack.org/>   <-------    GeneHack: bioinfo*linux*opinion



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Supercite, BBDB, Gnus, and attributions
  1999-10-17 21:28   ` john s jacobs anderson
@ 1999-10-17 23:19     ` Jack Twilley
  0 siblings, 0 replies; 4+ messages in thread
From: Jack Twilley @ 1999-10-17 23:19 UTC (permalink / raw)


>>>>> "jsja" == john s jacobs anderson <jacobs@genehack.org> writes:

>>>>> "EDB" == E David Bell <d.bell@motorola.com> writes:
    EDB> It took me a while to get this working.  This is what I've
    EDB> got:

    jsja> Thanks; that did the trick. Maybe one more thing you can
    jsja> help me with: SC used to insert quoted text with a few
    jsja> spaces in front of it. With the code from you, now SC
    jsja> inserts quoted text flush left.

    jsja> What is the variable to set to control this?

In EDB's code, he had the following line:

 '(sc-citation-leader ""))

You have several choices -- you can reconstruct the expression to not
include this option, you can use the custom package to go in and
remove it, or you can change the "" to "    ".

    jsja> Thanks again, john.

Jack.
(Funny.  I'm going to add that line. :-))
-- 
Jack Twilley
jmt at nycap dot rr dot com
http colon slash slash jmt dot dhs dot org slash tilde jmt slash


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1999-10-17 23:19 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-10-17  6:12 Supercite, BBDB, Gnus, and attributions john s jacobs anderson
1999-10-17 16:16 ` E. David Bell
1999-10-17 21:28   ` john s jacobs anderson
1999-10-17 23:19     ` Jack Twilley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).