aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKaroly Lorentey2005-06-15 12:57:51 +0000
committerKaroly Lorentey2005-06-15 12:57:51 +0000
commitef85512e51f043d73788f00a2aed13cccde0682c (patch)
treefc1fa1378533250f260ef8eaa9a84ae882d9df84 /src
parent8736257554f49445f7b4402ac7a9436b38ce6452 (diff)
parentef88a9999004e6c26148c8d280d6a41f623d7249 (diff)
downloademacs-ef85512e51f043d73788f00a2aed13cccde0682c.tar.gz
emacs-ef85512e51f043d73788f00a2aed13cccde0682c.zip
Merged from miles@gnu.org--gnu-2005 (patch 80-82, 350-422)
Patches applied: * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-350 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-351 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-352 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-353 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-354 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-355 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-356 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-357 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-358 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-359 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-360 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-361 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-362 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-363 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-364 Remove "-face" suffix from widget faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-365 Remove "-face" suffix from custom faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-366 Remove "-face" suffix from change-log faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-367 Remove "-face" suffix from compilation faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-368 Remove "-face" suffix from diff-mode faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-369 lisp/longlines.el (longlines-visible-face): Face removed * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-370 Remove "-face" suffix from woman faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-371 Remove "-face" suffix from whitespace-highlight face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-372 Remove "-face" suffix from ruler-mode faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-373 Remove "-face" suffix from show-paren faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-374 Remove "-face" suffix from log-view faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-375 Remove "-face" suffix from smerge faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-376 Remove "-face" suffix from show-tabs faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-377 Remove "-face" suffix from highlight-changes faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-378 Remove "-face" suffix from and downcase info faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-379 Remove "-face" suffix from pcvs faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-380 Update uses of renamed pcvs faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-381 Tweak ChangeLog * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-382 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-383 Remove "-face" suffix from strokes-char face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-384 Remove "-face" suffix from compare-windows face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-385 Remove "-face" suffix from calendar faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-386 Remove "-face" suffix from diary-button face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-387 Remove "-face" suffix from testcover faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-388 Remove "-face" suffix from viper faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-389 Remove "-face" suffix from org faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-390 Remove "-face" suffix from sgml-namespace face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-391 Remove "-face" suffix from table-cell face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-392 Remove "-face" suffix from tex-mode faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-393 Remove "-face" suffix from texinfo-heading face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-394 Remove "-face" suffix from flyspell faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-395 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-396 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-397 Remove "-face" suffix from gomoku faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-398 Remove "-face" suffix from mpuz faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-399 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-400 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-401 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-402 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-403 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-404 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-405 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-406 Merge from gnus--rel--5.10 * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-407 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-408 Remove "-face" suffix from Buffer-menu-buffer face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-409 Remove "-face" suffix from antlr-mode faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-410 Remove "-face" suffix from ebrowse faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-411 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-412 Remove "-face" suffix from flymake faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-413 Remove "-face" suffix from idlwave faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-414 Remove "-face" suffix from sh-script faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-415 Remove "-face" suffix from vhdl-mode faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-416 Update from CVS * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-417 Remove "-face" suffix from which-func face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-418 Remove "-face" suffix from cperl-mode faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-419 Remove "-face" suffix from ld-script faces * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-420 Fix cperl-mode font-lock problem * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-421 Tweak which-func face * miles@gnu.org--gnu-2005/emacs--cvs-trunk--0--patch-422 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-80 Merge from emacs--cvs-trunk--0 * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-81 Update from CVS * miles@gnu.org--gnu-2005/gnus--rel--5.10--patch-82 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-350
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog294
-rw-r--r--src/bytecode.c3
-rw-r--r--src/callproc.c33
-rw-r--r--src/coding.c2
-rw-r--r--src/composite.c2
-rw-r--r--src/config.in9
-rw-r--r--src/emacs.c1
-rw-r--r--src/eval.c51
-rw-r--r--src/fns.c4
-rw-r--r--src/frame.c18
-rw-r--r--src/image.c86
-rw-r--r--src/keyboard.c3
-rw-r--r--src/lisp.h10
-rw-r--r--src/macfns.c3
-rw-r--r--src/macmenu.c171
-rw-r--r--src/macterm.c318
-rw-r--r--src/makefile.w32-in7
-rw-r--r--src/process.c40
-rw-r--r--src/process.h4
-rw-r--r--src/s/ms-w32.h2
-rw-r--r--src/search.c96
-rw-r--r--src/unexmacosx.c1
-rw-r--r--src/unexw32.c59
-rw-r--r--src/w32.c8
-rw-r--r--src/w32bdf.c2
-rw-r--r--src/w32fns.c82
-rw-r--r--src/w32heap.c1
-rw-r--r--src/w32heap.h9
-rw-r--r--src/w32menu.c3
-rw-r--r--src/w32proc.c5
-rw-r--r--src/w32term.c20
-rw-r--r--src/window.c51
-rw-r--r--src/xdisp.c112
-rw-r--r--src/xfaces.c12
-rw-r--r--src/xmenu.c2
-rw-r--r--src/xterm.c19
36 files changed, 1137 insertions, 406 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index dbcac952b51..46cab9c1cba 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,283 @@
12005-06-15 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
2
3 * macterm.c (mac_compute_glyph_string_overhangs): Don't set
4 overhangs unless the given glyph type is noncomposite CHAR_GLYPH.
5 [USE_CARBON_EVENTS] (mac_convert_event_ref): Convert dead key down
6 events.
7 (XTread_socket): Don't pass keyboard events with the option
8 modifier to the system when Vmac_command_key_is_meta is nil or
9 Vmac_option_modifier is non-nil.
10 [USE_CARBON_EVENTS] (read_socket_inev): New variable.
11 [USE_CARBON_EVENTS] (init_command_handler): Fix argument.
12 [USE_CARBON_EVENTS] (mac_handle_mouse_event): New Carbon event
13 handler function.
14 (install_window_handler) [USE_CARBON_EVENTS]: Install it.
15 (XTread_socket) [USE_CARBON_EVENTS]: Move mouse wheel event
16 handler part to mac_handle_mouse_event.
17
182005-06-14 Juanma Barranquero <lekktu@gmail.com>
19
20 * eval.c (Fdefvaralias): Rename arguments SYMBOL and ALIASED to
21 NEW-ALIAS and BASE-VARIABLE, respectively.
22
232005-06-13 Stefan Monnier <monnier@iro.umontreal.ca>
24
25 * xdisp.c (note_mode_line_or_margin_highlight): Lisp_Object/int mixup.
26 (get_phys_cursor_geometry, format_mode_line_unwind_data)
27 (get_line_height_property, x_produce_glyphs): Remove unused vars.
28
29 * coding.c (run_pre_post_conversion_on_str): Remove unused var `buf'.
30
312005-06-13 Eli Zaretskii <eliz@gnu.org>
32
33 * w32term.c (x_use_underline_position_properties): New variable.
34 (x_draw_glyph_string): Remind in a comment to change doc string of
35 x-use-underline-position-properties if/when underline positioning
36 is implemented.
37 (syms_of_w32term): DEFVAR_BOOL x-use-underline-position-properties,
38 and initialize it to nil.
39
402005-06-12 Jason Rumney <jasonr@gnu.org>
41
42 * w32fns.c (NEWOPENFILENAME): New struct.
43 (Fx_file_dialog): Use it to trick the system into giving us up to
44 date dialogs on systems that are documented to support it.
45 Do not set OFN_FILEMUSTEXIST flag if looking for a directory.
46
472005-06-12 Eli Zaretskii <eliz@gnu.org>
48
49 * w32fns.c (w32_abort): Use the MB_YESNO dialog instead of
50 MB_ABORTRETRYIGNORE. Never return, even if DebugBreak does.
51
522005-06-11 Eli Zaretskii <eliz@gnu.org>
53
54 * image.c (x_create_x_image_and_pixmap) [HAVE_NTGUI]: Cast 4th arg
55 to CreateDIBSection to avoid a compiler warning.
56 (pbm_load): Cast 3rd arg to IMAGE_BACKGROUND to avoid a compiler
57 warning.
58 (png_load): Cast return values of fn_png_create_read_struct and
59 fn_png_create_info_struct, to avoid compiler warnings on W32.
60 Cast 3rd arg to IMAGE_BACKGROUND and image_background_transparent
61 to avoid compiler warnings.
62 (jpeg_load): Cast return value of fn_jpeg_std_error to avoid a
63 compiler warning on W32. Cast 3rd arg to IMAGE_BACKGROUND to
64 avoid a compiler warning.
65 (tiff_load): Cast return values of fn_TIFFOpen and
66 fn_TIFFClientOpen to avoid compiler warning on W32. Cast 3rd arg
67 to IMAGE_BACKGROUND to avoid a compiler warning.
68 (gif_load): Cast return values of fn_DGifOpenFileName and
69 fn_DGifOpen to avoid compiler warnings on W32. Cast 3rd arg to
70 IMAGE_BACKGROUND to avoid a compiler warning.
71 (DrawText) [HAVE_NTGUI || MAC_OS]: If already defined, undef
72 before redefining.
73
74 * w32bdf.c (create_offscreen_bitmap): Cast `bitsp' to `void **' in
75 the call to CreateDIBSection, to avoid a compiler warning.
76
772005-06-11 Jason Rumney <jasonr@gnu.org>
78
79 * w32fns.c (Fx_file_dialog): Unblock input before falling back to
80 minibuffer.
81 * macfns.c (Fx_file_dialog): Likewise.
82
832005-06-10 Eli Zaretskii <eliz@gnu.org>
84
85 * makefile.w32-in ($(TEMACS)): Depend on addsection.exe.
86
872005-06-10 Juanma Barranquero <lekktu@gmail.com>
88
89 * process.c (syms_of_process) [ADAPTIVE_READ_BUFFERING]:
90 * w32fns.c (syms_of_w32fns): Fix spellings.
91
922005-06-10 Eli Zaretskii <eliz@gnu.org>
93
94 * unexw32.c (COPY_CHUNK, COPY_PROC_CHUNK): Add a new argument
95 `verbose'; print diagnostic messages only if it is non-zero.
96 All callers changed to pass a zero value unless DEBUG_DUMP is defined
97 in the environment.
98 (copy_executable_and_dump_data): Print section names with %.8s.
99
1002005-06-10 Masatake YAMATO <jet@gyve.org>
101
102 * xdisp.c (note_mode_line_or_margin_highlight): Call clear_mouse_face
103 when mouse_face is not given.
104 Remove unnecessary tabs.
105
1062005-06-09 Luc Teirlinck <teirllm@auburn.edu>
107
108 * window.c (Fselect_window): Adapt call to Fselect_frame.
109
110 * lisp.h: Update EXFUN of Fselect_frame.
111
112 * keyboard.c (command_loop_1): Adapt call to Fselect_frame.
113
114 * frame.c (Fhandle_switch_frame, Fselect_frame): Delete unused arg
115 no_enter.
116 (Fset_mouse_position, Fset_mouse_pixel_position, Ficonify_frame):
117 Adapt to above change.
118
1192005-06-10 Juanma Barranquero <lekktu@gmail.com>
120
121 * fns.c (Fmemq, Fmaphash): Doc fixes.
122
1232005-06-09 Juanma Barranquero <lekktu@gmail.com>
124
125 * xfaces.c (Fdisplay_supports_face_attributes_p):
126 Fix typo in docstring.
127
1282005-06-08 Steven Tamm <steventamm@mac.com>
129
130 * unexmacosx.c (copy_data_segment): Copy __la_sym_ptr2 section
131 used by gcc4 on intel mac.
132
1332005-06-09 Kim F. Storm <storm@cua.dk>
134
135 * search.c (Fmatch_data): Add optional RESEAT arg. Unchain markers
136 in REUSE list if non-nil; free them if equal to evaporate.
137 (Fset_match_data): Add optional RESEAT arg. Unchain markers in LIST
138 if non-nil; free them if equal to evaporate. Use XCAR/XCDR.
139 (restore_search_regs): Rename from restore_match_data. Uses changed.
140 (unwind_set_match_data): New function.
141 (record_unwind_save_match_data): New function like save-match-data.
142
143 * lisp.h (Fmatch_data, Fset_match_data): Fix EXFUN.
144 (record_unwind_save_match_data): Add prototype.
145 (restore_search_regs): Rename from restore_match_data.
146
147 * composite.c (compose_chars_in_text):
148 * eval.c (do_autoload):
149 * macmenu.c (set_frame_menubar):
150 * process.c (read_process_output, exec_sentinel):
151 * xmenu.c (set_frame_menubar):
152 * xdisp.c (prepare_menu_bars, update_menu_bar, update_tool_bar):
153 * w32menu.c (set_frame_menubar):
154 Use record_unwind_save_match_data.
155
1562005-06-08 Richard M. Stallman <rms@gnu.org>
157
158 * xdisp.c (get_next_display_element): Alter previous change:
159 Distinguish Vshow_nonbreak_escape = t or not t.
160 For t, use escape_glyph once again, as before previous change.
161 Use space or hyphen for display, instead of the non-ASCII char.
162 (syms_of_xdisp) <show-nonbreak-escape>: Doc fix.
163
164 * process.c (Fstart_process): Don't touch command_channel_p slot.
165
166 * process.h (struct process): Delete command_channel_p.
167
1682005-06-07 Masatake YAMATO <jet@gyve.org>
169
170 * xdisp.c (note_mode_line_or_margin_highlight):
171 Check the overlapping of re-rendering area to avoid flickering.
172 (note_mouse_highlight): Call clear_mouse_face if PART
173 is not ON_MODE_LINE nor ON_HEADER_LINE.
174
1752005-06-07 Kim F. Storm <storm@cua.dk>
176
177 * process.c: Improve commentary for adaptive read buffering.
178
1792005-06-06 Stefan Monnier <monnier@iro.umontreal.ca>
180
181 * xterm.c (x_create_toolkit_scroll_bar): Use XtNarrowScrollbars
182 if available.
183
1842005-06-06 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
185
186 * macmenu.c (menu_quit_handler, install_menu_quit_handler):
187 New functions for popping down menus on C-g.
188 (set_frame_menubar, mac_menu_show): Call install_menu_quit_handler.
189
190 * macterm.c: Make mac_quit_char_modifiers and mac_quit_char_keycode
191 non-static.
192
193 * config.in: Add HAVE_CANCELMENUTRACKING.
194
1952005-06-06 Eli Zaretskii <eliz@gnu.org>
196
197 * w32heap.h (OFFSET_TO_RVA, RVA_TO_OFFSET, RVA_TO_PTR):
198 Remove macros.
199
200 * unexw32.c (RVA_TO_PTR): Move here from w32heap.h.
201
202 * w32proc.c (RVA_TO_PTR): New macro.
203
204 * w32heap.c (RVA_TO_PTR): No need to #undef now.
205
206 * makefile.w32-in ($(BLD)/emacs.$(O), $(BLD)/w32select.$(O)):
207 Depend on w32heap.h.
208
2092005-06-06 Luc Teirlinck <teirllm@auburn.edu>
210
211 * keyboard.c (command_loop_1): Update Vthis_original_command.
212
2132005-06-06 Richard M. Stallman <rms@gnu.org>
214
215 * xmenu.c (popup_get_selection): Undo previous change.
216
2172005-06-06 Juri Linkov <juri@jurta.org>
218
219 * xdisp.c (Qno_break_space): New variable.
220 (syms_of_xdisp): Initialize it.
221 (get_next_display_element): Add no-break space and soft hypen
222 codes for iso8859-2 and iso8859-5. Don't add `\' for them.
223 Use `no-break-space' face for no-break spaces.
224
2252005-06-06 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
226
227 * window.c (delete_window): Handle the case where a h/vchild has
228 a h/vchild.
229
2302005-06-05 Eli Zaretskii <eliz@gnu.org>
231
232 * w32.c (sys_setsockopt): Change arg 4 to `const void *'. In the
233 call to pfn_setsockopt, cast optval to `const char *'.
234
2352005-06-04 Eli Zaretskii <eliz@gnu.org>
236
237 * w32.c (gettimeofday): Use struct _timeb, not struct timeb.
238 (open_unc_volume): Cast return value of map_w32_filename, to avoid
239 compiler warnings.
240
241 * s/ms-w32.h (fileno): Don't define if already defined.
242
243 * emacs.c: Include w32heap.h, to avoid compiler warning about sbrk.
244
245 * makefile.w32-in (DOC): Define to point to the generated DOC-X.
246
2472005-06-04 Richard M. Stallman <rms@gnu.org>
248
249 * xmenu.c (popup_get_selection): Click not in menu deactivates menu.
250
2512005-06-04 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
252
253 * macmenu.c (cleanup_popup_menu): New function.
254 (Fx_popup_menu): unwind protect cleanup_popup_menu in case
255 mac_menu_show Quit:s.
256 (mac_menu_show): Quit on cancel if not popped up on click (i.e.
257 a dialog).
258
2592005-06-04 Kim F. Storm <storm@cua.dk>
260
261 * coding.c (decode_coding_string): Handle CODING_FINISH_INTERRUPT.
262
263 * callproc.c (Fcall_process): Don't use alloca to gradually
264 increase size of buf, as it effectively uses twice the necessary
265 space on the stack. Instead, pre-allocate buf of full size, and
266 gradually increase the read size.
267
268 * bytecode.c (BYTE_CODE_QUIT): Check Vthrow_on_input.
269
270 * eval.c (unbind_to): Preserve value of Vquit_flag.
271
272 * xterm.c (handle_one_xevent): Also ignore mouse motion just
273 before a button release event.
274
2752005-06-03 Juanma Barranquero <lekktu@gmail.com>
276
277 * xfaces.c (Finternal_lisp_face_equal_p): Really report
278 on faces in a frame, if the argument FRAME is non-nil.
279 Improve argument/docstring consistency.
280
12005-06-02 Kim F. Storm <storm@cua.dk> 2812005-06-02 Kim F. Storm <storm@cua.dk>
2 282
3 * xdisp.c (MODE_LINE_NOPROP_LEN): New macro. 283 * xdisp.c (MODE_LINE_NOPROP_LEN): New macro.
@@ -41,11 +321,11 @@
41 (format_mode_line_unwind_data, unwind_format_mode_line): 321 (format_mode_line_unwind_data, unwind_format_mode_line):
42 New functions for unwind protection in mode line formatting. 322 New functions for unwind protection in mode line formatting.
43 (x_consider_frame_title): Use them and new local var 'title_start' 323 (x_consider_frame_title): Use them and new local var 'title_start'
44 to support nested calls to format-mode-line and redisplay. Set 324 to support nested calls to format-mode-line and redisplay.
45 mode_line_target to MODE_LINE_TITLE. 325 Set mode_line_target to MODE_LINE_TITLE.
46 (Fformat_mode_line): Use them and new local var 'string_start' to 326 (Fformat_mode_line): Use them and new local var 'string_start' to
47 support nested calls to format-mode-line and redisplay. Set 327 support nested calls to format-mode-line and redisplay.
48 mode_line_target to MODE_LINE_NOPROP or MODE_LINE_STRING. 328 Set mode_line_target to MODE_LINE_NOPROP or MODE_LINE_STRING.
49 Don't trim trailing dashes. 329 Don't trim trailing dashes.
50 (decode_mode_spec): Don't make infinite number of trailing dashes 330 (decode_mode_spec): Don't make infinite number of trailing dashes
51 for MODE_LINE_NOPROP and MODE_LINE_STRING targets. 331 for MODE_LINE_NOPROP and MODE_LINE_STRING targets.
@@ -5078,7 +5358,7 @@
5078 5358
50792004-06-11 Kenichi Handa <handa@m17n.org> 53592004-06-11 Kenichi Handa <handa@m17n.org>
5080 5360
5081 * coding.c (decode_coding_string): Check CODING_FINISH_INTERRUPT. 5361 * coding.c (encode_coding_string): Check CODING_FINISH_INTERRUPT.
5082 5362
50832004-06-11 Kim F. Storm <storm@cua.dk> 53632004-06-11 Kim F. Storm <storm@cua.dk>
5084 5364
@@ -12841,9 +13121,9 @@
12841 * sound.c: Added a partial implementation of play-sound-internal 13121 * sound.c: Added a partial implementation of play-sound-internal
12842 for Microsoft Windows. Added various #ifdef / #else / #endif 13122 for Microsoft Windows. Added various #ifdef / #else / #endif
12843 code blocks to separate the code that will compile under 13123 code blocks to separate the code that will compile under
12844 Microsoft Windows from the code that is specific to Gnu/Linux. 13124 Microsoft Windows from the code that is specific to GNU/Linux.
12845 Moved several blocks of code around to make this separation of code 13125 Moved several blocks of code around to make this separation of code
12846 into Windows compatible and Gnu/Linux compatible code blocks easier. 13126 into Windows compatible and GNU/Linux compatible code blocks easier.
12847 13127
12848 * makefile.w32-in: Include sound.c and link with WinMM.lib. 13128 * makefile.w32-in: Include sound.c and link with WinMM.lib.
12849 13129
diff --git a/src/bytecode.c b/src/bytecode.c
index e8d006e67d1..6b05a3270d2 100644
--- a/src/bytecode.c
+++ b/src/bytecode.c
@@ -384,8 +384,11 @@ unmark_byte_stack ()
384 do { \ 384 do { \
385 if (!NILP (Vquit_flag) && NILP (Vinhibit_quit)) \ 385 if (!NILP (Vquit_flag) && NILP (Vinhibit_quit)) \
386 { \ 386 { \
387 Lisp_Object flag = Vquit_flag; \
387 Vquit_flag = Qnil; \ 388 Vquit_flag = Qnil; \
388 BEFORE_POTENTIAL_GC (); \ 389 BEFORE_POTENTIAL_GC (); \
390 if (EQ (Vthrow_on_input, flag)) \
391 Fthrow (Vthrow_on_input, Qnil); \
389 Fsignal (Qquit, Qnil); \ 392 Fsignal (Qquit, Qnil); \
390 AFTER_POTENTIAL_GC (); \ 393 AFTER_POTENTIAL_GC (); \
391 } \ 394 } \
diff --git a/src/callproc.c b/src/callproc.c
index 6027ccdda9f..fe198b0770a 100644
--- a/src/callproc.c
+++ b/src/callproc.c
@@ -218,9 +218,10 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
218 int fd[2]; 218 int fd[2];
219 int filefd; 219 int filefd;
220 register int pid; 220 register int pid;
221 char buf[16384]; 221#define CALLPROC_BUFFER_SIZE_MIN (16 * 1024)
222 char *bufptr = buf; 222#define CALLPROC_BUFFER_SIZE_MAX (4 * CALLPROC_BUFFER_SIZE_MIN)
223 int bufsize = sizeof buf; 223 char buf[CALLPROC_BUFFER_SIZE_MAX];
224 int bufsize = CALLPROC_BUFFER_SIZE_MIN;
224 int count = SPECPDL_INDEX (); 225 int count = SPECPDL_INDEX ();
225 226
226 register const unsigned char **new_argv 227 register const unsigned char **new_argv
@@ -765,7 +766,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
765 nread = carryover; 766 nread = carryover;
766 while (nread < bufsize - 1024) 767 while (nread < bufsize - 1024)
767 { 768 {
768 int this_read = emacs_read (fd[0], bufptr + nread, 769 int this_read = emacs_read (fd[0], buf + nread,
769 bufsize - nread); 770 bufsize - nread);
770 771
771 if (this_read < 0) 772 if (this_read < 0)
@@ -790,7 +791,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
790 if (!NILP (buffer)) 791 if (!NILP (buffer))
791 { 792 {
792 if (! CODING_MAY_REQUIRE_DECODING (&process_coding)) 793 if (! CODING_MAY_REQUIRE_DECODING (&process_coding))
793 insert_1_both (bufptr, nread, nread, 0, 1, 0); 794 insert_1_both (buf, nread, nread, 0, 1, 0);
794 else 795 else
795 { /* We have to decode the input. */ 796 { /* We have to decode the input. */
796 int size; 797 int size;
@@ -807,7 +808,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
807 requires text-encoding detection. */ 808 requires text-encoding detection. */
808 if (process_coding.type == coding_type_undecided) 809 if (process_coding.type == coding_type_undecided)
809 { 810 {
810 detect_coding (&process_coding, bufptr, nread); 811 detect_coding (&process_coding, buf, nread);
811 if (process_coding.composing != COMPOSITION_DISABLED) 812 if (process_coding.composing != COMPOSITION_DISABLED)
812 /* We have not yet allocated the composition 813 /* We have not yet allocated the composition
813 data because the coding type was undecided. */ 814 data because the coding type was undecided. */
@@ -816,7 +817,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
816 if (process_coding.cmp_data) 817 if (process_coding.cmp_data)
817 process_coding.cmp_data->char_offset = PT; 818 process_coding.cmp_data->char_offset = PT;
818 819
819 decode_coding (&process_coding, bufptr, decoding_buf, 820 decode_coding (&process_coding, buf, decoding_buf,
820 nread, size); 821 nread, size);
821 822
822 if (display_on_the_fly 823 if (display_on_the_fly
@@ -905,7 +906,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
905 if (carryover > 0) 906 if (carryover > 0)
906 /* As CARRYOVER should not be that large, we had 907 /* As CARRYOVER should not be that large, we had
907 better avoid overhead of bcopy. */ 908 better avoid overhead of bcopy. */
908 BCOPY_SHORT (bufptr + process_coding.consumed, bufptr, 909 BCOPY_SHORT (buf + process_coding.consumed, buf,
909 carryover); 910 carryover);
910 if (process_coding.result == CODING_FINISH_INSUFFICIENT_CMP) 911 if (process_coding.result == CODING_FINISH_INSUFFICIENT_CMP)
911 { 912 {
@@ -922,17 +923,13 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */)
922 if (process_coding.mode & CODING_MODE_LAST_BLOCK) 923 if (process_coding.mode & CODING_MODE_LAST_BLOCK)
923 break; 924 break;
924 925
926#if (CALLPROC_BUFFER_SIZE_MIN != CALLPROC_BUFFER_SIZE_MAX)
925 /* Make the buffer bigger as we continue to read more data, 927 /* Make the buffer bigger as we continue to read more data,
926 but not past 64k. */ 928 but not past CALLPROC_BUFFER_SIZE_MAX. */
927 if (bufsize < 64 * 1024 && total_read > 32 * bufsize) 929 if (bufsize < CALLPROC_BUFFER_SIZE_MAX && total_read > 32 * bufsize)
928 { 930 if ((bufsize *= 2) > CALLPROC_BUFFER_SIZE_MAX)
929 char *tempptr; 931 bufsize = CALLPROC_BUFFER_SIZE_MAX;
930 bufsize *= 2; 932#endif
931
932 tempptr = (char *) alloca (bufsize);
933 bcopy (bufptr, tempptr, bufsize / 2);
934 bufptr = tempptr;
935 }
936 933
937 if (display_p) 934 if (display_p)
938 { 935 {
diff --git a/src/coding.c b/src/coding.c
index f7da394def1..7111862b656 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -6056,7 +6056,6 @@ run_pre_post_conversion_on_str (str, coding, encodep)
6056 int count = SPECPDL_INDEX (); 6056 int count = SPECPDL_INDEX ();
6057 struct gcpro gcpro1, gcpro2; 6057 struct gcpro gcpro1, gcpro2;
6058 int multibyte = STRING_MULTIBYTE (str); 6058 int multibyte = STRING_MULTIBYTE (str);
6059 struct buffer *buf;
6060 Lisp_Object old_deactivate_mark; 6059 Lisp_Object old_deactivate_mark;
6061 6060
6062 record_unwind_protect (Fset_buffer, Fcurrent_buffer ()); 6061 record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
@@ -6256,6 +6255,7 @@ decode_coding_string (str, coding, nocopy)
6256 produced += coding->produced; 6255 produced += coding->produced;
6257 produced_char += coding->produced_char; 6256 produced_char += coding->produced_char;
6258 if (result == CODING_FINISH_NORMAL 6257 if (result == CODING_FINISH_NORMAL
6258 || result == CODING_FINISH_INTERRUPT
6259 || (result == CODING_FINISH_INSUFFICIENT_SRC 6259 || (result == CODING_FINISH_INSUFFICIENT_SRC
6260 && coding->consumed == 0)) 6260 && coding->consumed == 0))
6261 break; 6261 break;
diff --git a/src/composite.c b/src/composite.c
index f8e655a3685..ff2eed925d1 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -628,7 +628,7 @@ compose_chars_in_text (start, end, string)
628 } 628 }
629 629
630 /* Preserve the match data. */ 630 /* Preserve the match data. */
631 record_unwind_protect (Fset_match_data, Fmatch_data (Qnil, Qnil)); 631 record_unwind_save_match_data ();
632 632
633 /* If none of ASCII characters have composition functions, we can 633 /* If none of ASCII characters have composition functions, we can
634 skip them quickly. */ 634 skip them quickly. */
diff --git a/src/config.in b/src/config.in
index dc66c234d03..5fb1f530d44 100644
--- a/src/config.in
+++ b/src/config.in
@@ -96,6 +96,9 @@ Boston, MA 02111-1307, USA. */
96/* Define to 1 if you have the `bzero' function. */ 96/* Define to 1 if you have the `bzero' function. */
97#undef HAVE_BZERO 97#undef HAVE_BZERO
98 98
99/* Define to 1 if CancelMenuTracking is available (Mac OSX). */
100#undef HAVE_CANCELMENUTRACKING
101
99/* Define to 1 if you are using the Carbon API on Mac OS X. */ 102/* Define to 1 if you are using the Carbon API on Mac OS X. */
100#undef HAVE_CARBON 103#undef HAVE_CARBON
101 104
@@ -782,9 +785,9 @@ Boston, MA 02111-1307, USA. */
782/* If using the C implementation of alloca, define if you know the 785/* If using the C implementation of alloca, define if you know the
783 direction of stack growth for your system; otherwise it will be 786 direction of stack growth for your system; otherwise it will be
784 automatically deduced at run-time. 787 automatically deduced at run-time.
785 STACK_DIRECTION > 0 => grows toward higher addresses 788 STACK_DIRECTION > 0 => grows toward higher addresses
786 STACK_DIRECTION < 0 => grows toward lower addresses 789 STACK_DIRECTION < 0 => grows toward lower addresses
787 STACK_DIRECTION = 0 => direction of growth unknown */ 790 STACK_DIRECTION = 0 => direction of growth unknown */
788#undef STACK_DIRECTION 791#undef STACK_DIRECTION
789 792
790/* Define to 1 if you have the ANSI C header files. */ 793/* Define to 1 if you have the ANSI C header files. */
diff --git a/src/emacs.c b/src/emacs.c
index f435a3959a3..a8c64115098 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -44,6 +44,7 @@ Boston, MA 02111-1307, USA. */
44#include <fcntl.h> 44#include <fcntl.h>
45#include <windows.h> /* just for w32.h */ 45#include <windows.h> /* just for w32.h */
46#include "w32.h" 46#include "w32.h"
47#include "w32heap.h" /* for prototype of sbrk */
47#endif 48#endif
48 49
49#include "lisp.h" 50#include "lisp.h"
diff --git a/src/eval.c b/src/eval.c
index 8bb201c5df5..445eb283114 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -722,35 +722,36 @@ usage: (defmacro NAME ARGLIST [DOCSTRING] [DECL] BODY...) */)
722 722
723 723
724DEFUN ("defvaralias", Fdefvaralias, Sdefvaralias, 2, 3, 0, 724DEFUN ("defvaralias", Fdefvaralias, Sdefvaralias, 2, 3, 0,
725 doc: /* Make SYMBOL a variable alias for symbol ALIASED. 725 doc: /* Make NEW-ALIAS a variable alias for symbol BASE-VARIABLE.
726Setting the value of SYMBOL will subsequently set the value of ALIASED, 726Setting the value of NEW-ALIAS will subsequently set the value of BASE-VARIABLE,
727and getting the value of SYMBOL will return the value ALIASED has. 727 and getting the value of NEW-ALIAS will return the value BASE-VARIABLE has.
728Third arg DOCSTRING, if non-nil, is documentation for SYMBOL. If it is 728Third arg DOCSTRING, if non-nil, is documentation for NEW-ALIAS. If it is
729omitted or nil, SYMBOL gets the documentation string of ALIASED, or of the 729 omitted or nil, NEW-ALIAS gets the documentation string of BASE-VARIABLE,
730variable at the end of the chain of aliases, if ALIASED is itself an alias. 730 or of the variable at the end of the chain of aliases, if BASE-VARIABLE is
731The return value is ALIASED. */) 731 itself an alias.
732 (symbol, aliased, docstring) 732The return value is BASE-VARIABLE. */)
733 Lisp_Object symbol, aliased, docstring; 733 (new_alias, base_variable, docstring)
734 Lisp_Object new_alias, base_variable, docstring;
734{ 735{
735 struct Lisp_Symbol *sym; 736 struct Lisp_Symbol *sym;
736 737
737 CHECK_SYMBOL (symbol); 738 CHECK_SYMBOL (new_alias);
738 CHECK_SYMBOL (aliased); 739 CHECK_SYMBOL (base_variable);
739 740
740 if (SYMBOL_CONSTANT_P (symbol)) 741 if (SYMBOL_CONSTANT_P (new_alias))
741 error ("Cannot make a constant an alias"); 742 error ("Cannot make a constant an alias");
742 743
743 sym = XSYMBOL (symbol); 744 sym = XSYMBOL (new_alias);
744 sym->indirect_variable = 1; 745 sym->indirect_variable = 1;
745 sym->value = aliased; 746 sym->value = base_variable;
746 sym->constant = SYMBOL_CONSTANT_P (aliased); 747 sym->constant = SYMBOL_CONSTANT_P (base_variable);
747 LOADHIST_ATTACH (symbol); 748 LOADHIST_ATTACH (new_alias);
748 if (!NILP (docstring)) 749 if (!NILP (docstring))
749 Fput (symbol, Qvariable_documentation, docstring); 750 Fput (new_alias, Qvariable_documentation, docstring);
750 else 751 else
751 Fput (symbol, Qvariable_documentation, Qnil); 752 Fput (new_alias, Qvariable_documentation, Qnil);
752 753
753 return aliased; 754 return base_variable;
754} 755}
755 756
756 757
@@ -1971,7 +1972,7 @@ do_autoload (fundef, funname)
1971 GCPRO3 (fun, funname, fundef); 1972 GCPRO3 (fun, funname, fundef);
1972 1973
1973 /* Preserve the match data. */ 1974 /* Preserve the match data. */
1974 record_unwind_protect (Fset_match_data, Fmatch_data (Qnil, Qnil)); 1975 record_unwind_save_match_data ();
1975 1976
1976 /* Value saved here is to be restored into Vautoload_queue. */ 1977 /* Value saved here is to be restored into Vautoload_queue. */
1977 record_unwind_protect (un_autoload, Vautoload_queue); 1978 record_unwind_protect (un_autoload, Vautoload_queue);
@@ -3130,10 +3131,10 @@ unbind_to (count, value)
3130 int count; 3131 int count;
3131 Lisp_Object value; 3132 Lisp_Object value;
3132{ 3133{
3133 int quitf = !NILP (Vquit_flag); 3134 Lisp_Object quitf = Vquit_flag;
3134 struct gcpro gcpro1; 3135 struct gcpro gcpro1, gcpro2;
3135 3136
3136 GCPRO1 (value); 3137 GCPRO2 (value, quitf);
3137 Vquit_flag = Qnil; 3138 Vquit_flag = Qnil;
3138 3139
3139 while (specpdl_ptr != specpdl + count) 3140 while (specpdl_ptr != specpdl + count)
@@ -3182,8 +3183,8 @@ unbind_to (count, value)
3182 } 3183 }
3183 } 3184 }
3184 3185
3185 if (NILP (Vquit_flag) && quitf) 3186 if (NILP (Vquit_flag) && !NILP (quitf))
3186 Vquit_flag = Qt; 3187 Vquit_flag = quitf;
3187 3188
3188 UNGCPRO; 3189 UNGCPRO;
3189 return value; 3190 return value;
diff --git a/src/fns.c b/src/fns.c
index e910c87375b..a36789b4a92 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -1471,7 +1471,7 @@ The value is actually the tail of LIST whose car is ELT. */)
1471 1471
1472DEFUN ("memq", Fmemq, Smemq, 2, 2, 0, 1472DEFUN ("memq", Fmemq, Smemq, 2, 2, 0,
1473 doc: /* Return non-nil if ELT is an element of LIST. 1473 doc: /* Return non-nil if ELT is an element of LIST.
1474Comparison done with EQ. The value is actually the tail of LIST 1474Comparison done with `eq'. The value is actually the tail of LIST
1475whose car is ELT. */) 1475whose car is ELT. */)
1476 (elt, list) 1476 (elt, list)
1477 Lisp_Object elt, list; 1477 Lisp_Object elt, list;
@@ -5486,7 +5486,7 @@ DEFUN ("remhash", Fremhash, Sremhash, 2, 2, 0,
5486 5486
5487DEFUN ("maphash", Fmaphash, Smaphash, 2, 2, 0, 5487DEFUN ("maphash", Fmaphash, Smaphash, 2, 2, 0,
5488 doc: /* Call FUNCTION for all entries in hash table TABLE. 5488 doc: /* Call FUNCTION for all entries in hash table TABLE.
5489FUNCTION is called with 2 arguments KEY and VALUE. */) 5489FUNCTION is called with two arguments, KEY and VALUE. */)
5490 (function, table) 5490 (function, table)
5491 Lisp_Object function, table; 5491 Lisp_Object function, table;
5492{ 5492{
diff --git a/src/frame.c b/src/frame.c
index f86cb0d43da..10318ba7110 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -905,7 +905,7 @@ do_switch_frame (frame, track, for_deletion)
905 return frame; 905 return frame;
906} 906}
907 907
908DEFUN ("select-frame", Fselect_frame, Sselect_frame, 1, 2, "e", 908DEFUN ("select-frame", Fselect_frame, Sselect_frame, 1, 1, "e",
909 doc: /* Select the frame FRAME. 909 doc: /* Select the frame FRAME.
910Subsequent editing commands apply to its selected window. 910Subsequent editing commands apply to its selected window.
911The selection of FRAME lasts until the next time the user does 911The selection of FRAME lasts until the next time the user does
@@ -916,14 +916,14 @@ the command loop, because it still may have the window system's input
916focus. On a text-only terminal, the next redisplay will display FRAME. 916focus. On a text-only terminal, the next redisplay will display FRAME.
917 917
918This function returns FRAME, or nil if FRAME has been deleted. */) 918This function returns FRAME, or nil if FRAME has been deleted. */)
919 (frame, no_enter) 919 (frame)
920 Lisp_Object frame, no_enter; 920 Lisp_Object frame;
921{ 921{
922 return do_switch_frame (frame, 1, 0); 922 return do_switch_frame (frame, 1, 0);
923} 923}
924 924
925 925
926DEFUN ("handle-switch-frame", Fhandle_switch_frame, Shandle_switch_frame, 1, 2, "e", 926DEFUN ("handle-switch-frame", Fhandle_switch_frame, Shandle_switch_frame, 1, 1, "e",
927 doc: /* Handle a switch-frame event EVENT. 927 doc: /* Handle a switch-frame event EVENT.
928Switch-frame events are usually bound to this function. 928Switch-frame events are usually bound to this function.
929A switch-frame event tells Emacs that the window manager has requested 929A switch-frame event tells Emacs that the window manager has requested
@@ -932,8 +932,8 @@ This function selects the selected window of the frame of EVENT.
932 932
933If EVENT is frame object, handle it as if it were a switch-frame event 933If EVENT is frame object, handle it as if it were a switch-frame event
934to that frame. */) 934to that frame. */)
935 (event, no_enter) 935 (event)
936 Lisp_Object event, no_enter; 936 Lisp_Object event;
937{ 937{
938 /* Preserve prefix arg that the command loop just cleared. */ 938 /* Preserve prefix arg that the command loop just cleared. */
939 current_kboard->Vprefix_arg = Vcurrent_prefix_arg; 939 current_kboard->Vprefix_arg = Vcurrent_prefix_arg;
@@ -1754,7 +1754,7 @@ before calling this function on it, like this.
1754#if defined (MSDOS) && defined (HAVE_MOUSE) 1754#if defined (MSDOS) && defined (HAVE_MOUSE)
1755 if (FRAME_MSDOS_P (XFRAME (frame))) 1755 if (FRAME_MSDOS_P (XFRAME (frame)))
1756 { 1756 {
1757 Fselect_frame (frame, Qnil); 1757 Fselect_frame (frame);
1758 mouse_moveto (XINT (x), XINT (y)); 1758 mouse_moveto (XINT (x), XINT (y));
1759 } 1759 }
1760#endif 1760#endif
@@ -1786,7 +1786,7 @@ before calling this function on it, like this.
1786#if defined (MSDOS) && defined (HAVE_MOUSE) 1786#if defined (MSDOS) && defined (HAVE_MOUSE)
1787 if (FRAME_MSDOS_P (XFRAME (frame))) 1787 if (FRAME_MSDOS_P (XFRAME (frame)))
1788 { 1788 {
1789 Fselect_frame (frame, Qnil); 1789 Fselect_frame (frame);
1790 mouse_moveto (XINT (x), XINT (y)); 1790 mouse_moveto (XINT (x), XINT (y));
1791 } 1791 }
1792#endif 1792#endif
@@ -1908,7 +1908,7 @@ If omitted, FRAME defaults to the currently selected frame. */)
1908#if 0 /* This isn't logically necessary, and it can do GC. */ 1908#if 0 /* This isn't logically necessary, and it can do GC. */
1909 /* Don't let the frame remain selected. */ 1909 /* Don't let the frame remain selected. */
1910 if (EQ (frame, selected_frame)) 1910 if (EQ (frame, selected_frame))
1911 Fhandle_switch_frame (next_frame (frame, Qt), Qnil); 1911 Fhandle_switch_frame (next_frame (frame, Qt));
1912#endif 1912#endif
1913 1913
1914 /* Don't allow minibuf_window to remain on a deleted frame. */ 1914 /* Don't allow minibuf_window to remain on a deleted frame. */
diff --git a/src/image.c b/src/image.c
index 15e835fef3b..462294b33b4 100644
--- a/src/image.c
+++ b/src/image.c
@@ -1972,7 +1972,8 @@ x_create_x_image_and_pixmap (f, width, height, depth, ximg, pixmap)
1972 and store its handle in *pixmap. */ 1972 and store its handle in *pixmap. */
1973 *pixmap = CreateDIBSection (hdc, &((*ximg)->info), 1973 *pixmap = CreateDIBSection (hdc, &((*ximg)->info),
1974 (depth < 16) ? DIB_PAL_COLORS : DIB_RGB_COLORS, 1974 (depth < 16) ? DIB_PAL_COLORS : DIB_RGB_COLORS,
1975 &((*ximg)->data), NULL, 0); 1975 /* casting avoids a GCC warning */
1976 (void **)&((*ximg)->data), NULL, 0);
1976 1977
1977 /* Realize display palette and garbage all frames. */ 1978 /* Realize display palette and garbage all frames. */
1978 release_frame_dc (f, hdc); 1979 release_frame_dc (f, hdc);
@@ -5517,7 +5518,8 @@ pbm_load (f, img)
5517 /* Maybe fill in the background field while we have ximg handy. */ 5518 /* Maybe fill in the background field while we have ximg handy. */
5518 5519
5519 if (NILP (image_spec_value (img->spec, QCbackground, NULL))) 5520 if (NILP (image_spec_value (img->spec, QCbackground, NULL)))
5520 IMAGE_BACKGROUND (img, f, ximg); 5521 /* Casting avoids a GCC warning. */
5522 IMAGE_BACKGROUND (img, f, (XImagePtr_or_DC)ximg);
5521 5523
5522 /* Put the image into a pixmap. */ 5524 /* Put the image into a pixmap. */
5523 x_put_x_image (f, ximg, img->pixmap, width, height); 5525 x_put_x_image (f, ximg, img->pixmap, width, height);
@@ -5843,9 +5845,11 @@ png_load (f, img)
5843 tbr.bytes += sizeof (sig); 5845 tbr.bytes += sizeof (sig);
5844 } 5846 }
5845 5847
5846 /* Initialize read and info structs for PNG lib. */ 5848 /* Initialize read and info structs for PNG lib. Casting return
5847 png_ptr = fn_png_create_read_struct (PNG_LIBPNG_VER_STRING, NULL, 5849 value avoids a GCC warning on W32. */
5848 my_png_error, my_png_warning); 5850 png_ptr = (png_structp)fn_png_create_read_struct (PNG_LIBPNG_VER_STRING,
5851 NULL, my_png_error,
5852 my_png_warning);
5849 if (!png_ptr) 5853 if (!png_ptr)
5850 { 5854 {
5851 if (fp) fclose (fp); 5855 if (fp) fclose (fp);
@@ -5853,7 +5857,8 @@ png_load (f, img)
5853 return 0; 5857 return 0;
5854 } 5858 }
5855 5859
5856 info_ptr = fn_png_create_info_struct (png_ptr); 5860 /* Casting return value avoids a GCC warning on W32. */
5861 info_ptr = (png_infop)fn_png_create_info_struct (png_ptr);
5857 if (!info_ptr) 5862 if (!info_ptr)
5858 { 5863 {
5859 fn_png_destroy_read_struct (&png_ptr, NULL, NULL); 5864 fn_png_destroy_read_struct (&png_ptr, NULL, NULL);
@@ -5862,7 +5867,8 @@ png_load (f, img)
5862 return 0; 5867 return 0;
5863 } 5868 }
5864 5869
5865 end_info = fn_png_create_info_struct (png_ptr); 5870 /* Casting return value avoids a GCC warning on W32. */
5871 end_info = (png_infop)fn_png_create_info_struct (png_ptr);
5866 if (!end_info) 5872 if (!end_info)
5867 { 5873 {
5868 fn_png_destroy_read_struct (&png_ptr, &info_ptr, NULL); 5874 fn_png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
@@ -6135,8 +6141,9 @@ png_load (f, img)
6135 img->width = width; 6141 img->width = width;
6136 img->height = height; 6142 img->height = height;
6137 6143
6138 /* Maybe fill in the background field while we have ximg handy. */ 6144 /* Maybe fill in the background field while we have ximg handy.
6139 IMAGE_BACKGROUND (img, f, ximg); 6145 Casting avoids a GCC warning. */
6146 IMAGE_BACKGROUND (img, f, (XImagePtr_or_DC)ximg);
6140 6147
6141 /* Put the image into the pixmap, then free the X image and its buffer. */ 6148 /* Put the image into the pixmap, then free the X image and its buffer. */
6142 x_put_x_image (f, ximg, img->pixmap, width, height); 6149 x_put_x_image (f, ximg, img->pixmap, width, height);
@@ -6145,9 +6152,9 @@ png_load (f, img)
6145 /* Same for the mask. */ 6152 /* Same for the mask. */
6146 if (mask_img) 6153 if (mask_img)
6147 { 6154 {
6148 /* Fill in the background_transparent field while we have the mask 6155 /* Fill in the background_transparent field while we have the
6149 handy. */ 6156 mask handy. Casting avoids a GCC warning. */
6150 image_background_transparent (img, f, mask_img); 6157 image_background_transparent (img, f, (XImagePtr_or_DC)mask_img);
6151 6158
6152 x_put_x_image (f, mask_img, img->mask, img->width, img->height); 6159 x_put_x_image (f, mask_img, img->mask, img->width, img->height);
6153 x_destroy_x_image (mask_img); 6160 x_destroy_x_image (mask_img);
@@ -6265,8 +6272,8 @@ jpeg_image_p (object)
6265#endif /* HAVE_STLIB_H */ 6272#endif /* HAVE_STLIB_H */
6266 6273
6267#if defined (HAVE_NTGUI) && !defined (__WIN32__) 6274#if defined (HAVE_NTGUI) && !defined (__WIN32__)
6268/* jpeglib.h will define boolean differently depending on __WIN32__, 6275/* In older releases of the jpeg library, jpeglib.h will define boolean
6269 so make sure it is defined. */ 6276 differently depending on __WIN32__, so make sure it is defined. */
6270#define __WIN32__ 1 6277#define __WIN32__ 1
6271#endif 6278#endif
6272 6279
@@ -6494,8 +6501,9 @@ jpeg_load (f, img)
6494 } 6501 }
6495 6502
6496 /* Customize libjpeg's error handling to call my_error_exit when an 6503 /* Customize libjpeg's error handling to call my_error_exit when an
6497 error is detected. This function will perform a longjmp. */ 6504 error is detected. This function will perform a longjmp.
6498 cinfo.err = fn_jpeg_std_error (&mgr.pub); 6505 Casting return value avoids a GCC warning on W32. */
6506 cinfo.err = (struct jpeg_error_mgr *)fn_jpeg_std_error (&mgr.pub);
6499 mgr.pub.error_exit = my_error_exit; 6507 mgr.pub.error_exit = my_error_exit;
6500 6508
6501 if ((rc = setjmp (mgr.setjmp_buffer)) != 0) 6509 if ((rc = setjmp (mgr.setjmp_buffer)) != 0)
@@ -6606,7 +6614,8 @@ jpeg_load (f, img)
6606 6614
6607 /* Maybe fill in the background field while we have ximg handy. */ 6615 /* Maybe fill in the background field while we have ximg handy. */
6608 if (NILP (image_spec_value (img->spec, QCbackground, NULL))) 6616 if (NILP (image_spec_value (img->spec, QCbackground, NULL)))
6609 IMAGE_BACKGROUND (img, f, ximg); 6617 /* Casting avoids a GCC warning. */
6618 IMAGE_BACKGROUND (img, f, (XImagePtr_or_DC)ximg);
6610 6619
6611 /* Put the image into the pixmap. */ 6620 /* Put the image into the pixmap. */
6612 x_put_x_image (f, ximg, img->pixmap, width, height); 6621 x_put_x_image (f, ximg, img->pixmap, width, height);
@@ -6932,8 +6941,9 @@ tiff_load (f, img)
6932 return 0; 6941 return 0;
6933 } 6942 }
6934 6943
6935 /* Try to open the image file. */ 6944 /* Try to open the image file. Casting return value avoids a
6936 tiff = fn_TIFFOpen (SDATA (file), "r"); 6945 GCC warning on W32. */
6946 tiff = (TIFF *)fn_TIFFOpen (SDATA (file), "r");
6937 if (tiff == NULL) 6947 if (tiff == NULL)
6938 { 6948 {
6939 image_error ("Cannot open `%s'", file, Qnil); 6949 image_error ("Cannot open `%s'", file, Qnil);
@@ -6948,14 +6958,15 @@ tiff_load (f, img)
6948 memsrc.len = SBYTES (specified_data); 6958 memsrc.len = SBYTES (specified_data);
6949 memsrc.index = 0; 6959 memsrc.index = 0;
6950 6960
6951 tiff = fn_TIFFClientOpen ("memory_source", "r", &memsrc, 6961 /* Casting return value avoids a GCC warning on W32. */
6952 (TIFFReadWriteProc) tiff_read_from_memory, 6962 tiff = (TIFF *)fn_TIFFClientOpen ("memory_source", "r", &memsrc,
6953 (TIFFReadWriteProc) tiff_write_from_memory, 6963 (TIFFReadWriteProc) tiff_read_from_memory,
6954 tiff_seek_in_memory, 6964 (TIFFReadWriteProc) tiff_write_from_memory,
6955 tiff_close_memory, 6965 tiff_seek_in_memory,
6956 tiff_size_of_memory, 6966 tiff_close_memory,
6957 tiff_mmap_memory, 6967 tiff_size_of_memory,
6958 tiff_unmap_memory); 6968 tiff_mmap_memory,
6969 tiff_unmap_memory);
6959 6970
6960 if (!tiff) 6971 if (!tiff)
6961 { 6972 {
@@ -7018,7 +7029,8 @@ tiff_load (f, img)
7018 7029
7019 /* Maybe fill in the background field while we have ximg handy. */ 7030 /* Maybe fill in the background field while we have ximg handy. */
7020 if (NILP (image_spec_value (img->spec, QCbackground, NULL))) 7031 if (NILP (image_spec_value (img->spec, QCbackground, NULL)))
7021 IMAGE_BACKGROUND (img, f, ximg); 7032 /* Casting avoids a GCC warning on W32. */
7033 IMAGE_BACKGROUND (img, f, (XImagePtr_or_DC)ximg);
7022 7034
7023 /* Put the image into the pixmap, then free the X image and its buffer. */ 7035 /* Put the image into the pixmap, then free the X image and its buffer. */
7024 x_put_x_image (f, ximg, img->pixmap, width, height); 7036 x_put_x_image (f, ximg, img->pixmap, width, height);
@@ -7126,6 +7138,11 @@ gif_image_p (object)
7126#ifdef HAVE_GIF 7138#ifdef HAVE_GIF
7127 7139
7128#if defined (HAVE_NTGUI) || defined (MAC_OS) 7140#if defined (HAVE_NTGUI) || defined (MAC_OS)
7141/* winuser.h might define DrawText to DrawTextA or DrawTextW.
7142 Undefine before redefining to avoid a preprocessor warning. */
7143#ifdef DrawText
7144#undef DrawText
7145#endif
7129/* avoid conflict with QuickdrawText.h */ 7146/* avoid conflict with QuickdrawText.h */
7130#define DrawText gif_DrawText 7147#define DrawText gif_DrawText
7131#include <gif_lib.h> 7148#include <gif_lib.h>
@@ -7239,8 +7256,9 @@ gif_load (f, img)
7239 return 0; 7256 return 0;
7240 } 7257 }
7241 7258
7242 /* Open the GIF file. */ 7259 /* Open the GIF file. Casting return value avoids a GCC warning
7243 gif = fn_DGifOpenFileName (SDATA (file)); 7260 on W32. */
7261 gif = (GifFileType *)fn_DGifOpenFileName (SDATA (file));
7244 if (gif == NULL) 7262 if (gif == NULL)
7245 { 7263 {
7246 image_error ("Cannot open `%s'", file, Qnil); 7264 image_error ("Cannot open `%s'", file, Qnil);
@@ -7256,7 +7274,8 @@ gif_load (f, img)
7256 memsrc.len = SBYTES (specified_data); 7274 memsrc.len = SBYTES (specified_data);
7257 memsrc.index = 0; 7275 memsrc.index = 0;
7258 7276
7259 gif = fn_DGifOpen(&memsrc, gif_read_from_memory); 7277 /* Casting return value avoids a GCC warning on W32. */
7278 gif = (GifFileType *)fn_DGifOpen(&memsrc, gif_read_from_memory);
7260 if (!gif) 7279 if (!gif)
7261 { 7280 {
7262 image_error ("Cannot open memory source `%s'", img->spec, Qnil); 7281 image_error ("Cannot open memory source `%s'", img->spec, Qnil);
@@ -7390,7 +7409,8 @@ gif_load (f, img)
7390 7409
7391 /* Maybe fill in the background field while we have ximg handy. */ 7410 /* Maybe fill in the background field while we have ximg handy. */
7392 if (NILP (image_spec_value (img->spec, QCbackground, NULL))) 7411 if (NILP (image_spec_value (img->spec, QCbackground, NULL)))
7393 IMAGE_BACKGROUND (img, f, ximg); 7412 /* Casting avoids a GCC warning. */
7413 IMAGE_BACKGROUND (img, f, (XImagePtr_or_DC)ximg);
7394 7414
7395 /* Put the image into the pixmap, then free the X image and its buffer. */ 7415 /* Put the image into the pixmap, then free the X image and its buffer. */
7396 x_put_x_image (f, ximg, img->pixmap, width, height); 7416 x_put_x_image (f, ximg, img->pixmap, width, height);
@@ -7400,7 +7420,7 @@ gif_load (f, img)
7400 return 1; 7420 return 1;
7401} 7421}
7402 7422
7403#else 7423#else /* !HAVE_GIF */
7404 7424
7405#ifdef MAC_OS 7425#ifdef MAC_OS
7406static int 7426static int
diff --git a/src/keyboard.c b/src/keyboard.c
index 2ccf444964b..135c3313a7b 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1494,7 +1494,7 @@ command_loop_1 ()
1494 Is this a good idea? */ 1494 Is this a good idea? */
1495 if (FRAMEP (internal_last_event_frame) 1495 if (FRAMEP (internal_last_event_frame)
1496 && !EQ (internal_last_event_frame, selected_frame)) 1496 && !EQ (internal_last_event_frame, selected_frame))
1497 Fselect_frame (internal_last_event_frame, Qnil); 1497 Fselect_frame (internal_last_event_frame);
1498#endif 1498#endif
1499 /* If it has changed current-menubar from previous value, 1499 /* If it has changed current-menubar from previous value,
1500 really recompute the menubar from the value. */ 1500 really recompute the menubar from the value. */
@@ -1507,6 +1507,7 @@ command_loop_1 ()
1507 1507
1508 Vthis_command = Qnil; 1508 Vthis_command = Qnil;
1509 real_this_command = Qnil; 1509 real_this_command = Qnil;
1510 Vthis_original_command = Qnil;
1510 1511
1511 /* Read next key sequence; i gets its length. */ 1512 /* Read next key sequence; i gets its length. */
1512 i = read_key_sequence (keybuf, sizeof keybuf / sizeof keybuf[0], 1513 i = read_key_sequence (keybuf, sizeof keybuf / sizeof keybuf[0],
diff --git a/src/lisp.h b/src/lisp.h
index 2e356985cdb..4d84cfa9f64 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -2768,6 +2768,7 @@ EXFUN (Fbuffer_disable_undo, 1);
2768EXFUN (Fbuffer_enable_undo, 1); 2768EXFUN (Fbuffer_enable_undo, 1);
2769EXFUN (Ferase_buffer, 0); 2769EXFUN (Ferase_buffer, 0);
2770extern Lisp_Object Qoverlayp; 2770extern Lisp_Object Qoverlayp;
2771extern Lisp_Object Qevaporate;
2771extern Lisp_Object get_truename_buffer P_ ((Lisp_Object)); 2772extern Lisp_Object get_truename_buffer P_ ((Lisp_Object));
2772extern struct buffer *all_buffers; 2773extern struct buffer *all_buffers;
2773EXFUN (Fprevious_overlay_change, 1); 2774EXFUN (Fprevious_overlay_change, 1);
@@ -2835,11 +2836,12 @@ extern void syms_of_abbrev P_ ((void));
2835/* defined in search.c */ 2836/* defined in search.c */
2836extern void shrink_regexp_cache P_ ((void)); 2837extern void shrink_regexp_cache P_ ((void));
2837EXFUN (Fstring_match, 3); 2838EXFUN (Fstring_match, 3);
2838extern void restore_match_data P_ ((void)); 2839extern void restore_search_regs P_ ((void));
2839EXFUN (Fmatch_data, 2); 2840EXFUN (Fmatch_data, 3);
2840EXFUN (Fset_match_data, 1); 2841EXFUN (Fset_match_data, 2);
2841EXFUN (Fmatch_beginning, 1); 2842EXFUN (Fmatch_beginning, 1);
2842EXFUN (Fmatch_end, 1); 2843EXFUN (Fmatch_end, 1);
2844extern void record_unwind_save_match_data P_ ((void));
2843EXFUN (Flooking_at, 1); 2845EXFUN (Flooking_at, 1);
2844extern int fast_string_match P_ ((Lisp_Object, Lisp_Object)); 2846extern int fast_string_match P_ ((Lisp_Object, Lisp_Object));
2845extern int fast_c_string_match_ignore_case P_ ((Lisp_Object, const char *)); 2847extern int fast_c_string_match_ignore_case P_ ((Lisp_Object, const char *));
@@ -2954,7 +2956,7 @@ extern Lisp_Object do_switch_frame P_ ((Lisp_Object, int, int));
2954extern Lisp_Object get_frame_param P_ ((struct frame *, Lisp_Object)); 2956extern Lisp_Object get_frame_param P_ ((struct frame *, Lisp_Object));
2955extern Lisp_Object frame_buffer_predicate P_ ((Lisp_Object)); 2957extern Lisp_Object frame_buffer_predicate P_ ((Lisp_Object));
2956EXFUN (Fframep, 1); 2958EXFUN (Fframep, 1);
2957EXFUN (Fselect_frame, 2); 2959EXFUN (Fselect_frame, 1);
2958EXFUN (Fselected_frame, 0); 2960EXFUN (Fselected_frame, 0);
2959EXFUN (Fwindow_frame, 1); 2961EXFUN (Fwindow_frame, 1);
2960EXFUN (Fframe_root_window, 1); 2962EXFUN (Fframe_root_window, 1);
diff --git a/src/macfns.c b/src/macfns.c
index d0dd9b9c072..b26baf3eaf7 100644
--- a/src/macfns.c
+++ b/src/macfns.c
@@ -4375,14 +4375,15 @@ If ONLY-DIR-P is non-nil, the user can only select directories. */)
4375 break; 4375 break;
4376 } 4376 }
4377 NavDialogDispose(dialogRef); 4377 NavDialogDispose(dialogRef);
4378 UNBLOCK_INPUT;
4378 } 4379 }
4379 else { 4380 else {
4381 UNBLOCK_INPUT;
4380 /* Fall back on minibuffer if there was a problem */ 4382 /* Fall back on minibuffer if there was a problem */
4381 file = Fcompleting_read (prompt, intern ("read-file-name-internal"), 4383 file = Fcompleting_read (prompt, intern ("read-file-name-internal"),
4382 dir, mustmatch, dir, Qfile_name_history, 4384 dir, mustmatch, dir, Qfile_name_history,
4383 default_filename, Qnil); 4385 default_filename, Qnil);
4384 } 4386 }
4385 UNBLOCK_INPUT;
4386 } 4387 }
4387 4388
4388 UNGCPRO; 4389 UNGCPRO;
diff --git a/src/macmenu.c b/src/macmenu.c
index 54393bca594..ee83a5f609f 100644
--- a/src/macmenu.c
+++ b/src/macmenu.c
@@ -602,6 +602,13 @@ list_of_items (pane)
602 } 602 }
603} 603}
604 604
605static Lisp_Object
606cleanup_popup_menu (arg)
607 Lisp_Object arg;
608{
609 discard_menu_items ();
610}
611
605DEFUN ("x-popup-menu", Fx_popup_menu, Sx_popup_menu, 2, 2, 0, 612DEFUN ("x-popup-menu", Fx_popup_menu, Sx_popup_menu, 2, 2, 0,
606 doc: /* Pop up a deck-of-cards menu and return user's selection. 613 doc: /* Pop up a deck-of-cards menu and return user's selection.
607POSITION is a position specification. This is either a mouse button 614POSITION is a position specification. This is either a mouse button
@@ -647,6 +654,8 @@ cached information about equivalent key sequences. */)
647 int keymaps = 0; 654 int keymaps = 0;
648 int for_click = 0; 655 int for_click = 0;
649 struct gcpro gcpro1; 656 struct gcpro gcpro1;
657 int specpdl_count = SPECPDL_INDEX ();
658
650 659
651#ifdef HAVE_MENUS 660#ifdef HAVE_MENUS
652 if (! NILP (position)) 661 if (! NILP (position))
@@ -806,13 +815,13 @@ cached information about equivalent key sequences. */)
806 815
807#ifdef HAVE_MENUS 816#ifdef HAVE_MENUS
808 /* Display them in a menu. */ 817 /* Display them in a menu. */
818 record_unwind_protect (cleanup_popup_menu, Qnil);
809 BLOCK_INPUT; 819 BLOCK_INPUT;
810 820
811 selection = mac_menu_show (f, xpos, ypos, for_click, 821 selection = mac_menu_show (f, xpos, ypos, for_click,
812 keymaps, title, &error_name); 822 keymaps, title, &error_name);
813 UNBLOCK_INPUT; 823 UNBLOCK_INPUT;
814 824 unbind_to (specpdl_count, Qnil);
815 discard_menu_items ();
816 825
817 UNGCPRO; 826 UNGCPRO;
818#endif /* HAVE_MENUS */ 827#endif /* HAVE_MENUS */
@@ -1347,6 +1356,68 @@ update_submenu_strings (first_wv)
1347} 1356}
1348 1357
1349 1358
1359/* Event handler function that pops down a menu on C-g. We can only pop
1360 down menus if CancelMenuTracking is present (OSX 10.3 or later). */
1361
1362#ifdef HAVE_CANCELMENUTRACKING
1363static pascal OSStatus
1364menu_quit_handler (nextHandler, theEvent, userData)
1365 EventHandlerCallRef nextHandler;
1366 EventRef theEvent;
1367 void* userData;
1368{
1369 UInt32 keyCode;
1370 UInt32 keyModifiers;
1371 extern int mac_quit_char_modifiers;
1372 extern int mac_quit_char_keycode;
1373
1374 GetEventParameter (theEvent, kEventParamKeyCode,
1375 typeUInt32, NULL, sizeof(UInt32), NULL, &keyCode);
1376
1377 GetEventParameter (theEvent, kEventParamKeyModifiers,
1378 typeUInt32, NULL, sizeof(UInt32),
1379 NULL, &keyModifiers);
1380
1381 if (keyCode == mac_quit_char_keycode
1382 && keyModifiers == mac_quit_char_modifiers)
1383 {
1384 MenuRef menu = userData != 0
1385 ? (MenuRef)userData : AcquireRootMenu ();
1386
1387 CancelMenuTracking (menu, true, 0);
1388 if (!userData) ReleaseMenu (menu);
1389 return noErr;
1390 }
1391
1392 return CallNextEventHandler (nextHandler, theEvent);
1393}
1394#endif /* HAVE_CANCELMENUTRACKING */
1395
1396/* Add event handler for MENU_HANDLE so we can detect C-g.
1397 If MENU_HANDLE is NULL, install handler for all menus in the menu bar.
1398 If CancelMenuTracking isn't available, do nothing. */
1399
1400static void
1401install_menu_quit_handler (MenuHandle menu_handle)
1402{
1403#ifdef HAVE_CANCELMENUTRACKING
1404 EventHandlerUPP handler = NewEventHandlerUPP(menu_quit_handler);
1405 UInt32 numTypes = 1;
1406 EventTypeSpec typesList[] = { { kEventClassKeyboard, kEventRawKeyDown } };
1407 int i = MIN_MENU_ID;
1408 MenuHandle menu = menu_handle ? menu_handle : GetMenuHandle (i);
1409
1410 while (menu != NULL)
1411 {
1412 InstallMenuEventHandler (menu, handler, GetEventTypeCount (typesList),
1413 typesList, menu_handle, NULL);
1414 if (menu_handle) break;
1415 menu = GetMenuHandle (++i);
1416 }
1417 DisposeEventHandlerUPP (handler);
1418#endif /* HAVE_CANCELMENUTRACKING */
1419}
1420
1350/* Set the contents of the menubar widgets of frame F. 1421/* Set the contents of the menubar widgets of frame F.
1351 The argument FIRST_TIME is currently ignored; 1422 The argument FIRST_TIME is currently ignored;
1352 it is set the first time this is called, from initialize_frame_menubar. */ 1423 it is set the first time this is called, from initialize_frame_menubar. */
@@ -1404,7 +1475,7 @@ set_frame_menubar (f, first_time, deep_p)
1404 because it is not reentrant. */ 1475 because it is not reentrant. */
1405 specbind (Qdebug_on_next_call, Qnil); 1476 specbind (Qdebug_on_next_call, Qnil);
1406 1477
1407 record_unwind_protect (Fset_match_data, Fmatch_data (Qnil, Qnil)); 1478 record_unwind_save_match_data ();
1408 if (NILP (Voverriding_local_map_menu_flag)) 1479 if (NILP (Voverriding_local_map_menu_flag))
1409 { 1480 {
1410 specbind (Qoverriding_terminal_local_map, Qnil); 1481 specbind (Qoverriding_terminal_local_map, Qnil);
@@ -1566,6 +1637,8 @@ set_frame_menubar (f, first_time, deep_p)
1566 1637
1567 DrawMenuBar (); 1638 DrawMenuBar ();
1568 1639
1640 /* Add event handler so we can detect C-g. */
1641 install_menu_quit_handler (NULL);
1569 free_menubar_widget_value_tree (first_wv); 1642 free_menubar_widget_value_tree (first_wv);
1570 1643
1571 UNBLOCK_INPUT; 1644 UNBLOCK_INPUT;
@@ -1597,7 +1670,43 @@ free_frame_menubar (f)
1597} 1670}
1598 1671
1599 1672
1600/* mac_menu_show actually displays a menu using the panes and items in 1673static Lisp_Object
1674pop_down_menu (arg)
1675 Lisp_Object arg;
1676{
1677 struct Lisp_Save_Value *p1 = XSAVE_VALUE (Fcar (arg));
1678 struct Lisp_Save_Value *p2 = XSAVE_VALUE (Fcdr (arg));
1679
1680 FRAME_PTR f = p1->pointer;
1681 MenuHandle *menu = p2->pointer;
1682
1683 BLOCK_INPUT;
1684
1685 /* Must reset this manually because the button release event is not
1686 passed to Emacs event loop. */
1687 FRAME_MAC_DISPLAY_INFO (f)->grabbed = 0;
1688
1689 /* delete all menus */
1690 {
1691 int i = MIN_POPUP_SUBMENU_ID;
1692 MenuHandle submenu = GetMenuHandle (i);
1693 while (submenu != NULL)
1694 {
1695 DeleteMenu (i);
1696 DisposeMenu (submenu);
1697 submenu = GetMenuHandle (++i);
1698 }
1699 }
1700
1701 DeleteMenu (POPUP_SUBMENU_ID);
1702 DisposeMenu (*menu);
1703
1704 UNBLOCK_INPUT;
1705
1706 return Qnil;
1707}
1708
1709/* Mac_menu_show actually displays a menu using the panes and items in
1601 menu_items and returns the value selected from it; we assume input 1710 menu_items and returns the value selected from it; we assume input
1602 is blocked by the caller. */ 1711 is blocked by the caller. */
1603 1712
@@ -1635,6 +1744,7 @@ mac_menu_show (f, x, y, for_click, keymaps, title, error)
1635 = (Lisp_Object *) alloca (menu_items_used * sizeof (Lisp_Object)); 1744 = (Lisp_Object *) alloca (menu_items_used * sizeof (Lisp_Object));
1636 int submenu_depth = 0; 1745 int submenu_depth = 0;
1637 int first_pane; 1746 int first_pane;
1747 int specpdl_count = SPECPDL_INDEX ();
1638 1748
1639 *error = NULL; 1749 *error = NULL;
1640 1750
@@ -1808,7 +1918,7 @@ mac_menu_show (f, x, y, for_click, keymaps, title, error)
1808 title = ENCODE_MENU_STRING (title); 1918 title = ENCODE_MENU_STRING (title);
1809#endif 1919#endif
1810 wv_title->name = (char *) SDATA (title); 1920 wv_title->name = (char *) SDATA (title);
1811 wv_title->enabled = TRUE; 1921 wv_title->enabled = FALSE;
1812 wv_title->title = TRUE; 1922 wv_title->title = TRUE;
1813 wv_title->button_type = BUTTON_TYPE_NONE; 1923 wv_title->button_type = BUTTON_TYPE_NONE;
1814 wv_title->help = Qnil; 1924 wv_title->help = Qnil;
@@ -1821,6 +1931,10 @@ mac_menu_show (f, x, y, for_click, keymaps, title, error)
1821 submenu_id = MIN_POPUP_SUBMENU_ID; 1931 submenu_id = MIN_POPUP_SUBMENU_ID;
1822 fill_submenu (menu, first_wv->contents); 1932 fill_submenu (menu, first_wv->contents);
1823 1933
1934 /* Free the widget_value objects we used to specify the
1935 contents. */
1936 free_menubar_widget_value_tree (first_wv);
1937
1824 /* Adjust coordinates to be root-window-relative. */ 1938 /* Adjust coordinates to be root-window-relative. */
1825 pos.h = x; 1939 pos.h = x;
1826 pos.v = y; 1940 pos.v = y;
@@ -1835,11 +1949,18 @@ mac_menu_show (f, x, y, for_click, keymaps, title, error)
1835 1949
1836 InsertMenu (menu, -1); 1950 InsertMenu (menu, -1);
1837 1951
1952 record_unwind_protect (pop_down_menu,
1953 Fcons (make_save_value (f, 0),
1954 make_save_value (&menu, 0)));
1955
1956 /* Add event handler so we can detect C-g. */
1957 install_menu_quit_handler (menu);
1958
1838 /* Display the menu. */ 1959 /* Display the menu. */
1839 menu_item_choice = PopUpMenuSelect (menu, pos.v, pos.h, 0); 1960 menu_item_choice = PopUpMenuSelect (menu, pos.v, pos.h, 0);
1840 menu_item_selection = LoWord (menu_item_choice); 1961 menu_item_selection = LoWord (menu_item_choice);
1841 1962
1842 /* Get the refcon to find the correct item*/ 1963 /* Get the refcon to find the correct item */
1843 if (menu_item_selection) 1964 if (menu_item_selection)
1844 { 1965 {
1845 MenuHandle sel_menu = GetMenuHandle (HiWord (menu_item_choice)); 1966 MenuHandle sel_menu = GetMenuHandle (HiWord (menu_item_choice));
@@ -1847,35 +1968,10 @@ mac_menu_show (f, x, y, for_click, keymaps, title, error)
1847 GetMenuItemRefCon (sel_menu, menu_item_selection, &refcon); 1968 GetMenuItemRefCon (sel_menu, menu_item_selection, &refcon);
1848 } 1969 }
1849 } 1970 }
1850 1971 else if (! for_click)
1851#if 0 1972 /* Make "Cancel" equivalent to C-g unless this menu was popped up by
1852 /* Clean up extraneous mouse events which might have been generated 1973 a mouse press. */
1853 during the call. */ 1974 Fsignal (Qquit, Qnil);
1854 discard_mouse_events ();
1855#endif
1856
1857 /* Must reset this manually because the button release event is not
1858 passed to Emacs event loop. */
1859 FRAME_MAC_DISPLAY_INFO (f)->grabbed = 0;
1860
1861 /* Free the widget_value objects we used to specify the
1862 contents. */
1863 free_menubar_widget_value_tree (first_wv);
1864
1865 /* delete all menus */
1866 {
1867 int i = MIN_POPUP_SUBMENU_ID;
1868 MenuHandle submenu = GetMenuHandle (i);
1869 while (submenu != NULL)
1870 {
1871 DeleteMenu (i);
1872 DisposeMenu (submenu);
1873 submenu = GetMenuHandle (++i);
1874 }
1875 }
1876
1877 DeleteMenu (POPUP_SUBMENU_ID);
1878 DisposeMenu (menu);
1879 1975
1880 /* Find the selected item, and its pane, to return 1976 /* Find the selected item, and its pane, to return
1881 the proper value. */ 1977 the proper value. */
@@ -1931,6 +2027,11 @@ mac_menu_show (f, x, y, for_click, keymaps, title, error)
1931 } 2027 }
1932 } 2028 }
1933 } 2029 }
2030 else if (!for_click)
2031 /* Make "Cancel" equivalent to C-g. */
2032 Fsignal (Qquit, Qnil);
2033
2034 unbind_to (specpdl_count, Qnil);
1934 2035
1935 return Qnil; 2036 return Qnil;
1936} 2037}
diff --git a/src/macterm.c b/src/macterm.c
index 890c1a1b9ba..f5c71ab2c24 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -1996,33 +1996,37 @@ static void
1996mac_compute_glyph_string_overhangs (s) 1996mac_compute_glyph_string_overhangs (s)
1997 struct glyph_string *s; 1997 struct glyph_string *s;
1998{ 1998{
1999 Rect r; 1999 if (s->cmp == NULL
2000 MacFontStruct *font = s->font; 2000 && s->first_glyph->type == CHAR_GLYPH)
2001
2002 TextFont (font->mac_fontnum);
2003 TextSize (font->mac_fontsize);
2004 TextFace (font->mac_fontface);
2005
2006 if (s->two_byte_p)
2007 QDTextBounds (s->nchars * 2, (char *)s->char2b, &r);
2008 else
2009 { 2001 {
2010 int i; 2002 Rect r;
2011 char *buf = xmalloc (s->nchars); 2003 MacFontStruct *font = s->font;
2012 2004
2013 if (buf == NULL) 2005 TextFont (font->mac_fontnum);
2014 SetRect (&r, 0, 0, 0, 0); 2006 TextSize (font->mac_fontsize);
2007 TextFace (font->mac_fontface);
2008
2009 if (s->two_byte_p)
2010 QDTextBounds (s->nchars * 2, (char *)s->char2b, &r);
2015 else 2011 else
2016 { 2012 {
2017 for (i = 0; i < s->nchars; ++i) 2013 int i;
2018 buf[i] = s->char2b[i].byte2; 2014 char *buf = xmalloc (s->nchars);
2019 QDTextBounds (s->nchars, buf, &r); 2015
2020 xfree (buf); 2016 if (buf == NULL)
2017 SetRect (&r, 0, 0, 0, 0);
2018 else
2019 {
2020 for (i = 0; i < s->nchars; ++i)
2021 buf[i] = s->char2b[i].byte2;
2022 QDTextBounds (s->nchars, buf, &r);
2023 xfree (buf);
2024 }
2021 } 2025 }
2022 }
2023 2026
2024 s->right_overhang = r.right > s->width ? r.right - s->width : 0; 2027 s->right_overhang = r.right > s->width ? r.right - s->width : 0;
2025 s->left_overhang = r.left < 0 ? -r.left : 0; 2028 s->left_overhang = r.left < 0 ? -r.left : 0;
2029 }
2026} 2030}
2027 2031
2028 2032
@@ -7469,6 +7473,11 @@ Lisp_Object Vmac_pass_command_to_system;
7469/* If Non-nil, the Mac "Control" key is passed on to the Mac Toolbox 7473/* If Non-nil, the Mac "Control" key is passed on to the Mac Toolbox
7470 for processing before Emacs sees it. */ 7474 for processing before Emacs sees it. */
7471Lisp_Object Vmac_pass_control_to_system; 7475Lisp_Object Vmac_pass_control_to_system;
7476
7477/* Points to the variable `inev' in the function XTread_socket. It is
7478 used for passing an input event to the function back from a Carbon
7479 event handler. */
7480static struct input_event *read_socket_inev = NULL;
7472#endif 7481#endif
7473 7482
7474/* Set in term/mac-win.el to indicate that event loop can now generate 7483/* Set in term/mac-win.el to indicate that event loop can now generate
@@ -7601,45 +7610,79 @@ mac_get_mouse_btn (EventRef ref)
7601 7610
7602/* Normally, ConvertEventRefToEventRecord will correctly handle all 7611/* Normally, ConvertEventRefToEventRecord will correctly handle all
7603 events. However the click of the mouse wheel is not converted to a 7612 events. However the click of the mouse wheel is not converted to a
7604 mouseDown or mouseUp event. This calls ConvertEventRef, but then 7613 mouseDown or mouseUp event. Likewise for dead key down events.
7605 checks to see if it is a mouse up or down carbon event that has not 7614 This calls ConvertEventRef, but then checks to see if it is a mouse
7606 been converted, and if so, converts it by hand (to be picked up in 7615 up/down, or a dead key down carbon event that has not been
7607 the XTread_socket loop). */ 7616 converted, and if so, converts it by hand (to be picked up in the
7617 XTread_socket loop). */
7608static Boolean mac_convert_event_ref (EventRef eventRef, EventRecord *eventRec) 7618static Boolean mac_convert_event_ref (EventRef eventRef, EventRecord *eventRec)
7609{ 7619{
7610 Boolean result = ConvertEventRefToEventRecord (eventRef, eventRec); 7620 Boolean result = ConvertEventRefToEventRecord (eventRef, eventRec);
7611 /* Do special case for mouse wheel button. */ 7621
7612 if (!result && GetEventClass (eventRef) == kEventClassMouse) 7622 if (result)
7623 return result;
7624
7625 switch (GetEventClass (eventRef))
7613 { 7626 {
7614 UInt32 kind = GetEventKind (eventRef); 7627 case kEventClassMouse:
7615 if (kind == kEventMouseDown && !(eventRec->what == mouseDown)) 7628 switch (GetEventKind (eventRef))
7616 { 7629 {
7630 case kEventMouseDown:
7617 eventRec->what = mouseDown; 7631 eventRec->what = mouseDown;
7618 result=1; 7632 result = 1;
7619 } 7633 break;
7620 if (kind == kEventMouseUp && !(eventRec->what == mouseUp)) 7634
7621 { 7635 case kEventMouseUp:
7622 eventRec->what = mouseUp; 7636 eventRec->what = mouseUp;
7623 result=1; 7637 result = 1;
7638 break;
7639
7640 default:
7641 break;
7624 } 7642 }
7625 if (result) 7643
7644 case kEventClassKeyboard:
7645 switch (GetEventKind (eventRef))
7626 { 7646 {
7627 /* Need where and when. */ 7647 case kEventRawKeyDown:
7628 UInt32 mods; 7648 {
7629 GetEventParameter (eventRef, kEventParamMouseLocation, 7649 unsigned char char_codes;
7630 typeQDPoint, NULL, sizeof (Point), 7650 UInt32 key_code;
7631 NULL, &eventRec->where); 7651
7632 /* Use two step process because new event modifiers are 7652 eventRec->what = keyDown;
7633 32-bit and old are 16-bit. Currently, only loss is 7653 GetEventParameter (eventRef, kEventParamKeyMacCharCodes, typeChar,
7634 NumLock & Fn. */ 7654 NULL, sizeof (char), NULL, &char_codes);
7635 GetEventParameter (eventRef, kEventParamKeyModifiers, 7655 GetEventParameter (eventRef, kEventParamKeyCode, typeUInt32,
7636 typeUInt32, NULL, sizeof (UInt32), 7656 NULL, sizeof (UInt32), NULL, &key_code);
7637 NULL, &mods); 7657 eventRec->message = char_codes | ((key_code & 0xff) << 8);
7638 eventRec->modifiers = mods; 7658 result = 1;
7639 7659 }
7640 eventRec->when = EventTimeToTicks (GetEventTime (eventRef)); 7660 break;
7661
7662 default:
7663 break;
7641 } 7664 }
7665
7666 default:
7667 break;
7642 } 7668 }
7669
7670 if (result)
7671 {
7672 /* Need where and when. */
7673 UInt32 mods;
7674
7675 GetEventParameter (eventRef, kEventParamMouseLocation, typeQDPoint,
7676 NULL, sizeof (Point), NULL, &eventRec->where);
7677 /* Use two step process because new event modifiers are 32-bit
7678 and old are 16-bit. Currently, only loss is NumLock & Fn. */
7679 GetEventParameter (eventRef, kEventParamKeyModifiers, typeUInt32,
7680 NULL, sizeof (UInt32), NULL, &mods);
7681 eventRec->modifiers = mods;
7682
7683 eventRec->when = EventTimeToTicks (GetEventTime (eventRef));
7684 }
7685
7643 return result; 7686 return result;
7644} 7687}
7645 7688
@@ -8209,8 +8252,7 @@ mac_handle_command_event (next_handler, event, data)
8209} 8252}
8210 8253
8211static OSErr 8254static OSErr
8212init_command_handler (window) 8255init_command_handler ()
8213 WindowPtr window;
8214{ 8256{
8215 OSErr err = noErr; 8257 OSErr err = noErr;
8216 EventTypeSpec specs[] = {{kEventClassCommand, kEventCommandProcess}}; 8258 EventTypeSpec specs[] = {{kEventClassCommand, kEventCommandProcess}};
@@ -8295,6 +8337,68 @@ mac_handle_window_event (next_handler, event, data)
8295 8337
8296 return eventNotHandledErr; 8338 return eventNotHandledErr;
8297} 8339}
8340
8341static pascal OSStatus
8342mac_handle_mouse_event (next_handler, event, data)
8343 EventHandlerCallRef next_handler;
8344 EventRef event;
8345 void *data;
8346{
8347 OSStatus result;
8348
8349 switch (GetEventKind (event))
8350 {
8351 case kEventMouseWheelMoved:
8352 {
8353 WindowPtr wp;
8354 struct frame *f;
8355 EventMouseWheelAxis axis;
8356 SInt32 delta;
8357 Point point;
8358
8359 result = CallNextEventHandler (next_handler, event);
8360 if (result != eventNotHandledErr || read_socket_inev == NULL)
8361 return result;
8362
8363 GetEventParameter (event, kEventParamWindowRef, typeWindowRef,
8364 NULL, sizeof (WindowRef), NULL, &wp);
8365 f = mac_window_to_frame (wp);
8366 if (f != mac_focus_frame (&one_mac_display_info))
8367 break;
8368
8369 GetEventParameter (event, kEventParamMouseWheelAxis,
8370 typeMouseWheelAxis, NULL,
8371 sizeof (EventMouseWheelAxis), NULL, &axis);
8372 if (axis != kEventMouseWheelAxisY)
8373 break;
8374
8375 GetEventParameter (event, kEventParamMouseWheelDelta, typeSInt32,
8376 NULL, sizeof (SInt32), NULL, &delta);
8377 GetEventParameter (event, kEventParamMouseLocation, typeQDPoint,
8378 NULL, sizeof (Point), NULL, &point);
8379 read_socket_inev->kind = WHEEL_EVENT;
8380 read_socket_inev->code = 0;
8381 read_socket_inev->modifiers =
8382 (mac_event_to_emacs_modifiers (event)
8383 | ((delta < 0) ? down_modifier : up_modifier));
8384 SetPortWindowPort (wp);
8385 GlobalToLocal (&point);
8386 XSETINT (read_socket_inev->x, point.h);
8387 XSETINT (read_socket_inev->y, point.v);
8388 XSETFRAME (read_socket_inev->frame_or_window, f);
8389 read_socket_inev->timestamp =
8390 EventTimeToTicks (GetEventTime (event)) * (1000/60);
8391
8392 return noErr;
8393 }
8394 break;
8395
8396 default:
8397 break;
8398 }
8399
8400 return eventNotHandledErr;
8401}
8298#endif /* USE_CARBON_EVENTS */ 8402#endif /* USE_CARBON_EVENTS */
8299 8403
8300 8404
@@ -8304,16 +8408,24 @@ install_window_handler (window)
8304{ 8408{
8305 OSErr err = noErr; 8409 OSErr err = noErr;
8306#if USE_CARBON_EVENTS 8410#if USE_CARBON_EVENTS
8307 EventTypeSpec specs[] = {{kEventClassWindow, kEventWindowUpdate}, 8411 EventTypeSpec specs_window[] =
8308 {kEventClassWindow, kEventWindowBoundsChanging}}; 8412 {{kEventClassWindow, kEventWindowUpdate},
8309 static EventHandlerUPP handle_window_event_UPP = NULL; 8413 {kEventClassWindow, kEventWindowBoundsChanging}};
8310 8414 EventTypeSpec specs_mouse[] = {{kEventClassMouse, kEventMouseWheelMoved}};
8311 if (handle_window_event_UPP == NULL) 8415 static EventHandlerUPP handle_window_eventUPP = NULL;
8312 handle_window_event_UPP = NewEventHandlerUPP (mac_handle_window_event); 8416 static EventHandlerUPP handle_mouse_eventUPP = NULL;
8313 8417
8314 err = InstallWindowEventHandler (window, handle_window_event_UPP, 8418 if (handle_window_eventUPP == NULL)
8315 GetEventTypeCount (specs), specs, 8419 handle_window_eventUPP = NewEventHandlerUPP (mac_handle_window_event);
8316 NULL, NULL); 8420 if (handle_mouse_eventUPP == NULL)
8421 handle_mouse_eventUPP = NewEventHandlerUPP (mac_handle_mouse_event);
8422 err = InstallWindowEventHandler (window, handle_window_eventUPP,
8423 GetEventTypeCount (specs_window),
8424 specs_window, NULL, NULL);
8425 if (err == noErr)
8426 err = InstallWindowEventHandler (window, handle_mouse_eventUPP,
8427 GetEventTypeCount (specs_mouse),
8428 specs_mouse, NULL, NULL);
8317#endif 8429#endif
8318#if TARGET_API_MAC_CARBON 8430#if TARGET_API_MAC_CARBON
8319 if (mac_do_track_dragUPP == NULL) 8431 if (mac_do_track_dragUPP == NULL)
@@ -8865,68 +8977,19 @@ XTread_socket (sd, expected, hold_quit)
8865#if USE_CARBON_EVENTS 8977#if USE_CARBON_EVENTS
8866 /* Handle new events */ 8978 /* Handle new events */
8867 if (!mac_convert_event_ref (eventRef, &er)) 8979 if (!mac_convert_event_ref (eventRef, &er))
8868 switch (GetEventClass (eventRef)) 8980 {
8869 { 8981 /* There used to be a handler for the kEventMouseWheelMoved
8870 case kEventClassWindow: 8982 event here. But as of Mac OS X 10.4, this kind of event
8871 if (GetEventKind (eventRef) == kEventWindowBoundsChanged) 8983 is not directly posted to the main event queue by
8872 { 8984 two-finger scrolling on the trackpad. Instead, some
8873 WindowPtr window_ptr; 8985 private event is posted and it is converted to a wheel
8874 GetEventParameter(eventRef, kEventParamDirectObject, 8986 event by the default handler for the application target.
8875 typeWindowRef, NULL, sizeof(WindowPtr), 8987 The converted one can be received by a Carbon event
8876 NULL, &window_ptr); 8988 handler installed on a window target. */
8877 f = mac_window_to_frame (window_ptr); 8989 read_socket_inev = &inev;
8878 if (f && !f->async_iconified) 8990 SendEventToEventTarget (eventRef, toolbox_dispatcher);
8879 x_real_positions (f, &f->left_pos, &f->top_pos); 8991 read_socket_inev = NULL;
8880 SendEventToEventTarget (eventRef, toolbox_dispatcher); 8992 }
8881 }
8882 break;
8883 case kEventClassMouse:
8884 if (GetEventKind (eventRef) == kEventMouseWheelMoved)
8885 {
8886 SInt32 delta;
8887 Point point;
8888 struct frame *f = mac_focus_frame (dpyinfo);
8889 WindowPtr window_ptr;
8890
8891#if 0
8892 if (dpyinfo->x_focus_frame == NULL)
8893 {
8894 /* Beep if wheel move occurs when all the frames
8895 are invisible. */
8896 SysBeep(1);
8897 break;
8898 }
8899#endif
8900
8901 GetEventParameter(eventRef, kEventParamMouseWheelDelta,
8902 typeSInt32, NULL, sizeof (SInt32),
8903 NULL, &delta);
8904 GetEventParameter(eventRef, kEventParamMouseLocation,
8905 typeQDPoint, NULL, sizeof (Point),
8906 NULL, &point);
8907 inev.kind = WHEEL_EVENT;
8908 inev.code = 0;
8909 inev.modifiers = (mac_event_to_emacs_modifiers (eventRef)
8910 | ((delta < 0) ? down_modifier
8911 : up_modifier));
8912 window_ptr = FRAME_MAC_WINDOW (f);
8913 SetPortWindowPort (window_ptr);
8914 GlobalToLocal (&point);
8915 XSETINT (inev.x, point.h);
8916 XSETINT (inev.y, point.v);
8917 XSETFRAME (inev.frame_or_window,
8918 mac_window_to_frame (window_ptr));
8919 inev.timestamp = EventTimeToTicks (GetEventTime (eventRef))*(1000/60);
8920 }
8921 else
8922 SendEventToEventTarget (eventRef, toolbox_dispatcher);
8923
8924 break;
8925
8926 default:
8927 /* Send the event to the appropriate receiver. */
8928 SendEventToEventTarget (eventRef, toolbox_dispatcher);
8929 }
8930 else 8993 else
8931#endif /* USE_CARBON_EVENTS */ 8994#endif /* USE_CARBON_EVENTS */
8932 switch (er.what) 8995 switch (er.what)
@@ -9362,7 +9425,10 @@ XTread_socket (sd, expected, hold_quit)
9362 if ((!NILP (Vmac_pass_command_to_system) 9425 if ((!NILP (Vmac_pass_command_to_system)
9363 || !(er.modifiers & cmdKey)) 9426 || !(er.modifiers & cmdKey))
9364 && (!NILP (Vmac_pass_control_to_system) 9427 && (!NILP (Vmac_pass_control_to_system)
9365 || !(er.modifiers & controlKey))) 9428 || !(er.modifiers & controlKey))
9429 && (!NILP (Vmac_command_key_is_meta)
9430 && NILP (Vmac_option_modifier)
9431 || !(er.modifiers & optionKey)))
9366 if (SendEventToEventTarget (eventRef, toolbox_dispatcher) 9432 if (SendEventToEventTarget (eventRef, toolbox_dispatcher)
9367 != eventNotHandledErr) 9433 != eventNotHandledErr)
9368 break; 9434 break;
@@ -9890,8 +9956,8 @@ MakeMeTheFrontProcess ()
9890/***** Code to handle C-g testing *****/ 9956/***** Code to handle C-g testing *****/
9891 9957
9892/* Contains the Mac modifier formed from quit_char */ 9958/* Contains the Mac modifier formed from quit_char */
9893static mac_quit_char_modifiers = 0; 9959int mac_quit_char_modifiers = 0;
9894static mac_quit_char_keycode; 9960int mac_quit_char_keycode;
9895extern int quit_char; 9961extern int quit_char;
9896 9962
9897static void 9963static void
diff --git a/src/makefile.w32-in b/src/makefile.w32-in
index 5a232e28362..c631852c0f0 100644
--- a/src/makefile.w32-in
+++ b/src/makefile.w32-in
@@ -42,6 +42,8 @@ TOBJ = $(BLD)/firstfile.$(O)
42TRES = $(BLD)/emacs.res 42TRES = $(BLD)/emacs.res
43TLASTLIB = $(BLD)/lastfile.$(A) 43TLASTLIB = $(BLD)/lastfile.$(A)
44 44
45DOC = $(OBJDIR)/etc/DOC-X
46
45FULL_LINK_FLAGS = $(LINK_FLAGS) $(TEMACS_EXTRA_LINK) 47FULL_LINK_FLAGS = $(LINK_FLAGS) $(TEMACS_EXTRA_LINK)
46 48
47# 49#
@@ -165,7 +167,8 @@ $(EMACS): $(DOC) $(TEMACS)
165# (it is the preload heap size in MB). 167# (it is the preload heap size in MB).
166# 168#
167temacs: $(BLD) $(TEMACS) 169temacs: $(BLD) $(TEMACS)
168$(TEMACS): $(TLIB0) $(TLIB1) $(TLIBW32) $(TLASTLIB) $(TOBJ) $(TRES) 170$(TEMACS): $(TLIB0) $(TLIB1) $(TLIBW32) $(TLASTLIB) $(TOBJ) $(TRES) \
171 ../nt/$(BLD)/addsection.exe
169 $(LINK) $(LINK_OUT)$(TEMACS_TMP) $(FULL_LINK_FLAGS) $(TOBJ) $(TRES) $(LIBS) 172 $(LINK) $(LINK_OUT)$(TEMACS_TMP) $(FULL_LINK_FLAGS) $(TOBJ) $(TRES) $(LIBS)
170 "../nt/$(BLD)/addsection" "$(TEMACS_TMP)" "$(TEMACS)" EMHEAP 16 173 "../nt/$(BLD)/addsection" "$(TEMACS_TMP)" "$(TEMACS)" EMHEAP 16
171 echo $(OBJ0) > $(BLD)/buildobj.lst 174 echo $(OBJ0) > $(BLD)/buildobj.lst
@@ -593,6 +596,7 @@ $(BLD)/emacs.$(O) : \
593 $(SRC)/termhooks.h \ 596 $(SRC)/termhooks.h \
594 $(SRC)/w32bdf.h \ 597 $(SRC)/w32bdf.h \
595 $(SRC)/w32gui.h \ 598 $(SRC)/w32gui.h \
599 $(SRC)/w32heap.h \
596 $(SRC)/window.h 600 $(SRC)/window.h
597 601
598$(BLD)/eval.$(O) : \ 602$(BLD)/eval.$(O) : \
@@ -1428,6 +1432,7 @@ $(BLD)/w32select.$(O): \
1428 $(SRC)/systime.h \ 1432 $(SRC)/systime.h \
1429 $(SRC)/w32bdf.h \ 1433 $(SRC)/w32bdf.h \
1430 $(SRC)/w32gui.h \ 1434 $(SRC)/w32gui.h \
1435 $(SRC)/w32heap.h \
1431 $(SRC)/w32term.h 1436 $(SRC)/w32term.h
1432 1437
1433$(BLD)/w32reg.$(O): \ 1438$(BLD)/w32reg.$(O): \
diff --git a/src/process.c b/src/process.c
index 41e46c53dc9..dd13138e273 100644
--- a/src/process.c
+++ b/src/process.c
@@ -272,17 +272,19 @@ int update_tick;
272#define READ_OUTPUT_DELAY_MAX (READ_OUTPUT_DELAY_INCREMENT * 5) 272#define READ_OUTPUT_DELAY_MAX (READ_OUTPUT_DELAY_INCREMENT * 5)
273#define READ_OUTPUT_DELAY_MAX_MAX (READ_OUTPUT_DELAY_INCREMENT * 7) 273#define READ_OUTPUT_DELAY_MAX_MAX (READ_OUTPUT_DELAY_INCREMENT * 7)
274 274
275/* Number of processes which might be delayed. */ 275/* Number of processes which have a non-zero read_output_delay,
276 and therefore might be delayed for adaptive read buffering. */
276 277
277static int process_output_delay_count; 278static int process_output_delay_count;
278 279
279/* Non-zero if any process has non-nil process_output_skip. */ 280/* Non-zero if any process has non-nil read_output_skip. */
280 281
281static int process_output_skip; 282static int process_output_skip;
282 283
283/* Non-nil means to delay reading process output to improve buffering. 284/* Non-nil means to delay reading process output to improve buffering.
284 A value of t means that delay is reset after each send, any other 285 A value of t means that delay is reset after each send, any other
285 non-nil value does not reset the delay. */ 286 non-nil value does not reset the delay. A value of nil disables
287 adaptive read buffering completely. */
286static Lisp_Object Vprocess_adaptive_read_buffering; 288static Lisp_Object Vprocess_adaptive_read_buffering;
287#else 289#else
288#define process_output_delay_count 0 290#define process_output_delay_count 0
@@ -1535,7 +1537,6 @@ usage: (start-process NAME BUFFER PROGRAM &rest PROGRAM-ARGS) */)
1535 1537
1536 XPROCESS (proc)->childp = Qt; 1538 XPROCESS (proc)->childp = Qt;
1537 XPROCESS (proc)->plist = Qnil; 1539 XPROCESS (proc)->plist = Qnil;
1538 XPROCESS (proc)->command_channel_p = Qnil;
1539 XPROCESS (proc)->buffer = buffer; 1540 XPROCESS (proc)->buffer = buffer;
1540 XPROCESS (proc)->sentinel = Qnil; 1541 XPROCESS (proc)->sentinel = Qnil;
1541 XPROCESS (proc)->filter = Qnil; 1542 XPROCESS (proc)->filter = Qnil;
@@ -4319,6 +4320,11 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4319#endif 4320#endif
4320 4321
4321#ifdef ADAPTIVE_READ_BUFFERING 4322#ifdef ADAPTIVE_READ_BUFFERING
4323 /* Set the timeout for adaptive read buffering if any
4324 process has non-nil read_output_skip and non-zero
4325 read_output_delay, and we are not reading output for a
4326 specific wait_channel. It is not executed if
4327 Vprocess_adaptive_read_buffering is nil. */
4322 if (process_output_skip && check_delay > 0) 4328 if (process_output_skip && check_delay > 0)
4323 { 4329 {
4324 int usecs = EMACS_USECS (timeout); 4330 int usecs = EMACS_USECS (timeout);
@@ -4329,6 +4335,8 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4329 proc = chan_process[channel]; 4335 proc = chan_process[channel];
4330 if (NILP (proc)) 4336 if (NILP (proc))
4331 continue; 4337 continue;
4338 /* Find minimum non-zero read_output_delay among the
4339 processes with non-nil read_output_skip. */
4332 if (XINT (XPROCESS (proc)->read_output_delay) > 0) 4340 if (XINT (XPROCESS (proc)->read_output_delay) > 0)
4333 { 4341 {
4334 check_delay--; 4342 check_delay--;
@@ -4879,10 +4887,10 @@ read_process_output (proc, channel)
4879 { 4887 {
4880 Lisp_Object tem; 4888 Lisp_Object tem;
4881 /* Don't clobber the CURRENT match data, either! */ 4889 /* Don't clobber the CURRENT match data, either! */
4882 tem = Fmatch_data (Qnil, Qnil); 4890 tem = Fmatch_data (Qnil, Qnil, Qnil);
4883 restore_match_data (); 4891 restore_search_regs ();
4884 record_unwind_protect (Fset_match_data, Fmatch_data (Qnil, Qnil)); 4892 record_unwind_save_match_data ();
4885 Fset_match_data (tem); 4893 Fset_match_data (tem, Qt);
4886 } 4894 }
4887 4895
4888 /* For speed, if a search happens within this code, 4896 /* For speed, if a search happens within this code,
@@ -4936,7 +4944,7 @@ read_process_output (proc, channel)
4936 read_process_output_error_handler); 4944 read_process_output_error_handler);
4937 4945
4938 /* If we saved the match data nonrecursively, restore it now. */ 4946 /* If we saved the match data nonrecursively, restore it now. */
4939 restore_match_data (); 4947 restore_search_regs ();
4940 running_asynch_code = outer_running_asynch_code; 4948 running_asynch_code = outer_running_asynch_code;
4941 4949
4942 /* Handling the process output should not deactivate the mark. */ 4950 /* Handling the process output should not deactivate the mark. */
@@ -6340,10 +6348,10 @@ exec_sentinel (proc, reason)
6340 if (outer_running_asynch_code) 6348 if (outer_running_asynch_code)
6341 { 6349 {
6342 Lisp_Object tem; 6350 Lisp_Object tem;
6343 tem = Fmatch_data (Qnil, Qnil); 6351 tem = Fmatch_data (Qnil, Qnil, Qnil);
6344 restore_match_data (); 6352 restore_search_regs ();
6345 record_unwind_protect (Fset_match_data, Fmatch_data (Qnil, Qnil)); 6353 record_unwind_save_match_data ();
6346 Fset_match_data (tem); 6354 Fset_match_data (tem, Qt);
6347 } 6355 }
6348 6356
6349 /* For speed, if a search happens within this code, 6357 /* For speed, if a search happens within this code,
@@ -6357,7 +6365,7 @@ exec_sentinel (proc, reason)
6357 exec_sentinel_error_handler); 6365 exec_sentinel_error_handler);
6358 6366
6359 /* If we saved the match data nonrecursively, restore it now. */ 6367 /* If we saved the match data nonrecursively, restore it now. */
6360 restore_match_data (); 6368 restore_search_regs ();
6361 running_asynch_code = outer_running_asynch_code; 6369 running_asynch_code = outer_running_asynch_code;
6362 6370
6363 Vdeactivate_mark = odeactivate; 6371 Vdeactivate_mark = odeactivate;
@@ -6708,7 +6716,7 @@ init_process ()
6708#endif /* HAVE_SOCKETS */ 6716#endif /* HAVE_SOCKETS */
6709 6717
6710#if defined (DARWIN) || defined (MAC_OSX) 6718#if defined (DARWIN) || defined (MAC_OSX)
6711 /* PTYs are broken on Darwin < 6, but are sometimes useful for interactive 6719 /* PTYs are broken on Darwin < 6, but are sometimes useful for interactive
6712 processes. As such, we only change the default value. */ 6720 processes. As such, we only change the default value. */
6713 if (initialized) 6721 if (initialized)
6714 { 6722 {
@@ -6813,7 +6821,7 @@ The value takes effect when `start-process' is called. */);
6813 doc: /* If non-nil, improve receive buffering by delaying after short reads. 6821 doc: /* If non-nil, improve receive buffering by delaying after short reads.
6814On some systems, when Emacs reads the output from a subprocess, the output data 6822On some systems, when Emacs reads the output from a subprocess, the output data
6815is read in very small blocks, potentially resulting in very poor performance. 6823is read in very small blocks, potentially resulting in very poor performance.
6816This behaviour can be remedied to some extent by setting this variable to a 6824This behavior can be remedied to some extent by setting this variable to a
6817non-nil value, as it will automatically delay reading from such processes, to 6825non-nil value, as it will automatically delay reading from such processes, to
6818allowing them to produce more output before Emacs tries to read it. 6826allowing them to produce more output before Emacs tries to read it.
6819If the value is t, the delay is reset after each write to the process; any other 6827If the value is t, the delay is reset after each write to the process; any other
diff --git a/src/process.h b/src/process.h
index 6e2641d6b06..8e3f9028c0b 100644
--- a/src/process.h
+++ b/src/process.h
@@ -52,8 +52,6 @@ struct Lisp_Process
52 Lisp_Object buffer; 52 Lisp_Object buffer;
53 /* Number of this process */ 53 /* Number of this process */
54 Lisp_Object pid; 54 Lisp_Object pid;
55 /* Non-nil if this is really a command channel */
56 Lisp_Object command_channel_p;
57 /* t if this is a real child process. 55 /* t if this is a real child process.
58 For a net connection, it is a plist based on the arguments to make-network-process. */ 56 For a net connection, it is a plist based on the arguments to make-network-process. */
59 Lisp_Object childp; 57 Lisp_Object childp;
@@ -105,7 +103,7 @@ struct Lisp_Process
105 Initialized from `Vprocess_adaptive_read_buffering'. */ 103 Initialized from `Vprocess_adaptive_read_buffering'. */
106 Lisp_Object adaptive_read_buffering; 104 Lisp_Object adaptive_read_buffering;
107 /* Hysteresis to try to read process output in larger blocks. 105 /* Hysteresis to try to read process output in larger blocks.
108 On some systems, e.g. the Linux kernel, emacs is seen as 106 On some systems, e.g. GNU/Linux, Emacs is seen as
109 an interactive app also when reading process output, meaning 107 an interactive app also when reading process output, meaning
110 that process output can be read in as little as 1 byte at a 108 that process output can be read in as little as 1 byte at a
111 time. Value is micro-seconds to delay reading output from 109 time. Value is micro-seconds to delay reading output from
diff --git a/src/s/ms-w32.h b/src/s/ms-w32.h
index 709b32f1452..998c1f7cf05 100644
--- a/src/s/ms-w32.h
+++ b/src/s/ms-w32.h
@@ -354,7 +354,9 @@ Boston, MA 02111-1307, USA. */
354#define fcloseall _fcloseall 354#define fcloseall _fcloseall
355#define fdopen _fdopen 355#define fdopen _fdopen
356#define fgetchar _fgetchar 356#define fgetchar _fgetchar
357#ifndef fileno
357#define fileno _fileno 358#define fileno _fileno
359#endif
358#define flushall _flushall 360#define flushall _flushall
359#define fputchar _fputchar 361#define fputchar _fputchar
360#define fsync _commit 362#define fsync _commit
diff --git a/src/search.c b/src/search.c
index 73ec3a78e58..c1f2fd77cec 100644
--- a/src/search.c
+++ b/src/search.c
@@ -2739,7 +2739,7 @@ Zero means the entire text matched by the whole regexp or whole string. */)
2739 return match_limit (subexp, 0); 2739 return match_limit (subexp, 0);
2740} 2740}
2741 2741
2742DEFUN ("match-data", Fmatch_data, Smatch_data, 0, 2, 0, 2742DEFUN ("match-data", Fmatch_data, Smatch_data, 0, 3, 0,
2743 doc: /* Return a list containing all info on what the last search matched. 2743 doc: /* Return a list containing all info on what the last search matched.
2744Element 2N is `(match-beginning N)'; element 2N + 1 is `(match-end N)'. 2744Element 2N is `(match-beginning N)'; element 2N + 1 is `(match-end N)'.
2745All the elements are markers or nil (nil if the Nth pair didn't match) 2745All the elements are markers or nil (nil if the Nth pair didn't match)
@@ -2751,17 +2751,35 @@ integers \(rather than markers) to represent buffer positions. In
2751this case, and if the last match was in a buffer, the buffer will get 2751this case, and if the last match was in a buffer, the buffer will get
2752stored as one additional element at the end of the list. 2752stored as one additional element at the end of the list.
2753 2753
2754If REUSE is a list, reuse it as part of the value. If REUSE is long enough 2754If REUSE is a list, reuse it as part of the value. If REUSE is long
2755to hold all the values, and if INTEGERS is non-nil, no consing is done. 2755enough to hold all the values, and if INTEGERS is non-nil, no consing
2756is done.
2757
2758If optional third arg RESEAT is non-nil, any previous markers on the
2759REUSE list will be modified to point to nowhere.
2760
2761If RESEAT is `evaporate', put markers back on the free list.
2762Note: No other references to the markers must exist if you use this.
2756 2763
2757Return value is undefined if the last search failed. */) 2764Return value is undefined if the last search failed. */)
2758 (integers, reuse) 2765 (integers, reuse, reseat)
2759 Lisp_Object integers, reuse; 2766 Lisp_Object integers, reuse, reseat;
2760{ 2767{
2761 Lisp_Object tail, prev; 2768 Lisp_Object tail, prev;
2762 Lisp_Object *data; 2769 Lisp_Object *data;
2763 int i, len; 2770 int i, len;
2764 2771
2772 if (!NILP (reseat))
2773 for (tail = reuse; CONSP (tail); tail = XCDR (tail))
2774 if (MARKERP (XCAR (tail)))
2775 {
2776 if (EQ (reseat, Qevaporate))
2777 free_marker (XCAR (tail));
2778 else
2779 unchain_marker (XMARKER (XCAR (tail)));
2780 XSETCAR (tail, Qnil);
2781 }
2782
2765 if (NILP (last_thing_searched)) 2783 if (NILP (last_thing_searched))
2766 return Qnil; 2784 return Qnil;
2767 2785
@@ -2797,10 +2815,10 @@ Return value is undefined if the last search failed. */)
2797 /* last_thing_searched must always be Qt, a buffer, or Qnil. */ 2815 /* last_thing_searched must always be Qt, a buffer, or Qnil. */
2798 abort (); 2816 abort ();
2799 2817
2800 len = 2*(i+1); 2818 len = 2 * i + 2;
2801 } 2819 }
2802 else 2820 else
2803 data[2 * i] = data [2 * i + 1] = Qnil; 2821 data[2 * i] = data[2 * i + 1] = Qnil;
2804 } 2822 }
2805 2823
2806 if (BUFFERP (last_thing_searched) && !NILP (integers)) 2824 if (BUFFERP (last_thing_searched) && !NILP (integers))
@@ -2834,11 +2852,15 @@ Return value is undefined if the last search failed. */)
2834} 2852}
2835 2853
2836 2854
2837DEFUN ("set-match-data", Fset_match_data, Sset_match_data, 1, 1, 0, 2855DEFUN ("set-match-data", Fset_match_data, Sset_match_data, 1, 2, 0,
2838 doc: /* Set internal data on last search match from elements of LIST. 2856 doc: /* Set internal data on last search match from elements of LIST.
2839LIST should have been created by calling `match-data' previously. */) 2857LIST should have been created by calling `match-data' previously.
2840 (list) 2858
2841 register Lisp_Object list; 2859If optional arg RESEAT is non-nil, make markers on LIST point nowhere.
2860If RESEAT is `evaporate', put the markers back on the free list.
2861Note: No other references to the markers must exist if you use this. */)
2862 (list, reseat)
2863 register Lisp_Object list, reseat;
2842{ 2864{
2843 register int i; 2865 register int i;
2844 register Lisp_Object marker; 2866 register Lisp_Object marker;
@@ -2882,9 +2904,9 @@ LIST should have been created by calling `match-data' previously. */)
2882 search_regs.num_regs = length; 2904 search_regs.num_regs = length;
2883 } 2905 }
2884 2906
2885 for (i = 0;; i++) 2907 for (i = 0; CONSP (list); i++)
2886 { 2908 {
2887 marker = Fcar (list); 2909 marker = XCAR (list);
2888 if (BUFFERP (marker)) 2910 if (BUFFERP (marker))
2889 { 2911 {
2890 last_thing_searched = marker; 2912 last_thing_searched = marker;
@@ -2895,12 +2917,14 @@ LIST should have been created by calling `match-data' previously. */)
2895 if (NILP (marker)) 2917 if (NILP (marker))
2896 { 2918 {
2897 search_regs.start[i] = -1; 2919 search_regs.start[i] = -1;
2898 list = Fcdr (list); 2920 list = XCDR (list);
2899 } 2921 }
2900 else 2922 else
2901 { 2923 {
2902 int from; 2924 int from;
2925 Lisp_Object m;
2903 2926
2927 m = marker;
2904 if (MARKERP (marker)) 2928 if (MARKERP (marker))
2905 { 2929 {
2906 if (XMARKER (marker)->buffer == 0) 2930 if (XMARKER (marker)->buffer == 0)
@@ -2911,17 +2935,38 @@ LIST should have been created by calling `match-data' previously. */)
2911 2935
2912 CHECK_NUMBER_COERCE_MARKER (marker); 2936 CHECK_NUMBER_COERCE_MARKER (marker);
2913 from = XINT (marker); 2937 from = XINT (marker);
2914 list = Fcdr (list);
2915 2938
2916 marker = Fcar (list); 2939 if (!NILP (reseat) && MARKERP (m))
2940 {
2941 if (EQ (reseat, Qevaporate))
2942 free_marker (m);
2943 else
2944 unchain_marker (XMARKER (m));
2945 XSETCAR (list, Qnil);
2946 }
2947
2948 if ((list = XCDR (list), !CONSP (list)))
2949 break;
2950
2951 m = marker = XCAR (list);
2952
2917 if (MARKERP (marker) && XMARKER (marker)->buffer == 0) 2953 if (MARKERP (marker) && XMARKER (marker)->buffer == 0)
2918 XSETFASTINT (marker, 0); 2954 XSETFASTINT (marker, 0);
2919 2955
2920 CHECK_NUMBER_COERCE_MARKER (marker); 2956 CHECK_NUMBER_COERCE_MARKER (marker);
2921 search_regs.start[i] = from; 2957 search_regs.start[i] = from;
2922 search_regs.end[i] = XINT (marker); 2958 search_regs.end[i] = XINT (marker);
2959
2960 if (!NILP (reseat) && MARKERP (m))
2961 {
2962 if (EQ (reseat, Qevaporate))
2963 free_marker (m);
2964 else
2965 unchain_marker (XMARKER (m));
2966 XSETCAR (list, Qnil);
2967 }
2923 } 2968 }
2924 list = Fcdr (list); 2969 list = XCDR (list);
2925 } 2970 }
2926 2971
2927 for (; i < search_regs.num_regs; i++) 2972 for (; i < search_regs.num_regs; i++)
@@ -2959,7 +3004,7 @@ save_search_regs ()
2959 3004
2960/* Called upon exit from filters and sentinels. */ 3005/* Called upon exit from filters and sentinels. */
2961void 3006void
2962restore_match_data () 3007restore_search_regs ()
2963{ 3008{
2964 if (search_regs_saved) 3009 if (search_regs_saved)
2965 { 3010 {
@@ -2977,6 +3022,21 @@ restore_match_data ()
2977 } 3022 }
2978} 3023}
2979 3024
3025static Lisp_Object
3026unwind_set_match_data (list)
3027 Lisp_Object list;
3028{
3029 return Fset_match_data (list, Qevaporate);
3030}
3031
3032/* Called to unwind protect the match data. */
3033void
3034record_unwind_save_match_data ()
3035{
3036 record_unwind_protect (unwind_set_match_data,
3037 Fmatch_data (Qnil, Qnil, Qnil));
3038}
3039
2980/* Quote a string to inactivate reg-expr chars */ 3040/* Quote a string to inactivate reg-expr chars */
2981 3041
2982DEFUN ("regexp-quote", Fregexp_quote, Sregexp_quote, 1, 1, 0, 3042DEFUN ("regexp-quote", Fregexp_quote, Sregexp_quote, 1, 1, 0,
diff --git a/src/unexmacosx.c b/src/unexmacosx.c
index e54dbea448c..1a2c211a09d 100644
--- a/src/unexmacosx.c
+++ b/src/unexmacosx.c
@@ -695,6 +695,7 @@ copy_data_segment (struct load_command *lc)
695 } 695 }
696 else if (strncmp (sectp->sectname, "__la_symbol_ptr", 16) == 0 696 else if (strncmp (sectp->sectname, "__la_symbol_ptr", 16) == 0
697 || strncmp (sectp->sectname, "__nl_symbol_ptr", 16) == 0 697 || strncmp (sectp->sectname, "__nl_symbol_ptr", 16) == 0
698 || strncmp (sectp->sectname, "__la_sym_ptr2", 16) == 0
698 || strncmp (sectp->sectname, "__dyld", 16) == 0 699 || strncmp (sectp->sectname, "__dyld", 16) == 0
699 || strncmp (sectp->sectname, "__const", 16) == 0 700 || strncmp (sectp->sectname, "__const", 16) == 0
700 || strncmp (sectp->sectname, "__cfstring", 16) == 0) 701 || strncmp (sectp->sectname, "__cfstring", 16) == 0)
diff --git a/src/unexw32.c b/src/unexw32.c
index b1838644965..ebeb7355673 100644
--- a/src/unexw32.c
+++ b/src/unexw32.c
@@ -1,5 +1,5 @@
1/* unexec for GNU Emacs on Windows NT. 1/* unexec for GNU Emacs on Windows NT.
2 Copyright (C) 1994 Free Software Foundation, Inc. 2 Copyright (C) 1994, 2005 Free Software Foundation, Inc.
3 3
4This file is part of GNU Emacs. 4This file is part of GNU Emacs.
5 5
@@ -325,6 +325,9 @@ relocate_offset (DWORD offset,
325/* Convert address in executing image to RVA. */ 325/* Convert address in executing image to RVA. */
326#define PTR_TO_RVA(ptr) ((DWORD)(ptr) - (DWORD) GetModuleHandle (NULL)) 326#define PTR_TO_RVA(ptr) ((DWORD)(ptr) - (DWORD) GetModuleHandle (NULL))
327 327
328#define RVA_TO_PTR(var,section,filedata) \
329 ((void *)(RVA_TO_OFFSET(var,section) + (filedata).file_base))
330
328#define PTR_TO_OFFSET(ptr, pfile_data) \ 331#define PTR_TO_OFFSET(ptr, pfile_data) \
329 ((unsigned char *)(ptr) - (pfile_data)->file_base) 332 ((unsigned char *)(ptr) - (pfile_data)->file_base)
330 333
@@ -488,27 +491,34 @@ copy_executable_and_dump_data (file_data *p_infile,
488 PIMAGE_SECTION_HEADER dst_section; 491 PIMAGE_SECTION_HEADER dst_section;
489 DWORD offset; 492 DWORD offset;
490 int i; 493 int i;
494 int be_verbose = GetEnvironmentVariable ("DEBUG_DUMP", NULL, 0) > 0;
491 495
492#define COPY_CHUNK(message, src, size) \ 496#define COPY_CHUNK(message, src, size, verbose) \
493 do { \ 497 do { \
494 unsigned char *s = (void *)(src); \ 498 unsigned char *s = (void *)(src); \
495 unsigned long count = (size); \ 499 unsigned long count = (size); \
496 printf ("%s\n", (message)); \ 500 if (verbose) \
497 printf ("\t0x%08x Offset in input file.\n", s - p_infile->file_base); \ 501 { \
498 printf ("\t0x%08x Offset in output file.\n", dst - p_outfile->file_base); \ 502 printf ("%s\n", (message)); \
499 printf ("\t0x%08x Size in bytes.\n", count); \ 503 printf ("\t0x%08x Offset in input file.\n", s - p_infile->file_base); \
504 printf ("\t0x%08x Offset in output file.\n", dst - p_outfile->file_base); \
505 printf ("\t0x%08x Size in bytes.\n", count); \
506 } \
500 memcpy (dst, s, count); \ 507 memcpy (dst, s, count); \
501 dst += count; \ 508 dst += count; \
502 } while (0) 509 } while (0)
503 510
504#define COPY_PROC_CHUNK(message, src, size) \ 511#define COPY_PROC_CHUNK(message, src, size, verbose) \
505 do { \ 512 do { \
506 unsigned char *s = (void *)(src); \ 513 unsigned char *s = (void *)(src); \
507 unsigned long count = (size); \ 514 unsigned long count = (size); \
508 printf ("%s\n", (message)); \ 515 if (verbose) \
509 printf ("\t0x%08x Address in process.\n", s); \ 516 { \
510 printf ("\t0x%08x Offset in output file.\n", dst - p_outfile->file_base); \ 517 printf ("%s\n", (message)); \
511 printf ("\t0x%08x Size in bytes.\n", count); \ 518 printf ("\t0x%08x Address in process.\n", s); \
519 printf ("\t0x%08x Offset in output file.\n", dst - p_outfile->file_base); \
520 printf ("\t0x%08x Size in bytes.\n", count); \
521 } \
512 memcpy (dst, s, count); \ 522 memcpy (dst, s, count); \
513 dst += count; \ 523 dst += count; \
514 } while (0) 524 } while (0)
@@ -539,13 +549,14 @@ copy_executable_and_dump_data (file_data *p_infile,
539 dst = (unsigned char *) p_outfile->file_base; 549 dst = (unsigned char *) p_outfile->file_base;
540 550
541 COPY_CHUNK ("Copying DOS header...", dos_header, 551 COPY_CHUNK ("Copying DOS header...", dos_header,
542 (DWORD) nt_header - (DWORD) dos_header); 552 (DWORD) nt_header - (DWORD) dos_header, be_verbose);
543 dst_nt_header = (PIMAGE_NT_HEADERS) dst; 553 dst_nt_header = (PIMAGE_NT_HEADERS) dst;
544 COPY_CHUNK ("Copying NT header...", nt_header, 554 COPY_CHUNK ("Copying NT header...", nt_header,
545 (DWORD) section - (DWORD) nt_header); 555 (DWORD) section - (DWORD) nt_header, be_verbose);
546 dst_section = (PIMAGE_SECTION_HEADER) dst; 556 dst_section = (PIMAGE_SECTION_HEADER) dst;
547 COPY_CHUNK ("Copying section table...", section, 557 COPY_CHUNK ("Copying section table...", section,
548 nt_header->FileHeader.NumberOfSections * sizeof (*section)); 558 nt_header->FileHeader.NumberOfSections * sizeof (*section),
559 be_verbose);
549 560
550 /* Align the first section's raw data area, and set the header size 561 /* Align the first section's raw data area, and set the header size
551 field accordingly. */ 562 field accordingly. */
@@ -555,7 +566,9 @@ copy_executable_and_dump_data (file_data *p_infile,
555 for (i = 0; i < nt_header->FileHeader.NumberOfSections; i++) 566 for (i = 0; i < nt_header->FileHeader.NumberOfSections; i++)
556 { 567 {
557 char msg[100]; 568 char msg[100];
558 sprintf (msg, "Copying raw data for %s...", section->Name); 569 /* Windows section names are fixed 8-char strings, only
570 zero-terminated if the name is shorter than 8 characters. */
571 sprintf (msg, "Copying raw data for %.8s...", section->Name);
559 572
560 dst_save = dst; 573 dst_save = dst;
561 574
@@ -568,7 +581,7 @@ copy_executable_and_dump_data (file_data *p_infile,
568 /* Can always copy the original raw data. */ 581 /* Can always copy the original raw data. */
569 COPY_CHUNK 582 COPY_CHUNK
570 (msg, OFFSET_TO_PTR (section->PointerToRawData, p_infile), 583 (msg, OFFSET_TO_PTR (section->PointerToRawData, p_infile),
571 section->SizeOfRawData); 584 section->SizeOfRawData, be_verbose);
572 /* Ensure alignment slop is zeroed. */ 585 /* Ensure alignment slop is zeroed. */
573 ROUND_UP_DST_AND_ZERO (dst_nt_header->OptionalHeader.FileAlignment); 586 ROUND_UP_DST_AND_ZERO (dst_nt_header->OptionalHeader.FileAlignment);
574 587
@@ -577,7 +590,8 @@ copy_executable_and_dump_data (file_data *p_infile,
577 { 590 {
578 dst = dst_save 591 dst = dst_save
579 + RVA_TO_SECTION_OFFSET (PTR_TO_RVA (data_start), dst_section); 592 + RVA_TO_SECTION_OFFSET (PTR_TO_RVA (data_start), dst_section);
580 COPY_PROC_CHUNK ("Dumping initialized data...", data_start, data_size); 593 COPY_PROC_CHUNK ("Dumping initialized data...",
594 data_start, data_size, be_verbose);
581 dst = dst_save + dst_section->SizeOfRawData; 595 dst = dst_save + dst_section->SizeOfRawData;
582 } 596 }
583 if (section == bss_section) 597 if (section == bss_section)
@@ -586,7 +600,8 @@ copy_executable_and_dump_data (file_data *p_infile,
586 data size as necessary. */ 600 data size as necessary. */
587 dst = dst_save 601 dst = dst_save
588 + RVA_TO_SECTION_OFFSET (PTR_TO_RVA (bss_start), dst_section); 602 + RVA_TO_SECTION_OFFSET (PTR_TO_RVA (bss_start), dst_section);
589 COPY_PROC_CHUNK ("Dumping bss data...", bss_start, bss_size); 603 COPY_PROC_CHUNK ("Dumping bss data...", bss_start,
604 bss_size, be_verbose);
590 ROUND_UP_DST (dst_nt_header->OptionalHeader.FileAlignment); 605 ROUND_UP_DST (dst_nt_header->OptionalHeader.FileAlignment);
591 dst_section->PointerToRawData = PTR_TO_OFFSET (dst_save, p_outfile); 606 dst_section->PointerToRawData = PTR_TO_OFFSET (dst_save, p_outfile);
592 /* Determine new size of raw data area. */ 607 /* Determine new size of raw data area. */
@@ -601,7 +616,8 @@ copy_executable_and_dump_data (file_data *p_infile,
601 section's raw data size as necessary. */ 616 section's raw data size as necessary. */
602 dst = dst_save 617 dst = dst_save
603 + RVA_TO_SECTION_OFFSET (PTR_TO_RVA (bss_start_static), dst_section); 618 + RVA_TO_SECTION_OFFSET (PTR_TO_RVA (bss_start_static), dst_section);
604 COPY_PROC_CHUNK ("Dumping static bss data...", bss_start_static, bss_size_static); 619 COPY_PROC_CHUNK ("Dumping static bss data...", bss_start_static,
620 bss_size_static, be_verbose);
605 ROUND_UP_DST (dst_nt_header->OptionalHeader.FileAlignment); 621 ROUND_UP_DST (dst_nt_header->OptionalHeader.FileAlignment);
606 dst_section->PointerToRawData = PTR_TO_OFFSET (dst_save, p_outfile); 622 dst_section->PointerToRawData = PTR_TO_OFFSET (dst_save, p_outfile);
607 /* Determine new size of raw data area. */ 623 /* Determine new size of raw data area. */
@@ -619,7 +635,8 @@ copy_executable_and_dump_data (file_data *p_infile,
619 section's size to the appropriate size. */ 635 section's size to the appropriate size. */
620 dst = dst_save 636 dst = dst_save
621 + RVA_TO_SECTION_OFFSET (PTR_TO_RVA (heap_start), dst_section); 637 + RVA_TO_SECTION_OFFSET (PTR_TO_RVA (heap_start), dst_section);
622 COPY_PROC_CHUNK ("Dumping heap...", heap_start, heap_size); 638 COPY_PROC_CHUNK ("Dumping heap...", heap_start, heap_size,
639 be_verbose);
623 ROUND_UP_DST (dst_nt_header->OptionalHeader.FileAlignment); 640 ROUND_UP_DST (dst_nt_header->OptionalHeader.FileAlignment);
624 dst_section->PointerToRawData = PTR_TO_OFFSET (dst_save, p_outfile); 641 dst_section->PointerToRawData = PTR_TO_OFFSET (dst_save, p_outfile);
625 /* Determine new size of raw data area. */ 642 /* Determine new size of raw data area. */
@@ -654,7 +671,7 @@ copy_executable_and_dump_data (file_data *p_infile,
654 COPY_CHUNK 671 COPY_CHUNK
655 ("Copying remainder of executable...", 672 ("Copying remainder of executable...",
656 OFFSET_TO_PTR (offset, p_infile), 673 OFFSET_TO_PTR (offset, p_infile),
657 p_infile->size - offset); 674 p_infile->size - offset, be_verbose);
658 675
659 /* Final size for new image. */ 676 /* Final size for new image. */
660 p_outfile->size = DST_TO_OFFSET (); 677 p_outfile->size = DST_TO_OFFSET ();
diff --git a/src/w32.c b/src/w32.c
index cdc41a8c772..1bb4a91ff03 100644
--- a/src/w32.c
+++ b/src/w32.c
@@ -1273,7 +1273,7 @@ get_emacs_configuration_options (void)
1273void 1273void
1274gettimeofday (struct timeval *tv, struct timezone *tz) 1274gettimeofday (struct timeval *tv, struct timezone *tz)
1275{ 1275{
1276 struct timeb tb; 1276 struct _timeb tb;
1277 _ftime (&tb); 1277 _ftime (&tb);
1278 1278
1279 tv->tv_sec = tb.time; 1279 tv->tv_sec = tb.time;
@@ -1777,7 +1777,7 @@ open_unc_volume (const char *path)
1777 nr.dwDisplayType = RESOURCEDISPLAYTYPE_SERVER; 1777 nr.dwDisplayType = RESOURCEDISPLAYTYPE_SERVER;
1778 nr.dwUsage = RESOURCEUSAGE_CONTAINER; 1778 nr.dwUsage = RESOURCEUSAGE_CONTAINER;
1779 nr.lpLocalName = NULL; 1779 nr.lpLocalName = NULL;
1780 nr.lpRemoteName = map_w32_filename (path, NULL); 1780 nr.lpRemoteName = (LPSTR)map_w32_filename (path, NULL);
1781 nr.lpComment = NULL; 1781 nr.lpComment = NULL;
1782 nr.lpProvider = NULL; 1782 nr.lpProvider = NULL;
1783 1783
@@ -3207,7 +3207,7 @@ sys_shutdown (int s, int how)
3207} 3207}
3208 3208
3209int 3209int
3210sys_setsockopt (int s, int level, int optname, const char * optval, int optlen) 3210sys_setsockopt (int s, int level, int optname, const void * optval, int optlen)
3211{ 3211{
3212 if (winsock_lib == NULL) 3212 if (winsock_lib == NULL)
3213 { 3213 {
@@ -3219,7 +3219,7 @@ sys_setsockopt (int s, int level, int optname, const char * optval, int optlen)
3219 if (fd_info[s].flags & FILE_SOCKET) 3219 if (fd_info[s].flags & FILE_SOCKET)
3220 { 3220 {
3221 int rc = pfn_setsockopt (SOCK_HANDLE (s), level, optname, 3221 int rc = pfn_setsockopt (SOCK_HANDLE (s), level, optname,
3222 optval, optlen); 3222 (const char *)optval, optlen);
3223 if (rc == SOCKET_ERROR) 3223 if (rc == SOCKET_ERROR)
3224 set_errno (); 3224 set_errno ();
3225 return rc; 3225 return rc;
diff --git a/src/w32bdf.c b/src/w32bdf.c
index 092aff306dc..8d57cbd3523 100644
--- a/src/w32bdf.c
+++ b/src/w32bdf.c
@@ -604,7 +604,7 @@ create_offscreen_bitmap(HDC hdc, int width, int height, unsigned char **bitsp)
604 info.c[1].rgbRed = info.c[1].rgbGreen = info.c[1].rgbBlue = 255; 604 info.c[1].rgbRed = info.c[1].rgbGreen = info.c[1].rgbBlue = 255;
605 605
606 return CreateDIBSection(hdc, (LPBITMAPINFO)&info, 606 return CreateDIBSection(hdc, (LPBITMAPINFO)&info,
607 DIB_RGB_COLORS, bitsp, NULL, 0); 607 DIB_RGB_COLORS, (void **)bitsp, NULL, 0);
608} 608}
609 609
610glyph_metric * 610glyph_metric *
diff --git a/src/w32fns.c b/src/w32fns.c
index b7115601553..6a2f98c4c7d 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -7759,6 +7759,19 @@ file_dialog_callback (hwnd, msg, wParam, lParam)
7759 return 0; 7759 return 0;
7760} 7760}
7761 7761
7762/* Since we compile with _WIN32_WINNT set to 0x0400 (for NT4 compatibility)
7763 we end up with the old file dialogs. Define a big enough struct for the
7764 new dialog to trick GetOpenFileName into giving us the new dialogs on
7765 Windows 2000 and XP. */
7766typedef struct
7767{
7768 OPENFILENAME real_details;
7769 void * pReserved;
7770 DWORD dwReserved;
7771 DWORD FlagsEx;
7772} NEWOPENFILENAME;
7773
7774
7762DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 5, 0, 7775DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 5, 0,
7763 doc: /* Read file name, prompting with PROMPT in directory DIR. 7776 doc: /* Read file name, prompting with PROMPT in directory DIR.
7764Use a file selection dialog. 7777Use a file selection dialog.
@@ -7807,39 +7820,58 @@ If ONLY-DIR-P is non-nil, the user can only select directories. */)
7807 filename[0] = '\0'; 7820 filename[0] = '\0';
7808 7821
7809 { 7822 {
7810 OPENFILENAME file_details; 7823 NEWOPENFILENAME new_file_details;
7811 7824 BOOL file_opened = FALSE;
7825 OPENFILENAME * file_details = &new_file_details.real_details;
7826
7812 /* Prevent redisplay. */ 7827 /* Prevent redisplay. */
7813 specbind (Qinhibit_redisplay, Qt); 7828 specbind (Qinhibit_redisplay, Qt);
7814 BLOCK_INPUT; 7829 BLOCK_INPUT;
7815 7830
7816 bzero (&file_details, sizeof (file_details)); 7831 bzero (&new_file_details, sizeof (new_file_details));
7817 file_details.lStructSize = sizeof (file_details); 7832 /* Apparently NT4 crashes if you give it an unexpected size.
7818 file_details.hwndOwner = FRAME_W32_WINDOW (f); 7833 I'm not sure about Windows 9x, so play it safe. */
7834 if (w32_major_version > 4 && w32_major_version < 95)
7835 file_details->lStructSize = sizeof (new_file_details);
7836 else
7837 file_details->lStructSize = sizeof (file_details);
7838
7839 file_details->hwndOwner = FRAME_W32_WINDOW (f);
7819 /* Undocumented Bug in Common File Dialog: 7840 /* Undocumented Bug in Common File Dialog:
7820 If a filter is not specified, shell links are not resolved. */ 7841 If a filter is not specified, shell links are not resolved. */
7821 file_details.lpstrFilter = "All Files (*.*)\0*.*\0Directories\0*|*\0\0"; 7842 file_details->lpstrFilter = "All Files (*.*)\0*.*\0Directories\0*|*\0\0";
7822 file_details.lpstrFile = filename; 7843 file_details->lpstrFile = filename;
7823 file_details.nMaxFile = sizeof (filename); 7844 file_details->nMaxFile = sizeof (filename);
7824 file_details.lpstrInitialDir = init_dir; 7845 file_details->lpstrInitialDir = init_dir;
7825 file_details.lpstrTitle = SDATA (prompt); 7846 file_details->lpstrTitle = SDATA (prompt);
7826 7847
7827 if (! NILP (only_dir_p)) 7848 if (! NILP (only_dir_p))
7828 default_filter_index = 2; 7849 default_filter_index = 2;
7829 7850
7830 file_details.nFilterIndex = default_filter_index; 7851 file_details->nFilterIndex = default_filter_index;
7831 7852
7832 file_details.Flags = (OFN_HIDEREADONLY | OFN_NOCHANGEDIR 7853 file_details->Flags = (OFN_HIDEREADONLY | OFN_NOCHANGEDIR
7833 | OFN_EXPLORER | OFN_ENABLEHOOK); 7854 | OFN_EXPLORER | OFN_ENABLEHOOK);
7834 if (!NILP (mustmatch)) 7855 if (!NILP (mustmatch))
7835 file_details.Flags |= OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST; 7856 {
7857 /* Require that the path to the parent directory exists. */
7858 file_details->Flags |= OFN_PATHMUSTEXIST;
7859 /* If we are looking for a file, require that it exists. */
7860 if (NILP (only_dir_p))
7861 file_details->Flags |= OFN_FILEMUSTEXIST;
7862 }
7863
7864 file_details->lpfnHook = (LPOFNHOOKPROC) file_dialog_callback;
7836 7865
7837 file_details.lpfnHook = (LPOFNHOOKPROC) file_dialog_callback; 7866 file_opened = GetOpenFileName (file_details);
7838 7867
7839 if (GetOpenFileName (&file_details)) 7868 UNBLOCK_INPUT;
7869
7870 if (file_opened)
7840 { 7871 {
7841 dostounix_filename (filename); 7872 dostounix_filename (filename);
7842 if (file_details.nFilterIndex == 2) 7873
7874 if (file_details->nFilterIndex == 2)
7843 { 7875 {
7844 /* "Directories" selected - strip dummy file name. */ 7876 /* "Directories" selected - strip dummy file name. */
7845 char * last = strrchr (filename, '/'); 7877 char * last = strrchr (filename, '/');
@@ -7857,7 +7889,6 @@ If ONLY-DIR-P is non-nil, the user can only select directories. */)
7857 dir, mustmatch, dir, Qfile_name_history, 7889 dir, mustmatch, dir, Qfile_name_history,
7858 default_filename, Qnil); 7890 default_filename, Qnil);
7859 7891
7860 UNBLOCK_INPUT;
7861 file = unbind_to (count, file); 7892 file = unbind_to (count, file);
7862 } 7893 }
7863 7894
@@ -8698,7 +8729,7 @@ fontsets are automatically created. */);
8698 DEFVAR_BOOL ("w32-strict-painting", 8729 DEFVAR_BOOL ("w32-strict-painting",
8699 &w32_strict_painting, 8730 &w32_strict_painting,
8700 doc: /* Non-nil means use strict rules for repainting frames. 8731 doc: /* Non-nil means use strict rules for repainting frames.
8701Set this to nil to get the old behaviour for repainting; this should 8732Set this to nil to get the old behavior for repainting; this should
8702only be necessary if the default setting causes problems. */); 8733only be necessary if the default setting causes problems. */);
8703 w32_strict_painting = 1; 8734 w32_strict_painting = 1;
8704 8735
@@ -8890,24 +8921,25 @@ void globals_of_w32fns ()
8890 8921
8891#undef abort 8922#undef abort
8892 8923
8924void w32_abort (void) NO_RETURN;
8925
8893void 8926void
8894w32_abort() 8927w32_abort()
8895{ 8928{
8896 int button; 8929 int button;
8897 button = MessageBox (NULL, 8930 button = MessageBox (NULL,
8898 "A fatal error has occurred!\n\n" 8931 "A fatal error has occurred!\n\n"
8899 "Select Abort to exit, Retry to debug, Ignore to continue", 8932 "Would you like to attach a debugger?\n\n"
8933 "Select YES to debug, NO to abort Emacs",
8900 "Emacs Abort Dialog", 8934 "Emacs Abort Dialog",
8901 MB_ICONEXCLAMATION | MB_TASKMODAL 8935 MB_ICONEXCLAMATION | MB_TASKMODAL
8902 | MB_SETFOREGROUND | MB_ABORTRETRYIGNORE); 8936 | MB_SETFOREGROUND | MB_YESNO);
8903 switch (button) 8937 switch (button)
8904 { 8938 {
8905 case IDRETRY: 8939 case IDYES:
8906 DebugBreak (); 8940 DebugBreak ();
8907 break; 8941 exit (2); /* tell the compiler we will never return */
8908 case IDIGNORE: 8942 case IDNO:
8909 break;
8910 case IDABORT:
8911 default: 8943 default:
8912 abort (); 8944 abort ();
8913 break; 8945 break;
diff --git a/src/w32heap.c b/src/w32heap.c
index d947842474f..4c28718a510 100644
--- a/src/w32heap.c
+++ b/src/w32heap.c
@@ -31,7 +31,6 @@ Boston, MA 02111-1307, USA.
31#include "w32heap.h" 31#include "w32heap.h"
32#include "lisp.h" /* for VALMASK */ 32#include "lisp.h" /* for VALMASK */
33 33
34#undef RVA_TO_PTR
35#define RVA_TO_PTR(rva) ((unsigned char *)((DWORD)(rva) + (DWORD)GetModuleHandle (NULL))) 34#define RVA_TO_PTR(rva) ((unsigned char *)((DWORD)(rva) + (DWORD)GetModuleHandle (NULL)))
36 35
37/* This gives us the page size and the size of the allocation unit on NT. */ 36/* This gives us the page size and the size of the allocation unit on NT. */
diff --git a/src/w32heap.h b/src/w32heap.h
index 7fdf952683c..556c7fb28b4 100644
--- a/src/w32heap.h
+++ b/src/w32heap.h
@@ -82,15 +82,6 @@ typedef struct file_data {
82 unsigned char *file_base; 82 unsigned char *file_base;
83} file_data; 83} file_data;
84 84
85#define OFFSET_TO_RVA(var,section) \
86 (section->VirtualAddress + ((DWORD)(var) - section->PointerToRawData))
87
88#define RVA_TO_OFFSET(var,section) \
89 (section->PointerToRawData + ((DWORD)(var) - section->VirtualAddress))
90
91#define RVA_TO_PTR(var,section,filedata) \
92 ((void *)(RVA_TO_OFFSET(var,section) + (filedata).file_base))
93
94int open_input_file (file_data *p_file, char *name); 85int open_input_file (file_data *p_file, char *name);
95int open_output_file (file_data *p_file, char *name, unsigned long size); 86int open_output_file (file_data *p_file, char *name, unsigned long size);
96void close_file_data (file_data *p_file); 87void close_file_data (file_data *p_file);
diff --git a/src/w32menu.c b/src/w32menu.c
index 8a90eae7ec7..c5af0aae980 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -1443,7 +1443,8 @@ set_frame_menubar (f, first_time, deep_p)
1443 because it is not reentrant. */ 1443 because it is not reentrant. */
1444 specbind (Qdebug_on_next_call, Qnil); 1444 specbind (Qdebug_on_next_call, Qnil);
1445 1445
1446 record_unwind_protect (Fset_match_data, Fmatch_data (Qnil, Qnil)); 1446 record_unwind_save_match_data ();
1447
1447 if (NILP (Voverriding_local_map_menu_flag)) 1448 if (NILP (Voverriding_local_map_menu_flag))
1448 { 1449 {
1449 specbind (Qoverriding_terminal_local_map, Qnil); 1450 specbind (Qoverriding_terminal_local_map, Qnil);
diff --git a/src/w32proc.c b/src/w32proc.c
index 9abee2bf0c2..48b5e2c14a3 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -57,6 +57,11 @@ extern BOOL WINAPI IsValidLocale(LCID, DWORD);
57#include "syssignal.h" 57#include "syssignal.h"
58#include "w32term.h" 58#include "w32term.h"
59 59
60#define RVA_TO_PTR(var,section,filedata) \
61 ((void *)((section)->PointerToRawData \
62 + ((DWORD)(var) - (section)->VirtualAddress) \
63 + (filedata).file_base))
64
60/* Control whether spawnve quotes arguments as necessary to ensure 65/* Control whether spawnve quotes arguments as necessary to ensure
61 correct parsing by child process. Because not all uses of spawnve 66 correct parsing by child process. Because not all uses of spawnve
62 are careful about constructing argv arrays, we make this behaviour 67 are careful about constructing argv arrays, we make this behaviour
diff --git a/src/w32term.c b/src/w32term.c
index 403cec7db7e..57f27d70e4d 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -87,6 +87,10 @@ static int any_help_event_p;
87/* Last window where we saw the mouse. Used by mouse-autoselect-window. */ 87/* Last window where we saw the mouse. Used by mouse-autoselect-window. */
88static Lisp_Object last_window; 88static Lisp_Object last_window;
89 89
90/* Non-zero means make use of UNDERLINE_POSITION font properties.
91 (Not yet supported, see TODO in x_draw_glyph_string.) */
92int x_use_underline_position_properties;
93
90extern unsigned int msh_mousewheel; 94extern unsigned int msh_mousewheel;
91 95
92extern void free_frame_menubar (); 96extern void free_frame_menubar ();
@@ -2488,7 +2492,9 @@ x_draw_glyph_string (s)
2488 unsigned long dy = s->height - h; 2492 unsigned long dy = s->height - h;
2489 2493
2490 /* TODO: Use font information for positioning and thickness 2494 /* TODO: Use font information for positioning and thickness
2491 of underline. See OUTLINETEXTMETRIC, and xterm.c. */ 2495 of underline. See OUTLINETEXTMETRIC, and xterm.c.
2496 Note: If you make this work, don't forget to change the
2497 doc string of x-use-underline-position-properties below. */
2492 if (s->face->underline_defaulted_p) 2498 if (s->face->underline_defaulted_p)
2493 { 2499 {
2494 w32_fill_area (s->f, s->hdc, s->gc->foreground, s->x, 2500 w32_fill_area (s->f, s->hdc, s->gc->foreground, s->x,
@@ -6537,6 +6543,18 @@ the cursor have no effect. */);
6537 &w32_use_visible_system_caret, 0)) 6543 &w32_use_visible_system_caret, 0))
6538 w32_use_visible_system_caret = 0; 6544 w32_use_visible_system_caret = 0;
6539 6545
6546 /* We don't yet support this, but defining this here avoids whining
6547 from cus-start.el and other places, like "M-x set-variable". */
6548 DEFVAR_BOOL ("x-use-underline-position-properties",
6549 &x_use_underline_position_properties,
6550 doc: /* *Non-nil means make use of UNDERLINE_POSITION font properties.
6551nil means ignore them. If you encounter fonts with bogus
6552UNDERLINE_POSITION font properties, for example 7x13 on XFree prior
6553to 4.1, set this to nil.
6554
6555NOTE: Not supported on MS-Windows yet. */);
6556 x_use_underline_position_properties = 0;
6557
6540 DEFVAR_LISP ("x-toolkit-scroll-bars", &Vx_toolkit_scroll_bars, 6558 DEFVAR_LISP ("x-toolkit-scroll-bars", &Vx_toolkit_scroll_bars,
6541 doc: /* If not nil, Emacs uses toolkit scroll bars. */); 6559 doc: /* If not nil, Emacs uses toolkit scroll bars. */);
6542 Vx_toolkit_scroll_bars = Qt; 6560 Vx_toolkit_scroll_bars = Qt;
diff --git a/src/window.c b/src/window.c
index 83d99cf67ba..5bfff27f976 100644
--- a/src/window.c
+++ b/src/window.c
@@ -1454,8 +1454,10 @@ delete_window (window)
1454 tem = par->hchild; 1454 tem = par->hchild;
1455 if (NILP (tem)) 1455 if (NILP (tem))
1456 tem = par->vchild; 1456 tem = par->vchild;
1457 if (NILP (XWINDOW (tem)->next)) 1457 if (NILP (XWINDOW (tem)->next)) {
1458 replace_window (parent, tem); 1458 replace_window (parent, tem);
1459 par = XWINDOW (tem);
1460 }
1459 1461
1460 /* Since we may be deleting combination windows, we must make sure that 1462 /* Since we may be deleting combination windows, we must make sure that
1461 not only p but all its children have been marked as deleted. */ 1463 not only p but all its children have been marked as deleted. */
@@ -1467,6 +1469,51 @@ delete_window (window)
1467 /* Mark this window as deleted. */ 1469 /* Mark this window as deleted. */
1468 p->buffer = p->hchild = p->vchild = Qnil; 1470 p->buffer = p->hchild = p->vchild = Qnil;
1469 1471
1472 if (! NILP (par->parent))
1473 par = XWINDOW (par->parent);
1474
1475 /* Check if we have a v/hchild with a v/hchild. In that case remove
1476 one of them. */
1477
1478 if (! NILP (par->vchild) && ! NILP (XWINDOW (par->vchild)->vchild))
1479 {
1480 p = XWINDOW (par->vchild);
1481 par->vchild = p->vchild;
1482 tem = p->vchild;
1483 }
1484 else if (! NILP (par->hchild) && ! NILP (XWINDOW (par->hchild)->hchild))
1485 {
1486 p = XWINDOW (par->hchild);
1487 par->hchild = p->hchild;
1488 tem = p->hchild;
1489 }
1490 else
1491 p = 0;
1492
1493 if (p)
1494 {
1495 while (! NILP (tem)) {
1496 XWINDOW (tem)->parent = p->parent;
1497 if (NILP (XWINDOW (tem)->next))
1498 break;
1499 tem = XWINDOW (tem)->next;
1500 }
1501 if (! NILP (tem)) {
1502 /* The next of the v/hchild we are removing is now the next of the
1503 last child for the v/hchild:
1504 Before v/hchild -> v/hchild -> next1 -> next2
1505 |
1506 -> next3
1507 After: v/hchild -> next1 -> next2 -> next3
1508 */
1509 XWINDOW (tem)->next = p->next;
1510 if (! NILP (p->next))
1511 XWINDOW (p->next)->prev = tem;
1512 }
1513 p->next = p->prev = p->vchild = p->hchild = p->buffer = Qnil;
1514 }
1515
1516
1470 /* Adjust glyph matrices. */ 1517 /* Adjust glyph matrices. */
1471 adjust_glyphs (f); 1518 adjust_glyphs (f);
1472 UNBLOCK_INPUT; 1519 UNBLOCK_INPUT;
@@ -3189,7 +3236,7 @@ selects the buffer of the selected window before each command. */)
3189 so that FRAME_FOCUS_FRAME is moved appropriately as we 3236 so that FRAME_FOCUS_FRAME is moved appropriately as we
3190 move around in the state where a minibuffer in a separate 3237 move around in the state where a minibuffer in a separate
3191 frame is active. */ 3238 frame is active. */
3192 Fselect_frame (WINDOW_FRAME (w), Qnil); 3239 Fselect_frame (WINDOW_FRAME (w));
3193 } 3240 }
3194 else 3241 else
3195 sf->selected_window = window; 3242 sf->selected_window = window;
diff --git a/src/xdisp.c b/src/xdisp.c
index 31a82fefd78..a7ce6159a01 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -350,6 +350,10 @@ Lisp_Object Qtrailing_whitespace;
350 350
351Lisp_Object Qescape_glyph; 351Lisp_Object Qescape_glyph;
352 352
353/* Name and number of the face used to highlight non-breaking spaces. */
354
355Lisp_Object Qno_break_space;
356
353/* The symbol `image' which is the car of the lists used to represent 357/* The symbol `image' which is the car of the lists used to represent
354 images in Lisp. */ 358 images in Lisp. */
355 359
@@ -1881,7 +1885,7 @@ get_phys_cursor_geometry (w, row, glyph, heightp)
1881 int *heightp; 1885 int *heightp;
1882{ 1886{
1883 struct frame *f = XFRAME (WINDOW_FRAME (w)); 1887 struct frame *f = XFRAME (WINDOW_FRAME (w));
1884 int x, y, wd, h, h0, y0; 1888 int y, wd, h, h0, y0;
1885 1889
1886 /* Compute the width of the rectangle to draw. If on a stretch 1890 /* Compute the width of the rectangle to draw. If on a stretch
1887 glyph, and `x-stretch-block-cursor' is nil, don't draw a 1891 glyph, and `x-stretch-block-cursor' is nil, don't draw a
@@ -5081,8 +5085,10 @@ get_next_display_element (it)
5081 && it->len == 1) 5085 && it->len == 1)
5082 || !CHAR_PRINTABLE_P (it->c) 5086 || !CHAR_PRINTABLE_P (it->c)
5083 || (!NILP (Vshow_nonbreak_escape) 5087 || (!NILP (Vshow_nonbreak_escape)
5084 && (it->c == 0x8ad || it->c == 0x8a0 5088 && (it->c == 0x8a0 || it->c == 0x8ad
5085 || it->c == 0xf2d || it->c == 0xf20))) 5089 || it->c == 0x920 || it->c == 0x92d
5090 || it->c == 0xe20 || it->c == 0xe2d
5091 || it->c == 0xf20 || it->c == 0xf2d)))
5086 : (it->c >= 127 5092 : (it->c >= 127
5087 && (!unibyte_display_via_language_environment 5093 && (!unibyte_display_via_language_environment
5088 || it->c == unibyte_char_to_multibyte (it->c))))) 5094 || it->c == unibyte_char_to_multibyte (it->c)))))
@@ -5097,6 +5103,8 @@ get_next_display_element (it)
5097 int face_id, lface_id = 0 ; 5103 int face_id, lface_id = 0 ;
5098 GLYPH escape_glyph; 5104 GLYPH escape_glyph;
5099 5105
5106 /* Handle control characters with ^. */
5107
5100 if (it->c < 128 && it->ctl_arrow_p) 5108 if (it->c < 128 && it->ctl_arrow_p)
5101 { 5109 {
5102 g = '^'; /* default glyph for Control */ 5110 g = '^'; /* default glyph for Control */
@@ -5128,7 +5136,28 @@ get_next_display_element (it)
5128 goto display_control; 5136 goto display_control;
5129 } 5137 }
5130 5138
5131 escape_glyph = '\\'; /* default for Octal display */ 5139 /* Handle non-break space in the mode where it only gets
5140 highlighting. */
5141
5142 if (! EQ (Vshow_nonbreak_escape, Qt)
5143 && (it->c == 0x8a0 || it->c == 0x920
5144 || it->c == 0xe20 || it->c == 0xf20))
5145 {
5146 /* Merge the no-break-space face into the current face. */
5147 face_id = merge_faces (it->f, Qno_break_space, 0,
5148 it->face_id);
5149
5150 g = it->c = ' ';
5151 XSETINT (it->ctl_chars[0], g);
5152 ctl_len = 1;
5153 goto display_control;
5154 }
5155
5156 /* Handle sequences that start with the "escape glyph". */
5157
5158 /* the default escape glyph is \. */
5159 escape_glyph = '\\';
5160
5132 if (it->dp 5161 if (it->dp
5133 && INTEGERP (DISP_ESCAPE_GLYPH (it->dp)) 5162 && INTEGERP (DISP_ESCAPE_GLYPH (it->dp))
5134 && GLYPH_CHAR_VALID_P (XFASTINT (DISP_ESCAPE_GLYPH (it->dp)))) 5163 && GLYPH_CHAR_VALID_P (XFASTINT (DISP_ESCAPE_GLYPH (it->dp))))
@@ -5138,6 +5167,8 @@ get_next_display_element (it)
5138 } 5167 }
5139 if (lface_id) 5168 if (lface_id)
5140 { 5169 {
5170 /* The display table specified a face.
5171 Merge it into face_id and also into escape_glyph. */
5141 escape_glyph = FAST_GLYPH_CHAR (escape_glyph); 5172 escape_glyph = FAST_GLYPH_CHAR (escape_glyph);
5142 face_id = merge_faces (it->f, Qt, lface_id, 5173 face_id = merge_faces (it->f, Qt, lface_id,
5143 it->face_id); 5174 it->face_id);
@@ -5149,11 +5180,29 @@ get_next_display_element (it)
5149 it->face_id); 5180 it->face_id);
5150 } 5181 }
5151 5182
5183 /* Handle soft hyphens in the mode where they only get
5184 highlighting. */
5185
5186 if (! EQ (Vshow_nonbreak_escape, Qt)
5187 && (it->c == 0x8ad || it->c == 0x92d
5188 || it->c == 0xe2d || it->c == 0xf2d))
5189 {
5190 g = it->c = '-';
5191 XSETINT (it->ctl_chars[0], g);
5192 ctl_len = 1;
5193 goto display_control;
5194 }
5195
5196 /* Handle non-break space and soft hyphen
5197 with the escape glyph. */
5198
5152 if (it->c == 0x8a0 || it->c == 0x8ad 5199 if (it->c == 0x8a0 || it->c == 0x8ad
5200 || it->c == 0x920 || it->c == 0x92d
5201 || it->c == 0xe20 || it->c == 0xe2d
5153 || it->c == 0xf20 || it->c == 0xf2d) 5202 || it->c == 0xf20 || it->c == 0xf2d)
5154 { 5203 {
5155 XSETINT (it->ctl_chars[0], escape_glyph); 5204 XSETINT (it->ctl_chars[0], escape_glyph);
5156 g = it->c; 5205 g = it->c = ((it->c & 0xf) == 0 ? ' ' : '-');
5157 XSETINT (it->ctl_chars[1], g); 5206 XSETINT (it->ctl_chars[1], g);
5158 ctl_len = 2; 5207 ctl_len = 2;
5159 goto display_control; 5208 goto display_control;
@@ -8205,7 +8254,6 @@ static Lisp_Object
8205format_mode_line_unwind_data (obuf) 8254format_mode_line_unwind_data (obuf)
8206 struct buffer *obuf; 8255 struct buffer *obuf;
8207{ 8256{
8208 int i = 0;
8209 Lisp_Object vector; 8257 Lisp_Object vector;
8210 8258
8211 /* Reduce consing by keeping one vector in 8259 /* Reduce consing by keeping one vector in
@@ -8442,7 +8490,7 @@ prepare_menu_bars ()
8442 Lisp_Object tail, frame; 8490 Lisp_Object tail, frame;
8443 int count = SPECPDL_INDEX (); 8491 int count = SPECPDL_INDEX ();
8444 8492
8445 record_unwind_protect (Fset_match_data, Fmatch_data (Qnil, Qnil)); 8493 record_unwind_save_match_data ();
8446 8494
8447 FOR_EACH_FRAME (tail, frame) 8495 FOR_EACH_FRAME (tail, frame)
8448 { 8496 {
@@ -8565,7 +8613,7 @@ update_menu_bar (f, save_match_data)
8565 8613
8566 set_buffer_internal_1 (XBUFFER (w->buffer)); 8614 set_buffer_internal_1 (XBUFFER (w->buffer));
8567 if (save_match_data) 8615 if (save_match_data)
8568 record_unwind_protect (Fset_match_data, Fmatch_data (Qnil, Qnil)); 8616 record_unwind_save_match_data ();
8569 if (NILP (Voverriding_local_map_menu_flag)) 8617 if (NILP (Voverriding_local_map_menu_flag))
8570 { 8618 {
8571 specbind (Qoverriding_terminal_local_map, Qnil); 8619 specbind (Qoverriding_terminal_local_map, Qnil);
@@ -8756,7 +8804,7 @@ update_tool_bar (f, save_match_data)
8756 8804
8757 /* Save match data, if we must. */ 8805 /* Save match data, if we must. */
8758 if (save_match_data) 8806 if (save_match_data)
8759 record_unwind_protect (Fset_match_data, Fmatch_data (Qnil, Qnil)); 8807 record_unwind_save_match_data ();
8760 8808
8761 /* Make sure that we don't accidentally use bogus keymaps. */ 8809 /* Make sure that we don't accidentally use bogus keymaps. */
8762 if (NILP (Voverriding_local_map_menu_flag)) 8810 if (NILP (Voverriding_local_map_menu_flag))
@@ -19160,7 +19208,7 @@ get_line_height_property (it, prop)
19160 struct it *it; 19208 struct it *it;
19161 Lisp_Object prop; 19209 Lisp_Object prop;
19162{ 19210{
19163 Lisp_Object position, val; 19211 Lisp_Object position;
19164 19212
19165 if (STRINGP (it->object)) 19213 if (STRINGP (it->object))
19166 position = make_number (IT_STRING_CHARPOS (*it)); 19214 position = make_number (IT_STRING_CHARPOS (*it));
@@ -19511,7 +19559,6 @@ x_produce_glyphs (it)
19511 else 19559 else
19512 { 19560 {
19513 Lisp_Object spacing; 19561 Lisp_Object spacing;
19514 int total = 0;
19515 19562
19516 it->phys_ascent = it->ascent; 19563 it->phys_ascent = it->ascent;
19517 it->phys_descent = it->descent; 19564 it->phys_descent = it->descent;
@@ -21480,9 +21527,7 @@ note_mode_line_or_margin_highlight (window, x, y, area)
21480 int total_pixel_width; 21527 int total_pixel_width;
21481 int ignore; 21528 int ignore;
21482 21529
21483 21530 int vpos, hpos;
21484 if (clear_mouse_face (dpyinfo))
21485 cursor = No_Cursor;
21486 21531
21487 b = Fprevious_single_property_change (make_number (charpos + 1), 21532 b = Fprevious_single_property_change (make_number (charpos + 1),
21488 Qmouse_face, string, Qnil); 21533 Qmouse_face, string, Qnil);
@@ -21526,15 +21571,30 @@ note_mode_line_or_margin_highlight (window, x, y, area)
21526 for (tmp_glyph = glyph - gpos; tmp_glyph != glyph; tmp_glyph++) 21571 for (tmp_glyph = glyph - gpos; tmp_glyph != glyph; tmp_glyph++)
21527 total_pixel_width += tmp_glyph->pixel_width; 21572 total_pixel_width += tmp_glyph->pixel_width;
21528 21573
21529 dpyinfo->mouse_face_beg_col = (x - gpos); 21574 /* Pre calculation of re-rendering position */
21530 dpyinfo->mouse_face_beg_row = (area == ON_MODE_LINE 21575 vpos = (x - gpos);
21531 ? (w->current_matrix)->nrows - 1 21576 hpos = (area == ON_MODE_LINE
21532 : 0); 21577 ? (w->current_matrix)->nrows - 1
21578 : 0);
21579
21580 /* If the re-rendering position is included in the last
21581 re-rendering area, we should do nothing. */
21582 if ( EQ (window, dpyinfo->mouse_face_window)
21583 && dpyinfo->mouse_face_beg_col <= vpos
21584 && vpos < dpyinfo->mouse_face_end_col
21585 && dpyinfo->mouse_face_beg_row == hpos )
21586 return;
21587
21588 if (clear_mouse_face (dpyinfo))
21589 cursor = No_Cursor;
21590
21591 dpyinfo->mouse_face_beg_col = vpos;
21592 dpyinfo->mouse_face_beg_row = hpos;
21533 21593
21534 dpyinfo->mouse_face_beg_x = original_x_pixel - (total_pixel_width + dx); 21594 dpyinfo->mouse_face_beg_x = original_x_pixel - (total_pixel_width + dx);
21535 dpyinfo->mouse_face_beg_y = 0; 21595 dpyinfo->mouse_face_beg_y = 0;
21536 21596
21537 dpyinfo->mouse_face_end_col = (x - gpos) + gseq_length; 21597 dpyinfo->mouse_face_end_col = vpos + gseq_length;
21538 dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_beg_row; 21598 dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_beg_row;
21539 21599
21540 dpyinfo->mouse_face_end_x = 0; 21600 dpyinfo->mouse_face_end_x = 0;
@@ -21552,8 +21612,9 @@ note_mode_line_or_margin_highlight (window, x, y, area)
21552 if (NILP (pointer)) 21612 if (NILP (pointer))
21553 pointer = Qhand; 21613 pointer = Qhand;
21554 } 21614 }
21615 else if ((area == ON_MODE_LINE) || (area == ON_HEADER_LINE))
21616 clear_mouse_face (dpyinfo);
21555 } 21617 }
21556
21557 define_frame_cursor1 (f, cursor, pointer); 21618 define_frame_cursor1 (f, cursor, pointer);
21558} 21619}
21559 21620
@@ -21606,7 +21667,8 @@ note_mouse_highlight (f, x, y)
21606 /* If we were displaying active text in another window, clear that. 21667 /* If we were displaying active text in another window, clear that.
21607 Also clear if we move out of text area in same window. */ 21668 Also clear if we move out of text area in same window. */
21608 if (! EQ (window, dpyinfo->mouse_face_window) 21669 if (! EQ (window, dpyinfo->mouse_face_window)
21609 || (part != ON_TEXT && !NILP (dpyinfo->mouse_face_window))) 21670 || (part != ON_TEXT && part != ON_MODE_LINE && part != ON_HEADER_LINE
21671 && !NILP (dpyinfo->mouse_face_window)))
21610 clear_mouse_face (dpyinfo); 21672 clear_mouse_face (dpyinfo);
21611 21673
21612 /* Not on a window -> return. */ 21674 /* Not on a window -> return. */
@@ -22723,6 +22785,8 @@ syms_of_xdisp ()
22723 staticpro (&Qtrailing_whitespace); 22785 staticpro (&Qtrailing_whitespace);
22724 Qescape_glyph = intern ("escape-glyph"); 22786 Qescape_glyph = intern ("escape-glyph");
22725 staticpro (&Qescape_glyph); 22787 staticpro (&Qescape_glyph);
22788 Qno_break_space = intern ("no-break-space");
22789 staticpro (&Qno_break_space);
22726 Qimage = intern ("image"); 22790 Qimage = intern ("image");
22727 staticpro (&Qimage); 22791 staticpro (&Qimage);
22728 QCmap = intern (":map"); 22792 QCmap = intern (":map");
@@ -22829,7 +22893,11 @@ The face used for trailing whitespace is `trailing-whitespace'. */);
22829 Vshow_trailing_whitespace = Qnil; 22893 Vshow_trailing_whitespace = Qnil;
22830 22894
22831 DEFVAR_LISP ("show-nonbreak-escape", &Vshow_nonbreak_escape, 22895 DEFVAR_LISP ("show-nonbreak-escape", &Vshow_nonbreak_escape,
22832 doc: /* *Non-nil means display escape character before non-break space and hyphen. */); 22896 doc: /* *Control highlighting of non-break space and soft hyphen.
22897t means highlight the character itself (for non-break space,
22898use face `non-break-space'.
22899nil means no highlighting.
22900other values mean display the escape glyph before the character. */);
22833 Vshow_nonbreak_escape = Qt; 22901 Vshow_nonbreak_escape = Qt;
22834 22902
22835 DEFVAR_LISP ("void-text-area-pointer", &Vvoid_text_area_pointer, 22903 DEFVAR_LISP ("void-text-area-pointer", &Vvoid_text_area_pointer,
diff --git a/src/xfaces.c b/src/xfaces.c
index 953276aef83..f55ee7a901f 100644
--- a/src/xfaces.c
+++ b/src/xfaces.c
@@ -5039,8 +5039,8 @@ lface_equal_p (v1, v2)
5039DEFUN ("internal-lisp-face-equal-p", Finternal_lisp_face_equal_p, 5039DEFUN ("internal-lisp-face-equal-p", Finternal_lisp_face_equal_p,
5040 Sinternal_lisp_face_equal_p, 2, 3, 0, 5040 Sinternal_lisp_face_equal_p, 2, 3, 0,
5041 doc: /* True if FACE1 and FACE2 are equal. 5041 doc: /* True if FACE1 and FACE2 are equal.
5042If the optional argument FRAME is given, report on face FACE in that frame. 5042If the optional argument FRAME is given, report on FACE1 and FACE2 in that frame.
5043If FRAME is t, report on the defaults for face FACE (for new frames). 5043If FRAME is t, report on the defaults for FACE1 and FACE2 (for new frames).
5044If FRAME is omitted or nil, use the selected frame. */) 5044If FRAME is omitted or nil, use the selected frame. */)
5045 (face1, face2, frame) 5045 (face1, face2, frame)
5046 Lisp_Object face1, face2, frame; 5046 Lisp_Object face1, face2, frame;
@@ -5058,8 +5058,8 @@ If FRAME is omitted or nil, use the selected frame. */)
5058 Emacs. That frame is not an X frame. */ 5058 Emacs. That frame is not an X frame. */
5059 f = frame_or_selected_frame (frame, 2); 5059 f = frame_or_selected_frame (frame, 2);
5060 5060
5061 lface1 = lface_from_face_name (NULL, face1, 1); 5061 lface1 = lface_from_face_name (f, face1, 1);
5062 lface2 = lface_from_face_name (NULL, face2, 1); 5062 lface2 = lface_from_face_name (f, face2, 1);
5063 equal_p = lface_equal_p (XVECTOR (lface1)->contents, 5063 equal_p = lface_equal_p (XVECTOR (lface1)->contents,
5064 XVECTOR (lface2)->contents); 5064 XVECTOR (lface2)->contents);
5065 return equal_p ? Qt : Qnil; 5065 return equal_p ? Qt : Qnil;
@@ -6126,7 +6126,7 @@ DEFUN ("display-supports-face-attributes-p",
6126 1, 2, 0, 6126 1, 2, 0,
6127 doc: /* Return non-nil if all the face attributes in ATTRIBUTES are supported. 6127 doc: /* Return non-nil if all the face attributes in ATTRIBUTES are supported.
6128The optional argument DISPLAY can be a display name, a frame, or 6128The optional argument DISPLAY can be a display name, a frame, or
6129nil (meaning the selected frame's display) 6129nil (meaning the selected frame's display).
6130 6130
6131The definition of `supported' is somewhat heuristic, but basically means 6131The definition of `supported' is somewhat heuristic, but basically means
6132that a face containing all the attributes in ATTRIBUTES, when merged 6132that a face containing all the attributes in ATTRIBUTES, when merged
@@ -6139,7 +6139,7 @@ Point (2) implies that a `:weight black' attribute will be satisfied by
6139any display that can display bold, and a `:foreground \"yellow\"' as long 6139any display that can display bold, and a `:foreground \"yellow\"' as long
6140as it can display a yellowish color, but `:slant italic' will _not_ be 6140as it can display a yellowish color, but `:slant italic' will _not_ be
6141satisfied by the tty display code's automatic substitution of a `dim' 6141satisfied by the tty display code's automatic substitution of a `dim'
6142face for italic. */) 6142face for italic. */)
6143 (attributes, display) 6143 (attributes, display)
6144 Lisp_Object attributes, display; 6144 Lisp_Object attributes, display;
6145{ 6145{
diff --git a/src/xmenu.c b/src/xmenu.c
index 6e46accbe8d..194168e6dfd 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -2030,7 +2030,7 @@ set_frame_menubar (f, first_time, deep_p)
2030 because it is not reentrant. */ 2030 because it is not reentrant. */
2031 specbind (Qdebug_on_next_call, Qnil); 2031 specbind (Qdebug_on_next_call, Qnil);
2032 2032
2033 record_unwind_protect (Fset_match_data, Fmatch_data (Qnil, Qnil)); 2033 record_unwind_save_match_data ();
2034 record_unwind_protect (unuse_menu_items, Qnil); 2034 record_unwind_protect (unuse_menu_items, Qnil);
2035 if (NILP (Voverriding_local_map_menu_flag)) 2035 if (NILP (Voverriding_local_map_menu_flag))
2036 { 2036 {
diff --git a/src/xterm.c b/src/xterm.c
index c24802bab6b..71e1e2de1e8 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -4602,11 +4602,14 @@ x_create_toolkit_scroll_bar (f, bar)
4602 char *initial = ""; 4602 char *initial = "";
4603 char *val = initial; 4603 char *val = initial;
4604 XtVaGetValues (widget, XtNscrollVCursor, (XtPointer) &val, 4604 XtVaGetValues (widget, XtNscrollVCursor, (XtPointer) &val,
4605#ifdef XtNarrowScrollbars
4606 XtNarrowScrollbars, (XtPointer) &xaw3d_arrow_scroll,
4607#endif
4605 XtNpickTop, (XtPointer) &xaw3d_pick_top, NULL); 4608 XtNpickTop, (XtPointer) &xaw3d_pick_top, NULL);
4606 if (val == initial) 4609 if (xaw3d_arrow_scroll || val == initial)
4607 { /* ARROW_SCROLL */ 4610 { /* ARROW_SCROLL */
4608 xaw3d_arrow_scroll = True; 4611 xaw3d_arrow_scroll = True;
4609 /* Isn't that just a personal preference ? -sm */ 4612 /* Isn't that just a personal preference ? --Stef */
4610 XtVaSetValues (widget, XtNcursorName, "top_left_arrow", NULL); 4613 XtVaSetValues (widget, XtNcursorName, "top_left_arrow", NULL);
4611 } 4614 }
4612 } 4615 }
@@ -6789,12 +6792,6 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit)
6789 { 6792 {
6790 dpyinfo->grabbed |= (1 << event.xbutton.button); 6793 dpyinfo->grabbed |= (1 << event.xbutton.button);
6791 last_mouse_frame = f; 6794 last_mouse_frame = f;
6792 /* Ignore any mouse motion that happened
6793 before this event; any subsequent mouse-movement
6794 Emacs events should reflect only motion after
6795 the ButtonPress. */
6796 if (f != 0)
6797 f->mouse_moved = 0;
6798 6795
6799 if (!tool_bar_p) 6796 if (!tool_bar_p)
6800 last_tool_bar_item = -1; 6797 last_tool_bar_item = -1;
@@ -6802,6 +6799,12 @@ handle_one_xevent (dpyinfo, eventp, finish, hold_quit)
6802 else 6799 else
6803 dpyinfo->grabbed &= ~(1 << event.xbutton.button); 6800 dpyinfo->grabbed &= ~(1 << event.xbutton.button);
6804 6801
6802 /* Ignore any mouse motion that happened before this event;
6803 any subsequent mouse-movement Emacs events should reflect
6804 only motion after the ButtonPress/Release. */
6805 if (f != 0)
6806 f->mouse_moved = 0;
6807
6805#if defined (USE_X_TOOLKIT) || defined (USE_GTK) 6808#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
6806 f = x_menubar_window_to_frame (dpyinfo, event.xbutton.window); 6809 f = x_menubar_window_to_frame (dpyinfo, event.xbutton.window);
6807 /* For a down-event in the menu bar, 6810 /* For a down-event in the menu bar,