1 ;; 15-supercite.el --- Mail citing Settings
3 ;; Copyright (C) 2007 - 2020 Steve Youngs
5 ;; Author: Steve Youngs <steve@sxemacs.org>
6 ;; Maintainer: Steve Youngs <steve@sxemacs.org>
7 ;; Created: <2007-12-02>
8 ;; Time-stamp: <Saturday Sep 12, 2020 11:14:54 steve>
9 ;; Download: <https://downloads.sxemacs.org/SYinits>
10 ;; HTMLised: <https://www.sxemacs.org/SYinits/15-supercite.html>
11 ;; Git Repo: git clone https://git.sxemacs.org/syinit
12 ;; Keywords: init, compile
14 ;; This file is part of SYinit
16 ;; Redistribution and use in source and binary forms, with or without
17 ;; modification, are permitted provided that the following conditions
20 ;; 1. Redistributions of source code must retain the above copyright
21 ;; notice, this list of conditions and the following disclaimer.
23 ;; 2. Redistributions in binary form must reproduce the above copyright
24 ;; notice, this list of conditions and the following disclaimer in the
25 ;; documentation and/or other materials provided with the distribution.
27 ;; 3. Neither the name of the author nor the names of any contributors
28 ;; may be used to endorse or promote products derived from this
29 ;; software without specific prior written permission.
31 ;; THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR
32 ;; IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
33 ;; WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
34 ;; DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
35 ;; FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
36 ;; CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
37 ;; SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
38 ;; BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
39 ;; WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
40 ;; OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
41 ;; IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
45 ;; Setting up citing in Gnus with Supercite.
50 ;; The HTML version of this file was created with Hrvoje Niksic's
51 ;; htmlize.el which is part of the XEmacs "text-modes" package.
61 ;; Warning: This triggers a bug that has been fixed in an as yet to be
62 ;; released SXEmacs Gnus package. Sorry. I will get the packages out
63 ;; as soon as I can. This was as of: [2020-04-09]
64 (defun sy-september-citation-line ()
66 (whofrom (sc-whofrom)))
69 sc-reference-tag-string
72 (- (time-to-days (mail-header-parse-date
73 (sc-mail-field "date")))
74 (time-to-days (encode-time 0 0 0 01 09 1993))))
76 (sc-mail-field "sc-author")
79 (setq sc-rewrite-header-list
82 (sc-header-inarticle-writes)
83 (sc-header-regarding-adds)
84 (sc-header-author-email-writes)
85 (sc-header-attributed-writes)
86 (sc-header-author-writes)
88 (sc-no-blank-line-or-header)
89 (sc-header-author-email-writes)
90 (sy-september-citation-line)))
92 (setq sc-preferred-attribution-list
101 ;; ATM I'm not using the "traditional" Supercite way that non-nested
102 ;; citations prefixed with the author's attribution (normally their
103 ;; initials or their name), but rather the more "normal" form you see
104 ;; in most places today.
106 ;; If you do want the Supercite way, change `sc-nested-citation-p' to
107 ;; nil below and I would suggest choosing a different
108 ;; `sc-preferred-header-style' (see `sc-rewrite-header-list' above)
110 message-cite-function 'sc-cite-original
111 sc-confirm-always-p nil
112 sc-preferred-header-style 4
113 sc-auto-fill-region-p nil
114 sc-fixup-whitespace-p t
115 sc-electric-references-p t
116 sc-cite-blank-lines-p nil
117 sc-nested-citation-p t
118 sc-citation-separator " "
119 sc-reference-tag-string "|--> "
120 sc-citation-delimiter ">"
121 sc-extract-address-components 'gnus-extract-address-components)
123 (defun sy-sc-remove-signature ()
124 "Removes the signature from the original message.
126 To use, hang it off the appropriate hook such as `sc-pre-hook' so
127 you're not citing useless stuff."
129 (let ((start (point))
131 (sig-sep gnus-signature-separator)
135 (when (re-search-backward (car sig-sep) start t)
137 (while (looking-at "[ \t]*$")
140 (setq mark (set-marker (make-marker) (point)))
141 (delete-region mark (mark t)))
142 (setq sig-sep (cdr sig-sep))))))
144 (add-hook 'sc-load-hook 'sc-setup-filladapt)
145 (add-hook 'sc-pre-hook 'sy-sc-remove-signature)
146 (add-hook 'mail-citation-hook 'sc-cite-original)
148 ;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
149 (message "Supercite settings loaded successfully")