annotate lisp/mail/rmailedit.el @ 59146:9bde7721ad0f

* dispextern.h: Change HAVE_CARBON to MAC_OS. (struct glyph_string): Likewise. * emacs.c (main) [MAC_OS8]: Call mac_term_init instead of mac_initialize. * fileio.c (Fnext_read_file_uses_dialog_p, Fread_file_name): Change TARGET_API_MAC_CARBON to HAVE_CARBON. * fns.c (vector): Change MAC_OSX to MAC_OS. * frame.c (x_set_frame_parameters, x_report_frame_params) (x_set_fullscreen): Remove #ifndef HAVE_CARBON. (x_set_border_width, Vdefault_frame_scroll_bars): Change HAVE_CARBON to MAC_OS. * image.c [MAC_OS]: Include sys/stat.h. [MAC_OS && !MAC_OSX]: Include sys/param.h, ImageCompression.h, and QuickTimeComponents.h. * mac.c [!MAC_OSX] (mac_wait_next_event): Add extern. [!MAC_OSX] (select): Use mac_wait_next_event. [!MAC_OSX] (run_mac_command): Change EXEC_SUFFIXES to Vexec_suffixes. [!MAC_OSX] (select, run_mac_command): Change `#ifdef TARGET_API_MAC_CARBON' to `#if TARGET_API_MAC_CARBON'. (mac_clear_font_name_table): Add extern. (Fmac_clear_font_name_table): New defun. (syms_of_mac): Defsubr it. [MAC_OSX] (SELECT_POLLING_PERIOD_USEC): New define. [MAC_OSX] (select_and_poll_event): New function. [MAC_OSX] (sys_select): Use it. [MAC_OSX && SELECT_USE_CFSOCKET] (socket_callback): New function. [MAC_OSX && SELECT_USE_CFSOCKET] (SELECT_TIMEOUT_THRESHOLD_RUNLOOP, EVENT_CLASS_SOCK): New defines. [MAC_OSX] (sys_select) [SELECT_USE_CFSOCKET]: Use CFSocket and RunLoop for simultaneously monitoring two kinds of inputs, window events and process outputs, without periodically polling. * macfns.c (mac_initialized): Remove extern. (stricmp): Put in #if 0. All callers changed to use xstricmp in xfaces.c. (strnicmp): Decrement `n' at the end of each loop, not the beginning. (check_mac): Use the term "Mac native windows" instead of "Mac OS". (check_x_display_info, x_display_info_for_name): Sync with xfns.c. (mac_get_rdb_resource): New function (from w32reg.c). (x_get_string_resource): Use it. (install_window_handler): Add extern. (mac_window): New function. (Fx_create_frame): Use it instead of make_mac_frame. Set parameter for Qfullscreen. Call x_wm_set_size_hint. (Fx_open_connection, Fx_close_connection): New defuns. (syms_of_macfns): Defsubr them. (x_create_tip_frame) [TARGET_API_MAC_CARBON]: Add kWindowNoUpdatesAttribute to the window attribute. (x_create_tip_frame) [!TARGET_API_MAC_CARBON]: Use NewCWindow. (x_create_tip_frame): Don't call ShowWindow. (Fx_show_tip): Call ShowWindow. (Fx_file_dialog): Change `#ifdef TARGET_API_MAC_CARBON' to `#if TARGET_API_MAC_CARBON'. (mac_frame_parm_handlers): Set handlers for Qfullscreen. (syms_of_macfns) [MAC_OSX]: Initialize mac_in_use to 0. * macgui.h [!MAC_OSX]: Don't include Controls.h. Include Windows.h. (Window): Typedef to WindowPtr and move outside `#if TARGET_API_MAC_CARBON'. (XSizeHints): New struct. * macterm.c (x_update_begin, x_update_end) [TARGET_API_MAC_CARBON]: Disable screen updates during update of a frame. (x_draw_glyph_string_background, x_draw_glyph_string_foreground) [MAC_OS8]: Use XDrawImageString/XDrawImageString16. (construct_mouse_click): Put in #if 0. (x_check_fullscreen, x_check_fullscreen_move): Remove decls. (x_scroll_bar_create, x_scroll_bar_handle_click): Change `#ifdef TARGET_API_MAC_CARBON' to `#if TARGET_API_MAC_CARBON'. (activate_scroll_bars, deactivate_scroll_bars) [!TARGET_API_MAC_CARBON]: Use ActivateControl/DeactivateControl. (x_make_frame_visible) [TARGET_API_MAC_CARBON]: Reposition window if the position is neither user-specified nor program-specified. (x_free_frame_resources): Free size_hints. (x_wm_set_size_hint): Allocate size_hints if needed. Set size_hints. (mac_clear_font_name_table): New function. (mac_do_list_fonts): Initialize font_name_table if needed. (x_list_fonts): Don't initialize font_name_table. Add BLOCK_INPUT around mac_do_list_fonts. (mac_unload_font): New function. (x_load_font): Add BLOCK_INPUT around XLoadQueryFont. (init_mac_drag_n_drop, mac_do_receive_drag): Enclose declarations and definitions with #if TARGET_API_MAC_CARBON. [USE_CARBON_EVENTS] (mac_handle_window_event): Add decl. (install_window_handler): Add decl. (do_window_update): Add BeginUpdate/EndUpdate for the tooltip window. Use UpdateControls. Get the rectangle that should be updated and restrict the target of expose_frame to it. (do_grow_window): Set minimum height/width according to size_hints. (do_grow_window) [TARGET_API_MAC_CARBON]: Use ResizeWindow. (do_zoom_window): Don't use x_set_window_size. [USE_CARBON_EVENTS] (mac_handle_window_event): New function. (install_window_handler): New function. [!USE_CARBON_EVENTS] (mouse_region): New variable. [!USE_CARBON_EVENTS] (mac_wait_next_event): New function. (XTread_socket) [USE_CARBON_EVENTS]: Move call to GetEventDispatcherTarget inside BLOCK_INPUT. (XTread_socket) [!USE_CARBON_EVENTS]: Use mac_wait_next_event. Update mouse_region when mouse is moved. (make_mac_frame): Remove. (make_mac_terminal_frame): Put in #ifdef MAC_OS8. Initialize mouse pointer shapes. Change values of f->left_pos and f->top_pos. Don't use make_mac_frame. Use NewCWindow. Don't call ShowWindow. (mac_initialize_display_info) [MAC_OSX]: Create mac_id_name from Vinvocation_name and Vsystem_name. (mac_make_rdb): New function (from w32term.c). (mac_term_init): Use it. Add BLOCK_INPUT. Error if display has already been opened. Don't pass argument to mac_initialize_display_info. Don't set dpyinfo->height/width. Add entries to x_display_list and x_display_name_list. (x_delete_display): New function. (mac_initialize): Don't call mac_initialize_display_info. (syms_of_macterm) [!MAC_OSX]: Don't call Fprovide. * macterm.h (check_mac): Add extern. (struct mac_output): New member size_hints. (FRAME_SIZE_HINTS): New macro. (mac_unload_font): Add extern. * xdisp.c (expose_window, expose_frame): Remove kludges for Mac. * xfaces.c (clear_font_table) [MAC_OS]: call mac_unload_font.
author Steven Tamm <steventamm@mac.com>
date Mon, 27 Dec 2004 17:27:30 +0000
parents 695cf19ef79e
children 8c1e7e264988 375f2633d815
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
38412
253f761ad37b Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents: 37601
diff changeset
1 ;;; rmailedit.el --- "RMAIL edit mode" Edit the current message
658
7cbd4fcd8b0f *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 368
diff changeset
2
37588
9adbbd869684 (rmail-edit-mode): Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents: 26485
diff changeset
3 ;; Copyright (C) 1985, 1994, 2001 Free Software Foundation, Inc.
845
213978acbc1e entered into RCS
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 814
diff changeset
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
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
8 ;; This file is part of GNU Emacs.
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
9
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
10 ;; GNU Emacs is free software; you can redistribute it and/or modify
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
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
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
13 ;; any later version.
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
14
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
15 ;; GNU Emacs is distributed in the hope that it will be useful,
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
16 ;; but WITHOUT ANY WARRANTY; without even the implied warranty of
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
17 ;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
18 ;; GNU General Public License for more details.
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
19
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
20 ;; You should have received a copy of the GNU General Public License
14169
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 11573
diff changeset
21 ;; along with GNU Emacs; see the file COPYING. If not, write to the
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 11573
diff changeset
22 ;; Free Software Foundation, Inc., 59 Temple Place - Suite 330,
83f275dcd93a Update FSF's address.
Erik Naggum <erik@naggum.no>
parents: 11573
diff changeset
23 ;; Boston, MA 02111-1307, USA.
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
24
38412
253f761ad37b Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents: 37601
diff changeset
25 ;;; Commentary:
253f761ad37b Some fixes to follow coding conventions in files maintained by FSF.
Pavel Janík <Pavel@Janik.cz>
parents: 37601
diff changeset
26
807
4f28bd14272c *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 658
diff changeset
27 ;;; Code:
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
28
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
29 (require 'rmail)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
30
37588
9adbbd869684 (rmail-edit-mode): Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents: 26485
diff changeset
31 (defcustom rmail-edit-mode-hook nil
9adbbd869684 (rmail-edit-mode): Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents: 26485
diff changeset
32 "List of functions to call when editing an RMAIL message."
9adbbd869684 (rmail-edit-mode): Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents: 26485
diff changeset
33 :type 'hook
37601
58918e5712d6 (rmail-edit-mode-hook): Add :version.
Gerd Moellmann <gerd@gnu.org>
parents: 37588
diff changeset
34 :version "21.1"
37588
9adbbd869684 (rmail-edit-mode): Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents: 26485
diff changeset
35 :group 'rmail-edit)
9adbbd869684 (rmail-edit-mode): Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents: 26485
diff changeset
36
21436
779c7dcd4c04 (rmail-cease-edit): Call kill-all-local-variables.
Karl Heuer <kwzh@gnu.org>
parents: 16347
diff changeset
37 (defvar rmail-old-text)
779c7dcd4c04 (rmail-cease-edit): Call kill-all-local-variables.
Karl Heuer <kwzh@gnu.org>
parents: 16347
diff changeset
38
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
39 (defvar rmail-edit-map nil)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
40 (if rmail-edit-map
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
41 nil
4179
dfc4e9e14d24 (rmail-edit-map): Inherit properly from text-mode-map;
Richard M. Stallman <rms@gnu.org>
parents: 845
diff changeset
42 ;; Make a keymap that inherits text-mode-map.
21436
779c7dcd4c04 (rmail-cease-edit): Call kill-all-local-variables.
Karl Heuer <kwzh@gnu.org>
parents: 16347
diff changeset
43 (setq rmail-edit-map (make-sparse-keymap))
779c7dcd4c04 (rmail-cease-edit): Call kill-all-local-variables.
Karl Heuer <kwzh@gnu.org>
parents: 16347
diff changeset
44 (set-keymap-parent rmail-edit-map text-mode-map)
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
45 (define-key rmail-edit-map "\C-c\C-c" 'rmail-cease-edit)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
46 (define-key rmail-edit-map "\C-c\C-]" 'rmail-abort-edit))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
47
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
48 ;; Rmail Edit mode is suitable only for specially formatted data.
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
49 (put 'rmail-edit-mode 'mode-class 'special)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
50
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
51 (defun rmail-edit-mode ()
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
52 "Major mode for editing the contents of an RMAIL message.
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
53 The editing commands are the same as in Text mode, together with two commands
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
54 to return to regular RMAIL:
37588
9adbbd869684 (rmail-edit-mode): Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents: 26485
diff changeset
55 * \\[rmail-abort-edit] cancels the changes
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
56 you have made and returns to RMAIL
37588
9adbbd869684 (rmail-edit-mode): Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents: 26485
diff changeset
57 * \\[rmail-cease-edit] makes them permanent.
9adbbd869684 (rmail-edit-mode): Doc fix.
Gerd Moellmann <gerd@gnu.org>
parents: 26485
diff changeset
58 This functions runs the normal hook `rmail-edit-mode-hook'.
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
59 \\{rmail-edit-map}"
21436
779c7dcd4c04 (rmail-cease-edit): Call kill-all-local-variables.
Karl Heuer <kwzh@gnu.org>
parents: 16347
diff changeset
60 (text-mode)
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
61 (use-local-map rmail-edit-map)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
62 (setq major-mode 'rmail-edit-mode)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
63 (setq mode-name "RMAIL Edit")
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
64 (if (boundp 'mode-line-modified)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
65 (setq mode-line-modified (default-value 'mode-line-modified))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
66 (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
67 (if (rmail-summary-exists)
6726
d6bc6057d197 Fix previous change.
Karl Heuer <kwzh@gnu.org>
parents: 6723
diff changeset
68 (save-excursion
d6bc6057d197 Fix previous change.
Karl Heuer <kwzh@gnu.org>
parents: 6723
diff changeset
69 (set-buffer rmail-summary-buffer)
d6bc6057d197 Fix previous change.
Karl Heuer <kwzh@gnu.org>
parents: 6723
diff changeset
70 (rmail-summary-disable)))
21436
779c7dcd4c04 (rmail-cease-edit): Call kill-all-local-variables.
Karl Heuer <kwzh@gnu.org>
parents: 16347
diff changeset
71 (run-hooks 'rmail-edit-mode-hook))
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
72
22264
225596bc6090 (rmail-old-pruned): New permanent local.
Richard M. Stallman <rms@gnu.org>
parents: 21877
diff changeset
73 (defvar rmail-old-pruned nil)
225596bc6090 (rmail-old-pruned): New permanent local.
Richard M. Stallman <rms@gnu.org>
parents: 21877
diff changeset
74 (put 'rmail-old-pruned 'permanent-local t)
225596bc6090 (rmail-old-pruned): New permanent local.
Richard M. Stallman <rms@gnu.org>
parents: 21877
diff changeset
75
22752
00d24401ca1e (rmail-edit-current-message, rmail-cease-edit):
Richard M. Stallman <rms@gnu.org>
parents: 22264
diff changeset
76 (defvar rmail-edit-saved-coding-system nil)
00d24401ca1e (rmail-edit-current-message, rmail-cease-edit):
Richard M. Stallman <rms@gnu.org>
parents: 22264
diff changeset
77 (put 'rmail-edit-saved-coding-system 'permanent-local t)
00d24401ca1e (rmail-edit-current-message, rmail-cease-edit):
Richard M. Stallman <rms@gnu.org>
parents: 22264
diff changeset
78
16347
d710d3502336 (rmail-edit-current-message): Add autoload.
Richard M. Stallman <rms@gnu.org>
parents: 14326
diff changeset
79 ;;;###autoload
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
80 (defun rmail-edit-current-message ()
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
81 "Edit the contents of this message."
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
82 (interactive)
22264
225596bc6090 (rmail-old-pruned): New permanent local.
Richard M. Stallman <rms@gnu.org>
parents: 21877
diff changeset
83 (make-local-variable 'rmail-old-pruned)
225596bc6090 (rmail-old-pruned): New permanent local.
Richard M. Stallman <rms@gnu.org>
parents: 21877
diff changeset
84 (setq rmail-old-pruned (rmail-msg-is-pruned))
22752
00d24401ca1e (rmail-edit-current-message, rmail-cease-edit):
Richard M. Stallman <rms@gnu.org>
parents: 22264
diff changeset
85 (make-local-variable 'rmail-edit-saved-coding-system)
00d24401ca1e (rmail-edit-current-message, rmail-cease-edit):
Richard M. Stallman <rms@gnu.org>
parents: 22264
diff changeset
86 (setq rmail-edit-saved-coding-system save-buffer-coding-system)
22264
225596bc6090 (rmail-old-pruned): New permanent local.
Richard M. Stallman <rms@gnu.org>
parents: 21877
diff changeset
87 (rmail-toggle-header 0)
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
88 (rmail-edit-mode)
22752
00d24401ca1e (rmail-edit-current-message, rmail-cease-edit):
Richard M. Stallman <rms@gnu.org>
parents: 22264
diff changeset
89 ;; As the local value of save-buffer-coding-system is deleted by
00d24401ca1e (rmail-edit-current-message, rmail-cease-edit):
Richard M. Stallman <rms@gnu.org>
parents: 22264
diff changeset
90 ;; rmail-edit-mode, we restore the original value.
00d24401ca1e (rmail-edit-current-message, rmail-cease-edit):
Richard M. Stallman <rms@gnu.org>
parents: 22264
diff changeset
91 (make-local-variable 'save-buffer-coding-system)
00d24401ca1e (rmail-edit-current-message, rmail-cease-edit):
Richard M. Stallman <rms@gnu.org>
parents: 22264
diff changeset
92 (setq save-buffer-coding-system rmail-edit-saved-coding-system)
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
93 (make-local-variable 'rmail-old-text)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
94 (setq rmail-old-text (buffer-substring (point-min) (point-max)))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
95 (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
96 (force-mode-line-update)
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
97 (if (and (eq (key-binding "\C-c\C-c") 'rmail-cease-edit)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
98 (eq (key-binding "\C-c\C-]") 'rmail-abort-edit))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
99 (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
100 (message "%s" (substitute-command-keys
22264
225596bc6090 (rmail-old-pruned): New permanent local.
Richard M. Stallman <rms@gnu.org>
parents: 21877
diff changeset
101 "Editing: Type \\[rmail-cease-edit] to return to Rmail, \\[rmail-abort-edit] to abort"))))
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
102
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
103 (defun rmail-cease-edit ()
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
104 "Finish editing message; switch back to Rmail proper."
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
105 (interactive)
6723
6ff74185a672 (rmail-edit-mode, rmail-cease-edit): Disable summary during edit.
Karl Heuer <kwzh@gnu.org>
parents: 5851
diff changeset
106 (if (rmail-summary-exists)
6726
d6bc6057d197 Fix previous change.
Karl Heuer <kwzh@gnu.org>
parents: 6723
diff changeset
107 (save-excursion
d6bc6057d197 Fix previous change.
Karl Heuer <kwzh@gnu.org>
parents: 6723
diff changeset
108 (set-buffer rmail-summary-buffer)
d6bc6057d197 Fix previous change.
Karl Heuer <kwzh@gnu.org>
parents: 6723
diff changeset
109 (rmail-summary-enable)))
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
110 ;; Make sure buffer ends with a newline.
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
111 (save-excursion
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
112 (goto-char (point-max))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
113 (if (/= (preceding-char) ?\n)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
114 (insert "\n"))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
115 ;; Adjust the marker that points to the end of this message.
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
116 (set-marker (aref rmail-message-vector (1+ rmail-current-message))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
117 (point)))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
118 (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
119 (force-mode-line-update)
21436
779c7dcd4c04 (rmail-cease-edit): Call kill-all-local-variables.
Karl Heuer <kwzh@gnu.org>
parents: 16347
diff changeset
120 (kill-all-local-variables)
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
121 (rmail-mode-1)
21436
779c7dcd4c04 (rmail-cease-edit): Call kill-all-local-variables.
Karl Heuer <kwzh@gnu.org>
parents: 16347
diff changeset
122 (rmail-variables)
22752
00d24401ca1e (rmail-edit-current-message, rmail-cease-edit):
Richard M. Stallman <rms@gnu.org>
parents: 22264
diff changeset
123 ;; As the local value of save-buffer-coding-system is changed by
00d24401ca1e (rmail-edit-current-message, rmail-cease-edit):
Richard M. Stallman <rms@gnu.org>
parents: 22264
diff changeset
124 ;; rmail-variables, we restore the original value.
00d24401ca1e (rmail-edit-current-message, rmail-cease-edit):
Richard M. Stallman <rms@gnu.org>
parents: 22264
diff changeset
125 (setq save-buffer-coding-system rmail-edit-saved-coding-system)
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
126 (if (and (= (length old) (- (point-max) (point-min)))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
127 (string= old (buffer-substring (point-min) (point-max))))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
128 ()
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
129 (setq old nil)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
130 (rmail-set-attribute "edited" t)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
131 (if (boundp 'rmail-summary-vector)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
132 (progn
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
133 (aset rmail-summary-vector (1- rmail-current-message) nil)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
134 (save-excursion
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
135 (rmail-widen-to-current-msgbeg
21877
ed912554aac6 (rmail-cease-edit): Call rmail-show-message even if message text is unchanged.
Richard M. Stallman <rms@gnu.org>
parents: 21436
diff changeset
136 (function (lambda ()
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
137 (forward-line 2)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
138 (if (looking-at "Summary-line: ")
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
139 (let ((buffer-read-only nil))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
140 (delete-region (point)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
141 (progn (forward-line 1)
21877
ed912554aac6 (rmail-cease-edit): Call rmail-show-message even if message text is unchanged.
Richard M. Stallman <rms@gnu.org>
parents: 21436
diff changeset
142 (point))))))))))))
ed912554aac6 (rmail-cease-edit): Call rmail-show-message even if message text is unchanged.
Richard M. Stallman <rms@gnu.org>
parents: 21436
diff changeset
143 (save-excursion
22264
225596bc6090 (rmail-old-pruned): New permanent local.
Richard M. Stallman <rms@gnu.org>
parents: 21877
diff changeset
144 (rmail-show-message)
225596bc6090 (rmail-old-pruned): New permanent local.
Richard M. Stallman <rms@gnu.org>
parents: 21877
diff changeset
145 (rmail-toggle-header (if rmail-old-pruned 1 0))))
26485
d1f081e4844a (rmail-cease-edit): Run rmail-mode-hook.
Gerd Moellmann <gerd@gnu.org>
parents: 22752
diff changeset
146 (run-hooks 'rmail-mode-hook)
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
147 (setq buffer-read-only t))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
148
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
149 (defun rmail-abort-edit ()
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
150 "Abort edit of current message; restore original contents."
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
151 (interactive)
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
152 (delete-region (point-min) (point-max))
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
153 (insert rmail-old-text)
8498
ba1acb3cf835 (rmail-abort-edit): Call `rmail-highlight-headers'.
Richard M. Stallman <rms@gnu.org>
parents: 7562
diff changeset
154 (rmail-cease-edit)
ba1acb3cf835 (rmail-abort-edit): Call `rmail-highlight-headers'.
Richard M. Stallman <rms@gnu.org>
parents: 7562
diff changeset
155 (rmail-highlight-headers))
36
9697c13298e5 Initial revision
Joseph Arceneaux <jla@gnu.org>
parents:
diff changeset
156
48341
595c4a350a47 Add provide call.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 38412
diff changeset
157 (provide 'rmailedit)
595c4a350a47 Add provide call.
Markus Rost <rost@math.uni-bielefeld.de>
parents: 38412
diff changeset
158
52401
695cf19ef79e Add arch taglines
Miles Bader <miles@gnu.org>
parents: 48341
diff changeset
159 ;;; arch-tag: 93c22709-a14a-46c1-ab91-52c3f5a0ec12
658
7cbd4fcd8b0f *** empty log message ***
Eric S. Raymond <esr@snark.thyrsus.com>
parents: 368
diff changeset
160 ;;; rmailedit.el ends here