comparison lisp/mail/mh-xemacs-compat.el @ 47730:2568d5a27317

Upgraded to mh-e version 6.1.1.
author Bill Wohler <wohler@newt.com>
date Tue, 01 Oct 2002 20:27:23 +0000
parents
children 8aaba207e44b
comparison
equal deleted inserted replaced
47729:8dcdf2a8c1f8 47730:2568d5a27317
1 ;;; mh-xemacs-compat.el --- GNU Emacs Functions needed by XEmacs
2
3 ;; Copyright (C) 2001, 2002 Free Software Foundation, Inc.
4
5 ;; Author: FSF
6 ;; Maintainer: Bill Wohler <wohler@newt.com>
7 ;; Keywords: mail
8 ;; See: mh-e.el
9
10 ;; This file is part of GNU Emacs.
11
12 ;; GNU Emacs is free software; you can redistribute it and/or modify
13 ;; it under the terms of the GNU General Public License as published by
14 ;; the Free Software Foundation; either version 2, or (at your option)
15 ;; any later version.
16
17 ;; GNU Emacs is distributed in the hope that it will be useful,
18 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
19 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 ;; GNU General Public License for more details.
21
22 ;; You should have received a copy of the GNU General Public License
23 ;; along with GNU Emacs; see the file COPYING. If not, write to the
24 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
25 ;; Boston, MA 02111-1307, USA.
26
27 ;;; Commentary:
28
29 ;;; Change Log:
30
31 ;; $Id: mh-xemacs-compat.el,v 1.7 2002/04/07 19:20:55 wohler Exp $
32
33 ;;; Code:
34
35 ;;; Simple compatibility:
36
37 (unless (fboundp 'match-string-no-properties)
38 (defalias 'match-string-no-properties 'match-string))
39
40 ;;; Functions from simple.el of Emacs-21.1
41 ;;; simple.el --- basic editing commands for Emacs
42
43 ;; Copyright (C) 1985, 86, 87, 93, 94, 95, 96, 97, 98, 99, 2000, 2001
44 ;; Free Software Foundation, Inc.
45
46 (defun rfc822-goto-eoh ()
47 ;; Go to header delimiter line in a mail message, following RFC822 rules
48 (goto-char (point-min))
49 (while (looking-at "^[^: \n]+:\\|^[ \t]")
50 (forward-line 1))
51 (point))
52
53 ;;; Functions from sendmail.el of Emacs-21.1
54 ;;; sendmail.el --- mail sending commands for Emacs.
55
56 ;; Copyright (C) 1985, 86, 92, 93, 94, 95, 96, 98, 2000, 2001
57 ;; Free Software Foundation, Inc.
58
59 (defun mail-header-end ()
60 "Return the buffer location of the end of headers, as a number."
61 (save-restriction
62 (widen)
63 (save-excursion
64 (rfc822-goto-eoh)
65 (point))))
66
67 (defun mail-mode-fill-paragraph (arg)
68 ;; Do something special only if within the headers.
69 (if (< (point) (mail-header-end))
70 (let (beg end fieldname)
71 (when (prog1 (re-search-backward "^[-a-zA-Z]+:" nil 'yes)
72 (setq beg (point)))
73 (setq fieldname
74 (downcase (buffer-substring beg (1- (match-end 0))))))
75 (forward-line 1)
76 ;; Find continuation lines and get rid of their continuation markers.
77 (while (looking-at "[ \t]")
78 (delete-horizontal-space)
79 (forward-line 1))
80 (setq end (point-marker))
81 (goto-char beg)
82 ;; If this field contains addresses,
83 ;; make sure we can fill after each address.
84 (if (member fieldname
85 '("to" "cc" "bcc" "from" "reply-to"
86 "resent-to" "resent-cc" "resent-bcc"
87 "resent-from" "resent-reply-to"))
88 (while (search-forward "," end t)
89 (or (looking-at "[ \t]")
90 (insert " "))))
91 (fill-region-as-paragraph beg end)
92 ;; Mark all lines except the first as continuations.
93 (goto-char beg)
94 (forward-line 1)
95 (while (< (point) end)
96 (insert " ")
97 (forward-line 1))
98 (move-marker end nil)
99 t)))
100
101 (provide 'mh-xemacs-compat)
102
103 ;;; mh-xemacs-compat.el ends here