Mercurial > emacs
annotate lisp/mail/rmailedit.el @ 19860:c17fd465ea95 libc-970911 libc-970912 libc-970913 libc-970914 libc-970915 libc-970916 libc-970917 libc-970918 libc-970919 libc-970920 libc-970921 libc-970922 libc-970923 libc-970924 libc-970925 libc-970926 libc-970927 libc-970928 libc-970929 libc-970930 libc-971001 libc-971018 libc-971019 libc-971020 libc-971021 libc-971022 libc-971023 libc-971024 libc-971025 libc-971026 libc-971027 libc-971028 libc-971029 libc-971030 libc-971031 libc-971101 libc-971102 libc-971103 libc-971104 libc-971105 libc-971106 libc-971107 libc-971108 libc-971109 libc-971110 libc-971111 libc-971112 libc-971113 libc-971114 libc-971115 libc-971116 libc-971117 libc-971118 libc-971120 libc-971121 libc-971122 libc-971123 libc-971124 libc-971125 libc-971126 libc-971127 libc-971128 libc-971129 libc-971130 libc-971201 libc-971203 libc-971204 libc-971205 libc-971206 libc-971207 libc-971208 libc-971209 libc-971210 libc-971211 libc-971212 libc-971213 libc-971214 libc-971217 libc-971218 libc-971219 libc-971220 libc-971221 libc-971222 libc-971223 libc-971224 libc-971225 libc-971226 libc-971227 libc-971228 libc-971229 libc-971230 libc-971231 libc-980103 libc-980104 libc-980105 libc-980106 libc-980107 libc-980108 libc-980109 libc-980110 libc-980111 libc-980112 libc-980114 libc-980115 libc-980116 libc-980117 libc-980118 libc-980119 libc-980120 libc-980121 libc-980122 libc-980123 libc-980124 libc-980125 libc-980126 libc-980127 libc-980128
typos.
author | Jeff Law <law@redhat.com> |
---|---|
date | Wed, 10 Sep 1997 21:16:20 +0000 |
parents | d710d3502336 |
children | 779c7dcd4c04 |
rev | line source |
---|---|
658
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
368
diff
changeset
|
1 ;;; rmailedit.el --- "RMAIL edit mode" Edit the current message. |
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
368
diff
changeset
|
2 |
7300 | 3 ;; Copyright (C) 1985, 1994 Free Software Foundation, Inc. |
845 | 4 |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
5 ;; Maintainer: FSF |
814
38b2499cb3e9
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
807
diff
changeset
|
6 ;; Keywords: mail |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
7 |
36 | 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 | |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
12 ;; the Free Software Foundation; either version 2, or (at your option) |
36 | 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. | |
36 | 24 |
807
4f28bd14272c
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
658
diff
changeset
|
25 ;;; Code: |
36 | 26 |
27 (require 'rmail) | |
28 | |
29 (defvar rmail-edit-map nil) | |
30 (if rmail-edit-map | |
31 nil | |
4179
dfc4e9e14d24
(rmail-edit-map): Inherit properly from text-mode-map;
Richard M. Stallman <rms@gnu.org>
parents:
845
diff
changeset
|
32 ;; Make a keymap that inherits text-mode-map. |
dfc4e9e14d24
(rmail-edit-map): Inherit properly from text-mode-map;
Richard M. Stallman <rms@gnu.org>
parents:
845
diff
changeset
|
33 (setq rmail-edit-map (nconc (make-sparse-keymap) text-mode-map)) |
36 | 34 (define-key rmail-edit-map "\C-c\C-c" 'rmail-cease-edit) |
35 (define-key rmail-edit-map "\C-c\C-]" 'rmail-abort-edit)) | |
36 | |
37 ;; Rmail Edit mode is suitable only for specially formatted data. | |
38 (put 'rmail-edit-mode 'mode-class 'special) | |
39 | |
40 (defun rmail-edit-mode () | |
41 "Major mode for editing the contents of an RMAIL message. | |
42 The editing commands are the same as in Text mode, together with two commands | |
43 to return to regular RMAIL: | |
44 * rmail-abort-edit cancels the changes | |
45 you have made and returns to RMAIL | |
46 * rmail-cease-edit makes them permanent. | |
47 \\{rmail-edit-map}" | |
48 (use-local-map rmail-edit-map) | |
49 (setq major-mode 'rmail-edit-mode) | |
50 (setq mode-name "RMAIL Edit") | |
51 (if (boundp 'mode-line-modified) | |
52 (setq mode-line-modified (default-value 'mode-line-modified)) | |
53 (setq mode-line-format (default-value 'mode-line-format))) | |
6723
6ff74185a672
(rmail-edit-mode, rmail-cease-edit): Disable summary during edit.
Karl Heuer <kwzh@gnu.org>
parents:
5851
diff
changeset
|
54 (if (rmail-summary-exists) |
6726 | 55 (save-excursion |
56 (set-buffer rmail-summary-buffer) | |
57 (rmail-summary-disable))) | |
36 | 58 (run-hooks 'text-mode-hook 'rmail-edit-mode-hook)) |
59 | |
16347
d710d3502336
(rmail-edit-current-message): Add autoload.
Richard M. Stallman <rms@gnu.org>
parents:
14326
diff
changeset
|
60 ;;;###autoload |
36 | 61 (defun rmail-edit-current-message () |
62 "Edit the contents of this message." | |
63 (interactive) | |
64 (rmail-edit-mode) | |
65 (make-local-variable 'rmail-old-text) | |
66 (setq rmail-old-text (buffer-substring (point-min) (point-max))) | |
67 (setq buffer-read-only nil) | |
11573
4ad650d4a65b
(rmail-edit-current-message): Use force-mode-line-update.
Karl Heuer <kwzh@gnu.org>
parents:
8498
diff
changeset
|
68 (force-mode-line-update) |
36 | 69 (if (and (eq (key-binding "\C-c\C-c") 'rmail-cease-edit) |
70 (eq (key-binding "\C-c\C-]") 'rmail-abort-edit)) | |
71 (message "Editing: Type C-c C-c to return to Rmail, C-c C-] to abort") | |
14326
e5799768c51b
(rmail-edit-current-message): Pass proper format string to message.
Karl Heuer <kwzh@gnu.org>
parents:
14169
diff
changeset
|
72 (message "%s" (substitute-command-keys |
36 | 73 "Editing: Type \\[rmail-cease-edit] to return to Rmail, \\[rmail-abort-edit] to abort")))) |
74 | |
75 (defun rmail-cease-edit () | |
76 "Finish editing message; switch back to Rmail proper." | |
77 (interactive) | |
6723
6ff74185a672
(rmail-edit-mode, rmail-cease-edit): Disable summary during edit.
Karl Heuer <kwzh@gnu.org>
parents:
5851
diff
changeset
|
78 (if (rmail-summary-exists) |
6726 | 79 (save-excursion |
80 (set-buffer rmail-summary-buffer) | |
81 (rmail-summary-enable))) | |
36 | 82 ;; Make sure buffer ends with a newline. |
83 (save-excursion | |
84 (goto-char (point-max)) | |
85 (if (/= (preceding-char) ?\n) | |
86 (insert "\n")) | |
87 ;; Adjust the marker that points to the end of this message. | |
88 (set-marker (aref rmail-message-vector (1+ rmail-current-message)) | |
89 (point))) | |
90 (let ((old rmail-old-text)) | |
11573
4ad650d4a65b
(rmail-edit-current-message): Use force-mode-line-update.
Karl Heuer <kwzh@gnu.org>
parents:
8498
diff
changeset
|
91 (force-mode-line-update) |
36 | 92 (rmail-mode-1) |
93 (if (and (= (length old) (- (point-max) (point-min))) | |
94 (string= old (buffer-substring (point-min) (point-max)))) | |
95 () | |
96 (setq old nil) | |
97 (rmail-set-attribute "edited" t) | |
98 (if (boundp 'rmail-summary-vector) | |
99 (progn | |
100 (aset rmail-summary-vector (1- rmail-current-message) nil) | |
101 (save-excursion | |
102 (rmail-widen-to-current-msgbeg | |
103 (function (lambda () | |
104 (forward-line 2) | |
105 (if (looking-at "Summary-line: ") | |
106 (let ((buffer-read-only nil)) | |
107 (delete-region (point) | |
108 (progn (forward-line 1) | |
109 (point)))))))) | |
110 (rmail-show-message)))))) | |
111 (setq buffer-read-only t)) | |
112 | |
113 (defun rmail-abort-edit () | |
114 "Abort edit of current message; restore original contents." | |
115 (interactive) | |
116 (delete-region (point-min) (point-max)) | |
117 (insert rmail-old-text) | |
8498
ba1acb3cf835
(rmail-abort-edit): Call `rmail-highlight-headers'.
Richard M. Stallman <rms@gnu.org>
parents:
7562
diff
changeset
|
118 (rmail-cease-edit) |
ba1acb3cf835
(rmail-abort-edit): Call `rmail-highlight-headers'.
Richard M. Stallman <rms@gnu.org>
parents:
7562
diff
changeset
|
119 (rmail-highlight-headers)) |
36 | 120 |
658
7cbd4fcd8b0f
*** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents:
368
diff
changeset
|
121 ;;; rmailedit.el ends here |