comparison lisp/modes/mail-abbrevs.el @ 70:131b0175ea99 r20-0b30

Import from CVS: tag r20-0b30
author cvs
date Mon, 13 Aug 2007 09:02:59 +0200
parents ec9a17fef872
children c0c698873ce1
comparison
equal deleted inserted replaced
69:804d1389bcd6 70:131b0175ea99
1 ;;; Abbrev-expansion of mail aliases. 1 ;;; Abbrev-expansion of mail aliases.
2 ;;; Copyright (C) 1985-1994 Free Software Foundation, Inc. 2 ;;; Copyright (C) 1985-1994 Free Software Foundation, Inc.
3 ;;; Created: 19 oct 90, Jamie Zawinski <jwz@netscape.com> 3 ;;; Created: 19 oct 90, Jamie Zawinski <jwz@lucid.com>
4 ;;; Modified: 5 apr 92, Roland McGrath <roland@gnu.ai.mit.edu> 4 ;;; Modified: 5 apr 92, Roland McGrath <roland@gnu.ai.mit.edu>
5 ;;; Last change 4-may-94. jwz 5 ;;; Last change 4-may-94. jwz
6 6
7 ;; This file is part of XEmacs. 7 ;; This file is part of XEmacs.
8 8
86 ;;; alias everybody group1 group2 86 ;;; alias everybody group1 group2
87 ;;; Then when you type "everybody" on the To: line, it will be expanded to 87 ;;; Then when you type "everybody" on the To: line, it will be expanded to
88 ;;; fred, ethyl, larry, curly, moe 88 ;;; fred, ethyl, larry, curly, moe
89 ;;; 89 ;;;
90 ;;; Aliases may also contain forward references; the alias of "everybody" can 90 ;;; Aliases may also contain forward references; the alias of "everybody" can
91 ;;; precede the aliases of "group1" and "group2". 91 ;;; preceed the aliases of "group1" and "group2".
92 ;;; 92 ;;;
93 ;;; This code also understands the "source" .mailrc command, for reading 93 ;;; This code also understands the "source" .mailrc command, for reading
94 ;;; aliases from some other file as well. 94 ;;; aliases from some other file as well.
95 ;;; 95 ;;;
96 ;;; Aliases may contain hyphens, as in "alias foo-bar foo@bar"; word-abbrevs 96 ;;; Aliases may contain hyphens, as in "alias foo-bar foo@bar"; word-abbrevs
357 (setq comma (point)) 357 (setq comma (point))
358 (forward-char 1) ; Now we are just past the comma. 358 (forward-char 1) ; Now we are just past the comma.
359 (insert "\n") 359 (insert "\n")
360 (delete-horizontal-space) 360 (delete-horizontal-space)
361 (setq p (point)) 361 (setq p (point))
362 ;; Prevent abbrev expansion from happening again, since 362 (indent-relative)
363 ;; sendmail-pre-abbrev-expand-hook will already have done it.
364 (let ((abbrev-mode nil))
365 (indent-relative))
366 (setq fp (buffer-substring p (point))) 363 (setq fp (buffer-substring p (point)))
367 ;; Go to the end of the new line. 364 ;; Go to the end of the new line.
368 (end-of-line) 365 (end-of-line)
369 (if (> (current-column) fill-column) 366 (if (> (current-column) fill-column)
370 ;; It's still too long; do normal auto-fill. 367 ;; It's still too long; do normal auto-fill.
406 "The syntax table used in send-mail mode when in a mail-address header. 403 "The syntax table used in send-mail mode when in a mail-address header.
407 mail-mode-syntax-table is used when the cursor is in the message body or in 404 mail-mode-syntax-table is used when the cursor is in the message body or in
408 non-address headers.") 405 non-address headers.")
409 406
410 (defvar mail-abbrev-syntax-table 407 (defvar mail-abbrev-syntax-table
411 (if (fboundp 'map-syntax-table) 408 (let ((tab (copy-syntax-table mail-mode-header-syntax-table)))
412 (let ((tab (copy-syntax-table mail-mode-header-syntax-table))) 409 (if (vectorp tab)
413 (if (vectorp tab) 410 (let ((i (1- (length tab)))
414 (let ((i (1- (length tab))) 411 (_ (aref (standard-syntax-table) ?_))
415 (_ (aref (standard-syntax-table) ?_)) 412 (w (aref (standard-syntax-table) ?w)))
416 (w (aref (standard-syntax-table) ?w))) 413 (while (>= i 0)
417 (while (>= i 0) 414 (if (= (aref tab i) _) (aset tab i w))
418 (if (= (aref tab i) _) (aset tab i w)) 415 (setq i (1- i))))
419 (setq i (1- i)))) 416 (map-syntax-table
420 (map-syntax-table 417 #'(lambda (key val)
421 #'(lambda (key val) 418 (if (eq (char-syntax-from-code val) ?_)
422 (if (eq (char-syntax-from-code val) ?_) 419 (put-char-table key (set-char-syntax-in-code val ?w) tab)
423 (put-char-table key (set-char-syntax-in-code val ?w) tab) 420 ))
424 )) 421 tab))
425 tab)) 422 tab)
426 tab)
427 (let* ((tab (copy-syntax-table mail-mode-header-syntax-table))
428 (i (1- (length tab)))
429 (_ (aref (standard-syntax-table) ?_))
430 (w (aref (standard-syntax-table) ?w)))
431 (while (>= i 0)
432 (if (= (aref tab i) _) (aset tab i w))
433 (setq i (1- i)))
434 tab))
435 "The syntax-table used for abbrev-expansion purposes; this is not actually 423 "The syntax-table used for abbrev-expansion purposes; this is not actually
436 made the current syntax table of the buffer, but simply controls the set of 424 made the current syntax table of the buffer, but simply controls the set of
437 characters which may be a part of the name of a mail-alias.") 425 characters which may be a part of the name of a mail-alias.")
438 426
439 427