Mercurial > emacs
annotate lisp/mail/pmailedit.el @ 100581:a9602a27b979
(pmail-expunge-and-save): Call pmail-swap-buffers-maybe before
saving.
(pmail-quit): Handling expunging manually, instead of calling
pmail-expunge-and-save.
(pmail-next-undeleted-message): If no other message can be shown,
show the current one.
author | Chong Yidong <cyd@stupidchicken.com> |
---|---|
date | Sat, 20 Dec 2008 04:29:26 +0000 |
parents | 2d0b98e2cb33 |
children | 14070fe82d72 |
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 |
100229 | 32 (require 'pmailhdr) |
33 | |
97528
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
34 (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
|
35 "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
|
36 :type 'hook |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
37 :version "21.1" |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
38 :group 'pmail-edit) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
39 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
40 (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
|
41 |
100225
cff49a741231
Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
42 (defvar pmail-edit-map nil) |
cff49a741231
Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
43 (if pmail-edit-map |
cff49a741231
Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
44 nil |
cff49a741231
Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
45 ;; Make a keymap that inherits text-mode-map. |
cff49a741231
Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
46 (setq pmail-edit-map (make-sparse-keymap)) |
cff49a741231
Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
47 (set-keymap-parent pmail-edit-map text-mode-map) |
cff49a741231
Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
48 (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
|
49 (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
|
50 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
51 ;; 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
|
52 (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
|
53 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
54 (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
|
55 (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
|
56 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
57 (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
|
58 "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
|
59 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
|
60 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
|
61 * \\[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
|
62 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
|
63 * \\[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
|
64 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
|
65 \\{pmail-edit-map}" |
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 (defvar pmail-edit-saved-coding-system nil) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
83 (put 'pmail-edit-saved-coding-system 'permanent-local t) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
84 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
85 ;;;###autoload |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
86 (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
|
87 "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
|
88 (interactive) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
89 (if (= pmail-total-messages 0) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
90 (error "No messages in this file")) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
91 (make-local-variable 'pmail-old-pruned) |
100225
cff49a741231
Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
92 (setq pmail-old-pruned (eq pmail-header-style 'normal)) |
97528
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-edit-saved-coding-system) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
94 (setq pmail-edit-saved-coding-system save-buffer-coding-system) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
95 (pmail-header-show-headers) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
96 (pmail-edit-mode) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
97 ;; As the local value of save-buffer-coding-system is deleted by |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
98 ;; pmail-edit-mode, we restore the original value. |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
99 (make-local-variable 'save-buffer-coding-system) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
100 (setq save-buffer-coding-system pmail-edit-saved-coding-system) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
101 (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
|
102 (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
|
103 (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
|
104 (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
|
105 (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
|
106 (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
|
107 (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
|
108 (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
|
109 "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
|
110 |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
111 (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
|
112 "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
|
113 (interactive) |
100225
cff49a741231
Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
114 (if (pmail-summary-exists) |
cff49a741231
Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
115 (save-excursion |
cff49a741231
Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
116 (set-buffer pmail-summary-buffer) |
cff49a741231
Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
117 (pmail-summary-enable))) |
97528
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
118 ;; Make sure buffer ends with a newline. |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
119 (save-excursion |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
120 (goto-char (point-max)) |
100225
cff49a741231
Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
121 (if (/= (preceding-char) ?\n) |
cff49a741231
Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
122 (insert "\n")) |
cff49a741231
Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
123 ;; 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
|
124 (set-marker (aref pmail-message-vector (1+ pmail-current-message)) |
cff49a741231
Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
125 (point))) |
97528
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
126 (let ((old pmail-old-text)) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
127 (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
|
128 (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
|
129 (pmail-mode-1) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
130 (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
|
131 (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
|
132 (pmail-variables) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
133 ;; As the local value of save-buffer-coding-system is changed by |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
134 ;; pmail-variables, we restore the original value. |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
135 (setq save-buffer-coding-system pmail-edit-saved-coding-system) |
100225
cff49a741231
Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
136 (if (and (= (length old) (- (point-max) (point-min))) |
cff49a741231
Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
137 (string= old (buffer-substring (point-min) (point-max)))) |
cff49a741231
Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
138 () |
97528
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
139 (setq old nil) |
100225
cff49a741231
Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
140 (pmail-set-attribute "edited" t) |
cff49a741231
Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
141 (if (boundp 'pmail-summary-vector) |
cff49a741231
Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
142 (progn |
cff49a741231
Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
143 (aset pmail-summary-vector (1- pmail-current-message) nil) |
cff49a741231
Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
144 (save-excursion |
cff49a741231
Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
145 (pmail-widen-to-current-msgbeg |
cff49a741231
Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
146 (function (lambda () |
cff49a741231
Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
147 (forward-line 2) |
cff49a741231
Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
148 (if (looking-at "Summary-line: ") |
cff49a741231
Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
149 (let ((buffer-read-only nil)) |
cff49a741231
Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
150 (delete-region (point) |
cff49a741231
Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
151 (progn (forward-line 1) |
cff49a741231
Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
152 (point)))))))))))) |
97528
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
153 (save-excursion |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
154 (pmail-show-message) |
100225
cff49a741231
Sync with rmailedit.el.
Chong Yidong <cyd@stupidchicken.com>
parents:
98019
diff
changeset
|
155 (pmail-toggle-header (if pmail-old-pruned 1 0)))) |
97528
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
156 (run-hooks 'pmail-mode-hook) |
184bb2071e3f
mail/: Add new (temporary) libaries for which to test Rmail/mbox such
Paul Reilly <pmr@pajato.com>
parents:
diff
changeset
|
157 (setq buffer-read-only t)) |
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 | 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 |