Article View: news.software.readers
Article #80508Re: Some Gnus questions
From: Russ Allbery
Date: Mon, 18 Jun 2001 23:41
Date: Mon, 18 Jun 2001 23:41
138 lines
7103 bytes
7103 bytes
Frank Schmitt <Azzrael@rz-online.de> writes:
> I want a blank between quotesign and text which I cite, but none between
> my quotesigns and the ones which are already there.
I had to use Supercite to get that behavior. I use Supercite with the
following configuration file:
;; rra-sc.el -- Supercite initialization file.
;; $Id: rra-sc.el,v 1.2 2001/03/12 00:43:25 eagle Exp $
;;
;; Written by Russ Allbery <rra@stanford.edu>
;; This work is hereby placed in the public domain by its author.
;;
;; This is intended for loading from sc-load-hook and resets a bunch of
;; Supercite default settings so that it behaves like a normal citation engine
;; and never attempts to do its own weird quoting.
;; Recognize either : or > as a citation delimiter.
(setq sc-citation-delimiter-regexp "[:>]+")
(setq sc-citation-separator-regexp "[ ]?")
;; Ensure that we don't recognize words as part of a citation. Yes, this
;; means that my Supercite configuration actually does not recognize standard
;; Supercite citing. This is a feature. Standard Supercite citing is really
;; broken.
(setq sc-citation-root-regexp "~~~")
(setq sc-citation-nonnested-root-regexp "~~~")
;; When I cite messages, I want to nest citations rather than doing that
;; broken Supercite cruft with people's names.
(setq sc-nested-citation-p t)
;; Just insert a "> ". Nothing else.
(setq sc-citation-leader "")
(setq sc-reference-tag-string "")
;; Don't ask me about attribution strings.
(setq sc-confirm-always-p nil)
;; Do not try to adjust the whitespace or wrapping of cited text. I'll do
;; that myself.
(setq sc-auto-fill-region-p nil)
(setq sc-fixup-whitespace-p nil)
;; 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))))))
;; Build my attribution line. Pull the author out of Supercite's parse of the
;; mail headers, and put their address in <>s. Make sure that the "name"
;; doesn't end in whitespace (thus making for odd double whitespace in the
;; attribution). Also insert the name of the newsgroup where I was reading
;; the message unless I was reading it in a strange group.
(defun rra-sc-header ()
"Attribution header code for Supercite."
(let ((author (let ((testauthor (sc-mail-field "sc-author")))
(if (string= " " (substring testauthor -1 nil))
(substring testauthor 0 -1)
testauthor)))
(address (or (sc-mail-field "sc-from-address")
(sc-mail-field "sc-reply-address")
"")))
(insert sc-reference-tag-string
(if (not (or (string-match "^nnml:" gnus-newsgroup-name)
(string-match "^nntp\+" gnus-newsgroup-name)
(string= gnus-newsgroup-name
(sc-mail-field "newsgroups"))))
(concat "In " gnus-newsgroup-name ", ")
"")
(if (> (length author) 0)
(concat author
(if (> (length address) 0)
(concat " <" address ">")
""))
(if (> (length address) 0) address "someone"))
" writes:\n")))
;; Set this as the attribution writer.
(setq sc-rewrite-header-list (list '(rra-sc-header)))
(setq sc-preferred-header-style 0)
--
Russ Allbery (rra@stanford.edu) <http://www.eyrie.org/~eagle/>
Technical Details
Message-ID:
<ylzob51hlm.fsf@windlord.stanford.edu>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!nntp.stanford.edu!not-for-mailReferences:
<u21ez0yv.fsf@hschmi22.userfqdn.rz-online.de> <86bsnmm82p.fsf@blowfish.brfmasthugget.se> <66dujb6b.fsf@hschmi22.userfqdn.rz-online.de>Show Full Headers
Complete Article Headers
Message-ID: <ylzob51hlm.fsf@windlord.stanford.edu> Subject: Re: Some Gnus questions Date: Mon, 18 Jun 2001 23:41:25 +0000 From: Russ Allbery <rra@stanford.edu> References: <u21ez0yv.fsf@hschmi22.userfqdn.rz-online.de> <86bsnmm82p.fsf@blowfish.brfmasthugget.se> <66dujb6b.fsf@hschmi22.userfqdn.rz-online.de> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.mbox.zip!archiver1.google.com!newsfeed.google.com!newsfeed.stanford.edu!nntp.stanford.edu!not-for-mail Newsgroups: news.software.readers Organization: The Eyrie Lines: 137 NNTP-Posting-Host: windlord.stanford.edu Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.Stanford.EDU 992907686 2327 171.64.13.23 (18 Jun 2001 23:41:26 GMT) X-Complaints-To: news@news.stanford.edu User-Agent: Gnus/5.0807 (Gnus v5.8.7) XEmacs/21.1 (Channel Islands)