Mercurial > emacs
annotate lisp/mail/vms-pmail.el @ 75821:842cfcb70d5e
Unknown copyrights for emacs.xbm and gnu.xpm:
Remove images, which are unused.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Mon, 12 Feb 2007 21:51:58 +0000 |
parents | e3694f1cb928 |
children | 8e27d63c45eb 95d0cdf160ea |
rev | line source |
---|---|
38412
253f761ad37b
Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents:
30285
diff
changeset
|
1 ;;; vms-pmail.el --- use Emacs as the editor within VMS mail |
2232
4f9d60f7de9d
Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1190
diff
changeset
|
2 |
74509 | 3 ;; Copyright (C) 1992, 2001, 2002, 2003, 2004, 2005, |
75347 | 4 ;; 2006, 2007 Free Software Foundation, Inc. |
1190 | 5 |
18013 | 6 ;; Author: Roland B Roberts <roberts@panix.com> |
30285 | 7 ;; Maintainer: FSF |
2247
2c7997f249eb
Add or correct keywords
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
2232
diff
changeset
|
8 ;; Keywords: vms |
1190 | 9 |
10 ;; This file is part of GNU Emacs. | |
11 | |
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. | |
16 | |
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. | |
21 | |
22 ;; You should have received a copy of the GNU General Public License | |
14169 | 23 ;; along with GNU Emacs; see the file COPYING. If not, write to the |
64085 | 24 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
25 ;; Boston, MA 02110-1301, USA. | |
1190 | 26 |
38412
253f761ad37b
Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents:
30285
diff
changeset
|
27 ;;; Commentary: |
253f761ad37b
Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents:
30285
diff
changeset
|
28 |
1190 | 29 ;;; Code: |
30 | |
31 ;;; | |
32 ;;; Quick hack to use emacs as mail editor. There are a *bunch* of | |
33 ;;; changes scattered throughout emacs to make this work, namely: | |
34 ;;; (1) mod to sysdep.c to allow emacs to attach to a process other | |
35 ;;; than the one that originally spawned it. | |
36 ;;; (2) mod to kepteditor.com to define the logical emacs_parent_pid | |
37 ;;; which is what sysdep.c looks for, and define the logical | |
38 ;;; emacs_command_args which contains the command line | |
39 ;;; (3) mod to re-parse command line arguments from emacs_command_args | |
40 ;;; then execute them as though emacs were just starting up. | |
41 ;;; | |
42 (defun vms-pmail-save-and-exit () | |
73737
401ef839523a
(vms-pmail-save-and-exit, vms-pmail-abort, vms-pmail-setup):
Juanma Barranquero <lekktu@gmail.com>
parents:
68648
diff
changeset
|
43 "Save current buffer and exit Emacs. |
401ef839523a
(vms-pmail-save-and-exit, vms-pmail-abort, vms-pmail-setup):
Juanma Barranquero <lekktu@gmail.com>
parents:
68648
diff
changeset
|
44 If this Emacs cannot be suspended, you will be prompted about modified |
401ef839523a
(vms-pmail-save-and-exit, vms-pmail-abort, vms-pmail-setup):
Juanma Barranquero <lekktu@gmail.com>
parents:
68648
diff
changeset
|
45 buffers other than the mail buffer. BEWARE --- suspending Emacs without |
1190 | 46 saving your mail buffer causes mail to abort the send (potentially useful |
47 since the mail buffer is still here)." | |
48 (interactive) | |
49 (basic-save-buffer) | |
50 (if (vms-system-info "LOGICAL" "DONT_SUSPEND_EMACS") | |
51 (progn | |
52 (save-some-buffers) | |
53 (kill-emacs 1)) | |
54 (kill-buffer (current-buffer)) | |
55 (suspend-emacs))) | |
56 | |
57 (defun vms-pmail-abort () | |
73737
401ef839523a
(vms-pmail-save-and-exit, vms-pmail-abort, vms-pmail-setup):
Juanma Barranquero <lekktu@gmail.com>
parents:
68648
diff
changeset
|
58 "Mark buffer as unmodified and exit Emacs. |
1190 | 59 When the editor is exited without saving its buffer, VMS mail does not |
60 send a message. If you have other modified buffers you will be | |
61 prompted for what to do with them." | |
62 (interactive) | |
63 (if (not (yes-or-no-p "Really abort mail? ")) | |
64 (ding) | |
65 (not-modified) | |
66 (if (vms-system-info "LOGICAL" "DONT_SUSPEND_EMACS") | |
67 (progn | |
68 (save-some-buffers) | |
69 (kill-emacs 1)) | |
70 (kill-buffer (current-buffer)) | |
71 (suspend-emacs)))) | |
72 | |
73 (defun vms-pmail-setup () | |
74 "Set up file assuming use by VMS MAIL utility. | |
75 The buffer is put into text-mode, auto-save is turned off and the | |
76 following bindings are established. | |
77 | |
78 \\[vms-pmail-save-and-exit] vms-pmail-save-and-exit | |
79 \\[vms-pmail-abort] vms-pmail-abort | |
80 | |
73737
401ef839523a
(vms-pmail-save-and-exit, vms-pmail-abort, vms-pmail-setup):
Juanma Barranquero <lekktu@gmail.com>
parents:
68648
diff
changeset
|
81 All other Emacs commands are still available." |
1190 | 82 (interactive) |
83 (auto-save-mode -1) | |
84 (text-mode) | |
85 (let ((default (vms-system-info "LOGICAL" "SYS$SCRATCH")) | |
86 (directory (file-name-directory (buffer-file-name))) | |
87 (filename (file-name-nondirectory (buffer-file-name)))) | |
88 (if (string= directory "SYS$SCRATCH:") | |
89 (progn | |
90 (cd default) | |
91 (setq buffer-file-name (concat default filename)))) | |
92 (use-local-map (copy-keymap (current-local-map))) | |
93 (local-set-key "\C-c\C-c" 'vms-pmail-save-and-exit) | |
94 (local-set-key "\C-c\C-g" 'vms-pmail-abort))) | |
95 | |
96 (defun indicate-mail-reply-text () | |
97 "Prepares received mail for re-sending by placing >'s on each line." | |
98 (interactive) | |
99 (goto-char (point-min)) | |
100 (while (not (eobp)) | |
101 (insert ">") | |
102 (beginning-of-line) | |
103 (forward-line 1)) | |
104 (set-buffer-modified-p nil) | |
105 (goto-char (point-min))) | |
106 | |
107 (defun insert-signature () | |
108 "Moves to the end of the buffer and inserts a \"signature\" file. | |
109 First try the file indicated by environment variable MAIL$TRAILER. | |
110 If that fails, try the file \"~/.signature\". | |
111 If neither file exists, fails quietly." | |
112 (interactive) | |
113 (end-of-buffer) | |
114 (newline) | |
115 (if (vms-system-info "LOGICAL" "MAIL$TRAILER") | |
116 (if (file-attributes (vms-system-info "LOGICAL" "MAIL$TRAILER")) | |
117 (insert-file-contents (vms-system-info "LOGICAL" "MAIL$TRAILER")) | |
118 (if (file-attributes "~/.signature") | |
119 (insert-file-contents "~/.signature"))))) | |
120 | |
18383 | 121 (provide 'vms-pmail) |
122 | |
52401 | 123 ;;; arch-tag: 336850fc-7812-4663-8e4d-b9c13f47dce1 |
2232
4f9d60f7de9d
Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
1190
diff
changeset
|
124 ;;; vms-pmail.el ends here |