Mercurial > emacs
annotate lisp/mail/vms-pmail.el @ 28678:b132db55ef7e
(struct Lisp_Buffer_Cons): Remove.
author | Gerd Moellmann <gerd@gnu.org> |
---|---|
date | Fri, 21 Apr 2000 13:00:58 +0000 |
parents | 11218164bc54 |
children | 0ff2877c9bbe |
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> |
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 | |
14169 | 21 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330, | |
23 ;; Boston, MA 02111-1307, USA. | |
1190 | 24 |
25 ;;; Code: | |
26 | |
27 ;;; | |
28 ;;; Quick hack to use emacs as mail editor. There are a *bunch* of | |
29 ;;; changes scattered throughout emacs to make this work, namely: | |
30 ;;; (1) mod to sysdep.c to allow emacs to attach to a process other | |
31 ;;; than the one that originally spawned it. | |
32 ;;; (2) mod to kepteditor.com to define the logical emacs_parent_pid | |
33 ;;; which is what sysdep.c looks for, and define the logical | |
34 ;;; emacs_command_args which contains the command line | |
35 ;;; (3) mod to re-parse command line arguments from emacs_command_args | |
36 ;;; then execute them as though emacs were just starting up. | |
37 ;;; | |
38 (defun vms-pmail-save-and-exit () | |
39 "Save current buffer and exit emacs. | |
40 If this emacs cannot be suspended, you will be prompted about modified | |
41 buffers other than the mail buffer. BEWARE --- suspending emacs without | |
42 saving your mail buffer causes mail to abort the send (potentially useful | |
43 since the mail buffer is still here)." | |
44 (interactive) | |
45 (basic-save-buffer) | |
46 (if (vms-system-info "LOGICAL" "DONT_SUSPEND_EMACS") | |
47 (progn | |
48 (save-some-buffers) | |
49 (kill-emacs 1)) | |
50 (kill-buffer (current-buffer)) | |
51 (suspend-emacs))) | |
52 | |
53 (defun vms-pmail-abort () | |
54 "Mark buffer as unmodified and exit emacs. | |
55 When the editor is exited without saving its buffer, VMS mail does not | |
56 send a message. If you have other modified buffers you will be | |
57 prompted for what to do with them." | |
58 (interactive) | |
59 (if (not (yes-or-no-p "Really abort mail? ")) | |
60 (ding) | |
61 (not-modified) | |
62 (if (vms-system-info "LOGICAL" "DONT_SUSPEND_EMACS") | |
63 (progn | |
64 (save-some-buffers) | |
65 (kill-emacs 1)) | |
66 (kill-buffer (current-buffer)) | |
67 (suspend-emacs)))) | |
68 | |
69 (defun vms-pmail-setup () | |
70 "Set up file assuming use by VMS MAIL utility. | |
71 The buffer is put into text-mode, auto-save is turned off and the | |
72 following bindings are established. | |
73 | |
74 \\[vms-pmail-save-and-exit] vms-pmail-save-and-exit | |
75 \\[vms-pmail-abort] vms-pmail-abort | |
76 | |
77 All other emacs commands are still available." | |
78 (interactive) | |
79 (auto-save-mode -1) | |
80 (text-mode) | |
81 (let ((default (vms-system-info "LOGICAL" "SYS$SCRATCH")) | |
82 (directory (file-name-directory (buffer-file-name))) | |
83 (filename (file-name-nondirectory (buffer-file-name)))) | |
84 (if (string= directory "SYS$SCRATCH:") | |
85 (progn | |
86 (cd default) | |
87 (setq buffer-file-name (concat default filename)))) | |
88 (use-local-map (copy-keymap (current-local-map))) | |
89 (local-set-key "\C-c\C-c" 'vms-pmail-save-and-exit) | |
90 (local-set-key "\C-c\C-g" 'vms-pmail-abort))) | |
91 | |
92 (defun indicate-mail-reply-text () | |
93 "Prepares received mail for re-sending by placing >'s on each line." | |
94 (interactive) | |
95 (goto-char (point-min)) | |
96 (while (not (eobp)) | |
97 (insert ">") | |
98 (beginning-of-line) | |
99 (forward-line 1)) | |
100 (set-buffer-modified-p nil) | |
101 (goto-char (point-min))) | |
102 | |
103 (defun insert-signature () | |
104 "Moves to the end of the buffer and inserts a \"signature\" file. | |
105 First try the file indicated by environment variable MAIL$TRAILER. | |
106 If that fails, try the file \"~/.signature\". | |
107 If neither file exists, fails quietly." | |
108 (interactive) | |
109 (end-of-buffer) | |
110 (newline) | |
111 (if (vms-system-info "LOGICAL" "MAIL$TRAILER") | |
112 (if (file-attributes (vms-system-info "LOGICAL" "MAIL$TRAILER")) | |
113 (insert-file-contents (vms-system-info "LOGICAL" "MAIL$TRAILER")) | |
114 (if (file-attributes "~/.signature") | |
115 (insert-file-contents "~/.signature"))))) | |
116 | |
18383 | 117 (provide 'vms-pmail) |
118 | |
2232
4f9d60f7de9d
Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1190
diff
changeset
|
119 ;;; vms-pmail.el ends here |