Mercurial > emacs
annotate lisp/mail/supercite.el @ 92280:48b836154530
(IT_write_glyphs): Adapt to new glyph type.
author | Kim F. Storm <storm@cua.dk> |
---|---|
date | Wed, 27 Feb 2008 22:49:21 +0000 |
parents | 90dd1f6122b5 |
children | 117d4bd1128b |
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 |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
71 "*If non-nil, automatically fill each paragraph after it has been cited." |
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 |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
76 "*Number of blank lines to leave after mail headers have been nuked. |
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 " " |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
83 "*String comprising first part of a citation." |
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 ">" |
4850 | 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 " " |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
94 "*String comprising fourth and last part of a citation." |
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]*" |
4850 | 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:]]*" |
4850 | 107 "*Regexp describing variable root part of a citation for a cited line. |
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:]]+" |
4850 | 114 "*Regexp describing the variable root part of a nested citation. |
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 "[>]+" |
4850 | 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]*" |
4850 | 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 |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
135 "*If non-nil, put a citation on blank lines." |
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 '() |
4850 | 140 "*Alist for frame selection during citing. |
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 '() |
4850 | 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 '() |
4850 | 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 ) | |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
215 "*Default REGI frame for citing a region." |
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 ) | |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
226 "*Default REGI frame for unciting a region." |
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 ) | |
17489
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
243 "*Default REGI frame for reciting a region." |
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 |
4850 | 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 |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
270 "*If non-nil, always confirm attribution string before citing text body." |
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" |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
275 "*String used when author's attribution cannot be determined." |
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" |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
279 "*String used when author's name cannot be determined." |
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 |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
283 "*Non-nil means downcase the attribution and citation strings." |
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 |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
288 "*If non-nil, treat electric references as circular." |
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 |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
293 "*Hook for `sc-electric-mode' electric references mode." |
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 |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
297 "*Use electric references if non-nil." |
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 |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
302 "*If non-nil, delete all leading white space before citing." |
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 |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
307 "*Hook which gets run once after Supercite loads." |
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 |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
311 "*Hook which gets run before each invocation of `sc-cite-original'." |
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 |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
315 "*Hook which gets run after each invocation of `sc-cite-original'." |
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 |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
320 "*Warn if mail headers don't conform to RFC822." |
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 "" |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
324 "*Value returned by `sc-mail-field' if field isn't in mail headers." |
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)) | |
333 "*Name list components which are filtered out as noise. | |
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 |
4850 | 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 |
4850 | 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 |
4850 | 365 "*List of mail header regexps to remove or keep in body of reply. |
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") |
373 "*Specifies what to use as the attribution string. | |
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 |
4850 | 414 "*An alist for selecting preferred attribution based on mail headers. |
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 |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
437 "*Hook to run before selecting an attribution." |
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 |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
442 "*Hook to run after selecting an attribution, but before confirmation." |
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 |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
448 "*Hook to run before citing a region of text." |
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 |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
453 "*Hook to run before unciting a region of text." |
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 |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
458 "*Hook to run before reciting a region of text." |
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 |
4850 | 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 ">>>>> " |
cb41a5b41836
Add defgroup's; use defcustom for user vars.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
470 "*String used at the beginning of built-in reference headers." |
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 ) | |
484 "*List of reference header rewrite functions. | |
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 +" |
4850 | 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 |
4850 | 500 "*Controls what happens when the preferred attribution cannot be found. |
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 |
507 ;; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | |
508 ;; end user configuration variables | |
509 | |
86532
c44e4015b517
Delete meaningless header keys.
Glenn Morris <rgm@gnu.org>
parents:
84957
diff
changeset
|
510 (define-obsolete-variable-alias 'sc-version 'emacs-version "23.1") |
4850 | 511 |
512 (defvar sc-mail-info nil | |
513 "Alist of mail header information gleaned from reply buffer.") | |
514 (defvar sc-attributions nil | |
515 "Alist of attributions for use when citing.") | |
516 | |
517 (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
|
518 "Temporary regexp describing nested citations.") |
4850 | 519 (defvar sc-tmp-nonnested-regexp nil |
520 "Temporary regexp describing non-nested citations.") | |
521 (defvar sc-tmp-dumb-regexp nil | |
522 "Temp regexp describing non-nested citation cited with a nesting citer.") | |
523 | |
524 (make-variable-buffer-local 'sc-mail-info) | |
525 (make-variable-buffer-local 'sc-attributions) | |
526 | |
527 | |
528 ;; ====================================================================== | |
529 ;; supercite keymaps | |
530 | |
531 (defvar sc-mode-map-prefix "\C-c\C-p" | |
532 "*Key binding to install Supercite keymap. | |
533 If this is nil, Supercite keymap is not installed.") | |
534 | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
535 (defvar sc-T-keymap |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
536 (let ((map (make-sparse-keymap))) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
537 (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
|
538 (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
|
539 (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
|
540 (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
|
541 (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
|
542 (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
|
543 (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
|
544 (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
|
545 (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
|
546 (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
|
547 (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
|
548 (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
|
549 (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
|
550 (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
|
551 (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
|
552 (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
|
553 map) |
4850 | 554 "Keymap for sub-keymap of setting and toggling functions.") |
555 | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
556 (defvar sc-mode-map |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
557 (let ((map (make-sparse-keymap))) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
558 (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
|
559 (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
|
560 (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
|
561 (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
|
562 (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
|
563 (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
|
564 (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
|
565 (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
|
566 (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
|
567 (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
|
568 (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
|
569 (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
|
570 (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
|
571 (define-key map "?" 'sc-describe) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
572 map) |
4850 | 573 "Keymap for Supercite quasi-mode.") |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
43791
diff
changeset
|
574 |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
575 (defvar sc-electric-mode-map |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
576 (let ((map (make-sparse-keymap))) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
577 (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
|
578 (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
|
579 (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
|
580 (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
|
581 (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
|
582 (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
|
583 (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
|
584 (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
|
585 (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
|
586 (define-key map "?" 'describe-mode) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
587 (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
|
588 (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
|
589 (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
|
590 map) |
4850 | 591 "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
|
592 |
4850 | 593 |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
594 (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
|
595 (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
|
596 (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
|
597 (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
|
598 map) |
4850 | 599 "Keymap for minibuffer confirmation of attribution strings.") |
600 | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
601 (defvar sc-minibuffer-local-map |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
602 (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
|
603 (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
|
604 map) |
4850 | 605 "Keymap for minibuffer confirmation of attribution strings.") |
606 | |
607 | |
608 ;; ====================================================================== | |
609 ;; utility functions | |
610 | |
611 (defun sc-ask (alist) | |
612 "Ask a question in the minibuffer requiring a single character answer. | |
613 This function is kind of an extension of `y-or-n-p' where a single | |
614 letter is used to answer a question. Question is formed from ALIST | |
615 which has members of the form: (WORD . LETTER). WORD is the long | |
616 word form, while LETTER is the letter for selecting that answer. The | |
617 selected letter is returned, or nil if the question was not answered. | |
618 Note that WORD is a string and LETTER is a character. All LETTERs in | |
619 the list should be unique." | |
620 (let* ((prompt (concat | |
621 (mapconcat (function (lambda (elt) (car elt))) alist ", ") | |
622 "? (" | |
623 (mapconcat | |
624 (function | |
625 (lambda (elt) (char-to-string (cdr elt)))) alist "/") | |
626 ") ")) | |
627 (p prompt) | |
628 (event | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
629 (if (fboundp 'allocate-event) |
4850 | 630 (allocate-event) |
631 nil))) | |
632 (while (stringp p) | |
633 (if (let ((cursor-in-echo-area t) | |
634 (inhibit-quit t)) | |
635 (message "%s" p) | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
636 (setq event (read-event)) |
4850 | 637 (prog1 quit-flag (setq quit-flag nil))) |
638 (progn | |
639 (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
|
640 (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
|
641 (deallocate-event event)) |
4850 | 642 (setq quit-flag nil) |
643 (signal 'quit '()))) | |
644 (let ((char | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
645 (if (featurep 'xemacs) |
4850 | 646 (let* ((key (and (key-press-event-p event) (event-key event))) |
647 (char (and key (event-to-character event)))) | |
648 char) | |
649 event)) | |
650 elt) | |
651 (if char (setq char (downcase char))) | |
652 (cond | |
653 ((setq elt (rassq char alist)) | |
654 (message "%s%s" p (car elt)) | |
655 (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
|
656 ((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
|
657 (button-release-event-p event)) ; ignore them |
4850 | 658 nil) |
659 (t | |
660 (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
|
661 (if (featurep 'xemacs) |
4850 | 662 (ding nil 'y-or-n-p) |
663 (ding)) | |
664 (discard-input) | |
665 (if (eq p prompt) | |
666 (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
|
667 (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
|
668 (deallocate-event event)) |
4850 | 669 p)) |
670 | |
671 (defun sc-scan-info-alist (alist) | |
672 "Find a match in the info alist that matches a regexp in ALIST." | |
673 (let ((sc-mumble "") | |
674 rtnvalue) | |
675 (while alist | |
676 (let* ((elem (car alist)) | |
677 (infokey (car elem)) | |
678 (infoval (sc-mail-field infokey)) | |
679 (mlist (car (cdr elem)))) | |
680 (while mlist | |
681 (let* ((ml-elem (car mlist)) | |
682 (regexp (car ml-elem)) | |
683 (thing (cdr ml-elem))) | |
684 (if (string-match regexp infoval) | |
685 ;; 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
|
686 (setq rtnvalue thing |
4850 | 687 mlist nil |
688 alist nil) | |
689 ;; else we didn't find a match | |
690 (setq mlist (cdr mlist)) | |
691 ))) ;end of mlist loop | |
692 (setq alist (cdr alist)) | |
693 )) ;end of alist loop | |
694 rtnvalue)) | |
695 | |
696 | |
697 ;; ====================================================================== | |
698 ;; extract mail field information from headers in reply buffer | |
699 | |
700 ;; holder variables for bc happiness | |
701 (defvar sc-mail-headers-start nil | |
702 "Start of header fields.") | |
703 (defvar sc-mail-headers-end nil | |
704 "End of header fields.") | |
705 (defvar sc-mail-field-history nil | |
706 "For minibuffer completion on mail field queries.") | |
707 (defvar sc-mail-field-modification-history nil | |
708 "For minibuffer completion on mail field modifications.") | |
709 (defvar sc-mail-glom-frame | |
710 '((begin (setq sc-mail-headers-start (point))) | |
711 ("^x-attribution:[ \t]+.*$" (sc-mail-fetch-field t) nil t) | |
712 ("^\\S +:.*$" (sc-mail-fetch-field) nil t) | |
713 ("^$" (list 'abort '(step . 0))) | |
714 ("^[ \t]+" (sc-mail-append-field)) | |
715 (sc-mail-warn-if-non-rfc822-p (sc-mail-error-in-mail-field)) | |
716 (end (setq sc-mail-headers-end (point)))) | |
717 "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
|
718 (put 'sc-mail-glom-frame 'risky-local-variable t) |
4850 | 719 |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
720 (defvar curline) ; dynamic bondage |
28437 | 721 |
4850 | 722 ;; regi functions |
723 (defun sc-mail-fetch-field (&optional attribs-p) | |
724 "Insert a key and value into `sc-mail-info' alist. | |
725 If optional ATTRIBS-P is non-nil, the key/value pair is placed in | |
726 `sc-attributions' too." | |
727 (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
|
728 (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
|
729 (val (match-string-no-properties 2 curline)) |
4850 | 730 (keyval (cons key val))) |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
731 (push keyval sc-mail-info) |
4850 | 732 (if attribs-p |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
733 (push keyval sc-attributions)))) |
4850 | 734 nil) |
735 | |
736 (defun sc-mail-append-field () | |
737 "Append a continuation line onto the last fetched mail field's info." | |
738 (let ((keyval (car sc-mail-info))) | |
739 (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
|
740 (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
|
741 (match-string-no-properties 1 curline))))) |
4850 | 742 nil) |
743 | |
744 (defun sc-mail-error-in-mail-field () | |
745 "Issue warning that mail headers don't conform to RFC 822." | |
746 (let* ((len (min (length curline) 10)) | |
747 (ellipsis (if (< len (length curline)) "..." "")) | |
748 (msg "Mail header \"%s%s\" doesn't conform to RFC 822. skipping...")) | |
749 (message msg (substring curline 0 len) ellipsis)) | |
750 (beep) | |
751 (sit-for 2) | |
752 nil) | |
753 | |
754 ;; mail header nuking | |
755 (defvar sc-mail-last-header-nuked-p nil | |
756 "True if the last header was nuked.") | |
757 | |
758 (defun sc-mail-nuke-line () | |
759 "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
|
760 (delete-region (line-beginning-position) (line-beginning-position 2)) |
4850 | 761 '((step . -1))) |
762 | |
763 (defun sc-mail-nuke-header-line () | |
764 "Delete current-line and set up for possible continuation." | |
765 (setq sc-mail-last-header-nuked-p t) | |
766 (sc-mail-nuke-line)) | |
767 | |
768 (defun sc-mail-nuke-continuation-line () | |
769 "Delete a continuation line if the last header line was deleted." | |
770 (if sc-mail-last-header-nuked-p | |
771 (sc-mail-nuke-line))) | |
772 | |
773 (defun sc-mail-cleanup-blank-lines () | |
774 "Leave some blank lines after original mail headers are nuked. | |
775 The number of lines left is specified by `sc-blank-lines-after-headers'." | |
776 (if sc-blank-lines-after-headers | |
777 (save-restriction | |
778 (widen) | |
779 (skip-chars-backward " \t\n") | |
780 (forward-line 1) | |
781 (delete-blank-lines) | |
782 (beginning-of-line) | |
783 (if (looking-at "[ \t]*$") | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
784 (delete-region (line-beginning-position) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
785 (line-beginning-position 2))) |
4850 | 786 (insert-char ?\n sc-blank-lines-after-headers))) |
787 nil) | |
788 | |
789 (defun sc-mail-build-nuke-frame () | |
790 "Build the regiframe for nuking mail headers." | |
791 (let (every-func entry-func nonentry-func) | |
792 (cond | |
793 ((eq sc-nuke-mail-headers 'all) | |
794 (setq every-func '(progn (forward-line -1) (sc-mail-nuke-line)))) | |
795 ((eq sc-nuke-mail-headers 'specified) | |
796 (setq entry-func '(sc-mail-nuke-header-line) | |
797 nonentry-func '(setq sc-mail-last-header-nuked-p nil))) | |
798 ((eq sc-nuke-mail-headers 'keep) | |
799 (setq entry-func '(setq sc-mail-last-header-nuked-p nil) | |
800 nonentry-func '(sc-mail-nuke-header-line))) | |
801 ;; we never get far enough to interpret a frame if s-n-m-h == 'none | |
802 ((eq sc-nuke-mail-headers 'none)) | |
60916
480134f8cd16
* mail/supercite.el: Replace `illegal' with `invalid'.
Werner LEMBERG <wl@gnu.org>
parents:
58952
diff
changeset
|
803 (t (error "Invalid value for sc-nuke-mail-headers: %s" |
4850 | 804 sc-nuke-mail-headers)) |
805 ) ; end-cond | |
806 (append | |
807 (and entry-func | |
808 (regi-mapcar sc-nuke-mail-header-list entry-func nil t)) | |
809 (and nonentry-func (list (list "^\\S +:.*$" nonentry-func))) | |
810 (and (not every-func) | |
811 '(("^[ \t]+" (sc-mail-nuke-continuation-line)))) | |
812 '((begin (setq sc-mail-last-header-zapped-p nil))) | |
813 '((end (sc-mail-cleanup-blank-lines))) | |
814 (and every-func (list (list 'every every-func))) | |
815 ))) | |
816 | |
817 ;; mail processing and zapping. this is the top level entry defun to | |
818 ;; all header processing. | |
819 (defun sc-mail-process-headers (start end) | |
820 "Process original mail message's mail headers. | |
821 After processing, mail headers may be nuked. Header information is | |
822 stored in `sc-mail-info', and any old information is lost unless an | |
823 error occurs." | |
824 (interactive "r") | |
825 (let ((info (copy-alist sc-mail-info)) | |
826 (attribs (copy-alist sc-attributions))) | |
827 (setq sc-mail-info nil | |
828 sc-attributions nil) | |
829 (regi-interpret sc-mail-glom-frame start end) | |
830 (if (null sc-mail-info) | |
831 (progn | |
832 (message "No mail headers found! Restoring old information.") | |
833 (setq sc-mail-info info | |
834 sc-attributions attribs)) | |
835 (regi-interpret (sc-mail-build-nuke-frame) | |
836 sc-mail-headers-start sc-mail-headers-end) | |
837 ))) | |
838 | |
839 | |
840 ;; let the user change mail field information | |
841 (defun sc-mail-field (field) | |
842 "Return the mail header field value associated with FIELD. | |
843 If there was no mail header with FIELD as its key, return the value of | |
844 `sc-mumble'. FIELD is case insensitive." | |
61044
17207b620cf3
(sc-mail-field): Use assoc-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60924
diff
changeset
|
845 (or (cdr (assoc-string field sc-mail-info 'case-fold)) sc-mumble)) |
4850 | 846 |
847 (defun sc-mail-field-query (arg) | |
848 "View the value of a mail field. | |
849 With `\\[universal-argument]', prompts for action on mail field. | |
850 Action can be one of: View, Modify, Add, or Delete." | |
851 (interactive "P") | |
852 (let* ((alist '(("view" . ?v) ("modify" . ?m) ("add" . ?a) ("delete" . ?d))) | |
853 (action (if (not arg) ?v (sc-ask alist))) | |
854 key) | |
855 (if (not action) | |
856 () | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
857 (setq key (completing-read |
4850 | 858 (concat (car (rassq action alist)) |
859 " information key: ") | |
860 sc-mail-info nil | |
861 (if (eq action ?a) nil 'noexit) | |
862 nil 'sc-mail-field-history)) | |
863 (cond | |
864 ((eq action ?v) | |
865 (message "%s: %s" key (cdr (assoc key sc-mail-info)))) | |
866 ((eq action ?d) | |
867 (setq sc-mail-info (delq (assoc key sc-mail-info) sc-mail-info))) | |
868 ((eq action ?m) | |
869 (let ((keyval (assoc key sc-mail-info))) | |
870 ;; 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
|
871 (if (not (member (cdr keyval) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
872 sc-mail-field-modification-history)) |
4850 | 873 (setq sc-mail-field-modification-history |
874 (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
|
875 (setcdr keyval (read-string |
4850 | 876 (concat key ": ") (cdr keyval) |
877 'sc-mail-field-modification-history)))) | |
878 ((eq action ?a) | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
879 (push (cons key (read-string (concat key ": "))) sc-mail-info)) |
4850 | 880 )))) |
881 | |
882 | |
883 ;; ====================================================================== | |
884 ;; attributions | |
885 | |
886 (defvar sc-attribution-confirmation-history nil | |
887 "History for confirmation of attribution strings.") | |
888 (defvar sc-citation-confirmation-history nil | |
889 "History for confirmation of attribution prefixes.") | |
890 | |
891 (defun sc-attribs-%@-addresses (from &optional delim) | |
892 "Extract the author's email terminus from email address FROM. | |
893 Match addresses of the style ``name%[stuff].'' when called with DELIM | |
894 of \"%\" and addresses of the style ``[stuff]name@[stuff]'' when | |
895 called with DELIM \"@\". If DELIM is nil or not provided, matches | |
896 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
|
897 (and (string-match (concat "[-[:alnum:]_.]+" delim) from 0) |
4850 | 898 (substring from |
899 (match-beginning 0) | |
900 (- (match-end 0) (if (null delim) 0 1))))) | |
901 | |
902 (defun sc-attribs-!-addresses (from) | |
903 "Extract the author's email terminus from email address FROM. | |
904 Match addresses of the style ``[stuff]![stuff]...!name[stuff].''" | |
905 (let ((eos (length from)) | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
906 (mstart (string-match "![-[:alnum:]_.]+\\([^-![:alnum:]_.]\\|$\\)" |
4850 | 907 from 0)) |
908 (mend (match-end 0))) | |
909 (and mstart | |
910 (substring from (1+ mstart) (- mend (if (= mend eos) 0 1))) | |
911 ))) | |
912 | |
913 (defun sc-attribs-<>-addresses (from) | |
914 "Extract the author's email terminus from email address FROM. | |
915 Match addresses of the style ``<name[stuff]>.''" | |
916 (and (string-match "<\\(.*\\)>" from) | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
917 (match-string 1 from))) |
4850 | 918 |
919 (defun sc-get-address (from author) | |
920 "Get the full email address path from FROM. | |
921 AUTHOR is the author's name (which is removed from the address)." | |
922 (let ((eos (length from))) | |
61044
17207b620cf3
(sc-mail-field): Use assoc-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60924
diff
changeset
|
923 (if (string-match (concat "\\`\"?" (regexp-quote author) |
17207b620cf3
(sc-mail-field): Use assoc-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60924
diff
changeset
|
924 "\"?\\s +") from 0) |
4850 | 925 (let ((address (substring from (match-end 0) eos))) |
926 (if (and (= (aref address 0) ?<) | |
927 (= (aref address (1- (length address))) ?>)) | |
928 (substring address 1 (1- (length address))) | |
929 address)) | |
28437 | 930 (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
|
931 (match-string 0 from) |
4850 | 932 "") |
933 ))) | |
934 | |
935 (defun sc-attribs-emailname (from) | |
936 "Get the email terminus name from FROM." | |
937 (or | |
938 (sc-attribs-%@-addresses from "%") | |
939 (sc-attribs-%@-addresses from "@") | |
940 (sc-attribs-!-addresses from) | |
941 (sc-attribs-<>-addresses from) | |
942 (sc-attribs-%@-addresses from) | |
943 (substring from 0 10))) | |
944 | |
945 (defun sc-name-substring (string start end extend) | |
946 "Extract the specified substring of STRING from START to END. | |
947 EXTEND is the number of characters on each side to extend the | |
948 substring." | |
949 (and start | |
950 (let ((sos (+ start extend)) | |
951 (eos (- end extend))) | |
952 (substring string sos | |
953 (or (string-match sc-titlecue-regexp string sos) eos) | |
954 )))) | |
955 | |
956 (defun sc-attribs-extract-namestring (from) | |
957 "Extract the name string from FROM. | |
958 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
|
959 ;; FIXME: we probably should use mail-extract-address-components. |
4850 | 960 (let ((namestring |
961 (or | |
12859
90c22a02c12b
(sc-attribs-extract-namestring): If name has <...>,
Richard M. Stallman <rms@gnu.org>
parents:
12425
diff
changeset
|
962 ;; 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
|
963 ;; 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
|
964 ;; 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
|
965 ;; 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
|
966 (and (string-match " *<.*>" from 0) |
13813
7d18fdd1acf4
(sc-attribs-extract-namestring): Do look for
Karl Heuer <kwzh@gnu.org>
parents:
12859
diff
changeset
|
967 (let ((before-angles |
7d18fdd1acf4
(sc-attribs-extract-namestring): Do look for
Karl Heuer <kwzh@gnu.org>
parents:
12859
diff
changeset
|
968 (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
|
969 (if (string-match "\".*\"" before-angles 0) |
7d18fdd1acf4
(sc-attribs-extract-namestring): Do look for
Karl Heuer <kwzh@gnu.org>
parents:
12859
diff
changeset
|
970 (sc-name-substring |
7d18fdd1acf4
(sc-attribs-extract-namestring): Do look for
Karl Heuer <kwzh@gnu.org>
parents:
12859
diff
changeset
|
971 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
|
972 before-angles))) |
4850 | 973 (sc-name-substring |
974 from (string-match "(.*)" from 0) (match-end 0) 1) | |
975 (sc-name-substring | |
976 from (string-match "\".*\"" from 0) (match-end 0) 1) | |
977 (sc-name-substring | |
28437 | 978 from (string-match "\\([-.[:alnum:]_]+\\s +\\)+<" from 0) |
4850 | 979 (match-end 1) 0) |
980 (sc-attribs-emailname from)))) | |
981 ;; strip off any leading or trailing whitespace | |
982 (if namestring | |
983 (let ((bos 0) | |
984 (eos (1- (length namestring)))) | |
985 (while (and (<= bos eos) | |
986 (memq (aref namestring bos) '(32 ?\t))) | |
987 (setq bos (1+ bos))) | |
988 (while (and (> eos bos) | |
989 (memq (aref namestring eos) '(32 ?\t))) | |
990 (setq eos (1- eos))) | |
991 (substring namestring bos (1+ eos)))))) | |
992 | |
993 (defun sc-attribs-chop-namestring (namestring) | |
994 "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
|
995 example: (sc-attribs-chop-namestring \"John Xavier Doe\") |
4850 | 996 => (\"John\" \"Xavier\" \"Doe\")" |
997 (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
|
998 (cons (match-string 2 namestring) |
4850 | 999 (sc-attribs-chop-namestring (substring namestring (match-end 3))) |
1000 ))) | |
1001 | |
1002 (defun sc-attribs-strip-initials (namelist) | |
1003 "Extract the author's initials from the NAMELIST." | |
1004 (mapconcat | |
1005 (function | |
1006 (lambda (name) | |
1007 (if (< 0 (length name)) | |
1008 (substring name 0 1)))) | |
1009 namelist "")) | |
1010 | |
1011 (defun sc-guess-attribution (&optional string) | |
1012 "Guess attribution string on current line. | |
1013 If attribution cannot be guessed, nil is returned. Optional STRING if | |
1014 supplied, is used instead of the line point is on in the current buffer." | |
1015 (let ((start 0) | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1016 (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
|
1017 (line-end-position)))) |
4850 | 1018 attribution) |
1019 (and | |
1020 (= start (or (string-match sc-citation-leader-regexp string start) -1)) | |
1021 (setq start (match-end 0)) | |
1022 (= 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
|
1023 (setq attribution (match-string 0 string) |
4850 | 1024 start (match-end 0)) |
1025 (= start (or (string-match sc-citation-delimiter-regexp string start) -1)) | |
1026 (setq start (match-end 0)) | |
1027 (= start (or (string-match sc-citation-separator-regexp string start) -1)) | |
1028 attribution))) | |
1029 | |
1030 (defun sc-attribs-filter-namelist (namelist) | |
1031 "Filter out noise in NAMELIST according to `sc-name-filter-alist'." | |
1032 (let ((elements (length namelist)) | |
1033 (position -1) | |
1034 keepers filtered-list) | |
84957
ac461e78456b
(sc-attribs-filter-namelist): Use mapc rather than mapcar.
Glenn Morris <rgm@gnu.org>
parents:
78232
diff
changeset
|
1035 (mapc |
4850 | 1036 (function |
1037 (lambda (name) | |
1038 (setq position (1+ position)) | |
1039 (let ((keep-p t)) | |
84957
ac461e78456b
(sc-attribs-filter-namelist): Use mapc rather than mapcar.
Glenn Morris <rgm@gnu.org>
parents:
78232
diff
changeset
|
1040 (mapc |
4850 | 1041 (function |
1042 (lambda (filter) | |
1043 (let ((regexp (car filter)) | |
1044 (pos (cdr filter))) | |
1045 (if (and (string-match regexp name) | |
1046 (or (and (numberp pos) | |
1047 (= pos position)) | |
1048 (and (eq pos 'last) | |
1049 (= position (1- elements))) | |
1050 (eq pos 'any))) | |
1051 (setq keep-p nil)) | |
1052 ))) | |
1053 sc-name-filter-alist) | |
1054 (if keep-p | |
1055 (setq keepers (cons position keepers))) | |
1056 ))) | |
1057 namelist) | |
84957
ac461e78456b
(sc-attribs-filter-namelist): Use mapc rather than mapcar.
Glenn Morris <rgm@gnu.org>
parents:
78232
diff
changeset
|
1058 (mapc |
4850 | 1059 (function |
1060 (lambda (position) | |
1061 (setq filtered-list (cons (nth position namelist) filtered-list)) | |
1062 )) | |
1063 keepers) | |
1064 filtered-list)) | |
1065 | |
1066 (defun sc-attribs-chop-address (from) | |
1067 "Extract attribution information from FROM. | |
1068 This populates the `sc-attributions' with the list of possible attributions." | |
1069 (if (and (stringp from) | |
1070 (< 0 (length from))) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
43791
diff
changeset
|
1071 (let* ((sc-mumble "") |
4850 | 1072 (namestring (sc-attribs-extract-namestring from)) |
1073 (namelist (sc-attribs-filter-namelist | |
1074 (sc-attribs-chop-namestring namestring))) | |
1075 (revnames (reverse (cdr namelist))) | |
1076 (firstname (car namelist)) | |
1077 (midnames (reverse (cdr revnames))) | |
1078 (lastname (car revnames)) | |
1079 (initials (sc-attribs-strip-initials namelist)) | |
1080 (emailname (sc-attribs-emailname from)) | |
1081 (n 1) | |
1082 author middlenames) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
43791
diff
changeset
|
1083 |
4850 | 1084 ;; put basic information |
1085 (setq | |
1086 ;; put middle names and build sc-author entry | |
1087 middlenames (mapconcat | |
1088 (function | |
1089 (lambda (midname) | |
1090 (let ((key-attribs (format "middlename-%d" n)) | |
1091 (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
|
1092 (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
|
1093 (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
|
1094 (setq n (1+ n)) |
4850 | 1095 midname))) |
1096 midnames " ") | |
1097 | |
1098 author (concat firstname " " middlenames (and midnames " ") lastname) | |
1099 | |
1100 sc-attributions (append | |
1101 (list | |
1102 (cons "firstname" firstname) | |
1103 (cons "lastname" lastname) | |
1104 (cons "emailname" emailname) | |
1105 (cons "initials" initials)) | |
1106 sc-attributions) | |
1107 sc-mail-info (append | |
1108 (list | |
1109 (cons "sc-firstname" firstname) | |
1110 (cons "sc-middlenames" middlenames) | |
1111 (cons "sc-lastname" lastname) | |
1112 (cons "sc-emailname" emailname) | |
1113 (cons "sc-initials" initials) | |
1114 (cons "sc-author" author) | |
1115 (cons "sc-from-address" (sc-get-address | |
1116 (sc-mail-field "from") | |
1117 namestring)) | |
1118 (cons "sc-reply-address" (sc-get-address | |
1119 (sc-mail-field "reply-to") | |
1120 namestring)) | |
1121 (cons "sc-sender-address" (sc-get-address | |
1122 (sc-mail-field "sender") | |
1123 namestring)) | |
1124 ) | |
1125 sc-mail-info) | |
1126 )) | |
1127 ;; from string is empty | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1128 (push (cons "sc-author" sc-default-author-name) sc-mail-info))) |
4850 | 1129 |
1130 (defvar sc-attrib-or-cite nil | |
1131 "Used to toggle between attribution input or citation input.") | |
1132 | |
1133 (defun sc-toggle-fn () | |
1134 "Toggle between attribution selection and citation selection. | |
1135 Only used during confirmation." | |
1136 (interactive) | |
1137 (setq sc-attrib-or-cite (not sc-attrib-or-cite)) | |
1138 (throw 'sc-reconfirm t)) | |
1139 | |
1140 (defun sc-select-attribution () | |
1141 "Select an attribution from `sc-attributions'. | |
1142 | |
1143 Variables involved in selection process include: | |
1144 `sc-preferred-attribution-list' | |
1145 `sc-use-only-preference-p' | |
1146 `sc-confirm-always-p' | |
1147 `sc-default-attribution' | |
1148 `sc-attrib-selection-list'. | |
1149 | |
1150 Runs the hook `sc-attribs-preselect-hook' before selecting an | |
1151 attribution and the hook `sc-attribs-postselect-hook' after making the | |
1152 selection but before querying is performed. During | |
1153 `sc-attribs-postselect-hook' the variable `citation' is bound to the | |
1154 auto-selected citation string and the variable `attribution' is bound | |
1155 to the auto-selected attribution string." | |
1156 (run-hooks 'sc-attribs-preselect-hook) | |
1157 (let ((query-p sc-confirm-always-p) | |
1158 attribution citation | |
1159 (attriblist sc-preferred-attribution-list)) | |
1160 | |
1161 ;; first cruise through sc-preferred-attribution-list looking for | |
1162 ;; a match in either sc-attributions or sc-mail-info. if the | |
1163 ;; element is "sc-consult", then we have to do the alist | |
1164 ;; consultation phase | |
1165 (while attriblist | |
1166 (let* ((preferred (car attriblist))) | |
1167 (cond | |
1168 ((string= preferred "sc-consult") | |
1169 ;; we've been told to consult the attribution vs. mail | |
1170 ;; header key alist. we do this until we find a match in | |
1171 ;; the sc-attrib-selection-list. if we do not find a match, | |
1172 ;; we continue scanning attriblist | |
1173 (let ((attrib (sc-scan-info-alist sc-attrib-selection-list))) | |
1174 (cond | |
1175 ((not attrib) | |
1176 (setq attriblist (cdr attriblist))) | |
1177 ((stringp attrib) | |
1178 (setq attribution attrib | |
1179 attriblist nil)) | |
1180 ((listp attrib) | |
62903
9cca67e822b5
(sc-select-attribution): Only use a list element from
Glenn Morris <rgm@gnu.org>
parents:
62765
diff
changeset
|
1181 (setq attribution (eval attrib)) |
9cca67e822b5
(sc-select-attribution): Only use a list element from
Glenn Morris <rgm@gnu.org>
parents:
62765
diff
changeset
|
1182 (if (stringp attribution) |
9cca67e822b5
(sc-select-attribution): Only use a list element from
Glenn Morris <rgm@gnu.org>
parents:
62765
diff
changeset
|
1183 (setq attriblist nil) |
9cca67e822b5
(sc-select-attribution): Only use a list element from
Glenn Morris <rgm@gnu.org>
parents:
62765
diff
changeset
|
1184 (setq attribution nil |
9cca67e822b5
(sc-select-attribution): Only use a list element from
Glenn Morris <rgm@gnu.org>
parents:
62765
diff
changeset
|
1185 attriblist (cdr attriblist)))) |
4850 | 1186 (t (error "%s did not evaluate to a string or list!" |
1187 "sc-attrib-selection-list")) | |
1188 ))) | |
1189 ((setq attribution (cdr (assoc preferred sc-attributions))) | |
1190 (setq attriblist nil)) | |
1191 (t | |
1192 (setq attriblist (cdr attriblist))) | |
1193 ))) | |
1194 | |
1195 ;; if preference was not found, we may use a secondary method to | |
1196 ;; find a valid attribution | |
1197 (if (and (not attribution) | |
1198 (not sc-use-only-preference-p)) | |
1199 ;; secondary method tries to find a preference in this order | |
1200 ;; 1. sc-lastchoice | |
1201 ;; 2. x-attribution | |
1202 ;; 3. firstname | |
1203 ;; 4. lastname | |
1204 ;; 5. initials | |
1205 ;; 6. first non-empty attribution in alist | |
1206 (setq attribution | |
1207 (or (cdr (assoc "sc-lastchoice" sc-attributions)) | |
1208 (cdr (assoc "x-attribution" sc-attributions)) | |
1209 (cdr (assoc "firstname" sc-attributions)) | |
1210 (cdr (assoc "lastname" sc-attributions)) | |
1211 (cdr (assoc "initials" sc-attributions)) | |
1212 (cdr (car sc-attributions))))) | |
1213 | |
1214 ;; still couldn't find an attribution. we're now limited to using | |
1215 ;; the default attribution, but we'll force a query when this happens | |
1216 (if (not attribution) | |
1217 (setq attribution sc-default-attribution | |
1218 query-p t)) | |
1219 | |
1220 ;; create the attribution prefix | |
1221 (setq citation (sc-make-citation attribution)) | |
1222 | |
1223 ;; run the post selection hook before querying the user | |
1224 (run-hooks 'sc-attribs-postselect-hook) | |
1225 | |
1226 ;; query for confirmation | |
1227 (if query-p | |
1228 (let* ((query-alist (mapcar (function (lambda (entry) | |
1229 (list (cdr entry)))) | |
1230 sc-attributions)) | |
1231 (minibuffer-local-completion-map | |
1232 sc-minibuffer-local-completion-map) | |
1233 (minibuffer-local-map sc-minibuffer-local-map) | |
1234 (initial attribution) | |
1235 (completer-disable t) ; in case completer.el is used | |
1236 choice) | |
1237 (setq sc-attrib-or-cite nil) ; nil==attribution, t==citation | |
1238 (while | |
1239 (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
|
1240 (progn |
2e05b93ba14a
(sc-select-attribution): Accept whatever value we get in CHOICE; there
Richard M. Stallman <rms@gnu.org>
parents:
42206
diff
changeset
|
1241 (setq choice |
2e05b93ba14a
(sc-select-attribution): Accept whatever value we get in CHOICE; there
Richard M. Stallman <rms@gnu.org>
parents:
42206
diff
changeset
|
1242 (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
|
1243 (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
|
1244 "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
|
1245 citation |
2e05b93ba14a
(sc-select-attribution): Accept whatever value we get in CHOICE; there
Richard M. Stallman <rms@gnu.org>
parents:
42206
diff
changeset
|
1246 'sc-citation-confirmation-history) |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1247 (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
|
1248 "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
|
1249 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
|
1250 (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
|
1251 '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
|
1252 )) |
2e05b93ba14a
(sc-select-attribution): Accept whatever value we get in CHOICE; there
Richard M. Stallman <rms@gnu.org>
parents:
42206
diff
changeset
|
1253 nil))) |
4850 | 1254 (if sc-attrib-or-cite |
1255 ;; since the citation was chosen, we have to guess at | |
1256 ;; the attribution | |
1257 (setq citation choice | |
1258 attribution (or (sc-guess-attribution citation) | |
1259 citation)) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
43791
diff
changeset
|
1260 |
4850 | 1261 (setq citation (sc-make-citation choice) |
1262 attribution choice)) | |
1263 )) | |
1264 | |
1265 ;; its possible that the user wants to downcase the citation and | |
1266 ;; attribution | |
1267 (if sc-downcase-p | |
1268 (setq citation (downcase citation) | |
1269 attribution (downcase attribution))) | |
1270 | |
1271 ;; set up mail info alist | |
1272 (let* ((ckey "sc-citation") | |
1273 (akey "sc-attribution") | |
1274 (ckeyval (assoc ckey sc-mail-info)) | |
1275 (akeyval (assoc akey sc-mail-info))) | |
1276 (if ckeyval | |
1277 (setcdr ckeyval citation) | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1278 (push (cons ckey citation) sc-mail-info)) |
4850 | 1279 (if akeyval |
1280 (setcdr akeyval attribution) | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1281 (push (cons akey attribution) sc-mail-info))) |
4850 | 1282 |
1283 ;; set the sc-lastchoice attribution | |
1284 (let* ((lkey "sc-lastchoice") | |
1285 (lastchoice (assoc lkey sc-attributions))) | |
1286 (if lastchoice | |
1287 (setcdr lastchoice attribution) | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1288 (push (cons lkey attribution) sc-attributions))) |
4850 | 1289 )) |
1290 | |
1291 | |
1292 ;; ====================================================================== | |
1293 ;; filladapt hooks for supercite 3.1. you shouldn't need anything | |
1294 ;; extra to make gin-mode understand supercited lines. Even this | |
1295 ;; stuff might not be entirely necessary... | |
1296 | |
1297 (defun sc-cite-regexp (&optional root-regexp) | |
1298 "Return a regexp describing a Supercited line. | |
1299 The regexp is the concatenation of `sc-citation-leader-regexp', | |
1300 `sc-citation-root-regexp', `sc-citation-delimiter-regexp', and | |
1301 `sc-citation-separator-regexp'. If optional ROOT-REGEXP is supplied, | |
1302 use it instead of `sc-citation-root-regexp'." | |
1303 (concat sc-citation-leader-regexp | |
1304 (or root-regexp sc-citation-root-regexp) | |
1305 sc-citation-delimiter-regexp | |
1306 sc-citation-separator-regexp)) | |
1307 | |
1308 (defun sc-make-citation (attribution) | |
1309 "Make a non-nested citation from ATTRIBUTION." | |
1310 (concat sc-citation-leader | |
1311 attribution | |
1312 sc-citation-delimiter | |
1313 sc-citation-separator)) | |
1314 | |
63945
eb399d132bf4
(filladapt-prefix-table): Add defvar.
Richard M. Stallman <rms@gnu.org>
parents:
63056
diff
changeset
|
1315 (defvar filladapt-prefix-table) |
eb399d132bf4
(filladapt-prefix-table): Add defvar.
Richard M. Stallman <rms@gnu.org>
parents:
63056
diff
changeset
|
1316 |
4850 | 1317 (defun sc-setup-filladapt () |
1318 "Setup `filladapt-prefix-table' to handle Supercited paragraphs." | |
1319 (let* ((fa-sc-elt 'filladapt-supercite-included-text) | |
1320 (elt (rassq fa-sc-elt filladapt-prefix-table))) | |
1321 (if elt (setcar elt (sc-cite-regexp)) | |
1322 (message "Filladapt doesn't seem to know about Supercite.") | |
1323 (beep)))) | |
1324 | |
1325 | |
1326 ;; ====================================================================== | |
1327 ;; citing and unciting regions of text | |
1328 | |
1329 (defvar sc-fill-begin 1 | |
1330 "Buffer position to begin filling.") | |
1331 (defvar sc-fill-line-prefix "" | |
1332 "Fill prefix of previous line") | |
1333 | |
1334 ;; filling | |
1335 (defun sc-fill-if-different (&optional prefix) | |
1336 "Fill the region bounded by `sc-fill-begin' and point. | |
1337 Only fill if optional PREFIX is different than `sc-fill-line-prefix'. | |
1338 If `sc-auto-fill-region-p' is nil, do not fill region. If PREFIX is | |
1339 not supplied, initialize fill variables. This is useful for a regi | |
1340 `begin' frame-entry." | |
1341 (if (not prefix) | |
1342 (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
|
1343 sc-fill-begin (line-beginning-position)) |
4850 | 1344 (if (and sc-auto-fill-region-p |
1345 (not (string= prefix sc-fill-line-prefix))) | |
1346 (let ((fill-prefix sc-fill-line-prefix)) | |
1347 (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
|
1348 (fill-region sc-fill-begin (line-beginning-position))) |
4850 | 1349 (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
|
1350 sc-fill-begin (line-beginning-position)))) |
4850 | 1351 ) |
1352 nil) | |
1353 | |
1354 (defun sc-cite-coerce-cited-line () | |
1355 "Coerce a Supercited line to look like our style." | |
1356 (let* ((attribution (sc-guess-attribution)) | |
1357 (regexp (sc-cite-regexp attribution)) | |
1358 (prefix (sc-make-citation attribution))) | |
1359 (if (and attribution | |
1360 (looking-at regexp)) | |
1361 (progn | |
1362 (delete-region | |
1363 (match-beginning 0) | |
1364 (save-excursion | |
1365 (goto-char (match-end 0)) | |
1366 (if (bolp) (forward-char -1)) | |
1367 (point))) | |
1368 (insert prefix) | |
1369 (sc-fill-if-different prefix))) | |
1370 nil)) | |
1371 | |
1372 (defun sc-cite-coerce-dumb-citer () | |
1373 "Coerce a non-nested citation that's been cited with a dumb nesting citer." | |
1374 (delete-region (match-beginning 1) (match-end 1)) | |
1375 (beginning-of-line) | |
1376 (sc-cite-coerce-cited-line)) | |
1377 | |
1378 (defun sc-guess-nesting (&optional string) | |
1379 "Guess the citation nesting on the current line. | |
1380 If nesting cannot be guessed, nil is returned. Optional STRING if | |
1381 supplied, is used instead of the line point is on in the current | |
1382 buffer." | |
1383 (let ((start 0) | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1384 (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
|
1385 (line-end-position)))) |
4850 | 1386 nesting) |
1387 (and | |
1388 (= start (or (string-match sc-citation-leader-regexp string start) -1)) | |
1389 (setq start (match-end 0)) | |
1390 (= 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
|
1391 (setq nesting (match-string 0 string) |
4850 | 1392 start (match-end 0)) |
1393 (= start (or (string-match sc-citation-separator-regexp string start) -1)) | |
1394 nesting))) | |
1395 | |
1396 (defun sc-add-citation-level () | |
14007
c6476f4bb121
(sc-citation-nonnested-root-regexp,
Karl Heuer <kwzh@gnu.org>
parents:
13813
diff
changeset
|
1397 "Add a citation level for nested citation style w/ coercion." |
4850 | 1398 (let* ((nesting (sc-guess-nesting)) |
1399 (citation (make-string (1+ (length nesting)) | |
1400 (string-to-char sc-citation-delimiter))) | |
1401 (prefix (concat sc-citation-leader citation sc-citation-separator))) | |
1402 (if (looking-at (sc-cite-regexp "")) | |
1403 (delete-region (match-beginning 0) (match-end 0))) | |
1404 (insert prefix) | |
1405 (sc-fill-if-different prefix))) | |
1406 | |
1407 (defun sc-cite-line (&optional citation) | |
1408 "Cite a single line of uncited text. | |
1409 Optional CITATION overrides any citation automatically selected." | |
1410 (if sc-fixup-whitespace-p | |
1411 (fixup-whitespace)) | |
1412 (let ((prefix (or citation | |
1413 (cdr (assoc "sc-citation" sc-mail-info)) | |
1414 sc-default-attribution))) | |
1415 (insert prefix) | |
1416 (sc-fill-if-different prefix)) | |
1417 nil) | |
1418 | |
1419 (defun sc-uncite-line () | |
1420 "Remove citation from current line." | |
1421 (let ((cited (looking-at (sc-cite-regexp)))) | |
1422 (if cited | |
1423 (delete-region (match-beginning 0) (match-end 0)))) | |
1424 nil) | |
1425 | |
1426 (defun sc-recite-line (regexp) | |
1427 "Remove citation matching REGEXP from current line and recite line." | |
1428 (let ((cited (looking-at (concat "^" regexp))) | |
1429 (prefix (cdr (assoc "sc-citation" sc-mail-info)))) | |
1430 (if cited | |
1431 (delete-region (match-beginning 0) (match-end 0))) | |
1432 (insert (or prefix sc-default-attribution)) | |
1433 (sc-fill-if-different prefix)) | |
1434 nil) | |
1435 | |
1436 ;; 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
|
1437 (defun sc-cite-region (start end &optional confirm-p interactive) |
4850 | 1438 "Cite a region delineated by START and END. |
1439 If optional CONFIRM-P is non-nil, the attribution is confirmed before | |
1440 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
|
1441 `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
|
1442 |
59c9a776a021
(sc-cite-region): Don't use interactive-p. Add arg INTERACTIVE.
Richard M. Stallman <rms@gnu.org>
parents:
57160
diff
changeset
|
1443 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
|
1444 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
|
1445 (interactive "r\nP\np") |
4850 | 1446 (undo-boundary) |
58952
5c34e026a96e
(sc-cite-frame-alist): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
58583
diff
changeset
|
1447 (let ((frame (sc-scan-info-alist sc-cite-frame-alist)) |
4850 | 1448 (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
|
1449 (if (and frame (symbolp frame)) |
5c34e026a96e
(sc-cite-frame-alist): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
58583
diff
changeset
|
1450 (setq frame (symbol-value frame))) |
5c34e026a96e
(sc-cite-frame-alist): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
58583
diff
changeset
|
1451 (or frame (setq frame sc-default-cite-frame)) |
4850 | 1452 (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
|
1453 (if interactive |
4850 | 1454 (sc-select-attribution)) |
1455 (regi-interpret frame start end))) | |
1456 | |
1457 (defun sc-uncite-region (start end) | |
1458 "Uncite a region delineated by START and END. | |
1459 First runs `sc-pre-uncite-hook'." | |
1460 (interactive "r") | |
1461 (undo-boundary) | |
58952
5c34e026a96e
(sc-cite-frame-alist): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
58583
diff
changeset
|
1462 (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
|
1463 (if (and frame (symbolp frame)) |
5c34e026a96e
(sc-cite-frame-alist): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
58583
diff
changeset
|
1464 (setq frame (symbol-value frame))) |
5c34e026a96e
(sc-cite-frame-alist): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
58583
diff
changeset
|
1465 (or frame (setq frame sc-default-uncite-frame)) |
4850 | 1466 (run-hooks 'sc-pre-uncite-hook) |
1467 (regi-interpret frame start end))) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
43791
diff
changeset
|
1468 |
4850 | 1469 (defun sc-recite-region (start end) |
1470 "Recite a region delineated by START and END. | |
1471 First runs `sc-pre-recite-hook'." | |
1472 (interactive "r") | |
1473 (let ((sc-confirm-always-p t)) | |
1474 (sc-select-attribution)) | |
1475 (undo-boundary) | |
58952
5c34e026a96e
(sc-cite-frame-alist): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
58583
diff
changeset
|
1476 (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
|
1477 (if (and frame (symbolp frame)) |
5c34e026a96e
(sc-cite-frame-alist): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
58583
diff
changeset
|
1478 (setq frame (symbol-value frame))) |
5c34e026a96e
(sc-cite-frame-alist): Doc fix.
Juri Linkov <juri@jurta.org>
parents:
58583
diff
changeset
|
1479 (or frame (setq frame sc-default-recite-frame)) |
4850 | 1480 (run-hooks 'sc-pre-recite-hook) |
1481 (regi-interpret frame start end))) | |
1482 | |
1483 | |
1484 ;; ====================================================================== | |
1485 ;; building headers | |
1486 | |
1487 (defun sc-hdr (prefix field &optional sep return-nil-p) | |
1488 "Returns a concatenation of PREFIX and FIELD. | |
1489 If FIELD is not a string or is the empty string, the empty string will | |
1490 be returned. Optional third argument SEP is concatenated on the end if | |
1491 it is a string. Returns empty string, unless optional RETURN-NIL-P is | |
1492 non-nil." | |
1493 (if (and (stringp field) | |
1494 (not (string= field ""))) | |
1495 (concat prefix field (or sep "")) | |
1496 (and (not return-nil-p) ""))) | |
1497 | |
1498 (defun sc-whofrom () | |
1499 "Return the value of (sc-mail-field \"from\") or nil." | |
1500 (let ((sc-mumble nil)) | |
1501 (sc-mail-field "from"))) | |
1502 | |
1503 (defun sc-no-header () | |
1504 "Does nothing. Use this instead of nil to get a blank header." | |
1505 ()) | |
1506 | |
1507 (defun sc-no-blank-line-or-header() | |
14007
c6476f4bb121
(sc-citation-nonnested-root-regexp,
Karl Heuer <kwzh@gnu.org>
parents:
13813
diff
changeset
|
1508 "Similar to `sc-no-header' except it removes the preceding blank line." |
4850 | 1509 (if (not (bobp)) |
1510 (if (and (eolp) | |
1511 (progn (forward-line -1) | |
21861 | 1512 (or (= (point) (mail-header-end)) |
4850 | 1513 (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
|
1514 (with-no-warnings |
103e161cb74f
(sc-ask, sc-no-blank-line-or-header): Avoid warnings.
Richard M. Stallman <rms@gnu.org>
parents:
64754
diff
changeset
|
1515 (mh-in-header-p)))))) |
4850 | 1516 (progn (forward-line) |
1517 (let ((kill-lines-magic t)) | |
1518 (kill-line)))))) | |
1519 | |
1520 (defun sc-header-on-said () | |
1521 "\"On <date>, <from> said:\" unless: | |
1522 1. the \"from\" field cannot be found, in which case nothing is inserted; | |
1523 2. the \"date\" field is missing in which case only the from part is printed." | |
1524 (let ((sc-mumble "") | |
1525 (whofrom (sc-whofrom))) | |
1526 (if whofrom | |
1527 (insert sc-reference-tag-string | |
1528 (sc-hdr "On " (sc-mail-field "date") ", ") | |
1529 whofrom " said:\n")))) | |
1530 | |
1531 (defun sc-header-inarticle-writes () | |
1532 "\"In article <message-id>, <from> writes:\" | |
1533 Treats \"message-id\" and \"from\" fields similar to `sc-header-on-said'." | |
1534 (let ((sc-mumble "") | |
1535 (whofrom (sc-mail-field "from"))) | |
1536 (if whofrom | |
1537 (insert sc-reference-tag-string | |
1538 (sc-hdr "In article " (sc-mail-field "message-id") ", ") | |
1539 whofrom " writes:\n")))) | |
1540 | |
1541 (defun sc-header-regarding-adds () | |
1542 "\"Regarding <subject>; <from> adds:\" | |
1543 Treats \"subject\" and \"from\" fields similar to `sc-header-on-said'." | |
1544 (let ((sc-mumble "") | |
1545 (whofrom (sc-whofrom))) | |
1546 (if whofrom | |
1547 (insert sc-reference-tag-string | |
1548 (sc-hdr "Regarding " (sc-mail-field "subject") "; ") | |
1549 whofrom " adds:\n")))) | |
1550 | |
1551 (defun sc-header-attributed-writes () | |
1552 "\"<sc-attribution>\" == <sc-author> <address> writes: | |
1553 Treats these fields in a similar manner to `sc-header-on-said'." | |
1554 (let ((sc-mumble "") | |
1555 (whofrom (sc-whofrom))) | |
1556 (if whofrom | |
1557 (insert sc-reference-tag-string | |
1558 (sc-hdr "\"" (sc-mail-field "sc-attribution") "\" == ") | |
1559 (sc-hdr "" (sc-mail-field "sc-author") " ") | |
1560 (or (sc-hdr "<" (sc-mail-field "sc-from-address") ">" t) | |
1561 (sc-hdr "<" (sc-mail-field "sc-reply-address") ">" t) | |
1562 "") | |
1563 " writes:\n")))) | |
1564 | |
1565 (defun sc-header-author-writes () | |
1566 "<sc-author> writes:" | |
1567 (let ((sc-mumble "") | |
1568 (whofrom (sc-whofrom))) | |
1569 (if whofrom | |
1570 (insert sc-reference-tag-string | |
1571 (sc-hdr "" (sc-mail-field "sc-author")) | |
1572 " writes:\n")))) | |
1573 | |
1574 (defun sc-header-verbose () | |
1575 "Very verbose, some say gross." | |
1576 (let ((sc-mumble "") | |
1577 (whofrom (sc-whofrom)) | |
1578 (tag sc-reference-tag-string)) | |
1579 (if whofrom | |
1580 (insert (sc-hdr (concat tag "On ") (sc-mail-field "date") ",\n") | |
1581 (or (sc-hdr tag (sc-mail-field "sc-author") "\n" t) | |
1582 (concat tag whofrom "\n")) | |
1583 (sc-hdr (concat tag "from the organization of ") | |
1584 (sc-mail-field "organization") "\n") | |
1585 (let ((rtag (concat tag "who can be reached at: "))) | |
1586 (or (sc-hdr rtag (sc-mail-field "sc-from-address") "\n" t) | |
1587 (sc-hdr rtag (sc-mail-field "sc-reply-address") "\n" t) | |
1588 "")) | |
1589 (sc-hdr | |
1590 (concat tag "(whose comments are cited below with \"") | |
1591 (sc-mail-field "sc-citation") "\"),\n") | |
1592 (sc-hdr (concat tag "had this to say in article ") | |
1593 (sc-mail-field "message-id") "\n") | |
1594 (sc-hdr (concat tag "in newsgroups ") | |
1595 (sc-mail-field "newsgroups") "\n") | |
1596 (sc-hdr (concat tag "concerning the subject of ") | |
1597 (sc-mail-field "subject") "\n") | |
1598 (sc-hdr (concat tag "(see ") | |
1599 (sc-mail-field "references") | |
1600 " for more details)\n") | |
1601 )))) | |
1602 | |
1603 | |
1604 ;; ====================================================================== | |
1605 ;; header rewrites | |
1606 | |
1607 (defconst sc-electric-bufname " *sc-erefs* " | |
1608 "Supercite electric reference mode's buffer name.") | |
1609 (defvar sc-eref-style 0 | |
1610 "Current electric reference style.") | |
1611 | |
1612 (defun sc-valid-index-p (index) | |
1613 "Returns INDEX if it is a valid index into `sc-rewrite-header-list'. | |
1614 Otherwise returns nil." | |
1615 ;; a number, and greater than or equal to zero | |
1616 ;; less than or equal to the last index | |
1617 (and (natnump index) | |
1618 (< index (length sc-rewrite-header-list)) | |
1619 index)) | |
1620 | |
1621 (defun sc-eref-insert-selected (&optional nomsg) | |
1622 "Insert the selected reference header in the current buffer. | |
1623 Optional NOMSG, if non-nil, inhibits printing messages, unless an | |
1624 error occurs." | |
1625 (let ((ref (nth sc-eref-style sc-rewrite-header-list))) | |
1626 (condition-case err | |
1627 (progn | |
1628 (eval ref) | |
1629 (let ((lines (count-lines (point-min) (point-max)))) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
43791
diff
changeset
|
1630 (or nomsg (message "Ref header %d [%d line%s]: %s" |
4850 | 1631 sc-eref-style lines |
1632 (if (= lines 1) "" "s") | |
1633 ref)))) | |
1634 (void-function | |
1635 (progn (message | |
1636 "Symbol's function definition is void: %s (Header %d)" | |
1637 (car (cdr err)) sc-eref-style) | |
1638 (beep) | |
1639 )) | |
1640 ))) | |
1641 | |
1642 (defun sc-electric-mode (&optional arg) | |
1643 " | |
1644 Mode for viewing Supercite reference headers. Commands are: | |
1645 \n\\{sc-electric-mode-map} | |
1646 | |
1647 `sc-electric-mode' is not intended to be run interactively, but rather | |
1648 accessed through Supercite's electric reference feature. See | |
1649 `sc-insert-reference' for more details. Optional ARG is the initial | |
1650 header style to use, unless not supplied or invalid, in which case | |
1651 `sc-preferred-header-style' is used." | |
1652 | |
1653 (let ((info sc-mail-info)) | |
1654 | |
1655 (setq sc-eref-style | |
1656 (or (sc-valid-index-p arg) | |
1657 (sc-valid-index-p sc-preferred-header-style) | |
1658 0)) | |
1659 | |
1660 (get-buffer-create sc-electric-bufname) | |
1661 ;; set up buffer and enter command loop | |
1662 (save-excursion | |
1663 (save-window-excursion | |
1664 (pop-to-buffer sc-electric-bufname) | |
1665 (kill-all-local-variables) | |
1666 (let ((sc-mail-info info) | |
1667 (buffer-read-only t) | |
1668 (mode-name "SC Electric Refs") | |
1669 (major-mode 'sc-electric-mode)) | |
1670 (use-local-map sc-electric-mode-map) | |
1671 (sc-eref-show sc-eref-style) | |
62765
db1434c1a2f5
(sc-electric-mode): Use run-mode-hooks.
Lute Kamstra <lute@gnu.org>
parents:
62315
diff
changeset
|
1672 (run-mode-hooks 'sc-electric-mode-hook) |
4850 | 1673 (recursive-edit) |
1674 ))) | |
1675 | |
1676 (and sc-eref-style | |
1677 (sc-eref-insert-selected)) | |
1678 (kill-buffer sc-electric-bufname) | |
1679 )) | |
1680 | |
1681 ;; functions for electric reference mode | |
1682 (defun sc-eref-show (index) | |
1683 "Show reference INDEX in `sc-rewrite-header-list'." | |
1684 (let ((msg "No %ing reference headers in list.") | |
1685 (last (length sc-rewrite-header-list))) | |
1686 (setq sc-eref-style | |
1687 (cond | |
1688 ((sc-valid-index-p index) index) | |
1689 ((< index 0) | |
1690 (if sc-electric-circular-p | |
1691 (1- last) | |
1692 (progn (error msg "preced") 0))) | |
1693 ((>= index last) | |
1694 (if sc-electric-circular-p | |
1695 0 | |
1696 (progn (error msg "follow") (1- last)))) | |
1697 )) | |
1698 (save-excursion | |
1699 (set-buffer sc-electric-bufname) | |
1700 (let ((buffer-read-only nil)) | |
1701 (erase-buffer) | |
1702 (goto-char (point-min)) | |
1703 (sc-eref-insert-selected) | |
1704 ;; now shrink the window to just contain the electric reference | |
1705 ;; header. | |
1706 (let ((hdrlines (count-lines (point-min) (point-max))) | |
1707 (winlines (1- (window-height)))) | |
1708 (if (/= hdrlines winlines) | |
1709 (if (> hdrlines winlines) | |
1710 ;; we have to enlarge the window | |
1711 (enlarge-window (- hdrlines winlines)) | |
1712 ;; we have to shrink the window | |
1713 (shrink-window (- winlines (max hdrlines window-min-height))) | |
1714 ))) | |
1715 )))) | |
1716 | |
1717 (defun sc-eref-next () | |
1718 "Display next reference in other buffer." | |
1719 (interactive) | |
1720 (sc-eref-show (1+ sc-eref-style))) | |
1721 | |
1722 (defun sc-eref-prev () | |
1723 "Display previous reference in other buffer." | |
1724 (interactive) | |
1725 (sc-eref-show (1- sc-eref-style))) | |
1726 | |
1727 (defun sc-eref-setn () | |
1728 "Set reference header selected as preferred." | |
1729 (interactive) | |
1730 (setq sc-preferred-header-style sc-eref-style) | |
1731 (message "Preferred reference style set to header %d." sc-eref-style)) | |
1732 | |
1733 (defun sc-eref-goto (refnum) | |
1734 "Show reference style indexed by REFNUM. | |
1735 If REFNUM is an invalid index, don't go to that reference and return | |
1736 nil." | |
1737 (interactive "NGoto Reference: ") | |
1738 (if (sc-valid-index-p refnum) | |
1739 (sc-eref-show refnum) | |
1740 (error "Invalid reference: %d. (Range: [%d .. %d])" | |
1741 refnum 0 (1- (length sc-rewrite-header-list))) | |
1742 )) | |
1743 | |
1744 (defun sc-eref-jump () | |
1745 "Set reference header to preferred header." | |
1746 (interactive) | |
1747 (sc-eref-show sc-preferred-header-style)) | |
1748 | |
1749 (defun sc-eref-abort () | |
1750 "Exit from electric reference mode without inserting reference." | |
1751 (interactive) | |
1752 (setq sc-eref-style nil) | |
1753 (exit-recursive-edit)) | |
1754 | |
1755 (defun sc-eref-exit () | |
1756 "Exit from electric reference mode and insert selected reference." | |
1757 (interactive) | |
1758 (exit-recursive-edit)) | |
1759 | |
1760 (defun sc-insert-reference (arg) | |
1761 "Insert, at point, a reference header in the body of the reply. | |
1762 Numeric ARG indicates which header style from `sc-rewrite-header-list' | |
1763 to use when rewriting the header. No supplied ARG indicates use of | |
1764 `sc-preferred-header-style'. | |
1765 | |
1766 With just `\\[universal-argument]', electric reference insert mode is | |
1767 entered, regardless of the value of `sc-electric-references-p'. See | |
1768 `sc-electric-mode' for more information." | |
1769 (interactive "P") | |
1770 (if (consp arg) | |
1771 (sc-electric-mode) | |
1772 (let ((preference (or (sc-valid-index-p arg) | |
1773 (sc-valid-index-p sc-preferred-header-style) | |
1774 sc-preferred-header-style | |
1775 0))) | |
1776 (if sc-electric-references-p | |
1777 (sc-electric-mode preference) | |
1778 (sc-eref-insert-selected t) | |
1779 )))) | |
1780 | |
1781 | |
1782 ;; ====================================================================== | |
1783 ;; variable toggling | |
1784 | |
1785 (defun sc-raw-mode-toggle () | |
1786 "Toggle, in one fell swoop, two important SC variables: | |
1787 `sc-fixup-whitespace-p' and `sc-auto-fill-region-p'" | |
1788 (interactive) | |
1789 (setq sc-fixup-whitespace-p (not sc-fixup-whitespace-p) | |
1790 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
|
1791 (force-mode-line-update)) |
4850 | 1792 |
1793 (defun sc-toggle-var (variable) | |
1794 "Boolean toggle VARIABLE's value. | |
42206 | 1795 VARIABLE must be a bound symbol. nil values change to t, non-nil |
4850 | 1796 values are changed to nil." |
1797 (message "%s changed from %s to %s" | |
1798 variable (symbol-value variable) | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1799 (set variable (not (symbol-value variable))))) |
4850 | 1800 |
1801 (defun sc-set-variable (var) | |
1802 "Set the Supercite VARIABLE. | |
1803 This function mimics `set-variable', except that the variable to set | |
1804 is determined non-interactively. The value is queried for in the | |
1805 minibuffer exactly the same way that `set-variable' does it. | |
1806 | |
1807 You can see the current value of the variable when the minibuffer is | |
1808 querying you by typing `C-h'. Note that the format is changed | |
1809 slightly from that used by `set-variable' -- the current value is | |
1810 printed just after the variable's name instead of at the bottom of the | |
1811 help window." | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1812 (let* ((minibuffer-help-form '(funcall myhelp)) |
4850 | 1813 (myhelp |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1814 (lambda () |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1815 (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
|
1816 (prin1 var) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1817 (if (boundp var) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1818 (let ((print-length 20)) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1819 (princ "\t(Current value: ") |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1820 (prin1 (symbol-value var)) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1821 (princ ")"))) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1822 (princ "\n\nDocumentation:\n") |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1823 (princ (substring (documentation-property |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1824 var |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1825 'variable-documentation) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1826 1)) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1827 (with-current-buffer standard-output |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1828 (help-mode)) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1829 nil)))) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1830 (set var (eval-minibuffer (format "Set %s to value: " var))))) |
4850 | 1831 |
1832 (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
|
1833 `(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
|
1834 (interactive) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1835 (sc-toggle-var ',(intern (concat "sc-" rootname "-p"))))) |
4850 | 1836 |
1837 (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
|
1838 `(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
|
1839 (interactive) |
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1840 (sc-set-variable ',(intern (concat "sc-" rootname))))) |
4850 | 1841 |
1842 (sc-toggle-symbol "confirm-always") | |
1843 (sc-toggle-symbol "downcase") | |
1844 (sc-toggle-symbol "electric-references") | |
1845 (sc-toggle-symbol "auto-fill-region") | |
1846 (sc-toggle-symbol "mail-nuke-blank-lines") | |
1847 (sc-toggle-symbol "nested-citation") | |
1848 (sc-toggle-symbol "electric-circular") | |
1849 (sc-toggle-symbol "use-only-preferences") | |
1850 (sc-toggle-symbol "fixup-whitespace") | |
1851 | |
1852 (sc-setvar-symbol "preferred-attribution-list") | |
1853 (sc-setvar-symbol "preferred-header-style") | |
1854 (sc-setvar-symbol "mail-nuke-mail-headers") | |
1855 (sc-setvar-symbol "mail-header-nuke-list") | |
1856 (sc-setvar-symbol "cite-region-limit") | |
1857 | |
1858 (defun sc-T-describe () | |
1859 " | |
1860 | |
1861 Supercite provides a number of key bindings which simplify the process | |
1862 of setting or toggling certain variables controlling its operation. | |
1863 | |
1864 Note on function names in this list: all functions of the form | |
1865 `sc-S-<name>' actually call `sc-set-variable' on the corresponding | |
1866 `sc-<name>' variable. All functions of the form `sc-T-<name>' call | |
1867 `sc-toggle-var' on the corresponding `sc-<name>-p' variable. | |
1868 | |
1869 \\{sc-T-keymap}" | |
1870 (interactive) | |
1871 (describe-function 'sc-T-describe)) | |
1872 | |
1873 | |
1874 ;; ====================================================================== | |
1875 ;; published interface to mail and news readers | |
1876 | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1877 (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
|
1878 "Supercite minor mode." |
61282
73d56a93d9fd
(sc-minor-mode): Specify :group.
Lute Kamstra <lute@gnu.org>
parents:
61044
diff
changeset
|
1879 :group 'supercite |
73d56a93d9fd
(sc-minor-mode): Specify :group.
Lute Kamstra <lute@gnu.org>
parents:
61044
diff
changeset
|
1880 :lighter (" SC" (sc-auto-fill-region-p |
73d56a93d9fd
(sc-minor-mode): Specify :group.
Lute Kamstra <lute@gnu.org>
parents:
61044
diff
changeset
|
1881 (":f" (sc-fixup-whitespace-p "w")) |
73d56a93d9fd
(sc-minor-mode): Specify :group.
Lute Kamstra <lute@gnu.org>
parents:
61044
diff
changeset
|
1882 (sc-fixup-whitespace-p ":w"))) |
73d56a93d9fd
(sc-minor-mode): Specify :group.
Lute Kamstra <lute@gnu.org>
parents:
61044
diff
changeset
|
1883 :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
|
1884 |
7370
ecb09a00d330
(sc-cite-original): Add autoload.
Richard M. Stallman <rms@gnu.org>
parents:
5286
diff
changeset
|
1885 ;;;###autoload |
4850 | 1886 (defun sc-cite-original () |
1887 "Workhorse citing function which performs the initial citation. | |
1888 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
|
1889 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
|
1890 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
|
1891 `sc-cite-original' does not do any yanking of the |
4850 | 1892 original message but it does require a few things: |
1893 | |
1894 1) The reply buffer is the current buffer. | |
1895 | |
1896 2) The original message has been yanked and inserted into the | |
1897 reply buffer. | |
1898 | |
1899 3) Verbose mail headers from the original message have been | |
1900 inserted into the reply buffer directly before the text of the | |
1901 original message. | |
1902 | |
1903 4) Point is at the beginning of the verbose headers. | |
1904 | |
1905 5) Mark is at the end of the body of text to be cited. | |
1906 | |
92244 | 1907 The region need not be active (and typically isn't when this |
1908 function is called). Also, the hook `sc-pre-hook' is run before, | |
1909 and `sc-post-hook' is run after the guts of this function." | |
4850 | 1910 (run-hooks 'sc-pre-hook) |
1911 | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1912 (sc-minor-mode 1) |
4850 | 1913 |
1914 (undo-boundary) | |
1915 | |
1916 ;; grab point and mark since the region is probably not active when | |
1917 ;; this function gets automatically called. we want point to be a | |
1918 ;; 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
|
1919 (let* ((zmacs-regions nil) ; for XEemacs |
24876 | 1920 (mark-active t) ; for Emacs |
4850 | 1921 (point (point-marker)) |
1922 (mark (copy-marker (mark-marker)))) | |
49598
0d8b17d428b5
Trailing whitepace deleted.
Juanma Barranquero <lekktu@gmail.com>
parents:
43791
diff
changeset
|
1923 |
4850 | 1924 ;; make sure point comes before mark, not all functions are |
1925 ;; interactive "r" | |
1926 (if (< mark point) | |
1927 (let ((tmp point)) | |
1928 (setq point mark | |
1929 mark tmp))) | |
1930 | |
1931 ;; first process mail headers, and populate sc-mail-info | |
1932 (sc-mail-process-headers point mark) | |
1933 | |
1934 ;; now get possible attributions | |
1935 (sc-attribs-chop-address (or (sc-mail-field "from") | |
1936 (sc-mail-field "reply") | |
1937 (sc-mail-field "reply-to") | |
1938 (sc-mail-field "sender"))) | |
1939 ;; select the attribution | |
1940 (sc-select-attribution) | |
1941 | |
1942 ;; cite the region, but first check the value of sc-cite-region-limit | |
1943 (let ((linecnt (count-lines point mark))) | |
1944 (and sc-cite-region-limit | |
1945 (if (or (not (numberp sc-cite-region-limit)) | |
1946 (<= linecnt sc-cite-region-limit)) | |
1947 (progn | |
1948 ;; cite the region and insert the header rewrite | |
1949 (sc-cite-region point mark) | |
1950 (goto-char point) | |
1951 (let ((sc-eref-style (or sc-preferred-header-style 0))) | |
1952 (if sc-electric-references-p | |
1953 (sc-electric-mode sc-eref-style) | |
1954 (sc-eref-insert-selected t)))) | |
1955 (beep) | |
1956 (message | |
1957 "Region not cited. %d lines exceeds sc-cite-region-limit: %d" | |
1958 linecnt sc-cite-region-limit)))) | |
1959 | |
1960 ;; finally, free the point-marker | |
1961 (set-marker point nil) | |
1962 (set-marker mark nil) | |
1963 ) | |
51174
26b66dee5902
Use `push' and replace `regi-pos' by equivalents.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
50759
diff
changeset
|
1964 (run-hooks 'sc-post-hook)) |
4850 | 1965 |
1966 | |
1967 ;; ====================================================================== | |
1968 ;; bug reporting and miscellaneous commands | |
1969 | |
1970 (defun sc-open-line (arg) | |
1971 "Like `open-line', but insert the citation prefix at the front of the line. | |
1972 With numeric ARG, inserts that many new lines." | |
1973 (interactive "p") | |
1974 (save-excursion | |
1975 (let ((start (point)) | |
1976 (prefix (or (progn (beginning-of-line) | |
1977 (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
|
1978 (match-string 0))) |
4850 | 1979 ""))) |
1980 (goto-char start) | |
1981 (open-line arg) | |
1982 (forward-line 1) | |
1983 (while (< 0 arg) | |
1984 (insert prefix) | |
1985 (forward-line 1) | |
92244 | 1986 (setq arg (1- arg)))))) |
4850 | 1987 |
1988 (defun sc-insert-citation (arg) | |
1989 "Insert citation string at beginning of current line if not already cited. | |
1990 With `\\[universal-argument]' insert citation even if line is already | |
1991 cited." | |
1992 (interactive "P") | |
1993 (save-excursion | |
1994 (beginning-of-line) | |
1995 (if (or (not (looking-at (sc-cite-regexp))) | |
1996 (looking-at "^[ \t]*$") | |
1997 (consp arg)) | |
1998 (insert (sc-mail-field "sc-citation")) | |
38436
b174db545cfd
Some fixes to follow coding conventions.
Pavel Janík <Pavel@Janik.cz>
parents:
28437
diff
changeset
|
1999 (error "Line is already cited")))) |
4850 | 2000 |
57933
59c9a776a021
(sc-cite-region): Don't use interactive-p. Add arg INTERACTIVE.
Richard M. Stallman <rms@gnu.org>
parents:
57160
diff
changeset
|
2001 (defun sc-version (message) |
4850 | 2002 "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
|
2003 If MESSAGE is non-nil (interactively, with no prefix argument), |
4850 | 2004 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
|
2005 (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
|
2006 (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
|
2007 (if message |
59c9a776a021
(sc-cite-region): Don't use interactive-p. Add arg INTERACTIVE.
Richard M. Stallman <rms@gnu.org>
parents:
57160
diff
changeset
|
2008 (message verstr) |
59c9a776a021
(sc-cite-region): Don't use interactive-p. Add arg INTERACTIVE.
Richard M. Stallman <rms@gnu.org>
parents:
57160
diff
changeset
|
2009 (insert "`sc-version' says: " verstr)))) |
4850 | 2010 |
92244 | 2011 (make-obsolete 'sc-version 'emacs-version "23.1") |
2012 | |
4850 | 2013 (defun sc-describe () |
92244 | 2014 "Read the Supercite info node." |
4850 | 2015 (interactive) |
92244 | 2016 (info "(SC)top")) |
2017 | |
92263
90dd1f6122b5
(sc-describe): Fix typos in obsolescence declaration.
Juanma Barranquero <lekktu@gmail.com>
parents:
92244
diff
changeset
|
2018 (make-obsolete 'sc-describe "read the SC manual using `info'." "23.1") |
4850 | 2019 |
86532
c44e4015b517
Delete meaningless header keys.
Glenn Morris <rgm@gnu.org>
parents:
84957
diff
changeset
|
2020 (define-obsolete-function-alias 'sc-submit-bug-report 'report-emacs-bug "23.1") |
4850 | 2021 |
2022 | |
2023 ;; useful stuff | |
2024 (provide 'supercite) | |
2025 (run-hooks 'sc-load-hook) | |
2026 | |
61044
17207b620cf3
(sc-mail-field): Use assoc-string.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
60924
diff
changeset
|
2027 ;; arch-tag: a5d5bfa6-3bd5-4414-8c65-0afc83e45cd3 |
4850 | 2028 ;;; supercite.el ends here |