annotate lisp/=superyank.el @ 814:38b2499cb3e9

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