;;; 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 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
;; 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
(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.
(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))) ?>))
(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
- (if (symbolp sc-cite-frame-alist)
- (symbol-value sc-cite-frame-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
- (if (symbolp sc-uncite-frame-alist)
- (symbol-value sc-uncite-frame-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
- (if (symbolp sc-recite-frame-alist)
- (symbol-value sc-recite-frame-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 ()
(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