]> code.delx.au - gnu-emacs/blobdiff - lisp/mail/supercite.el
(rmail-reply): Don't call mail-strip-quoted-names.
[gnu-emacs] / lisp / mail / supercite.el
index 439e4402f037c1964b67e169d7e2f8a4a48a8217..eadfa1430c3e919aca1d42ff1107e0a30068569f 100644 (file)
@@ -3,7 +3,7 @@
 ;; Copyright (C) 1993, 1997 Free Software Foundation, Inc.
 
 ;; Author: 1993 Barry A. Warsaw, Century Computing, Inc. <bwarsaw@cen.com>
-;; Maintainer:    supercite-help@python.org
+;; Maintainer:    Mark Senn <mds@ecn.purdue.edu>
 ;; Created:       February 1993
 ;; Last Modified: 1993/09/22 18:58:46
 ;; Keywords: mail, news
 ;; Boston, MA 02111-1307, USA.
 
 ;; LCD Archive Entry
-;; supercite|Barry A. Warsaw|supercite-help@anthem.nlm.nih.gov
+;; supercite|Barry A. Warsaw|supercite-help@python.org
 ;; |Mail and news reply citation package
 ;; |1993/09/22 18:58:46|3.1|
 
-;; Code:
+;;; Commentary:
+
+;;; Code:
 
 \f
 (require 'regi)
@@ -103,14 +105,14 @@ This should NOT have a leading `^' character."
 
 ;; Nemacs and Mule users note: please see the texinfo manual for
 ;; suggestions on setting these variables.
-(defcustom sc-citation-root-regexp "[-._a-zA-Z0-9]*"
+(defcustom sc-citation-root-regexp "[-._[:alnum:]]*"
   "*Regexp describing variable root part of a citation for a cited line.
 This should NOT have a leading `^' character.  See also
 `sc-citation-nonnested-root-regexp'."
   :type 'regexp
   :group 'supercite-cite)
 
-(defcustom sc-citation-nonnested-root-regexp "[-._a-zA-Z0-9]+"
+(defcustom sc-citation-nonnested-root-regexp "[-._[:alnum:]]+"
   "*Regexp describing the variable root part of a nested citation.
 This should NOT have a leading `^' character.  This variable is
 related to `sc-citation-root-regexp' but whereas that variable
@@ -419,9 +421,10 @@ and the return value must be a string, which is used as the selected
 attribution.  Note that the variable `sc-preferred-attribution-list'
 must contain an element of the string \"sc-consult\" for this variable
 to be consulted during attribution selection."
-  :type '(repeat (list symbol (repeat (cons regexp
-                                           (choice (repeat (repeat sexp))
-                                                   symbol)))))
+  :type '(repeat (list string
+                      (repeat (cons regexp
+                                    (choice (sexp :tag "List to eval")
+                                            string)))))
   :group 'supercite-attr)
 
 (defcustom sc-attribs-preselect-hook nil
@@ -499,7 +502,7 @@ string."
 \f
 (defconst sc-version "3.1"
   "Supercite version number.")
-(defconst sc-help-address "supercite-help@anthem.nlm.nih.gov"
+(defconst sc-help-address "bug-supercite@gnu.org"
   "Address accepting submissions of bug reports.")
 
 (defvar sc-mail-info nil
@@ -510,7 +513,8 @@ string."
 (defconst sc-emacs-features
   (let ((version 'v18)
        (flavor  'GNU))
-    (if (string= (substring emacs-version 0 2) "19")
+    (if (not
+        (string= (substring emacs-version 0 2) "18"))
        (setq version 'v19))
     (if (string-match "Lucid" emacs-version)
        (setq flavor 'Lucid))
@@ -519,9 +523,9 @@ string."
   "A list describing what version of Emacs we're running on.
 Known flavors are:
 
-All GNU18's: (v18 GNU)
-FSF19.x    : (v19 GNU)
-Lucid19.x  : (v19 Lucid)")
+Emacs 18           : (v18 GNU)
+Emacs 19 or later  : (v19 GNU)
+Lucid 19 or later  : (v19 Lucid)")
 
 
 (defvar sc-tmp-nested-regexp nil
@@ -647,8 +651,7 @@ In version 18, the HISTORY argument is ignored."
   "Compatibility between Emacs 18 and 19 `read-string'.
 In version 18, the HISTORY argument is ignored."
   (if (memq 'v19 sc-emacs-features)
-      ;; maybe future versions will take a `history' argument:
-      (read-string prompt initial-contents)
+      (read-string prompt initial-contents history)
     (read-string prompt initial-contents)))
 
 (if (fboundp 'match-string)
@@ -714,7 +717,7 @@ the list should be unique."
              (setq event (read-char)))
             ((memq 'Lucid sc-emacs-features)
              (next-command-event event))
-            (t                         ; must be FSF19
+            (t                         ; must be Emacs 19
              (setq event (read-event))))
            (prog1 quit-flag (setq quit-flag nil)))
          (progn
@@ -798,6 +801,8 @@ the list should be unique."
     (end                          (setq sc-mail-headers-end (point))))
   "Regi frame for glomming mail header information.")
 
+(eval-when-compile (defvar curline))   ; dynamic bondage
+
 ;; regi functions
 (defun sc-mail-fetch-field (&optional attribs-p)
   "Insert a key and value into `sc-mail-info' alist.
@@ -1008,7 +1013,7 @@ AUTHOR is the author's name (which is removed from the address)."
                   (= (aref address (1- (length address))) ?>))
              (substring address 1 (1- (length address)))
            address))
-      (if (string-match "[-a-zA-Z0-9!@%._]+" from 0)
+      (if (string-match "[-[:alnum:]!@%._]+" from 0)
          (sc-submatch 0 from)
        "")
       )))
@@ -1055,7 +1060,7 @@ This should be the author's full name minus an optional title."
          (sc-name-substring
           from (string-match "\".*\"" from 0) (match-end 0) 1)
          (sc-name-substring
-          from (string-match "\\([-.a-zA-Z0-9_]+\\s +\\)+<" from 0)
+          from (string-match "\\([-.[:alnum:]_]+\\s +\\)+<" from 0)
           (match-end 1) 0)
          (sc-attribs-emailname from))))
     ;; strip off any leading or trailing whitespace
@@ -1317,18 +1322,20 @@ to the auto-selected attribution string."
          (setq sc-attrib-or-cite nil)  ; nil==attribution, t==citation
          (while
              (catch 'sc-reconfirm
-               (string= "" (setq choice
-                                 (if sc-attrib-or-cite
-                                     (sc-read-string
-                                      "Enter citation prefix: "
-                                      citation
-                                      'sc-citation-confirmation-history)
-                                   (sc-completing-read
-                                    "Complete attribution name: "
-                                    query-alist nil nil
-                                    (cons initial 0)
-                                    'sc-attribution-confirmation-history)
-                                   )))))
+               (progn
+                 (setq choice
+                       (if sc-attrib-or-cite
+                           (sc-read-string
+                            "Enter citation prefix: "
+                            citation
+                            'sc-citation-confirmation-history)
+                         (sc-completing-read
+                          "Complete attribution name: "
+                          query-alist nil nil
+                          (cons initial 0)
+                          'sc-attribution-confirmation-history)
+                         ))
+                 nil)))
          (if sc-attrib-or-cite
              ;; since the citation was chosen, we have to guess at
              ;; the attribution
@@ -1861,11 +1868,11 @@ entered, regardless of the value of `sc-electric-references-p'.  See
 
 (defun sc-toggle-var (variable)
   "Boolean toggle VARIABLE's value.
-VARIABLE must be a bound symbol.  Nil values change to t, non-nil
+VARIABLE must be a bound symbol.  nil values change to t, non-nil
 values are changed to nil."
   (message "%s changed from %s to %s"
           variable (symbol-value variable)
-          (set-variable variable (not (eval-expression variable))))
+          (set variable (not (symbol-value variable))))
   (sc-set-mode-string))
 
 (defun sc-set-variable (var)
@@ -2010,7 +2017,7 @@ before, and `sc-post-hook' is run after the guts of this function."
   ;; this function gets automatically called. we want point to be a
   ;; mark so any deleting before point works properly
   (let* ((zmacs-regions nil)           ; for Lemacs
-        (mark-active t)                ; for FSFmacs
+        (mark-active t)                ; for Emacs
         (point (point-marker))
         (mark  (copy-marker (mark-marker))))
   
@@ -2092,7 +2099,7 @@ cited."
            (looking-at "^[ \t]*$")
            (consp arg))
        (insert (sc-mail-field "sc-citation"))
-      (error "Line is already cited."))))
+      (error "Line is already cited"))))
 
 (defun sc-version (arg)
   "Echo the current version of Supercite in the minibuffer.