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