;; 15-supercite-sy.el --- Mail citing Settings -*- Emacs-Lisp -*- ;; Copyright (C) 2007 - 2012 Steve Youngs ;; Author: Steve Youngs ;; Maintainer: Steve Youngs ;; Created: <2007-12-02> ;; Time-stamp: ;; Download: ;; HTMLised: ;; Git Repo: git clone http://git.sxemacs.org/syinit ;; Keywords: init, compile ;; This file is part of SYinit ;; Redistribution and use in source and binary forms, with or without ;; modification, are permitted provided that the following conditions ;; are met: ;; ;; 1. Redistributions of source code must retain the above copyright ;; notice, this list of conditions and the following disclaimer. ;; ;; 2. Redistributions in binary form must reproduce the above copyright ;; notice, this list of conditions and the following disclaimer in the ;; documentation and/or other materials provided with the distribution. ;; ;; 3. Neither the name of the author nor the names of any contributors ;; may be used to endorse or promote products derived from this ;; software without specific prior written permission. ;; ;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR ;; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED ;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE ;; DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE ;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR ;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR ;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, ;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE ;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN ;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. ;;; Commentary: ;; ;; Setting up citing in Gnus with Supercite. ;; ;;; Credits: ;; ;; The HTML version of this file was created with Hrvoje Niksic's ;; htmlize.el which is part of the XEmacs "text-modes" package. ;; ;;; Todo: ;; ;; ;;; Code: (require 'supercite) (require 'time-date) (defun sy-september-citation-line () (let ((sc-mumble "") (whofrom (sc-whofrom))) (if whofrom (insert sc-reference-tag-string (sc-hdr "On " (int-to-string (- (time-to-days (mail-header-parse-date (sc-mail-field "date"))) (time-to-days (encode-time 0 0 0 01 09 1993)))) " September 1993, ") (sc-mail-field "sc-author") " wrote:\n")))) (setq sc-rewrite-header-list '((sc-no-header) (sc-header-on-said) (sc-header-inarticle-writes) (sc-header-regarding-adds) (sc-header-attributed-writes) (sc-header-author-writes) (sc-header-verbose) (sc-no-blank-line-or-header) (sc-header-author-email-writes) (sy-september-citation-line))) (setq sc-preferred-attribution-list (list '"sc-lastchoice" "x-attribution" "sc-consult" "initials" "firstname" "emailname" "lastname")) (setq message-cite-function 'sc-cite-original sc-confirm-always-p nil sc-preferred-header-style 8 sc-auto-fill-region-p nil sc-fixup-whitespace-p nil sc-electric-references-p t sc-cite-blank-lines-p nil sc-nested-citation-p t sc-citation-leader " " sc-citation-separator " " sc-reference-tag-string "* " sc-citation-delimiter "> " sc-extract-address-components 'gnus-extract-address-components) (defun sy-sc-remove-signature () "Removes the signature from the original message. To use, hang it off the appropriate hook such as `sc-pre-hook' so you're not citing useless stuff." (save-excursion (let ((start (point)) (end (mark t)) (sig-sep gnus-signature-separator) mark) (while sig-sep (goto-char end) (when (re-search-backward (car sig-sep) start t) (forward-line -1) (while (looking-at "[ \t]*$") (forward-line -1)) (forward-line 1) (setq mark (set-marker (make-marker) (point))) (delete-region mark (mark t))) (setq sig-sep (cdr sig-sep)))))) (add-hook 'sc-load-hook 'sc-setup-filladapt) (add-hook 'sc-pre-hook 'sy-sc-remove-signature) (add-hook 'mail-citation-hook 'sc-cite-original) ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: (message "Supercite settings loaded successfully")