annotate lisp/=superyank.el @ 25972:e7205498db63

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