annotate lisp/=superyank.el @ 162:6de3e4609f2c

*** empty log message ***
author Jim Blandy <jimb@redhat.com>
date Sun, 13 Jan 1991 21:49:51 +0000
parents ce5567c47b8f
children 4cd7543be581
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
28
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1 ;; superyank.el -- Version 1.1
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
2 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
3 ;; Inserts the message being replied to with various user controlled
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
4 ;; citation styles.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
5 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
6
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
7 ;; This file is distributed in the hope that it will be useful,
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
8 ;; but WITHOUT ANY WARRANTY. No author or distributor
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
9 ;; accepts responsibility to anyone for the consequences of using it
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
10 ;; or for whether it serves any particular purpose or works at all,
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
11 ;; unless he says so in writing. Refer to the GNU Emacs General Public
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
12 ;; License for full details.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
13
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
14 ;; Everyone is granted permission to copy, modify and redistribute
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
15 ;; this file, but only under the conditions described in the
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
16 ;; GNU Emacs General Public License. A copy of this license is
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
17 ;; supposed to have been given to you along with GNU Emacs so you
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
18 ;; can know your rights and responsibilities. It should be in a
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
19 ;; file named COPYING. Among other things, the copyright notice
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
20 ;; and this notice must be preserved on all copies.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
21
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
22 ;; NAME: Barry A. Warsaw USMAIL: National Institute of Standards
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
23 ;; TELE: (301) 975-3460 and Technology (formerly NBS)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
24 ;; UUCP: {...}!uunet!cme-durer!warsaw Rm. B-124, Bldg. 220
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
25 ;; ARPA: warsaw@cme.nist.gov Gaithersburg, MD 20899
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
26
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
27 ;; Modification history:
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
28 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
29 ;; modified: 14-Jun-1989 baw (better keymap set procedure, rewrite-headers)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
30 ;; modified: 12-Jun-1989 baw (added defvar for sy-use-only-preference-p)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
31 ;; modified: 6-Jun-1989 baw (better sy-rewrite-headers, no kill/yank)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
32 ;; modified: 5-Jun-1989 baw (requires rnewspost.el)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
33 ;; modified: 1-Jun-1989 baw (persistent attribution, sy-open-line)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
34 ;; modified: 31-May-1989 baw (fixed some gnus problems, id'd another)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
35 ;; modified: 22-May-1989 baw (documentation)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
36 ;; modified: 8-May-1989 baw (auto filling of regions)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
37 ;; modified: 1-May-1989 baw (documentation)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
38 ;; modified: 27-Apr-1989 baw (new preference scheme)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
39 ;; modified: 24-Apr-1989 baw (remove gnus headers, attrib scheme, cite lines)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
40 ;; modified: 19-Apr-1989 baw (cite key, fill p, yank region, naming scheme)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
41 ;; modified: 12-Apr-1989 baw (incorp other mail yank features seen on net)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
42 ;; created : 16-Feb-1989 baw (mod vanilla fn indent-rigidly mail-yank-original)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
43
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
44 ;; Though I wrote this package basically from scratch, as an elisp
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
45 ;; learning exercise, it was inspired by postings of similar packages to
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
46 ;; the gnu.emacs newsgroup over the past month or so.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
47 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
48 ;; Here's a brief history of how this package developed:
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
49 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
50 ;; I as well as others on the net were pretty unhappy about the way emacs
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
51 ;; cited replies with the tab or 4 spaces. It looked ugly and made it hard
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
52 ;; to distinguish between original and cited lines. I hacked on the function
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
53 ;; yank-original to at least give the user the ability to define the citation
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
54 ;; character. I posted this simple hack, and others did as well. The main
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
55 ;; difference between mine and others was that a space was put after the
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
56 ;; citation string on on new citations, but not after previously cited lines:
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
57 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
58 ;; >> John wrote this originally
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
59 ;; > Jane replied to that
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
60 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
61 ;; Then Martin Neitzel posted some code that he developed, derived in part
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
62 ;; from code that Ashwin Ram posted previous to that. In Martin's
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
63 ;; posting, he introduced a new, and (IMHO) superior, citation style,
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
64 ;; eliminating nested citations. Yes, I wanted to join the Small-But-
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
65 ;; Growing-Help-Stamp-Out-Nested-Citation-Movement! You should too.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
66 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
67 ;; But Martin's code simply asks the user for the citation string (here
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
68 ;; after called the `attribution' string), and I got to thinking, it wouldn't
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
69 ;; be that difficult to automate that part. So I started hacking this out.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
70 ;; It proved to be not as simple as I first thought. But anyway here it
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
71 ;; is. See the wish list below for future plans (if I have time).
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
72 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
73 ;; Type "C-h f mail-yank-original" after this package is loaded to get a
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
74 ;; description of what it does and the variables that control it.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
75 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
76 ;; ======================================================================
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
77 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
78 ;; Changes wish list
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
79 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
80 ;; 1) C-x C-s yanks a region from the RMAIL buffer instead of the
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
81 ;; whole buffer
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
82 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
83 ;; 2) reparse nested citations to try to recast as non-nested citations
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
84 ;; perhaps by checking the References: line
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
85 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
86 ;; ======================================================================
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
87 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
88 ;; require and provide features
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
89 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
90 (require 'sendmail)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
91 (provide 'superyank)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
92
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
93 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
94 ;; ======================================================================
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
95 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
96 ;; don't need rnewspost.el to rewrite the header. This only works
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
97 ;; with diffs to rnewspost.el that I posted with the original
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
98 ;; superyank code.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
99 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
100 (setq news-reply-header-hook nil)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
101
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
102 ;; **********************************************************************
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
103 ;; start of user defined variables
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
104 ;; **********************************************************************
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
105 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
106 ;; this section defines variables that control the operation of
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
107 ;; super-mail-yank. Most of these are described in the comment section
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
108 ;; as well as the DOCSTRING.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
109 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
110
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
111 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
112 ;; ----------------------------------------------------------------------
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
113 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
114 ;; this variable holds the default author's name for citations
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
115 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
116 (defvar sy-default-attribution "Anon"
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
117 "String that describes attribution to unknown person. This string
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
118 should not contain the citation string.")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
119
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
120 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
121 ;; ----------------------------------------------------------------------
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
122 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
123 ;; string used as an end delimiter for both nested and non-nested citations
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
124 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
125 (defvar sy-citation-string ">"
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
126 "String to use as an end-delimiter for citations. This string is
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
127 used in both nested and non-nested citations. For best results, use a
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
128 single character with no trailing space. Most commonly used string
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
129 is: \">\.")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
130
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
131 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
132 ;; ----------------------------------------------------------------------
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
133 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
134 ;; variable controlling citation type, nested or non-nested
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
135 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
136 (defvar sy-nested-citation-p nil
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
137 "Non-nil uses nested citations, nil uses non-nested citations.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
138 Nested citations are of the style:
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
139
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
140 I wrote this
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
141 > He wrote this
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
142 >> She replied to something he wrote
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
143
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
144 Non-nested citations are of the style:
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
145
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
146 I wrote this
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
147 John> He wrote this
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
148 Jane> She originally wrote this")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
149
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
150
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
151 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
152 ;; ----------------------------------------------------------------------
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
153 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
154 ;; regular expression that matches existing citations
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
155 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
156 (defvar sy-cite-regexp "[a-zA-Z0-9]*>"
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
157 "Regular expression that describes how an already cited line in an
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
158 article begins. The regexp is only used at the beginning of a line,
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
159 so it doesn't need to begin with a '^'.")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
160
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
161 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
162 ;; ----------------------------------------------------------------------
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
163 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
164 ;; regular expression that delimits names from titles in the field that
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
165 ;; looks like: (John X. Doe -- Computer Hacker Extraordinaire)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
166 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
167 (defvar sy-titlecue-regexp "\\s +-+\\s +"
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
168
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
169 "Regular expression that delineates names from titles in the name
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
170 field. Often, people will set up their name field to look like this:
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
171
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
172 (John Xavier Doe -- Computer Hacker Extraordinaire)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
173
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
174 Set to nil to treat entire field as a name.")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
175
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
176 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
177 ;; ----------------------------------------------------------------------
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
178 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
179 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
180 (defvar sy-preferred-attribution 2
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
181
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
182 "This is an integer indicating what the user's preference is in
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
183 attribution style, based on the following key:
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
184
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
185 0: email address name is preferred
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
186 1: initials are preferred
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
187 2: first name is preferred
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
188 3: last name is preferred
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
189
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
190 The value of this variable may also be greater than 3, which would
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
191 allow you to prefer the 2nd through nth - 1 name. If the preferred
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
192 attribution is nil or the empty string, then the secondary preferrence
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
193 will be the first name. After that, the entire name alist is search
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
194 until a non-empty, non-nil name is found. If no such name is found,
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
195 then the user is either queried or the default attribution string is
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
196 used depending on the value of sy-confirm-always-p.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
197
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
198 Examples:
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
199
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
200 assume the from: line looks like this:
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
201
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
202 from: doe@computer.some.where.com (John Xavier Doe)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
203
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
204 The following preferences would return these strings:
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
205
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
206 0: \"doe\"
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
207 1: \"JXD\"
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
208 2: \"John\"
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
209 3: \"Doe\"
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
210 4: \"Xavier\"
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
211
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
212 anything else would return \"John\".")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
213
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
214 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
215 ;; ----------------------------------------------------------------------
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
216 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
217 (defvar sy-confirm-always-p t
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
218 "If t, always confirm attribution string before inserting into
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
219 buffer.")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
220
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
221
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
222 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
223 ;; ----------------------------------------------------------------------
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
224 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
225 ;; informative header hook
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
226 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
227 (defvar sy-rewrite-header-hook 'sy-header-on-said
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
228 "Hook for inserting informative header at the top of the yanked
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
229 message. Set to nil for no header. Here is a list of predefined
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
230 header styles; you can use these as a model to write you own:
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
231
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
232 sy-header-on-said [default]: On 14-Jun-1989 GMT,
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
233 John Xavier Doe said:
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
234
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
235 sy-header-inarticle-writes: In article <123456789> John Xavier Doe writes:
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
236
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
237 sy-header-regarding-writes: Regarding RE: superyank; John Xavier Doe adds:
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
238
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
239 sy-header-verbose: On 14-Jun-1989 GMT, John Xavier Doe
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
240 from the organization Great Company
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
241 has this to say about article <123456789>
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
242 in newsgroups misc.misc
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
243 concerning RE: superyank
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
244 referring to previous articles <987654321>
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
245
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
246 You can use the following variables as information strings in your header:
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
247
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
248 sy-reply-yank-date: the date field [ex: 14-Jun-1989 GMT]
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
249 sy-reply-yank-from: the from field [ex: John Xavier Doe]
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
250 sy-reply-yank-message-id: the message id [ex: <123456789>]
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
251 sy-reply-yank-subject: the subject line [ex: RE: superyank]
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
252 sy-reply-yank-newsgroup: the newsgroup name for GNUS [ex: misc.misc]
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
253 sy-reply-yank-references: the article references [ex: <987654321>]
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
254 sy-reply-yank-organization: the author's organization [ex: Great Company]
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
255
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
256 If a field can't be found, because it doesn't exist or is not being
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
257 shown, perhaps because of toggle-headers, the corresponding field
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
258 variable will contain the string \"mumble mumble\".")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
259
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
260 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
261 ;; ----------------------------------------------------------------------
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
262 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
263 ;; non-nil means downcase the author's name string
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
264 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
265 (defvar sy-downcase-p nil
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
266 "Non-nil means downcase the author's name string.")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
267
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
268 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
269 ;; ----------------------------------------------------------------------
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
270 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
271 ;; controls removal of leading white spaces
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
272 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
273 (defvar sy-left-justify-p nil
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
274 "If non-nil, delete all leading white space before citing.")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
275
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
276 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
277 ;; ----------------------------------------------------------------------
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
278 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
279 ;; controls auto filling of region
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
280 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
281 (defvar sy-auto-fill-region-p nil
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
282 "If non-nil, automatically fill each paragraph that is cited. If
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
283 nil, do not auto fill each paragraph.")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
284
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
285
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
286 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
287 ;; ----------------------------------------------------------------------
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
288 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
289 ;; controls use of preferred attribution only, or use of attribution search
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
290 ;; scheme if the preferred attrib can't be found.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
291 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
292 (defvar sy-use-only-preference-p nil
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
293
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
294 "If non-nil, then only the preferred attribution string will be
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
295 used. If the preferred attribution string can not be found, then the
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
296 sy-default-attribution will be used. If nil, and the preferred
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
297 attribution string is not found, then some secondary scheme will be
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
298 employed to find a suitable attribution string.")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
299
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
300 ;; **********************************************************************
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
301 ;; end of user defined variables
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
302 ;; **********************************************************************
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
303
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
304 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
305 ;; ----------------------------------------------------------------------
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
306 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
307 ;; The new citation style means we can clean out other headers in addition
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
308 ;; to those previously cleaned out. Anyway, we create our own headers.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
309 ;; Also, we want to clean out any headers that gnus puts in. Add to this
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
310 ;; for other mail or news readers you may be using.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
311 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
312 (setq mail-yank-ignored-headers "^via:\\|^origin:\\|^status:\\|^re\\(mail\\|ceiv\\)ed\\|^[a-z-]*message-id:\\|^\\(summary-\\)?line[s]?:\\|^cc:\\|^subject:\\|^\\(\\(in-\\)?reply-\\)?to:\\|^\\(\\(return\\|reply\\)-\\)?path:\\|^\\(posted-\\)?date:\\|^\\(mail-\\)?from:\\|^newsgroup[s]?:\\|^organization:\\|^keywords:\\|^distribution:\\|^references:")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
313
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
314 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
315 ;; ----------------------------------------------------------------------
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
316 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
317 ;; global variables, not user accessable
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
318 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
319 (setq sy-persist-attribution (concat sy-default-attribution "> "))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
320 (setq sy-reply-yank-date "")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
321 (setq sy-reply-yank-from "")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
322 (setq sy-reply-yank-message-id "")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
323 (setq sy-reply-yank-subject "")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
324 (setq sy-reply-yank-newsgroups "")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
325 (setq sy-reply-yank-references "")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
326 (setq sy-reply-yank-organization "")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
327
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
328 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
329 ;; ======================================================================
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
330 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
331 ;; This section contains primitive functions used in the schemes. They
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
332 ;; extract name fields from various parts of the "from:" field based on
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
333 ;; the control variables described above.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
334 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
335 ;; Some will use recursion to pick out the correct namefield in the namestring
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
336 ;; or the list of initials. These functions all scan a string that contains
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
337 ;; the name, ie: "John Xavier Doe". There is no limit on the number of names
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
338 ;; in the string. Also note that all white spaces are basically ignored and
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
339 ;; are stripped from the returned strings, and titles are ignored if
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
340 ;; sy-titlecue-regexp is set to non-nil.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
341 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
342 ;; Others will use methods to try to extract the name from the email
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
343 ;; address of the originator. The types of addresses readable are
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
344 ;; described above.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
345
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
346 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
347 ;; ----------------------------------------------------------------------
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
348 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
349 ;; try to extract the name from an email address of the form
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
350 ;; name%[stuff]
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
351 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
352 ;; Unlike the get-name functions above, these functions operate on the
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
353 ;; buffer instead of a supplied name-string.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
354 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
355 (defun sy-%-style-address ()
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
356 (beginning-of-line)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
357 (buffer-substring
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
358 (progn (re-search-forward "%" (point-max) t)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
359 (if (not (bolp)) (forward-char -1))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
360 (point))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
361 (progn (re-search-backward "^\\|[^a-zA-Z0-9]")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
362 (point))))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
363
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
364 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
365 ;; ----------------------------------------------------------------------
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
366 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
367 ;; try to extract names from addresses with the form:
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
368 ;; [stuff]name@[stuff]
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
369 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
370 (defun sy-@-style-address ()
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
371 (beginning-of-line)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
372 (buffer-substring
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
373 (progn (re-search-forward "@" (point-max) t)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
374 (if (not (bolp)) (forward-char -1))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
375 (point))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
376 (progn (re-search-backward "^\\|[^a-zA-Z0-0]")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
377 (if (not (bolp)) (forward-char 1))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
378 (point))))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
379
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
380 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
381 ;; ----------------------------------------------------------------------
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
382 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
383 ;; try to extract the name from addresses with the form:
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
384 ;; [stuff]![stuff]...!name[stuff]
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
385 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
386 (defun sy-!-style-address ()
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
387 (beginning-of-line)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
388 (buffer-substring
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
389 (progn (while (re-search-forward "!" (point-max) t))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
390 (point))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
391 (progn (re-search-forward "[^a-zA-Z0-9]\\|$")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
392 (if (not (eolp)) (forward-char -1))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
393 (point))))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
394
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
395 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
396 ;; ----------------------------------------------------------------------
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
397 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
398 ;; using the different email name schemes, try each one until you get a
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
399 ;; non-nil entry
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
400 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
401 (defun sy-get-emailname ()
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
402 (let ((en1 (sy-%-style-address))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
403 (en2 (sy-@-style-address))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
404 (en3 (sy-!-style-address)))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
405 (cond
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
406 ((not (string-equal en1 "")) en1)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
407 ((not (string-equal en2 "")) en2)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
408 ((not (string-equal en3 "")) en3)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
409 (t ""))))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
410
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
411 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
412 ;; ----------------------------------------------------------------------
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
413 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
414 ;; returns the "car" of the namestring, really the first namefield
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
415 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
416 ;; (sy-string-car "John Xavier Doe")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
417 ;; => "John"
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
418 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
419 (defun sy-string-car (namestring)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
420 (substring namestring
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
421 (progn (string-match "\\s *" namestring) (match-end 0))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
422 (progn (string-match "\\s *\\S +" namestring) (match-end 0))))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
423
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
424 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
425 ;; ----------------------------------------------------------------------
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
426 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
427 ;; returns the "cdr" of the namestring, really the whole string from
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
428 ;; after the first name field to the end of the string.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
429 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
430 ;; (sy-string-cdr "John Xavier Doe")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
431 ;; => "Xavier Doe"
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
432 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
433 (defun sy-string-cdr (namestring)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
434 (substring namestring
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
435 (progn (string-match "\\s *\\S +\\s *" namestring)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
436 (match-end 0))))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
437
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
438 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
439 ;; ----------------------------------------------------------------------
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
440 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
441 ;; convert a namestring to a list of namefields
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
442 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
443 ;; (sy-namestring-to-list "John Xavier Doe")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
444 ;; => ("John" "Xavier" "Doe")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
445 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
446 (defun sy-namestring-to-list (namestring)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
447 (if (not (string-match namestring ""))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
448 (append (list (sy-string-car namestring))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
449 (sy-namestring-to-list (sy-string-cdr namestring)))))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
450
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
451 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
452 ;; ----------------------------------------------------------------------
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
453 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
454 ;; strip the initials from each item in the list and return a string
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
455 ;; that is the concatenation of the initials
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
456 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
457 (defun sy-strip-initials (raw-nlist)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
458 (if (not raw-nlist)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
459 nil
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
460 (concat (substring (car raw-nlist) 0 1)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
461 (sy-strip-initials (cdr raw-nlist)))))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
462
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
463
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
464 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
465 ;; ----------------------------------------------------------------------
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
466 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
467 ;; using the namestring, build a list which is in the following order
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
468 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
469 ;; (email, initials, firstname, lastname, name1, name2, name3 ... nameN-1)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
470 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
471 (defun sy-build-ordered-namelist (namestring)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
472 (let* ((raw-nlist (sy-namestring-to-list namestring))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
473 (initials (sy-strip-initials raw-nlist))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
474 (firstname (car raw-nlist))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
475 (revnames (reverse (cdr raw-nlist)))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
476 (lastname (car revnames))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
477 (midnames (reverse (cdr revnames)))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
478 (emailnames (sy-get-emailname)))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
479 (append (list emailnames)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
480 (list initials)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
481 (list firstname)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
482 (list lastname)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
483 midnames)))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
484
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
485 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
486 ;; ----------------------------------------------------------------------
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
487 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
488 ;; Query the user for the attribution string. Supply sy-default-attribution
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
489 ;; as the default choice.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
490 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
491 (defun sy-query-for-attribution ()
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
492 (concat
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
493 (let* ((prompt (concat "Enter attribution string: (default "
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
494 sy-default-attribution
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
495 ") "))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
496 (query (read-input prompt))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
497 (attribution (if (string-equal query "")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
498 sy-default-attribution
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
499 query)))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
500 (if sy-downcase-p
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
501 (downcase attribution)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
502 attribution))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
503 sy-citation-string))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
504
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
505
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
506 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
507 ;; ----------------------------------------------------------------------
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
508 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
509 ;; parse the current line for the namestring
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
510 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
511 (defun sy-get-namestring ()
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
512 (save-restriction
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
513 (beginning-of-line)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
514 (if (re-search-forward "(.*)" (point-max) t)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
515 (let ((start (progn
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
516 (beginning-of-line)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
517 (re-search-forward "\\((\\s *\\)\\|$" (point-max) t)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
518 (point)))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
519 (end (progn
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
520 (re-search-forward
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
521 (concat "\\(\\s *\\()\\|" sy-titlecue-regexp "\\)\\)\\|$")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
522 (point-max) t)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
523 (point))))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
524 (narrow-to-region start end)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
525 (let ((start (progn
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
526 (beginning-of-line)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
527 (point)))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
528 (end (progn
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
529 (end-of-line)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
530 (re-search-backward
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
531 (concat "\\s *\\()\\|" sy-titlecue-regexp "\\)$")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
532 (point-min) t)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
533 (point))))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
534 (buffer-substring start end)))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
535 (let ((start (progn
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
536 (beginning-of-line)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
537 (re-search-forward "^\"*")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
538 (point)))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
539 (end (progn
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
540 (re-search-forward "\\(\\s *[a-zA-Z0-9\\.]+\\)*"
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
541 (point-max) t)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
542 (point))))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
543 (buffer-substring start end)))))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
544
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
545
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
546 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
547 ;; ----------------------------------------------------------------------
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
548 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
549 ;; scan the nlist and return the integer pointing to the first legal
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
550 ;; non-empty namestring. Returns the integer pointing to the index
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
551 ;; in the nlist of the preferred namestring, or nil if no legal
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
552 ;; non-empty namestring could be found.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
553 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
554 (defun sy-return-preference-n (nlist)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
555 (let ((p sy-preferred-attribution)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
556 (exception nil))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
557 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
558 ;; check to be sure the index is not out-of-bounds
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
559 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
560 (cond
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
561 ((< p 0) (setq p 2) (setq exception t))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
562 ((not (nth p nlist)) (setq p 2) (setq exception t)))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
563 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
564 ;; check to be sure that the explicit preference is not empty
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
565 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
566 (if (string-equal (nth p nlist) "")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
567 (progn (setq p 0)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
568 (setq exception t)))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
569 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
570 ;; find the first non-empty namestring
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
571 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
572 (while (and (nth p nlist)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
573 (string-equal (nth p nlist) ""))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
574 (setq exception t)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
575 (setq p (+ p 1)))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
576 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
577 ;; return the preference index if non-nil, otherwise nil
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
578 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
579 (if (or (and exception sy-use-only-preference-p)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
580 (not (nth p nlist)))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
581 nil
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
582 p)))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
583
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
584 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
585 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
586 ;; ----------------------------------------------------------------------
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
587 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
588 ;; rebuild the nlist into an alist for completing-read. Use as a guide
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
589 ;; the index of the preferred name field. Get the actual preferred
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
590 ;; name field base on other factors (see above). If no actual preferred
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
591 ;; name field is found, then query the user for the attribution string.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
592 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
593 ;; also note that the nlist is guaranteed to be non-empty. At the very
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
594 ;; least it will consist of 4 empty strings ("" "" "" "")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
595 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
596 (defun sy-nlist-to-alist (nlist)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
597 (let ((preference (sy-return-preference-n nlist))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
598 alist
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
599 (n 0))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
600 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
601 ;; check to be sure preference is not nil
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
602 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
603 (if (not preference)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
604 (setq alist (list (cons (sy-query-for-attribution) nil)))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
605 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
606 ;; preference is non-nil
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
607 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
608 (setq alist (list (cons (nth preference nlist) nil)))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
609 (while (nth n nlist)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
610 (if (= n preference) nil
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
611 (setq alist (append alist (list (cons (nth n nlist) nil)))))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
612 (setq n (+ n 1))))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
613 alist))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
614
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
615
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
616
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
617 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
618 ;; ----------------------------------------------------------------------
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
619 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
620 ;; confirm if desired after the alist has been built
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
621 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
622 (defun sy-get-attribution (alist)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
623 (concat
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
624 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
625 ;; check to see if nested citations are to be used
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
626 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
627 (if sy-nested-citation-p
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
628 ""
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
629 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
630 ;; check to see if confirmation is needed
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
631 ;; if not, just return the preference (first element in alist)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
632 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
633 (if (not sy-confirm-always-p)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
634 (car (car alist))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
635 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
636 ;; confirmation is requested so build the prompt, confirm
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
637 ;; and return the chosen string
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
638 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
639 (let* (ignore
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
640 (prompt (concat "Complete attribution string: (default "
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
641 (car (car alist))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
642 ") "))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
643 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
644 ;; set up the local completion keymap
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
645 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
646 (minibuffer-local-must-match-map
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
647 (let ((map (make-sparse-keymap)))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
648 (define-key map "?" 'minibuffer-completion-help)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
649 (define-key map " " 'minibuffer-complete-word)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
650 (define-key map "\t" 'minibuffer-complete)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
651 (define-key map "\00A" 'exit-minibuffer)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
652 (define-key map "\00D" 'exit-minibuffer)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
653 (define-key map "\007"
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
654 '(lambda ()
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
655 (interactive)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
656 (beep)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
657 (exit-minibuffer)))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
658 map))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
659 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
660 ;; read the completion
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
661 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
662 (attribution (completing-read prompt alist))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
663 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
664 ;; check attribution string for emptyness
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
665 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
666 (choice (if (or (not attribution)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
667 (string-equal attribution ""))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
668 (car (car alist))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
669 attribution)))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
670
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
671 (if sy-downcase-p
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
672 (downcase choice)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
673 choice))))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
674 sy-citation-string))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
675
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
676
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
677 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
678 ;; ----------------------------------------------------------------------
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
679 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
680 ;; this function will scan the current rmail buffer, narrowing it to the
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
681 ;; from: line, then using this, it will try to decipher some names from
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
682 ;; that line. It will then build the name alist and try to confirm
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
683 ;; its choice of attribution strings. It returns the chosen attribution
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
684 ;; string.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
685 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
686 (defun sy-scan-rmail-for-names (rmailbuffer)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
687 (save-excursion
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
688 (let ((case-fold-search t)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
689 alist
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
690 attribution)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
691 (switch-to-buffer rmailbuffer)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
692 (goto-char (point-min))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
693 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
694 ;; be sure there is a from: line
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
695 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
696 (if (not (re-search-forward "^from:\\s *" (point-max) t))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
697 (setq attribution (sy-query-for-attribution))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
698 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
699 ;; if there is a from: line, then scan the narrow the buffer,
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
700 ;; grab the namestring, and build the alist, then using this
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
701 ;; get the attribution string.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
702 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
703 (save-restriction
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
704 (narrow-to-region (point)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
705 (progn (end-of-line) (point)))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
706 (let* ((namestring (sy-get-namestring))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
707 (nlist (sy-build-ordered-namelist namestring)))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
708 (setq alist (sy-nlist-to-alist nlist))))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
709 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
710 ;; we've built the alist, now confirm the attribution choice
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
711 ;; if appropriate
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
712 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
713 (setq attribution (sy-get-attribution alist)))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
714 attribution)))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
715
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
716
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
717 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
718 ;; ======================================================================
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
719 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
720 ;; the following function insert of citations, writing of headers, filling
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
721 ;; paragraphs and general higher level operations
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
722 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
723
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
724 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
725 ;; ----------------------------------------------------------------------
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
726 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
727 ;; insert a nested citation
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
728 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
729 (defun sy-insert-citation (start end cite-string)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
730 (save-excursion
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
731 (goto-char end)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
732 (setq end (point-marker))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
733 (goto-char start)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
734 (or (bolp)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
735 (forward-line 1))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
736
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
737 (let ((fill-prefix (concat cite-string " "))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
738 (fstart (point))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
739 (fend (point)))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
740
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
741 (while (< (point) end)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
742 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
743 ;; remove leading tabs if desired
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
744 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
745 (if sy-left-justify-p
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
746 (delete-region (point)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
747 (progn (skip-chars-forward " \t") (point))))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
748 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
749 ;; check to see if the current line should be cited
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
750 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
751 (if (or (eolp)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
752 (looking-at sy-cite-regexp))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
753 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
754 ;; do not cite this line unless nested-citations are to be
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
755 ;; used
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
756 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
757 (progn
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
758 (or (eolp)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
759 (if sy-nested-citation-p
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
760 (insert cite-string)))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
761
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
762 ;; set fill start and end points
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
763 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
764 (or (= fstart fend)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
765 (not sy-auto-fill-region-p)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
766 (progn (goto-char fend)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
767 (or (not (eolp))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
768 (setq fend (+ fend 1)))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
769 (fill-region-as-paragraph fstart fend)))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
770 (setq fstart (point))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
771 (setq fend (point)))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
772
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
773 ;; else
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
774 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
775 (insert fill-prefix)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
776 (end-of-line)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
777 (setq fend (point)))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
778
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
779 (forward-line 1)))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
780 (move-marker end nil)))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
781
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
782 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
783 ;; ----------------------------------------------------------------------
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
784 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
785 ;; yank a particular field into a holding variable
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
786 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
787 (defun sy-yank-fields (start)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
788 (save-excursion
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
789 (goto-char start)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
790 (setq sy-reply-yank-date (mail-fetch-field "date")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
791 sy-reply-yank-from (mail-fetch-field "from")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
792 sy-reply-yank-subject (mail-fetch-field "subject")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
793 sy-reply-yank-newsgroups (mail-fetch-field "newsgroups")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
794 sy-reply-yank-references (mail-fetch-field "references")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
795 sy-reply-yank-message-id (mail-fetch-field "message-id")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
796 sy-reply-yank-organization (mail-fetch-field "organization"))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
797 (or sy-reply-yank-date
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
798 (setq sy-reply-yank-date "mumble mumble"))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
799 (or sy-reply-yank-from
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
800 (setq sy-reply-yank-from "mumble mumble"))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
801 (or sy-reply-yank-subject
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
802 (setq sy-reply-yank-subject "mumble mumble"))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
803 (or sy-reply-yank-newsgroups
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
804 (setq sy-reply-yank-newsgroups "mumble mumble"))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
805 (or sy-reply-yank-references
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
806 (setq sy-reply-yank-references "mumble mumble"))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
807 (or sy-reply-yank-message-id
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
808 (setq sy-reply-yank-message-id "mumble mumble"))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
809 (or sy-reply-yank-organization
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
810 (setq sy-reply-yank-organization "mumble mumble"))))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
811
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
812 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
813 ;; ----------------------------------------------------------------------
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
814 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
815 ;; rewrite the header to be more conversational
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
816 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
817 (defun sy-rewrite-headers (start)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
818 (goto-char start)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
819 (run-hooks 'sy-rewrite-header-hook))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
820
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
821 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
822 ;; ----------------------------------------------------------------------
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
823 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
824 ;; some different styles of headers
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
825 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
826 (defun sy-header-on-said ()
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
827 (insert-string "\nOn " sy-reply-yank-date ",\n"
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
828 sy-reply-yank-from " said:\n"))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
829
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
830 (defun sy-header-inarticle-writes ()
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
831 (insert-string "\nIn article " sy-reply-yank-message-id
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
832 " " sy-reply-yank-from " writes:\n"))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
833
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
834 (defun sy-header-regarding-writes ()
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
835 (insert-string "\nRegarding " sy-reply-yank-subject
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
836 "; " sy-reply-yank-from " adds:\n"))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
837
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
838 (defun sy-header-verbose ()
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
839 (insert-string "\nOn " sy-reply-yank-date ",\n"
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
840 sy-reply-yank-from "\nfrom the organization "
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
841 sy-reply-yank-organization "\nhad this to say about article "
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
842 sy-reply-yank-message-id "\nin newsgroups "
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
843 sy-reply-yank-newsgroups "\nconcerning "
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
844 sy-reply-yank-subject "\nreferring to previous articles "
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
845 sy-reply-yank-references "\n"))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
846
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
847 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
848 ;; ----------------------------------------------------------------------
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
849 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
850 ;; yank the original article in and attribute
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
851 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
852 (defun sy-yank-original (arg)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
853
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
854 "Insert the message being replied to, if any (in rmail/gnus). Puts
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
855 point before the text and mark after. Calls generalized citation
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
856 function sy-insert-citation to cite all allowable lines."
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
857
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
858 (interactive "P")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
859 (if mail-reply-buffer
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
860 (let* ((sy-confirm-always-p (if (consp arg)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
861 t
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
862 sy-confirm-always-p))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
863 (attribution (sy-scan-rmail-for-names mail-reply-buffer))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
864 (top (point))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
865 (start (point))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
866 (end (progn (delete-windows-on mail-reply-buffer)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
867 (insert-buffer mail-reply-buffer)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
868 (mark))))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
869
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
870 (sy-yank-fields start)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
871 (sy-rewrite-headers start)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
872 (setq start (point))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
873 (mail-yank-clear-headers top (mark))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
874 (setq sy-persist-attribution (concat attribution " "))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
875 (sy-insert-citation start end attribution))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
876
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
877 (goto-char top)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
878 (exchange-point-and-mark)))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
879
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
880
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
881 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
882 ;; ----------------------------------------------------------------------
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
883 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
884 ;; this is here for compatibility with existing mail/news yankers
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
885 ;; overloads the default mail-yank-original
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
886 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
887 (defun mail-yank-original (arg)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
888
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
889 "Yank original message buffer into the reply buffer, citing as per
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
890 user preferences. Numeric Argument forces confirmation.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
891
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
892 Here is a description of the superyank.el package, what it does and
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
893 what variables control its operation. This was written by Barry
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
894 Warsaw (warsaw@cme.nist.gov, {...}!uunet!cme-durer!warsaw).
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
895
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
896 A 'Citation' is the acknowledgement of the original author of a mail
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
897 message. There are two general forms of citation. In 'nested
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
898 citations', indication is made that the cited line was written by
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
899 someone *other* that the current message author (or by that author at
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
900 an earlier time). No indication is made as to the identity of the
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
901 original author. Thus, a nested citation after multiple replies would
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
902 look like this (this is after my reply to a previous message):
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
903
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
904 >>John originally wrote this
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
905 >>and this as well
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
906 > Jane said that John didn't know
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
907 > what he was talking about
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
908 And that's what I think as well.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
909
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
910 In non-nested citations, you won't see multiple \">\" characters at
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
911 the beginning of the line. Non-nested citations will insert an
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
912 informative string at the beginning of a cited line, attributing that
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
913 line to an author. The same message described above might look like
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
914 this if non-nested citations were used:
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
915
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
916 John> John originally wrote this
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
917 John> and this as well
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
918 Jane> Jane said that John didn't know
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
919 Jane> what he was talking about
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
920 And that's what I think as well.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
921
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
922 Notice that my inclusion of Jane's inclusion of John's original
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
923 message did not result in a cited line of the form: Jane>John>. Thus
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
924 no nested citations. The style of citation is controlled by the
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
925 variable `sy-nested-citation-p'. Nil uses non-nested citations and
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
926 non-nil uses old style, nested citations.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
927
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
928 The variable `sy-citation-string' is the string to use as a marker for
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
929 a citation, either nested or non-nested. For best results, this
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
930 string should be a single character with no trailing space and is
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
931 typically the character \">\". In non-nested citations this string is
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
932 appended to the attribution string (author's name), along with a
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
933 trailing space. In nested citations, a trailing space is only added
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
934 to a first level citation.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
935
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
936 Another important variable is `sy-cite-regexp' which describes strings
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
937 that indicate a previously cited line. This regular expression is
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
938 always used at the beginning of a line so it doesn't need to begin
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
939 with a \"^\" character. Change this variable if you change
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
940 `sy-citation-string'.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
941
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
942 The following section only applies to non-nested citations.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
943
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
944 This package has a fair amount of intellegence related to deciphering
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
945 the author's name based on information provided by the original
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
946 message buffer. In normal operation, the program will pick out the
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
947 author's first and last names, initials, terminal email address and
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
948 any other names it can find. It will then pick an attribution string
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
949 from this list based on a user defined preference and it will ask for
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
950 confirmation if the user specifies. This package gathers its
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
951 information from the `From:' line of the original message buffer. It
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
952 recognizes From: lines with the following forms:
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
953
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
954 From: John Xavier Doe <doe@speedy.computer.com>
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
955 From: \"John Xavier Doe\" <doe@speedy.computer.com>
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
956 From: doe@speedy.computer.com (John Xavier Doe)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
957 From: computer!speedy!doe (John Xavier Doe)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
958 From: computer!speedy!doe (John Xavier Doe)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
959 From: doe%speedy@computer.com (John Xavier Doe)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
960
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
961 In this case, if confirmation is requested, the following strings will
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
962 be made available for completion and confirmation:
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
963
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
964 \"John\"
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
965 \"Xavier\"
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
966 \"Doe\"
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
967 \"JXD\"
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
968 \"doe\"
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
969
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
970 Note that completion is case sensitive. If there was a problem
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
971 picking out a From: line, or any other problem getting even a single
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
972 name, then the user will be queried for an attribution string. The
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
973 default attribution string is set in the variable
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
974 `sy-default-attribution'.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
975
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
976 Sometimes people set their name fields so that it also includes a
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
977 title of the form:
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
978
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
979 From: doe@speedy.computer.com (John Doe -- Hacker Extraordinaire)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
980
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
981 To avoid the inclusion of the string \"-- Hacker Extraordinaire\" in
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
982 the name list, the variable `sy-titlecue-regexp' is provided. Its
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
983 default setting will still properly recognize names of the form:
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
984
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
985 From: xdoe@speedy.computer.com (John Xavier-Doe -- Crazed Hacker)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
986
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
987 The variable `sy-preferred-attribution' contains an integer that
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
988 indicates which name field the user prefers to use as the attribution
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
989 string, based on the following key:
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
990
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
991 0: email address name is preferred
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
992 1: initials are preferred
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
993 2: first name is preferred
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
994 3: last name is preferred
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
995
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
996 The value can be greater than 3, in which case, you would be
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
997 preferring the 2nd throught nth -1 name. In any case, if the
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
998 preferred name can't be found, then one of two actions will be taken
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
999 depending on the value of the variable `sy-use-only-preference-p'. If
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1000 this is non-nil, then the `sy-default-attribution will be used. If it
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1001 is nil, then a secondary scheme will be employed to find a suitable
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1002 attribution scheme. First, the author's first name will be used. If
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1003 that can't be found than the name list is searched for the first
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1004 non-nil, non-empty name string. If still no name can be found, then
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1005 the user is either queried, or the `sy-default-attribution' is used,
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1006 depending on the value of `sy-confirm-always-p'.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1007
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1008 If the variable `sy-confirm-always-p' is non-nil, superyank will always
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1009 confirm the attribution string with the user before inserting it into
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1010 the reply buffer. Confirmation is with completion, but the completion
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1011 list is merely a suggestion; the user can override the list by typing
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1012 in a string of their choice.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1013
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1014 The variable `sy-rewrite-header-hook' is a hook that contains a lambda
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1015 expression which rewrites the informative header at the top of the
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1016 yanked message. Set to nil to avoid writing any header.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1017
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1018 You can make superyank autofill each paragraph it cites by setting the
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1019 variable `sy-auto-fill-region-p' to non-nil. Or set the variable to nil
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1020 and fill the paragraphs manually with sy-fill-paragraph-manually (see
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1021 below).
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1022
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1023 Finally, `sy-downcase-p' if non-nil, indicates that you always want to
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1024 downcase the attribution string before insertion, and
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1025 `sy-left-justify-p', if non-nil, indicates that you want to delete all
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1026 leading white space before citing.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1027
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1028 Since the almost all yanking in other modes (RMAIL, GNUS) is done
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1029 through the function `mail-yank-original', and since superyank
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1030 overloads this function, cited yanking is automatically bound to the
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1031 C-c C-y key. There are three other smaller functions that are
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1032 provided with superyank and they are bound as below. Try C-h f on
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1033 each function to get more information on these functions.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1034
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1035 Key Bindings:
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1036
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1037 C-c C-y mail-yank-original (superyank's version)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1038 C-c q sy-fill-paragraph-manually
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1039 C-c C-q sy-fill-paragraph-manually
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1040 C-c i sy-insert-persist-attribution
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1041 C-c C-i sy-insert-persist-attribution
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1042 C-c C-o sy-open-line
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1043
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1044
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1045 Summary of variables, with their default values:
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1046
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1047 sy-default-attribution (default: \"Anon\")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1048 Attribution to use if no attribution string can be deciphered
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1049 from the original message buffer.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1050
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1051 sy-citation-string (default: \">\")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1052 String to append to the attribution string for citation, for
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1053 best results, it should be one character with no trailing space.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1054
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1055 sy-nested-citation-p (default: nil)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1056 Nil means use non-nested citations, non-nil means use old style
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1057 nested citations.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1058
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1059 sy-cite-regexp (default: \"[a-zA-Z0-9]*>\")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1060 Regular expression that matches the beginning of a previously
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1061 cited line. Always used at the beginning of a line so it does
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1062 not need to start with a \"^\" character.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1063
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1064 sy-titlecue-regexp (default: \"\\s +-+\\s +\")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1065 Regular expression that matches a title delimiter in the name
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1066 field.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1067
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1068 sy-preferred-attribution (default: 2)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1069 Integer indicating user's preferred attribution field.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1070
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1071 sy-confirm-always-p (default: t)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1072 Non-nil says always confirm with completion before inserting
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1073 attribution.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1074
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1075 sy-rewrite-header-hook (default: 'sy-header-on-said)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1076 Hook for inserting informative header at the top of the yanked
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1077 message.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1078
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1079 sy-downcase-p (default: nil)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1080 Non-nil says downcase the attribution string before insertion.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1081
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1082 sy-left-justify-p (default: nil)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1083 Non-nil says delete leading white space before citing.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1084
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1085 sy-auto-fill-region-p (default: nil)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1086 Non-nil says don't auto fill the region. T says auto fill the
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1087 paragraph.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1088
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1089 sy-use-only-preference-p (default: nil)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1090 If nil, use backup scheme when preferred attribution string
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1091 can't be found. If non-nil and preferred attribution string
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1092 can't be found, then use sy-default-attribution."
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1093
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1094 (interactive "P")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1095
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1096 (local-set-key "\C-cq" 'sy-fill-paragraph-manually)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1097 (local-set-key "\C-c\C-q" 'sy-fill-paragraph-manually)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1098 (local-set-key "\C-c\i" 'sy-insert-persist-attribution)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1099 (local-set-key "\C-c\C-i" 'sy-insert-persist-attribution)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1100 (local-set-key "\C-c\C-o" 'sy-open-line)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1101
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1102 (sy-yank-original arg))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1103
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1104
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1105 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1106 ;; ----------------------------------------------------------------------
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1107 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1108 ;; based on Bruce Israel's "fill-paragraph-properly", and modified from
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1109 ;; code posted by David C. Lawrence. Modified to use the persistant
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1110 ;; attribution if none could be found from the paragraph.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1111 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1112 (defun sy-fill-paragraph-manually (arg)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1113 "Fill paragraph containing or following point, automatically finding
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1114 the sy-cite-regexp and using it as the prefix. If the sy-cite-regexp
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1115 is not in the first line of the paragraph, it makes a guess at what
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1116 the fill-prefix for the paragraph should be by looking at the first
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1117 line and taking anything up to the first alphanumeric character.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1118
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1119 Prefix arg means justify both sides of paragraph as well.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1120
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1121 This function just does fill-paragraph if the fill-prefix is set. If
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1122 what it deduces to be the paragraph prefix (based on the first line)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1123 does not precede each line in the region, then the persistant
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1124 attribution is used. The persistant attribution is just the last
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1125 attribution string used to cite lines."
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1126
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1127 (interactive "P")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1128 (save-excursion
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1129 (forward-paragraph)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1130 (or (bolp)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1131 (newline 1))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1132
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1133 (let ((end (point))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1134 st
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1135 (fill-prefix fill-prefix))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1136 (backward-paragraph)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1137 (if (looking-at "\n")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1138 (forward-char 1))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1139 (setq st (point))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1140 (if fill-prefix
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1141 nil
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1142 (untabify st end) ;; die, scurvy tabs!
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1143 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1144 ;; untabify might have made the paragraph longer character-wise,
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1145 ;; make sure end reflects the correct location of eop.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1146 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1147 (forward-paragraph)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1148 (setq end (point))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1149 (goto-char st)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1150 (if (looking-at sy-cite-regexp)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1151 (setq fill-prefix (concat
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1152 (buffer-substring
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1153 st (progn (re-search-forward sy-cite-regexp)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1154 (point)))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1155 " "))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1156 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1157 ;; this regexp is is convenient because paragraphs quoted by simple
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1158 ;; indentation must still yield to us <evil laugh>
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1159 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1160 (while (looking-at "[^a-zA-Z0-9]")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1161 (forward-char 1))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1162 (setq fill-prefix (buffer-substring st (point))))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1163 (next-line 1) (beginning-of-line)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1164 (while (and (< (point) end)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1165 (not (string-equal fill-prefix "")))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1166 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1167 ;; if what we decided was the fill-prefix does not precede all
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1168 ;; of the lines in the paragraph, we probably goofed. In this
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1169 ;; case set it to the persistant attribution.
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1170 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1171 (if (looking-at (regexp-quote fill-prefix))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1172 ()
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1173 (setq fill-prefix sy-persist-attribution))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1174 (next-line 1)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1175 (beginning-of-line)))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1176 (fill-region-as-paragraph st end arg))))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1177
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1178 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1179 ;; ----------------------------------------------------------------------
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1180 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1181 ;; insert the persistant attribution at point
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1182 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1183 (defun sy-insert-persist-attribution ()
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1184 "Insert the persistant attribution at the beginning of the line that
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1185 point is on. This string is the last attribution confirmed and used
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1186 in the yanked reply buffer."
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1187 (interactive)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1188 (save-excursion
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1189 (beginning-of-line)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1190 (insert-string sy-persist-attribution)))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1191
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1192
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1193 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1194 ;; ----------------------------------------------------------------------
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1195 ;;
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1196 ;; open a line putting the attribution at the beginning
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1197
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1198 (defun sy-open-line (arg)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1199 "Insert a newline and leave point before it. Also inserts the
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1200 persistant attribution at the beginning of the line. With arg,
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1201 inserts that many newlines."
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1202 (interactive "p")
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1203 (save-excursion
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1204 (let ((start (point)))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1205 (open-line arg)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1206 (goto-char start)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1207 (forward-line)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1208 (while (< 0 arg)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1209 (sy-insert-persist-attribution)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1210 (forward-line 1)
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1211 (setq arg (- arg 1))))))
ce5567c47b8f Initial revision
Jim Blandy <jimb@redhat.com>
parents:
diff changeset
1212