Mercurial > emacs
annotate lisp/mail/mailabbrev.el @ 77927:d15a774f9796
(scan_words): Fix arg to UPDATE_SYNTAX_TABLE_BACKWARD.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Wed, 06 Jun 2007 17:09:40 +0000 |
parents | f79d4df148cb |
children | 8e27d63c45eb d7172f202ab8 |
rev | line source |
---|---|
38412
253f761ad37b
Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents:
34921
diff
changeset
|
1 ;;; mailabbrev.el --- abbrev-expansion of mail aliases |
1148 | 2 |
74509 | 3 ;; Copyright (C) 1985, 1986, 1987, 1992, 1993, 1996, 1997, 2000, 2001, |
75347 | 4 ;; 2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc. |
1148 | 5 |
27589 | 6 ;; Author: Jamie Zawinski <jwz@lucid.com>, now <jwz@jwz.org> |
7 ;; Maintainer: FSF | |
1148 | 8 ;; Created: 19 Oct 90 |
9 ;; Keywords: mail | |
10 | |
14169 | 11 ;; This file is part of GNU Emacs. |
459 | 12 |
14169 | 13 ;; GNU Emacs is free software; you can redistribute it and/or modify |
14 ;; it under the terms of the GNU General Public License as published by | |
15 ;; the Free Software Foundation; either version 2, or (at your option) | |
16 ;; any later version. | |
459 | 17 |
14169 | 18 ;; GNU Emacs is distributed in the hope that it will be useful, |
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
21 ;; GNU General Public License for more details. | |
459 | 22 |
14169 | 23 ;; You should have received a copy of the GNU General Public License |
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the | |
64085 | 25 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
26 ;; Boston, MA 02110-1301, USA. | |
459 | 27 |
1148 | 28 ;;; Commentary: |
29 | |
15293
1343afeec307
(mail-abbrev-expand-hook): Disable abbrev mode temporarily while working,
Roland McGrath <roland@gnu.org>
parents:
14800
diff
changeset
|
30 ;; This file ensures that, when the point is in a To:, CC:, BCC:, or From: |
14169 | 31 ;; field, word-abbrevs are defined for each of your mail aliases. These |
32 ;; aliases will be defined from your .mailrc file (or the file specified by | |
52685 | 33 ;; `mail-personal-alias-file') if it exists. Your mail aliases will |
14169 | 34 ;; expand any time you type a word-delimiter at the end of an abbreviation. |
35 ;; | |
36 ;; What you see is what you get: if mailabbrev is in use when you type | |
37 ;; a name, and the name does not expand, you know it is not an abbreviation. | |
38 ;; However, if you yank abbreviations into the headers | |
39 ;; in a way that bypasses the check for abbreviations, | |
40 ;; they are expanded (but not visibly) when you send the message. | |
41 ;; | |
42 ;; Your mail alias abbrevs will be in effect only when the point is in an | |
43 ;; appropriate header field. When in the body of the message, or other | |
44 ;; header fields, the mail aliases will not expand. Rather, the normal | |
44669
c94319aaffb8
(mail-mode-abbrev-table): Delete defvar.
Richard M. Stallman <rms@gnu.org>
parents:
44393
diff
changeset
|
45 ;; mode-specific abbrev table will be used if |
14169 | 46 ;; defined. So if you use mail-mode specific abbrevs, this code will not |
47 ;; adversely affect you. You can control which header fields the abbrevs | |
48 ;; are used in by changing the variable mail-abbrev-mode-regexp. | |
49 ;; | |
50 ;; If auto-fill mode is on, abbrevs will wrap at commas instead of at word | |
51 ;; boundaries; also, header continuation-lines will be properly indented. | |
52 ;; | |
28803
80075cf72ede
(mail-abbrev-insert-alias): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
27589
diff
changeset
|
53 ;; You can also insert a mail alias with mail-abbrev-insert-alias |
14169 | 54 ;; (bound to C-c C-a), which prompts you for an alias (with completion) |
55 ;; and inserts its expansion at point. | |
56 ;; | |
57 ;; This file fixes a bug in the old system which prohibited your .mailrc | |
58 ;; file from having lines like | |
59 ;; | |
60 ;; alias someone "John Doe <doe@quux.com>" | |
61 ;; | |
62 ;; That is, if you want an address to have embedded spaces, simply surround it | |
63 ;; with double-quotes. This is necessary because the format of the .mailrc | |
64 ;; file bogusly uses spaces as address delimiters. The following line defines | |
65 ;; an alias which expands to three addresses: | |
66 ;; | |
67 ;; alias foobar addr-1 addr-2 "address three <addr-3>" | |
68 ;; | |
69 ;; (This is bogus because mail-delivery programs want commas, not spaces, | |
70 ;; but that's what the file format is, so we have to live with it.) | |
71 ;; | |
72 ;; If you like, you can call the function define-mail-abbrev to define your | |
73 ;; mail aliases instead of using a .mailrc file. When you call it in this | |
74 ;; way, addresses are separated by commas. | |
75 ;; | |
76 ;; CAVEAT: This works on most Sun systems; I have been told that some versions | |
77 ;; of /bin/mail do not understand double-quotes in the .mailrc file. So you | |
78 ;; should make sure your version does before including verbose addresses like | |
79 ;; this. One solution to this, if you are on a system whose /bin/mail doesn't | |
80 ;; work that way, (and you still want to be able to /bin/mail to send mail in | |
81 ;; addition to emacs) is to define minimal aliases (without full names) in | |
82 ;; your .mailrc file, and use define-mail-abbrev to redefine them when sending | |
83 ;; mail from emacs; this way, mail sent from /bin/mail will work, and mail | |
84 ;; sent from emacs will be pretty. | |
85 ;; | |
86 ;; Aliases in the mailrc file may be nested. If you define aliases like | |
87 ;; alias group1 fred ethel | |
88 ;; alias group2 larry curly moe | |
89 ;; alias everybody group1 group2 | |
90 ;; Then when you type "everybody" on the To: line, it will be expanded to | |
91 ;; fred, ethyl, larry, curly, moe | |
92 ;; | |
93 ;; Aliases may also contain forward references; the alias of "everybody" can | |
94 ;; precede the aliases of "group1" and "group2". | |
95 ;; | |
96 ;; This code also understands the "source" .mailrc command, for reading | |
97 ;; aliases from some other file as well. | |
98 ;; | |
99 ;; Aliases may contain hyphens, as in "alias foo-bar foo@bar"; word-abbrevs | |
100 ;; normally cannot contain hyphens, but this code works around that for the | |
101 ;; specific case of mail-alias word-abbrevs. | |
102 ;; | |
103 ;; To read in the contents of another .mailrc-type file from emacs, use the | |
104 ;; command Meta-X merge-mail-abbrevs. The rebuild-mail-abbrevs command is | |
105 ;; similar, but will delete existing aliases first. | |
106 ;; | |
107 ;; If you would like your aliases to be expanded when you type M-> or ^N to | |
108 ;; move out of the mail-header into the message body (instead of having to | |
109 ;; type SPC at the end of the abbrev before moving away) then you can do | |
110 ;; | |
111 ;; (add-hook | |
34921
fc01ec9131a8
(mail-abbrevs-enable, mail-abbrevs-disable):
Gerd Moellmann <gerd@gnu.org>
parents:
30888
diff
changeset
|
112 ;; 'mail-mode-hook |
30888
e559f0aa6b2d
Don't quote lambda.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28803
diff
changeset
|
113 ;; (lambda () |
49171
e0c2ecbf4fc5
(Commentary): Use command remapping instead of
Andreas Schwab <schwab@suse.de>
parents:
47573
diff
changeset
|
114 ;; (define-key mail-mode-map [remap next-line] 'mail-abbrev-next-line) |
e0c2ecbf4fc5
(Commentary): Use command remapping instead of
Andreas Schwab <schwab@suse.de>
parents:
47573
diff
changeset
|
115 ;; (define-key mail-mode-map [remap end-of-buffer] 'mail-abbrev-end-of-buffer))) |
14169 | 116 ;; |
117 ;; If you want multiple addresses separated by a string other than ", " then | |
118 ;; you can set the variable mail-alias-separator-string to it. This has to | |
119 ;; be a comma bracketed by whitespace if you want any kind of reasonable | |
120 ;; behaviour. | |
121 ;; | |
122 ;; Thanks to Harald Hanche-Olsen, Michael Ernst, David Loeffler, and | |
123 ;; Noah Friedman for suggestions and bug reports. | |
1432
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
124 |
34921
fc01ec9131a8
(mail-abbrevs-enable, mail-abbrevs-disable):
Gerd Moellmann <gerd@gnu.org>
parents:
30888
diff
changeset
|
125 ;; To use this package, do (add-hook 'mail-mode-hook 'mail-abbrevs-setup). |
459 | 126 |
1148 | 127 ;;; Code: |
128 | |
43136
9c1aa7b635bd
Require sendmail only at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
41998
diff
changeset
|
129 (eval-when-compile |
9c1aa7b635bd
Require sendmail only at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
41998
diff
changeset
|
130 (require 'sendmail)) |
459 | 131 |
20097 | 132 (defgroup mail-abbrev nil |
133 "Expand mail aliases as abbrevs, in certain mail headers." | |
134 :group 'abbrev-mode) | |
135 | |
136 (defcustom mail-abbrevs-mode nil | |
137 "*Non-nil means expand mail aliases as abbrevs, in certain message headers." | |
138 :type 'boolean | |
139 :group 'mail-abbrev | |
140 :require 'mailabbrev | |
30888
e559f0aa6b2d
Don't quote lambda.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28803
diff
changeset
|
141 :set (lambda (symbol value) |
e559f0aa6b2d
Don't quote lambda.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28803
diff
changeset
|
142 (setq mail-abbrevs-mode value) |
e559f0aa6b2d
Don't quote lambda.
Stefan Monnier <monnier@iro.umontreal.ca>
parents:
28803
diff
changeset
|
143 (if value (mail-abbrevs-enable) (mail-abbrevs-disable))) |
21670
808ecc2eaa84
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
20219
diff
changeset
|
144 :initialize 'custom-initialize-default |
808ecc2eaa84
*** empty log message ***
Dan Nicolaescu <done@ece.arizona.edu>
parents:
20219
diff
changeset
|
145 :version "20.3") |
20097 | 146 |
147 (defcustom mail-abbrevs-only nil | |
148 "*Non-nil means only mail abbrevs should expand automatically. | |
149 Other abbrevs expand only when you explicitly use `expand-abbrev'." | |
150 :type 'boolean | |
151 :group 'mail-abbrev) | |
152 | |
459 | 153 ;; originally defined in sendmail.el - used to be an alist, now is a table. |
1432
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
154 (defvar mail-abbrevs nil |
598 | 155 "Word-abbrev table of mail address aliases. |
459 | 156 If this is nil, it means the aliases have not yet been initialized and |
157 should be read from the .mailrc file. (This is distinct from there being | |
158 no aliases, which is represented by this being a table with no entries.)") | |
159 | |
14800
47631a15d6a2
(mail-abbrev-modtime): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14761
diff
changeset
|
160 (defvar mail-abbrev-modtime nil |
47631a15d6a2
(mail-abbrev-modtime): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14761
diff
changeset
|
161 "The modification time of your mail alias file when it was last examined.") |
47631a15d6a2
(mail-abbrev-modtime): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14761
diff
changeset
|
162 |
47631a15d6a2
(mail-abbrev-modtime): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14761
diff
changeset
|
163 (defun mail-abbrevs-sync-aliases () |
52371
d6c91e697cdc
(mail-abbrevs-sync-aliases): Do nothing if mail-personal-alias-file is nil.
Richard M. Stallman <rms@gnu.org>
parents:
49171
diff
changeset
|
164 (when mail-personal-alias-file |
d6c91e697cdc
(mail-abbrevs-sync-aliases): Do nothing if mail-personal-alias-file is nil.
Richard M. Stallman <rms@gnu.org>
parents:
49171
diff
changeset
|
165 (if (file-exists-p mail-personal-alias-file) |
d6c91e697cdc
(mail-abbrevs-sync-aliases): Do nothing if mail-personal-alias-file is nil.
Richard M. Stallman <rms@gnu.org>
parents:
49171
diff
changeset
|
166 (let ((modtime (nth 5 (file-attributes mail-personal-alias-file)))) |
d6c91e697cdc
(mail-abbrevs-sync-aliases): Do nothing if mail-personal-alias-file is nil.
Richard M. Stallman <rms@gnu.org>
parents:
49171
diff
changeset
|
167 (if (not (equal mail-abbrev-modtime modtime)) |
d6c91e697cdc
(mail-abbrevs-sync-aliases): Do nothing if mail-personal-alias-file is nil.
Richard M. Stallman <rms@gnu.org>
parents:
49171
diff
changeset
|
168 (progn |
d6c91e697cdc
(mail-abbrevs-sync-aliases): Do nothing if mail-personal-alias-file is nil.
Richard M. Stallman <rms@gnu.org>
parents:
49171
diff
changeset
|
169 (setq mail-abbrev-modtime modtime) |
d6c91e697cdc
(mail-abbrevs-sync-aliases): Do nothing if mail-personal-alias-file is nil.
Richard M. Stallman <rms@gnu.org>
parents:
49171
diff
changeset
|
170 (build-mail-abbrevs))))))) |
14800
47631a15d6a2
(mail-abbrev-modtime): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14761
diff
changeset
|
171 |
474 | 172 ;;;###autoload |
1432
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
173 (defun mail-abbrevs-setup () |
14761
bef2b46521de
(mail-abbrevs-setup): Doc fix.
Richard M. Stallman <rms@gnu.org>
parents:
14169
diff
changeset
|
174 "Initialize use of the `mailabbrev' package." |
1432
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
175 (if (and (not (vectorp mail-abbrevs)) |
10328
edd33989fb23
(mail-abbrev-mailrc-file): Variable and macro deleted.
Noah Friedman <friedman@splode.com>
parents:
8215
diff
changeset
|
176 (file-exists-p mail-personal-alias-file)) |
14800
47631a15d6a2
(mail-abbrev-modtime): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14761
diff
changeset
|
177 (progn |
15293
1343afeec307
(mail-abbrev-expand-hook): Disable abbrev mode temporarily while working,
Roland McGrath <roland@gnu.org>
parents:
14800
diff
changeset
|
178 (setq mail-abbrev-modtime |
14800
47631a15d6a2
(mail-abbrev-modtime): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14761
diff
changeset
|
179 (nth 5 (file-attributes mail-personal-alias-file))) |
47631a15d6a2
(mail-abbrev-modtime): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14761
diff
changeset
|
180 (build-mail-abbrevs))) |
47631a15d6a2
(mail-abbrev-modtime): New variable.
Richard M. Stallman <rms@gnu.org>
parents:
14761
diff
changeset
|
181 (mail-abbrevs-sync-aliases) |
11059 | 182 (add-hook 'pre-abbrev-expand-hook 'sendmail-pre-abbrev-expand-hook |
183 nil t) | |
459 | 184 (abbrev-mode 1)) |
185 | |
20097 | 186 (defun mail-abbrevs-enable () |
34921
fc01ec9131a8
(mail-abbrevs-enable, mail-abbrevs-disable):
Gerd Moellmann <gerd@gnu.org>
parents:
30888
diff
changeset
|
187 (add-hook 'mail-mode-hook 'mail-abbrevs-setup)) |
20097 | 188 |
189 (defun mail-abbrevs-disable () | |
190 "Turn off use of the `mailabbrev' package." | |
34921
fc01ec9131a8
(mail-abbrevs-enable, mail-abbrevs-disable):
Gerd Moellmann <gerd@gnu.org>
parents:
30888
diff
changeset
|
191 (remove-hook 'mail-mode-hook 'mail-abbrevs-setup) |
20097 | 192 (abbrev-mode (if (default-value 'abbrev-mode) 1 -1))) |
193 | |
598 | 194 ;;;###autoload |
1432
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
195 (defun build-mail-abbrevs (&optional file recursivep) |
10328
edd33989fb23
(mail-abbrev-mailrc-file): Variable and macro deleted.
Noah Friedman <friedman@splode.com>
parents:
8215
diff
changeset
|
196 "Read mail aliases from personal mail alias file and set `mail-abbrevs'. |
edd33989fb23
(mail-abbrev-mailrc-file): Variable and macro deleted.
Noah Friedman <friedman@splode.com>
parents:
8215
diff
changeset
|
197 By default this is the file specified by `mail-personal-alias-file'." |
edd33989fb23
(mail-abbrev-mailrc-file): Variable and macro deleted.
Noah Friedman <friedman@splode.com>
parents:
8215
diff
changeset
|
198 (setq file (expand-file-name (or file mail-personal-alias-file))) |
1432
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
199 (if (vectorp mail-abbrevs) |
459 | 200 nil |
1432
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
201 (setq mail-abbrevs nil) |
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
202 (define-abbrev-table 'mail-abbrevs '())) |
606 | 203 (message "Parsing %s..." file) |
459 | 204 (let ((buffer nil) |
205 (obuf (current-buffer))) | |
206 (unwind-protect | |
207 (progn | |
20219
b90e718314de
(build-mail-abbrevs): Use initial space in
Karl Heuer <kwzh@gnu.org>
parents:
20097
diff
changeset
|
208 (setq buffer (generate-new-buffer " mailrc")) |
598 | 209 (buffer-disable-undo buffer) |
459 | 210 (set-buffer buffer) |
211 (cond ((get-file-buffer file) | |
212 (insert (save-excursion | |
213 (set-buffer (get-file-buffer file)) | |
214 (buffer-substring (point-min) (point-max))))) | |
215 ((not (file-exists-p file))) | |
216 (t (insert-file-contents file))) | |
217 ;; Don't lose if no final newline. | |
218 (goto-char (point-max)) | |
219 (or (eq (preceding-char) ?\n) (newline)) | |
220 (goto-char (point-min)) | |
221 ;; Delete comments from the file | |
222 (while (search-forward "# " nil t) | |
223 (let ((p (- (point) 2))) | |
224 (end-of-line) | |
225 (delete-region p (point)))) | |
226 (goto-char (point-min)) | |
227 ;; handle "\\\n" continuation lines | |
228 (while (not (eobp)) | |
229 (end-of-line) | |
230 (if (= (preceding-char) ?\\) | |
231 (progn (delete-char -1) (delete-char 1) (insert ?\ )) | |
232 (forward-char 1))) | |
233 (goto-char (point-min)) | |
234 (while (re-search-forward | |
907 | 235 "^\\(a\\(lias\\)?\\|g\\(roup\\)?\\|source\\)[ \t]+" nil t) |
459 | 236 (beginning-of-line) |
237 (if (looking-at "source[ \t]+\\([^ \t\n]+\\)") | |
238 (progn | |
239 (end-of-line) | |
1432
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
240 (build-mail-abbrevs |
3945
7a8d0a08eac7
(build-mail-abbrevs): Do substitute-in-file-name on the abbrev, for `source'.
Richard M. Stallman <rms@gnu.org>
parents:
3742
diff
changeset
|
241 (substitute-in-file-name |
7939
338a91733ff9
(build-mail-abbrevs): Pass a recursivep argument in recursive call.
Richard M. Stallman <rms@gnu.org>
parents:
5559
diff
changeset
|
242 (buffer-substring (match-beginning 1) (match-end 1))) |
338a91733ff9
(build-mail-abbrevs): Pass a recursivep argument in recursive call.
Richard M. Stallman <rms@gnu.org>
parents:
5559
diff
changeset
|
243 t)) |
459 | 244 (re-search-forward "[ \t]+\\([^ \t\n]+\\)") |
245 (let* ((name (buffer-substring | |
246 (match-beginning 1) (match-end 1))) | |
247 (start (progn (skip-chars-forward " \t") (point)))) | |
248 (end-of-line) | |
249 ; (message "** %s \"%s\"" name (buffer-substring start (point)))(sit-for 1) | |
3742
f5bbe69b8bc5
(define-mail-abbrev): Renamed from define-mail-alias.
Richard M. Stallman <rms@gnu.org>
parents:
3741
diff
changeset
|
250 (define-mail-abbrev |
459 | 251 name |
3742
f5bbe69b8bc5
(define-mail-abbrev): Renamed from define-mail-alias.
Richard M. Stallman <rms@gnu.org>
parents:
3741
diff
changeset
|
252 (buffer-substring start (point)) |
f5bbe69b8bc5
(define-mail-abbrev): Renamed from define-mail-alias.
Richard M. Stallman <rms@gnu.org>
parents:
3741
diff
changeset
|
253 t)))) |
459 | 254 ;; Resolve forward references in .mailrc file. |
255 ;; This would happen automatically before the first abbrev was | |
256 ;; expanded, but why not do it now. | |
257 (or recursivep (mail-resolve-all-aliases)) | |
1432
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
258 mail-abbrevs) |
459 | 259 (if buffer (kill-buffer buffer)) |
260 (set-buffer obuf))) | |
606 | 261 (message "Parsing %s... done" file)) |
459 | 262 |
627 | 263 (defvar mail-alias-separator-string ", " |
459 | 264 "*A string inserted between addresses in multi-address mail aliases. |
15293
1343afeec307
(mail-abbrev-expand-hook): Disable abbrev mode temporarily while working,
Roland McGrath <roland@gnu.org>
parents:
14800
diff
changeset
|
265 This has to contain a comma, so \", \" is a reasonable value. You might |
459 | 266 also want something like \",\\n \" to get each address on its own line.") |
267 | |
3742
f5bbe69b8bc5
(define-mail-abbrev): Renamed from define-mail-alias.
Richard M. Stallman <rms@gnu.org>
parents:
3741
diff
changeset
|
268 ;; define-mail-abbrev sets this flag, which causes mail-resolve-all-aliases |
459 | 269 ;; to be called before expanding abbrevs if it's necessary. |
270 (defvar mail-abbrev-aliases-need-to-be-resolved t) | |
271 | |
1432
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
272 ;; originally defined in mailalias.el ; build-mail-abbrevs calls this with |
459 | 273 ;; stuff parsed from the .mailrc file. |
274 ;; | |
474 | 275 ;;;###autoload |
3742
f5bbe69b8bc5
(define-mail-abbrev): Renamed from define-mail-alias.
Richard M. Stallman <rms@gnu.org>
parents:
3741
diff
changeset
|
276 (defun define-mail-abbrev (name definition &optional from-mailrc-file) |
11059 | 277 "Define NAME as a mail alias abbrev that translates to DEFINITION. |
627 | 278 If DEFINITION contains multiple addresses, separate them with commas." |
1432
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
279 ;; When this is called from build-mail-abbrevs, the third argument is |
459 | 280 ;; true, and we do some evil space->comma hacking like /bin/mail does. |
281 (interactive "sDefine mail alias: \nsDefine %s as mail alias for: ") | |
282 ;; Read the defaults first, if we have not done so. | |
1432
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
283 (if (vectorp mail-abbrevs) |
459 | 284 nil |
1432
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
285 (setq mail-abbrevs nil) |
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
286 (define-abbrev-table 'mail-abbrevs '()) |
10328
edd33989fb23
(mail-abbrev-mailrc-file): Variable and macro deleted.
Noah Friedman <friedman@splode.com>
parents:
8215
diff
changeset
|
287 (if (file-exists-p mail-personal-alias-file) |
1432
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
288 (build-mail-abbrevs))) |
459 | 289 ;; strip garbage from front and end |
290 (if (string-match "\\`[ \t\n,]+" definition) | |
291 (setq definition (substring definition (match-end 0)))) | |
292 (if (string-match "[ \t\n,]+\\'" definition) | |
293 (setq definition (substring definition 0 (match-beginning 0)))) | |
8215
767bef8ec35b
(define-mail-abbrev): Don't try to parse empty aliases.
Richard M. Stallman <rms@gnu.org>
parents:
7939
diff
changeset
|
294 (let* ((result '()) |
767bef8ec35b
(define-mail-abbrev): Don't try to parse empty aliases.
Richard M. Stallman <rms@gnu.org>
parents:
7939
diff
changeset
|
295 (L (length definition)) |
767bef8ec35b
(define-mail-abbrev): Don't try to parse empty aliases.
Richard M. Stallman <rms@gnu.org>
parents:
7939
diff
changeset
|
296 (start (if (> L 0) 0)) |
767bef8ec35b
(define-mail-abbrev): Don't try to parse empty aliases.
Richard M. Stallman <rms@gnu.org>
parents:
7939
diff
changeset
|
297 end) |
459 | 298 (while start |
299 ;; If we're reading from the mailrc file, then addresses are delimited | |
300 ;; by spaces, and addresses with embedded spaces must be surrounded by | |
627 | 301 ;; double-quotes. Otherwise, addresses are separated by commas. |
459 | 302 (if from-mailrc-file |
303 (if (eq ?\" (aref definition start)) | |
304 (setq start (1+ start) | |
305 end (string-match "\"[ \t,]*" definition start)) | |
8215
767bef8ec35b
(define-mail-abbrev): Don't try to parse empty aliases.
Richard M. Stallman <rms@gnu.org>
parents:
7939
diff
changeset
|
306 (setq end (string-match "[ \t,]+" definition start))) |
767bef8ec35b
(define-mail-abbrev): Don't try to parse empty aliases.
Richard M. Stallman <rms@gnu.org>
parents:
7939
diff
changeset
|
307 (setq end (string-match "[ \t\n,]*,[ \t\n,]*" definition start))) |
59349
c3a4bd30088a
(sendmail-pre-abbrev-expand-hook):
Richard M. Stallman <rms@gnu.org>
parents:
52685
diff
changeset
|
308 (let ((tem (substring definition start end))) |
c3a4bd30088a
(sendmail-pre-abbrev-expand-hook):
Richard M. Stallman <rms@gnu.org>
parents:
52685
diff
changeset
|
309 ;; Advance the loop past this address. |
c3a4bd30088a
(sendmail-pre-abbrev-expand-hook):
Richard M. Stallman <rms@gnu.org>
parents:
52685
diff
changeset
|
310 (setq start (and end |
c3a4bd30088a
(sendmail-pre-abbrev-expand-hook):
Richard M. Stallman <rms@gnu.org>
parents:
52685
diff
changeset
|
311 (/= (match-end 0) L) |
c3a4bd30088a
(sendmail-pre-abbrev-expand-hook):
Richard M. Stallman <rms@gnu.org>
parents:
52685
diff
changeset
|
312 (match-end 0))) |
c3a4bd30088a
(sendmail-pre-abbrev-expand-hook):
Richard M. Stallman <rms@gnu.org>
parents:
52685
diff
changeset
|
313 ;; If the full name contains a problem character, quote it. |
c3a4bd30088a
(sendmail-pre-abbrev-expand-hook):
Richard M. Stallman <rms@gnu.org>
parents:
52685
diff
changeset
|
314 (when (string-match "\\(.+?\\)[ \t]*\\(<.*>\\)" tem) |
c3a4bd30088a
(sendmail-pre-abbrev-expand-hook):
Richard M. Stallman <rms@gnu.org>
parents:
52685
diff
changeset
|
315 (if (string-match "[^- !#$%&'*+/0-9=?A-Za-z^_`{|}~]" |
c3a4bd30088a
(sendmail-pre-abbrev-expand-hook):
Richard M. Stallman <rms@gnu.org>
parents:
52685
diff
changeset
|
316 (match-string 1 tem)) |
c3a4bd30088a
(sendmail-pre-abbrev-expand-hook):
Richard M. Stallman <rms@gnu.org>
parents:
52685
diff
changeset
|
317 (setq tem (replace-regexp-in-string |
c3a4bd30088a
(sendmail-pre-abbrev-expand-hook):
Richard M. Stallman <rms@gnu.org>
parents:
52685
diff
changeset
|
318 "\\(.+?\\)[ \t]*\\(<.*>\\)" "\"\\1\" \\2" |
c3a4bd30088a
(sendmail-pre-abbrev-expand-hook):
Richard M. Stallman <rms@gnu.org>
parents:
52685
diff
changeset
|
319 tem)))) |
c3a4bd30088a
(sendmail-pre-abbrev-expand-hook):
Richard M. Stallman <rms@gnu.org>
parents:
52685
diff
changeset
|
320 (push tem result))) |
459 | 321 (setq definition (mapconcat (function identity) |
322 (nreverse result) | |
627 | 323 mail-alias-separator-string))) |
459 | 324 (setq mail-abbrev-aliases-need-to-be-resolved t) |
325 (setq name (downcase name)) | |
1432
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
326 ;; use an abbrev table instead of an alist for mail-abbrevs. |
459 | 327 (let ((abbrevs-changed abbrevs-changed)) ; protect this from being changed. |
43268
08fa5680829b
(define-mail-abbrev): Define as system abbrev.
Richard M. Stallman <rms@gnu.org>
parents:
43214
diff
changeset
|
328 (define-abbrev mail-abbrevs name definition 'mail-abbrev-expand-hook 0 t))) |
459 | 329 |
330 | |
331 (defun mail-resolve-all-aliases () | |
332 "Resolve all forward references in the mail aliases table." | |
333 (if mail-abbrev-aliases-need-to-be-resolved | |
334 (progn | |
335 ;; (message "Resolving mail aliases...") | |
1432
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
336 (if (vectorp mail-abbrevs) |
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
337 (mapatoms (function mail-resolve-all-aliases-1) mail-abbrevs)) |
459 | 338 (setq mail-abbrev-aliases-need-to-be-resolved nil) |
339 ;; (message "Resolving mail aliases... done.") | |
340 ))) | |
341 | |
717 | 342 (defun mail-resolve-all-aliases-1 (sym &optional so-far) |
343 (if (memq sym so-far) | |
344 (error "mail alias loop detected: %s" | |
345 (mapconcat 'symbol-name (cons sym so-far) " <- "))) | |
459 | 346 (let ((definition (and (boundp sym) (symbol-value sym)))) |
347 (if definition | |
348 (let ((result '()) | |
349 (start 0)) | |
350 (while start | |
351 (let ((end (string-match "[ \t\n]*,[, \t\n]*" definition start))) | |
352 (setq result (cons (substring definition start end) result) | |
353 start (and end (match-end 0))))) | |
354 (setq definition | |
355 (mapconcat (function (lambda (x) | |
356 (or (mail-resolve-all-aliases-1 | |
12444
0f96d53b31b7
(mail-resolve-all-aliases-1):
Richard M. Stallman <rms@gnu.org>
parents:
11504
diff
changeset
|
357 (intern-soft (downcase x) mail-abbrevs) |
717 | 358 (cons sym so-far)) |
459 | 359 x))) |
360 (nreverse result) | |
627 | 361 mail-alias-separator-string)) |
459 | 362 (set sym definition)))) |
363 (symbol-value sym)) | |
364 | |
365 | |
627 | 366 (defun mail-abbrev-expand-hook () |
11059 | 367 "For use as the fourth arg to `define-abbrev'. |
368 After expanding a mail-abbrev, if Auto Fill mode is on and we're past the | |
369 fill-column, break the line at the previous comma, and indent the next line." | |
15293
1343afeec307
(mail-abbrev-expand-hook): Disable abbrev mode temporarily while working,
Roland McGrath <roland@gnu.org>
parents:
14800
diff
changeset
|
370 ;; Disable abbrev mode to avoid recursion in indent-relative expanding |
1343afeec307
(mail-abbrev-expand-hook): Disable abbrev mode temporarily while working,
Roland McGrath <roland@gnu.org>
parents:
14800
diff
changeset
|
371 ;; part of the abbrev expansion as an abbrev itself. |
1343afeec307
(mail-abbrev-expand-hook): Disable abbrev mode temporarily while working,
Roland McGrath <roland@gnu.org>
parents:
14800
diff
changeset
|
372 (let ((abbrev-mode nil)) |
1343afeec307
(mail-abbrev-expand-hook): Disable abbrev mode temporarily while working,
Roland McGrath <roland@gnu.org>
parents:
14800
diff
changeset
|
373 (save-excursion |
1343afeec307
(mail-abbrev-expand-hook): Disable abbrev mode temporarily while working,
Roland McGrath <roland@gnu.org>
parents:
14800
diff
changeset
|
374 (let ((p (point)) |
1343afeec307
(mail-abbrev-expand-hook): Disable abbrev mode temporarily while working,
Roland McGrath <roland@gnu.org>
parents:
14800
diff
changeset
|
375 bol comma fp) |
1343afeec307
(mail-abbrev-expand-hook): Disable abbrev mode temporarily while working,
Roland McGrath <roland@gnu.org>
parents:
14800
diff
changeset
|
376 (beginning-of-line) |
1343afeec307
(mail-abbrev-expand-hook): Disable abbrev mode temporarily while working,
Roland McGrath <roland@gnu.org>
parents:
14800
diff
changeset
|
377 (setq bol (point)) |
1343afeec307
(mail-abbrev-expand-hook): Disable abbrev mode temporarily while working,
Roland McGrath <roland@gnu.org>
parents:
14800
diff
changeset
|
378 (goto-char p) |
1343afeec307
(mail-abbrev-expand-hook): Disable abbrev mode temporarily while working,
Roland McGrath <roland@gnu.org>
parents:
14800
diff
changeset
|
379 (while (and auto-fill-function |
1343afeec307
(mail-abbrev-expand-hook): Disable abbrev mode temporarily while working,
Roland McGrath <roland@gnu.org>
parents:
14800
diff
changeset
|
380 (>= (current-column) fill-column) |
1343afeec307
(mail-abbrev-expand-hook): Disable abbrev mode temporarily while working,
Roland McGrath <roland@gnu.org>
parents:
14800
diff
changeset
|
381 (search-backward "," bol t)) |
1343afeec307
(mail-abbrev-expand-hook): Disable abbrev mode temporarily while working,
Roland McGrath <roland@gnu.org>
parents:
14800
diff
changeset
|
382 (setq comma (point)) |
1343afeec307
(mail-abbrev-expand-hook): Disable abbrev mode temporarily while working,
Roland McGrath <roland@gnu.org>
parents:
14800
diff
changeset
|
383 (forward-char 1) ; Now we are just past the comma. |
1343afeec307
(mail-abbrev-expand-hook): Disable abbrev mode temporarily while working,
Roland McGrath <roland@gnu.org>
parents:
14800
diff
changeset
|
384 (insert "\n") |
1343afeec307
(mail-abbrev-expand-hook): Disable abbrev mode temporarily while working,
Roland McGrath <roland@gnu.org>
parents:
14800
diff
changeset
|
385 (delete-horizontal-space) |
1343afeec307
(mail-abbrev-expand-hook): Disable abbrev mode temporarily while working,
Roland McGrath <roland@gnu.org>
parents:
14800
diff
changeset
|
386 (setq p (point)) |
1343afeec307
(mail-abbrev-expand-hook): Disable abbrev mode temporarily while working,
Roland McGrath <roland@gnu.org>
parents:
14800
diff
changeset
|
387 (indent-relative) |
1343afeec307
(mail-abbrev-expand-hook): Disable abbrev mode temporarily while working,
Roland McGrath <roland@gnu.org>
parents:
14800
diff
changeset
|
388 (setq fp (buffer-substring p (point))) |
1343afeec307
(mail-abbrev-expand-hook): Disable abbrev mode temporarily while working,
Roland McGrath <roland@gnu.org>
parents:
14800
diff
changeset
|
389 ;; Go to the end of the new line. |
1343afeec307
(mail-abbrev-expand-hook): Disable abbrev mode temporarily while working,
Roland McGrath <roland@gnu.org>
parents:
14800
diff
changeset
|
390 (end-of-line) |
1343afeec307
(mail-abbrev-expand-hook): Disable abbrev mode temporarily while working,
Roland McGrath <roland@gnu.org>
parents:
14800
diff
changeset
|
391 (if (> (current-column) fill-column) |
1343afeec307
(mail-abbrev-expand-hook): Disable abbrev mode temporarily while working,
Roland McGrath <roland@gnu.org>
parents:
14800
diff
changeset
|
392 ;; It's still too long; do normal auto-fill. |
1343afeec307
(mail-abbrev-expand-hook): Disable abbrev mode temporarily while working,
Roland McGrath <roland@gnu.org>
parents:
14800
diff
changeset
|
393 (let ((fill-prefix (or fp "\t"))) |
1343afeec307
(mail-abbrev-expand-hook): Disable abbrev mode temporarily while working,
Roland McGrath <roland@gnu.org>
parents:
14800
diff
changeset
|
394 (do-auto-fill))) |
1343afeec307
(mail-abbrev-expand-hook): Disable abbrev mode temporarily while working,
Roland McGrath <roland@gnu.org>
parents:
14800
diff
changeset
|
395 ;; Resume the search. |
1343afeec307
(mail-abbrev-expand-hook): Disable abbrev mode temporarily while working,
Roland McGrath <roland@gnu.org>
parents:
14800
diff
changeset
|
396 (goto-char comma) |
1343afeec307
(mail-abbrev-expand-hook): Disable abbrev mode temporarily while working,
Roland McGrath <roland@gnu.org>
parents:
14800
diff
changeset
|
397 ))))) |
598 | 398 |
399 ;;; Syntax tables and abbrev-expansion | |
459 | 400 |
15293
1343afeec307
(mail-abbrev-expand-hook): Disable abbrev mode temporarily while working,
Roland McGrath <roland@gnu.org>
parents:
14800
diff
changeset
|
401 (defvar mail-abbrev-mode-regexp |
5559
e976a52296fc
(mail-abbrev-mode-regexp): Add Reply-to.
Richard M. Stallman <rms@gnu.org>
parents:
4805
diff
changeset
|
402 "^\\(Resent-\\)?\\(To\\|From\\|CC\\|BCC\\|Reply-to\\):" |
11059 | 403 "*Regexp to select mail-headers in which mail abbrevs should be expanded. |
10776
52b3af3cb71a
(mail-abbrev-mode-regexp): Doc fix.
Karl Heuer <kwzh@gnu.org>
parents:
10328
diff
changeset
|
404 This string will be handed to `looking-at' with point at the beginning |
459 | 405 of the current line; if it matches, abbrev mode will be turned on, otherwise |
406 it will be turned off. (You don't need to worry about continuation lines.) | |
407 This should be set to match those mail fields in which you want abbreviations | |
408 turned on.") | |
409 | |
43136
9c1aa7b635bd
Require sendmail only at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
41998
diff
changeset
|
410 (defvar mail-abbrev-syntax-table nil |
13258
2a96bf08bccb
(mail-abbrev-syntax-table): Rewrite using map-char-table.
Richard M. Stallman <rms@gnu.org>
parents:
13161
diff
changeset
|
411 "The syntax-table used for abbrev-expansion purposes. |
2a96bf08bccb
(mail-abbrev-syntax-table): Rewrite using map-char-table.
Richard M. Stallman <rms@gnu.org>
parents:
13161
diff
changeset
|
412 This is not actually made the current syntax table of the buffer, but |
2a96bf08bccb
(mail-abbrev-syntax-table): Rewrite using map-char-table.
Richard M. Stallman <rms@gnu.org>
parents:
13161
diff
changeset
|
413 simply controls the set of characters which may be a part of the name |
43136
9c1aa7b635bd
Require sendmail only at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
41998
diff
changeset
|
414 of a mail alias. The value is set up, buffer-local, when first needed.") |
598 | 415 |
44118
00eee90af15f
(mail-abbrev-make-syntax-table): New subroutine
Richard M. Stallman <rms@gnu.org>
parents:
43268
diff
changeset
|
416 (defun mail-abbrev-make-syntax-table () |
00eee90af15f
(mail-abbrev-make-syntax-table): New subroutine
Richard M. Stallman <rms@gnu.org>
parents:
43268
diff
changeset
|
417 (make-local-variable 'mail-abbrev-syntax-table) |
00eee90af15f
(mail-abbrev-make-syntax-table): New subroutine
Richard M. Stallman <rms@gnu.org>
parents:
43268
diff
changeset
|
418 (unless mail-abbrev-syntax-table |
44393
6ae0e3db6a85
(mail-abbrev-make-syntax-table): Use (syntax-table), not old-syntax-table.
Richard M. Stallman <rms@gnu.org>
parents:
44379
diff
changeset
|
419 (let ((tab (copy-syntax-table (syntax-table))) |
44118
00eee90af15f
(mail-abbrev-make-syntax-table): New subroutine
Richard M. Stallman <rms@gnu.org>
parents:
43268
diff
changeset
|
420 (_ (aref (standard-syntax-table) ?_)) |
00eee90af15f
(mail-abbrev-make-syntax-table): New subroutine
Richard M. Stallman <rms@gnu.org>
parents:
43268
diff
changeset
|
421 (w (aref (standard-syntax-table) ?w))) |
00eee90af15f
(mail-abbrev-make-syntax-table): New subroutine
Richard M. Stallman <rms@gnu.org>
parents:
43268
diff
changeset
|
422 (map-char-table |
00eee90af15f
(mail-abbrev-make-syntax-table): New subroutine
Richard M. Stallman <rms@gnu.org>
parents:
43268
diff
changeset
|
423 (function (lambda (key value) |
46354
ff0c68e547f7
(mail-abbrev-make-syntax-table): Check the
Andreas Schwab <schwab@suse.de>
parents:
44669
diff
changeset
|
424 (if (null value) |
ff0c68e547f7
(mail-abbrev-make-syntax-table): Check the
Andreas Schwab <schwab@suse.de>
parents:
44669
diff
changeset
|
425 ;; Fetch the inherited value |
ff0c68e547f7
(mail-abbrev-make-syntax-table): Check the
Andreas Schwab <schwab@suse.de>
parents:
44669
diff
changeset
|
426 (setq value (aref tab key))) |
44118
00eee90af15f
(mail-abbrev-make-syntax-table): New subroutine
Richard M. Stallman <rms@gnu.org>
parents:
43268
diff
changeset
|
427 (if (equal value _) |
00eee90af15f
(mail-abbrev-make-syntax-table): New subroutine
Richard M. Stallman <rms@gnu.org>
parents:
43268
diff
changeset
|
428 (set-char-table-range tab key w)))) |
00eee90af15f
(mail-abbrev-make-syntax-table): New subroutine
Richard M. Stallman <rms@gnu.org>
parents:
43268
diff
changeset
|
429 tab) |
00eee90af15f
(mail-abbrev-make-syntax-table): New subroutine
Richard M. Stallman <rms@gnu.org>
parents:
43268
diff
changeset
|
430 (modify-syntax-entry ?@ "w" tab) |
47573
29a49406ad9d
(mail-abbrev-make-syntax-table): Give %!._- word constituent syntax.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
46354
diff
changeset
|
431 (modify-syntax-entry ?% "w" tab) |
29a49406ad9d
(mail-abbrev-make-syntax-table): Give %!._- word constituent syntax.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
46354
diff
changeset
|
432 (modify-syntax-entry ?! "w" tab) |
29a49406ad9d
(mail-abbrev-make-syntax-table): Give %!._- word constituent syntax.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
46354
diff
changeset
|
433 (modify-syntax-entry ?. "w" tab) |
29a49406ad9d
(mail-abbrev-make-syntax-table): Give %!._- word constituent syntax.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
46354
diff
changeset
|
434 (modify-syntax-entry ?_ "w" tab) |
29a49406ad9d
(mail-abbrev-make-syntax-table): Give %!._- word constituent syntax.
Markus Rost <rost@math.uni-bielefeld.de>
parents:
46354
diff
changeset
|
435 (modify-syntax-entry ?- "w" tab) |
44118
00eee90af15f
(mail-abbrev-make-syntax-table): New subroutine
Richard M. Stallman <rms@gnu.org>
parents:
43268
diff
changeset
|
436 (setq mail-abbrev-syntax-table tab)))) |
459 | 437 |
598 | 438 (defun mail-abbrev-in-expansion-header-p () |
439 "Whether point is in a mail-address header field." | |
440 (let ((case-fold-search t)) | |
441 (and ;; | |
442 ;; we are on an appropriate header line... | |
443 (save-excursion | |
39566
497b8fa7e100
(mail-abbrev-in-expansion-header-p): Simplify.
Gerd Moellmann <gerd@gnu.org>
parents:
38412
diff
changeset
|
444 (unless (eobp) (forward-char 1)) |
497b8fa7e100
(mail-abbrev-in-expansion-header-p): Simplify.
Gerd Moellmann <gerd@gnu.org>
parents:
38412
diff
changeset
|
445 (re-search-backward "^[^ \t]" nil 'move) |
598 | 446 ;; are we at the front of an appropriate header line? |
447 (looking-at mail-abbrev-mode-regexp)) | |
448 ;; | |
21866
d98a0a598fb9
(mail-abbrev-in-expansion-header-p): Use mail-header-end.
Richard M. Stallman <rms@gnu.org>
parents:
21670
diff
changeset
|
449 ;; ...and are we in the headers? |
43268
08fa5680829b
(define-mail-abbrev): Define as system abbrev.
Richard M. Stallman <rms@gnu.org>
parents:
43214
diff
changeset
|
450 (< (point) |
08fa5680829b
(define-mail-abbrev): Define as system abbrev.
Richard M. Stallman <rms@gnu.org>
parents:
43214
diff
changeset
|
451 (save-restriction |
08fa5680829b
(define-mail-abbrev): Define as system abbrev.
Richard M. Stallman <rms@gnu.org>
parents:
43214
diff
changeset
|
452 (widen) |
08fa5680829b
(define-mail-abbrev): Define as system abbrev.
Richard M. Stallman <rms@gnu.org>
parents:
43214
diff
changeset
|
453 (save-excursion |
08fa5680829b
(define-mail-abbrev): Define as system abbrev.
Richard M. Stallman <rms@gnu.org>
parents:
43214
diff
changeset
|
454 (rfc822-goto-eoh) |
08fa5680829b
(define-mail-abbrev): Define as system abbrev.
Richard M. Stallman <rms@gnu.org>
parents:
43214
diff
changeset
|
455 (point))))))) |
598 | 456 |
627 | 457 (defun sendmail-pre-abbrev-expand-hook () |
1432
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
458 (and (and mail-abbrevs (not (eq mail-abbrevs t))) |
1148 | 459 (if (mail-abbrev-in-expansion-header-p) |
43136
9c1aa7b635bd
Require sendmail only at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
41998
diff
changeset
|
460 |
9c1aa7b635bd
Require sendmail only at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
41998
diff
changeset
|
461 ;; We are in a To: (or CC:, or whatever) header, and |
9c1aa7b635bd
Require sendmail only at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
41998
diff
changeset
|
462 ;; should use word-abbrevs to expand mail aliases. |
9c1aa7b635bd
Require sendmail only at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
41998
diff
changeset
|
463 (let ((local-abbrev-table mail-abbrevs) |
9c1aa7b635bd
Require sendmail only at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
41998
diff
changeset
|
464 (old-syntax-table (syntax-table))) |
1148 | 465 |
466 ;; Before anything else, resolve aliases if they need it. | |
467 (and mail-abbrev-aliases-need-to-be-resolved | |
468 (mail-resolve-all-aliases)) | |
469 | |
470 ;; Now proceed with the abbrev section. | |
43136
9c1aa7b635bd
Require sendmail only at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
41998
diff
changeset
|
471 ;; - We already installed mail-abbrevs as the abbrev table. |
1148 | 472 ;; - Then install the mail-abbrev-syntax-table, which |
473 ;; temporarily marks all of the | |
474 ;; non-alphanumeric-atom-characters (the "_" | |
475 ;; syntax ones) as being normal word-syntax. We do this | |
476 ;; because the C code for expand-abbrev only works on words, | |
477 ;; and we want these characters to be considered words for | |
478 ;; the purpose of abbrev expansion. | |
479 ;; - Then we call expand-abbrev again, recursively, to do | |
480 ;; the abbrev expansion with the above syntax table. | |
43136
9c1aa7b635bd
Require sendmail only at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
41998
diff
changeset
|
481 ;; - Restore the previous syntax table. |
1148 | 482 ;; - Then we do a trick which tells the expand-abbrev frame |
483 ;; which invoked us to not continue (and thus not | |
484 ;; expand twice.) This means that any abbrev expansion | |
485 ;; will happen as a result of this function's call to | |
486 ;; expand-abbrev, and not as a result of the call to | |
487 ;; expand-abbrev which invoked *us*. | |
488 | |
44118
00eee90af15f
(mail-abbrev-make-syntax-table): New subroutine
Richard M. Stallman <rms@gnu.org>
parents:
43268
diff
changeset
|
489 (mail-abbrev-make-syntax-table) |
1148 | 490 |
491 ;; If the character just typed was non-alpha-symbol-syntax, | |
492 ;; then don't expand the abbrev now (that is, don't expand | |
493 ;; when the user types -.) Check the character's syntax in | |
43136
9c1aa7b635bd
Require sendmail only at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
41998
diff
changeset
|
494 ;; the usual syntax table. |
1148 | 495 |
3668
87f7ff6bba51
(sendmail-pre-abbrev-expand-hook):
Richard M. Stallman <rms@gnu.org>
parents:
3664
diff
changeset
|
496 (or (and (integerp last-command-char) |
77664
f79d4df148cb
(sendmail-pre-abbrev-expand-hook):
Richard M. Stallman <rms@gnu.org>
parents:
75347
diff
changeset
|
497 ;; Some commands such as M-> may want to expand first. |
f79d4df148cb
(sendmail-pre-abbrev-expand-hook):
Richard M. Stallman <rms@gnu.org>
parents:
75347
diff
changeset
|
498 (equal this-command 'self-insert) |
59349
c3a4bd30088a
(sendmail-pre-abbrev-expand-hook):
Richard M. Stallman <rms@gnu.org>
parents:
52685
diff
changeset
|
499 (or (eq (char-syntax last-command-char) ?_) |
c3a4bd30088a
(sendmail-pre-abbrev-expand-hook):
Richard M. Stallman <rms@gnu.org>
parents:
52685
diff
changeset
|
500 ;; Don't expand on @. |
c3a4bd30088a
(sendmail-pre-abbrev-expand-hook):
Richard M. Stallman <rms@gnu.org>
parents:
52685
diff
changeset
|
501 (memq last-command-char '(?@ ?. ?% ?! ?_ ?-)))) |
1148 | 502 (let ((pre-abbrev-expand-hook nil)) ; That's us; don't loop. |
503 ;; Use this table so that abbrevs can have hyphens in them. | |
504 (set-syntax-table mail-abbrev-syntax-table) | |
43136
9c1aa7b635bd
Require sendmail only at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
41998
diff
changeset
|
505 (unwind-protect |
9c1aa7b635bd
Require sendmail only at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
41998
diff
changeset
|
506 (expand-abbrev) |
9c1aa7b635bd
Require sendmail only at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
41998
diff
changeset
|
507 ;; Now set it back to what it was before. |
9c1aa7b635bd
Require sendmail only at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
41998
diff
changeset
|
508 (set-syntax-table old-syntax-table)))) |
11504
ae5b033ad31f
(sendmail-pre-abbrev-expand-hook): When setting the
Karl Heuer <kwzh@gnu.org>
parents:
11059
diff
changeset
|
509 (setq abbrev-start-location (point-max) ; This is the trick. |
1148 | 510 abbrev-start-location-buffer (current-buffer))) |
511 | |
20097 | 512 (if (or (not mail-abbrevs-only) |
513 (eq this-command 'expand-abbrev)) | |
43136
9c1aa7b635bd
Require sendmail only at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
41998
diff
changeset
|
514 ;; We're not in a mail header where mail aliases should |
9c1aa7b635bd
Require sendmail only at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
41998
diff
changeset
|
515 ;; be expanded, then use the normal mail-mode abbrev table |
9c1aa7b635bd
Require sendmail only at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
41998
diff
changeset
|
516 ;; (if any) and the normal mail-mode syntax table. |
9c1aa7b635bd
Require sendmail only at compile time.
Richard M. Stallman <rms@gnu.org>
parents:
41998
diff
changeset
|
517 nil |
20097 | 518 ;; This is not a mail abbrev, and we should not expand it. |
519 ;; This kludge stops expand-abbrev from doing anything. | |
520 (setq abbrev-start-location (point-max) | |
521 abbrev-start-location-buffer (current-buffer)))) | |
1148 | 522 )) |
598 | 523 |
524 ;;; utilities | |
459 | 525 |
1432
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
526 (defun merge-mail-abbrevs (file) |
459 | 527 "Merge mail aliases from the given file with existing ones." |
528 (interactive (list | |
529 (let ((insert-default-directory t) | |
530 (default-directory (expand-file-name "~/")) | |
10328
edd33989fb23
(mail-abbrev-mailrc-file): Variable and macro deleted.
Noah Friedman <friedman@splode.com>
parents:
8215
diff
changeset
|
531 (def mail-personal-alias-file)) |
459 | 532 (read-file-name |
65680
ed770a0a7846
2005-09-24 Emilio C. Lopes <eclig@gmx.net>
Romain Francoise <romain@orebokech.com>
parents:
64754
diff
changeset
|
533 (format "Read additional aliases from file (default %s): " |
459 | 534 def) |
535 default-directory | |
536 (expand-file-name def default-directory) | |
537 t)))) | |
1432
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
538 (build-mail-abbrevs file)) |
459 | 539 |
12945
14e16370799d
(rebuild-mail-abbrevs): FILE defaults to visited file.
Richard M. Stallman <rms@gnu.org>
parents:
12444
diff
changeset
|
540 (defun rebuild-mail-abbrevs (&optional file) |
459 | 541 "Rebuild all the mail aliases from the given file." |
542 (interactive (list | |
543 (let ((insert-default-directory t) | |
544 (default-directory (expand-file-name "~/")) | |
10328
edd33989fb23
(mail-abbrev-mailrc-file): Variable and macro deleted.
Noah Friedman <friedman@splode.com>
parents:
8215
diff
changeset
|
545 (def mail-personal-alias-file)) |
459 | 546 (read-file-name |
65680
ed770a0a7846
2005-09-24 Emilio C. Lopes <eclig@gmx.net>
Romain Francoise <romain@orebokech.com>
parents:
64754
diff
changeset
|
547 (format "Read mail aliases from file (default %s): " def) |
459 | 548 default-directory |
549 (expand-file-name def default-directory) | |
550 t)))) | |
12945
14e16370799d
(rebuild-mail-abbrevs): FILE defaults to visited file.
Richard M. Stallman <rms@gnu.org>
parents:
12444
diff
changeset
|
551 (if (null file) |
14e16370799d
(rebuild-mail-abbrevs): FILE defaults to visited file.
Richard M. Stallman <rms@gnu.org>
parents:
12444
diff
changeset
|
552 (setq file buffer-file-name)) |
1432
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
553 (setq mail-abbrevs nil) |
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
554 (build-mail-abbrevs file)) |
584 | 555 |
28803
80075cf72ede
(mail-abbrev-insert-alias): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
27589
diff
changeset
|
556 (defun mail-abbrev-insert-alias (&optional alias) |
598 | 557 "Prompt for and insert a mail alias." |
907 | 558 (interactive (progn |
1432
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
559 (if (not (vectorp mail-abbrevs)) (mail-abbrevs-setup)) |
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
560 (list (completing-read "Expand alias: " mail-abbrevs nil t)))) |
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
561 (if (not (vectorp mail-abbrevs)) (mail-abbrevs-setup)) |
13000
a86ad056a1cd
(mail-interactive-insert-alias): Call mail-abbrev-expand-hook.
Richard M. Stallman <rms@gnu.org>
parents:
12956
diff
changeset
|
562 (insert (or (and alias (symbol-value (intern-soft alias mail-abbrevs))) "")) |
a86ad056a1cd
(mail-interactive-insert-alias): Call mail-abbrev-expand-hook.
Richard M. Stallman <rms@gnu.org>
parents:
12956
diff
changeset
|
563 (mail-abbrev-expand-hook)) |
598 | 564 |
28803
80075cf72ede
(mail-abbrev-insert-alias): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
27589
diff
changeset
|
565 (defun mail-abbrev-complete-alias () |
80075cf72ede
(mail-abbrev-insert-alias): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
27589
diff
changeset
|
566 "Perform completion on alias preceding point." |
80075cf72ede
(mail-abbrev-insert-alias): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
27589
diff
changeset
|
567 ;; Based on lisp.el:lisp-complete-symbol |
80075cf72ede
(mail-abbrev-insert-alias): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
27589
diff
changeset
|
568 (interactive) |
44379
5e64981e7abd
(mail-abbrev-complete-alias): Call mail-abbrev-make-syntax-table.
Richard M. Stallman <rms@gnu.org>
parents:
44118
diff
changeset
|
569 (mail-abbrev-make-syntax-table) |
28803
80075cf72ede
(mail-abbrev-insert-alias): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
27589
diff
changeset
|
570 (let* ((end (point)) |
80075cf72ede
(mail-abbrev-insert-alias): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
27589
diff
changeset
|
571 (syntax-table (syntax-table)) |
80075cf72ede
(mail-abbrev-insert-alias): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
27589
diff
changeset
|
572 (beg (unwind-protect |
80075cf72ede
(mail-abbrev-insert-alias): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
27589
diff
changeset
|
573 (save-excursion |
80075cf72ede
(mail-abbrev-insert-alias): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
27589
diff
changeset
|
574 (set-syntax-table mail-abbrev-syntax-table) |
80075cf72ede
(mail-abbrev-insert-alias): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
27589
diff
changeset
|
575 (backward-word 1) |
80075cf72ede
(mail-abbrev-insert-alias): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
27589
diff
changeset
|
576 (point)) |
80075cf72ede
(mail-abbrev-insert-alias): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
27589
diff
changeset
|
577 (set-syntax-table syntax-table))) |
80075cf72ede
(mail-abbrev-insert-alias): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
27589
diff
changeset
|
578 (alias (buffer-substring beg end)) |
80075cf72ede
(mail-abbrev-insert-alias): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
27589
diff
changeset
|
579 (completion (try-completion alias mail-abbrevs))) |
80075cf72ede
(mail-abbrev-insert-alias): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
27589
diff
changeset
|
580 (cond ((eq completion t) |
80075cf72ede
(mail-abbrev-insert-alias): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
27589
diff
changeset
|
581 (message "%s" alias)) ; confirm |
80075cf72ede
(mail-abbrev-insert-alias): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
27589
diff
changeset
|
582 ((null completion) |
80075cf72ede
(mail-abbrev-insert-alias): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
27589
diff
changeset
|
583 (error "[Can't complete \"%s\"]" alias)) ; (message ...) (ding) |
80075cf72ede
(mail-abbrev-insert-alias): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
27589
diff
changeset
|
584 ((not (string= completion alias)) |
80075cf72ede
(mail-abbrev-insert-alias): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
27589
diff
changeset
|
585 (delete-region beg end) |
80075cf72ede
(mail-abbrev-insert-alias): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
27589
diff
changeset
|
586 (insert completion)) |
80075cf72ede
(mail-abbrev-insert-alias): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
27589
diff
changeset
|
587 (t (with-output-to-temp-buffer "*Completions*" |
80075cf72ede
(mail-abbrev-insert-alias): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
27589
diff
changeset
|
588 (display-completion-list |
80075cf72ede
(mail-abbrev-insert-alias): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
27589
diff
changeset
|
589 (prog2 |
80075cf72ede
(mail-abbrev-insert-alias): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
27589
diff
changeset
|
590 (message "Making completion list...") |
80075cf72ede
(mail-abbrev-insert-alias): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
27589
diff
changeset
|
591 (all-completions alias mail-abbrevs) |
66114
13abee3a9bc6
* message.el (message-expand-group): Pass the common
Masatake YAMATO <jet@gyve.org>
parents:
65680
diff
changeset
|
592 (message "Making completion list...done")) |
13abee3a9bc6
* message.el (message-expand-group): Pass the common
Masatake YAMATO <jet@gyve.org>
parents:
65680
diff
changeset
|
593 alias)))))) |
28803
80075cf72ede
(mail-abbrev-insert-alias): Renamed from
Gerd Moellmann <gerd@gnu.org>
parents:
27589
diff
changeset
|
594 |
1432
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
595 (defun mail-abbrev-next-line (&optional arg) |
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
596 "Expand any mail abbrev, then move cursor vertically down ARG lines. |
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
597 If there is no character in the target line exactly under the current column, |
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
598 the cursor is positioned after the character in that line which spans this |
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
599 column, or at the end of the line if it is not long enough. |
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
600 If there is no line in the buffer after this one, |
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
601 a newline character is inserted to create a line |
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
602 and the cursor moves to that line. |
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
603 |
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
604 The command \\[set-goal-column] can be used to create |
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
605 a semipermanent goal column to which this command always moves. |
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
606 Then it does not try to move vertically. This goal column is stored |
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
607 in `goal-column', which is nil when there is none. |
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
608 |
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
609 If you are thinking of using this in a Lisp program, consider |
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
610 using `forward-line' instead. It is usually easier to use |
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
611 and more reliable (no dependence on goal column, etc.)." |
598 | 612 (interactive "p") |
717 | 613 (if (looking-at "[ \t]*\n") (expand-abbrev)) |
614 (setq this-command 'next-line) | |
598 | 615 (next-line arg)) |
616 | |
1432
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
617 (defun mail-abbrev-end-of-buffer (&optional arg) |
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
618 "Expand any mail abbrev, then move point to end of buffer. |
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
619 Leave mark at previous position. |
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
620 With arg N, put point N/10 of the way from the true end. |
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
621 |
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
622 Don't use this command in Lisp programs! |
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
623 \(goto-char (point-max)) is faster and avoids clobbering the mark." |
4034
9e585b42806d
(mail-abbrev-end-of-buffer): Fix interactive spec to "P", same as
Roland McGrath <roland@gnu.org>
parents:
3945
diff
changeset
|
624 (interactive "P") |
717 | 625 (if (looking-at "[ \t]*\n") (expand-abbrev)) |
626 (setq this-command 'end-of-buffer) | |
59349
c3a4bd30088a
(sendmail-pre-abbrev-expand-hook):
Richard M. Stallman <rms@gnu.org>
parents:
52685
diff
changeset
|
627 (with-no-warnings |
c3a4bd30088a
(sendmail-pre-abbrev-expand-hook):
Richard M. Stallman <rms@gnu.org>
parents:
52685
diff
changeset
|
628 (end-of-buffer arg))) |
598 | 629 |
43214
c7e8bcec1caf
(mail-mode-map): Use eval-after-load to change it.
Richard M. Stallman <rms@gnu.org>
parents:
43136
diff
changeset
|
630 (eval-after-load "sendmail" |
c7e8bcec1caf
(mail-mode-map): Use eval-after-load to change it.
Richard M. Stallman <rms@gnu.org>
parents:
43136
diff
changeset
|
631 '(progn |
c7e8bcec1caf
(mail-mode-map): Use eval-after-load to change it.
Richard M. Stallman <rms@gnu.org>
parents:
43136
diff
changeset
|
632 (define-key mail-mode-map "\C-c\C-a" 'mail-abbrev-insert-alias) |
c7e8bcec1caf
(mail-mode-map): Use eval-after-load to change it.
Richard M. Stallman <rms@gnu.org>
parents:
43136
diff
changeset
|
633 (define-key mail-mode-map "\e\t" ; like lisp-complete-symbol |
c7e8bcec1caf
(mail-mode-map): Use eval-after-load to change it.
Richard M. Stallman <rms@gnu.org>
parents:
43136
diff
changeset
|
634 'mail-abbrev-complete-alias))) |
598 | 635 |
1432
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
636 ;;(define-key mail-mode-map "\C-n" 'mail-abbrev-next-line) |
7446ab662993
Delete version 18 compatibility stuff.
Richard M. Stallman <rms@gnu.org>
parents:
1150
diff
changeset
|
637 ;;(define-key mail-mode-map "\M->" 'mail-abbrev-end-of-buffer) |
598 | 638 |
2418
3af5c7b9f4a1
Provide mailabbrev, not mail-abbrevs.
Richard M. Stallman <rms@gnu.org>
parents:
1832
diff
changeset
|
639 (provide 'mailabbrev) |
14169 | 640 |
20097 | 641 (if mail-abbrevs-mode |
642 (mail-abbrevs-enable)) | |
643 | |
52401 | 644 ;;; arch-tag: 5aa2d901-73f8-4ad7-b73c-4802282ad2ff |
38412
253f761ad37b
Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents:
34921
diff
changeset
|
645 ;;; mailabbrev.el ends here |