(vip-shift-width): Doc fix.
[bpt/emacs.git] / lisp / sc.el
index 5e75e52..03eade6 100644 (file)
@@ -3,19 +3,15 @@
 
 ;; ========== Introduction ==========
 ;; Citation and attribution package for various GNU emacs news and
-;; electronic mail reading subsystems.  This version of supercite will
-;; interface to VM 4.40+ and MH-E 3.7 (shipped w/ emacs 18.57) as is.
-;; It will also interface with GNUS 3.12+, RMAIL 18.55+, GNEWS, and
-;; probably most other news/mail subsystems by using the overloading
-;; functions provided in sc-oloads.el (see that file or the README for
-;; more information on interfacing supercite with your reader subsystem).
-;; This version should now be compatible with Lucid Emacs 19.x emacses.
+;; electronic mail reading subsystems.  This version of supercite should
+;; work with Rmail and GNUS as found in Emacs 19.  It may also work with
+;; VM 4.40+ and MH-E 3.7.
 
 ;; This package does not do any yanking of messages, but instead
 ;; massages raw reply buffers set up by the reply/forward functions in
 ;; the news/mail subsystems. Therefore, such useful operations as
 ;; yanking and citing portions of the original article (instead of the
-;; whole article) are not within the ability or responsiblity of
+;; whole article) are not within the ability or responsibility of
 ;; supercite.
 
 ;; ========== Disclaimer ==========
 ;; replies that personalized flair, but the instructions in this
 ;; section should be sufficient for getting started.
 
-;; With this release of supercite overloading is the only supported
-;; way to get supercite hooked into your favorite news/mail reading
-;; subsystems.  Overloading will be necessary for RMAIL, GNUS, GNEWS,
-;; RNEWS and PCMAIL. Overloading will not be needed for VM 4.37+ or
-;; MH-E 3.7+.  MH-E comes with emacs 18.57 but if you have an earlier
-;; version of emacs, you should be able to ftp MH-E 3.7 separately. Or
-;; you can extract the MH-E overloading stuff from version 2.1's
-;; sc-oloads.el.
-
 ;; First, to connect supercite to any mail/news reading subsystem, put
 ;; this in your .emacs file:
 ;;
-;; (add-hooks 'mail-yank-hooks 'sc-cite-original)  ; for all but MH-E
+;; (setq mail-yank-hooks 'sc-cite-original)  ; for old mail agents
 ;; (setq mh-yank-hooks   'sc-cite-original)  ; for MH-E only
+;; (add-hook 'mail-citation-hook 'sc-cite-original) ; for newer mail agents
 ;;
 ;; If supercite is not pre-loaded into your emacs session, you should
 ;; add the following autoload:
 ;;
 ;; (autoload 'sc-cite-original "sc" "Supercite 2.3" t)
 ;;
-;; Then, if you need to overload, put the following in your .emacs file:
-;;
-;; (defun my-sc-overload-hook ()
-;;   (require 'sc-oloads)      ; be sure this file is on your load-path
-;;   (sc-overload-functions))
-;;
-;; (setq news-reply-mode-hook 'my-sc-overload-hook) ; for RNEWS,GNUS,GNEWS
-;; (setq mail-setup-hook      'my-sc-overload-hook) ; for RMAIL, PCMAIL
-;;
 ;; Finally, if you want to customize supercite, you should do it in a
 ;; function called my-supercite-hook and:
 ;;
 ;; (setq sc-load-hook 'my-supercite-hook)
 
-(require 'sc-alist)
+(require 'assoc)
 
 \f
 ;; vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
@@ -389,7 +368,7 @@ Runs after sc-cite-original executes.")
 
 \f
 ;; ======================================================================
-;; global variables, not user accessable
+;; global variables, not user accessible
 
 (defconst sc-version-number "2.3"
   "Supercite's version number.")
@@ -434,7 +413,7 @@ Runs after sc-cite-original executes.")
 (defun sc-mark ()
   "Mark compatibility between emacs v18 and v19."
   (let ((zmacs-regions nil))
-    (mark)))
+    (marker-position (mark-marker))))
 
 (defun sc-update-gal (attribution)
   "Update the information alist.
@@ -574,7 +553,7 @@ If FIELD is not a valid key, return sc-mumble-string."
   ())
 
 (defun sc-no-blank-line-or-header()
-  "Similar to sc-no-header except it removes the preceeding blank line."
+  "Similar to sc-no-header except it removes the preceding blank line."
   (if (not (bobp))
       (if (and (eolp)
               (progn (forward-line -1)
@@ -1000,7 +979,7 @@ Return the list of name symbols."
                                   (run-hooks 'sc-fill-paragraph-hook)))
               (setq fstart (point)
                     fend (point)))
-             ;; not end of line so perhap cite it
+             ;; not end of line so perhaps cite it
              ((not (looking-at sc-cite-regexp))
               (insert (aget sc-gal-information "sc-citation")))
              (sc-nested-citation-p
@@ -1106,11 +1085,11 @@ non-blank line after point.
          generic-citation))
        (t nil)))))                                      ;; heuristic #6
 
-(defun sc-consistant-cite-p (prefix)
-  "Check current paragraph for consistant citation.
+(defun sc-consistent-cite-p (prefix)
+  "Check current paragraph for consistent citation.
 Scans to paragraph delineated by (forward|backward)-paragraph to see
 if all lines start with PREFIX. Returns t if entire paragraph is
-consistantly cited, nil otherwise."
+consistently cited, nil otherwise."
   (save-excursion
     (let ((end   (progn (forward-paragraph)
                        (beginning-of-line)
@@ -1173,7 +1152,7 @@ Restrict scan to current paragraph."
 Fill the paragraph containing or following point. Use
 sc-guess-fill-prefix to find the fill-prefix for the paragraph.
 
-If the paragraph is inconsistantly cited (mixed fill-prefix), then the
+If the paragraph is inconsistently cited (mixed fill-prefix), then the
 user is queried to restrict the the fill to only those lines around
 point which begin with the fill prefix.
 
@@ -1186,7 +1165,7 @@ paragraph.  sc-fill-arg is set by sc-fill-paragraph-manually."
       (cond
        ((not fill-prefix)
        (fill-paragraph sc-fill-arg))
-       ((sc-consistant-cite-p fill-prefix)
+       ((sc-consistent-cite-p fill-prefix)
        (fill-paragraph sc-fill-arg))
        ((y-or-n-p "Inconsistent citation found. Restrict? ")
        (message "")
@@ -1387,10 +1366,12 @@ Any old information is lost, unless an error occurs."
        (info (copy-sequence sc-gal-information)))
     (setq sc-gal-attributions nil
          sc-gal-information nil)
-    (let ((start (region-beginning))
-         (end   (region-end))
+    (let (start end
          (sc-force-confirmation-p t)
          (sc-cite-context nil))
+      (let ((mark-active t))
+       (setq start (region-beginning)
+             end (region-end)))
       (sc-fetch-fields start end)
       (if (null sc-gal-information)
          (progn
@@ -1535,8 +1516,10 @@ original message but it does require a few things:
   (run-hooks 'sc-pre-hook)
   (setq sc-gal-attributions nil)
   (setq sc-gal-information nil)
-  (let ((start (region-beginning))
-       (end   (region-end)))
+  (let (start end)
+    (let ((mark-active t))
+      (setq start (region-beginning)
+           end (region-end)))
     (sc-fetch-fields start end)
     (sc-mail-yank-clear-headers start end)
     (if (not sc-all-but-cite-p)
@@ -1551,7 +1534,7 @@ original message but it does require a few things:
 ;;
 (defun sc-describe ()
   "Supercite version 2.3 is now described in a texinfo manual which
-makes the documenation available both for online perusal via emacs'
+makes the documentation available both for online perusal via emacs'
 info system, or for hard-copy printing using the TeX facility.
 
 To view the online document hit \\[info], then \"mSupercite <RET>\"."