;;; supercite.el --- minor mode for citing mail and news replies
-;; Copyright (C) 1993, 1997, 2003 Free Software Foundation, Inc.
+;; Copyright (C) 1993, 1997, 2001, 2002, 2003, 2004,
+;; 2005, 2006, 2007 Free Software Foundation, Inc.
;; Author: 1993 Barry A. Warsaw <bwarsaw@python.org>
-;; Maintainer: FSF
+;; Maintainer: Glenn Morris <rgm@gnu.org>
;; Created: February 1993
-;; Last Modified: 1993/09/22 18:58:46
;; Keywords: mail, news
-;; supercite.el revision: 3.54
-
;; This file is part of GNU Emacs.
;; GNU Emacs is free software; you can redistribute it and/or modify
;; it under the terms of the GNU General Public License as published by
-;; the Free Software Foundation; either version 2, or (at your option)
+;; the Free Software Foundation; either version 3, or (at your option)
;; any later version.
;; GNU Emacs is distributed in the hope that it will be useful,
;; You should have received a copy of the GNU General Public License
;; along with GNU Emacs; see the file COPYING. If not, write to the
-;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
-;; Boston, MA 02111-1307, USA.
+;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+;; Boston, MA 02110-1301, USA.
;; LCD Archive Entry
;; supercite|Barry A. Warsaw|supercite-help@python.org
;; vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
(defgroup supercite nil
- "Supercite package"
+ "Supercite package."
:prefix "sc-"
:group 'mail
:group 'news)
(defgroup supercite-frames nil
- "Supercite (regi) frames"
+ "Supercite (regi) frames."
:prefix "sc-"
:group 'supercite)
(defgroup supercite-attr nil
- "Supercite attributions"
+ "Supercite attributions."
:prefix "sc-"
:group 'supercite)
(defgroup supercite-cite nil
- "Supercite citings"
+ "Supercite citings."
:prefix "sc-"
:group 'supercite)
(defgroup supercite-hooks nil
- "Hooking into supercite"
+ "Hooking into supercite."
:prefix "sc-"
:group 'supercite)
(...)))
Where INFOKEY is a key for `sc-mail-field', REGEXP is a regular
-expression to match against the INFOKEY's value. FRAME is a citation
-frame, or a variable containing a citation frame."
+expression to match against the INFOKEY's value. FRAME is
+a citation frame, or a symbol that represents the name of
+a variable whose value is a citation frame."
:type '(repeat (list symbol (repeat (cons regexp
(choice (repeat (repeat sexp))
symbol)))))
:group 'supercite-frames)
+(put 'sc-cite-frame-alist 'risky-local-variable t)
(defcustom sc-uncite-frame-alist '()
"*Alist for frame selection during unciting.
(choice (repeat (repeat sexp))
symbol)))))
:group 'supercite-frames)
+(put 'sc-uncite-frame-alist 'risky-local-variable t)
(defcustom sc-recite-frame-alist '()
"*Alist for frame selection during reciting.
(choice (repeat (repeat sexp))
symbol)))))
:group 'supercite-frames)
+(put 'sc-recite-frame-alist 'risky-local-variable t)
(defcustom sc-default-cite-frame
'(;; initialize fill state and temporary variables when entering
"*Default REGI frame for citing a region."
:type '(repeat (repeat sexp))
:group 'supercite-frames)
+(put 'sc-default-cite-frame 'risky-local-variable t)
(defcustom sc-default-uncite-frame
'(;; do nothing on a blank line
"*Default REGI frame for unciting a region."
:type '(repeat (repeat sexp))
:group 'supercite-frames)
+(put 'sc-default-uncite-frame 'risky-local-variable t)
(defcustom sc-default-recite-frame
'(;; initialize fill state when entering frame
"*Default REGI frame for reciting a region."
:type '(repeat (repeat sexp))
:group 'supercite-frames)
+(put 'sc-default-recite-frame 'risky-local-variable t)
(defcustom sc-cite-region-limit t
"*This variable controls automatic citation of yanked text.
-Legal values are:
+Valid values are:
non-nil -- cite the entire region, regardless of its size
nil -- do not cite the region at all
(defcustom sc-nuke-mail-headers 'all
"*Controls mail header nuking.
-Used in conjunction with `sc-nuke-mail-header-list'. Legal values are:
+Used in conjunction with `sc-nuke-mail-header-list'. Valid values are:
`all' -- nuke all mail headers
`none' -- don't nuke any mail headers
(...)))
Where INFOKEY is a key for `sc-mail-field', REGEXP is a regular
-expression to match against the INFOKEY's value. ATTRIBUTION can be a
-string or a list. If its a string, then it is the attribution that is
+expression to match against the INFOKEY's value. ATTRIBUTION can be a
+string or a list. If it's a string, then it is the attribution that is
selected by `sc-select-attribution'. If it is a list, it is `eval'd
and the return value must be a string, which is used as the selected
attribution. Note that the variable `sc-preferred-attribution-list'
(choice (sexp :tag "List to eval")
string)))))
:group 'supercite-attr)
+(put 'sc-attrib-selection-list 'risky-local-variable t)
(defcustom sc-attribs-preselect-hook nil
"*Hook to run before selecting an attribution."
Electric reference mode will cycle through this list of functions."
:type '(repeat sexp)
:group 'supercite)
+(put 'sc-rewrite-header-list 'risky-local-variable t)
(defcustom sc-titlecue-regexp "\\s +-+\\s +"
"*Regular expression describing the separator between names and titles.
;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
;; end user configuration variables
\f
-(defconst sc-version "3.1"
- "Supercite version number.")
-(defconst sc-help-address "bug-supercite@gnu.org"
- "Address accepting submissions of bug reports.")
+(define-obsolete-variable-alias 'sc-version 'emacs-version "23.1")
(defvar sc-mail-info nil
"Alist of mail header information gleaned from reply buffer.")
(prog1 quit-flag (setq quit-flag nil)))
(progn
(message "%s%s" p (single-key-description event))
- (and (fboundp 'deallocate-event)
- (deallocate-event event))
+ (if (fboundp 'deallocate-event)
+ (deallocate-event event))
(setq quit-flag nil)
(signal 'quit '())))
(let ((char
((setq elt (rassq char alist))
(message "%s%s" p (car elt))
(setq p (cdr elt)))
- ((and (fboundp 'button-release-event-p)
- (button-release-event-p event)) ; ignore them
+ ((if (fboundp 'button-release-event-p)
+ (button-release-event-p event)) ; ignore them
nil)
(t
(message "%s%s" p (single-key-description event))
(discard-input)
(if (eq p prompt)
(setq p (concat "Try again. " prompt)))))))
- (and (fboundp 'deallocate-event)
- (deallocate-event event))
+ (if (fboundp 'deallocate-event)
+ (deallocate-event event))
p))
(defun sc-scan-info-alist (alist)
(sc-mail-warn-if-non-rfc822-p (sc-mail-error-in-mail-field))
(end (setq sc-mail-headers-end (point))))
"Regi frame for glomming mail header information.")
+(put 'sc-mail-glom-frame 'risky-local-variable t)
(defvar curline) ; dynamic bondage
nonentry-func '(sc-mail-nuke-header-line)))
;; we never get far enough to interpret a frame if s-n-m-h == 'none
((eq sc-nuke-mail-headers 'none))
- (t (error "Illegal value for sc-nuke-mail-headers: %s"
+ (t (error "Invalid value for sc-nuke-mail-headers: %s"
sc-nuke-mail-headers))
) ; end-cond
(append
"Return the mail header field value associated with FIELD.
If there was no mail header with FIELD as its key, return the value of
`sc-mumble'. FIELD is case insensitive."
- (or (cdr (assoc (downcase field) sc-mail-info)) sc-mumble))
+ (or (cdr (assoc-string field sc-mail-info 'case-fold)) sc-mumble))
(defun sc-mail-field-query (arg)
"View the value of a mail field.
"Get the full email address path from FROM.
AUTHOR is the author's name (which is removed from the address)."
(let ((eos (length from)))
- (if (string-match (concat "\\(^\\|^\"\\)" author
- "\\(\\s +\\|\"\\s +\\)") from 0)
+ (if (string-match (concat "\\`\"?" (regexp-quote author)
+ "\"?\\s +") from 0)
(let ((address (substring from (match-end 0) eos)))
(if (and (= (aref address 0) ?<)
(= (aref address (1- (length address))) ?>))
(let ((elements (length namelist))
(position -1)
keepers filtered-list)
- (mapcar
+ (mapc
(function
(lambda (name)
(setq position (1+ position))
(let ((keep-p t))
- (mapcar
+ (mapc
(function
(lambda (filter)
(let ((regexp (car filter))
(setq keepers (cons position keepers)))
)))
namelist)
- (mapcar
+ (mapc
(function
(lambda (position)
(setq filtered-list (cons (nth position namelist) filtered-list))
(setq attribution attrib
attriblist nil))
((listp attrib)
- (setq attribution (eval attrib)
- attriblist nil))
+ (setq attribution (eval attrib))
+ (if (stringp attribution)
+ (setq attriblist nil)
+ (setq attribution nil
+ attriblist (cdr attriblist))))
(t (error "%s did not evaluate to a string or list!"
"sc-attrib-selection-list"))
)))
sc-citation-delimiter
sc-citation-separator))
+(defvar filladapt-prefix-table)
+
(defun sc-setup-filladapt ()
"Setup `filladapt-prefix-table' to handle Supercited paragraphs."
(let* ((fa-sc-elt 'filladapt-supercite-included-text)
and that means call `sc-select-attribution' too."
(interactive "r\nP\np")
(undo-boundary)
- (let ((frame (or (sc-scan-info-alist sc-cite-frame-alist)
- sc-default-cite-frame))
+ (let ((frame (sc-scan-info-alist sc-cite-frame-alist))
(sc-confirm-always-p (if confirm-p t sc-confirm-always-p)))
+ (if (and frame (symbolp frame))
+ (setq frame (symbol-value frame)))
+ (or frame (setq frame sc-default-cite-frame))
(run-hooks 'sc-pre-cite-hook)
(if interactive
(sc-select-attribution))
First runs `sc-pre-uncite-hook'."
(interactive "r")
(undo-boundary)
- (let ((frame (or (sc-scan-info-alist sc-uncite-frame-alist)
- sc-default-uncite-frame)))
+ (let ((frame (sc-scan-info-alist sc-uncite-frame-alist)))
+ (if (and frame (symbolp frame))
+ (setq frame (symbol-value frame)))
+ (or frame (setq frame sc-default-uncite-frame))
(run-hooks 'sc-pre-uncite-hook)
(regi-interpret frame start end)))
(let ((sc-confirm-always-p t))
(sc-select-attribution))
(undo-boundary)
- (let ((frame (or (sc-scan-info-alist sc-recite-frame-alist)
- sc-default-recite-frame)))
+ (let ((frame (sc-scan-info-alist sc-recite-frame-alist)))
+ (if (and frame (symbolp frame))
+ (setq frame (symbol-value frame)))
+ (or frame (setq frame sc-default-recite-frame))
(run-hooks 'sc-pre-recite-hook)
(regi-interpret frame start end)))
(progn (forward-line -1)
(or (= (point) (mail-header-end))
(and (eq major-mode 'mh-letter-mode)
- (mh-in-header-p)))))
+ (with-no-warnings
+ (mh-in-header-p))))))
(progn (forward-line)
(let ((kill-lines-magic t))
(kill-line))))))
(major-mode 'sc-electric-mode))
(use-local-map sc-electric-mode-map)
(sc-eref-show sc-eref-style)
- (run-hooks 'sc-electric-mode-hook)
+ (run-mode-hooks 'sc-electric-mode-hook)
(recursive-edit)
)))
(define-minor-mode sc-minor-mode
"Supercite minor mode."
- nil (" SC" (sc-auto-fill-region-p
- (":f" (sc-fixup-whitespace-p "w"))
- (sc-fixup-whitespace-p ":w")))
- `((,sc-mode-map-prefix . ,sc-mode-map)))
+ :group 'supercite
+ :lighter (" SC" (sc-auto-fill-region-p
+ (":f" (sc-fixup-whitespace-p "w"))
+ (sc-fixup-whitespace-p ":w")))
+ :keymap `((,sc-mode-map-prefix . ,sc-mode-map)))
;;;###autoload
(defun sc-cite-original ()
If MESSAGE is non-nil (interactively, with no prefix argument),
inserts the version string in the current buffer instead."
(interactive (not current-prefix-arg))
- (let ((verstr (format "Using Supercite.el %s" sc-version)))
+ (let ((verstr (format "Using Supercite.el %s" emacs-version)))
(if message
(message verstr)
(insert "`sc-version' says: " verstr))))
(interactive)
(describe-function 'sc-describe))
-(defun sc-submit-bug-report ()
- "Submit a bug report on Supercite via mail."
- (interactive)
- (require 'reporter)
- (and
- (y-or-n-p "Do you want to submit a report on Supercite? ")
- (reporter-submit-bug-report
- sc-help-address
- (concat "Supercite version " sc-version)
- (list
- 'sc-attrib-selection-list
- 'sc-auto-fill-region-p
- 'sc-blank-lines-after-headers
- 'sc-citation-leader
- 'sc-citation-delimiter
- 'sc-citation-separator
- 'sc-citation-leader-regexp
- 'sc-citation-root-regexp
- 'sc-citation-nonnested-root-regexp
- 'sc-citation-delimiter-regexp
- 'sc-citation-separator-regexp
- 'sc-cite-region-limit
- 'sc-confirm-always-p
- 'sc-default-attribution
- 'sc-default-author-name
- 'sc-downcase-p
- 'sc-electric-circular-p
- 'sc-electric-references-p
- 'sc-fixup-whitespace-p
- 'sc-mail-warn-if-non-rfc822-p
- 'sc-mumble
- 'sc-name-filter-alist
- 'sc-nested-citation-p
- 'sc-nuke-mail-headers
- 'sc-nuke-mail-header-list
- 'sc-preferred-attribution-list
- 'sc-preferred-header-style
- 'sc-reference-tag-string
- 'sc-rewrite-header-list
- 'sc-titlecue-regexp
- 'sc-use-only-preference-p
- ))))
+(define-obsolete-function-alias 'sc-submit-bug-report 'report-emacs-bug "23.1")
\f
;; useful stuff
(provide 'supercite)
(run-hooks 'sc-load-hook)
-;;; arch-tag: a5d5bfa6-3bd5-4414-8c65-0afc83e45cd3
+;; arch-tag: a5d5bfa6-3bd5-4414-8c65-0afc83e45cd3
;;; supercite.el ends here