Mercurial > emacs
annotate lisp/mail/supercite.el @ 92594:674c88622bd9
Move many autoloads to separate file, cal-loaddefs.el.
Move defcustoms to start and re-order.
(calendar-month-name-array, calendar-starred-day): No need to declare
for compiler.
(cal-loaddefs): Require it.
(appt, chinese-calendar, calendar-tex): Move custom groups to the
appropriate file.
(diary-entry-marker, calendar-today-marker, calendar-holiday-marker):
Reverse logic.
(diary-face, diary-file-name-prefix-function, diary-include-string)
(diary-glob-file-regexp-prefix, diary-face-attrs)
(diary-file-name-prefix, sexp-diary-entry-symbol)
(print-diary-entries-hook, list-diary-entries-hook)
(nongregorian-diary-listing-hook, mark-diary-entries-hook)
(nongregorian-diary-marking-hook, diary-list-include-blanks):
Move to diary-lib.
(all-christian-calendar-holidays, all-islamic-calendar-holidays)
(all-bahai-calendar-holidays): Doc fix.
(calendar-mark-ring): Add doc-string.
(calendar-starred-day): Defvar it.
(calendar-mode): Make calendar-starred-day local.
(calendar-star-date): No need to make calendar-starred-day local.
author | Glenn Morris <rgm@gnu.org> |
---|---|
date | Sat, 08 Mar 2008 03:47:03 +0000 |
parents | 117d4bd1128b |
children | 31a0ecf62949 |
rev | line source |
---|---|
4850 | 1 ;;; supercite.el --- minor mode for citing mail and news replies |
2 | |
74509 | 3 ;; Copyright (C) 1993, 1997, 2001, 2002, 2003, 2004, |
79712 | 4 ;; 2005, 2006, 2007, 2008 Free Software Foundation, Inc. |
12859
90c22a02c12b
(sc-attribs-extract-namestring): If name has <...>,
Richard M. Stallman <rms@gnu.org>
parents:
12425
diff
changeset
|
5 |
57160 | 6 ;; Author: 1993 Barry A. Warsaw <bwarsaw@python.org> |
65919
5c09efcfc1d9
Update maintainer email address.
Glenn Morris <rgm@gnu.org>
parents:
64832
diff
changeset
|
7 ;; Maintainer: Glenn Morris <rgm@gnu.org> |
4850 | 8 ;; Created: February 1993 |
5140 | 9 ;; Keywords: mail, news |
4850 | 10 |
11 ;; This file is part of GNU Emacs. | |
12 | |
13 ;; GNU Emacs is free software; you can redistribute it and/or modify | |
14 ;; it under the terms of the GNU General Public License as published by | |
78232
8e27d63c45eb
Switch license to GPLv3 or later.
Glenn Morris <rgm@gnu.org>
parents:
75514
diff
changeset
|
15 ;; the Free Software Foundation; either version 3, or (at your option) |
4850 | 16 ;; any later version. |
17 | |
18 ;; GNU Emacs is distributed in the hope that it will be useful, | |
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 ;; GNU General Public License for more details. | |
22 | |
23 ;; You should have received a copy of the GNU General Public License | |
14169 | 24 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
64085 | 25 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
26 ;; Boston, MA 02110-1301, USA. | |
4850 | 27 |
28 ;; LCD Archive Entry | |
24612
8f10db1e779a
(sc-attrib-selection-list): Fix custom type
Dave Love <fx@gnu.org>
parents:
24426
diff
changeset
|
29 ;; supercite|Barry A. Warsaw|supercite-help@python.org |
4850 | 30 ;; |Mail and news reply citation package |
31 ;; |1993/09/22 18:58:46|3.1| | |
32 | |
38436
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
28437
diff
changeset
|
33 ;;; Commentary: |
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
28437
diff
changeset
|
34 |
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
28437
diff
changeset
|
35 ;;; Code: |
4850 | 36 |
37 | |
38 (require 'regi) | |
21861 | 39 (require 'sendmail) ;; For mail-header-end. |
4850 | 40 |
41 ;; start user configuration variables | |
42 ;; vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv | |
43 | |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
44 (defgroup supercite nil |
64037
72c3c77d111e
(supercite, supercite-frames, supercite-attr, supercite-cite, supercite-hooks):
Juanma Barranquero <lekktu@gmail.com>
parents:
63945
diff
changeset
|
45 "Supercite package." |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
46 :prefix "sc-" |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
47 :group 'mail |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
48 :group 'news) |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
49 |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
50 (defgroup supercite-frames nil |
64037
72c3c77d111e
(supercite, supercite-frames, supercite-attr, supercite-cite, supercite-hooks):
Juanma Barranquero <lekktu@gmail.com>
parents:
63945
diff
changeset
|
51 "Supercite (regi) frames." |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
52 :prefix "sc-" |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
53 :group 'supercite) |
4850 | 54 |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
55 (defgroup supercite-attr nil |
64037
72c3c77d111e
(supercite, supercite-frames, supercite-attr, supercite-cite, supercite-hooks):
Juanma Barranquero <lekktu@gmail.com>
parents:
63945
diff
changeset
|
56 "Supercite attributions." |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
57 :prefix "sc-" |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
58 :group 'supercite) |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
59 |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
60 (defgroup supercite-cite nil |
64037
72c3c77d111e
(supercite, supercite-frames, supercite-attr, supercite-cite, supercite-hooks):
Juanma Barranquero <lekktu@gmail.com>
parents:
63945
diff
changeset
|
61 "Supercite citings." |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
62 :prefix "sc-" |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
63 :group 'supercite) |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
64 |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
65 (defgroup supercite-hooks nil |
64037
72c3c77d111e
(supercite, supercite-frames, supercite-attr, supercite-cite, supercite-hooks):
Juanma Barranquero <lekktu@gmail.com>
parents:
63945
diff
changeset
|
66 "Hooking into supercite." |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
67 :prefix "sc-" |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
68 :group 'supercite) |
4850 | 69 |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
70 (defcustom sc-auto-fill-region-p t |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
71 "If non-nil, automatically fill each paragraph after it has been cited." |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
72 :type 'boolean |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
73 :group 'supercite) |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
74 |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
75 (defcustom sc-blank-lines-after-headers 1 |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
76 "Number of blank lines to leave after mail headers have been nuked. |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
77 Set to nil, to use whatever blank lines happen to occur naturally." |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
78 :type '(choice (const :tag "leave" nil) |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
79 integer) |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
80 :group 'supercite) |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
81 |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
82 (defcustom sc-citation-leader " " |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
83 "String comprising first part of a citation." |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
84 :type 'string |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
85 :group 'supercite-cite) |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
86 |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
87 (defcustom sc-citation-delimiter ">" |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
88 "String comprising third part of a citation. |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
89 This string is used in both nested and non-nested citations." |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
90 :type 'string |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
91 :group 'supercite-cite) |
4850 | 92 |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
93 (defcustom sc-citation-separator " " |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
94 "String comprising fourth and last part of a citation." |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
95 :type 'string |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
96 :group 'supercite-cite) |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
97 |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
98 (defcustom sc-citation-leader-regexp "[ \t]*" |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
99 "Regexp describing citation leader for a cited line. |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
100 This should NOT have a leading `^' character." |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
101 :type 'regexp |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
102 :group 'supercite-cite) |
4850 | 103 |
104 ;; Nemacs and Mule users note: please see the texinfo manual for | |
105 ;; suggestions on setting these variables. | |
28437 | 106 (defcustom sc-citation-root-regexp "[-._[:alnum:]]*" |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
107 "Regexp describing variable root part of a citation for a cited line. |
4850 | 108 This should NOT have a leading `^' character. See also |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
109 `sc-citation-nonnested-root-regexp'." |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
110 :type 'regexp |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
111 :group 'supercite-cite) |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
112 |
28437 | 113 (defcustom sc-citation-nonnested-root-regexp "[-._[:alnum:]]+" |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
114 "Regexp describing the variable root part of a nested citation. |
4850 | 115 This should NOT have a leading `^' character. This variable is |
14007
c6476f4bb121
(sc-citation-nonnested-root-regexp,
Karl Heuer <kwzh@gnu.org>
parents:
13813
diff
changeset
|
116 related to `sc-citation-root-regexp' but whereas that variable |
4850 | 117 describes both nested and non-nested citation roots, this variable |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
118 describes only nested citation roots." |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
119 :type 'regexp |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
120 :group 'supercite-cite) |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
121 |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
122 (defcustom sc-citation-delimiter-regexp "[>]+" |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
123 "Regexp describing citation delimiter for a cited line. |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
124 This should NOT have a leading `^' character." |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
125 :type 'regexp |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
126 :group 'supercite-cite) |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
127 |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
128 (defcustom sc-citation-separator-regexp "[ \t]*" |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
129 "Regexp describing citation separator for a cited line. |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
130 This should NOT have a leading `^' character." |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
131 :type 'regexp |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
132 :group 'supercite-cite) |
4850 | 133 |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
134 (defcustom sc-cite-blank-lines-p nil |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
135 "If non-nil, put a citation on blank lines." |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
136 :type 'boolean |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
137 :group 'supercite-cite) |
4850 | 138 |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
139 (defcustom sc-cite-frame-alist '() |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
140 "Alist for frame selection during citing. |
4850 | 141 Each element of this list has the following form: |
142 (INFOKEY ((REGEXP . FRAME) | |
143 (REGEXP . FRAME) | |
144 (...))) | |
145 | |
146 Where INFOKEY is a key for `sc-mail-field', REGEXP is a regular | |
58952
5c34e026a96e
(sc-cite-frame-alist): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
58583
diff
changeset
|
147 expression to match against the INFOKEY's value. FRAME is |
5c34e026a96e
(sc-cite-frame-alist): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
58583
diff
changeset
|
148 a citation frame, or a symbol that represents the name of |
5c34e026a96e
(sc-cite-frame-alist): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
58583
diff
changeset
|
149 a variable whose value is a citation frame." |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
150 :type '(repeat (list symbol (repeat (cons regexp |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
151 (choice (repeat (repeat sexp)) |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
152 symbol))))) |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
153 :group 'supercite-frames) |
62315
c37dfc8054d6
(sc-cite-frame-alist, sc-uncite-frame-alist)
Richard M. Stallman <rms@gnu.org>
parents:
61282
diff
changeset
|
154 (put 'sc-cite-frame-alist 'risky-local-variable t) |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
155 |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
156 (defcustom sc-uncite-frame-alist '() |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
157 "Alist for frame selection during unciting. |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
158 See the variable `sc-cite-frame-alist' for details." |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
159 :type '(repeat (list symbol (repeat (cons regexp |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
160 (choice (repeat (repeat sexp)) |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
161 symbol))))) |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
162 :group 'supercite-frames) |
62315
c37dfc8054d6
(sc-cite-frame-alist, sc-uncite-frame-alist)
Richard M. Stallman <rms@gnu.org>
parents:
61282
diff
changeset
|
163 (put 'sc-uncite-frame-alist 'risky-local-variable t) |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
164 |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
165 (defcustom sc-recite-frame-alist '() |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
166 "Alist for frame selection during reciting. |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
167 See the variable `sc-cite-frame-alist' for details." |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
168 :type '(repeat (list symbol (repeat (cons regexp |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
169 (choice (repeat (repeat sexp)) |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
170 symbol))))) |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
171 :group 'supercite-frames) |
62315
c37dfc8054d6
(sc-cite-frame-alist, sc-uncite-frame-alist)
Richard M. Stallman <rms@gnu.org>
parents:
61282
diff
changeset
|
172 (put 'sc-recite-frame-alist 'risky-local-variable t) |
4850 | 173 |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
174 (defcustom sc-default-cite-frame |
4850 | 175 '(;; initialize fill state and temporary variables when entering |
176 ;; frame. this makes things run much faster | |
177 (begin (progn | |
178 (sc-fill-if-different) | |
179 (setq sc-tmp-nested-regexp (sc-cite-regexp "") | |
180 sc-tmp-nonnested-regexp (sc-cite-regexp) | |
181 sc-tmp-dumb-regexp | |
182 (concat "\\(" | |
183 (sc-cite-regexp "") | |
184 "\\)" | |
185 (sc-cite-regexp sc-citation-nonnested-root-regexp)) | |
186 ))) | |
187 ;; blank lines mean paragraph separators, so fill the last cited | |
188 ;; paragraph, unless sc-cite-blank-lines-p is non-nil, in which | |
189 ;; case we treat blank lines just like any other line. | |
190 ("^[ \t]*$" (if sc-cite-blank-lines-p | |
191 (sc-cite-line) | |
192 (sc-fill-if-different ""))) | |
193 ;; do nothing if looking at a reference tag. make sure that the | |
194 ;; tag string isn't the empty string since this will match every | |
195 ;; line. it cannot be nil. | |
196 (sc-reference-tag-string (if (string= sc-reference-tag-string "") | |
197 (list 'continue) | |
198 nil)) | |
199 ;; this regexp catches nested citations in which the author cited | |
200 ;; a non-nested citation with a dumb citer. | |
201 (sc-tmp-dumb-regexp (sc-cite-coerce-dumb-citer)) | |
202 ;; if we are looking at a nested citation then add a citation level | |
203 (sc-tmp-nested-regexp (sc-add-citation-level)) | |
204 ;; if we're looking at a non-nested citation, coerce it to our style | |
205 (sc-tmp-nonnested-regexp (sc-cite-coerce-cited-line)) | |
206 ;; we must be looking at an uncited line. if we are in nested | |
207 ;; citations, just add a citation level | |
208 (sc-nested-citation-p (sc-add-citation-level)) | |
209 ;; we're looking at an uncited line and we are in non-nested | |
210 ;; citations, so cite it with a non-nested citation | |
211 (t (sc-cite-line)) | |
212 ;; be sure when we're done that we fill the last cited paragraph. | |
213 (end (sc-fill-if-different "")) | |
214 ) | |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
215 "Default REGI frame for citing a region." |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
216 :type '(repeat (repeat sexp)) |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
217 :group 'supercite-frames) |
62315
c37dfc8054d6
(sc-cite-frame-alist, sc-uncite-frame-alist)
Richard M. Stallman <rms@gnu.org>
parents:
61282
diff
changeset
|
218 (put 'sc-default-cite-frame 'risky-local-variable t) |
4850 | 219 |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
220 (defcustom sc-default-uncite-frame |
4850 | 221 '(;; do nothing on a blank line |
222 ("^[ \t]*$" nil) | |
223 ;; if the line is cited, uncite it | |
224 ((sc-cite-regexp) (sc-uncite-line)) | |
225 ) | |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
226 "Default REGI frame for unciting a region." |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
227 :type '(repeat (repeat sexp)) |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
228 :group 'supercite-frames) |
62315
c37dfc8054d6
(sc-cite-frame-alist, sc-uncite-frame-alist)
Richard M. Stallman <rms@gnu.org>
parents:
61282
diff
changeset
|
229 (put 'sc-default-uncite-frame 'risky-local-variable t) |
4850 | 230 |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
231 (defcustom sc-default-recite-frame |
4850 | 232 '(;; initialize fill state when entering frame |
233 (begin (sc-fill-if-different)) | |
234 ;; do nothing on a blank line | |
235 ("^[ \t]*$" nil) | |
236 ;; if we're looking at a cited line, recite it | |
237 ((sc-cite-regexp) (sc-recite-line (sc-cite-regexp))) | |
238 ;; otherwise, the line is uncited, so just cite it | |
239 (t (sc-cite-line)) | |
240 ;; be sure when we're done that we fill the last cited paragraph. | |
241 (end (sc-fill-if-different "")) | |
242 ) | |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
243 "Default REGI frame for reciting a region." |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
244 :type '(repeat (repeat sexp)) |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
245 :group 'supercite-frames) |
62315
c37dfc8054d6
(sc-cite-frame-alist, sc-uncite-frame-alist)
Richard M. Stallman <rms@gnu.org>
parents:
61282
diff
changeset
|
246 (put 'sc-default-recite-frame 'risky-local-variable t) |
4850 | 247 |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
248 (defcustom sc-cite-region-limit t |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
249 "This variable controls automatic citation of yanked text. |
60924
fb2b49a3a4e0
* mail/supercite.el: Replace `legal' with `valid'.
Werner LEMBERG <wl@gnu.org>
parents:
60916
diff
changeset
|
250 Valid values are: |
4850 | 251 |
252 non-nil -- cite the entire region, regardless of its size | |
253 nil -- do not cite the region at all | |
254 <integer> -- a number indicating the threshold for citation. When | |
255 the number of lines in the region is greater than this | |
256 value, a warning message will be printed and the region | |
257 will not be cited. Lines in region are counted with | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
43791
diff
changeset
|
258 `count-lines'. |
4850 | 259 |
260 The gathering of attribution information is not affected by the value | |
261 of this variable. The number of lines in the region is calculated | |
262 *after* all mail headers are removed. This variable is only consulted | |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
263 during the initial citing via `sc-cite-original'." |
22592
17e17690ab4e
(sc-cite-region-limit): Use `other' widget
Andreas Schwab <schwab@suse.de>
parents:
21861
diff
changeset
|
264 :type '(choice (const :tag "do not cite" nil) |
17e17690ab4e
(sc-cite-region-limit): Use `other' widget
Andreas Schwab <schwab@suse.de>
parents:
21861
diff
changeset
|
265 (integer :tag "citation threshold") |
17e17690ab4e
(sc-cite-region-limit): Use `other' widget
Andreas Schwab <schwab@suse.de>
parents:
21861
diff
changeset
|
266 (other :tag "always cite" t)) |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
267 :group 'supercite-cite) |
4850 | 268 |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
269 (defcustom sc-confirm-always-p t |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
270 "If non-nil, always confirm attribution string before citing text body." |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
271 :type 'boolean |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
272 :group 'supercite-attr) |
4850 | 273 |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
274 (defcustom sc-default-attribution "Anon" |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
275 "String used when author's attribution cannot be determined." |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
276 :type 'string |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
277 :group 'supercite-attr) |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
278 (defcustom sc-default-author-name "Anonymous" |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
279 "String used when author's name cannot be determined." |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
280 :type 'string |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
281 :group 'supercite-attr) |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
282 (defcustom sc-downcase-p nil |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
283 "Non-nil means downcase the attribution and citation strings." |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
284 :type 'boolean |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
285 :group 'supercite-attr |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
286 :group 'supercite-cite) |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
287 (defcustom sc-electric-circular-p t |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
288 "If non-nil, treat electric references as circular." |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
289 :type 'boolean |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
290 :group 'supercite-attr) |
4850 | 291 |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
292 (defcustom sc-electric-mode-hook nil |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
293 "Hook for `sc-electric-mode' electric references mode." |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
294 :type 'hook |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
295 :group 'supercite-hooks) |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
296 (defcustom sc-electric-references-p nil |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
297 "Use electric references if non-nil." |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
298 :type 'boolean |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
299 :group 'supercite) |
4850 | 300 |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
301 (defcustom sc-fixup-whitespace-p nil |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
302 "If non-nil, delete all leading white space before citing." |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
303 :type 'boolean |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
304 :group 'supercite) |
4850 | 305 |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
306 (defcustom sc-load-hook nil |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
307 "Hook which gets run once after Supercite loads." |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
308 :type 'hook |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
309 :group 'supercite-hooks) |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
310 (defcustom sc-pre-hook nil |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
311 "Hook which gets run before each invocation of `sc-cite-original'." |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
312 :type 'hook |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
313 :group 'supercite-hooks) |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
314 (defcustom sc-post-hook nil |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
315 "Hook which gets run after each invocation of `sc-cite-original'." |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
316 :type 'hook |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
317 :group 'supercite-hooks) |
4850 | 318 |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
319 (defcustom sc-mail-warn-if-non-rfc822-p t |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
320 "Warn if mail headers don't conform to RFC822." |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
321 :type 'boolean |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
322 :group 'supercite-attr) |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
323 (defcustom sc-mumble "" |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
324 "Value returned by `sc-mail-field' if field isn't in mail headers." |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
325 :type 'string |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
326 :group 'supercite-attr) |
4850 | 327 |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
328 (defcustom sc-name-filter-alist |
4850 | 329 '(("^\\(Mr\\|Mrs\\|Ms\\|Dr\\)[.]?$" . 0) |
330 ("^\\(Jr\\|Sr\\)[.]?$" . last) | |
331 ("^ASTS$" . 0) | |
332 ("^[I]+$" . last)) | |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
333 "Name list components which are filtered out as noise. |
4850 | 334 This variable contains an association list where each element is of |
335 the form: (REGEXP . POSITION). | |
336 | |
337 REGEXP is a regular expression which matches the name list component. | |
338 Match is performed using `string-match'. POSITION is the position in | |
339 the name list which can match the regular expression, starting at zero | |
340 for the first element. Use `last' to match the last element in the | |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
341 list and `any' to match all elements." |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
342 :type '(repeat (cons regexp (choice (const last) (const any) |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
343 (integer :tag "position")))) |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
344 :group 'supercite-attr) |
4850 | 345 |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
346 (defcustom sc-nested-citation-p nil |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
347 "Controls whether to use nested or non-nested citation style. |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
348 Non-nil uses nested citations, nil uses non-nested citations." |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
349 :type 'boolean |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
350 :group 'supercite) |
4850 | 351 |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
352 (defcustom sc-nuke-mail-headers 'all |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
353 "Controls mail header nuking. |
60924
fb2b49a3a4e0
* mail/supercite.el: Replace `legal' with `valid'.
Werner LEMBERG <wl@gnu.org>
parents:
60916
diff
changeset
|
354 Used in conjunction with `sc-nuke-mail-header-list'. Valid values are: |
4850 | 355 |
356 `all' -- nuke all mail headers | |
357 `none' -- don't nuke any mail headers | |
358 `specified' -- nuke headers specified in `sc-nuke-mail-header-list' | |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
359 `keep' -- keep headers specified in `sc-nuke-mail-header-list'" |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
360 :type '(choice (const all) (const none) |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
361 (const specified) (const keep)) |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
362 :group 'supercite) |
4850 | 363 |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
364 (defcustom sc-nuke-mail-header-list nil |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
365 "List of mail header regexps to remove or keep in body of reply. |
4850 | 366 This list contains regular expressions describing the mail headers to |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
367 keep or nuke, depending on the value of `sc-nuke-mail-headers'." |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
368 :type '(repeat regexp) |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
369 :group 'supercite) |
4850 | 370 |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
371 (defcustom sc-preferred-attribution-list |
4850 | 372 '("sc-lastchoice" "x-attribution" "firstname" "initials" "lastname") |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
373 "Specifies what to use as the attribution string. |
4850 | 374 Supercite creates a list of possible attributions when it scans the |
375 mail headers from the original message. Each attribution choice is | |
376 associated with a key in an attribution alist. Supercite tries to | |
377 pick a \"preferred\" attribution by matching the attribution alist | |
378 keys against the elements in `sc-preferred-attribution-list' in order. | |
379 The first non-empty string value found is used as the preferred | |
380 attribution. | |
381 | |
382 Note that Supercite now honors the X-Attribution: mail field. If | |
383 present in the original message, the value of this field should always | |
384 be used to select the most preferred attribution since it reflects how | |
385 the original author would like to be distinguished. It should be | |
386 considered bad taste to put any attribution preference key before | |
387 \"x-attribution\" in this list, except perhaps for \"sc-lastchoice\" | |
7639 | 388 \(see below). |
4850 | 389 |
390 Supercite remembers the last attribution used when reciting an already | |
391 cited paragraph. This attribution will always be saved with the | |
392 \"sc-lastchoice\" key, which can be used in this list. Note that the | |
393 last choice is always reset after every call of `sc-cite-original'. | |
394 | |
395 Barring error conditions, the following preferences are always present | |
396 in the attribution alist: | |
397 | |
398 \"emailname\" -- email terminus name | |
399 \"initials\" -- initials of author | |
400 \"firstname\" -- first name of author | |
401 \"lastname\" -- last name of author | |
402 \"middlename-1\" -- first middle name of author | |
403 \"middlename-2\" -- second middle name of author | |
404 ... | |
405 | |
406 Middle name indexes can be any positive integer greater than 0, | |
407 although it is unlikely that many authors will supply more than one | |
408 middle name, if that many. The string of all middle names is | |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
409 associated with the key \"middlenames\"." |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
410 :type '(repeat string) |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
411 :group 'supercite-attr) |
4850 | 412 |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
413 (defcustom sc-attrib-selection-list nil |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
414 "An alist for selecting preferred attribution based on mail headers. |
4850 | 415 Each element of this list has the following form: |
416 | |
417 (INFOKEY ((REGEXP . ATTRIBUTION) | |
418 (REGEXP . ATTRIBUTION) | |
419 (...))) | |
420 | |
421 Where INFOKEY is a key for `sc-mail-field', REGEXP is a regular | |
75514
77b456d647bc
(sc-attrib-selection-list): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
75347
diff
changeset
|
422 expression to match against the INFOKEY's value. ATTRIBUTION can be a |
77b456d647bc
(sc-attrib-selection-list): Fix typo in docstring.
Juanma Barranquero <lekktu@gmail.com>
parents:
75347
diff
changeset
|
423 string or a list. If it's a string, then it is the attribution that is |
4850 | 424 selected by `sc-select-attribution'. If it is a list, it is `eval'd |
425 and the return value must be a string, which is used as the selected | |
426 attribution. Note that the variable `sc-preferred-attribution-list' | |
427 must contain an element of the string \"sc-consult\" for this variable | |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
428 to be consulted during attribution selection." |
24613
83a507b08fe1
(sc-scan-info-alist): Revert last change.
Dave Love <fx@gnu.org>
parents:
24612
diff
changeset
|
429 :type '(repeat (list string |
83a507b08fe1
(sc-scan-info-alist): Revert last change.
Dave Love <fx@gnu.org>
parents:
24612
diff
changeset
|
430 (repeat (cons regexp |
83a507b08fe1
(sc-scan-info-alist): Revert last change.
Dave Love <fx@gnu.org>
parents:
24612
diff
changeset
|
431 (choice (sexp :tag "List to eval") |
83a507b08fe1
(sc-scan-info-alist): Revert last change.
Dave Love <fx@gnu.org>
parents:
24612
diff
changeset
|
432 string))))) |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
433 :group 'supercite-attr) |
62315
c37dfc8054d6
(sc-cite-frame-alist, sc-uncite-frame-alist)
Richard M. Stallman <rms@gnu.org>
parents:
61282
diff
changeset
|
434 (put 'sc-attrib-selection-list 'risky-local-variable t) |
4850 | 435 |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
436 (defcustom sc-attribs-preselect-hook nil |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
437 "Hook to run before selecting an attribution." |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
438 :type 'hook |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
439 :group 'supercite-attr |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
440 :group 'supercite-hooks) |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
441 (defcustom sc-attribs-postselect-hook nil |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
442 "Hook to run after selecting an attribution, but before confirmation." |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
443 :type 'hook |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
444 :group 'supercite-attr |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
445 :group 'supercite-hooks) |
4850 | 446 |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
447 (defcustom sc-pre-cite-hook nil |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
448 "Hook to run before citing a region of text." |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
449 :type 'hook |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
450 :group 'supercite-cite |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
451 :group 'supercite-hooks) |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
452 (defcustom sc-pre-uncite-hook nil |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
453 "Hook to run before unciting a region of text." |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
454 :type 'hook |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
455 :group 'supercite-cite |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
456 :group 'supercite-hooks) |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
457 (defcustom sc-pre-recite-hook nil |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
458 "Hook to run before reciting a region of text." |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
459 :type 'hook |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
460 :group 'supercite-cite |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
461 :group 'supercite-hooks) |
4850 | 462 |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
463 (defcustom sc-preferred-header-style 4 |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
464 "Index into `sc-rewrite-header-list' specifying preferred header style. |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
465 Index zero accesses the first function in the list." |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
466 :type 'integer |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
467 :group 'supercite) |
4850 | 468 |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
469 (defcustom sc-reference-tag-string ">>>>> " |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
470 "String used at the beginning of built-in reference headers." |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
471 :type 'string |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
472 :group 'supercite) |
4850 | 473 |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
474 (defcustom sc-rewrite-header-list |
4850 | 475 '((sc-no-header) |
476 (sc-header-on-said) | |
477 (sc-header-inarticle-writes) | |
478 (sc-header-regarding-adds) | |
479 (sc-header-attributed-writes) | |
480 (sc-header-author-writes) | |
481 (sc-header-verbose) | |
482 (sc-no-blank-line-or-header) | |
483 ) | |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
484 "List of reference header rewrite functions. |
4850 | 485 The variable `sc-preferred-header-style' controls which function in |
486 this list is chosen for automatic reference header insertions. | |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
487 Electric reference mode will cycle through this list of functions." |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
488 :type '(repeat sexp) |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
489 :group 'supercite) |
62315
c37dfc8054d6
(sc-cite-frame-alist, sc-uncite-frame-alist)
Richard M. Stallman <rms@gnu.org>
parents:
61282
diff
changeset
|
490 (put 'sc-rewrite-header-list 'risky-local-variable t) |
4850 | 491 |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
492 (defcustom sc-titlecue-regexp "\\s +-+\\s +" |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
493 "Regular expression describing the separator between names and titles. |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
494 Set to nil to treat entire field as a name." |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
495 :type '(choice (const :tag "entire field as name" nil) |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
496 regexp) |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
497 :group 'supercite-attr) |
4850 | 498 |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
499 (defcustom sc-use-only-preference-p nil |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
500 "Controls what happens when the preferred attribution cannot be found. |
4850 | 501 If non-nil, then `sc-default-attribution' will be used. If nil, then |
502 some secondary scheme will be employed to find a suitable attribution | |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
503 string." |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
504 :type 'boolean |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
505 :group 'supercite-attr) |
4850 | 506 |
92543
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
507 (defcustom sc-mode-map-prefix "\C-c\C-p" |
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
508 "Key binding to install Supercite keymap." |
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
509 :type 'string |
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
510 :group 'supercite) |
117d4bd1128b
Remove leading `*' from defcustom doc-strings.
Glenn Morris <rgm@gnu.org>
parents:
92263
diff
changeset
|
511 |
4850 | 512 ;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ |
513 ;; end user configuration variables | |
514 | |
86532
c44e4015b517
Delete meaningless header keys.
Glenn Morris <rgm@gnu.org>
parents:
84957
diff
changeset
|
515 (define-obsolete-variable-alias 'sc-version 'emacs-version "23.1") |
4850 | 516 |
517 (defvar sc-mail-info nil | |
518 "Alist of mail header information gleaned from reply buffer.") | |
519 (defvar sc-attributions nil | |
520 "Alist of attributions for use when citing.") | |
521 | |
522 (defvar sc-tmp-nested-regexp nil | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
523 "Temporary regexp describing nested citations.") |
4850 | 524 (defvar sc-tmp-nonnested-regexp nil |
525 "Temporary regexp describing non-nested citations.") | |
526 (defvar sc-tmp-dumb-regexp nil | |
527 "Temp regexp describing non-nested citation cited with a nesting citer.") | |
528 | |
529 (make-variable-buffer-local 'sc-mail-info) | |
530 (make-variable-buffer-local 'sc-attributions) | |
531 | |
532 | |
533 ;; ====================================================================== | |
534 ;; supercite keymaps | |
535 | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
536 (defvar sc-T-keymap |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
537 (let ((map (make-sparse-keymap))) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
538 (define-key map "a" 'sc-S-preferred-attribution-list) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
539 (define-key map "b" 'sc-T-mail-nuke-blank-lines) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
540 (define-key map "c" 'sc-T-confirm-always) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
541 (define-key map "d" 'sc-T-downcase) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
542 (define-key map "e" 'sc-T-electric-references) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
543 (define-key map "f" 'sc-T-auto-fill-region) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
544 (define-key map "h" 'sc-T-describe) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
545 (define-key map "l" 'sc-S-cite-region-limit) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
546 (define-key map "n" 'sc-S-mail-nuke-mail-headers) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
547 (define-key map "N" 'sc-S-mail-header-nuke-list) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
548 (define-key map "o" 'sc-T-electric-circular) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
549 (define-key map "p" 'sc-S-preferred-header-style) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
550 (define-key map "s" 'sc-T-nested-citation) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
551 (define-key map "u" 'sc-T-use-only-preferences) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
552 (define-key map "w" 'sc-T-fixup-whitespace) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
553 (define-key map "?" 'sc-T-describe) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
554 map) |
4850 | 555 "Keymap for sub-keymap of setting and toggling functions.") |
556 | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
557 (defvar sc-mode-map |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
558 (let ((map (make-sparse-keymap))) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
559 (define-key map "c" 'sc-cite-region) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
560 (define-key map "f" 'sc-mail-field-query) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
561 (define-key map "g" 'sc-mail-process-headers) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
562 (define-key map "h" 'sc-describe) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
563 (define-key map "i" 'sc-insert-citation) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
564 (define-key map "o" 'sc-open-line) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
565 (define-key map "r" 'sc-recite-region) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
566 (define-key map "\C-p" 'sc-raw-mode-toggle) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
567 (define-key map "u" 'sc-uncite-region) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
568 (define-key map "v" 'sc-version) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
569 (define-key map "w" 'sc-insert-reference) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
570 (define-key map "\C-t" sc-T-keymap) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
571 (define-key map "\C-b" 'sc-submit-bug-report) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
572 (define-key map "?" 'sc-describe) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
573 map) |
4850 | 574 "Keymap for Supercite quasi-mode.") |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
43791
diff
changeset
|
575 |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
576 (defvar sc-electric-mode-map |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
577 (let ((map (make-sparse-keymap))) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
578 (define-key map "p" 'sc-eref-prev) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
579 (define-key map "n" 'sc-eref-next) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
580 (define-key map "s" 'sc-eref-setn) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
581 (define-key map "j" 'sc-eref-jump) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
582 (define-key map "x" 'sc-eref-abort) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
583 (define-key map "q" 'sc-eref-abort) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
584 (define-key map "\r" 'sc-eref-exit) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
585 (define-key map "\n" 'sc-eref-exit) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
586 (define-key map "g" 'sc-eref-goto) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
587 (define-key map "?" 'describe-mode) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
588 (define-key map "\C-h" 'describe-mode) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
589 (define-key map [f1] 'describe-mode) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
590 (define-key map [help] 'describe-mode) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
591 map) |
4850 | 592 "Keymap for `sc-electric-mode' electric references mode.") |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
593 |
4850 | 594 |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
595 (defvar sc-minibuffer-local-completion-map |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
596 (let ((map (copy-keymap minibuffer-local-completion-map))) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
597 (define-key map "\C-t" 'sc-toggle-fn) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
598 (define-key map " " 'self-insert-command) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
599 map) |
4850 | 600 "Keymap for minibuffer confirmation of attribution strings.") |
601 | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
602 (defvar sc-minibuffer-local-map |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
603 (let ((map (copy-keymap minibuffer-local-map))) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
604 (define-key map "\C-t" 'sc-toggle-fn) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
605 map) |
4850 | 606 "Keymap for minibuffer confirmation of attribution strings.") |
607 | |
608 | |
609 ;; ====================================================================== | |
610 ;; utility functions | |
611 | |
612 (defun sc-ask (alist) | |
613 "Ask a question in the minibuffer requiring a single character answer. | |
614 This function is kind of an extension of `y-or-n-p' where a single | |
615 letter is used to answer a question. Question is formed from ALIST | |
616 which has members of the form: (WORD . LETTER). WORD is the long | |
617 word form, while LETTER is the letter for selecting that answer. The | |
618 selected letter is returned, or nil if the question was not answered. | |
619 Note that WORD is a string and LETTER is a character. All LETTERs in | |
620 the list should be unique." | |
621 (let* ((prompt (concat | |
622 (mapconcat (function (lambda (elt) (car elt))) alist ", ") | |
623 "? (" | |
624 (mapconcat | |
625 (function | |
626 (lambda (elt) (char-to-string (cdr elt)))) alist "/") | |
627 ") ")) | |
628 (p prompt) | |
629 (event | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
630 (if (fboundp 'allocate-event) |
4850 | 631 (allocate-event) |
632 nil))) | |
633 (while (stringp p) | |
634 (if (let ((cursor-in-echo-area t) | |
635 (inhibit-quit t)) | |
636 (message "%s" p) | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
637 (setq event (read-event)) |
4850 | 638 (prog1 quit-flag (setq quit-flag nil))) |
639 (progn | |
640 (message "%s%s" p (single-key-description event)) | |
64832
103e161cb74f
(sc-ask, sc-no-blank-line-or-header): Avoid warnings.
Richard M. Stallman <rms@gnu.org>
parents:
64754
diff
changeset
|
641 (if (fboundp 'deallocate-event) |
103e161cb74f
(sc-ask, sc-no-blank-line-or-header): Avoid warnings.
Richard M. Stallman <rms@gnu.org>
parents:
64754
diff
changeset
|
642 (deallocate-event event)) |
4850 | 643 (setq quit-flag nil) |
644 (signal 'quit '()))) | |
645 (let ((char | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
646 (if (featurep 'xemacs) |
4850 | 647 (let* ((key (and (key-press-event-p event) (event-key event))) |
648 (char (and key (event-to-character event)))) | |
649 char) | |
650 event)) | |
651 elt) | |
652 (if char (setq char (downcase char))) | |
653 (cond | |
654 ((setq elt (rassq char alist)) | |
655 (message "%s%s" p (car elt)) | |
656 (setq p (cdr elt))) | |
64832
103e161cb74f
(sc-ask, sc-no-blank-line-or-header): Avoid warnings.
Richard M. Stallman <rms@gnu.org>
parents:
64754
diff
changeset
|
657 ((if (fboundp 'button-release-event-p) |
103e161cb74f
(sc-ask, sc-no-blank-line-or-header): Avoid warnings.
Richard M. Stallman <rms@gnu.org>
parents:
64754
diff
changeset
|
658 (button-release-event-p event)) ; ignore them |
4850 | 659 nil) |
660 (t | |
661 (message "%s%s" p (single-key-description event)) | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
662 (if (featurep 'xemacs) |
4850 | 663 (ding nil 'y-or-n-p) |
664 (ding)) | |
665 (discard-input) | |
666 (if (eq p prompt) | |
667 (setq p (concat "Try again. " prompt))))))) | |
64832
103e161cb74f
(sc-ask, sc-no-blank-line-or-header): Avoid warnings.
Richard M. Stallman <rms@gnu.org>
parents:
64754
diff
changeset
|
668 (if (fboundp 'deallocate-event) |
103e161cb74f
(sc-ask, sc-no-blank-line-or-header): Avoid warnings.
Richard M. Stallman <rms@gnu.org>
parents:
64754
diff
changeset
|
669 (deallocate-event event)) |
4850 | 670 p)) |
671 | |
672 (defun sc-scan-info-alist (alist) | |
673 "Find a match in the info alist that matches a regexp in ALIST." | |
674 (let ((sc-mumble "") | |
675 rtnvalue) | |
676 (while alist | |
677 (let* ((elem (car alist)) | |
678 (infokey (car elem)) | |
679 (infoval (sc-mail-field infokey)) | |
680 (mlist (car (cdr elem)))) | |
681 (while mlist | |
682 (let* ((ml-elem (car mlist)) | |
683 (regexp (car ml-elem)) | |
684 (thing (cdr ml-elem))) | |
685 (if (string-match regexp infoval) | |
686 ;; we found a match, time to return | |
24613
83a507b08fe1
(sc-scan-info-alist): Revert last change.
Dave Love <fx@gnu.org>
parents:
24612
diff
changeset
|
687 (setq rtnvalue thing |
4850 | 688 mlist nil |
689 alist nil) | |
690 ;; else we didn't find a match | |
691 (setq mlist (cdr mlist)) | |
692 ))) ;end of mlist loop | |
693 (setq alist (cdr alist)) | |
694 )) ;end of alist loop | |
695 rtnvalue)) | |
696 | |
697 | |
698 ;; ====================================================================== | |
699 ;; extract mail field information from headers in reply buffer | |
700 | |
701 ;; holder variables for bc happiness | |
702 (defvar sc-mail-headers-start nil | |
703 "Start of header fields.") | |
704 (defvar sc-mail-headers-end nil | |
705 "End of header fields.") | |
706 (defvar sc-mail-field-history nil | |
707 "For minibuffer completion on mail field queries.") | |
708 (defvar sc-mail-field-modification-history nil | |
709 "For minibuffer completion on mail field modifications.") | |
710 (defvar sc-mail-glom-frame | |
711 '((begin (setq sc-mail-headers-start (point))) | |
712 ("^x-attribution:[ \t]+.*$" (sc-mail-fetch-field t) nil t) | |
713 ("^\\S +:.*$" (sc-mail-fetch-field) nil t) | |
714 ("^$" (list 'abort '(step . 0))) | |
715 ("^[ \t]+" (sc-mail-append-field)) | |
716 (sc-mail-warn-if-non-rfc822-p (sc-mail-error-in-mail-field)) | |
717 (end (setq sc-mail-headers-end (point)))) | |
718 "Regi frame for glomming mail header information.") | |
63056
095901aead41
(sc-mail-glom-frame): Mark as risky.
Richard M. Stallman <rms@gnu.org>
parents:
62924
diff
changeset
|
719 (put 'sc-mail-glom-frame 'risky-local-variable t) |
4850 | 720 |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
721 (defvar curline) ; dynamic bondage |
28437 | 722 |
4850 | 723 ;; regi functions |
724 (defun sc-mail-fetch-field (&optional attribs-p) | |
725 "Insert a key and value into `sc-mail-info' alist. | |
726 If optional ATTRIBS-P is non-nil, the key/value pair is placed in | |
727 `sc-attributions' too." | |
728 (if (string-match "^\\(\\S *\\)\\s *:\\s +\\(.*\\)$" curline) | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
729 (let* ((key (downcase (match-string-no-properties 1 curline))) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
730 (val (match-string-no-properties 2 curline)) |
4850 | 731 (keyval (cons key val))) |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
732 (push keyval sc-mail-info) |
4850 | 733 (if attribs-p |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
734 (push keyval sc-attributions)))) |
4850 | 735 nil) |
736 | |
737 (defun sc-mail-append-field () | |
738 "Append a continuation line onto the last fetched mail field's info." | |
739 (let ((keyval (car sc-mail-info))) | |
740 (if (and keyval (string-match "^\\s *\\(.*\\)$" curline)) | |
11556
a83ee7a1e0fd
Made sc-string-text to strip of text properties of buffer text, so string
Simon Marshall <simon@gnu.org>
parents:
9845
diff
changeset
|
741 (setcdr keyval (concat (cdr keyval) " " |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
742 (match-string-no-properties 1 curline))))) |
4850 | 743 nil) |
744 | |
745 (defun sc-mail-error-in-mail-field () | |
746 "Issue warning that mail headers don't conform to RFC 822." | |
747 (let* ((len (min (length curline) 10)) | |
748 (ellipsis (if (< len (length curline)) "..." "")) | |
749 (msg "Mail header \"%s%s\" doesn't conform to RFC 822. skipping...")) | |
750 (message msg (substring curline 0 len) ellipsis)) | |
751 (beep) | |
752 (sit-for 2) | |
753 nil) | |
754 | |
755 ;; mail header nuking | |
756 (defvar sc-mail-last-header-nuked-p nil | |
757 "True if the last header was nuked.") | |
758 | |
759 (defun sc-mail-nuke-line () | |
760 "Nuke the current mail header line." | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
761 (delete-region (line-beginning-position) (line-beginning-position 2)) |
4850 | 762 '((step . -1))) |
763 | |
764 (defun sc-mail-nuke-header-line () | |
765 "Delete current-line and set up for possible continuation." | |
766 (setq sc-mail-last-header-nuked-p t) | |
767 (sc-mail-nuke-line)) | |
768 | |
769 (defun sc-mail-nuke-continuation-line () | |
770 "Delete a continuation line if the last header line was deleted." | |
771 (if sc-mail-last-header-nuked-p | |
772 (sc-mail-nuke-line))) | |
773 | |
774 (defun sc-mail-cleanup-blank-lines () | |
775 "Leave some blank lines after original mail headers are nuked. | |
776 The number of lines left is specified by `sc-blank-lines-after-headers'." | |
777 (if sc-blank-lines-after-headers | |
778 (save-restriction | |
779 (widen) | |
780 (skip-chars-backward " \t\n") | |
781 (forward-line 1) | |
782 (delete-blank-lines) | |
783 (beginning-of-line) | |
784 (if (looking-at "[ \t]*$") | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
785 (delete-region (line-beginning-position) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
786 (line-beginning-position 2))) |
4850 | 787 (insert-char ?\n sc-blank-lines-after-headers))) |
788 nil) | |
789 | |
790 (defun sc-mail-build-nuke-frame () | |
791 "Build the regiframe for nuking mail headers." | |
792 (let (every-func entry-func nonentry-func) | |
793 (cond | |
794 ((eq sc-nuke-mail-headers 'all) | |
795 (setq every-func '(progn (forward-line -1) (sc-mail-nuke-line)))) | |
796 ((eq sc-nuke-mail-headers 'specified) | |
797 (setq entry-func '(sc-mail-nuke-header-line) | |
798 nonentry-func '(setq sc-mail-last-header-nuked-p nil))) | |
799 ((eq sc-nuke-mail-headers 'keep) | |
800 (setq entry-func '(setq sc-mail-last-header-nuked-p nil) | |
801 nonentry-func '(sc-mail-nuke-header-line))) | |
802 ;; we never get far enough to interpret a frame if s-n-m-h == 'none | |
803 ((eq sc-nuke-mail-headers 'none)) | |
60916
480134f8cd16
* mail/supercite.el: Replace `illegal' with `invalid'.
Werner LEMBERG <wl@gnu.org>
parents:
58952
diff
changeset
|
804 (t (error "Invalid value for sc-nuke-mail-headers: %s" |
4850 | 805 sc-nuke-mail-headers)) |
806 ) ; end-cond | |
807 (append | |
808 (and entry-func | |
809 (regi-mapcar sc-nuke-mail-header-list entry-func nil t)) | |
810 (and nonentry-func (list (list "^\\S +:.*$" nonentry-func))) | |
811 (and (not every-func) | |
812 '(("^[ \t]+" (sc-mail-nuke-continuation-line)))) | |
813 '((begin (setq sc-mail-last-header-zapped-p nil))) | |
814 '((end (sc-mail-cleanup-blank-lines))) | |
815 (and every-func (list (list 'every every-func))) | |
816 ))) | |
817 | |
818 ;; mail processing and zapping. this is the top level entry defun to | |
819 ;; all header processing. | |
820 (defun sc-mail-process-headers (start end) | |
821 "Process original mail message's mail headers. | |
822 After processing, mail headers may be nuked. Header information is | |
823 stored in `sc-mail-info', and any old information is lost unless an | |
824 error occurs." | |
825 (interactive "r") | |
826 (let ((info (copy-alist sc-mail-info)) | |
827 (attribs (copy-alist sc-attributions))) | |
828 (setq sc-mail-info nil | |
829 sc-attributions nil) | |
830 (regi-interpret sc-mail-glom-frame start end) | |
831 (if (null sc-mail-info) | |
832 (progn | |
833 (message "No mail headers found! Restoring old information.") | |
834 (setq sc-mail-info info | |
835 sc-attributions attribs)) | |
836 (regi-interpret (sc-mail-build-nuke-frame) | |
837 sc-mail-headers-start sc-mail-headers-end) | |
838 ))) | |
839 | |
840 | |
841 ;; let the user change mail field information | |
842 (defun sc-mail-field (field) | |
843 "Return the mail header field value associated with FIELD. | |
844 If there was no mail header with FIELD as its key, return the value of | |
845 `sc-mumble'. FIELD is case insensitive." | |
61044
17207b620cf3
(sc-mail-field): Use assoc-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60924
diff
changeset
|
846 (or (cdr (assoc-string field sc-mail-info 'case-fold)) sc-mumble)) |
4850 | 847 |
848 (defun sc-mail-field-query (arg) | |
849 "View the value of a mail field. | |
850 With `\\[universal-argument]', prompts for action on mail field. | |
851 Action can be one of: View, Modify, Add, or Delete." | |
852 (interactive "P") | |
853 (let* ((alist '(("view" . ?v) ("modify" . ?m) ("add" . ?a) ("delete" . ?d))) | |
854 (action (if (not arg) ?v (sc-ask alist))) | |
855 key) | |
856 (if (not action) | |
857 () | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
858 (setq key (completing-read |
4850 | 859 (concat (car (rassq action alist)) |
860 " information key: ") | |
861 sc-mail-info nil | |
862 (if (eq action ?a) nil 'noexit) | |
863 nil 'sc-mail-field-history)) | |
864 (cond | |
865 ((eq action ?v) | |
866 (message "%s: %s" key (cdr (assoc key sc-mail-info)))) | |
867 ((eq action ?d) | |
868 (setq sc-mail-info (delq (assoc key sc-mail-info) sc-mail-info))) | |
869 ((eq action ?m) | |
870 (let ((keyval (assoc key sc-mail-info))) | |
871 ;; first put initial value onto list if not already there | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
872 (if (not (member (cdr keyval) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
873 sc-mail-field-modification-history)) |
4850 | 874 (setq sc-mail-field-modification-history |
875 (cons (cdr keyval) sc-mail-field-modification-history))) | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
876 (setcdr keyval (read-string |
4850 | 877 (concat key ": ") (cdr keyval) |
878 'sc-mail-field-modification-history)))) | |
879 ((eq action ?a) | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
880 (push (cons key (read-string (concat key ": "))) sc-mail-info)) |
4850 | 881 )))) |
882 | |
883 | |
884 ;; ====================================================================== | |
885 ;; attributions | |
886 | |
887 (defvar sc-attribution-confirmation-history nil | |
888 "History for confirmation of attribution strings.") | |
889 (defvar sc-citation-confirmation-history nil | |
890 "History for confirmation of attribution prefixes.") | |
891 | |
892 (defun sc-attribs-%@-addresses (from &optional delim) | |
893 "Extract the author's email terminus from email address FROM. | |
894 Match addresses of the style ``name%[stuff].'' when called with DELIM | |
895 of \"%\" and addresses of the style ``[stuff]name@[stuff]'' when | |
896 called with DELIM \"@\". If DELIM is nil or not provided, matches | |
897 addresses of the style ``name''." | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
898 (and (string-match (concat "[-[:alnum:]_.]+" delim) from 0) |
4850 | 899 (substring from |
900 (match-beginning 0) | |
901 (- (match-end 0) (if (null delim) 0 1))))) | |
902 | |
903 (defun sc-attribs-!-addresses (from) | |
904 "Extract the author's email terminus from email address FROM. | |
905 Match addresses of the style ``[stuff]![stuff]...!name[stuff].''" | |
906 (let ((eos (length from)) | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
907 (mstart (string-match "![-[:alnum:]_.]+\\([^-![:alnum:]_.]\\|$\\)" |
4850 | 908 from 0)) |
909 (mend (match-end 0))) | |
910 (and mstart | |
911 (substring from (1+ mstart) (- mend (if (= mend eos) 0 1))) | |
912 ))) | |
913 | |
914 (defun sc-attribs-<>-addresses (from) | |
915 "Extract the author's email terminus from email address FROM. | |
916 Match addresses of the style ``<name[stuff]>.''" | |
917 (and (string-match "<\\(.*\\)>" from) | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
918 (match-string 1 from))) |
4850 | 919 |
920 (defun sc-get-address (from author) | |
921 "Get the full email address path from FROM. | |
922 AUTHOR is the author's name (which is removed from the address)." | |
923 (let ((eos (length from))) | |
61044
17207b620cf3
(sc-mail-field): Use assoc-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60924
diff
changeset
|
924 (if (string-match (concat "\\`\"?" (regexp-quote author) |
17207b620cf3
(sc-mail-field): Use assoc-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60924
diff
changeset
|
925 "\"?\\s +") from 0) |
4850 | 926 (let ((address (substring from (match-end 0) eos))) |
927 (if (and (= (aref address 0) ?<) | |
928 (= (aref address (1- (length address))) ?>)) | |
929 (substring address 1 (1- (length address))) | |
930 address)) | |
28437 | 931 (if (string-match "[-[:alnum:]!@%._]+" from 0) |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
932 (match-string 0 from) |
4850 | 933 "") |
934 ))) | |
935 | |
936 (defun sc-attribs-emailname (from) | |
937 "Get the email terminus name from FROM." | |
938 (or | |
939 (sc-attribs-%@-addresses from "%") | |
940 (sc-attribs-%@-addresses from "@") | |
941 (sc-attribs-!-addresses from) | |
942 (sc-attribs-<>-addresses from) | |
943 (sc-attribs-%@-addresses from) | |
944 (substring from 0 10))) | |
945 | |
946 (defun sc-name-substring (string start end extend) | |
947 "Extract the specified substring of STRING from START to END. | |
948 EXTEND is the number of characters on each side to extend the | |
949 substring." | |
950 (and start | |
951 (let ((sos (+ start extend)) | |
952 (eos (- end extend))) | |
953 (substring string sos | |
954 (or (string-match sc-titlecue-regexp string sos) eos) | |
955 )))) | |
956 | |
957 (defun sc-attribs-extract-namestring (from) | |
958 "Extract the name string from FROM. | |
959 This should be the author's full name minus an optional title." | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
960 ;; FIXME: we probably should use mail-extract-address-components. |
4850 | 961 (let ((namestring |
962 (or | |
12859
90c22a02c12b
(sc-attribs-extract-namestring): If name has <...>,
Richard M. Stallman <rms@gnu.org>
parents:
12425
diff
changeset
|
963 ;; If there is a <...> in the name, |
90c22a02c12b
(sc-attribs-extract-namestring): If name has <...>,
Richard M. Stallman <rms@gnu.org>
parents:
12425
diff
changeset
|
964 ;; treat everything before that as the full name. |
90c22a02c12b
(sc-attribs-extract-namestring): If name has <...>,
Richard M. Stallman <rms@gnu.org>
parents:
12425
diff
changeset
|
965 ;; Even if it contains parens, use the whole thing. |
13813
7d18fdd1acf4
(sc-attribs-extract-namestring): Do look for
Karl Heuer <kwzh@gnu.org>
parents:
12859
diff
changeset
|
966 ;; On the other hand, we do look for quotes in the usual way. |
12859
90c22a02c12b
(sc-attribs-extract-namestring): If name has <...>,
Richard M. Stallman <rms@gnu.org>
parents:
12425
diff
changeset
|
967 (and (string-match " *<.*>" from 0) |
13813
7d18fdd1acf4
(sc-attribs-extract-namestring): Do look for
Karl Heuer <kwzh@gnu.org>
parents:
12859
diff
changeset
|
968 (let ((before-angles |
7d18fdd1acf4
(sc-attribs-extract-namestring): Do look for
Karl Heuer <kwzh@gnu.org>
parents:
12859
diff
changeset
|
969 (sc-name-substring from 0 (match-beginning 0) 0))) |
7d18fdd1acf4
(sc-attribs-extract-namestring): Do look for
Karl Heuer <kwzh@gnu.org>
parents:
12859
diff
changeset
|
970 (if (string-match "\".*\"" before-angles 0) |
7d18fdd1acf4
(sc-attribs-extract-namestring): Do look for
Karl Heuer <kwzh@gnu.org>
parents:
12859
diff
changeset
|
971 (sc-name-substring |
7d18fdd1acf4
(sc-attribs-extract-namestring): Do look for
Karl Heuer <kwzh@gnu.org>
parents:
12859
diff
changeset
|
972 before-angles (match-beginning 0) (match-end 0) 1) |
7d18fdd1acf4
(sc-attribs-extract-namestring): Do look for
Karl Heuer <kwzh@gnu.org>
parents:
12859
diff
changeset
|
973 before-angles))) |
4850 | 974 (sc-name-substring |
975 from (string-match "(.*)" from 0) (match-end 0) 1) | |
976 (sc-name-substring | |
977 from (string-match "\".*\"" from 0) (match-end 0) 1) | |
978 (sc-name-substring | |
28437 | 979 from (string-match "\\([-.[:alnum:]_]+\\s +\\)+<" from 0) |
4850 | 980 (match-end 1) 0) |
981 (sc-attribs-emailname from)))) | |
982 ;; strip off any leading or trailing whitespace | |
983 (if namestring | |
984 (let ((bos 0) | |
985 (eos (1- (length namestring)))) | |
986 (while (and (<= bos eos) | |
987 (memq (aref namestring bos) '(32 ?\t))) | |
988 (setq bos (1+ bos))) | |
989 (while (and (> eos bos) | |
990 (memq (aref namestring eos) '(32 ?\t))) | |
991 (setq eos (1- eos))) | |
992 (substring namestring bos (1+ eos)))))) | |
993 | |
994 (defun sc-attribs-chop-namestring (namestring) | |
995 "Convert NAMESTRING to a list of names. | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
996 example: (sc-attribs-chop-namestring \"John Xavier Doe\") |
4850 | 997 => (\"John\" \"Xavier\" \"Doe\")" |
998 (if (string-match "\\([ \t]*\\)\\([^ \t._]+\\)\\([ \t]*\\)" namestring) | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
999 (cons (match-string 2 namestring) |
4850 | 1000 (sc-attribs-chop-namestring (substring namestring (match-end 3))) |
1001 ))) | |
1002 | |
1003 (defun sc-attribs-strip-initials (namelist) | |
1004 "Extract the author's initials from the NAMELIST." | |
1005 (mapconcat | |
1006 (function | |
1007 (lambda (name) | |
1008 (if (< 0 (length name)) | |
1009 (substring name 0 1)))) | |
1010 namelist "")) | |
1011 | |
1012 (defun sc-guess-attribution (&optional string) | |
1013 "Guess attribution string on current line. | |
1014 If attribution cannot be guessed, nil is returned. Optional STRING if | |
1015 supplied, is used instead of the line point is on in the current buffer." | |
1016 (let ((start 0) | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1017 (string (or string (buffer-substring (line-beginning-position) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1018 (line-end-position)))) |
4850 | 1019 attribution) |
1020 (and | |
1021 (= start (or (string-match sc-citation-leader-regexp string start) -1)) | |
1022 (setq start (match-end 0)) | |
1023 (= start (or (string-match sc-citation-root-regexp string start) 1)) | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1024 (setq attribution (match-string 0 string) |
4850 | 1025 start (match-end 0)) |
1026 (= start (or (string-match sc-citation-delimiter-regexp string start) -1)) | |
1027 (setq start (match-end 0)) | |
1028 (= start (or (string-match sc-citation-separator-regexp string start) -1)) | |
1029 attribution))) | |
1030 | |
1031 (defun sc-attribs-filter-namelist (namelist) | |
1032 "Filter out noise in NAMELIST according to `sc-name-filter-alist'." | |
1033 (let ((elements (length namelist)) | |
1034 (position -1) | |
1035 keepers filtered-list) | |
84957
ac461e78456b
(sc-attribs-filter-namelist): Use mapc rather than mapcar.
Glenn Morris <rgm@gnu.org>
parents:
78232
diff
changeset
|
1036 (mapc |
4850 | 1037 (function |
1038 (lambda (name) | |
1039 (setq position (1+ position)) | |
1040 (let ((keep-p t)) | |
84957
ac461e78456b
(sc-attribs-filter-namelist): Use mapc rather than mapcar.
Glenn Morris <rgm@gnu.org>
parents:
78232
diff
changeset
|
1041 (mapc |
4850 | 1042 (function |
1043 (lambda (filter) | |
1044 (let ((regexp (car filter)) | |
1045 (pos (cdr filter))) | |
1046 (if (and (string-match regexp name) | |
1047 (or (and (numberp pos) | |
1048 (= pos position)) | |
1049 (and (eq pos 'last) | |
1050 (= position (1- elements))) | |
1051 (eq pos 'any))) | |
1052 (setq keep-p nil)) | |
1053 ))) | |
1054 sc-name-filter-alist) | |
1055 (if keep-p | |
1056 (setq keepers (cons position keepers))) | |
1057 ))) | |
1058 namelist) | |
84957
ac461e78456b
(sc-attribs-filter-namelist): Use mapc rather than mapcar.
Glenn Morris <rgm@gnu.org>
parents:
78232
diff
changeset
|
1059 (mapc |
4850 | 1060 (function |
1061 (lambda (position) | |
1062 (setq filtered-list (cons (nth position namelist) filtered-list)) | |
1063 )) | |
1064 keepers) | |
1065 filtered-list)) | |
1066 | |
1067 (defun sc-attribs-chop-address (from) | |
1068 "Extract attribution information from FROM. | |
1069 This populates the `sc-attributions' with the list of possible attributions." | |
1070 (if (and (stringp from) | |
1071 (< 0 (length from))) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
43791
diff
changeset
|
1072 (let* ((sc-mumble "") |
4850 | 1073 (namestring (sc-attribs-extract-namestring from)) |
1074 (namelist (sc-attribs-filter-namelist | |
1075 (sc-attribs-chop-namestring namestring))) | |
1076 (revnames (reverse (cdr namelist))) | |
1077 (firstname (car namelist)) | |
1078 (midnames (reverse (cdr revnames))) | |
1079 (lastname (car revnames)) | |
1080 (initials (sc-attribs-strip-initials namelist)) | |
1081 (emailname (sc-attribs-emailname from)) | |
1082 (n 1) | |
1083 author middlenames) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
43791
diff
changeset
|
1084 |
4850 | 1085 ;; put basic information |
1086 (setq | |
1087 ;; put middle names and build sc-author entry | |
1088 middlenames (mapconcat | |
1089 (function | |
1090 (lambda (midname) | |
1091 (let ((key-attribs (format "middlename-%d" n)) | |
1092 (key-mail (format "sc-middlename-%d" n))) | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1093 (push (cons key-attribs midname) sc-attributions) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1094 (push (cons key-mail midname) sc-mail-info) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1095 (setq n (1+ n)) |
4850 | 1096 midname))) |
1097 midnames " ") | |
1098 | |
1099 author (concat firstname " " middlenames (and midnames " ") lastname) | |
1100 | |
1101 sc-attributions (append | |
1102 (list | |
1103 (cons "firstname" firstname) | |
1104 (cons "lastname" lastname) | |
1105 (cons "emailname" emailname) | |
1106 (cons "initials" initials)) | |
1107 sc-attributions) | |
1108 sc-mail-info (append | |
1109 (list | |
1110 (cons "sc-firstname" firstname) | |
1111 (cons "sc-middlenames" middlenames) | |
1112 (cons "sc-lastname" lastname) | |
1113 (cons "sc-emailname" emailname) | |
1114 (cons "sc-initials" initials) | |
1115 (cons "sc-author" author) | |
1116 (cons "sc-from-address" (sc-get-address | |
1117 (sc-mail-field "from") | |
1118 namestring)) | |
1119 (cons "sc-reply-address" (sc-get-address | |
1120 (sc-mail-field "reply-to") | |
1121 namestring)) | |
1122 (cons "sc-sender-address" (sc-get-address | |
1123 (sc-mail-field "sender") | |
1124 namestring)) | |
1125 ) | |
1126 sc-mail-info) | |
1127 )) | |
1128 ;; from string is empty | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1129 (push (cons "sc-author" sc-default-author-name) sc-mail-info))) |
4850 | 1130 |
1131 (defvar sc-attrib-or-cite nil | |
1132 "Used to toggle between attribution input or citation input.") | |
1133 | |
1134 (defun sc-toggle-fn () | |
1135 "Toggle between attribution selection and citation selection. | |
1136 Only used during confirmation." | |
1137 (interactive) | |
1138 (setq sc-attrib-or-cite (not sc-attrib-or-cite)) | |
1139 (throw 'sc-reconfirm t)) | |
1140 | |
1141 (defun sc-select-attribution () | |
1142 "Select an attribution from `sc-attributions'. | |
1143 | |
1144 Variables involved in selection process include: | |
1145 `sc-preferred-attribution-list' | |
1146 `sc-use-only-preference-p' | |
1147 `sc-confirm-always-p' | |
1148 `sc-default-attribution' | |
1149 `sc-attrib-selection-list'. | |
1150 | |
1151 Runs the hook `sc-attribs-preselect-hook' before selecting an | |
1152 attribution and the hook `sc-attribs-postselect-hook' after making the | |
1153 selection but before querying is performed. During | |
1154 `sc-attribs-postselect-hook' the variable `citation' is bound to the | |
1155 auto-selected citation string and the variable `attribution' is bound | |
1156 to the auto-selected attribution string." | |
1157 (run-hooks 'sc-attribs-preselect-hook) | |
1158 (let ((query-p sc-confirm-always-p) | |
1159 attribution citation | |
1160 (attriblist sc-preferred-attribution-list)) | |
1161 | |
1162 ;; first cruise through sc-preferred-attribution-list looking for | |
1163 ;; a match in either sc-attributions or sc-mail-info. if the | |
1164 ;; element is "sc-consult", then we have to do the alist | |
1165 ;; consultation phase | |
1166 (while attriblist | |
1167 (let* ((preferred (car attriblist))) | |
1168 (cond | |
1169 ((string= preferred "sc-consult") | |
1170 ;; we've been told to consult the attribution vs. mail | |
1171 ;; header key alist. we do this until we find a match in | |
1172 ;; the sc-attrib-selection-list. if we do not find a match, | |
1173 ;; we continue scanning attriblist | |
1174 (let ((attrib (sc-scan-info-alist sc-attrib-selection-list))) | |
1175 (cond | |
1176 ((not attrib) | |
1177 (setq attriblist (cdr attriblist))) | |
1178 ((stringp attrib) | |
1179 (setq attribution attrib | |
1180 attriblist nil)) | |
1181 ((listp attrib) | |
62903
9cca67e822b5
(sc-select-attribution): Only use a list element from
Glenn Morris <rgm@gnu.org>
parents:
62765
diff
changeset
|
1182 (setq attribution (eval attrib)) |
9cca67e822b5
(sc-select-attribution): Only use a list element from
Glenn Morris <rgm@gnu.org>
parents:
62765
diff
changeset
|
1183 (if (stringp attribution) |
9cca67e822b5
(sc-select-attribution): Only use a list element from
Glenn Morris <rgm@gnu.org>
parents:
62765
diff
changeset
|
1184 (setq attriblist nil) |
9cca67e822b5
(sc-select-attribution): Only use a list element from
Glenn Morris <rgm@gnu.org>
parents:
62765
diff
changeset
|
1185 (setq attribution nil |
9cca67e822b5
(sc-select-attribution): Only use a list element from
Glenn Morris <rgm@gnu.org>
parents:
62765
diff
changeset
|
1186 attriblist (cdr attriblist)))) |
4850 | 1187 (t (error "%s did not evaluate to a string or list!" |
1188 "sc-attrib-selection-list")) | |
1189 ))) | |
1190 ((setq attribution (cdr (assoc preferred sc-attributions))) | |
1191 (setq attriblist nil)) | |
1192 (t | |
1193 (setq attriblist (cdr attriblist))) | |
1194 ))) | |
1195 | |
1196 ;; if preference was not found, we may use a secondary method to | |
1197 ;; find a valid attribution | |
1198 (if (and (not attribution) | |
1199 (not sc-use-only-preference-p)) | |
1200 ;; secondary method tries to find a preference in this order | |
1201 ;; 1. sc-lastchoice | |
1202 ;; 2. x-attribution | |
1203 ;; 3. firstname | |
1204 ;; 4. lastname | |
1205 ;; 5. initials | |
1206 ;; 6. first non-empty attribution in alist | |
1207 (setq attribution | |
1208 (or (cdr (assoc "sc-lastchoice" sc-attributions)) | |
1209 (cdr (assoc "x-attribution" sc-attributions)) | |
1210 (cdr (assoc "firstname" sc-attributions)) | |
1211 (cdr (assoc "lastname" sc-attributions)) | |
1212 (cdr (assoc "initials" sc-attributions)) | |
1213 (cdr (car sc-attributions))))) | |
1214 | |
1215 ;; still couldn't find an attribution. we're now limited to using | |
1216 ;; the default attribution, but we'll force a query when this happens | |
1217 (if (not attribution) | |
1218 (setq attribution sc-default-attribution | |
1219 query-p t)) | |
1220 | |
1221 ;; create the attribution prefix | |
1222 (setq citation (sc-make-citation attribution)) | |
1223 | |
1224 ;; run the post selection hook before querying the user | |
1225 (run-hooks 'sc-attribs-postselect-hook) | |
1226 | |
1227 ;; query for confirmation | |
1228 (if query-p | |
1229 (let* ((query-alist (mapcar (function (lambda (entry) | |
1230 (list (cdr entry)))) | |
1231 sc-attributions)) | |
1232 (minibuffer-local-completion-map | |
1233 sc-minibuffer-local-completion-map) | |
1234 (minibuffer-local-map sc-minibuffer-local-map) | |
1235 (initial attribution) | |
1236 (completer-disable t) ; in case completer.el is used | |
1237 choice) | |
1238 (setq sc-attrib-or-cite nil) ; nil==attribution, t==citation | |
1239 (while | |
1240 (catch 'sc-reconfirm | |
43791
2e05b93ba14a
(sc-select-attribution): Accept whatever value we get in CHOICE; there
Richard M. Stallman <rms@gnu.org>
parents:
42206
diff
changeset
|
1241 (progn |
2e05b93ba14a
(sc-select-attribution): Accept whatever value we get in CHOICE; there
Richard M. Stallman <rms@gnu.org>
parents:
42206
diff
changeset
|
1242 (setq choice |
2e05b93ba14a
(sc-select-attribution): Accept whatever value we get in CHOICE; there
Richard M. Stallman <rms@gnu.org>
parents:
42206
diff
changeset
|
1243 (if sc-attrib-or-cite |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1244 (read-string |
43791
2e05b93ba14a
(sc-select-attribution): Accept whatever value we get in CHOICE; there
Richard M. Stallman <rms@gnu.org>
parents:
42206
diff
changeset
|
1245 "Enter citation prefix: " |
2e05b93ba14a
(sc-select-attribution): Accept whatever value we get in CHOICE; there
Richard M. Stallman <rms@gnu.org>
parents:
42206
diff
changeset
|
1246 citation |
2e05b93ba14a
(sc-select-attribution): Accept whatever value we get in CHOICE; there
Richard M. Stallman <rms@gnu.org>
parents:
42206
diff
changeset
|
1247 'sc-citation-confirmation-history) |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1248 (completing-read |
43791
2e05b93ba14a
(sc-select-attribution): Accept whatever value we get in CHOICE; there
Richard M. Stallman <rms@gnu.org>
parents:
42206
diff
changeset
|
1249 "Complete attribution name: " |
2e05b93ba14a
(sc-select-attribution): Accept whatever value we get in CHOICE; there
Richard M. Stallman <rms@gnu.org>
parents:
42206
diff
changeset
|
1250 query-alist nil nil |
2e05b93ba14a
(sc-select-attribution): Accept whatever value we get in CHOICE; there
Richard M. Stallman <rms@gnu.org>
parents:
42206
diff
changeset
|
1251 (cons initial 0) |
2e05b93ba14a
(sc-select-attribution): Accept whatever value we get in CHOICE; there
Richard M. Stallman <rms@gnu.org>
parents:
42206
diff
changeset
|
1252 'sc-attribution-confirmation-history) |
2e05b93ba14a
(sc-select-attribution): Accept whatever value we get in CHOICE; there
Richard M. Stallman <rms@gnu.org>
parents:
42206
diff
changeset
|
1253 )) |
2e05b93ba14a
(sc-select-attribution): Accept whatever value we get in CHOICE; there
Richard M. Stallman <rms@gnu.org>
parents:
42206
diff
changeset
|
1254 nil))) |
4850 | 1255 (if sc-attrib-or-cite |
1256 ;; since the citation was chosen, we have to guess at | |
1257 ;; the attribution | |
1258 (setq citation choice | |
1259 attribution (or (sc-guess-attribution citation) | |
1260 citation)) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
43791
diff
changeset
|
1261 |
4850 | 1262 (setq citation (sc-make-citation choice) |
1263 attribution choice)) | |
1264 )) | |
1265 | |
1266 ;; its possible that the user wants to downcase the citation and | |
1267 ;; attribution | |
1268 (if sc-downcase-p | |
1269 (setq citation (downcase citation) | |
1270 attribution (downcase attribution))) | |
1271 | |
1272 ;; set up mail info alist | |
1273 (let* ((ckey "sc-citation") | |
1274 (akey "sc-attribution") | |
1275 (ckeyval (assoc ckey sc-mail-info)) | |
1276 (akeyval (assoc akey sc-mail-info))) | |
1277 (if ckeyval | |
1278 (setcdr ckeyval citation) | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1279 (push (cons ckey citation) sc-mail-info)) |
4850 | 1280 (if akeyval |
1281 (setcdr akeyval attribution) | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1282 (push (cons akey attribution) sc-mail-info))) |
4850 | 1283 |
1284 ;; set the sc-lastchoice attribution | |
1285 (let* ((lkey "sc-lastchoice") | |
1286 (lastchoice (assoc lkey sc-attributions))) | |
1287 (if lastchoice | |
1288 (setcdr lastchoice attribution) | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1289 (push (cons lkey attribution) sc-attributions))) |
4850 | 1290 )) |
1291 | |
1292 | |
1293 ;; ====================================================================== | |
1294 ;; filladapt hooks for supercite 3.1. you shouldn't need anything | |
1295 ;; extra to make gin-mode understand supercited lines. Even this | |
1296 ;; stuff might not be entirely necessary... | |
1297 | |
1298 (defun sc-cite-regexp (&optional root-regexp) | |
1299 "Return a regexp describing a Supercited line. | |
1300 The regexp is the concatenation of `sc-citation-leader-regexp', | |
1301 `sc-citation-root-regexp', `sc-citation-delimiter-regexp', and | |
1302 `sc-citation-separator-regexp'. If optional ROOT-REGEXP is supplied, | |
1303 use it instead of `sc-citation-root-regexp'." | |
1304 (concat sc-citation-leader-regexp | |
1305 (or root-regexp sc-citation-root-regexp) | |
1306 sc-citation-delimiter-regexp | |
1307 sc-citation-separator-regexp)) | |
1308 | |
1309 (defun sc-make-citation (attribution) | |
1310 "Make a non-nested citation from ATTRIBUTION." | |
1311 (concat sc-citation-leader | |
1312 attribution | |
1313 sc-citation-delimiter | |
1314 sc-citation-separator)) | |
1315 | |
63945
eb399d132bf4
(filladapt-prefix-table): Add defvar.
Richard M. Stallman <rms@gnu.org>
parents:
63056
diff
changeset
|
1316 (defvar filladapt-prefix-table) |
eb399d132bf4
(filladapt-prefix-table): Add defvar.
Richard M. Stallman <rms@gnu.org>
parents:
63056
diff
changeset
|
1317 |
4850 | 1318 (defun sc-setup-filladapt () |
1319 "Setup `filladapt-prefix-table' to handle Supercited paragraphs." | |
1320 (let* ((fa-sc-elt 'filladapt-supercite-included-text) | |
1321 (elt (rassq fa-sc-elt filladapt-prefix-table))) | |
1322 (if elt (setcar elt (sc-cite-regexp)) | |
1323 (message "Filladapt doesn't seem to know about Supercite.") | |
1324 (beep)))) | |
1325 | |
1326 | |
1327 ;; ====================================================================== | |
1328 ;; citing and unciting regions of text | |
1329 | |
1330 (defvar sc-fill-begin 1 | |
1331 "Buffer position to begin filling.") | |
1332 (defvar sc-fill-line-prefix "" | |
1333 "Fill prefix of previous line") | |
1334 | |
1335 ;; filling | |
1336 (defun sc-fill-if-different (&optional prefix) | |
1337 "Fill the region bounded by `sc-fill-begin' and point. | |
1338 Only fill if optional PREFIX is different than `sc-fill-line-prefix'. | |
1339 If `sc-auto-fill-region-p' is nil, do not fill region. If PREFIX is | |
1340 not supplied, initialize fill variables. This is useful for a regi | |
1341 `begin' frame-entry." | |
1342 (if (not prefix) | |
1343 (setq sc-fill-line-prefix "" | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1344 sc-fill-begin (line-beginning-position)) |
4850 | 1345 (if (and sc-auto-fill-region-p |
1346 (not (string= prefix sc-fill-line-prefix))) | |
1347 (let ((fill-prefix sc-fill-line-prefix)) | |
1348 (if (not (string= fill-prefix "")) | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1349 (fill-region sc-fill-begin (line-beginning-position))) |
4850 | 1350 (setq sc-fill-line-prefix prefix |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1351 sc-fill-begin (line-beginning-position)))) |
4850 | 1352 ) |
1353 nil) | |
1354 | |
1355 (defun sc-cite-coerce-cited-line () | |
1356 "Coerce a Supercited line to look like our style." | |
1357 (let* ((attribution (sc-guess-attribution)) | |
1358 (regexp (sc-cite-regexp attribution)) | |
1359 (prefix (sc-make-citation attribution))) | |
1360 (if (and attribution | |
1361 (looking-at regexp)) | |
1362 (progn | |
1363 (delete-region | |
1364 (match-beginning 0) | |
1365 (save-excursion | |
1366 (goto-char (match-end 0)) | |
1367 (if (bolp) (forward-char -1)) | |
1368 (point))) | |
1369 (insert prefix) | |
1370 (sc-fill-if-different prefix))) | |
1371 nil)) | |
1372 | |
1373 (defun sc-cite-coerce-dumb-citer () | |
1374 "Coerce a non-nested citation that's been cited with a dumb nesting citer." | |
1375 (delete-region (match-beginning 1) (match-end 1)) | |
1376 (beginning-of-line) | |
1377 (sc-cite-coerce-cited-line)) | |
1378 | |
1379 (defun sc-guess-nesting (&optional string) | |
1380 "Guess the citation nesting on the current line. | |
1381 If nesting cannot be guessed, nil is returned. Optional STRING if | |
1382 supplied, is used instead of the line point is on in the current | |
1383 buffer." | |
1384 (let ((start 0) | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1385 (string (or string (buffer-substring (line-beginning-position) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1386 (line-end-position)))) |
4850 | 1387 nesting) |
1388 (and | |
1389 (= start (or (string-match sc-citation-leader-regexp string start) -1)) | |
1390 (setq start (match-end 0)) | |
1391 (= start (or (string-match sc-citation-delimiter-regexp string start) -1)) | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1392 (setq nesting (match-string 0 string) |
4850 | 1393 start (match-end 0)) |
1394 (= start (or (string-match sc-citation-separator-regexp string start) -1)) | |
1395 nesting))) | |
1396 | |
1397 (defun sc-add-citation-level () | |
14007
c6476f4bb121
(sc-citation-nonnested-root-regexp,
Karl Heuer <kwzh@gnu.org>
parents:
13813
diff
changeset
|
1398 "Add a citation level for nested citation style w/ coercion." |
4850 | 1399 (let* ((nesting (sc-guess-nesting)) |
1400 (citation (make-string (1+ (length nesting)) | |
1401 (string-to-char sc-citation-delimiter))) | |
1402 (prefix (concat sc-citation-leader citation sc-citation-separator))) | |
1403 (if (looking-at (sc-cite-regexp "")) | |
1404 (delete-region (match-beginning 0) (match-end 0))) | |
1405 (insert prefix) | |
1406 (sc-fill-if-different prefix))) | |
1407 | |
1408 (defun sc-cite-line (&optional citation) | |
1409 "Cite a single line of uncited text. | |
1410 Optional CITATION overrides any citation automatically selected." | |
1411 (if sc-fixup-whitespace-p | |
1412 (fixup-whitespace)) | |
1413 (let ((prefix (or citation | |
1414 (cdr (assoc "sc-citation" sc-mail-info)) | |
1415 sc-default-attribution))) | |
1416 (insert prefix) | |
1417 (sc-fill-if-different prefix)) | |
1418 nil) | |
1419 | |
1420 (defun sc-uncite-line () | |
1421 "Remove citation from current line." | |
1422 (let ((cited (looking-at (sc-cite-regexp)))) | |
1423 (if cited | |
1424 (delete-region (match-beginning 0) (match-end 0)))) | |
1425 nil) | |
1426 | |
1427 (defun sc-recite-line (regexp) | |
1428 "Remove citation matching REGEXP from current line and recite line." | |
1429 (let ((cited (looking-at (concat "^" regexp))) | |
1430 (prefix (cdr (assoc "sc-citation" sc-mail-info)))) | |
1431 (if cited | |
1432 (delete-region (match-beginning 0) (match-end 0))) | |
1433 (insert (or prefix sc-default-attribution)) | |
1434 (sc-fill-if-different prefix)) | |
1435 nil) | |
1436 | |
1437 ;; interactive functions | |
57933
59c9a776a021
(sc-cite-region): Don't use interactive-p. Add arg INTERACTIVE.
Richard M. Stallman <rms@gnu.org>
parents:
57160
diff
changeset
|
1438 (defun sc-cite-region (start end &optional confirm-p interactive) |
4850 | 1439 "Cite a region delineated by START and END. |
1440 If optional CONFIRM-P is non-nil, the attribution is confirmed before | |
1441 its use in the citation string. This function first runs | |
57933
59c9a776a021
(sc-cite-region): Don't use interactive-p. Add arg INTERACTIVE.
Richard M. Stallman <rms@gnu.org>
parents:
57160
diff
changeset
|
1442 `sc-pre-cite-hook'. |
59c9a776a021
(sc-cite-region): Don't use interactive-p. Add arg INTERACTIVE.
Richard M. Stallman <rms@gnu.org>
parents:
57160
diff
changeset
|
1443 |
59c9a776a021
(sc-cite-region): Don't use interactive-p. Add arg INTERACTIVE.
Richard M. Stallman <rms@gnu.org>
parents:
57160
diff
changeset
|
1444 When called interactively, the optional arg INTERACTIVE is non-nil, |
59c9a776a021
(sc-cite-region): Don't use interactive-p. Add arg INTERACTIVE.
Richard M. Stallman <rms@gnu.org>
parents:
57160
diff
changeset
|
1445 and that means call `sc-select-attribution' too." |
59c9a776a021
(sc-cite-region): Don't use interactive-p. Add arg INTERACTIVE.
Richard M. Stallman <rms@gnu.org>
parents:
57160
diff
changeset
|
1446 (interactive "r\nP\np") |
4850 | 1447 (undo-boundary) |
58952
5c34e026a96e
(sc-cite-frame-alist): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
58583
diff
changeset
|
1448 (let ((frame (sc-scan-info-alist sc-cite-frame-alist)) |
4850 | 1449 (sc-confirm-always-p (if confirm-p t sc-confirm-always-p))) |
58952
5c34e026a96e
(sc-cite-frame-alist): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
58583
diff
changeset
|
1450 (if (and frame (symbolp frame)) |
5c34e026a96e
(sc-cite-frame-alist): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
58583
diff
changeset
|
1451 (setq frame (symbol-value frame))) |
5c34e026a96e
(sc-cite-frame-alist): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
58583
diff
changeset
|
1452 (or frame (setq frame sc-default-cite-frame)) |
4850 | 1453 (run-hooks 'sc-pre-cite-hook) |
57933
59c9a776a021
(sc-cite-region): Don't use interactive-p. Add arg INTERACTIVE.
Richard M. Stallman <rms@gnu.org>
parents:
57160
diff
changeset
|
1454 (if interactive |
4850 | 1455 (sc-select-attribution)) |
1456 (regi-interpret frame start end))) | |
1457 | |
1458 (defun sc-uncite-region (start end) | |
1459 "Uncite a region delineated by START and END. | |
1460 First runs `sc-pre-uncite-hook'." | |
1461 (interactive "r") | |
1462 (undo-boundary) | |
58952
5c34e026a96e
(sc-cite-frame-alist): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
58583
diff
changeset
|
1463 (let ((frame (sc-scan-info-alist sc-uncite-frame-alist))) |
5c34e026a96e
(sc-cite-frame-alist): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
58583
diff
changeset
|
1464 (if (and frame (symbolp frame)) |
5c34e026a96e
(sc-cite-frame-alist): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
58583
diff
changeset
|
1465 (setq frame (symbol-value frame))) |
5c34e026a96e
(sc-cite-frame-alist): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
58583
diff
changeset
|
1466 (or frame (setq frame sc-default-uncite-frame)) |
4850 | 1467 (run-hooks 'sc-pre-uncite-hook) |
1468 (regi-interpret frame start end))) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
43791
diff
changeset
|
1469 |
4850 | 1470 (defun sc-recite-region (start end) |
1471 "Recite a region delineated by START and END. | |
1472 First runs `sc-pre-recite-hook'." | |
1473 (interactive "r") | |
1474 (let ((sc-confirm-always-p t)) | |
1475 (sc-select-attribution)) | |
1476 (undo-boundary) | |
58952
5c34e026a96e
(sc-cite-frame-alist): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
58583
diff
changeset
|
1477 (let ((frame (sc-scan-info-alist sc-recite-frame-alist))) |
5c34e026a96e
(sc-cite-frame-alist): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
58583
diff
changeset
|
1478 (if (and frame (symbolp frame)) |
5c34e026a96e
(sc-cite-frame-alist): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
58583
diff
changeset
|
1479 (setq frame (symbol-value frame))) |
5c34e026a96e
(sc-cite-frame-alist): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
58583
diff
changeset
|
1480 (or frame (setq frame sc-default-recite-frame)) |
4850 | 1481 (run-hooks 'sc-pre-recite-hook) |
1482 (regi-interpret frame start end))) | |
1483 | |
1484 | |
1485 ;; ====================================================================== | |
1486 ;; building headers | |
1487 | |
1488 (defun sc-hdr (prefix field &optional sep return-nil-p) | |
1489 "Returns a concatenation of PREFIX and FIELD. | |
1490 If FIELD is not a string or is the empty string, the empty string will | |
1491 be returned. Optional third argument SEP is concatenated on the end if | |
1492 it is a string. Returns empty string, unless optional RETURN-NIL-P is | |
1493 non-nil." | |
1494 (if (and (stringp field) | |
1495 (not (string= field ""))) | |
1496 (concat prefix field (or sep "")) | |
1497 (and (not return-nil-p) ""))) | |
1498 | |
1499 (defun sc-whofrom () | |
1500 "Return the value of (sc-mail-field \"from\") or nil." | |
1501 (let ((sc-mumble nil)) | |
1502 (sc-mail-field "from"))) | |
1503 | |
1504 (defun sc-no-header () | |
1505 "Does nothing. Use this instead of nil to get a blank header." | |
1506 ()) | |
1507 | |
1508 (defun sc-no-blank-line-or-header() | |
14007
c6476f4bb121
(sc-citation-nonnested-root-regexp,
Karl Heuer <kwzh@gnu.org>
parents:
13813
diff
changeset
|
1509 "Similar to `sc-no-header' except it removes the preceding blank line." |
4850 | 1510 (if (not (bobp)) |
1511 (if (and (eolp) | |
1512 (progn (forward-line -1) | |
21861 | 1513 (or (= (point) (mail-header-end)) |
4850 | 1514 (and (eq major-mode 'mh-letter-mode) |
64832
103e161cb74f
(sc-ask, sc-no-blank-line-or-header): Avoid warnings.
Richard M. Stallman <rms@gnu.org>
parents:
64754
diff
changeset
|
1515 (with-no-warnings |
103e161cb74f
(sc-ask, sc-no-blank-line-or-header): Avoid warnings.
Richard M. Stallman <rms@gnu.org>
parents:
64754
diff
changeset
|
1516 (mh-in-header-p)))))) |
4850 | 1517 (progn (forward-line) |
1518 (let ((kill-lines-magic t)) | |
1519 (kill-line)))))) | |
1520 | |
1521 (defun sc-header-on-said () | |
1522 "\"On <date>, <from> said:\" unless: | |
1523 1. the \"from\" field cannot be found, in which case nothing is inserted; | |
1524 2. the \"date\" field is missing in which case only the from part is printed." | |
1525 (let ((sc-mumble "") | |
1526 (whofrom (sc-whofrom))) | |
1527 (if whofrom | |
1528 (insert sc-reference-tag-string | |
1529 (sc-hdr "On " (sc-mail-field "date") ", ") | |
1530 whofrom " said:\n")))) | |
1531 | |
1532 (defun sc-header-inarticle-writes () | |
1533 "\"In article <message-id>, <from> writes:\" | |
1534 Treats \"message-id\" and \"from\" fields similar to `sc-header-on-said'." | |
1535 (let ((sc-mumble "") | |
1536 (whofrom (sc-mail-field "from"))) | |
1537 (if whofrom | |
1538 (insert sc-reference-tag-string | |
1539 (sc-hdr "In article " (sc-mail-field "message-id") ", ") | |
1540 whofrom " writes:\n")))) | |
1541 | |
1542 (defun sc-header-regarding-adds () | |
1543 "\"Regarding <subject>; <from> adds:\" | |
1544 Treats \"subject\" and \"from\" fields similar to `sc-header-on-said'." | |
1545 (let ((sc-mumble "") | |
1546 (whofrom (sc-whofrom))) | |
1547 (if whofrom | |
1548 (insert sc-reference-tag-string | |
1549 (sc-hdr "Regarding " (sc-mail-field "subject") "; ") | |
1550 whofrom " adds:\n")))) | |
1551 | |
1552 (defun sc-header-attributed-writes () | |
1553 "\"<sc-attribution>\" == <sc-author> <address> writes: | |
1554 Treats these fields in a similar manner to `sc-header-on-said'." | |
1555 (let ((sc-mumble "") | |
1556 (whofrom (sc-whofrom))) | |
1557 (if whofrom | |
1558 (insert sc-reference-tag-string | |
1559 (sc-hdr "\"" (sc-mail-field "sc-attribution") "\" == ") | |
1560 (sc-hdr "" (sc-mail-field "sc-author") " ") | |
1561 (or (sc-hdr "<" (sc-mail-field "sc-from-address") ">" t) | |
1562 (sc-hdr "<" (sc-mail-field "sc-reply-address") ">" t) | |
1563 "") | |
1564 " writes:\n")))) | |
1565 | |
1566 (defun sc-header-author-writes () | |
1567 "<sc-author> writes:" | |
1568 (let ((sc-mumble "") | |
1569 (whofrom (sc-whofrom))) | |
1570 (if whofrom | |
1571 (insert sc-reference-tag-string | |
1572 (sc-hdr "" (sc-mail-field "sc-author")) | |
1573 " writes:\n")))) | |
1574 | |
1575 (defun sc-header-verbose () | |
1576 "Very verbose, some say gross." | |
1577 (let ((sc-mumble "") | |
1578 (whofrom (sc-whofrom)) | |
1579 (tag sc-reference-tag-string)) | |
1580 (if whofrom | |
1581 (insert (sc-hdr (concat tag "On ") (sc-mail-field "date") ",\n") | |
1582 (or (sc-hdr tag (sc-mail-field "sc-author") "\n" t) | |
1583 (concat tag whofrom "\n")) | |
1584 (sc-hdr (concat tag "from the organization of ") | |
1585 (sc-mail-field "organization") "\n") | |
1586 (let ((rtag (concat tag "who can be reached at: "))) | |
1587 (or (sc-hdr rtag (sc-mail-field "sc-from-address") "\n" t) | |
1588 (sc-hdr rtag (sc-mail-field "sc-reply-address") "\n" t) | |
1589 "")) | |
1590 (sc-hdr | |
1591 (concat tag "(whose comments are cited below with \"") | |
1592 (sc-mail-field "sc-citation") "\"),\n") | |
1593 (sc-hdr (concat tag "had this to say in article ") | |
1594 (sc-mail-field "message-id") "\n") | |
1595 (sc-hdr (concat tag "in newsgroups ") | |
1596 (sc-mail-field "newsgroups") "\n") | |
1597 (sc-hdr (concat tag "concerning the subject of ") | |
1598 (sc-mail-field "subject") "\n") | |
1599 (sc-hdr (concat tag "(see ") | |
1600 (sc-mail-field "references") | |
1601 " for more details)\n") | |
1602 )))) | |
1603 | |
1604 | |
1605 ;; ====================================================================== | |
1606 ;; header rewrites | |
1607 | |
1608 (defconst sc-electric-bufname " *sc-erefs* " | |
1609 "Supercite electric reference mode's buffer name.") | |
1610 (defvar sc-eref-style 0 | |
1611 "Current electric reference style.") | |
1612 | |
1613 (defun sc-valid-index-p (index) | |
1614 "Returns INDEX if it is a valid index into `sc-rewrite-header-list'. | |
1615 Otherwise returns nil." | |
1616 ;; a number, and greater than or equal to zero | |
1617 ;; less than or equal to the last index | |
1618 (and (natnump index) | |
1619 (< index (length sc-rewrite-header-list)) | |
1620 index)) | |
1621 | |
1622 (defun sc-eref-insert-selected (&optional nomsg) | |
1623 "Insert the selected reference header in the current buffer. | |
1624 Optional NOMSG, if non-nil, inhibits printing messages, unless an | |
1625 error occurs." | |
1626 (let ((ref (nth sc-eref-style sc-rewrite-header-list))) | |
1627 (condition-case err | |
1628 (progn | |
1629 (eval ref) | |
1630 (let ((lines (count-lines (point-min) (point-max)))) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
43791
diff
changeset
|
1631 (or nomsg (message "Ref header %d [%d line%s]: %s" |
4850 | 1632 sc-eref-style lines |
1633 (if (= lines 1) "" "s") | |
1634 ref)))) | |
1635 (void-function | |
1636 (progn (message | |
1637 "Symbol's function definition is void: %s (Header %d)" | |
1638 (car (cdr err)) sc-eref-style) | |
1639 (beep) | |
1640 )) | |
1641 ))) | |
1642 | |
1643 (defun sc-electric-mode (&optional arg) | |
1644 " | |
1645 Mode for viewing Supercite reference headers. Commands are: | |
1646 \n\\{sc-electric-mode-map} | |
1647 | |
1648 `sc-electric-mode' is not intended to be run interactively, but rather | |
1649 accessed through Supercite's electric reference feature. See | |
1650 `sc-insert-reference' for more details. Optional ARG is the initial | |
1651 header style to use, unless not supplied or invalid, in which case | |
1652 `sc-preferred-header-style' is used." | |
1653 | |
1654 (let ((info sc-mail-info)) | |
1655 | |
1656 (setq sc-eref-style | |
1657 (or (sc-valid-index-p arg) | |
1658 (sc-valid-index-p sc-preferred-header-style) | |
1659 0)) | |
1660 | |
1661 (get-buffer-create sc-electric-bufname) | |
1662 ;; set up buffer and enter command loop | |
1663 (save-excursion | |
1664 (save-window-excursion | |
1665 (pop-to-buffer sc-electric-bufname) | |
1666 (kill-all-local-variables) | |
1667 (let ((sc-mail-info info) | |
1668 (buffer-read-only t) | |
1669 (mode-name "SC Electric Refs") | |
1670 (major-mode 'sc-electric-mode)) | |
1671 (use-local-map sc-electric-mode-map) | |
1672 (sc-eref-show sc-eref-style) | |
62765
db1434c1a2f5
(sc-electric-mode): Use run-mode-hooks.
Lute Kamstra <lute@gnu.org>
parents:
62315
diff
changeset
|
1673 (run-mode-hooks 'sc-electric-mode-hook) |
4850 | 1674 (recursive-edit) |
1675 ))) | |
1676 | |
1677 (and sc-eref-style | |
1678 (sc-eref-insert-selected)) | |
1679 (kill-buffer sc-electric-bufname) | |
1680 )) | |
1681 | |
1682 ;; functions for electric reference mode | |
1683 (defun sc-eref-show (index) | |
1684 "Show reference INDEX in `sc-rewrite-header-list'." | |
1685 (let ((msg "No %ing reference headers in list.") | |
1686 (last (length sc-rewrite-header-list))) | |
1687 (setq sc-eref-style | |
1688 (cond | |
1689 ((sc-valid-index-p index) index) | |
1690 ((< index 0) | |
1691 (if sc-electric-circular-p | |
1692 (1- last) | |
1693 (progn (error msg "preced") 0))) | |
1694 ((>= index last) | |
1695 (if sc-electric-circular-p | |
1696 0 | |
1697 (progn (error msg "follow") (1- last)))) | |
1698 )) | |
1699 (save-excursion | |
1700 (set-buffer sc-electric-bufname) | |
1701 (let ((buffer-read-only nil)) | |
1702 (erase-buffer) | |
1703 (goto-char (point-min)) | |
1704 (sc-eref-insert-selected) | |
1705 ;; now shrink the window to just contain the electric reference | |
1706 ;; header. | |
1707 (let ((hdrlines (count-lines (point-min) (point-max))) | |
1708 (winlines (1- (window-height)))) | |
1709 (if (/= hdrlines winlines) | |
1710 (if (> hdrlines winlines) | |
1711 ;; we have to enlarge the window | |
1712 (enlarge-window (- hdrlines winlines)) | |
1713 ;; we have to shrink the window | |
1714 (shrink-window (- winlines (max hdrlines window-min-height))) | |
1715 ))) | |
1716 )))) | |
1717 | |
1718 (defun sc-eref-next () | |
1719 "Display next reference in other buffer." | |
1720 (interactive) | |
1721 (sc-eref-show (1+ sc-eref-style))) | |
1722 | |
1723 (defun sc-eref-prev () | |
1724 "Display previous reference in other buffer." | |
1725 (interactive) | |
1726 (sc-eref-show (1- sc-eref-style))) | |
1727 | |
1728 (defun sc-eref-setn () | |
1729 "Set reference header selected as preferred." | |
1730 (interactive) | |
1731 (setq sc-preferred-header-style sc-eref-style) | |
1732 (message "Preferred reference style set to header %d." sc-eref-style)) | |
1733 | |
1734 (defun sc-eref-goto (refnum) | |
1735 "Show reference style indexed by REFNUM. | |
1736 If REFNUM is an invalid index, don't go to that reference and return | |
1737 nil." | |
1738 (interactive "NGoto Reference: ") | |
1739 (if (sc-valid-index-p refnum) | |
1740 (sc-eref-show refnum) | |
1741 (error "Invalid reference: %d. (Range: [%d .. %d])" | |
1742 refnum 0 (1- (length sc-rewrite-header-list))) | |
1743 )) | |
1744 | |
1745 (defun sc-eref-jump () | |
1746 "Set reference header to preferred header." | |
1747 (interactive) | |
1748 (sc-eref-show sc-preferred-header-style)) | |
1749 | |
1750 (defun sc-eref-abort () | |
1751 "Exit from electric reference mode without inserting reference." | |
1752 (interactive) | |
1753 (setq sc-eref-style nil) | |
1754 (exit-recursive-edit)) | |
1755 | |
1756 (defun sc-eref-exit () | |
1757 "Exit from electric reference mode and insert selected reference." | |
1758 (interactive) | |
1759 (exit-recursive-edit)) | |
1760 | |
1761 (defun sc-insert-reference (arg) | |
1762 "Insert, at point, a reference header in the body of the reply. | |
1763 Numeric ARG indicates which header style from `sc-rewrite-header-list' | |
1764 to use when rewriting the header. No supplied ARG indicates use of | |
1765 `sc-preferred-header-style'. | |
1766 | |
1767 With just `\\[universal-argument]', electric reference insert mode is | |
1768 entered, regardless of the value of `sc-electric-references-p'. See | |
1769 `sc-electric-mode' for more information." | |
1770 (interactive "P") | |
1771 (if (consp arg) | |
1772 (sc-electric-mode) | |
1773 (let ((preference (or (sc-valid-index-p arg) | |
1774 (sc-valid-index-p sc-preferred-header-style) | |
1775 sc-preferred-header-style | |
1776 0))) | |
1777 (if sc-electric-references-p | |
1778 (sc-electric-mode preference) | |
1779 (sc-eref-insert-selected t) | |
1780 )))) | |
1781 | |
1782 | |
1783 ;; ====================================================================== | |
1784 ;; variable toggling | |
1785 | |
1786 (defun sc-raw-mode-toggle () | |
1787 "Toggle, in one fell swoop, two important SC variables: | |
1788 `sc-fixup-whitespace-p' and `sc-auto-fill-region-p'" | |
1789 (interactive) | |
1790 (setq sc-fixup-whitespace-p (not sc-fixup-whitespace-p) | |
1791 sc-auto-fill-region-p (not sc-auto-fill-region-p)) | |
11571
771bd7ddd4cc
(sc-raw-mode-toggle): Use force-mode-line-update.
Karl Heuer <kwzh@gnu.org>
parents:
11556
diff
changeset
|
1792 (force-mode-line-update)) |
4850 | 1793 |
1794 (defun sc-toggle-var (variable) | |
1795 "Boolean toggle VARIABLE's value. | |
42206 | 1796 VARIABLE must be a bound symbol. nil values change to t, non-nil |
4850 | 1797 values are changed to nil." |
1798 (message "%s changed from %s to %s" | |
1799 variable (symbol-value variable) | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1800 (set variable (not (symbol-value variable))))) |
4850 | 1801 |
1802 (defun sc-set-variable (var) | |
1803 "Set the Supercite VARIABLE. | |
1804 This function mimics `set-variable', except that the variable to set | |
1805 is determined non-interactively. The value is queried for in the | |
1806 minibuffer exactly the same way that `set-variable' does it. | |
1807 | |
1808 You can see the current value of the variable when the minibuffer is | |
1809 querying you by typing `C-h'. Note that the format is changed | |
1810 slightly from that used by `set-variable' -- the current value is | |
1811 printed just after the variable's name instead of at the bottom of the | |
1812 help window." | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1813 (let* ((minibuffer-help-form '(funcall myhelp)) |
4850 | 1814 (myhelp |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1815 (lambda () |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1816 (with-output-to-temp-buffer "*Help*" |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1817 (prin1 var) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1818 (if (boundp var) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1819 (let ((print-length 20)) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1820 (princ "\t(Current value: ") |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1821 (prin1 (symbol-value var)) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1822 (princ ")"))) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1823 (princ "\n\nDocumentation:\n") |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1824 (princ (substring (documentation-property |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1825 var |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1826 'variable-documentation) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1827 1)) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1828 (with-current-buffer standard-output |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1829 (help-mode)) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1830 nil)))) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1831 (set var (eval-minibuffer (format "Set %s to value: " var))))) |
4850 | 1832 |
1833 (defmacro sc-toggle-symbol (rootname) | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1834 `(defun ,(intern (concat "sc-T-" rootname)) () |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1835 (interactive) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1836 (sc-toggle-var ',(intern (concat "sc-" rootname "-p"))))) |
4850 | 1837 |
1838 (defmacro sc-setvar-symbol (rootname) | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1839 `(defun ,(intern (concat "sc-S-" rootname)) () |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1840 (interactive) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1841 (sc-set-variable ',(intern (concat "sc-" rootname))))) |
4850 | 1842 |
1843 (sc-toggle-symbol "confirm-always") | |
1844 (sc-toggle-symbol "downcase") | |
1845 (sc-toggle-symbol "electric-references") | |
1846 (sc-toggle-symbol "auto-fill-region") | |
1847 (sc-toggle-symbol "mail-nuke-blank-lines") | |
1848 (sc-toggle-symbol "nested-citation") | |
1849 (sc-toggle-symbol "electric-circular") | |
1850 (sc-toggle-symbol "use-only-preferences") | |
1851 (sc-toggle-symbol "fixup-whitespace") | |
1852 | |
1853 (sc-setvar-symbol "preferred-attribution-list") | |
1854 (sc-setvar-symbol "preferred-header-style") | |
1855 (sc-setvar-symbol "mail-nuke-mail-headers") | |
1856 (sc-setvar-symbol "mail-header-nuke-list") | |
1857 (sc-setvar-symbol "cite-region-limit") | |
1858 | |
1859 (defun sc-T-describe () | |
1860 " | |
1861 | |
1862 Supercite provides a number of key bindings which simplify the process | |
1863 of setting or toggling certain variables controlling its operation. | |
1864 | |
1865 Note on function names in this list: all functions of the form | |
1866 `sc-S-<name>' actually call `sc-set-variable' on the corresponding | |
1867 `sc-<name>' variable. All functions of the form `sc-T-<name>' call | |
1868 `sc-toggle-var' on the corresponding `sc-<name>-p' variable. | |
1869 | |
1870 \\{sc-T-keymap}" | |
1871 (interactive) | |
1872 (describe-function 'sc-T-describe)) | |
1873 | |
1874 | |
1875 ;; ====================================================================== | |
1876 ;; published interface to mail and news readers | |
1877 | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1878 (define-minor-mode sc-minor-mode |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1879 "Supercite minor mode." |
61282
73d56a93d9fd
(sc-minor-mode): Specify :group.
Lute Kamstra <lute@gnu.org>
parents:
61044
diff
changeset
|
1880 :group 'supercite |
73d56a93d9fd
(sc-minor-mode): Specify :group.
Lute Kamstra <lute@gnu.org>
parents:
61044
diff
changeset
|
1881 :lighter (" SC" (sc-auto-fill-region-p |
73d56a93d9fd
(sc-minor-mode): Specify :group.
Lute Kamstra <lute@gnu.org>
parents:
61044
diff
changeset
|
1882 (":f" (sc-fixup-whitespace-p "w")) |
73d56a93d9fd
(sc-minor-mode): Specify :group.
Lute Kamstra <lute@gnu.org>
parents:
61044
diff
changeset
|
1883 (sc-fixup-whitespace-p ":w"))) |
73d56a93d9fd
(sc-minor-mode): Specify :group.
Lute Kamstra <lute@gnu.org>
parents:
61044
diff
changeset
|
1884 :keymap `((,sc-mode-map-prefix . ,sc-mode-map))) |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1885 |
7370
ecb09a00d330
(sc-cite-original): Add autoload.
Richard M. Stallman <rms@gnu.org>
parents:
5286
diff
changeset
|
1886 ;;;###autoload |
4850 | 1887 (defun sc-cite-original () |
1888 "Workhorse citing function which performs the initial citation. | |
1889 This is callable from the various mail and news readers' reply | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1890 function according to the agreed upon standard. See the associated |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1891 info node `(SC)Top' for more details. |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1892 `sc-cite-original' does not do any yanking of the |
4850 | 1893 original message but it does require a few things: |
1894 | |
1895 1) The reply buffer is the current buffer. | |
1896 | |
1897 2) The original message has been yanked and inserted into the | |
1898 reply buffer. | |
1899 | |
1900 3) Verbose mail headers from the original message have been | |
1901 inserted into the reply buffer directly before the text of the | |
1902 original message. | |
1903 | |
1904 4) Point is at the beginning of the verbose headers. | |
1905 | |
1906 5) Mark is at the end of the body of text to be cited. | |
1907 | |
92244 | 1908 The region need not be active (and typically isn't when this |
1909 function is called). Also, the hook `sc-pre-hook' is run before, | |
1910 and `sc-post-hook' is run after the guts of this function." | |
4850 | 1911 (run-hooks 'sc-pre-hook) |
1912 | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1913 (sc-minor-mode 1) |
4850 | 1914 |
1915 (undo-boundary) | |
1916 | |
1917 ;; grab point and mark since the region is probably not active when | |
1918 ;; this function gets automatically called. we want point to be a | |
1919 ;; mark so any deleting before point works properly | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1920 (let* ((zmacs-regions nil) ; for XEemacs |
24876 | 1921 (mark-active t) ; for Emacs |
4850 | 1922 (point (point-marker)) |
1923 (mark (copy-marker (mark-marker)))) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
43791
diff
changeset
|
1924 |
4850 | 1925 ;; make sure point comes before mark, not all functions are |
1926 ;; interactive "r" | |
1927 (if (< mark point) | |
1928 (let ((tmp point)) | |
1929 (setq point mark | |
1930 mark tmp))) | |
1931 | |
1932 ;; first process mail headers, and populate sc-mail-info | |
1933 (sc-mail-process-headers point mark) | |
1934 | |
1935 ;; now get possible attributions | |
1936 (sc-attribs-chop-address (or (sc-mail-field "from") | |
1937 (sc-mail-field "reply") | |
1938 (sc-mail-field "reply-to") | |
1939 (sc-mail-field "sender"))) | |
1940 ;; select the attribution | |
1941 (sc-select-attribution) | |
1942 | |
1943 ;; cite the region, but first check the value of sc-cite-region-limit | |
1944 (let ((linecnt (count-lines point mark))) | |
1945 (and sc-cite-region-limit | |
1946 (if (or (not (numberp sc-cite-region-limit)) | |
1947 (<= linecnt sc-cite-region-limit)) | |
1948 (progn | |
1949 ;; cite the region and insert the header rewrite | |
1950 (sc-cite-region point mark) | |
1951 (goto-char point) | |
1952 (let ((sc-eref-style (or sc-preferred-header-style 0))) | |
1953 (if sc-electric-references-p | |
1954 (sc-electric-mode sc-eref-style) | |
1955 (sc-eref-insert-selected t)))) | |
1956 (beep) | |
1957 (message | |
1958 "Region not cited. %d lines exceeds sc-cite-region-limit: %d" | |
1959 linecnt sc-cite-region-limit)))) | |
1960 | |
1961 ;; finally, free the point-marker | |
1962 (set-marker point nil) | |
1963 (set-marker mark nil) | |
1964 ) | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1965 (run-hooks 'sc-post-hook)) |
4850 | 1966 |
1967 | |
1968 ;; ====================================================================== | |
1969 ;; bug reporting and miscellaneous commands | |
1970 | |
1971 (defun sc-open-line (arg) | |
1972 "Like `open-line', but insert the citation prefix at the front of the line. | |
1973 With numeric ARG, inserts that many new lines." | |
1974 (interactive "p") | |
1975 (save-excursion | |
1976 (let ((start (point)) | |
1977 (prefix (or (progn (beginning-of-line) | |
1978 (if (looking-at (sc-cite-regexp)) | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1979 (match-string 0))) |
4850 | 1980 ""))) |
1981 (goto-char start) | |
1982 (open-line arg) | |
1983 (forward-line 1) | |
1984 (while (< 0 arg) | |
1985 (insert prefix) | |
1986 (forward-line 1) | |
92244 | 1987 (setq arg (1- arg)))))) |
4850 | 1988 |
1989 (defun sc-insert-citation (arg) | |
1990 "Insert citation string at beginning of current line if not already cited. | |
1991 With `\\[universal-argument]' insert citation even if line is already | |
1992 cited." | |
1993 (interactive "P") | |
1994 (save-excursion | |
1995 (beginning-of-line) | |
1996 (if (or (not (looking-at (sc-cite-regexp))) | |
1997 (looking-at "^[ \t]*$") | |
1998 (consp arg)) | |
1999 (insert (sc-mail-field "sc-citation")) | |
38436
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
28437
diff
changeset
|
2000 (error "Line is already cited")))) |
4850 | 2001 |
57933
59c9a776a021
(sc-cite-region): Don't use interactive-p. Add arg INTERACTIVE.
Richard M. Stallman <rms@gnu.org>
parents:
57160
diff
changeset
|
2002 (defun sc-version (message) |
4850 | 2003 "Echo the current version of Supercite in the minibuffer. |
57933
59c9a776a021
(sc-cite-region): Don't use interactive-p. Add arg INTERACTIVE.
Richard M. Stallman <rms@gnu.org>
parents:
57160
diff
changeset
|
2004 If MESSAGE is non-nil (interactively, with no prefix argument), |
4850 | 2005 inserts the version string in the current buffer instead." |
57933
59c9a776a021
(sc-cite-region): Don't use interactive-p. Add arg INTERACTIVE.
Richard M. Stallman <rms@gnu.org>
parents:
57160
diff
changeset
|
2006 (interactive (not current-prefix-arg)) |
86773
91992c60e402
(sc-version): Use emacs-version rather than sc-version.
Glenn Morris <rgm@gnu.org>
parents:
86532
diff
changeset
|
2007 (let ((verstr (format "Using Supercite.el %s" emacs-version))) |
57933
59c9a776a021
(sc-cite-region): Don't use interactive-p. Add arg INTERACTIVE.
Richard M. Stallman <rms@gnu.org>
parents:
57160
diff
changeset
|
2008 (if message |
59c9a776a021
(sc-cite-region): Don't use interactive-p. Add arg INTERACTIVE.
Richard M. Stallman <rms@gnu.org>
parents:
57160
diff
changeset
|
2009 (message verstr) |
59c9a776a021
(sc-cite-region): Don't use interactive-p. Add arg INTERACTIVE.
Richard M. Stallman <rms@gnu.org>
parents:
57160
diff
changeset
|
2010 (insert "`sc-version' says: " verstr)))) |
4850 | 2011 |
92244 | 2012 (make-obsolete 'sc-version 'emacs-version "23.1") |
2013 | |
4850 | 2014 (defun sc-describe () |
92244 | 2015 "Read the Supercite info node." |
4850 | 2016 (interactive) |
92244 | 2017 (info "(SC)top")) |
2018 | |
92263
90dd1f6122b5
(sc-describe): Fix typos in obsolescence declaration.
Juanma Barranquero <lekktu@gmail.com>
parents:
92244
diff
changeset
|
2019 (make-obsolete 'sc-describe "read the SC manual using `info'." "23.1") |
4850 | 2020 |
86532
c44e4015b517
Delete meaningless header keys.
Glenn Morris <rgm@gnu.org>
parents:
84957
diff
changeset
|
2021 (define-obsolete-function-alias 'sc-submit-bug-report 'report-emacs-bug "23.1") |
4850 | 2022 |
2023 | |
2024 ;; useful stuff | |
2025 (provide 'supercite) | |
2026 (run-hooks 'sc-load-hook) | |
2027 | |
61044
17207b620cf3
(sc-mail-field): Use assoc-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60924
diff
changeset
|
2028 ;; arch-tag: a5d5bfa6-3bd5-4414-8c65-0afc83e45cd3 |
4850 | 2029 ;;; supercite.el ends here |