annotate lisp/mail/vms-pmail.el @ 14472:8979515dac09 libc-960203 libc-960204 libc-960205 libc-960206 libc-960207 libc-960208 libc-960209 libc-960210

Add cygwin32; Put eabi .sdata2/.sbss2 into read-only memory
author Michael Meissner <gnu@the-meissners.org>
date Sat, 03 Feb 1996 01:03:27 +0000
parents 83f275dcd93a
children e35b7126595f
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
2232
4f9d60f7de9d Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1190
diff changeset
1 ;;; vms-pmail.el --- use Emacs as the editor within VMS mail.
4f9d60f7de9d Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1190
diff changeset
2
1190
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
3 ;; Copyright (C) 1992 Free Software Foundation, Inc.
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
4
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
5 ;; Author: Roland B Roberts <roberts@nsrl31.nsrl.rochester.edu>
2247
2c7997f249eb Add or correct keywords
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2232
diff changeset
6 ;; Keywords: vms
1190
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
7
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
9
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11 ;; it under the terms of the GNU General Public License as published by
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12 ;; the Free Software Foundation; either version 2, or (at your option)
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
13 ;; any later version.
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 ;; GNU General Public License for more details.
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 2247
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 2247
diff changeset
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 2247
diff changeset
23 ;; Boston, MA 02111-1307, USA.
1190
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
24
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25 ;;; Code:
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
26
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
27 ;;;
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28 ;;; Quick hack to use emacs as mail editor. There are a *bunch* of
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29 ;;; changes scattered throughout emacs to make this work, namely:
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30 ;;; (1) mod to sysdep.c to allow emacs to attach to a process other
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31 ;;; than the one that originally spawned it.
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
32 ;;; (2) mod to kepteditor.com to define the logical emacs_parent_pid
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
33 ;;; which is what sysdep.c looks for, and define the logical
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
34 ;;; emacs_command_args which contains the command line
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35 ;;; (3) mod to re-parse command line arguments from emacs_command_args
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
36 ;;; then execute them as though emacs were just starting up.
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37 ;;;
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38 (defun vms-pmail-save-and-exit ()
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39 "Save current buffer and exit emacs.
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
40 If this emacs cannot be suspended, you will be prompted about modified
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
41 buffers other than the mail buffer. BEWARE --- suspending emacs without
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
42 saving your mail buffer causes mail to abort the send (potentially useful
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
43 since the mail buffer is still here)."
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
44 (interactive)
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
45 (basic-save-buffer)
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
46 (if (vms-system-info "LOGICAL" "DONT_SUSPEND_EMACS")
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
47 (progn
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
48 (save-some-buffers)
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
49 (kill-emacs 1))
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
50 (kill-buffer (current-buffer))
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
51 (suspend-emacs)))
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
52
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
53 (defun vms-pmail-abort ()
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
54 "Mark buffer as unmodified and exit emacs.
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
55 When the editor is exited without saving its buffer, VMS mail does not
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
56 send a message. If you have other modified buffers you will be
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
57 prompted for what to do with them."
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
58 (interactive)
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
59 (if (not (yes-or-no-p "Really abort mail? "))
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
60 (ding)
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
61 (not-modified)
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
62 (if (vms-system-info "LOGICAL" "DONT_SUSPEND_EMACS")
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
63 (progn
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
64 (save-some-buffers)
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
65 (kill-emacs 1))
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
66 (kill-buffer (current-buffer))
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
67 (suspend-emacs))))
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
68
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
69 (defun vms-pmail-setup ()
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70 "Set up file assuming use by VMS MAIL utility.
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71 The buffer is put into text-mode, auto-save is turned off and the
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
72 following bindings are established.
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
73
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
74 \\[vms-pmail-save-and-exit] vms-pmail-save-and-exit
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
75 \\[vms-pmail-abort] vms-pmail-abort
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
76
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
77 All other emacs commands are still available."
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
78 (interactive)
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79 (auto-save-mode -1)
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
80 (text-mode)
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
81 (let ((default (vms-system-info "LOGICAL" "SYS$SCRATCH"))
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
82 (directory (file-name-directory (buffer-file-name)))
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
83 (filename (file-name-nondirectory (buffer-file-name))))
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
84 (if (string= directory "SYS$SCRATCH:")
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
85 (progn
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
86 (cd default)
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
87 (setq buffer-file-name (concat default filename))))
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
88 (use-local-map (copy-keymap (current-local-map)))
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
89 (local-set-key "\C-c\C-c" 'vms-pmail-save-and-exit)
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
90 (local-set-key "\C-c\C-g" 'vms-pmail-abort)))
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
91
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
92 (defun indicate-mail-reply-text ()
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
93 "Prepares received mail for re-sending by placing >'s on each line."
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
94 (interactive)
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
95 (goto-char (point-min))
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
96 (while (not (eobp))
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
97 (insert ">")
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
98 (beginning-of-line)
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
99 (forward-line 1))
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
100 (set-buffer-modified-p nil)
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
101 (goto-char (point-min)))
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103 (defun insert-signature ()
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
104 "Moves to the end of the buffer and inserts a \"signature\" file.
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
105 First try the file indicated by environment variable MAIL$TRAILER.
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
106 If that fails, try the file \"~/.signature\".
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
107 If neither file exists, fails quietly."
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108 (interactive)
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
109 (end-of-buffer)
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
110 (newline)
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111 (if (vms-system-info "LOGICAL" "MAIL$TRAILER")
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
112 (if (file-attributes (vms-system-info "LOGICAL" "MAIL$TRAILER"))
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
113 (insert-file-contents (vms-system-info "LOGICAL" "MAIL$TRAILER"))
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
114 (if (file-attributes "~/.signature")
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
115 (insert-file-contents "~/.signature")))))
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
116
2232
4f9d60f7de9d Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1190
diff changeset
117 ;;; vms-pmail.el ends here