annotate lisp/mail/pmailedit.el @ 100696:f78a8298540c

(Directory Variables): Explain what is a "project". Add indexing. Improve wording. Add a footnote about using _dir-locals.el on MS-DOS.
author Eli Zaretskii <eliz@gnu.org>
date Fri, 26 Dec 2008 16:00:56 +0000
parents 818439524f9b
children 02ad31ca52a9
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
1 ;;; pmailedit.el --- "PMAIL edit mode" Edit the current message
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
2
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
3 ;; Copyright (C) 1985, 1994, 2001, 2002, 2003, 2004, 2005, 2006,
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
4 ;; 2007, 2008 Free Software Foundation, Inc.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
5
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
6 ;; Maintainer: FSF
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
7 ;; Keywords: mail
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
8
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
9 ;; This file is part of GNU Emacs.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
10
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
11 ;; GNU Emacs is free software: you can redistribute it and/or modify
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
12 ;; it under the terms of the GNU General Public License as published by
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
13 ;; the Free Software Foundation, either version 3 of the License, or
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
14 ;; (at your option) any later version.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
15
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
16 ;; GNU Emacs is distributed in the hope that it will be useful,
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
17 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
18 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
19 ;; GNU General Public License for more details.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
20
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
21 ;; You should have received a copy of the GNU General Public License
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
22 ;; along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
23
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
24 ;;; Commentary:
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
25
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
26 ;;; Code:
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
27
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
28 (eval-when-compile
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
29 (require 'pmail)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
30 (require 'pmailsum))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
31
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
32 (defcustom pmail-edit-mode-hook nil
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
33 "List of functions to call when editing an PMAIL message."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
34 :type 'hook
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
35 :version "21.1"
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
36 :group 'pmail-edit)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
37
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
38 (defvar pmail-old-text)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
39
100225
cff49a741231 Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
40 (defvar pmail-edit-map nil)
cff49a741231 Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
41 (if pmail-edit-map
cff49a741231 Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
42 nil
cff49a741231 Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
43 ;; Make a keymap that inherits text-mode-map.
cff49a741231 Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
44 (setq pmail-edit-map (make-sparse-keymap))
cff49a741231 Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
45 (set-keymap-parent pmail-edit-map text-mode-map)
cff49a741231 Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
46 (define-key pmail-edit-map "\C-c\C-c" 'pmail-cease-edit)
cff49a741231 Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
47 (define-key pmail-edit-map "\C-c\C-]" 'pmail-abort-edit))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
48
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
49 ;; Pmail Edit mode is suitable only for specially formatted data.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
50 (put 'pmail-edit-mode 'mode-class 'special)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
51
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
52 (declare-function pmail-summary-disable "" ())
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
53 (declare-function pmail-summary-enable "pmailsum" ())
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
54
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
55 (defun pmail-edit-mode ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
56 "Major mode for editing the contents of an PMAIL message.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
57 The editing commands are the same as in Text mode, together with two commands
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
58 to return to regular PMAIL:
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
59 * \\[pmail-abort-edit] cancels the changes
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
60 you have made and returns to PMAIL
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
61 * \\[pmail-cease-edit] makes them permanent.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
62 This functions runs the normal hook `pmail-edit-mode-hook'.
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
63 \\{pmail-edit-map}"
100659
b8a72d8ed8b5 (pmail-edit-current-message): Change error message.
Richard M. Stallman <rms@gnu.org>
parents: 100658
diff changeset
64 ;; Changing the major mode unswaps the Pmail buffer
b8a72d8ed8b5 (pmail-edit-current-message): Change error message.
Richard M. Stallman <rms@gnu.org>
parents: 100658
diff changeset
65 ;; via change-major-mode-hook.
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
66 (delay-mode-hooks (text-mode))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
67 (use-local-map pmail-edit-map)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
68 (setq major-mode 'pmail-edit-mode)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
69 (setq mode-name "PMAIL Edit")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
70 (if (boundp 'mode-line-modified)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
71 (setq mode-line-modified (default-value 'mode-line-modified))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
72 (setq mode-line-format (default-value 'mode-line-format)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
73 (if (pmail-summary-exists)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
74 (save-excursion
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
75 (set-buffer pmail-summary-buffer)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
76 (pmail-summary-disable)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
77 (run-mode-hooks 'pmail-edit-mode-hook))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
78
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
79 (defvar pmail-old-pruned nil)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
80 (put 'pmail-old-pruned 'permanent-local t)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
81
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
82 ;;;###autoload
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
83 (defun pmail-edit-current-message ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
84 "Edit the contents of this message."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
85 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
86 (if (= pmail-total-messages 0)
100659
b8a72d8ed8b5 (pmail-edit-current-message): Change error message.
Richard M. Stallman <rms@gnu.org>
parents: 100658
diff changeset
87 (error "No messages in this buffer"))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
88 (make-local-variable 'pmail-old-pruned)
100225
cff49a741231 Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
89 (setq pmail-old-pruned (eq pmail-header-style 'normal))
100659
b8a72d8ed8b5 (pmail-edit-current-message): Change error message.
Richard M. Stallman <rms@gnu.org>
parents: 100658
diff changeset
90 ;; Changing the major mode unswaps the Pmail buffer
b8a72d8ed8b5 (pmail-edit-current-message): Change error message.
Richard M. Stallman <rms@gnu.org>
parents: 100658
diff changeset
91 ;; via change-major-mode-hook.
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
92 (pmail-edit-mode)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
93 (make-local-variable 'pmail-old-text)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
94 (setq pmail-old-text (buffer-substring (point-min) (point-max)))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
95 (setq buffer-read-only nil)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
96 (force-mode-line-update)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
97 (if (and (eq (key-binding "\C-c\C-c") 'pmail-cease-edit)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
98 (eq (key-binding "\C-c\C-]") 'pmail-abort-edit))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
99 (message "Editing: Type C-c C-c to return to Pmail, C-c C-] to abort")
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
100 (message "%s" (substitute-command-keys
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
101 "Editing: Type \\[pmail-cease-edit] to return to Pmail, \\[pmail-abort-edit] to abort"))))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
102
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
103 (defun pmail-cease-edit ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
104 "Finish editing message; switch back to Pmail proper."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
105 (interactive)
100225
cff49a741231 Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
106 (if (pmail-summary-exists)
cff49a741231 Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
107 (save-excursion
cff49a741231 Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
108 (set-buffer pmail-summary-buffer)
cff49a741231 Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
109 (pmail-summary-enable)))
100662
818439524f9b (pmail-cease-edit): Put `>' before `From ' lines in message.
Richard M. Stallman <rms@gnu.org>
parents: 100661
diff changeset
110 ;; Disguise any "From " lines so they don't start a new message.
818439524f9b (pmail-cease-edit): Put `>' before `From ' lines in message.
Richard M. Stallman <rms@gnu.org>
parents: 100661
diff changeset
111 (save-excursion
818439524f9b (pmail-cease-edit): Put `>' before `From ' lines in message.
Richard M. Stallman <rms@gnu.org>
parents: 100661
diff changeset
112 (goto-char (point-min))
818439524f9b (pmail-cease-edit): Put `>' before `From ' lines in message.
Richard M. Stallman <rms@gnu.org>
parents: 100661
diff changeset
113 (while (search-forward "\nFrom " nil t)
818439524f9b (pmail-cease-edit): Put `>' before `From ' lines in message.
Richard M. Stallman <rms@gnu.org>
parents: 100661
diff changeset
114 (beginning-of-line)
818439524f9b (pmail-cease-edit): Put `>' before `From ' lines in message.
Richard M. Stallman <rms@gnu.org>
parents: 100661
diff changeset
115 (insert ">")))
100661
af9f2d22b21d Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 100659
diff changeset
116 ;; Make sure buffer ends with a blank line
af9f2d22b21d Comment change.
Richard M. Stallman <rms@gnu.org>
parents: 100659
diff changeset
117 ;; so as not to run this message together with the following one.
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
118 (save-excursion
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
119 (goto-char (point-max))
100225
cff49a741231 Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
120 (if (/= (preceding-char) ?\n)
cff49a741231 Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
121 (insert "\n"))
100653
14070fe82d72 (pmailhdr): Don't require it.
Richard M. Stallman <rms@gnu.org>
parents: 100229
diff changeset
122 (unless (looking-back "\n\n")
14070fe82d72 (pmailhdr): Don't require it.
Richard M. Stallman <rms@gnu.org>
parents: 100229
diff changeset
123 (insert "\n"))
100225
cff49a741231 Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
124 ;; Adjust the marker that points to the end of this message.
cff49a741231 Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
125 (set-marker (aref pmail-message-vector (1+ pmail-current-message))
cff49a741231 Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
126 (point)))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
127 (let ((old pmail-old-text))
100659
b8a72d8ed8b5 (pmail-edit-current-message): Change error message.
Richard M. Stallman <rms@gnu.org>
parents: 100658
diff changeset
128 ;; Go back to Pmail mode, but carefully.
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
129 (force-mode-line-update)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
130 (kill-all-local-variables)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
131 (pmail-mode-1)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
132 (if (boundp 'tool-bar-map)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
133 (set (make-local-variable 'tool-bar-map) pmail-tool-bar-map))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
134 (pmail-variables)
100659
b8a72d8ed8b5 (pmail-edit-current-message): Change error message.
Richard M. Stallman <rms@gnu.org>
parents: 100658
diff changeset
135 ;; If text has really changed, mark message as edited.
100653
14070fe82d72 (pmailhdr): Don't require it.
Richard M. Stallman <rms@gnu.org>
parents: 100229
diff changeset
136 (unless (and (= (length old) (- (point-max) (point-min)))
14070fe82d72 (pmailhdr): Don't require it.
Richard M. Stallman <rms@gnu.org>
parents: 100229
diff changeset
137 (string= old (buffer-substring (point-min) (point-max))))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
138 (setq old nil)
100653
14070fe82d72 (pmailhdr): Don't require it.
Richard M. Stallman <rms@gnu.org>
parents: 100229
diff changeset
139 (pmail-set-attribute pmail-edited-attr-index t)
100659
b8a72d8ed8b5 (pmail-edit-current-message): Change error message.
Richard M. Stallman <rms@gnu.org>
parents: 100658
diff changeset
140 ;;;??? BROKEN perhaps.
b8a72d8ed8b5 (pmail-edit-current-message): Change error message.
Richard M. Stallman <rms@gnu.org>
parents: 100658
diff changeset
141 ;; I think that the Summary-Line header may not be kept there any more.
100225
cff49a741231 Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
142 (if (boundp 'pmail-summary-vector)
cff49a741231 Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
143 (progn
cff49a741231 Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
144 (aset pmail-summary-vector (1- pmail-current-message) nil)
cff49a741231 Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
145 (save-excursion
cff49a741231 Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
146 (pmail-widen-to-current-msgbeg
cff49a741231 Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
147 (function (lambda ()
cff49a741231 Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
148 (forward-line 2)
cff49a741231 Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
149 (if (looking-at "Summary-line: ")
cff49a741231 Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
150 (let ((buffer-read-only nil))
cff49a741231 Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
151 (delete-region (point)
cff49a741231 Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
152 (progn (forward-line 1)
cff49a741231 Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
153 (point))))))))))))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
154 (save-excursion
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
155 (pmail-show-message)
100225
cff49a741231 Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
156 (pmail-toggle-header (if pmail-old-pruned 1 0))))
100653
14070fe82d72 (pmailhdr): Don't require it.
Richard M. Stallman <rms@gnu.org>
parents: 100229
diff changeset
157 (run-hooks 'pmail-mode-hook))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
158
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
159 (defun pmail-abort-edit ()
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
160 "Abort edit of current message; restore original contents."
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
161 (interactive)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
162 (delete-region (point-min) (point-max))
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
163 (insert pmail-old-text)
100225
cff49a741231 Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
164 (pmail-cease-edit)
cff49a741231 Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents: 98019
diff changeset
165 (pmail-highlight-headers))
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
166
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
167 (provide 'pmailedit)
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
168
98019
72564311fb7b Add local variable setting for change-log-default-name.
Glenn Morris <rgm@gnu.org>
parents: 97533
diff changeset
169 ;; Local Variables:
72564311fb7b Add local variable setting for change-log-default-name.
Glenn Morris <rgm@gnu.org>
parents: 97533
diff changeset
170 ;; change-log-default-name: "ChangeLog.pmail"
72564311fb7b Add local variable setting for change-log-default-name.
Glenn Morris <rgm@gnu.org>
parents: 97533
diff changeset
171 ;; End:
72564311fb7b Add local variable setting for change-log-default-name.
Glenn Morris <rgm@gnu.org>
parents: 97533
diff changeset
172
97533
ec1125c7ac26 Add arch tagline
Miles Bader <miles@gnu.org>
parents: 97532
diff changeset
173 ;; arch-tag: 9524f335-12cc-4e95-9e9b-3208dc30550b
97528
184bb2071e3f mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff changeset
174 ;;; pmailedit.el ends here