(risky-local-variable-p): VAL=nil has special meaning.
[emacs.git] / lisp / mail / mh-xemacs-compat.el
blob8366831381f37a47c82e34ea899422705e07a51e
1 ;;; mh-xemacs-compat.el --- GNU Emacs Functions needed by XEmacs
3 ;; Copyright (C) 2001, 2002 Free Software Foundation, Inc.
5 ;; Author: FSF
6 ;; Maintainer: Bill Wohler <wohler@newt.com>
7 ;; Keywords: mail
8 ;; See: mh-e.el
10 ;; This file is part of GNU Emacs.
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.
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.
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.
27 ;;; Commentary:
29 ;;; Change Log:
31 ;; $Id: mh-xemacs-compat.el,v 1.7 2002/04/07 19:20:55 wohler Exp $
33 ;;; Code:
35 ;;; Simple compatibility:
37 (unless (fboundp 'match-string-no-properties)
38 (defalias 'match-string-no-properties 'match-string))
40 ;;; Functions from simple.el of Emacs-21.1
41 ;;; simple.el --- basic editing commands for Emacs
43 ;; Copyright (C) 1985, 86, 87, 93, 94, 95, 96, 97, 98, 99, 2000, 2001
44 ;; Free Software Foundation, Inc.
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))
53 ;;; Functions from sendmail.el of Emacs-21.1
54 ;;; sendmail.el --- mail sending commands for Emacs.
56 ;; Copyright (C) 1985, 86, 92, 93, 94, 95, 96, 98, 2000, 2001
57 ;; Free Software Foundation, Inc.
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))))
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)))
101 (provide 'mh-xemacs-compat)
103 ;;; mh-xemacs-compat.el ends here