annotate lisp/mail/vms-pmail.el @ 95362:e886c765584a

* src/fileio.c (Fwrite_region): Delay the defaulting to beg&z to after calling build_annotations. * lisp/files.el (basic-save-buffer-2): Pass nil rather than (point-min) to write-region.
author Stefan Monnier <monnier@iro.umontreal.ca>
date Wed, 28 May 2008 12:36:15 +0000
parents ef65fa4dca3b
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
86503
2c08ad76fc1f * progmodes/cperl-mode.el (compilation-error-regexp-alist): Pacify
Dan Nicolaescu <dann@ics.uci.edu>
parents: 85529
diff changeset
1 ;; -*- no-byte-compile: t -*-
38412
253f761ad37b Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents: 30285
diff changeset
2 ;;; 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
3
74509
f7702c5f335d Update copyright years.
Glenn Morris <rgm@gnu.org>
parents: 73737
diff changeset
4 ;; Copyright (C) 1992, 2001, 2002, 2003, 2004, 2005,
79712
de499b20517a Add 2008 to copyright years.
Glenn Morris <rgm@gnu.org>
parents: 78232
diff changeset
5 ;; 2006, 2007, 2008 Free Software Foundation, Inc.
1190
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
6
18013
e35b7126595f Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 14169
diff changeset
7 ;; Author: Roland B Roberts <roberts@panix.com>
30285
0ff2877c9bbe Change maintainer to FSF.
Gerd Moellmann <gerd@gnu.org>
parents: 18383
diff changeset
8 ;; Maintainer: FSF
2247
2c7997f249eb Add or correct keywords
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 2232
diff changeset
9 ;; Keywords: vms
1190
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
10
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
11 ;; This file is part of GNU Emacs.
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
12
94674
ef65fa4dca3b Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
13 ;; GNU Emacs is free software: you can redistribute it and/or modify
1190
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
14 ;; it under the terms of the GNU General Public License as published by
94674
ef65fa4dca3b Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
15 ;; the Free Software Foundation, either version 3 of the License, or
ef65fa4dca3b Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
16 ;; (at your option) any later version.
1190
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
17
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
18 ;; GNU Emacs is distributed in the hope that it will be useful,
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
19 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
20 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
21 ;; GNU General Public License for more details.
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
22
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
23 ;; You should have received a copy of the GNU General Public License
94674
ef65fa4dca3b Switch to recommended form of GPLv3 permissions notice.
Glenn Morris <rgm@gnu.org>
parents: 93975
diff changeset
24 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
1190
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
25
38412
253f761ad37b Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents: 30285
diff changeset
26 ;;; Commentary:
253f761ad37b Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents: 30285
diff changeset
27
1190
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
28 ;;; Code:
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
29
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
30 ;;;
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
31 ;;; 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
32 ;;; changes scattered throughout emacs to make this work, namely:
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
33 ;;; (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
34 ;;; than the one that originally spawned it.
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
35 ;;; (2) mod to kepteditor.com to define the logical emacs_parent_pid
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
36 ;;; which is what sysdep.c looks for, and define the logical
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
37 ;;; emacs_command_args which contains the command line
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
38 ;;; (3) mod to re-parse command line arguments from emacs_command_args
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
39 ;;; then execute them as though emacs were just starting up.
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
40 ;;;
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
41 (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
42 "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
43 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
44 buffers other than the mail buffer. BEWARE --- suspending Emacs without
1190
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
45 saving your mail buffer causes mail to abort the send (potentially useful
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
46 since the mail buffer is still here)."
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
47 (interactive)
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
48 (basic-save-buffer)
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
49 (if (vms-system-info "LOGICAL" "DONT_SUSPEND_EMACS")
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
50 (progn
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
51 (save-some-buffers)
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
52 (kill-emacs 1))
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
53 (kill-buffer (current-buffer))
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
54 (suspend-emacs)))
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
55
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
56 (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
57 "Mark buffer as unmodified and exit Emacs.
1190
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
58 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
59 send a message. If you have other modified buffers you will be
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
60 prompted for what to do with them."
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
61 (interactive)
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
62 (if (not (yes-or-no-p "Really abort mail? "))
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
63 (ding)
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
64 (not-modified)
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
65 (if (vms-system-info "LOGICAL" "DONT_SUSPEND_EMACS")
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
66 (progn
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
67 (save-some-buffers)
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
68 (kill-emacs 1))
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
69 (kill-buffer (current-buffer))
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
70 (suspend-emacs))))
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
71
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
72 (defun vms-pmail-setup ()
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
73 "Set up file assuming use by VMS MAIL utility.
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
74 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
75 following bindings are established.
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 \\[vms-pmail-save-and-exit] vms-pmail-save-and-exit
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
78 \\[vms-pmail-abort] vms-pmail-abort
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
79
73737
401ef839523a (vms-pmail-save-and-exit, vms-pmail-abort, vms-pmail-setup):
Juanma Barranquero <lekktu@gmail.com>
parents: 68648
diff changeset
80 All other Emacs commands are still available."
1190
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
81 (interactive)
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
82 (auto-save-mode -1)
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
83 (text-mode)
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
84 (let ((default (vms-system-info "LOGICAL" "SYS$SCRATCH"))
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
85 (directory (file-name-directory (buffer-file-name)))
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
86 (filename (file-name-nondirectory (buffer-file-name))))
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
87 (if (string= directory "SYS$SCRATCH:")
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
88 (progn
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
89 (cd default)
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
90 (setq buffer-file-name (concat default filename))))
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
91 (use-local-map (copy-keymap (current-local-map)))
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
92 (local-set-key "\C-c\C-c" 'vms-pmail-save-and-exit)
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
93 (local-set-key "\C-c\C-g" 'vms-pmail-abort)))
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
94
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
95 (defun indicate-mail-reply-text ()
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
96 "Prepares received mail for re-sending by placing >'s on each line."
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
97 (interactive)
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
98 (goto-char (point-min))
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
99 (while (not (eobp))
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
100 (insert ">")
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
101 (beginning-of-line)
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
102 (forward-line 1))
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
103 (set-buffer-modified-p nil)
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
104 (goto-char (point-min)))
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
105
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
106 (defun insert-signature ()
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
107 "Moves to the end of the buffer and inserts a \"signature\" file.
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
108 First try the file indicated by environment variable MAIL$TRAILER.
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
109 If that fails, try the file \"~/.signature\".
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
110 If neither file exists, fails quietly."
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
111 (interactive)
85529
84efd7d3c35e * mail/vms-pmail.el (insert-signature): Don't use end-of-buffer.
Dan Nicolaescu <dann@ics.uci.edu>
parents: 78232
diff changeset
112 (goto-char (point-max))
1190
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
113 (newline)
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
114 (if (vms-system-info "LOGICAL" "MAIL$TRAILER")
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
115 (if (file-attributes (vms-system-info "LOGICAL" "MAIL$TRAILER"))
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
116 (insert-file-contents (vms-system-info "LOGICAL" "MAIL$TRAILER"))
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
117 (if (file-attributes "~/.signature")
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
118 (insert-file-contents "~/.signature")))))
747b98b6d825 Initial revision
Richard M. Stallman <rms@gnu.org>
parents:
diff changeset
119
18383
11218164bc54 Add provide call.
Richard M. Stallman <rms@gnu.org>
parents: 18013
diff changeset
120 (provide 'vms-pmail)
11218164bc54 Add provide call.
Richard M. Stallman <rms@gnu.org>
parents: 18013
diff changeset
121
93975
1e3a407766b9 Fix up comment convention on the arch-tag lines.
Stefan Monnier <monnier@iro.umontreal.ca>
parents: 87649
diff changeset
122 ;; arch-tag: 336850fc-7812-4663-8e4d-b9c13f47dce1
2232
4f9d60f7de9d Add standard library headers.
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 1190
diff changeset
123 ;;; vms-pmail.el ends here