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