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