[comp.emacs] Supercite 2.1 public release

warsaw@cme.nist.gov (Barry A. Warsaw) (08/03/90)

Hello everyone. Supercite version 2.1 is now ready for public release.
For those who do not know, supercite is a sophisticated package for
citing original messages in the replied and/or forwarded message.
Supercite is intended for use with Gnu emacs version 18.55. 

Ever wanted to change the default way RMAIL, GNUS and other mail/news
packages cited the yanked original message, or was wondering how
people got those replies that look like:

	Jane> She wrote this.
	John> He wrote this.
	and I wrote this.

Check out supercite...

In brief, here are the changes since version 2.0 (released in October '89):

	1) Overloading has been entirely rewritten and should now be much
	   easier to use (for those who can't or won't patch distribution
	   elisp).

	2) Non-nested citations are now composed of 4 parts, the citation
	   leader, the attribution string, the citation delimiter, and the
	   citation separator.  This lets you indent (with tabs) cited
	   bodies of text.

	3) No more dependencies on sendmail.el and mail-utils.el.

	4) Alists are buffer local so you can use supercite in more than 1
	   reply buffer in the same emacs session.

	5) Electric reference mode is rewritten, and should be cleaner to
	   use.

	6) For the first time, I've added a smaller version of supercite
	   (called "Cheapcite") which is for those who think supercite is
	   too big, but still like the citation style (no doubt some will
	   consider Cheapcite to big. Oh well...).

	7) New functions, bug fixes, typos, etc...

No diffs are available to v2.0, so I'm sending out the whole thing as
two shar files (which will come in messages to follow). I am
refraining from compressing the files, due to the recent uncertainty
over particular compression algorithms' patent status and other
spooge.  Also, version 2.1 is now available via anonymous ftp from
durer.cme.nist.gov (129.6.32.4) in
pub/gnu/elisp/supercite-2.1.shar.0{1,2}.

Enjoy, and join the supercite mailing list if you're interested in
discussing the package (see address below), though it might take a
little while to process additions/deletions.  I should mention that
tomorrow (8/3/90) is my last day at NIST.  I'll be on the internet at
my new job, and the supercite mailing list will still exist for the
time being; I'm just not sure exactly when I'll get to catching up on
its traffic.  Hopefully soon.

-Barry

NAME: Barry A. Warsaw                USMAIL: National Institute of
TELE: (301) 975-3460                         Standards and Technology
UUCP: uunet!cme.nist.gov!warsaw              Rm. B-124, Bldg. 220
INET: warsaw@cme.nist.gov                    Gaithersburg, MD 20899


  /----------------------------------------------------------\
 / This mailing list covers issues related to the advanced    \
 | mail/news citation package for GNU emacs called Supercite. |
 |                                                            |
 | Send articles to:                                          |
 |      (Internet) supercite@cme.nist.gov                     |
 |      (Uucp)     uunet!cme.nist.gov!supercite               |
 |                                                            |
 | Send requests for mailing list additions/deletions to:     |
 |      (Internet) supercite-request@cme.nist.gov             |
 \      (Uucp)     uunet!cme.nist.gov!supercite-request       /
  \__________________________________________________________/

warsaw@cme.nist.gov (Barry A. Warsaw) (08/03/90)

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 1 (of 2)."
# Contents:  ChangeLog MANIFEST README baw-alist.el cheapcite.el
#   mh-e.el.diff rnewspost.el.diff sc-electric.el sc-oloads.el
#   sendmail.el.diff
# Wrapped by warsaw@anthem on Thu Aug  2 22:43:56 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'ChangeLog' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'ChangeLog'\"
else
echo shar: Extracting \"'ChangeLog'\" \(9247 characters\)
sed "s/^X//" >'ChangeLog' <<'END_OF_FILE'
XThu Aug  2 22:40:42 1990  Barry Warsaw  (warsaw at anthem)
X
X		* shar it up, post to comp.emacs, gnu.emacs, elisp directory,
X		cme.nist.gov [129.6.32.4].
X
XMon Jul 30 19:06:34 1990  Barry Warsaw  (warsaw at anthem)
X
X		* Added "cheapcite", a minimal supercite file.
X
X		* Changed (obsolete function?) read-input to read-string.
X
XSat Jul 28 14:02:06 1990  Barry Warsaw  (warsaw at anthem)
X
X		* shar'd it up and posted to supercite list.
X
X		* spell checked, updated README and docstring.
X
X		* Added sc-version which displays version number.
X
XFri Jul 27 09:58:38 1990  Barry Warsaw  (warsaw at anthem)
X
X		* Removed the dependence on global variables sc-cite-context and
X		sc-force-confirmation-p.  Now they are locally bound (via let) in
X		the contexts that need them.
X
X		* Fixed sc-confirm so C-g in minibuffer aborts the cite or recite
X		function. Added a catch/throw to 'select-abort.  Catch in sc-cite
X		and sc-recite, throw in sc-confirm (on C-g).
X
X		* Rewrote the sc-describe doc string and moved the linking
X		information to the README, since by that time, you'll have read
X		the README and already figured out how to link it.
X
XWed Jul 25 10:23:16 1990  Barry Warsaw  (warsaw at anthem)
X
X		* Always check sc-preferred-header-style to be sure it is legal
X		before using.
X
X		* Changed the logic for sc-insert-references to be more useful as
X		to when to enter electric mode.
X
X		* Wrapped all evals of sc-rewrite-header-list functions in
X		condition-cases so we'd see and handle void-functions and other
X		errors. 
X
XTue Jul 24 17:57:49 1990  Barry Warsaw  (warsaw at anthem)
X
X		* Significantly rewrote electric insert to live within a quasi
X		major mode. Uses recursive edit to strictly control key strokes
X		while doing electric referencing.  Seems the best way to do it,
X		though perhaps a bit parental.
X
XFri Jul 20 09:48:15 1990  Barry Warsaw  (warsaw at anthem)
X
X		* Added circular references in electric reference mode. Added
X		control variable sc-electric-circular-p.
X
X		* sc-load-hook removed. Its not really needed since sc-run-hook
X		basically performs the same function.
X
XThu Jul 19 12:49:08 1990  Barry Warsaw  (warsaw at anthem)
X
X		* sc-left-justify-p has been renamed sc-fixup-whitespace-p.
X
X		* Made certain variables, most notably sc-gal-information and
X		sc-gal-attributions buffer local.
X
X		* Cleaned up docstrings in baw-alists.el
X
X		* Redesigned overload mechanism based on code supplied by
X		umerin@tc.nagasaki.go.jp.  Overload file will now byte-compile and
X		overloading in general is quite a bit more clean.
X
XTue Jul 17 15:57:35 1990  Barry Warsaw  (warsaw at anthem)
X
X		* fixed some typos in the docstrings.
X
X		* fixed sc-spoogify-docstring so that if the major mode is
X		preloaded, it will make a copy of the function property, modify
X		that docstring, then fset the major mode to this copy.
X
X		* changed the string "newsgroup" to "newsgroups" in the defvar for
X		sc-mail-fields-list.  Also in documentation.
X
X		* added sc-glom-headers, an interactive function which lets you
X		set up sc-gal-* for any mail headers within region.
X
XFri Jul 13 14:26:47 1990  Barry Warsaw  (warsaw at anthem)
X
X		* sc-spoogify-docstring won't abort on error if major-mode is
X		preloaded.  It just won't spoogify the docstring.		
X
X		* Added variable sc-nuke-mail-headers-p to control nuking or
X		non-nuking of mail headers after glomming useful info from them.
X
X		* copied in mail-yank-clear-headers to sc-* to further reduce
X		dependence on sendmail.el.  Renamed mail-yank-ignored-headers to
X		sc-*.
X
X		* Fixed a bug in sc-cite not passing numeric arg correctly to
X		sc-insert-reference. Also fixed slight bug in sc-insert-reference.
X
X		* clarified cite confirmation message and recite confirmation
X		message by adding sc-cite-context.
X
X		* moved mail-fetch-field to supercite: sc-mail-fetch-field to
X		remove dependency of supercite on sendmail.el and mail-utils.el
X
X		* Added sc-citation-leader.  A composed citation string is now
X		build from (concat sc-citation-leader 'attribution'
X		sc-citation-delimiter and followed with sc-citation-separator.
X
X		* move sup-misc.el to sc-misc.el
X
XFri Oct 13 17:30:13 1989  Barry Warsaw  (warsaw at rtg)
X
X		* Shar it up and post version 2.0.
X
X		* moved supercite-misc.el to sup-misc.el and
X		baw-alist-utils.el to baw-alist.el for sake of users of
X		bogus UN*X's which can't handle long file names.
X
X		* Merged in mh-e support as provided by Mark Baushke.
X
XThu Oct 12 17:50:55 1989  Barry Warsaw  (warsaw at rtg)
X
X		* Fixed small bug in sc-populate-alists. No space was being
X		put between last middlename and lastname.
X
X		* Cleaned up documentation. Ready to post tomorrow.
X
XWed Oct 11 13:43:35 1989  Barry Warsaw  (warsaw at rtg)
X
X		* Moved sc-supercite to sc-describe.
X
X		* Cleaned up code and documentation for distribution. I'll be
X		watching for bugs to pop up before release.
X
X		* Added sc-leached-keymap for better documentation.
X
X		* Changed default value of sc-cite-regexp to include possible
X		whitespace around attribution text and mulitple ">" characters.
X
X		* Changed all symbol prefixes from sy- to sc- in both the
X		supercite.el and supercite-misc.el files.
X
X		* Added cute hack so that description of supercite bindings are
X		leached onto the docstring of the current buffer's major-mode
X		function.  "C-h m" after supercite is loaded will show the
X		supercite keybindings in the *Help* buffer.
X
XTue Oct 10 17:30:32 1989  Barry Warsaw  (warsaw at rtg)
X
X		* Fixed a bug in the creation of the "sc-author" field which was
X		putting a bogus space at the end of the author's name. Also added
X		all the other name fields to the "sc-gal-information" alist. You
X		can now access "sc-firstname", "sc-lastname", and all
X		"sc-middlename-N".
X
X		* Added an attribution style that I use.
X		sc-header-attributed-writes. 
X
X		* Parameterized the ">>>>>" prefix on the reference header. Some
X		people find this annoying, I like it.
X
XSun Oct  8 22:08:11 1989  Barry Warsaw  (warsaw at rtg)
X
X		* Added binding for sc-insert-reference for mh-e mode.
X
XWed Oct  4 18:54:43 1989  Barry Warsaw  (warsaw at rtg)
X
X		* Fixed bug in searching for author names in certain From: lines
X		which didn't find names with dots (abbreviations) and dashes.
X
X		* Added per-interface keymaps which allow you to define different
X		keybindings based on the major-mode of the buffer which supercite
X		is leaching onto.
X
XTue Oct  3 20:01:17 1989  Barry Warsaw  (warsaw at rtg)
X
X		* Fixed bug in sc-{re,un}cite which bombed out if first line in
X		region was blank. These functions now search for attribution
X		prefix on first non-blank line in region.
X
XMon Sep 25 10:30:32 1989  Barry Warsaw  (warsaw at rtg)
X
X		* Modified diffs and overloads to mh-e stuff as per ks and mdb
X
X		* Fixed conditional loads in supercite-misc.el
X
X		* Added (require 'sendmail)
X
XThu Sep 21 10:17:23 1989  Barry Warsaw  (warsaw at rtg)
X
X		* Posted 2.0gamma to supercite list.
X
X		* Added overload functions to supercite-misc.el
X
X		* Fixed some bugs in electric-reference functions
X
X		* After citing a yanked region, leave point (or mark if
X		point>mark) on first non-blank line.
X
XWed Sep 13 18:10:45 1989  Barry Warsaw  (warsaw at rtg)
X
X		* Added electric reference header selection. Now you don't have to
X		remember which integer pointed to which reference style!
X
XTue Sep 12 18:23:47 1989  Barry Warsaw  (warsaw at rtg)
X
X		* Fixed some bugs in paragraph filling and made the whole thing
X		more robust and simple.
X
X		* Added exchange of point and mark when point > mark.  Exchange is
X		only visible internal to sc- functions.  Order of point and mark
X		are restored after citing.
X
X		* Added some new mail headers to clean.
X
XWed Sep  6 18:45:11 1989  Barry Warsaw  (warsaw at rtg)
X
X		* Remerged files by popular demand. Added page delimiters.
X
XFri Sep  1 18:37:59 1989  Barry Warsaw  (warsaw at rtg)
X
X		* Modified documentation and updated the public domain notice.
X
X		* Restored "C-c q" binding of sc-fill-paragraph-manually.
X
XTue Aug 29 18:54:27 1989  Barry Warsaw  (warsaw at rtg)
X
X		* Added sc-modify-info function.
X
X		* Fixed sc-left-justify-p to use fixup-whitespace (which makes
X		more sense).
X
XMon Aug 21 10:07:06 1989  Barry Warsaw  (warsaw at rtg)
X
X		* Posted 2.0beta version to mailing list.
X
X		* Added sc-uncite function.
X
XFri Aug 18 16:49:43 1989  Barry Warsaw  (warsaw at rtg)
X
X		* Split files for managability.
X
XThu Aug 17 21:43:33 1989  Barry Warsaw  (warsaw at rtg)
X
X		* Added alist utilites and rewrote major portions of code to
X		utilize these association lists for keeping track of important
X		information.
X
XMon Aug 14 17:09:11 1989  Barry Warsaw  (warsaw at rtg)
X
X		* Added facility to remember which attribution was last used. This
X		last used attribution is presented to the user as the preferred
X		choice for the next attribution.
X
XMon Jul 31 18:52:41 1989  Barry Warsaw  (warsaw at rtg)
X
X		* Modified some documentation.
X
XThu Jul 27 17:01:49 1989  Barry Warsaw  (warsaw at rtg)
X
X		* Added some better filling functions and hookified the paragraph
X		fill function so you can use whatever you want.
X
XWed Jul  5 21:15:45 1989  Barry Warsaw  (warsaw at rtg)
X
X		* Totally rewrote version 2.0 based on superyank 1.11.  This
X		included major modifications of almost every bit of code in the
X		package. Much too numerous to mention here.
END_OF_FILE
if test 9247 -ne `wc -c <'ChangeLog'`; then
    echo shar: \"'ChangeLog'\" unpacked with wrong size!
fi
# end of 'ChangeLog'
fi
if test -f 'MANIFEST' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'MANIFEST'\"
else
echo shar: Extracting \"'MANIFEST'\" \(764 characters\)
sed "s/^X//" >'MANIFEST' <<'END_OF_FILE'
X   File Name		Archive #	Description
X-----------------------------------------------------------
X ChangeLog                  1	Differences from v2.0.
X MANIFEST                   1	This shipping list
X README                     1	Introduction to supercite v2.1.
X baw-alist.el               1	Association list utilities.
X cheapcite.el               1	Cheapcite version 2.1. (minimalist's supercite)
X mh-e.el.diff               1	Context diff patch file for mh-e.el.
X rnewspost.el.diff          1	Context diff patch file for rnewspost.el.
X sc-electric.el             1	Electric insert mode.
X sc-oloads.el               1	Overloading functions.
X sendmail.el.diff           1	Context diff patch file for sendmail.el.
X supercite.el               2	Supercite version 2.1.
END_OF_FILE
if test 764 -ne `wc -c <'MANIFEST'`; then
    echo shar: \"'MANIFEST'\" unpacked with wrong size!
fi
# end of 'MANIFEST'
fi
if test -f 'README' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'README'\"
else
echo shar: Extracting \"'README'\" \(10460 characters\)
sed "s/^X//" >'README' <<'END_OF_FILE'
XThis is the distribution of Supercite 2.1, an elisp utility to do
Xfancy citing of reply messages for GNU emacs.  This is the second
Xrelease of the supercite package. This version fixes bugs, clarifies
Xissues, and occasionally adds features to version 2.0, originally
Xreleased in October '89.  The ancestor to this package was Superyank
X1.11.
X
X
X-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
X
XMajor changes since version 2.0:
X
X     1) Overloading has been entirely rewritten, based on code donated
X        by umerin@tc.nagasaki.go.jp.  The overload file has been
X        renamed to sc-oloads.el, and this file can now be byte
X        compiled.  Also, overloading in general has been entirely
X        cleaned up.  Not so much of a hack now. :-)
X
X     2) Citation strings are now built from 4 parts, the citation
X        leader, the attribution string, the citation delimiter, and
X        the citation separator.  The citation leader is the added
X        feature.
X
X     3) Removed all dependence on sendmail.el and mail-utils.el.
X
X     4)	Various bug fixes and typos, including sc-spoogify-docstring.
X
X     5) Made the alists buffer local so you could have more than 1
X        reply buffer going in the same emacs session.
X
X     6) Completely rewrote electric reference insert mode.  It now
X        pops you into a recursive-edit.  I think this version is much
X        more usable.
X
X     7) Some new functions and variables, most notably:
X	         sc-glom-headers (Command)
X			 sc-version (Command)
X			 sc-nuke-mail-headers-p (Variable)
X			 sc-citation-leader (Variable)
X			 sc-fixup-whitespace-p (Variable -- was sc-left-justify-p)
X			 sc-electric-circular-p
X
X     8) Added "cheapcite", a minimalist supercite package for those
X	    who are daunted by the complexity and/or size of supercite.
X			 
X
XFor more information on changes since Version 2.0, see the ChangeLog file.
X
X
X-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
X
XThis package should contain the following files:
X
X	 supercite.el       -- the main elisp file
X	 cheapcite.el       -- the minimalist supercite
X	 sc-oloads.el       -- overloading functions
X	 sc-electric.el     -- supercite's electric reference insert mode
X	 baw-alist.el       -- association list utilities
X	 mh-e.el.diff       -- patch file to mh-e.el
X	 rnewspost.el.diff  -- patch file to rnewspost.el
X	 sendmail.el.diff   -- patch file to sendmail.el
X	 README             -- this file
X	 ChangeLog          -- history of changes file
X
XSupercite 2.1 has been tested and is known to work with VM 4.37-41
Xout of the box. Supercite will work with GNUS 3.12-13, RMAIL, RNEWS,
XMH, perhaps GNEWS, PCMAIL, and other packages, once the supplied
Xpatches are installed, or the proper functions have been overloaded
X(see below).
X
XOnce you've got it linked, installed, and loaded you can find out more
Xinformation on using supercite by typing "M-x sc-describe".  The rest
Xof this README describes how to interface supercite with the various
Xmail/news packages you might be using.
X
X
X-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
X
XThe author runs a Supercite mailing list on which a number of mail and
Xnews package authors and other supercite users participate.  Back in
XJune of '89, some discussion was held and an interface between these
Xpackages and Supercite was agreed upon.  The ancestor to this package,
XSuperyank 1.11 was designed along an old interface and this package,
XSupercite 2.1 conforms to this new standard. When version 2.0 was
Xreleased back in October '89, only VM 4.37 conforms to this standard
Xas distributed, and today (27-Jul-1990) VM is still the only package
Xwhich interfaces with supercite 'from the box'.  It is rumored that
Xemacs v19 will include the agreed upon interface, allowing GNUS
X3.12-13, RMAIL, RNEWS and MH-E to use supercite with no modification
Xto distribution code.  However until such time as this, you must apply
Xthe specified patches, or use the appropriate overloaded functions to
Xaccess supercite from the mail/news package of your choice.  Using
Xeither the patches or the overloads, you *should* be able to use
Xsupercite with: VM, GNUS, RMAIL, MH, RNEWS, GNEWS, PCMAIL, and perhaps
Xothers.
X
XThe interface mentioned above was formally proposed by Martin Neitzel
Xon Fri, 23 Jun 89, in a mail message to the supercite mailing list:
X
X	Martin> Each news/mail-reader should provide a form of
X	Martin> mail-yank-original that
X
X	Martin> 1: inserts the original message incl. header into the
X	Martin>    reply buffer; no indentation/prefixing is done, the header
X	Martin>    tends to be a "full blown" version rather than to be
X	Martin>    stripped down.
X
X	Martin> 2: `point' is at the start of the header, `mark' at the
X	Martin>    end of the message body.
X
X	Martin> 3: (run-hooks 'mail-yank-hooks)
X
X	Martin> [Supercite] should be run as such a hook and merely
X	Martin> rewrite the message.  This way it isn't anymore
X	Martin> [supercite]'s job to gather the original from obscure
X	Martin> sources. [...]
X
XSupercite 2.1 conforms to this interface, as does VM. So, to access
Xsupercite from VM (or other packages, once overloading or patching has
Xbeen completed), simply add this to your .emacs file:
X
X	 (autoload 'sc-cite-original "supercite"  "Hookified Supercite 2.1" t)
X	 (autoload 'sc-cite          "supercite"  "Interactive Supercite 2.1" t)
X	 (setq mail-yank-hooks 'sc-cite-original)
X	 (setq mh-yank-hooks 'sc-cite-original)    ; for mh-e users
X
XIf supercite is too complex or large for your tastes, but you still
Xwant to use some of the flavor of supercite, then cheapcite might be
Xjust for you. Lots of supercite's fancier features, such as automatic
Xattribution extraction, electric referencing, per-interface keymaps,
Xetc., have been yanked from cheapcite.  You still get nested and
Xnon-nested citations, and cheapcite conforms to the same interface as
Xsupercite (and understands many of the same variables and commands).
XCheapcite is meant to be a replacement for supercite; I don't think
Xthey'll live together very well in the same emacs session.  To link to
Xcheapcite instead of supercite, just change the autoload lines above
Xto:
X
X	 (autoload 'sc-cite-original "cheapcite"  "Hookified Cheapcite 2.1" t)
X	 (autoload 'sc-cite          "cheapcite"  "Interactive Cheapcite 2.1" t)
X
XAlmost everything else remains the same.
X
X
X-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
X
XTo link supercite (or cheapcite) with the mail/news package you're
Xusing (if it is not VM) you will either have to patch certain files
Xwhich are distributed with emacs 18.55, or go the overload route.  To
Xpatch, apply these context diff files using the 'patch' utility
X(available, I believe on prep.ai.mit.edu, among other places):
X
X		rnewspost.el.diff
X		sendmail.el.diff
X		mh-e.el.diff
X
XThe really important one is sendmail.el.diff which will let supercite
Xwork with GNUS, RMAIL and RNEWS.  The rnewspost.el.diff file just
Xcleans some stuff up for use with RNEWS and GNUS.  If you use MH-E
Xmode, install mh-e.el.diff.
X
XIf for some reason you cannot install the diff files, don't fret, you
Xcan use supercite by going the overload route.  I have completely
Xrewritten this part of supercite (based on code donated by Masanobu
XUmeda) since v2.0, and it should now be clearer and easier to use.
XRefer to the sc-oloads.el file during this discussion.
X
XThere is a variable, called sc-overload-functions which maintains a
Xlist of overload pairs.  The first symbol in the pair is the symbol of
Xthe function to overload.  The second symbol is the symbol of the
Xsupercite equivalent function which provides the enhanced (for hooking
Xup the supercite package) functionality.  By default,
Xsc-overload-functions contains the pairings needed to link supercite
Xwith most of the major known mail/news packages.
X
XThere is a function, also called sc-overload-functions which will scan
Xthis overload pairing list, setting the function cell of any fbound,
Xoriginal function symbol with the supercite equivalent function.  In
Xthis way, overloading is accomplished.  If the original symbol is not
Xyet fbound (say, because GNUS was not yet loaded, so
Xnews-reply-yank-original wasn't yet bound), supercite will skip this
Xpairing.
X
XThe final piece of the puzzle is to determine a hook in your mail/news
Xreader package which gets run after the package is loaded (so the
Xoriginal function will be fbound), but before the original package
Xyanks in and cites the text.  You will set this hook to load
Xsupercite, and perform the overloading.  I have analyzed the major
Xpackages available to find hooks which I think will work.  They are:
X
X     mail-setup-hook      (for packages using sendmail.el)
X     news-reply-mode-hook (for packages using rnewspost.el)
X     mh-letter-mode-hook  (for packages using mh-e.el)
X
XSo, if you are using one of the major news/mail packages, this is all
Xyou should need to add to your .emacs file to get supercite linked in
Xat the proper time:
X
X     (defun my-sc-overload-hook-func ()
X       (require 'sc-oloads)
X       (sc-overload-functions))
X
X     (setq mail-setup-hook 'my-sc-overload-hook-func)
X     (setq news-reply-mode-hook 'my-sc-overload-hook-func)
X     (setq mh-letter-mode-hook 'my-sc-overload-hook-func)
X
XIf you are not using one of these mail/news packages, simply find an
Xappropriate hook within that package and set it to run
Xmy-sc-overload-hook-func.  Please inform the author of any hook
Xfunctions you find, so that I can update this README for future releases.
X
X
X-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
X
XEnjoy, and please send the author your compliments, questions,
Xsuggestions and bug reports.  Don't forget, if you're interested in
Xdiscussing supercite and/or cheapcite, join the mailing list by
Xsending mail to the supercite-request address below.
X
X-Barry
X
X
XNAME: Barry A. Warsaw            USMAIL: National Institute of
XTELE: (301) 975-3460                     Standards and Technology
XUUCP: uunet!cme.nist.gov!warsaw          Rm. B-124, Bldg. 220
XINET: warsaw@cme.nist.gov                Gaithersburg, MD 20899
X
XGet on the Supercite mailing list:
X
XSend articles to:
X          INET: supercite@cme.nist.gov
X          UUCP: uunet!cme.nist.gov!supercite
X
XSend administrivia (additions/deletions to list, etc) to:
X          INET: supercite-request@cme.nist.gov
X          UUCP: uunet!cme.nist.gov!supercite-request
X
X
X+++ Local Variables: ---
X+++ tab-width: 4 ---
X+++ End: ---
END_OF_FILE
if test 10460 -ne `wc -c <'README'`; then
    echo shar: \"'README'\" unpacked with wrong size!
fi
# end of 'README'
fi
if test -f 'baw-alist.el' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'baw-alist.el'\"
else
echo shar: Extracting \"'baw-alist.el'\" \(5466 characters\)
sed "s/^X//" >'baw-alist.el' <<'END_OF_FILE'
X;; baw-alist.el -- Version 1.0
X
X;; association list utilities providing insertion, deletion, sorting
X;; fetching off key-value pairs in association lists.
X
X;; ========== Disclaimer ==========
X;; This software is distributed in the hope that it will be useful,
X;; but WITHOUT ANY WARRANTY.  No author or distributor accepts
X;; responsibility to anyone for the consequences of using it or for
X;; whether it serves any particular purpose or works at all, unless he
X;; says so in writing.
X
X;; This software was written as part of the supercite author's
X;; official duty as an employee of the United States Government and is
X;; thus in the public domain.  You are free to use that particular
X;; software as you wish, but WITHOUT ANY WARRANTY WHATSOEVER.  It
X;; would be nice, though if when you use any of this code, you give
X;; due credit to the author.
X
X;; ========== Author (unless otherwise stated) ==========
X;; NAME: Barry A. Warsaw              USMAIL: National Institute of
X;; TELE: (301) 975-3460                       Standards and Technology
X;; UUCP: uunet!cme.nist.gov!warsaw            Rm. B-124, Bldg. 220
X;; INET: warsaw@cme.nist.gov                  Gaithersburg, MD 20899
X
X;; ========== Modification History ==========
X;; modified: 19-Jul-1990 baw (conform doc strings)
X;; modified: 13-Jul-1990 baw (cleaned up a bit)
X;; modified:  6-Sep-1989 baw (create alists from flat lists)
X;; modified:  1-Sep-1989 baw (updated pd notice)
X;; created : 17-Aug-1989 baw
X
X(provide 'baw-alist)
X
X
X(defun asort (alist-symbol key)
X  "Move a specified key-value pair to the head of an alist.
XThe alist is referenced by ALIST-SYMBOL. Key-value pair to move to
Xhead is one matching KEY.  Returns the sorted list and doesn't affect
Xthe order of any other key-value pair.  Side effect sets alist to new
Xsorted list."
X  (set alist-symbol
X       (sort (copy-alist (eval alist-symbol))
X	     (function (lambda (a b) (equal (car a) key))))))
X
X
X(defun aelement (key value)
X  "Makes a list of a cons cell containing car of KEY and cdr of VALUE.
XThe returned list is suitable as an element of an alist."
X  (list (cons key value)))
X
X
X(defun aheadsym (alist)
X  "Return the key symbol at the head of ALIST."
X  (car (car alist)))
X
X
X(defun anot-head-p (alist key)
X  "Find out if a specified key-value pair is not at the head of an alist.
XThe alist to check is specified by ALIST and the key-value pair is the
Xone matching the supplied KEY.  Returns nil if ALIST is nil, or if
Xkey-value pair is at the head of the alist.  Returns t if key-value
Xpair is not at the head of alist.  ALIST is not altered."
X  (not (equal (aheadsym alist) key)))
X
X
X(defun aput (alist-symbol key &optional value)
X  "Inserts a key-value pair into an alist.
XThe alist is referenced by ALIST-SYMBOL. The key-value pair is made
Xfrom KEY and optionally, VALUE. Returns the altered alist or nil if
XALIST is nil.
X
XIf the key-value pair referenced by KEY can be found in the alist, and
XVALUE is supplied non-nil, then the value of KEY will be set to VALUE.
XIf VALUE is not supplied, or is nil, the key-value pair will not be
Xmodified, but will be moved to the head of the alist. If the key-value
Xpair cannot be found in the alist, it will be inserted into the head
Xof the alist (with value nil if VALUE is nil or not supplied)."
X  (let ((elem (aelement key value))
X	alist)
X    (asort alist-symbol key)
X    (setq alist (eval alist-symbol))
X    (cond ((null alist) (set alist-symbol elem))
X	  ((anot-head-p alist key) (set alist-symbol (nconc elem alist)))
X	  (value (setcar alist (car elem)))
X	  (t alist))))
X
X
X(defun adelete (alist-symbol key)
X  "Delete a key-value pair from the alist.
XAlist is referenced by ALIST-SYMBOL and the key-value pair to remove
Xis pair matching KEY.  Returns the altered alist."
X  (asort alist-symbol key)
X  (let ((alist (eval alist-symbol)))
X    (cond ((null alist) nil)
X	  ((anot-head-p alist key) alist)
X	  (t (set alist-symbol (cdr alist))))))
X
X
X(defun aget (alist key &optional keynil-p)
X  "Returns the value in ALIST that is associated with KEY.
XOptional KEYNIL-P describes what to do if the value associated with
XKEY is nil.  If KEYNIL-P is not supplied or is nil, and the value is
Xnil, then KEY is returned.  If KEYNIL-P is non-nil, then nil would be
Xreturned.
X
XIf no key-value pair matching KEY could be found in ALIST, or ALIST is
Xnil then nil is returned. ALIST is not altered."
X  (let ((copy (copy-alist alist)))
X    (cond ((null alist) nil)
X	  ((progn (asort 'copy key)
X		  (anot-head-p copy key)) nil)
X	  ((cdr (car copy)))
X	  (keynil-p nil)
X	  ((car (car copy)))
X	  (t nil))))
X
X
X(defun amake (alist-symbol keylist &optional valuelist)
X  "Make an association list.
XThe association list is attached to the alist referenced by
XALIST-SYMBOL. Each element in the KEYLIST becomes a key and is
Xassociated with the value in VALUELIST with the same index. If
XVALUELIST is not supplied or is nil, then each key in KEYLIST is
Xassociated with nil.
X
XKEYLIST and VALUELIST should have the same number of elements, but
Xthis isn't enforced.  If VALUELIST is smaller than KEYLIST, remaining
Xkeys are associated with nil.  If VALUELIST is larger than KEYLIST,
Xextra values are ignored.  Returns the created alist."
X  (let ((keycar (car keylist))
X	(keycdr (cdr keylist))
X	(valcar (car valuelist))
X	(valcdr (cdr valuelist)))
X    (cond ((null keycdr)
X	   (aput alist-symbol keycar valcar))
X	  (t
X	   (amake alist-symbol keycdr valcdr)
X	   (aput alist-symbol keycar valcar))))
X  (eval alist-symbol))
END_OF_FILE
if test 5466 -ne `wc -c <'baw-alist.el'`; then
    echo shar: \"'baw-alist.el'\" unpacked with wrong size!
fi
# end of 'baw-alist.el'
fi
if test -f 'cheapcite.el' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'cheapcite.el'\"
else
echo shar: Extracting \"'cheapcite.el'\" \(25766 characters\)
sed "s/^X//" >'cheapcite.el' <<'END_OF_FILE'
X;; ======================================================================
X;; cheapcite.el -- Version 2.1
X
X;; ======================================================================
X;; This a small package which does interactive citations (both nested
X;; and non-nested), ala supercite, but without all the fancy features.
X;; It is supplied for folks who want some of the citing parts of
X;; supercite without all the (what they consider) extra cruft.  An
X;; understandable desire.
X
X;; cheapcite interfaces to mail and news readers exactly the same (de
X;; facto standard) way that supercite does, so refer to all
X;; documentation relating to supercite interfacing for more details.
X
X;; cheapcite uses many of the same variable and function names as
X;; supercite; it is meant to be used instead of supercite not along
X;; with supercite.  Use one or the other.
X
X;; ========== Disclaimer ==========
X;; This software is distributed in the hope that it will be useful,
X;; but WITHOUT ANY WARRANTY.  No author or distributor accepts
X;; responsibility to anyone for the consequences of using it or for
X;; whether it serves any particular purpose or works at all, unless he
X;; says so in writing.
X
X;; Some of this software was written as part of the supercite author's
X;; official duty as an employee of the United States Government and is
X;; thus in the public domain.  You are free to use that particular
X;; software as you wish, but WITHOUT ANY WARRANTY WHATSOEVER.  It
X;; would be nice, though if when you use any of this code, you give
X;; due credit to the author.
X
X;; Other parts of this code were written by other people.  Wherever
X;; possible, credit to that author, and the copy* notice supplied by
X;; the author are included with that code.
X
X;; ========== Author (unless otherwise stated) ==========
X;; NAME: Barry A. Warsaw              USMAIL: National Institute of
X;; TELE: (301) 975-3460                       Standards and Technology
X;; UUCP: uunet!cme.nist.gov!warsaw            Rm. B-124, Bldg. 220
X;; INET: warsaw@cme.nist.gov                  Gaithersburg, MD 20899
X
X;; Want to be on the Supercite mailing list?
X;;
X;; Send articles to supercite@cme.nist.gov or uunet!cme.nist.gov!supercite
X;; Send administrative queries/requests to supercite-request@cme.nist.gov
X;;	or uunet!cme.nist.gov!supercite-request
X
X(provide 'cheapcite)
X
X
X
X;; ======================================================================
X;; start of user defined variables
X;; ======================================================================
X
X(defvar sc-nested-citation-p nil
X  "*Controls whether to use nested or non-nested citation style.")
X
X(defvar sc-citation-leader ""
X  "*String used at the front of a composed citation.")
X
X(defvar sc-citation-delimiter ">"
X  "*String to use at the end of a composed citation.  
XThis string is used in both nested and non-nested citations.  For best
Xresults, use a single character with no trailing space.")
X
X(defvar sc-citation-separator " "
X  "*String used to separate the composed citation and the cited line.
XNormally this character is a single space character though often a
Xsingle tab character is used.")
X
X(defvar sc-cite-regexp "\\s *[a-zA-Z0-9]*\\s *>+\\s *"
X  "*Regular expression describing how a already cited line begins.
XThe regexp is only used at the beginning of a line, so it doesn't need
Xto start with a '^'.")
X
X(defvar sc-fill-paragraph-hook 'sc-fill-paragraph
X  "*Hook for filling a paragraph.  
XThis hook gets executed when you fill a paragraph either manually or
Xautomagically. It expects point to be within the extent of the
Xparagraph that is going to be filled.")
X
X(defvar sc-auto-fill-region-p nil
X  "*If non-nil, automatically fill each paragraph after it has been cited.")
X
X(defvar sc-fixup-whitespace-p nil
X  "*If non-nil, delete all leading white space before citing.")
X
X(defvar sc-nuke-mail-headers-p t
X  "*Nuke or don't nuke mail headers.
XIf non-nil, nuke mail headers after gleaning useful information form
Xthem. If nil, don't nuke mail headers.")
X
X(defvar sc-run-hook nil
X  "*User definable hook.
XRuns after sc-cite-original executes.")
X
X(defvar sc-load-hook nil
X  "*User definable hook.
XRuns after cheapcite is loaded. Set your customizations here.")
X
X(defvar sc-rewrite-header-hook 'sc-standard-header
X  "*User definable hook.
XRuns before original mail headers are nuked.  Set it to a function
Xwhich will write a header for you.  See sc-mail-fetch-field for how to
Xinclude information in your header, and sc-standard-header for an
Xexample function.
X
XNOTE: do not use 'insert' in your function.  Use 'insert-before-markers`.")
X
X(defvar sc-default-keymap
X  '(lambda ()
X     (local-set-key "\C-c\C-t" 'sc-cite)
X     (local-set-key "\C-c\C-a" 'sc-recite)
X     (local-set-key "\C-c\C-u" 'sc-uncite)
X     (local-set-key "\C-c\C-i" 'sc-insert-citation)
X     (local-set-key "\C-c\C-o" 'sc-open-line)
X     (local-set-key "\C-c\C-q" 'sc-fill-paragraph-manually)
X     (local-set-key "\C-c\q"   'sc-fill-paragraph-manually)
X     (local-set-key "\C-c\C-v" 'sc-version)
X     (local-set-key "\C-c?"    'sc-describe)
X     )
X  "*Variable which contains function to set keymap.")
X
X;; **********************************************************************
X;; end of user defined variables
X;; **********************************************************************
X
X
X
X;; ======================================================================
X;; global variables, not user accessable
X
X(defconst sc-version-number "2.1")
X
X;; when rnewspost.el patch is installed (or function is overloaded)
X;; this should be nil since cheapcite now does this itself.
X(setq news-reply-header-hook nil)
X
X(make-variable-buffer-local 'sc-fill-arg)
X(make-variable-buffer-local 'sc-attribution-string)
X(make-variable-buffer-local 'sc-citation-string)
X(setq-default sc-fill-arg nil)
X(setq-default sc-attribution-string "")
X(setq-default sc-citation-string "")
X
X
X;; the new citation style means we can clean out other headers in
X;; addition to those previously cleaned out.  anyway, we create our
X;; own headers.  cleans out mail, gnus, vm and other headers. add to
X;; this for other mail or news readers you may be using.
X
X(setq sc-mail-yank-ignored-headers
X      (concat
X       "^via:\\|^origin:\\|^status:\\|^received:\\|^remailed\\|"
X       "^[a-z-]*message-id:\\|^\\(summary-\\)?line[s]?:\\|^cc:\\|"
X       "^subject:\\|^\\(\\(in-\\)?reply-\\)?to:\\|^sender:\\|^replied:\\|"
X       "^\\(\\(return\\|reply\\)-\\)?path:\\|^\\(posted-\\)?date:\\|"
X       "^\\(mail-\\)?from:\\|^newsgroup[s]?:\\|^organization:\\|^keywords:\\|"
X       "^distribution:\\|^xref:\\|^references:\\|^x-mailer:\\|"
X       "^\\(x-\\)?followup-to:\\|^x-vm-attributes:\\|^expires:\\|"
X       "^approved:\\|^apparently-to:\\|^summary:\\|"
X       "^x-vm-attributes:\\|^x-vm-v[0-9]+-data:"))
X
X
X
X;; ======================================================================
X;; nuking mail headers
X
X(defun sc-mail-yank-clear-headers (start end)
X  "Nuke mail headers between START and END. 
XUse sc-mail-yank-ignored-headers to determine which headers to nuke."
X  (save-excursion
X    (goto-char start)
X    (if (search-forward "\n\n" end t)
X	(save-restriction
X	  (narrow-to-region start (point))
X	  (goto-char start)
X	  (while (let ((case-fold-search t))
X		   (re-search-forward sc-mail-yank-ignored-headers nil t))
X	    (beginning-of-line)
X	    (delete-region (point)
X			   (progn (re-search-forward "\n[^ \t]")
X				  (forward-char -1)
X				  (point))))))))
X
X
X(defun sc-mail-fetch-field (field)
X  "Return the value of the header field FIELD.
XThe buffer is expected to be narrowed to just the headers of the
Xmessage."
X  (save-excursion
X    (goto-char (point-min))
X    (let ((case-fold-search t)
X	  (name (concat "^" (regexp-quote field) "[ \t]*:[ \t]*")))
X      (goto-char (point-min))
X      (if (re-search-forward name nil t)
X	  (let ((opoint (point)))
X	    (while (progn (forward-line 1)
X			  (looking-at "[ \t]")))
X	    (buffer-substring opoint (1- (point))))))))
X
X
X(defun sc-standard-header ()
X  "Write a standard reference header."
X  (insert-before-markers ">>>>> "
X			 (or (sc-mail-fetch-field "from")
X			     "Some anonymous person")
X			 " writes:\n\n"))
X
X
X
X;; ======================================================================
X;; this section queries the user for necessary information
X
X(defun sc-query (default)
X  "Query for an attribution string with the DEFAULT choice.
XReturns the string entered by the user, if non-empty and non-nil, or
XDEFAULT otherwise."
X  (let* ((prompt (concat
X		  (cond ((eq sc-cite-context 'citing) "Cite")
X			((eq sc-cite-context 'reciting) "Recite")
X			(t (error "Cheapcite Error: sc-cite-context invalid!"))
X			)
X		  " with attribution string: "
X		  (if (not (string= default ""))
X		      (concat "(default " default ") "))
X		  ))
X	 (query (read-string prompt)))
X    (if (or (null query)
X	    (string= query ""))
X	default
X      query)))
X
X
X
X;; ======================================================================
X;; this section contains paragraph filling support
X
X(defun sc-guess-fill-prefix ()
X  "Guess the fill prefix used on the current line.
XUse various heuristics to find the fill prefix. Search begins on first
Xnon-blank line in the region delineated by point and mark.
X
X     1) If fill-prefix is already bound to the empty string, return
X        nil.
X
X     2) If fill-prefix is already bound, but not to the empty
X        string, return the value of fill-prefix.
X
X     3) If the current line starts with the last chosen citation
X        string, then that string is returned.
X
X     4) If the current line starts with a string matching the regular
X        expression, sc-cite-regexp, then that string is returned.
X
X     5) Nil is returned."
X  (save-excursion
X    ;; scan for first non-blank line in the region
X    (beginning-of-line)
X    (while (and (< (point) (mark))
X		(eolp))
X      (forward-line 1))
X    (let ((citation sc-citation-string))
X      (cond
X       ((string= fill-prefix "") nil)
X       (fill-prefix)
X       ((looking-at (regexp-quote citation)) citation)
X       ((looking-at sc-cite-regexp)
X	(buffer-substring
X	 (point) (progn
X		   (re-search-forward (concat sc-cite-regexp "\\s *")
X				      (point-max) nil)
X		   (point))))
X       ((looking-at (concat ".*" sc-citation-delimiter "\\s *"))
X	(buffer-substring
X	 (point) (progn (re-search-forward (concat ".*" sc-citation-delimiter
X						   "\\s *"))
X			(point))))
X       (t nil)))))
X
X
X(defun sc-consistant-cite-p (prefix)
X  "Check current paragraph for consistant citation.
XScans to paragraph delineated by (forward|backward)-paragraph to see
Xif all lines start with PREFIX. Returns t if entire paragraph is
Xconsistantly cited, nil otherwise."
X  (save-excursion
X    (let ((end   (progn (forward-paragraph)
X			(beginning-of-line)
X			(or (not (eolp))
X			    (forward-char -1))
X			(point)))
X	  (start (progn (backward-paragraph)
X			(beginning-of-line)
X			(or (not (eolp))
X			    (forward-char 1))
X			(point)))
X	  (badline t))
X      (goto-char start)
X      (beginning-of-line)
X      (while (and (< (point) end)
X		  badline)
X	(setq badline (looking-at prefix))
X	(forward-line 1))
X      badline)))
X
X
X(defun sc-fill-start (fill-prefix)
X  "Find buffer position of start of region which begins with FILL-PREFIX.
XRestrict scan to current paragraph."
X  (save-excursion
X    (let ((badline nil)
X	  (top (save-excursion
X		 (backward-paragraph)
X		 (beginning-of-line)
X		 (or (not (eolp))
X		     (forward-char 1))
X		 (point))))
X      (while (and (not badline)
X		  (> (point) top))
X	(forward-line -1)
X	(setq badline (not (looking-at fill-prefix)))))
X    (forward-line 1)
X    (point)))
X
X
X(defun sc-fill-end (fill-prefix)
X  "Find the buffer position of end of region which begins with FILL-PREFIX.
XRestrict scan to current paragraph."
X  (save-excursion
X    (let ((badline nil)
X	  (bot (save-excursion
X		 (forward-paragraph)
X		 (beginning-of-line)
X		 (or (not (eolp))
X		     (forward-char -1))
X		 (point))))
X      (while (and (not badline)
X		  (< (point) bot))
X	(beginning-of-line)
X	(setq badline (not (looking-at fill-prefix)))
X	(forward-line 1)))
X    (forward-line -1)
X    (point)))
X
X
X(defun sc-fill-paragraph ()
X  "Cheapcite's paragraph fill function.
XFill the paragraph containing or following point. Use
Xsc-guess-fill-prefix to find the fill-prefix for the paragraph.
X
XIf the paragraph is inconsistantly cited (mixed fill-prefix), then the
Xuser is queried to restrict the the fill to only those lines around
Xpoint which begin with the fill prefix.
X
XThe variable sc-fill-arg is passed to fill-paragraph and
Xfill-region-as-paragraph which controls justification of the
Xparagraph.  sc-fill-arg is set by sc-fill-paragraph-manually."
X  (save-excursion
X    (let ((pnt (point))
X	  (fill-prefix (sc-guess-fill-prefix)))
X      (cond
X       ((not fill-prefix)
X	(fill-paragraph sc-fill-arg))
X       ((sc-consistant-cite-p fill-prefix)
X	(fill-paragraph sc-fill-arg))
X       ((y-or-n-p "Inconsistent citation found. Restrict? ")
X	(message "")
X	(fill-region-as-paragraph (progn (goto-char pnt)
X					 (sc-fill-start fill-prefix))
X				  (progn (goto-char pnt)
X					 (sc-fill-end fill-prefix))
X				  sc-fill-arg))
X       (t
X	(message "")
X	(progn
X	  (setq fill-prefix sc-citation-string)
X	  (fill-paragraph sc-fill-arg))
X	))
X      )))
X
X
X
X;; ======================================================================
X;; region citing and unciting
X
X(defun sc-cite-region (start end)
X  "Cite the region between START and END."
X  (save-excursion
X    (set-mark end)
X    (goto-char start)
X    (beginning-of-line)
X    (let ((fstart (point))
X	  (fend   (point)))
X      (while (< (point) (mark))
X	;; remove leading whitespace if desired 
X	(and sc-fixup-whitespace-p
X	     (fixup-whitespace))
X	;; if end of line then perhaps autofill
X	(cond ((eolp)
X	       (or (= fstart fend)
X		   (not sc-auto-fill-region-p)
X		   (save-excursion (set-mark fend)
X				   (goto-char (/ (+ fstart fend 1) 2))
X				   (run-hooks 'sc-fill-paragraph-hook)))
X	       (setq fstart (point)
X		     fend (point)))
X	      ;; not end of line so perhap cite it
X	      ((not (looking-at sc-cite-regexp))
X	       (insert (or sc-citation-string "")))
X	      (sc-nested-citation-p sc-citation-delimiter)
X	      )
X	(setq fend (point))
X	(forward-line 1)))))
X
X
X(defun sc-uncite-region (start end cite-regexp)
X  "Uncite the previously cited region between START and END.
XCITE-REGEXP describes how a cited line of texts starts.  Unciting also
Xauto-fills paragraph if sc-auto-fill-region-p is non-nil."
X  (save-excursion
X    (set-mark end)
X    (goto-char start)
X    (beginning-of-line)
X    (let ((fstart (point))
X	  (fend (point)))
X      (while (< (point) (mark))
X	;; if end of line, then perhaps autofill
X	(cond ((eolp)
X	       (or (= fstart fend)
X		   (not sc-auto-fill-region-p)
X		   (save-excursion (set-mark fend)
X				   (goto-char (/ (+ fstart fend 1) 2))
X				   (run-hooks 'sc-fill-paragraph-hook)))
X	       (setq fstart (point)
X		     fend (point)))
X	      ;; not end of line so perhaps uncite it
X	      ((looking-at cite-regexp)
X	       (save-excursion
X		 (save-restriction
X		   (narrow-to-region (progn (beginning-of-line)
X					    (point))
X				     (progn (end-of-line)
X					    (point)))
X		   (beginning-of-line)
X		   (delete-region (point-min)
X				  (progn (re-search-forward cite-regexp
X							    (point-max)
X							    t)
X					 (match-end 0)))))))
X	(setq fend (point))
X	(forward-line 1)))))
X
X
X
X;; ======================================================================
X;; top level interactive functions which can be bound to keystrokes
X
X(defun sc-cite ()
X  "Cite the region of text between point and mark.
X
XThe mail header lines should be at the top of the region, with the
Xbody of the reply following.  These mail header lines will be parse
Xfirst for useful information, then deleted."
X  (interactive)
X  (undo-boundary)
X  (let ((xchange (if (> (mark) (point)) nil
X		   (exchange-point-and-mark)
X		   t))
X	(sc-cite-context 'citing))
X    (setq sc-attribution-string (sc-query sc-attribution-string))
X    (setq sc-citation-string (concat sc-citation-leader
X				     sc-attribution-string
X				     sc-citation-delimiter
X				     sc-citation-separator))
X    (sc-cite-region (point) (mark))
X    ;; leave point on first cited line
X    (while (and (< (point) (mark))
X		(not (looking-at (if sc-nested-citation-p
X				     sc-citation-delimiter
X				   sc-citation-string))))
X      (forward-line 1))
X    (and xchange
X	 (exchange-point-and-mark))
X    ))
X
X
X(defun sc-uncite ()
X  "Uncite the region between point and mark."
X  (interactive)
X  (undo-boundary)
X  (let ((xchange (if (> (mark) (point)) nil
X		   (exchange-point-and-mark)
X		   t))
X	(fp (or (sc-guess-fill-prefix)
X		"")))
X    (sc-uncite-region (point) (mark) (regexp-quote fp))
X    (and xchange
X	 (exchange-point-and-mark))
X    ))
X
X
X(defun sc-recite ()
X  "Recite the region by first unciting then citing the text."
X  (interactive)
X  (undo-boundary)
X  (let ((xchange (if (> (mark) (point)) nil
X		   (exchange-point-and-mark)
X		   t))
X	(sc-cite-context 'reciting))
X    (setq sc-attribution-string (sc-query sc-attribution-string))
X    (sc-uncite-region (point) (mark) (regexp-quote (sc-guess-fill-prefix)))
X    (setq sc-citation-string (concat sc-citation-leader
X				     sc-attribution-string
X				     sc-citation-delimiter
X				     sc-citation-separator))
X    (sc-cite-region (point) (mark))
X    (and xchange
X	 (exchange-point-and-mark))
X    ))
X
X
X(defun sc-insert-citation ()
X  "Insert citation string at beginning of current line."
X  (interactive)
X  (save-excursion
X    (beginning-of-line)
X    (insert sc-attribution-string)))
X
X
X(defun sc-open-line (arg)
X  "Insert a newline and leave point before it.
XAlso inserts the guessed prefix at the beginning of the new line. With
Xnumeric ARG, inserts that many newlines."
X  (interactive "p")
X  (save-excursion
X    (let ((start (point))
X	  (string (sc-guess-fill-prefix)))
X      (open-line arg)
X      (goto-char start)
X      (forward-line 1)
X      (while (< 0 arg)
X	(insert string)
X	(forward-line 1)
X	(setq arg (- arg 1))))))
X
X
X(defun sc-fill-paragraph-manually (arg)
X  "Fill current cited paragraph.
XReally just runs the hook sc-fill-paragraph-hook, however it does set
Xthe global variable sc-fill-arg to the value of ARG.  This is
Xcurrently the only way to pass an argument to a hookified function."
X  (interactive "P")
X  (setq sc-fill-arg arg)
X  (run-hooks 'sc-fill-paragraph-hook))
X
X
X(defun sc-version ()
X  "Show cheapcite version."
X  (interactive)
X  (message "Using Cheapcite %s" sc-version-number))
X
X
X
X;; ======================================================================
X;; leach onto current mode
X
X(defun sc-append-current-keymap ()
X  "Append some useful key bindings to the current local key map."
X  (run-hooks 'sc-default-keymap)
X  (setq sc-leached-keymap (current-local-map))
X  )
X
X
X(defun sc-snag-all-keybindings ()
X  "Snag all keybindings in major-modes current keymap."
X  (let* ((curkeymap (current-local-map))
X	 (symregexp ".*sc-.*\n")
X	 (docstring (substitute-command-keys "\\{curkeymap}"))
X	 (start 0)
X	 (maxend (length docstring))
X	 (spooge ""))
X    (while (and (< start maxend)
X		(string-match symregexp docstring start))
X      (setq spooge (concat spooge (substring docstring
X					     (match-beginning 0)
X					     (match-end 0))))
X      (setq start (match-end 0)))
X    spooge))
X
X
X(defun sc-spoogify-docstring ()
X  "Modifies (makes into spooge) the docstring for the current major mode.
XThis will leach the keybinding descriptions for cheapcite onto the end
Xof the current major mode's docstring.  If major mode is preloaded,
Xthis function will first make a copy of the list associated with the
Xmode, then modify this copy."
X  (let* ((symfunc (symbol-function major-mode))
X	 (doc-cdr (nthcdr 2 symfunc))
X	 (doc-str (documentation major-mode)))
X    (cond
X     ;; is a docstring even provided?
X     ((not (stringp doc-str)))
X     ;; have we already leached on?
X     ((string-match "Cheapcite" doc-str))
X     ;; lets build the new doc string
X     (t
X      (let ((newdoc-str (concat doc-str "
X
XThe major mode for this buffer has been modified to include the
XCheapcite 2.1 package for handling attributions and citations of
Xoriginal messages in email replies.  For more information on this
Xpackage, type \"\\[sc-describe]\" (see below).  The following keys are
Xbound to Cheapcite commands:
X
X"
X				(sc-snag-all-keybindings))))
X	(condition-case nil
X	    (setcar doc-cdr newdoc-str)
X	  (error
X	   ;; the major mode must be preloaded, make a copy first
X	   (setq symfunc (copy-sequence (symbol-function major-mode))
X		 doc-cdr (nthcdr 2 symfunc))
X	   (setcar doc-cdr newdoc-str)
X	   (fset major-mode symfunc)
X	   ))
X	))
X     )))
X
X
X;; ======================================================================
X;; this section contains default hooks and hook support for execution
X
X(defun sc-cite-original ()
X  "Hook version of sc-cite.
X
XThis is callable from the various mail and news readers' reply
Xfunction according to the predefined standard. Type
X\"\\[sc-describe]\" for more details.  Sc-cite-original does not do
Xany yanking of the original message but it does require a few things:
X
X     1) The reply buffer is the current buffer.
X
X     2) The original message has been yanked and inserted into the
X        reply buffer.
X
X     3) Verbose mail headers from the original message have been
X        inserted into the reply buffer directly before the text of the
X        original message.
X
X     4) Point is at the beginning of the verbose headers.
X
X     5) Mark is at the  end of the body of text to be cited."
X  (let ((headers (point-marker)))
X    (run-hooks 'sc-rewrite-header-hook)
X    (goto-char headers))
X  (let ((start (region-beginning))
X	(end   (region-end)))
X    (if sc-nuke-mail-headers-p
X	(sc-mail-yank-clear-headers start end))
X    (sc-cite)
X    (sc-append-current-keymap)
X    (sc-spoogify-docstring)
X    (run-hooks 'sc-run-hook)
X    ))
X
X
X
X;; ======================================================================
X;; describe this package
X
X(defun sc-describe ()
X  "Describe the Cheapcite 2.1 package.
X
XThis package provides a subset of the features provided by the
Xsupercite 2.1 package.  Cheapcite is mainly intended for folks who
Xwant to have more control over citations of original mail/news
Xmessages, but don't like the complexity and/or size of supercite. Some
Xfolks will undoubtably think cheapcite is too complex for its
Xfunctionality and they can easily ignore both supercite and cheapcite.
X
XThis help string basically outlines the differences between cheapcite
Xand supercite.  You should be familiar with supercite's concepts
Xbefore you read this help string.
X
XAuthor:
X
XNAME: Barry A. Warsaw            USMAIL: National Institute of
XTELE: (301) 975-3460                     Standards and Technology
XUUCP: uunet!cme.nist.gov!warsaw          Rm. B-124, Bldg. 220
XINET: warsaw@cme.nist.gov                Gaithersburg, MD 20899
X
XGet on the Supercite mailing list:
X
XSend articles to:
X          INET: supercite@cme.nist.gov
X          UUCP: uunet!cme.nist.gov!supercite
X
XSend administrivia (additions/deletions to list, etc) to:
X          INET: supercite-request@cme.nist.gov
X          UUCP: uunet!cme.nist.gov!supercite-request
X
X-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
X
XCheapcite understands these supercite variables, which have almost
Xidentical function within the cheapcite package:
X
X     sc-nested-citation-p
X     sc-citation-leader
X     sc-citation-delimiter
X     sc-citation-separator
X     sc-cite-regexp
X     sc-fill-paragraph-hook
X     sc-auto-fill-region-p
X     sc-fixup-whitespace-p
X     sc-nuke-mail-headers-p
X     sc-run-hook
X     sc-load-hook
X     sc-default-keymap
X
XCheapcite has no concept of global alists (gal's) and no information
Xis gleaned from mail headers before they are nuked.  Cheapcite does
Xnot attempt to decipher an attribution string from mail headers,
Xinstead, it queries the user for an attribution string every time it
Xtries to cite a body of text.  Cheapcite does remember the last
Xattribution string entered by you and will use that as a default.
X
XSince no information is gleaned from mail headers, cheapcite can't
Xreally rewrite reference headers. Instead, a hook is executed before
Xthe mail headers are nuked:
X
X     Variable: sc-rewrite-header-hook
X          Hook which executes a reference header rewrite function on
X          the buffer *before* the original mail headers are nuked.
X
X          NOTE: be sure to use 'insert-before-markers' instead of
X          'insert' in the function set in this hook.
X          Default: 'sc-standard-header.
X
XYou can use sc-mail-fetch-field to get coarse information from the
Xoriginal mail headers.
X
X-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
X
XCheapcite provides these commands with similar functionality to their
Xsupercite equivalents:
X
X     sc-cite
X     sc-uncite
X     sc-recite
X     sc-insert-citation
X     sc-open-line
X     sc-fill-paragraph-manually
X     sc-version
X
XCheapcite will also leach onto the current local keymap in a manner
Xsimilar to supercite, however cheapcite has no notion of a
Xper-interface keymap.  It will only use sc-default-keymap to set the
Xdesired keybindings.
X
X
X-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
X
XIf this explanation of cheapcite seems terse, you're right.  But then,
Xthat's the purpose of cheapcite.  I've really attempted to pair down
Xsupercite as much as I could, while maintaining the flavor of the
Xpackage.
X
XEnjoy, and please send the author your compliments, questions,
Xsuggestions and bug reports.  Don't forget, if you're interested in
Xdiscussing supercite and/or cheapcite, join the mailing list by
Xsending mail to the request line mentioned above."
X  (interactive)
X  (describe-function 'sc-describe))
X
X
X;; ======================================================================
X;; load hook
X(run-hooks 'sc-load-hook)
END_OF_FILE
if test 25766 -ne `wc -c <'cheapcite.el'`; then
    echo shar: \"'cheapcite.el'\" unpacked with wrong size!
fi
# end of 'cheapcite.el'
fi
if test -f 'mh-e.el.diff' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'mh-e.el.diff'\"
else
echo shar: Extracting \"'mh-e.el.diff'\" \(3006 characters\)
sed "s/^X//" >'mh-e.el.diff' <<'END_OF_FILE'
X*** lisp/mh-e.el	Thu Sep  1 11:21:53 1988
X--- lisp.local/mh-e.el	Fri Sep 22 11:16:58 1989
X***************
X*** 1819,1822 ****
X--- 1819,1824 ----
X  
X  
X+ ;; mod 22-Sep-1989 mdb:: mdb@ESD.3Com.COM, {3comvax,auspex,sun}!bridge2!mdb
X+ ;; modified to conditionally use mhl instead of always using it.
X  (defun mh-insert-letter (prefix-provided folder msg)
X    "Insert a message from any folder into the current letter.
X***************
X*** 1835,1844 ****
X    (save-restriction
X      (narrow-to-region (point) (point))
X!     (let ((start (point-min)))
X        (if (equal msg "") (setq msg (format "%d" mh-sent-from-msg)))
X!       (mh-exec-lib-cmd-output "mhl" "-nobell" "-noclear"
X! 			      (mh-expand-file-name msg
X! 						   (mh-expand-file-name
X! 						    folder)))
X        (when (not prefix-provided)
X  	    (mh-clean-msg-header start mh-invisible-headers mh-visible-headers)
X--- 1837,1849 ----
X    (save-restriction
X      (narrow-to-region (point) (point))
X!     (let ((start (point-min))
X! 	  (msg-filename (mh-expand-file-name msg (mh-expand-file-name folder))))
X        (if (equal msg "") (setq msg (format "%d" mh-sent-from-msg)))
X!       (if mhl-formfile
X! 	  (if (stringp mhl-formfile)
X! 	      (mh-exec-lib-cmd-output
X! 	       "mhl" "-nobell" "-noclear" "-form" mhl-formfile msg-filename)
X! 	    (mh-exec-lib-cmd-output "mhl" "-nobell" "-noclear" msg-filename))
X! 	(insert-file-contents msg-filename t))
X        (when (not prefix-provided)
X  	    (mh-clean-msg-header start mh-invisible-headers mh-visible-headers)
X***************
X*** 1883,1892 ****
X        (error "There is no current message.")))
X  
X  (defun mh-insert-prefix-string (ins-string)
X    ;; Preface each line in the current buffer with STRING.
X!   (goto-char (point-min))
X!   (while (not (eobp))
X!     (insert ins-string)
X!     (forward-line 1)))
X  
X  
X--- 1888,1921 ----
X        (error "There is no current message.")))
X  
X+ ;; mod 7-Sep-1989 mdb: mdb@ESD.3Com.COM, {3comvax,auspex,sun}!bridge2!mdb
X+ ;; generalized, hookified citations
X  (defun mh-insert-prefix-string (ins-string)
X    ;; Preface each line in the current buffer with STRING.
X!   (setq mh-ins-string ins-string)
X!   (save-excursion
X!     (set-mark (point-max))
X!     (goto-char (point-min))
X! ;;  (while (not (eobp))
X! ;;    (insert ins-string)
X! ;;    (forward-line 1)))
X!     (run-hooks 'mh-yank-hooks)))
X! 
X! ;; added 7-Sep-1988 mdb: mdb@ESD.3Com.COM, {3comvax,auspex,sun}!bridge2!mdb
X! ;; generalized, hookified citations
X! (defvar mh-ins-string nil
X!   "A temporary set by mh-insert-prefix prior to running mh-yank-hooks .")
X! 
X! ;; added 7-Sep-1988 mdb: mdb@ESD.3Com.COM, {3comvax,auspex,sun}!bridge2!mdb
X! ;; generalized, hookified citations
X! (defvar mh-yank-hooks
X!   '(lambda ()
X!      (save-excursion
X!        (goto-char (point))
X!        (or (bolp) (forward-line 1))
X!        (while (< (point) (mark))
X! 	 (insert mh-ins-string)
X! 	 (forward-line 1))))
X!   "Hook to run citation function. Expects POINT and MARK to be set to
X! the region to cite.")
X  
X  
END_OF_FILE
if test 3006 -ne `wc -c <'mh-e.el.diff'`; then
    echo shar: \"'mh-e.el.diff'\" unpacked with wrong size!
fi
# end of 'mh-e.el.diff'
fi
if test -f 'rnewspost.el.diff' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'rnewspost.el.diff'\"
else
echo shar: Extracting \"'rnewspost.el.diff'\" \(917 characters\)
sed "s/^X//" >'rnewspost.el.diff' <<'END_OF_FILE'
X*** rnewspost.el.orig	Thu Jun 29 22:38:15 1989
X--- rnewspost.el	Fri Jul 28 18:38:12 1989
X***************
X*** 118,123 ****
X    (mail-yank-original arg)
X    (exchange-point-and-mark)
X!   (insert "In article " news-reply-yank-message-id
X! 	  " " news-reply-yank-from " writes:\n\n"))
X  
X  (defun news-reply-newsgroups ()
X--- 118,132 ----
X    (mail-yank-original arg)
X    (exchange-point-and-mark)
X!   ;; added 14-Jun-1989 baw: warsaw@cme.nist.gov, uunet!cme-durer!warsaw
X!   ;; generalized, hookified citations
X!   (run-hooks 'news-reply-header-hook))
X!  
X! ;; added 14-Jun-1989 baw: warsaw@cme.nist.gov, uunet!cme-durer!warsaw
X! ;; generalized, hookified citations
X! (defvar news-reply-header-hook
X!   '(lambda ()
X! 	 (insert "In article " news-reply-yank-message-id
X! 			 " " news-reply-yank-from " writes:\n\n"))
X!   "Hook for inserting a header at the top of a yanked message.")
X  
X  (defun news-reply-newsgroups ()
END_OF_FILE
if test 917 -ne `wc -c <'rnewspost.el.diff'`; then
    echo shar: \"'rnewspost.el.diff'\" unpacked with wrong size!
fi
# end of 'rnewspost.el.diff'
fi
if test -f 'sc-electric.el' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'sc-electric.el'\"
else
echo shar: Extracting \"'sc-electric.el'\" \(6889 characters\)
sed "s/^X//" >'sc-electric.el' <<'END_OF_FILE'
X;; sc-electric.el  --  Version 2.1
X
X;; ========== Introduction ==========
X;; This file contains sc-electric mode for viewing reference headers.
X;; It is loaded automatically by supercite.el when needed.
X
X;; ========== Disclaimer ==========
X;; This software is distributed in the hope that it will be useful,
X;; but WITHOUT ANY WARRANTY.  No author or distributor accepts
X;; responsibility to anyone for the consequences of using it or for
X;; whether it serves any particular purpose or works at all, unless he
X;; says so in writing.
X
X;; Some of this software was written as part of the supercite author's
X;; official duty as an employee of the United States Government and is
X;; thus in the public domain.  You are free to use that particular
X;; software as you wish, but WITHOUT ANY WARRANTY WHATSOEVER.  It
X;; would be nice, though if when you use any of this code, you give
X;; due credit to the author.
X
X;; Other parts of this code were written by other people.  Wherever
X;; possible, credit to that author, and the copy* notice supplied by
X;; the author are included with that code.
X
X;; ========== Author (unless otherwise stated) ==========
X;; NAME: Barry A. Warsaw              USMAIL: National Institute of
X;; TELE: (301) 975-3460                       Standards and Technology
X;; UUCP: uunet!cme.nist.gov!warsaw            Rm. B-124, Bldg. 220
X;; INET: warsaw@cme.nist.gov                  Gaithersburg, MD 20899
X
X;; Want to be on the Supercite mailing list?
X;;
X;; Send articles to supercite@cme.nist.gov or uunet!cme.nist.gov!supercite
X;; Send administrative queries/requests to supercite-request@cme.nist.gov
X;;	or uunet!cme.nist.gov!supercite-request
X
X(provide 'sc-electric)
X
X
X;; ======================================================================
X;; set up vars for major mode
X
X(defconst sc-electric-bufname "*sc-erefs*"
X  "*Supercite's electric buffer name.")
X
X
X(defvar sc-electric-mode-hook nil
X  "*Hook for sc-electric-mode.")
X
X
X
X;; ======================================================================
X;; sc-electric-mode
X
X(defun sc-electric-mode (&optional arg)
X  "Quasi major mode for viewing supercite reference headers.
XCommands are: \\{sc-electric-mode-map}
XSc-electric-mode is not intended to be run interactively, but rather
Xaccessed through supercite's electric reference feature.  See
Xsc-insert-reference for more details. Optional ARG is the initial
Xheader style to use, unless not supplied or invalid, in which case
Xsc-preferred-header-style is used."
X  (let ((gal sc-gal-information)
X	(sc-eref-style (if arg  ;; assume passed arg is okay
X			   arg
X			 (if (and (natnump sc-preferred-header-style)
X				  (sc-valid-index-p sc-preferred-header-style))
X			     sc-preferred-header-style
X			   0)))
X	(gmap (current-global-map))
X	(lmap (current-local-map))
X	(mmap (copy-keymap minibuffer-local-map))
X	chr
X	)
X    (get-buffer-create sc-electric-bufname)
X    (save-excursion
X      (set-buffer sc-electric-bufname)
X      (kill-all-local-variables)
X      (setq sc-gal-information gal)
X      (sc-eref-show sc-eref-style)
X      (setq buffer-read-only t)
X      (setq mode-name "Supercite-Electric-References")
X      (setq major-mode 'sc-electric-mode)
X      (run-hooks 'sc-electric-mode-hook)
X      )
X    (display-buffer sc-electric-bufname)
X    ;; set up keymaps in current buffer
X    (use-global-map (copy-keymap gmap))
X    (suppress-keymap (current-global-map))
X    (use-local-map sc-electric-mode-map)
X    (setq chr 0)
X    (while (<= chr 9)
X      (define-key minibuffer-local-map (int-to-string chr)
X	'self-insert-command)
X      (setq chr (1+ chr))
X      )
X    (define-key minibuffer-local-map "-" 'undefined)
X    ;; enter command loop
X    (recursive-edit)
X    (if sc-eref-style
X	(condition-case nil
X	    (eval (nth sc-eref-style sc-rewrite-header-list))
X	  (error nil)
X	  ))	  
X    ;; now restore state
X    (use-local-map lmap)
X    (use-global-map gmap)
X    (setq minibuffer-local-map mmap)
X    ))
X
X
X
X;; ======================================================================
X;; functions for electric mode
X
X(defun sc-eref-index (index)
X  "Check INDEX to be sure it is a valid index into sc-rewrite-header-list.
XIf sc-electric-circular-p is non-nil, then list is considered circular
Xso that movement across the ends of the list wraparound."
X  (let ((last (1- (length sc-rewrite-header-list))))
X    (cond ((sc-valid-index-p index) index)
X	  ((< index 0)
X	   (if sc-electric-circular-p last
X	     (progn (error "No preceding reference headers in list.") 0)))
X	  ((> index last)
X	   (if sc-electric-circular-p 0
X	     (progn (error "No following reference headers in list.") last)))
X	  )
X    ))
X
X
X(defun sc-eref-show (index)
X  "Show reference INDEX in sc-rewrite-header-list."
X  (setq sc-eref-style (sc-eref-index index))
X  (save-excursion
X    (set-buffer sc-electric-bufname)
X    (let ((ref (nth sc-eref-style sc-rewrite-header-list))
X	  (buffer-read-only nil))
X      (erase-buffer)
X      (goto-char (point-min))
X      (condition-case err
X	  (progn
X	    (eval ref)
X	    (message "Showing reference header %d." sc-eref-style)
X	    )
X	(void-function
X	 (progn (message
X		 "Symbol's function definition is void: %s (Header %d)"
X		 (symbol-name (car (cdr err)))
X		 sc-eref-style)
X		(beep)
X		))
X	))))
X
X
X
X;; ======================================================================
X;; interactive commands
X
X(defun sc-eref-describe ()
X  "Describe supercite electric reference mode."
X  (interactive)
X  (save-excursion
X    (set-buffer sc-electric-bufname)
X    (describe-mode)))
X
X
X(defun sc-eref-next ()
X  "Display next reference in minibuffer."
X  (interactive)
X  (sc-eref-show (1+ sc-eref-style)))
X
X
X(defun sc-eref-prev ()
X  "Display previous reference in minibuffer."
X  (interactive)
X  (sc-eref-show (1- sc-eref-style)))
X
X
X(defun sc-eref-setn ()
X  "Set reference header selected as preferred."
X  (interactive)
X  (setq sc-preferred-header-style sc-eref-style)
X  (message "Preferred reference style set to header %d." sc-eref-style))
X
X
X(defun sc-eref-goto (refnum)
X  "Show reference style indexed by REFNUM.
XIf REFNUM is an invalid index, don't go to that reference and return
Xnil."
X  (interactive "NGoto Reference Number: ")
X  (if (sc-valid-index-p refnum)
X      (sc-eref-show refnum)
X    (error "Invalid reference number: %d. (Range: [%d, %d])"
X	   refnum 0 (1- length sc-rewrite-header-list))
X    ))
X
X
X(defun sc-eref-jump ()
X  "Set reference header to preferred header."
X  (interactive)
X  (sc-eref-show sc-preferred-header-style))
X
X
X(defun sc-eref-abort ()
X  "Exit from electric referencing without inserting reference."
X  (interactive)
X  (setq sc-eref-style nil)
X  (delete-windows-on sc-electric-bufname)
X  (kill-buffer sc-electric-bufname)
X  (exit-recursive-edit))
X
X
X(defun sc-eref-exit ()
X  "Exit from electric referencing and insert selected reference."
X  (interactive)
X  (delete-windows-on sc-electric-bufname)
X  (kill-buffer sc-electric-bufname)
X  (exit-recursive-edit))
END_OF_FILE
if test 6889 -ne `wc -c <'sc-electric.el'`; then
    echo shar: \"'sc-electric.el'\" unpacked with wrong size!
fi
# end of 'sc-electric.el'
fi
if test -f 'sc-oloads.el' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'sc-oloads.el'\"
else
echo shar: Extracting \"'sc-oloads.el'\" \(9666 characters\)
sed "s/^X//" >'sc-oloads.el' <<'END_OF_FILE'
X;; sc-oloads.el  --  Version 2.1
X
X;; ========== Introduction ==========
X;; This file contains overloading facilities for supercite.  Supercite
X;; interfaces to various news and mail reading packages in a standard
X;; way, as determined in 1989 by the supercite mailing list
X;; participants.  Many mail/news package authors participated in the
X;; discussion and the standard is an outcome of those discussions.
X
X;; As of the date of this writing (18-Jul-1990), only VM 4.40+ conform
X;; to the standard out-of-the-package.  Since RMAIL, GNUS, RNEWS, MH
X;; and other packages utilize elisp in the emacs 18.55 distribution,
X;; and since this distribution does not conform to the standard,
X;; patches are necessary to enable these packages to use supercite.
X
X;; It is preferrable to install the patches that are supplied with
X;; supercite, however, that is not always possible.  This package will
X;; let you overload certain functions which should provide access to
X;; supercite for most of the mail/news readers I currently know about.
X;; Packages supported (I hope): GNUS 3.12 and up, VM 4.40 and up,
X;; RMAIL and RNEWS for 18.55, MH, probably GNEWS and PCMAIL.  Are
X;; there others?
X
X;; ========== Disclaimer ==========
X;; This software is distributed in the hope that it will be useful,
X;; but WITHOUT ANY WARRANTY.  No author or distributor accepts
X;; responsibility to anyone for the consequences of using it or for
X;; whether it serves any particular purpose or works at all, unless he
X;; says so in writing.
X
X;; Some of this software was written as part of the supercite author's
X;; official duty as an employee of the United States Government and is
X;; thus in the public domain.  You are free to use that particular
X;; software as you wish, but WITHOUT ANY WARRANTY WHATSOEVER.  It
X;; would be nice, though if when you use any of this code, you give
X;; due credit to the author.
X
X;; Other parts of this code were written by other people.  Wherever
X;; possible, credit to that author, and the copy* notice supplied by
X;; the author are included with that code.
X
X;; ========== Author (unless otherwise stated) ==========
X;; NAME: Barry A. Warsaw              USMAIL: National Institute of
X;; TELE: (301) 975-3460                       Standards and Technology
X;; UUCP: uunet!cme.nist.gov!warsaw            Rm. B-124, Bldg. 220
X;; INET: warsaw@cme.nist.gov                  Gaithersburg, MD 20899
X
X;; Want to be on the Supercite mailing list?
X;;
X;; Send articles to supercite@cme.nist.gov or uunet!cme.nist.gov!supercite
X;; Send administrative queries/requests to supercite-request@cme.nist.gov
X;;	or uunet!cme.nist.gov!supercite-request
X
X(provide 'sc-oloads)
X
X
X;; ======================================================================
X;; functions which do the overloading
X;; based on code supplied by umerin@tc.nagasaki.go.jp
X
X(defvar sc-overload-functions
X  '((mail-yank-original       sc-mail-yank-original)
X    (news-reply-yank-original sc-news-reply-yank-original)
X    (mh-insert-letter         sc-mh-insert-letter)
X    (mh-insert-prefix-string  sc-mh-insert-prefix-string)
X    )
X  "*Functions overloaded by supercite.
XIt is a list of '(original overload)', where original is the original
Xfunction symbol, overload is the supercite equivalent function.")
X
X
X(defun sc-overload-functions ()
X  "Overload functions defined by the variable sc-overload-functions.
XIf the original symbol is not yet bound, it will not be overloaded.
XAlso, if the symbol has already been overloaded, it will not be
Xoverloaded again."
X  (let ((binding   nil)
X	(overloads sc-overload-functions))
X    (while overloads
X      (setq binding   (car overloads))
X      (setq overloads (cdr overloads))
X      (and (fboundp (car binding))
X	   (not (get (car binding) 'sc-overloaded))
X	   (progn
X	     (fset (car binding) (symbol-function (car (cdr binding))))
X	     (put (car binding) 'sc-overloaded 'sc-overloaded))
X	   )
X      )))
X
X
X
X;; ======================================================================
X;; sendmail.el overload functions. This is the heart of supercite
X;; conformance by packages which rely on distribution emacs elisp. You
X;; should almost always overload this function.
X
X(defun sc-mail-yank-original (arg)
X  "Supercite version of mail-yank-original.
XThis function is the workhorse which many packages rely upon to do
Xciting. It inserts the message being replied to in the reply buffer.
XPuts point before the mail headers and mark after body of text.
X
XCitation is accomplished by running the hook mail-yank-hooks and is
Xthus user configurable. Default is to indent each nonblank line ARG
Xspaces (default 3). Just \\[universal-argument] as argument means
Xdon't indent and don't delete any header fields."
X  (interactive "P")
X  (if mail-reply-buffer
X      (let ((start (point)))
X	(delete-windows-on mail-reply-buffer)
X	(insert-buffer mail-reply-buffer)
X	(if (consp arg)
X	    nil
X	  ;; mod 28-Jul-1989 baw: warsaw@cme.nist.gov,
X	  ;; generalized, hookified citations
X	  (run-hooks 'mail-yank-hooks))
X	(exchange-point-and-mark)
X	(if (not (eolp)) (insert ?\n)))))
X
X;; added 28-Jul-1989 baw: warsaw@cme.nist.gov
X;; generalized, hookified citations
X(defvar mail-indention-spaces 3
X  "*Set to number of spaces to indent when yanking a reply.")
X
X
X;; added 28-Jul-1989 baw: warsaw@cme.nist.gov
X;; generalized, hookified citations
X(defvar mail-yank-hooks
X  "*Hook for citing a yanked original message in a reply buffer."
X  '(lambda ()
X     (indent-rigidly (point) (mark) mail-indention-spaces))
X  "Hook to run citation function.
XExpects point and mark to be set to the region to cite.")
X
X
X
X;; ======================================================================
X;; rnewspost.el overload functions.  Not strictly necessary for supercite
X;; to work but it reduces the amount of manual cleaning the user has to
X;; do for GNUS and other news readers.
X
X(defun sc-news-reply-yank-original (arg)
X  "Supercite version of news-reply-yank-original.
XInsert the message being replied to in the reply buffer. Puts point
Xbefore the mail headers and mark after body of the text.  Calls
Xmail-yank-original to actually yank the message into the buffer and
Xcite text.  
X
XIf mail-yank-original is not overloaded by supercite, each nonblank
Xline is indented ARG spaces (default 3).  Just \\[universal-argument]
Xas ARG means don't indent and don't delete any header fields."
X  (interactive "P")
X  (mail-yank-original arg)
X  (exchange-point-and-mark)
X  ;; added 14-Jun-1989 baw: warsaw@cme.nist.gov
X  ;; generalized, hookified citations
X  (run-hooks 'news-reply-header-hook))
X
X
X;; added 14-Jun-1989 baw: warsaw@cme.nist.gov generalized, hookified
X;; citations (modified 18-Jul-1990)
X(defvar news-reply-header-hook
X  "*Hook which handles insertion of a reference header."
X  '(lambda ()
X     (insert "In article " news-reply-yank-message-id
X	     " " news-reply-yank-from " writes:\n\n"))
X  "Hook for inserting a header at the top of a yanked message.")
X
X
X
X;; ======================================================================
X;; mh-e diffs supplied by Mark D. Baushke
X;;      Internet: mdb@ESD.3Com.COM
X;;      UUCP:     {3comvax,auspex,sun}!bridge2!mdb
X;;
X;; mod 22-Sep-1989 mdb:: mdb@ESD.3Com.COM, {3comvax,auspex,sun}!bridge2!mdb
X;; modified to conditionally use mhl instead of always using it.
X(defun sc-mh-insert-letter (prefix-provided folder msg)
X  "Insert a message from any folder into the current letter.
XRemoves the message's headers using mh-invisible-headers.
XPrefixes each non-blank line with mh-ins-buf-prefix (default \">> \").
XIf (optional) prefix argument provided, do not indent and do not delete
Xheaders.
XLeaves the mark before the letter and point after it."
X  (interactive
X   (list current-prefix-arg
X	 (mh-prompt-for-folder "Message from" mh-sent-from-folder nil)
X	 (read-input (format "Message number%s: "
X			     (if mh-sent-from-msg
X				 (format " [%d]" mh-sent-from-msg)
X			       "")))))
X  (save-restriction
X    (narrow-to-region (point) (point))
X    (let ((start (point-min))
X	  (msg-filename (mh-expand-file-name msg
X					     (mh-expand-file-name folder))))
X      (if (equal msg "") (setq msg (format "%d" mh-sent-from-msg)))
X      (if mhl-formfile
X	  (if (stringp mhl-formfile)
X	      (mh-exec-lib-cmd-output
X	       "mhl" "-nobell" "-noclear" "-form" mhl-formfile msg-filename)
X	    (mh-exec-lib-cmd-output "mhl" "-nobell" "-noclear" msg-filename))
X	(insert-file-contents msg-filename t))
X      (when (not prefix-provided)
X	    (mh-clean-msg-header start mh-invisible-headers mh-visible-headers)
X	    (set-mark start)		; since mh-clean-msg-header moves it
X	    (mh-insert-prefix-string mh-ins-buf-prefix)))))
X
X;; mod 7-Sep-1989 mdb: mdb@ESD.3Com.COM, {3comvax,auspex,sun}!bridge2!mdb
X;; generalized, hookified citations
X(defun sc-mh-insert-prefix-string (ins-string)
X  ;; Preface each line in the current buffer with STRING.
X  (setq mh-ins-string ins-string)
X  (save-excursion
X    (set-mark (point-max))
X    (goto-char (point-min))
X    (run-hooks 'mh-yank-hooks)))
X
X;; added 7-Sep-1988 mdb: mdb@ESD.3Com.COM, {3comvax,auspex,sun}!bridge2!mdb
X;; generalized, hookified citations
X(defvar mh-ins-string nil
X  "A temporary set by mh-insert-prefix prior to running mh-yank-hooks .")
X
X;; added 7-Sep-1988 mdb: mdb@ESD.3Com.COM, {3comvax,auspex,sun}!bridge2!mdb
X;; generalized, hookified citations
X(defvar mh-yank-hooks
X  '(lambda ()
X     (save-excursion
X       (goto-char (point))
X       (or (bolp) (forward-line 1))
X       (while (< (point) (mark))
X	 (insert mh-ins-string)
X	 (forward-line 1))))
X  "Hook which will add attribution to another message being quoted. When
Xthis hook gets run, point is at the beginning of the region to be cited
Xand mark is at the end.")
END_OF_FILE
if test 9666 -ne `wc -c <'sc-oloads.el'`; then
    echo shar: \"'sc-oloads.el'\" unpacked with wrong size!
fi
# end of 'sc-oloads.el'
fi
if test -f 'sendmail.el.diff' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'sendmail.el.diff'\"
else
echo shar: Extracting \"'sendmail.el.diff'\" \(1226 characters\)
sed "s/^X//" >'sendmail.el.diff' <<'END_OF_FILE'
X*** sendmail.el.orig	Thu Jun 29 22:38:16 1989
X--- sendmail.el	Fri Jul 28 19:06:33 1989
X***************
X*** 378,386 ****
X  	(if (consp arg)
X  	    nil
X! 	  (mail-yank-clear-headers start (mark))
X! 	  (indent-rigidly start (mark)
X! 			  (if arg (prefix-numeric-value arg) 3)))
X  	(exchange-point-and-mark)
X  	(if (not (eolp)) (insert ?\n)))))
X  
X  (defun mail-yank-clear-headers (start end)
X--- 378,400 ----
X  	(if (consp arg)
X  	    nil
X! 	  ;; mod 28-Jul-1989 baw: warsaw@cme.nist.gov, uunet!cme-durer!warsaw
X! 	  ;; generalized, hookified citations
X! 	  (run-hooks 'mail-yank-hooks))
X  	(exchange-point-and-mark)
X  	(if (not (eolp)) (insert ?\n)))))
X+ 
X+ ;; added 28-Jul-1989 baw: warsaw@cme.nist.gov, uunet!cme-durer!warsaw
X+ ;; generalized, hookified citations
X+ (defvar mail-indention-spaces 3
X+   "Set to number of spaces to indent when yanking a reply.")
X+ 
X+ ;; added 28-Jul-1989 baw: warsaw@cme.nist.gov, uunet!cme-durer!warsaw
X+ ;; generalized, hookified citations
X+ (defvar mail-yank-hooks
X+   '(lambda ()
X+      (indent-rigidly (point) (mark) mail-indention-spaces))
X+   "Hook to run citation function.  Expects POINT and MARK to be set to the
X+ region to cite.")
X+ 
X  
X  (defun mail-yank-clear-headers (start end)
END_OF_FILE
if test 1226 -ne `wc -c <'sendmail.el.diff'`; then
    echo shar: \"'sendmail.el.diff'\" unpacked with wrong size!
fi
# end of 'sendmail.el.diff'
fi
echo shar: End of archive 1 \(of 2\).
cp /dev/null ark1isdone
MISSING=""
for I in 1 2 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked both archives.
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0

warsaw@cme.nist.gov (Barry A. Warsaw) (08/03/90)

#! /bin/sh
# This is a shell archive.  Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file".  To overwrite existing
# files, type "sh file -c".  You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g..  If this archive is complete, you
# will see the following message at the end:
#		"End of archive 2 (of 2)."
# Contents:  supercite.el
# Wrapped by warsaw@anthem on Thu Aug  2 22:43:57 1990
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'supercite.el' -a "${1}" != "-c" ; then 
  echo shar: Will not clobber existing file \"'supercite.el'\"
else
echo shar: Extracting \"'supercite.el'\" \(68078 characters\)
sed "s/^X//" >'supercite.el' <<'END_OF_FILE'
X;; ======================================================================
X;; supercite.el -- Version 2.1
X
X;; ========== Introduction ==========
X;; Citation and attribution package for various GNU emacs news and
X;; electronic mail readers.  It has been tested with these commonly
X;; available news and mail readers: VM 4.41, GNUS 3.13 and RMAIL
X;; 18.55. It will interface to VM 4.40+ with no modifications, but
X;; with GNUS 3.12+ and RMAIL 18.55 modifications to distribution files
X;; emacs/lisp/{sendmail,rnewspost}.el of GNU emacs version 18.55 are
X;; required.  Modifications are also required for mh-e users. These
X;; modifications are supplied as diff files and as overload functions.
X;; See the file sc-oloads.el for more information on overloading. See
X;; the README file for more information on installing patches.
X
X;; This package does not do any yanking of messages, but instead
X;; massages raw reply buffers set up by the reply/forward functions in
X;; the news/mail reader package. Supercite is invoked via a hook.  See
X;; the README file for more information on how to meet the interface
X;; if you are writing a reader package, or want to link supercite with
X;; a reader.
X
X;; ========== Disclaimer ==========
X;; This software is distributed in the hope that it will be useful,
X;; but WITHOUT ANY WARRANTY.  No author or distributor accepts
X;; responsibility to anyone for the consequences of using it or for
X;; whether it serves any particular purpose or works at all, unless he
X;; says so in writing.
X
X;; Some of this software was written as part of the supercite author's
X;; official duty as an employee of the United States Government and is
X;; thus in the public domain.  You are free to use that particular
X;; software as you wish, but WITHOUT ANY WARRANTY WHATSOEVER.  It
X;; would be nice, though if when you use any of this code, you give
X;; due credit to the author.
X
X;; Other parts of this code were written by other people.  Wherever
X;; possible, credit to that author, and the copy* notice supplied by
X;; the author are included with that code.
X
X;; ========== Author (unless otherwise stated) ==========
X;; NAME: Barry A. Warsaw              USMAIL: National Institute of
X;; TELE: (301) 975-3460                       Standards and Technology
X;; UUCP: uunet!cme.nist.gov!warsaw            Rm. B-124, Bldg. 220
X;; INET: warsaw@cme.nist.gov                  Gaithersburg, MD 20899
X
X;; Want to be on the Supercite mailing list?
X;;
X;; Send articles to supercite@cme.nist.gov or uunet!cme.nist.gov!supercite
X;; Send administrative queries/requests to supercite-request@cme.nist.gov
X;;	or uunet!cme.nist.gov!supercite-request
X
X;; ========== Credits and Thanks ==========
X;; This package was derived from the Superyank 1.11 package as posted
X;; to the net.  Superyank 1.11 was inspired by code and ideas from
X;; Martin Neitzel and Ashwin Ram.  It has been migrated to Supercite
X;; 2.1 through the comments and suggestions of the supercite mailing
X;; list which consists of many authors and users of the various mail
X;; and news reading packages.
X
X;; Many folks on the supercite mailing list have contributed their
X;; help in debugging, making suggestions and supplying support code or
X;; bug fixes for the previous versions of supercite.  I want to thank
X;; everyone who helped, especially:
X;;
X;; Mark Baushke, Khalid Sattar, David Lawrence, Chris Davis, Kyle
X;; Jones, Kayvan Sylvan, and Masanobu Umeda.
X;;
X;; I don't mean to leave anyone out. All who have helped have been
X;; appreciated.
X
X;; ======================================================================
X;; Wish list for version 2.2:
X;;
X;; 1) handle multiple yanking into a single reply buffer. perhaps have a
X;;    stack for sc-gal-information (didn't get to it in 2.1).
X;;
X;; 2) correct for unix mail(1) putting > in front of From lines.  Is it
X;;    really supercite's job?
X
X;; ======================================================================
X;; require and provide features and autoload
X;;
X(require 'baw-alist)
X(provide 'supercite)
X
X
X;; **********************************************************************
X;; start of user defined variables
X;; **********************************************************************
X
X(defvar sc-nested-citation-p nil
X  "*Controls whether to use nested or non-nested citation style.
XNon-nil uses nested citations, nil uses non-nested citations.  Nested
Xcitations are of the style:
X
X     I wrote this
X     > He wrote this
X     >> She replied to something he wrote
X
XNon-nested citations are of the style:
X
X     I wrote this
X     John> He wrote this
X     Jane> She originally wrote this")
X
X
X(defvar sc-citation-leader ""
X  "*String used at the front of a composed citation.")
X
X(defvar sc-citation-delimiter ">"
X  "*String to use at the end of a composed citation.  
XThis string is used in both nested and non-nested citations.  For best
Xresults, use a single character with no trailing space.")
X
X(defvar sc-citation-separator " "
X  "*String used to separate the composed citation and the cited line.
XNormally this character is a single space character though often a
Xsingle tab character is used.")
X
X(defvar sc-default-author-name "Anonymous"
X  "*String used when author's name cannot be determined.")
X
X(defvar sc-default-attribution "Anon"
X  "*String used when author's attribution cannot be determined.")
X
X(defvar sc-cite-regexp "\\s *[a-zA-Z0-9]*\\s *>+\\s *"
X  "*Regular expression describing how a already cited line begins.
XThe regexp is only used at the beginning of a line, so it doesn't need
Xto start with a '^'.")
X
X(defvar sc-titlecue-regexp "\\s +-+\\s +"
X  "*Regular expression describing the separator between names and titles.
XOften, people will set up their name field to look like this:
X
X     (John Xavier Doe -- Computer Hacker Extraordinaire)
X
XTitle cue recognizes the ' -- ' as a separator between the name field
Xand the title field. Set to nil to treat entire field as a name.")
X
X(defvar sc-confirm-always-p t
X  "*If t, always confirm attribution string before citing text body.")
X
X(defvar sc-preferred-attribution 'firstname
X  "*Specifies which part of the author's name becomes the attribution.
XThe value of this variable should be a quoted symbol, based on the
Xfollowing key:
X
X     emailname   -- email address name
X     initials    -- initials of author
X     firstname   -- first name of author
X     lastname    -- last name of author
X     middlename1 -- first middle name of author
X     middlename2 -- second middle name of author
X     ...
X
XMiddle name indexes can be any positive integer greater than 0, though
Xit is unlikely that many authors will supply more than one middle
Xname, if that many.")
X
X(defvar sc-use-only-preference-p nil
X  "*Controls what happens when the preferred attribution cannot be found.
XIf non-nil, then sc-default-attribution will be used if preferred
Xattribution string can't be found. If nil, then some secondary scheme
Xwill be employed to find a suitable attribution string.")
X
X(defvar sc-downcase-p nil
X  "*Non-nil means downcase the attribution and citation strings.")
X
X(defvar sc-rewrite-header-list
X  '((sc-no-header)
X    (sc-header-on-said)
X    (sc-header-inarticle-writes)
X    (sc-header-regarding-writes)
X    (sc-header-attributed-writes)
X    )
X  "*List of reference header rewrite functions.
XThe variable sc-preferred-header-style controls which function in this
Xlist is chosen for automatic reference header insertions. Electric
Xreference mode will cycle through this list of functions.  Here's a
Xlist of predefined reference header styles which you can use as a
Xmodel for writing your own:
X
X     sc-no-header:
X          {blank}
X
X     sc-header-on-said [default]:
X          On <date>
X          <from> said:
X
X     sc-header-inarticle-writes:
X          In article <message-id> <from> writes:
X
X     sc-header-regarding-writes:
X          Regarding <subject>; <from> adds:
X
X     sc-header-attributed-writes:
X          \"<attribution>\" == <author> <from> writes:
X
XEach line of the reference will be prefixed by the string in
Xsc-reference-tag-string. If you write your own reference header
Xfunctions, you may want to use this variable.
X
XThe variables that you can use to create your headers are those that
Xare included in sc-mail-fields-list.  Some additional fields are
Xalways made available by Supercite.  These are:
X
X     \"sc-author\"       - author of the original article
X     \"sc-firstname\"    - author's firstname
X     \"sc-lastname\"     - author's lastname
X     \"sc-middlename-N\" - author's Nth middlename
X     \"sc-attribution\"  - user chosen attribution string
X     \"sc-citation\"     - user chosen citation string
X     \"from\"            - the value of the \"From:\" field
X
XAny of these field names can be used (as strings) as arguments to
Xsc-field.")
X
X(defvar sc-preferred-header-style 1
X  "*Index into sc-rewrite-header-list specifying preferred header style.
XSupercite uses this variable as an index into the header rewrite list
Xto decide which style to use (by default) when writing the reference
Xheader. Index zero accesses the first function in the list.")
X
X(defvar sc-electric-references-p t
X  "*Use electric references if non-nil.")
X
X(defvar sc-electric-circular-p t
X  "*Treat electric references as circular if non-nil.")
X
X(defvar sc-mail-fields-list
X  '("date" "message-id"  "subject" "newsgroups" "references"
X    "from" "return-path" "path"    "reply"      "organization")
X  "*List of mail header whose values will be saved.
XSupercite will scan the mail headers for the fields specified in this
Xlist and save the values of these fields in sc-gal-information which
Xcan be accessed with sc-field.  You don't need to include the colon in
Xthe field string.")
X
X(defvar sc-mumble-string "mumble"
X  "*Value returned by sc-field if chosen field cannot be found. 
XYou may want to set this to nil or add spaces around any string
Xvalue.")
X
X(defvar sc-reference-tag-string ">>>>> "
X  "*String used at the beginning of default reference headers.
XThis will visually separate a reference header from the cited body of
Xtext, though the default is known to be annoying to some people.")
X
X(defvar sc-fill-paragraph-hook 'sc-fill-paragraph
X  "*Hook for filling a paragraph.  
XThis hook gets executed when you fill a paragraph either manually or
Xautomagically. It expects point to be within the extent of the
Xparagraph that is going to be filled.")
X
X(defvar sc-auto-fill-region-p nil
X  "*If non-nil, automatically fill each paragraph after it has been cited.")
X
X(defvar sc-fixup-whitespace-p nil
X  "*If non-nil, delete all leading white space before citing.")
X
X(defvar sc-nuke-mail-headers-p t
X  "*Nuke or don't nuke mail headers.
XIf non-nil, nuke mail headers after gleaning useful information form
Xthem. If nil, don't nuke mail headers.")
X
X(defvar sc-run-hook nil
X  "*User definable hook.
XRuns after sc-cite-original executes.")
X
X(defvar sc-load-hook nil
X  "*User definable hook.
XRuns after supercite is loaded. Set your customizations here.")
X
X
X
X;; ======================================================================
X;; keymaps
X;;
X(defvar sc-default-keymap
X  '(lambda ()
X     (local-set-key "\C-c\C-r" 'sc-insert-reference)
X     (local-set-key "\C-c\C-t" 'sc-cite)
X     (local-set-key "\C-c\C-a" 'sc-recite)
X     (local-set-key "\C-c\C-u" 'sc-uncite)
X     (local-set-key "\C-c\C-i" 'sc-insert-citation)
X     (local-set-key "\C-c\C-o" 'sc-open-line)
X     (local-set-key "\C-c\C-q" 'sc-fill-paragraph-manually)
X     (local-set-key "\C-c\q"   'sc-fill-paragraph-manually)
X     (local-set-key "\C-c\C-m" 'sc-modify-information)
X     (local-set-key "\C-c\C-g" 'sc-glom-headers)
X     (local-set-key "\C-c\C-v" 'sc-version)
X     (local-set-key "\C-c?"    'sc-describe)
X     )
X  "*Default keymap if major-mode can't be found in `sc-local-keymaps'.")
X
X(defvar sc-local-keymaps
X  '((mail-mode
X     (lambda ()
X       (local-set-key "\C-c\C-r" 'sc-insert-reference)
X       (local-set-key "\C-c\C-t" 'sc-cite)
X       (local-set-key "\C-c\C-a" 'sc-recite)
X       (local-set-key "\C-c\C-u" 'sc-uncite)
X       (local-set-key "\C-c\C-i" 'sc-insert-citation)
X       (local-set-key "\C-c\C-o" 'sc-open-line)
X       (local-set-key "\C-c\C-q" 'sc-fill-paragraph-manually)
X       (local-set-key "\C-c\q"   'sc-fill-paragraph-manually)
X       (local-set-key "\C-c\C-m" 'sc-modify-information)
X       (local-set-key "\C-c\C-g" 'sc-glom-headers)
X       (local-set-key "\C-c\C-v" 'sc-version)
X       (local-set-key "\C-c?"    'sc-describe)
X       ))
X    (mh-letter-mode
X     (lambda ()
X       (local-set-key "\C-c\C-r" 'sc-insert-reference)
X       (local-set-key "\C-c\C-t" 'sc-cite)
X       (local-set-key "\C-c\C-a" 'sc-recite)
X       (local-set-key "\C-c\C-u" 'sc-uncite)
X       (local-set-key "\C-ci"    'sc-insert-citation)
X       (local-set-key "\C-c\C-o" 'sc-open-line)
X       (local-set-key "\C-c\q"   'sc-fill-paragraph-manually)
X       (local-set-key "\C-c\C-m" 'sc-modify-information)
X       (local-set-key "\C-c\C-g" 'sc-glom-headers)
X       (local-set-key "\C-c\C-v" 'sc-version)
X       (local-set-key "\C-c?"    'sc-describe)
X       ))
X    (news-reply-mode mail-mode)
X    (vm-mail-mode mail-mode)
X    (e-reply-mode mail-mode)
X    (n-reply-mode mail-mode)
X    )
X  "*List of keymaps to use with the associated major-mode.")
X
X
X(defvar sc-electric-mode-map nil
X  "*Keymap for sc-electric-mode.")
X
X
X(if sc-electric-mode-map
X    nil
X  (setq sc-electric-mode-map (make-sparse-keymap))
X  (define-key sc-electric-mode-map "p"     'sc-eref-prev)
X  (define-key sc-electric-mode-map "n"     'sc-eref-next)
X  (define-key sc-electric-mode-map "s"     'sc-eref-setn)
X  (define-key sc-electric-mode-map "j"     'sc-eref-jump)
X  (define-key sc-electric-mode-map "\C-g"  'sc-eref-abort)
X  (define-key sc-electric-mode-map "x"     'sc-eref-abort)
X  (define-key sc-electric-mode-map "\r"    'sc-eref-exit)
X  (define-key sc-electric-mode-map "\n"    'sc-eref-exit)
X  (define-key sc-electric-mode-map "q"     'sc-eref-exit)
X  (define-key sc-electric-mode-map "g"     'sc-eref-goto)
X  (define-key sc-electric-mode-map "\C-hm" 'sc-eref-describe)
X  )
X
X
X;; **********************************************************************
X;; end of user defined variables
X;; **********************************************************************
X
X
X;; ======================================================================
X;; global variables, not user accessable
X;;
X
X(defconst sc-version-number "2.1")
X
X;; when rnewspost.el patch is installed (or function is overloaded)
X;; this should be nil since supercite now does this itself.
X(setq news-reply-header-hook nil)
X
X;; autoload for sc-electric-mode
X(autoload 'sc-electric-mode "sc-electric"
X	  "Major mode for viewing supercite reference headers." nil)
X
X
X;; global alists, misc variables
X;;
X(make-variable-buffer-local 'sc-gal-attributions)
X(make-variable-buffer-local 'sc-gal-information)
X(make-variable-buffer-local 'sc-leached-keymap)
X(make-variable-buffer-local 'sc-fill-arg)
X
X(setq-default sc-gal-attributions nil)
X(setq-default sc-gal-information  nil)
X(setq-default sc-leached-keymap (current-local-map))
X(setq-default sc-fill-arg nil)
X
X;; the new citation style means we can clean out other headers in
X;; addition to those previously cleaned out.  anyway, we create our
X;; own headers.  cleans out mail, gnus, vm and other headers. add to
X;; this for other mail or news readers you may be using.
X
X(setq sc-mail-yank-ignored-headers
X      (concat
X       "^via:\\|^origin:\\|^status:\\|^received:\\|^remailed\\|"
X       "^[a-z-]*message-id:\\|^\\(summary-\\)?line[s]?:\\|^cc:\\|"
X       "^subject:\\|^\\(\\(in-\\)?reply-\\)?to:\\|^sender:\\|^replied:\\|"
X       "^\\(\\(return\\|reply\\)-\\)?path:\\|^\\(posted-\\)?date:\\|"
X       "^\\(mail-\\)?from:\\|^newsgroup[s]?:\\|^organization:\\|^keywords:\\|"
X       "^distribution:\\|^xref:\\|^references:\\|^x-mailer:\\|"
X       "^\\(x-\\)?followup-to:\\|^x-vm-attributes:\\|^expires:\\|"
X       "^approved:\\|^apparently-to:\\|^summary:\\|"
X       "^x-vm-attributes:\\|^x-vm-v[0-9]+-data:"))
X
X
X
X
X;; ======================================================================
X;; miscellaneous
X
X(defun sc-update-gal (attribution)
X  "Update the sc-gal-information alist.
XAdd ATTRIBUTION and compose the nested and non-nested citation
Xstrings."
X  (let ((attrib (if sc-downcase-p (downcase attribution) attribution)))
X    (aput 'sc-gal-information "sc-attribution" attrib)
X    (aput 'sc-gal-information "sc-nested-citation"
X	  (concat attrib sc-citation-delimiter))
X    (aput 'sc-gal-information "sc-citation"
X	  (concat sc-citation-leader
X		  attrib
X		  sc-citation-delimiter
X		  sc-citation-separator))))
X
X
X(defun sc-valid-index-p (index)
X  "Returns t if INDEX is a valid index into sc-rewrite-header-list.
XDoes not check to see if function at index into list is a valid
Xfunction without error."
X  (let ((last (1- (length sc-rewrite-header-list))))
X    (and (natnump index)  ;; a number, and greater than or equal to zero
X	 (<= index last)  ;; less than or equal to the last index
X	 )))
X
X
X;; ======================================================================
X;; this section snarfs mail fields and places them in the info alist
X
X(defun sc-mail-yank-clear-headers (start end)
X  "Nuke mail headers between START and END. 
XUse sc-mail-yank-ignored-headers to determine which headers to nuke."
X  (save-excursion
X    (goto-char start)
X    (if (search-forward "\n\n" end t)
X	(save-restriction
X	  (narrow-to-region start (point))
X	  (goto-char start)
X	  (while (let ((case-fold-search t))
X		   (re-search-forward sc-mail-yank-ignored-headers nil t))
X	    (beginning-of-line)
X	    (delete-region (point)
X			   (progn (re-search-forward "\n[^ \t]")
X				  (forward-char -1)
X				  (point))))))))
X
X
X(defun sc-mail-fetch-field (field)
X  "Return the value of the header field FIELD.
XThe buffer is expected to be narrowed to just the headers of the
Xmessage."
X  (save-excursion
X    (goto-char (point-min))
X    (let ((case-fold-search t)
X	  (name (concat "^" (regexp-quote field) "[ \t]*:[ \t]*")))
X      (goto-char (point-min))
X      (if (re-search-forward name nil t)
X	  (let ((opoint (point)))
X	    (while (progn (forward-line 1)
X			  (looking-at "[ \t]")))
X	    (buffer-substring opoint (1- (point))))))))
X
X
X(defun sc-fetch-fields (start end)
X  "Fetch the mail fields in the region from START to END.
XAdd them to the global alist sc-gal-information. These fields can be
Xaccessed in reference headers with sc-field."
X  (save-excursion
X    (save-restriction
X      (narrow-to-region start end)
X      (goto-char start)
X      (mapcar
X       (function
X	(lambda (field)
X	  (let ((value (sc-mail-fetch-field field)))
X	    (and value
X		 (aput 'sc-gal-information field value)))))
X       sc-mail-fields-list)
X      (aput 'sc-gal-information "from" (sc-mail-fetch-field "from")))))
X
X
X(defun sc-field (field)
X  "Return the alist information associated with the FIELD.
XIf FIELD is not a valid key in sc-gal-information, return
Xsc-mumble-string."
X  (or (aget sc-gal-information field)
X      sc-mumble-string))
X
X
X;; ======================================================================
X;; contains supplied header reference rewrite functions
X
X(defun sc-no-header ()
X  "Does nothing. Use this instead of nil to get a blank header."
X  ())
X
X(defun sc-header-on-said ()
X  "\"On <date>, <from> said:\""
X  (insert sc-reference-tag-string
X	  "On " (sc-field "date") ", " (sc-field "from") " said:\n"))
X
X(defun sc-header-inarticle-writes ()
X  "\"In article <message-id>, <from> writes:\""
X  (insert sc-reference-tag-string
X	  "In article " (sc-field "message-id")
X	  ", " (sc-field "from") " writes:\n"))
X
X(defun sc-header-regarding-writes ()
X  "\"Regarding <subject>; <from> adds:\""
X  (insert sc-reference-tag-string
X	  "Regarding " (sc-field "subject")
X	  "; " (sc-field "from") " adds:\n"))
X
X(defun sc-header-attributed-writes ()
X  "\"<sc-attribution>\" == <sc-author> <from> writes:"
X  (insert sc-reference-tag-string
X	  "\"" (sc-field "sc-attribution")
X	  "\" == " (sc-field "sc-author") " "
X	  (sc-field "from") " writes:\n"))
X
X
X;; ======================================================================
X;; this section queries the user for necessary information
X;;
X
X(defun sc-query (default)
X  "Query for an attribution string with the DEFAULT choice.
XReturns the string entered by the user, if non-empty and non-nil, or
XDEFAULT otherwise."
X  (let* ((prompt (concat "Enter attribution string: (default "
X			 default ") "))
X	 (query (read-string prompt)))
X    (if (or (null query)
X	    (string= query ""))
X	default
X      query)))
X
X
X(defun sc-confirm ()
X  "Confirm the preferred attribution with the user.
XWhen this function sc-gal-attributions should be set, and the aheadsym
Xof this alist is used as the default selection.  Also,
X\\[keyboard-quit] selects the default."
X  (if (or sc-confirm-always-p
X	  sc-force-confirmation-p)
X      (aput 'sc-gal-attributions
X	    (let* ((default (aheadsym sc-gal-attributions))
X		   chosen
X		   (prompt (concat "Complete "
X				   (cond
X				    ((eq sc-cite-context 'citing) "cite")
X				    ((eq sc-cite-context 'reciting) "recite")
X				    (t ""))
X				   " attribution string: (default "
X				   default ") "))
X		   (minibuffer-local-completion-map
X		    (copy-keymap minibuffer-local-completion-map)))
X	      (define-key minibuffer-local-completion-map "\C-g"
X		'(lambda () (interactive) (beep) (throw 'select-abort nil)))
X	      (setq chosen (completing-read prompt sc-gal-attributions))
X	      (if (or (not chosen)
X		      (string= chosen ""))
X		  default
X		chosen)
X	      ))
X    ))
X
X
X;; ======================================================================
X;; this section contains primitive functions used in the email address
X;; parsing schemes.  they extract name fields from various parts of
X;; the "from:" field.
X
X(defun sc-%-style-address (from-string)
X  "Extract the author's name from email address string FROM-STRING.
XMatch addresses of the style \"name%[stuff].\""
X  (and (string-match "[a-zA-Z0-9]+%" from-string 0)
X       (substring from-string (match-beginning 0) (1- (match-end 0)))))
X
X
X(defun sc-@-style-address (from-string)
X  "Extract the author's name from email address string FROM-STRING.
XMatch addresses of the style \"[stuff]name@[stuff].\""
X  (and (string-match "[a-zA-Z0-9]+@" from-string 0)
X       (substring from-string (match-beginning 0) (1- (match-end 0)))))
X
X
X(defun sc-!-style-address (from-string)
X  "Extract the author's name from email address string FROM-STRING.
XMatch addresses of the style \"[stuff]![stuff]...!name[stuff].\""
X  (let ((eostring (string-match "$" from-string 0))
X	(mstart (string-match "![a-zA-Z0-9]+\\([^!a-zA-Z0-9]\\|$\\)"
X			      from-string 0))
X	(mend (match-end 0)))
X    (if mstart
X	(substring from-string (1+ mstart) (if (= mend eostring)
X					       mend
X					     (1- mend)))
X      nil)))
X
X
X(defun sc-no-style-address (from-string)
X  "Extract the author's name from email address string FROM-STRING.
XMatch addresses of the style \"name.\""
X  (and (string-match "[a-zA-Z0-9]+" from-string 0)
X       (substring from-string (match-beginning 0) (match-end 0))))
X
X
X(defun sc-get-emailname (from-string)
X  "Get an email address from the FROM-STRING."
X  (cond
X   ((sc-%-style-address from-string))
X   ((sc-@-style-address from-string))
X   ((sc-!-style-address from-string))
X   ((sc-no-style-address from-string))
X   (t (substring from-string 0 10))))
X
X
X;; ======================================================================
X;; this section contains functions that will extract a list of names
X;; from the name field string.
X
X
X(defun sc-string-car (namestring)
X  "Return the string-equivalent \"car\" of NAMESTRING.
X
X     example: (sc-string-car \"John Xavier Doe\")
X              => \"John\""
X  (substring namestring
X	     (progn (string-match "\\s *" namestring) (match-end 0))
X	     (progn (string-match "\\s *\\S +" namestring) (match-end 0))))
X
X
X(defun sc-string-cdr (namestring)
X  "Return the string-equivalent \"cdr\" of NAMESTRING.
X
X     example: (sc-string-cdr \"John Xavier Doe\")
X              => \"Xavier Doe\""
X  (substring namestring
X	     (progn (string-match "\\s *\\S +\\s *" namestring)
X		    (match-end 0))))
X
X
X(defun sc-extract-namestring (from-string)
X  "Extract the name string from the FROM-STRING.
XThis should be the author's full name minus an optional title."
X  (let ((pstart (string-match "(.*)" from-string 0))
X	(pend (match-end 0))
X	(qstart (string-match "\".*\"" from-string 0))
X	(qend (match-end 0))
X	(bstart (string-match "\\([.a-zA-Z0-9---]+\\s *\\)+" from-string 0))
X	(bend (match-end 0)))
X    (cond
X     (pstart (substring from-string
X			(1+ pstart)
X			(or (string-match sc-titlecue-regexp
X					  from-string
X					  (1+ pstart))
X			    (1- pend))))
X     (qstart (substring from-string
X			(1+ qstart)
X			(or (string-match sc-titlecue-regexp
X					  from-string
X					  (1+ qstart))
X			    (1- qend))))
X     (bstart (substring from-string
X			bstart
X			(or (string-match sc-titlecue-regexp
X					  from-string
X					  bstart)
X			    bend))))))
X
X
X(defun sc-namestring-to-list (namestring)
X  "Convert NAMESTRING to a list of names.
X
X     example: (sc-namestring-to-list \"John Xavier Doe\")
X              => (\"John\" \"Xavier\" \"Doe\")"
X  (if (not (string-match namestring ""))
X      (append (list (sc-string-car namestring))
X	      (sc-namestring-to-list (sc-string-cdr namestring)))))
X
X
X(defun sc-strip-initials (namelist)
X  "Extract the author's initials from the NAMELIST."
X  (if (not namelist)
X      nil
X    (concat (substring (car namelist) 0 1)
X	    (sc-strip-initials (cdr namelist)))))
X
X
X;; ======================================================================
X;; this section handles selection of the attribution and citation strings
X;;
X
X(defun sc-populate-alists (from-string)
X  "Put important and useful information in the alists.
XAlists are sc-gal-information and sc-gal-attributions. Return the list
Xof name symbols."
X  (let* ((namelist (sc-namestring-to-list (sc-extract-namestring from-string)))
X	 (revnames (reverse (cdr namelist)))
X	 (midnames (reverse (cdr revnames)))
X	 (firstname (car namelist))
X	 (midnames (reverse (cdr revnames)))
X	 (lastname (car revnames))
X	 (initials (sc-strip-initials namelist))
X	 (emailname (sc-get-emailname from-string))
X	 (n 1)
X	 (symlist '(emailname initials firstname lastname)))
X    
X    ;; put basic information
X    (aput 'sc-gal-attributions 'firstname firstname)
X    (aput 'sc-gal-attributions 'lastname lastname)
X    (aput 'sc-gal-attributions 'emailname emailname)
X    (aput 'sc-gal-attributions 'initials initials)
X    
X    (aput 'sc-gal-information "sc-firstname" firstname)
X    (aput 'sc-gal-information "sc-lastname" lastname)
X    (aput 'sc-gal-information "sc-emailname" emailname)
X    (aput 'sc-gal-information "sc-initials" initials)
X    
X    ;; put middle names
X    (mapcar
X     (function
X      (lambda (name)
X	(let ((symbol (intern (format "middlename%d" n)))
X	      (string (format "sc-middlename-%d" n)))
X	  (aput 'sc-gal-attributions symbol name)
X	  (aput 'sc-gal-information string name)
X	  (setq n (1+ n))
X	  (nconc symlist (list symbol)))))
X     midnames)
X    
X    ;; build the sc-author entry
X    (aput 'sc-gal-information "sc-author"
X	  (concat firstname " " (mapconcat
X				 (function
X				  (lambda (name) name))
X				 midnames " ")
X		  (if midnames " ") lastname))
X    symlist))
X
X
X(defun sc-sort-attribution-alist ()
X  "Put preferred attribution at head of sc-gal-attributions alist."
X  (asort 'sc-gal-attributions sc-preferred-attribution)
X  
X  ;; use backup scheme if preference is not legal
X  (if (or (null sc-preferred-attribution)
X	  (anot-head-p sc-gal-attributions sc-preferred-attribution)
X	  (let ((prefval (aget sc-gal-attributions
X			       sc-preferred-attribution)))
X	    (or (null prefval)
X		(string= prefval ""))))
X      ;; no legal attribution
X      (if sc-use-only-preference-p
X	  (aput 'sc-gal-attributions 'sc-user-query
X		(sc-query sc-default-attribution))
X	;; else use secondary scheme
X	(asort 'sc-gal-attributions 'firstname))))
X
X
X(defun sc-build-attribution-alist (from-string)
X  "Extract attributions from FROM-LIST, applying preferences."
X  (let ((symlist (sc-populate-alists from-string))
X	(headval (progn (sc-sort-attribution-alist)
X			(aget sc-gal-attributions
X			      (aheadsym sc-gal-attributions)))))
X    
X    ;; foreach element in the symlist, remove the corresponding key-value
X    ;; pair in the alist, then insert just the value.
X    (mapcar
X     (function
X      (lambda (symbol)
X	(let ((value (aget sc-gal-attributions symbol)))
X	  (if (not (or (null value)
X		       (string= value "")))
X	      (aput 'sc-gal-attributions value))
X	  (adelete 'sc-gal-attributions symbol))))
X     symlist)
X    
X    ;; now reinsert the head (preferred) attribution, this effectively
X    ;; just moves the head value to the front of the list.
X    (aput 'sc-gal-attributions headval)
X    
X    ;; check to be sure alist is not nil
X    (if (null sc-gal-attributions)
X	(aput 'sc-gal-attributions sc-default-attribution))))
X
X
X(defun sc-select ()
X  "Select an attribution and create a citation string."
X  (cond
X   (sc-nested-citation-p
X    (sc-update-gal ""))
X   ((null (aget sc-gal-information "from" t))
X    (aput 'sc-gal-information "sc-author" sc-default-author-name)
X    (sc-update-gal (sc-query sc-default-attribution)))
X   ((null sc-gal-attributions)
X    (sc-build-attribution-alist (aget sc-gal-information "from" t))
X    (sc-confirm)
X    (sc-update-gal (aheadsym sc-gal-attributions)))
X   (t
X    (sc-confirm)
X    (sc-update-gal (aheadsym sc-gal-attributions)))
X   )
X  t)
X
X
X;; ======================================================================
X;; region citing and unciting
X
X(defun sc-cite-region (start end)
X  "Cite a region delineated by START and END."
X  (save-excursion
X    (set-mark end)
X    (goto-char start)
X    (beginning-of-line)
X    (let ((fstart (point))
X	  (fend   (point)))
X      (while (< (point) (mark))
X	;; remove leading whitespace if desired 
X	(and sc-fixup-whitespace-p
X	     (fixup-whitespace))
X	;; if end of line then perhaps autofill
X	(cond ((eolp)
X	       (or (= fstart fend)
X		   (not sc-auto-fill-region-p)
X		   (save-excursion (set-mark fend)
X				   (goto-char (/ (+ fstart fend 1) 2))
X				   (run-hooks 'sc-fill-paragraph-hook)))
X	       (setq fstart (point)
X		     fend (point)))
X	      ;; not end of line so perhap cite it
X	      ((not (looking-at sc-cite-regexp))
X	       (insert (aget sc-gal-information "sc-citation")))
X	      (sc-nested-citation-p
X	       (insert (aget sc-gal-information "sc-nested-citation"))))
X	(setq fend (point))
X	(forward-line 1)))))
X
X
X(defun sc-uncite-region (start end cite-regexp)
X  "Uncite a previously cited region delineated by START and END.
XCITE-REGEXP describes how a cited line of texts starts.  Unciting also
Xauto-fills paragraph if sc-auto-fill-region-p is non-nil."
X  (save-excursion
X    (set-mark end)
X    (goto-char start)
X    (beginning-of-line)
X    (let ((fstart (point))
X	  (fend (point)))
X      (while (< (point) (mark))
X	;; if end of line, then perhaps autofill
X	(cond ((eolp)
X	       (or (= fstart fend)
X		   (not sc-auto-fill-region-p)
X		   (save-excursion (set-mark fend)
X				   (goto-char (/ (+ fstart fend 1) 2))
X				   (run-hooks 'sc-fill-paragraph-hook)))
X	       (setq fstart (point)
X		     fend (point)))
X	      ;; not end of line so perhaps uncite it
X	      ((looking-at cite-regexp)
X	       (save-excursion
X		 (save-restriction
X		   (narrow-to-region (progn (beginning-of-line)
X					    (point))
X				     (progn (end-of-line)
X					    (point)))
X		   (beginning-of-line)
X		   (delete-region (point-min)
X				  (progn (re-search-forward cite-regexp
X							    (point-max)
X							    t)
X					 (match-end 0)))))))
X	(setq fend (point))
X	(forward-line 1)))))
X
X
X;; ======================================================================
X;; this section contains paragraph filling support
X
X(defun sc-guess-fill-prefix ()
X  "Guess the fill prefix used on the current line.
XUse various heuristics to find the fill prefix. Search begins on first
Xnon-blank line in the region delineated by point and mark.
X
X     1) If fill-prefix is already bound to the empty string, return
X        nil.
X
X     2) If fill-prefix is already bound, but not to the empty
X        string, return the value of fill-prefix.
X
X     3) If the current line starts with the last chosen citation
X        string, then that string is returned.
X
X     4) If the current line starts with a string matching the regular
X        expression, sc-cite-regexp, then that string is returned.
X
X     5) Nil is returned."
X  (save-excursion
X    ;; scan for first non-blank line in the region
X    (beginning-of-line)
X    (while (and (< (point) (mark))
X		(eolp))
X      (forward-line 1))
X    (let ((citation (aget sc-gal-information "sc-citation")))
X      (cond
X       ((string= fill-prefix "") nil)
X       (fill-prefix)
X       ((looking-at (regexp-quote citation)) citation)
X       ((looking-at sc-cite-regexp)
X	(buffer-substring
X	 (point) (progn
X		   (re-search-forward (concat sc-cite-regexp "\\s *")
X				      (point-max) nil)
X		   (point))))
X       ((looking-at (concat ".*" sc-citation-delimiter "\\s *"))
X	(buffer-substring
X	 (point) (progn (re-search-forward (concat ".*" sc-citation-delimiter
X						   "\\s *"))
X			(point))))
X       (t nil)))))
X
X
X(defun sc-consistant-cite-p (prefix)
X  "Check current paragraph for consistant citation.
XScans to paragraph delineated by (forward|backward)-paragraph to see
Xif all lines start with PREFIX. Returns t if entire paragraph is
Xconsistantly cited, nil otherwise."
X  (save-excursion
X    (let ((end   (progn (forward-paragraph)
X			(beginning-of-line)
X			(or (not (eolp))
X			    (forward-char -1))
X			(point)))
X	  (start (progn (backward-paragraph)
X			(beginning-of-line)
X			(or (not (eolp))
X			    (forward-char 1))
X			(point)))
X	  (badline t))
X      (goto-char start)
X      (beginning-of-line)
X      (while (and (< (point) end)
X		  badline)
X	(setq badline (looking-at prefix))
X	(forward-line 1))
X      badline)))
X
X
X(defun sc-fill-start (fill-prefix)
X  "Find buffer position of start of region which begins with FILL-PREFIX.
XRestrict scan to current paragraph."
X  (save-excursion
X    (let ((badline nil)
X	  (top (save-excursion
X		 (backward-paragraph)
X		 (beginning-of-line)
X		 (or (not (eolp))
X		     (forward-char 1))
X		 (point))))
X      (while (and (not badline)
X		  (> (point) top))
X	(forward-line -1)
X	(setq badline (not (looking-at fill-prefix)))))
X    (forward-line 1)
X    (point)))
X
X
X(defun sc-fill-end (fill-prefix)
X  "Find the buffer position of end of region which begins with FILL-PREFIX.
XRestrict scan to current paragraph."
X  (save-excursion
X    (let ((badline nil)
X	  (bot (save-excursion
X		 (forward-paragraph)
X		 (beginning-of-line)
X		 (or (not (eolp))
X		     (forward-char -1))
X		 (point))))
X      (while (and (not badline)
X		  (< (point) bot))
X	(beginning-of-line)
X	(setq badline (not (looking-at fill-prefix)))
X	(forward-line 1)))
X    (forward-line -1)
X    (point)))
X
X
X(defun sc-fill-paragraph ()
X  "Supercite's paragraph fill function.
XFill the paragraph containing or following point. Use
Xsc-guess-fill-prefix to find the fill-prefix for the paragraph.
X
XIf the paragraph is inconsistantly cited (mixed fill-prefix), then the
Xuser is queried to restrict the the fill to only those lines around
Xpoint which begin with the fill prefix.
X
XThe variable sc-fill-arg is passed to fill-paragraph and
Xfill-region-as-paragraph which controls justification of the
Xparagraph.  sc-fill-arg is set by sc-fill-paragraph-manually."
X  (save-excursion
X    (let ((pnt (point))
X	  (fill-prefix (sc-guess-fill-prefix)))
X      (cond
X       ((not fill-prefix)
X	(fill-paragraph sc-fill-arg))
X       ((sc-consistant-cite-p fill-prefix)
X	(fill-paragraph sc-fill-arg))
X       ((y-or-n-p "Inconsistent citation found. Restrict? ")
X	(message "")
X	(fill-region-as-paragraph (progn (goto-char pnt)
X					 (sc-fill-start fill-prefix))
X				  (progn (goto-char pnt)
X					 (sc-fill-end fill-prefix))
X				  sc-fill-arg))
X       (t
X	(message "")
X	(progn
X	  (setq fill-prefix (aget sc-gal-information "sc-citation"))
X	  (fill-paragraph sc-fill-arg)))))))
X
X
X
X;; ======================================================================
X;; the following functions are the top level, interactive functions that
X;; can be bound to key strokes
X
X(defun sc-insert-reference (arg)
X  "Insert, at point, a reference header in the body of the reply.
XNumeric ARG indicates which header style from sc-rewrite-header-list
Xto use when rewriting the header. No supplied ARG indicates use of
Xsc-preferred-header-style.
X
XWith just \\[universal-argument], electric reference insert mode is
Xentered, regardless of the value of sc-electric-references-p.  See
Xsc-electric-mode for more information.  With numeric ARG, if
Xsc-electric-references-p is non-nil, then electric reference insert
Xmode is entered, otherwise, the selected header style is simply
Xinserted."
X  (interactive "P")
X  (if (consp arg)
X      (sc-electric-mode)
X    (let ((pref (cond ((sc-valid-index-p arg) arg)
X		      ((sc-valid-index-p sc-preferred-header-style)
X		       sc-preferred-header-style)
X		      (t 0))))
X      (if sc-electric-references-p (sc-electric-mode pref)
X	(condition-case err
X	    (eval (nth pref sc-rewrite-header-list))
X	  (void-function
X	   (progn (message
X		   "Symbol's function definition is void: %s. (Header %d)."
X		   (symbol-name (car (cdr err)))
X		   pref)
X		  (beep)))
X	  (error
X	   (progn (message "Error evaluating rewrite header function %d."
X			   pref)
X		  (beep)))
X	  ))
X      )))
X
X
X(defun sc-cite (arg)
X  "Cite the region of text between point and mark.
XNumeric ARG, if supplied, is passed unaltered to sc-insert-reference.
X
XThe mail header lines should be at the top of the region, with the
Xbody of the reply following.  These mail header lines will be parse
Xfirst for useful information, then deleted."
X  (interactive "P")
X  (catch 'select-abort
X    (let ((sc-cite-context 'citing)
X	  (sc-force-confirmation-p (interactive-p)))
X      (sc-select)
X      (undo-boundary)
X      (let ((xchange (if (> (mark) (point)) nil
X		       (exchange-point-and-mark)
X		       t)))
X	(sc-insert-reference arg)
X	(sc-cite-region (point) (mark))
X	;; leave point on first cited line
X	(while (and (< (point) (mark))
X		    (not (looking-at (aget sc-gal-information
X					   (if sc-nested-citation-p
X					       "sc-nested-citation"
X					     "sc-citation")))))
X	  (forward-line 1))
X	(and xchange
X	     (exchange-point-and-mark))
X	)
X      )))
X    
X
X
X(defun sc-uncite ()
X  "Uncite the region between point and mark."
X  (interactive)
X  (undo-boundary)
X  (let ((xchange (if (> (mark) (point)) nil
X		   (exchange-point-and-mark)
X		   t))
X	(fp (or (sc-guess-fill-prefix)
X		"")))
X    (sc-uncite-region (point) (mark) (regexp-quote fp))
X    (and xchange
X	 (exchange-point-and-mark))))
X
X
X(defun sc-recite ()
X  "Recite the region by first unciting then citing the text."
X  (interactive)
X  (catch 'select-abort
X    (let ((sc-cite-context 'reciting)
X	  (sc-force-confirmation-p t))
X      (sc-select)
X      (undo-boundary)
X      (let ((xchange (if (> (mark) (point)) nil
X		       (exchange-point-and-mark)
X		       t)))
X	(sc-uncite-region (point) (mark) (regexp-quote (sc-guess-fill-prefix)))
X	(sc-cite-region (point) (mark))
X	(and xchange
X	     (exchange-point-and-mark))
X	)
X      )))
X
X
X(defun sc-insert-citation ()
X  "Insert citation string at beginning of current line."
X  (interactive)
X  (save-excursion
X    (beginning-of-line)
X    (insert (aget sc-gal-information "sc-citation"))))
X
X
X(defun sc-open-line (arg)
X  "Insert a newline and leave point before it.
XAlso inserts the guessed prefix at the beginning of the new line. With
Xnumeric ARG, inserts that many newlines."
X  (interactive "p")
X  (save-excursion
X    (let ((start (point))
X	  (string (sc-guess-fill-prefix)))
X      (open-line arg)
X      (goto-char start)
X      (forward-line 1)
X      (while (< 0 arg)
X	(insert string)
X	(forward-line 1)
X	(setq arg (- arg 1))))))
X
X
X(defun sc-fill-paragraph-manually (arg)
X  "Fill current cited paragraph.
XReally just runs the hook sc-fill-paragraph-hook, however it does set
Xthe global variable sc-fill-arg to the value of ARG.  This is
Xcurrently the only way to pass an argument to a hookified function."
X  (interactive "P")
X  (setq sc-fill-arg arg)
X  (run-hooks 'sc-fill-paragraph-hook))
X
X
X(defun sc-modify-information (arg)
X  "Interactively modify information in sc-gal-information.
X\\[universal-argument] if supplied, deletes the entry from the alist.
XYou can add an entry by supplying a key instead of completing."
X  (interactive "P")
X  (let* ((delete-p   (consp arg))
X	 (action     (if delete-p "delete" "modify"))
X	 (defaultkey (aheadsym sc-gal-information))
X	 (prompt     (concat "Select information key to "
X			     action ": (default "
X			     defaultkey ") "))
X	 (key (completing-read prompt sc-gal-information))
X	 )
X    (if (or (string= key "")
X	    (null key))
X	(setq key defaultkey))
X    (if delete-p (adelete 'sc-gal-information key)
X      (let* ((oldval (aget sc-gal-information key t))
X	     (prompt (concat "Enter new value for key \""
X			     key "\" (default \"" oldval "\") "))
X	     (newval (read-input prompt)))
X	(if (or (string= newval "")
X		(null newval))
X	    nil
X	  (aput 'sc-gal-information key newval)
X	  )))
X    ))
X
X
X(defun sc-glom-headers ()
X  "Glom information from mail headers in region between point and mark.
XAny old attribution information is lost."
X  (interactive)
X  (setq sc-gal-attributions nil)
X  (setq sc-gal-information nil)
X  (let ((start (region-beginning))
X	(end   (region-end))
X	(sc-force-confirmation-p t)
X	(sc-cite-context nil))
X    (sc-fetch-fields start end)
X    (if sc-nuke-mail-headers-p
X	(sc-mail-yank-clear-headers start end))
X    (sc-select)))
X
X
X(defun sc-version ()
X  "Show supercite version."
X  (interactive)
X  (message "Using Supercite %s" sc-version-number))
X
X
X
X;; ======================================================================
X;; leach onto current mode
X
X(defun sc-append-current-keymap ()
X  "Append some useful key bindings to the current local key map.
XThis searches sc-local-keymap for the keymap to install based on the
Xmajor-mode of the current buffer."
X  (let ((hook (car (cdr (assq major-mode sc-local-keymaps)))))
X    (cond
X     ((not hook)
X      (run-hooks 'sc-default-keymap))
X     ((not (listp hook))
X      (setq hook (car (cdr (assq hook sc-local-keymaps))))
X      (run-hooks 'hook))
X     (t
X      (run-hooks 'hook))))
X  (setq sc-leached-keymap (current-local-map)))
X
X
X(defun sc-snag-all-keybindings ()
X  "Snag all keybindings in major-modes current keymap."
X  (let* ((curkeymap (current-local-map))
X	 (symregexp ".*sc-.*\n")
X	 (docstring (substitute-command-keys "\\{curkeymap}"))
X	 (start 0)
X	 (maxend (length docstring))
X	 (spooge ""))
X    (while (and (< start maxend)
X		(string-match symregexp docstring start))
X      (setq spooge (concat spooge (substring docstring
X					     (match-beginning 0)
X					     (match-end 0))))
X      (setq start (match-end 0)))
X    spooge))
X
X
X(defun sc-spoogify-docstring ()
X  "Modifies (makes into spooge) the docstring for the current major mode.
XThis will leach the keybinding descriptions for supercite onto the end
Xof the current major mode's docstring.  If major mode is preloaded,
Xthis function will first make a copy of the list associated with the
Xmode, then modify this copy."
X  (let* ((symfunc (symbol-function major-mode))
X	 (doc-cdr (nthcdr 2 symfunc))
X	 (doc-str (documentation major-mode)))
X    (cond
X     ;; is a docstring even provided?
X     ((not (stringp doc-str)))
X     ;; have we already leached on?
X     ((string-match "Supercite" doc-str))
X     ;; lets build the new doc string
X     (t
X      (let ((newdoc-str (concat doc-str "
X
XThe major mode for this buffer has been modified to include the
XSupercite 2.1 package for handling attributions and citations of
Xoriginal messages in email replies.  For more information on this
Xpackage, type \"\\[sc-describe]\" (see below).  The following keys are
Xbound to Supercite commands:
X
X"
X				(sc-snag-all-keybindings))))
X	(condition-case nil
X	    (setcar doc-cdr newdoc-str)
X	  (error
X	   ;; the major mode must be preloaded, make a copy first
X	   (setq symfunc (copy-sequence (symbol-function major-mode))
X		 doc-cdr (nthcdr 2 symfunc))
X	   (setcar doc-cdr newdoc-str)
X	   (fset major-mode symfunc)
X	   ))
X	))
X     )))
X
X
X;; ======================================================================
X;; this section contains default hooks and hook support for execution
X
X(defun sc-cite-original ()
X  "Hook version of sc-cite.
X
XThis is callable from the various mail and news readers' reply
Xfunction according to the predefined standard. Type
X\"\\[sc-describe]\" for more details.  Sc-cite-original does not do
Xany yanking of the original message but it does require a few things:
X
X     1) The reply buffer is the current buffer.
X
X     2) The original message has been yanked and inserted into the
X        reply buffer.
X
X     3) Verbose mail headers from the original message have been
X        inserted into the reply buffer directly before the text of the
X        original message.
X
X     4) Point is at the beginning of the verbose headers.
X
X     5) Mark is at the  end of the body of text to be cited."
X  (setq sc-gal-attributions nil)
X  (setq sc-gal-information nil)
X  (let ((start (region-beginning))
X	(end   (region-end))
X	(sc-electric-references-p nil))
X    (sc-fetch-fields start end)
X    (if sc-nuke-mail-headers-p
X	(sc-mail-yank-clear-headers start end))
X    (sc-cite sc-preferred-header-style)
X    (sc-append-current-keymap)
X    (sc-spoogify-docstring)
X    (run-hooks 'sc-run-hook)
X    ))
X
X
X
X;; ======================================================================
X;; describe this package
X;;
X
X(defun sc-describe ()
X  "Describe the Supercite 2.1 package.
X
XThis package provides mechanisms for doing sophisticated citing of
Xyanked text in the reply buffers of the major news and email reading
Xmodes.
X
XSupercite 2.1 has been tested and *seems* to work with GNUS 3.12-3.13
XRMAIL 18.55 and VM 4.37-4.41. It is also supposed to work with MH-E
Xmode and perhaps even GNEWS, RNEWS, PCMAIL and other packages.  Some
Xmodifications may be necessary to run supercite with these packages.
XSee the accompanying README file for details on how to link up with
Xsupercite. 
X
XAuthor:
X
XNAME: Barry A. Warsaw            USMAIL: National Institute of
XTELE: (301) 975-3460                     Standards and Technology
XUUCP: uunet!cme.nist.gov!warsaw          Rm. B-124, Bldg. 220
XINET: warsaw@cme.nist.gov                Gaithersburg, MD 20899
X
XGet on the Supercite mailing list:
X
XSend articles to:
X          INET: supercite@cme.nist.gov
X          UUCP: uunet!cme.nist.gov!supercite
X
XSend administrivia (additions/deletions to list, etc) to:
X          INET: supercite-request@cme.nist.gov
X          UUCP: uunet!cme.nist.gov!supercite-request
X
X-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
X
XWhat is a citation?  A \"citation\" is the acknowledgment of the
Xoriginal author of a mail message, in the body of the reply. The
X\"attribution string\" is the part of the author's name that will be
Xused to cite the body of the text (e.g. \"John\", the author's first
Xname). The \"citation string\" is built from the \"citation leader\",
Xthe attribution string, the \"citation delimiter\", and the \"citation
Xseparator\".  It is the string that is inserted in front of every line
Xto be cited in the reply body (e.g. \"John> \").
X
XThere are two general forms of citation.  In \"nested citations\",
Xindication is made that the cited line was written by someone *other*
Xthan the current message author, but no reference is made as to the
Xidentity of the original author.  Here's an example of what a message
Xbuffer would look like using nested citations after multiple replies:
X
X     >> John originally wrote this
X     >> and this as well
X     > Jane said that John didn't know
X     > what he was talking about
X     And that's what I think too.
X
XIn \"non-nested citations\" each cited line begins with an informative
Xstring referencing the original author.  Only the first level of
Xreferencing will be shown; subsequent citations don't nest the
Xreferences.  The same message described above might look like this if
Xnon-nested citations were used:
X
X     John> John originally wrote this
X     John> and this as well
X     Jane> Jane said that John didn't know
X     Jane> what he was talking about
X     And that's what I think too.
X
XNotice that my inclusion of Jane's inclusion of John's original
Xmessage did not result in a cited line beginning with: \"Jane>John>\".
XThus no nested citations.
X
XHeuristics are used to extract such information as the author's name
Xand email address from the mail headers in the reply buffer. This
Xinformation is made available to the supercite user for use in
Xbuilding the citation string and reference header.  The \"reference
Xheader\" is header placed at the top of the cited body of text
Xdescribing who the author is in more detail.
X
XThe citing of the text body is undoable, so the user could yank and
Xcite the text, undo, then continually re-cite the text until the
Xdesired citation string is inserted. Often people would like a
Xnickname to be used as the citation string, but this nickname cannot
Xbe picked up by supercite.  It is a simple matter to undo the original
Xcitation, and then perform a citation with the nickname as the
Xattribution string.
X
X-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
X
XThere are a number of variables which control some of the features
Xdescribed thus far. First there is the variable which controls whether
Xnested or non-nested citations will be used:
X
X     Variable: sc-nested-citation-p
X          Controls citation style.  If nil, non-nested citations are
X          used.  If non-nil, old-style nested citations are used.
X          Default: nil.
X
XFor non-nested citations, the citation string is made up of four
Xparts, the citation leader, the attribution string, the citation
Xdelimiter and the citation separator.  The attribution string is
Xdetermined by supercite (though you can override this -- see below);
Xthe other three parts are user defined.  Nested citations use only the
Xcitation separator:
X
X     Variable: sc-citation-leader 
X          String that leads the composed citation string.
X          Default: \" \".
X
X     Variable: sc-citation-delimiter
X          String that indicates a line has been cited. For nested
X          citations this string is inserted in front of all cited
X          lines. For non-nested citations, this string is inserted
X          after the attribution string but before the citation
X          separator.  Default: \">\".
X
X     Variable: sc-citation-separator
X          String that ends a composed citation string. Placed between
X          the citation delimiter and the original line of text.
X
XFor example, say the following preferences are in use:
X
X          (setq sc-citation-leader    \"    \")
X          (setq sc-citation-delimiter \">\")
X          (setq sc-citation-separator \" \")
X
Xand the attribution string was \"Jane\".  The composed citation string
Xwould be \"    Jane> \", which would be used in non-nested citations.
XOf course, only \">\" would be used in nested citations.
X
XOccasionally, for whatever reason, the author's name cannot be found
Xin the mail header, and so a default author name may be used:
X
X     Variable: sc-default-author-name
X          String used when author's name cannot be found.
X          Default: \"Anonymous\".
X
XAlso if the author's name cannot be found, a default attribution
Xstring may be used, from which a legal citation string will be built:
X
X     Variable: sc-default-attribution
X          String used when author's attribution string cannot be
X          found. Default: \"Anon\".
X
XFinally, how does the package determine if a line has already been
Xcited, so that for non-nested citations, the line won't be recited?
XThis is accomplished through the use of a regular expression:
X
X     Variable: sc-cite-regexp
X          Regular expression that describes how an already cited line
X          begins.  Default: \"\\\\s *[a-zA-Z0-9]*\\\\s *>+\\\\s *\".
X
X-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
X
XSupercite employs a number of heuristics to decipher the author's name
Xbased on the \"From:\" field which is usually present in all mail and
Xnews reading buffers.  If possible, it will pick out the author's
Xfirst, last and middle names, the author's initials and the author's
Xemail terminus.  Supercite can recognize \"From:\" lines with the
Xfollowing forms:
X
X     From: John Xavier Doe <doe@speedy.computer.com>
X     From: \"John Xavier Doe\" <doe@speedy.computer.com>
X     From: doe@speedy.computer.com (John Xavier Doe)
X     From: computer!speedy!doe (John Xavier Doe)
X     From: doe%speedy@computer.com (John Xavier Doe)
X     From: computer!speedy!doe (John Xavier-Doe)
X     From: computer!speedy!doe (John Xavier-Doe -- Decent Hacker)
X
XOnce supercite has parsed this field, it puts together a list of these
Xnames and may present them to the user for selection.
X
XNote that some author fields (as in the last example above) will
Xcontain a descriptive title.  The user can choose to ignore the title,
Xwhile still recognizing hyphenated names, through the use of a regular
Xexpression:
X
X     Variable: sc-titlecue-regexp
X          Regular expression that delineates names from titles in the
X          author's name fields.  Default: \"\\\\s +-+\\\\s +\".
X
XOnce an attribution string is extracted, supercite will normally
Xuse it to build the citation string automatically.  However, you can
Xtell supercite to request confirmation of the selected attribution
Xbefore the citation string is built:
X
X     Variable: sc-confirm-always-p
X          If non-nil, always confirm attribution string with user
X          before using to cite text.  If nil, use automatic selection
X          to choose attribution string. Default: t.
X
XIf you choose to confirm the attribution before the citation string is
Xbuilt, you will be presented with a list of choices.  Supercite
Xmaintains a notion of your \"preferred\" attribution string and this
Xis presented as the default choice. Hitting the carriage return will
Xselect this preferred default.  You are free to type in any string at
Xthe prompt, even if it is not one of the presented choices, and this
Xstring becomes the literal attribution string when you hit return.
XWhen an attribution string is confirmed, or typed in, it now becomes
Xthe preferred default attribution string for future insertions.
X
X-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
X
XYou can tell supercite which part of the author's name is your
Xpreference for use as the attribution string:
X
X     Variable: sc-preferred-attribution
X          Quoted symbol specifying which portion of an author's name
X          should be used when building the attribution string using
X          the following key:
X
X          emailname   -- email terminus
X          initials    -- author's initials
X          firstname   -- first name
X          lastname    -- last name
X          middlename1 -- first middle name
X          middlename2 -- second middle name
X          ...
X
X          Middlename indexes can be any positive integer greater than
X          0, though it is unlikely that many authors will supply more
X          than one middle name, if that many.  Default: 'firstname.
X
XIf you are using automatic selection, and your preferred attribution
Xcan't be found (i.e. is either nil, or the empty string), then a
Xsecondary method can be employed to find a valid attribution string.
XA variable controls whether a secondary method will be used in this
Xcase, or whether supercite should just use the default attribution (in
Xsc-default-attribution):
X
X     Variable: sc-use-only-preference-p
X          Controls what happens when the preferred attribution string
X          cannot be found.  If non-nil, then sc-default-attribution is
X          used, otherwise a secondary scheme is employed.
X          Default: nil.
X
XThe following steps are taken to find a valid attribution string when
Xsc-use-only-preference-p is nil.  The first step to return a non-nil,
Xnon-empty string becomes the attribution.
X
X     1. Use the author's first name.
X     2. Find the first non-nil, non-empty attribution string in the
X        attribution list.
X     3. If sc-confirm-always-p is non-nil, then the user is queried
X        for an attribution, otherwise,
X     4. sc-default-attribution is used.
X
XOnce a legal attribution string is found, you can force the string to
Xlower case characters.
X
X     Variable: sc-downcase-p
X          Non-nil means downcase the attribution string.
X          Default: nil.
X
X-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
X
XTypically, citing is performed on a body of text that has been yanked
Xfrom a mail or news reading buffer.  This yanked text should have the
Xverbose headers at the top of the region to be cited.  As mentioned
Xabove, Supercite will parse these headers, picking out useful
Xinformation (most notably the \"From:\" line), then delete those mail
Xheaders, and replace them in the reply buffer with user customizable
Xreference headers.  You can have multiple references header styles at
Xyour disposal and can customize your own headers, adding them to the
Xlist of those available. This list is kept in the variable:
X
X     Variable: sc-rewrite-header-list
X          List of user customizable reference header rewrite
X          functions.
X          Default: '((sc-no-header)
X                     (sc-header-on-said)
X                     (sc-header-inarticle-writes)
X                     (sc-header-regarding-writes)
X                     (sc-header-attributed-writes)).
X
XAdd your own functions to this list or re-order the list to utilize
Xyour own custom reference headers.  A reference header is rewritten
Xautomatically when the text is originally yanked, and a command is
Xprovided that allows the user to insert any reference header in the
Xlist. The header written by default is user customizable:
X
X     Variable: sc-preferred-header-style
X          Integer specifying which header rewrite function is used
X          when automatically inserting the rewritten header.  This is
X          an index into sc-rewrite-header-list, with the first element
X          indexed as zero.  Default: 1.
X
XAlternatively, you can use \"electric reference\" inserting to select
Xa reference header to use.  In electric reference insert mode, you are
Xplaced in a recursive edit where you can scan back and forth through
Xthe list of headers.  You can also set a new preferred header style.
XElectric reference inserting is also available through the
Xsc-insert-reference command (see below).  This variable controls
Xwhether you will automatically insert references, or use electric
Xreference mode:
X
X     Variable: sc-electric-references-p
X          Non-nil specifies use electric reference insert mode.
X          Default: t.
X
XWhile in electric reference mode, certain keys are bound to certain
Xfunctions.  All other keys, except those which self insert, are still
Xvalid. Self inserting keys are reinstated when you exit electric
Xreference insert mode.  Here are the default keybindings in this mode:
X\\{sc-electric-mode-map}
X
XYou cannot edit the references while in electric reference mode.
XAlso, there is a variable which controls whether the rewrite functions
Xlist should be treated as circular in electric reference mode:
X
X     Variable: sc-electric-circular-p
X          If non-nil, treat the reference header rewrite list of
X          functions as circular in electric reference mode.
X          Default: t.
X
XYou may want to include some information about the author in your
Xcustom reference headers.  This information can come from the mail
Xheaders or some internal supercite variables.  There is a variable
Xthat describes which mail headers should be fetched and remembered for
Xuse in the reference headers:
X
X     Variable: sc-mail-fields-list
X          List of mail header fields that you want supercite to
X          extract and remember. These can be accessed through the
X          sc-field function in your reference header functions.
X          Default: '(\"date\" \"message-id\" \"subject\" \"newsgroups\"
X                     \"references\" \"return-path\" \"path\" \"reply\"
X                     \"organization\")
X
XIn addition, supercite always provides the following information
Xfields:
X
X     1. \"sc-attribution\"      (the selected attribution string)
X     2. \"sc-nested-citation\"  (the nested citation string)
X     3. \"sc-citation\"         (the non-nested citation string)
X     4. \"from\"                (the From: mail header)
X     5. \"sc-author\"           (the author's full name)
X     6. \"sc-firstname\"        (the author's first name)
X     7. \"sc-lastname\"         (the author's last name)
X     8. \"sc-middlename-1\"     (the author's first middle name)
X     9. ...                     (more middle names)
X
XIf you access a field with sc-field that does not exist in the
Xinformation list, supercite will return a mumble string:
X
X     Variable: sc-mumble-string
X          String returned by sc-field if chosen field can't be found.
X          Default: \"mumble\".
X
XAfter supercite has gleaned useful information from the mail headers,
Xit will usually remove them from the reply buffer.  You can tell
Xsupercite to remove the headers or leave them in the buffer:
X
X     Variable: sc-nuke-mail-headers-p
X          If non-nil, nuke the mail headers, otherwise leave them in
X          the reply buffer.
X          Default: t.
X
XThe default reference header rewrite functions typically insert a
Xstring which serves to visually separate the header from the cited
Xbody of text.  You may want to change this for the default functions,
Xor use it in your custom header rewrite functions:
X
X     Variable: sc-reference-tag-string
X          String that is inserted before reference header lines on
X          those reference rewrite functions which are predefined.
X          Default: \">>>>> \"
X
X
X-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
X
XSupercite provides a paragraph filling function which recognizes the
Xcitation string to properly fill a cited text body.  There are other
Xpackages freely available which also work quite well when filling such
Xa prefixed paragraph, and so supercite calls the filling function via
Xa hook:
X
X     Variable: sc-fill-paragraph-hook
X          Hook for filling a paragraph. run when you fill a paragraph
X          either automatically or manually.
X          Default: 'sc-fill-paragraph.
X
XEach cited paragraph can be automatically filled when cited:
X
X     Variable: sc-auto-fill-region-p
X          If non-nil, automatically fill each paragraph after it has
X          been cited.  Default: nil.
X
XThere is a function available to manually fill a paragraph if you
Xdon't want automatic filling (see below).
X
X
X-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
X
XHere are a couple of other user definable variables.  For more
Xinformation on these or any supercite variable, type:
X\\[describe-variable] <variable-name>.
X
X     Variable: sc-fixup-whitespace-p
X          If non-nil, delete all leading white space before citing.
X          Default: nil.
X
X     Variable: sc-load-hook
X          User definable hook which runs after supercite is loaded.
X          Default: nil.
X
X     Variable: sc-run-hook
X          User definable hook which runs after sc-cite-original
X          executes. Default: nil.
X
X
X-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
X
XSince every email/news reader uses a different buffer name or
Xmajor-mode to reply in, supercite can't know ahead of time what the
Xbuffer or major-mode name is. So supercite needs to leach onto
Xwhatever buffer the reply is being made in, modifying the keymap and
Xthe documentation string for that buffer. Many of the supercite 2.0
Xbeta testers used many different readers, so a mechanism was developed
Xto provide a per-interface keymap, which installs itself into the
Xbuffer's current-local-map based on the major-mode of the buffer.
XThere are two variables which control the keymap that gets installed:
X
X          Variable: sc-default-keymap
X               Default keymap to use if major-mode keybinding cannot
X               be found in sc-local-keymaps.
X               Keybindings:
X                    (C-c C-r) sc-insert-reference
X                    (C-c C-t) sc-cite
X                    (C-c C-a) sc-recite
X                    (C-c C-u) sc-uncite
X                    (C-c C-i) sc-insert-citation
X                    (C-c C-o) sc-open-line
X                    (C-c C-q) sc-fill-paragraph-manually (also C-c q)
X                    (C-c C-m) sc-modify-information
X                    (C-c C-g) sc-glom-headers
X                    (C-c C-v) sc-version
X                    (C-c ?)   sc-describe
X
X          Variable: sc-local-keymaps
X               Variable which contains a list of interfaces and their
X               keybindings.
X
XSc-local-keymaps is an association list of the form:
X
X     ((MAJOR-MODE [FUNCTION | MAJOR-MODE])*)
X
XWhen it is time to modify the keymap of the current buffer, supercite
Xlooks up the `major-mode' of that buffer in this association list. If
Xit matches the major mode with a MAJOR-MODE key, the value is
Xreturned, otherwise, the default keymap is installed (see above).
X
XIf the MAJOR-MODE is found and the value is returned, this value is
Xchecked to see if it is a list.  If so, it is assumed that this value
Xis a lambda expression which will set the current local keymap as
Xdesired.  If the value is not a list, it is assumed to be a previously
Xdefined MAJOR-MODE.  This new major mode is looked up and the lambda
Xexpression is evaluated.  Only one level of indirection is possible,
Xbut this does allow you to save space when defining key bindings.
X
X-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
X
XThere are a number of interactive commands that are provided as part
Xof the supercite package.  You can find out more details about each
Xcommand by entering \\[describe-function] <function>.
X
X     Command: sc-insert-reference
X          Insert a reference header into the body of the text.
X          Key binding: \\[sc-insert-reference].
X
X     Command: sc-cite
X          Cite the region of text between point and mark.
X          Key binding: \\[sc-cite].
X
X     Command: sc-uncite
X          Uncite the region of text between point and mark.
X          Key binding: \\[sc-uncite].
X
X     Command: sc-recite
X          Recite the region of text between point and mark.
X          Key binding: \\[sc-recite].
X
X     Command: sc-insert-citation
X          Insert the citation string at the beginning of the
X          current line.
X          Key binding: \\[sc-insert-citation].
X
X     Command: sc-open-line
X          Insert a newline and leave point before it. Also, insert the
X          citation string at the beginning of the new line.
X          Key binding: \\[sc-open-line].
X
X     Command: sc-fill-paragraph-manually
X          Fill paragraph containing or following point by running
X          the hook, sc-fill-paragraph-hook.
X          Key binding: \\[sc-fill-paragraph-manually].
X
X     Command: sc-modify-information
X          Interactively add, delete or modify a key value in the
X          attribution list sc-gal-information.
X          Key binding: \\[sc-modify-information].
X
X     Command: sc-glom-headers
X          Glom information from mail headers in region between point
X          and mark.
X          Key binding: \\[sc-glom-headers].
X
X     Command: sc-version
X          Show the supercite version number.
X          Key binding: \\[sc-version].
X
X     Command: sc-describe
X          Describe the supercite package.
X          Key binding: \\[sc-describe].
X
X
X-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
X
XEnjoy, and please send the author your compliments, questions,
Xsuggestions and bug reports.  Don't forget, if you're interested in
Xdiscussing supercite, join the mailing list by sending mail to the
Xrequest line mentioned above."
X  (interactive)
X  (describe-function 'sc-describe))
X
X
X;; ======================================================================
X;; load hook
X(run-hooks 'sc-load-hook)
END_OF_FILE
if test 68078 -ne `wc -c <'supercite.el'`; then
    echo shar: \"'supercite.el'\" unpacked with wrong size!
fi
# end of 'supercite.el'
fi
echo shar: End of archive 2 \(of 2\).
cp /dev/null ark2isdone
MISSING=""
for I in 1 2 ; do
    if test ! -f ark${I}isdone ; then
	MISSING="${MISSING} ${I}"
    fi
done
if test "${MISSING}" = "" ; then
    echo You have unpacked both archives.
    rm -f ark[1-9]isdone
else
    echo You still need to unpack the following archives:
    echo "        " ${MISSING}
fi
##  End of shell archive.
exit 0