aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMiles Bader2007-04-11 00:17:47 +0000
committerMiles Bader2007-04-11 00:17:47 +0000
commit57cb2e6f261bb0aad81a9f7e6f3017b54adee068 (patch)
tree6ceb46f2e3bf08f16468d77f4fbfd201f637596a /src
parent3bd1d328e94787ac52ef6ba5dfec3b94ba23917a (diff)
parentc429815a6b9d271a57eed4956125f6bc89d1d72b (diff)
downloademacs-57cb2e6f261bb0aad81a9f7e6f3017b54adee068.tar.gz
emacs-57cb2e6f261bb0aad81a9f7e6f3017b54adee068.zip
Merge from emacs--devo--0
Patches applied: * emacs--devo--0 (patch 675-697) - Update from CVS - Merge from gnus--rel--5.10 - Release ERC 5.2. * gnus--rel--5.10 (patch 211-215) - Update from CVS - Merge from emacs--devo--0 Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-189
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog201
-rw-r--r--src/ChangeLog.52
-rw-r--r--src/buffer.c2
-rw-r--r--src/editfns.c42
-rw-r--r--src/emacs.c5
-rw-r--r--src/fileio.c8
-rw-r--r--src/gmalloc.c78
-rw-r--r--src/gtkutil.c1
-rw-r--r--src/indent.c7
-rw-r--r--src/intervals.c68
-rw-r--r--src/keyboard.c6
-rw-r--r--src/keymap.c55
-rw-r--r--src/keymap.h2
-rw-r--r--src/lread.c7
-rw-r--r--src/m/hp800.h77
-rw-r--r--src/m/sr2k.h160
-rw-r--r--src/macfns.c20
-rw-r--r--src/macselect.c15
-rw-r--r--src/macterm.c37
-rw-r--r--src/print.c2
-rw-r--r--src/process.c46
-rw-r--r--src/s/darwin.h17
-rw-r--r--src/undo.c2
-rw-r--r--src/unexhp9k800.c334
-rw-r--r--src/w32fns.c2
-rw-r--r--src/widget.c5
-rw-r--r--src/window.c2
-rw-r--r--src/xdisp.c21
-rw-r--r--src/xfns.c2
29 files changed, 1052 insertions, 174 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 9cc5e085001..61e6de2c97d 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,158 @@
12007-04-10 Chong Yidong <cyd@stupidchicken.com>
2
3 * xdisp.c (note_mode_line_or_margin_highlight): Don't decrement
4 glyph pointer before start of glyph row.
5
62007-04-09 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
7
8 * s/darwin.h (__restrict, struct kboard): Remove outdated workarounds.
9 (C_SWITCH_SYSTEM): Remove `-I../mac/src'.
10
112007-04-09 Martin Rudalics <rudalics@gmx.at>
12
13 * indent.c (Fmove_to_column): Set next_boundary with correct start pt.
14
152007-04-08 Richard Stallman <rms@gnu.org>
16
17 * xdisp.c (syms_of_xdisp) <message-log-max>: Default 100.
18
192007-04-07 Chong Yidong <cyd@stupidchicken.com>
20
21 * editfns.c (Ftranspose_regions): Validate interval before setting
22 text properties.
23
242007-04-03 Eli Zaretskii <eliz@gnu.org>
25
26 * emacs.c (main): Fix instructions for building Emacs for profiling.
27
282007-04-03 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
29
30 * gtkutil.c (xg_update_menubar): Call g_list_next after moving
31 menu bar item.
32
332007-04-02 Juanma Barranquero <lekktu@gmail.com>
34
35 * print.c (Fprin1_to_string): Use macro SPECPDL_INDEX.
36
372007-04-01 Chong Yidong <cyd@stupidchicken.com>
38
39 * keymap.c (Fcommand_remapping): New optional argument.
40 (where_is_internal): Use new keymaps argument.
41 (Fkey_binding): Caller changed.
42
43 * keyboard.c (command_loop_1): Caller changed.
44
452007-03-31 Eli Zaretskii <eliz@gnu.org>
46
47 * window.c (Fget_lru_window): Doc fix.
48
492007-03-30 Chong Yidong <cyd@stupidchicken.com>
50
51 * undo.c (Fprimitive_undo): Give clearer error message when trying
52 to change text properties outside accessible part of buffer.
53
542007-03-29 Kim F. Storm <storm@cua.dk>
55
56 * process.c (wait_reading_process_output) [HAVE_PTYS]:
57 When EIO happens, clear channel from descriptor masks before raising
58 SIGCHLD signal to avoid busy loop between read and sigchld_handler.
59 (sigchld_handler): Remove sleep (2007-03-11 & 2007-03-26 changes).
60
612007-03-29 Juanma Barranquero <lekktu@gmail.com>
62
63 * buffer.c (Fset_buffer_major_mode): Check that BUFFER is valid.
64
65 * process.c (Fformat_network_address): Return nil when the
66 argument vector contains invalid values.
67
682007-03-28 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
69
70 * gmalloc.c [HAVE_GTK_AND_PTHREAD]: Define USE_PTHREAD.
71 [USE_PTHREAD]: Include pthread.h.
72 (malloc_init_once_control, _malloc_mutex) [USE_PTHREAD]: New variables.
73 (malloc_initialize_1): New function created from __malloc_initialize.
74 (__malloc_initialize): Use it.
75 (LOCK, UNLOCK): New macros to make malloc etc. thread safe.
76 (_malloc_internal, _free_internal, _realloc_internal): Use them.
77
78 * lread.c (readchar): Extend BLOCK_INPUT block to ferror/clearerr.
79
802007-03-27 Juanma Barranquero <lekktu@gmail.com>
81
82 * process.c (Fformat_network_address): Make args array big enough
83 to format IPv6 addresses.
84
852007-03-27 Glenn Morris <rgm@gnu.org>
86
87 * m/hp800.h: Restore HP-UX support (removed 2007-01-29).
88
892007-03-26 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
90
91 * macfns.c (Fx_display_mm_height, Fx_display_mm_width): Scale whole
92 screen size in pixels by millimeters per pixel of main display.
93
94 * macselect.c (get_scrap_target_type_list, x_own_selection):
95 Move assignments outside predicate macros.
96 (Vselection_converter_alist): Doc fix.
97
98 * macterm.c (create_text_encoding_info_alist): Move assignments
99 outside predicate macros.
100 (mac_initialize_display_info) [MAC_OSX]: dpyinfo->height and
101 dpyinfo->width are those of whole screen.
102
1032007-03-26 Sam Steingold <sds@gnu.org>
104
105 * process.c (sigchld_handler): Delay by 1ms instead of 1s to
106 alleviate sluggishness (the original problem is still fixed).
107
1082007-03-25 Kim F. Storm <storm@cua.dk>
109
110 * intervals.c (merge_properties): Use explicit loop instead of
111 Fplist_member to avoid QUIT. Don't use Fcdr.
112 (intervals_equal): Likewise. Rewrite loop to perform length check
113 on the fly rather than calling Flength. Don't use Fcar.
114
1152007-03-24 Eli Zaretskii <eliz@gnu.org>
116
117 * editfns.c (Fgoto_char): Doc fix.
118
119 * indent.c (Findent_to): Doc fix.
120
1212007-03-24 Chong Yidong <cyd@stupidchicken.com>
122
123 * editfns.c (Ftranspose_regions): Use set_text_properties_1
124 instead of Fset_text_properties to avoid GC. Signal after change.
125
1262007-03-24 Eli Zaretskii <eliz@gnu.org>
127
128 * xfns.c (Fx_show_tip): Doc fix.
129
130 * macfns.c (Fx_show_tip): Doc fix.
131
132 * w32fns.c (Fx_show_tip): Doc fix.
133
1342007-03-23 Kim F. Storm <storm@cua.dk>
135
136 * intervals.c (merge_properties, intervals_equal):
137 Use Fplist_member instead of Fmemq to find properties.
138
1392007-03-23 Glenn Morris <rgm@gnu.org>
140
141 * unexhp9k800.c: Restore file with clarified legal status.
142 * m/sr2k.h: Restore since dependency unexhp9k800.c is restored.
143
1442007-03-22 Chong Yidong <cyd@stupidchicken.com>
145
146 * widget.c (EmacsFrameSetCharSize): Catch X errors.
147
1482007-03-22 Kenichi Handa <handa@m17n.org>
149
150 * fileio.c (Fcopy_file): Call barf_or_query_if_file_exists with
151 non-encoded file name.
152 (Frename_file): Likewise.
153 (Fadd_name_to_file): Likewise.
154 (Fmake_symbolic_link): Likewise.
155
12007-03-20 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> 1562007-03-20 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
2 157
3 * Makefile.in (alloca.o, gtkutil.o): Depend on systime.h. 158 * Makefile.in (alloca.o, gtkutil.o): Depend on systime.h.
@@ -25,9 +180,9 @@
25 * print.c: Include blockinput.h. 180 * print.c: Include blockinput.h.
26 (Fredirect_debugging_output): Add BLOCK_INPUT around fclose. 181 (Fredirect_debugging_output): Add BLOCK_INPUT around fclose.
27 182
28 * process.c (Fmake_network_process) [HAVE_GETADDRINFO]: Clear 183 * process.c (Fmake_network_process) [HAVE_GETADDRINFO]:
29 immediate_quit before calling freeaddrinfo. Add BLOCK_INPUT 184 Clear immediate_quit before calling freeaddrinfo.
30 around freeaddrinfo. 185 Add BLOCK_INPUT around freeaddrinfo.
31 186
32 * term.c: Include blockinput.h. 187 * term.c: Include blockinput.h.
33 (write_glyphs, insert_glyphs): Add BLOCK_INPUT around fwrite. 188 (write_glyphs, insert_glyphs): Add BLOCK_INPUT around fwrite.
@@ -51,8 +206,8 @@
51 (x_activate_menubar, mac_menu_show): Set it during menu tracking. 206 (x_activate_menubar, mac_menu_show): Set it during menu tracking.
52 (popup_activated): New function. 207 (popup_activated): New function.
53 208
54 * xdisp.c (redisplay_internal, note_mouse_highlight): Check 209 * xdisp.c (redisplay_internal, note_mouse_highlight):
55 popup_activated for MAC_OS. 210 Check popup_activated for MAC_OS.
56 211
572007-03-17 Juanma Barranquero <lekktu@gmail.com> 2122007-03-17 Juanma Barranquero <lekktu@gmail.com>
58 213
@@ -491,9 +646,9 @@
491 646
4922007-01-22 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> 6472007-01-22 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
493 648
494 * macselect.c [TARGET_API_MAC_CARBON] (mac_do_receive_drag): Don't 649 * macselect.c [TARGET_API_MAC_CARBON] (mac_do_receive_drag):
495 pass keyboard modifiers to mac_store_drag_event, but put them as 650 Don't pass keyboard modifiers to mac_store_drag_event, but put
496 kEventParamKeyModifiers Apple event parameter. 651 them as kEventParamKeyModifiers Apple event parameter.
497 652
4982007-01-21 Chong Yidong <cyd@stupidchicken.com> 6532007-01-21 Chong Yidong <cyd@stupidchicken.com>
499 654
@@ -577,8 +732,8 @@
577 (mac_dialog) [TARGET_API_MAC_CARBON]: Remove function. 732 (mac_dialog) [TARGET_API_MAC_CARBON]: Remove function.
578 (mac_dialog_show) [TARGET_API_MAC_CARBON]: Use create_and_show_dialog. 733 (mac_dialog_show) [TARGET_API_MAC_CARBON]: Use create_and_show_dialog.
579 734
580 * macterm.c (x_free_frame_resources) [USE_CG_DRAWING]: Call 735 * macterm.c (x_free_frame_resources) [USE_CG_DRAWING]:
581 mac_prepare_for_quickdraw. 736 Call mac_prepare_for_quickdraw.
582 (quit_char, make_ctrl_char) [TARGET_API_MAC_CARBON]: Move externs 737 (quit_char, make_ctrl_char) [TARGET_API_MAC_CARBON]: Move externs
583 outside #ifdef MAC_OSX. 738 outside #ifdef MAC_OSX.
584 (mac_quit_char_key_p) [TARGET_API_MAC_CARBON]: Move function 739 (mac_quit_char_key_p) [TARGET_API_MAC_CARBON]: Move function
@@ -2230,8 +2385,8 @@
2230 2385
22312006-08-28 Kenichi Handa <handa@m17n.org> 23862006-08-28 Kenichi Handa <handa@m17n.org>
2232 2387
2233 * coding.c (Fdetect_coding_region, Fdetect_coding_string): Fix 2388 * coding.c (Fdetect_coding_region, Fdetect_coding_string):
2234 docstring about ISO-2022 control characters. 2389 Fix docstring about ISO-2022 control characters.
2235 2390
22362006-08-28 Kim F. Storm <storm@cua.dk> 23912006-08-28 Kim F. Storm <storm@cua.dk>
2237 2392
@@ -2454,7 +2609,7 @@
24542006-08-09 Kenichi Handa <handa@m17n.org> 26092006-08-09 Kenichi Handa <handa@m17n.org>
2455 2610
2456 * coding.c (syms_of_coding): Improve the docstring 2611 * coding.c (syms_of_coding): Improve the docstring
2457 file-coding-system-alist. 2612 of file-coding-system-alist.
2458 2613
24592006-08-07 Andreas Schwab <schwab@suse.de> 26142006-08-07 Andreas Schwab <schwab@suse.de>
2460 2615
@@ -3402,8 +3557,8 @@
3402 * macterm.c (font_panel_shown_p) [USE_MAC_FONT_PANEL]: New variable. 3557 * macterm.c (font_panel_shown_p) [USE_MAC_FONT_PANEL]: New variable.
3403 (mac_font_panel_visible_p, mac_show_hide_font_panel) 3558 (mac_font_panel_visible_p, mac_show_hide_font_panel)
3404 [USE_MAC_FONT_PANEL]: New functions. 3559 [USE_MAC_FONT_PANEL]: New functions.
3405 [USE_MAC_FONT_PANEL] (mac_set_font_info_for_selection): Return 3560 [USE_MAC_FONT_PANEL] (mac_set_font_info_for_selection):
3406 immediately if font panel is not visible. 3561 Return immediately if font panel is not visible.
3407 3562
3408 * macterm.h (mac_font_panel_visible_p, mac_show_hide_font_panel): 3563 * macterm.h (mac_font_panel_visible_p, mac_show_hide_font_panel):
3409 Add externs. 3564 Add externs.
@@ -3422,8 +3577,8 @@
3422 3577
34232006-05-29 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> 35782006-05-29 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
3424 3579
3425 * sound.c (alsa_open, alsa_configure, alsa_write): Move 3580 * sound.c (alsa_open, alsa_configure, alsa_write):
3426 assignment to err out of if-statement. 3581 Move assignment to err out of if-statement.
3427 3582
3428 * gtkutil.c (menu_nav_ended): New function. 3583 * gtkutil.c (menu_nav_ended): New function.
3429 (create_menus): Connect menu_nav_ended to "selection-done" to fix 3584 (create_menus): Connect menu_nav_ended to "selection-done" to fix
@@ -3838,8 +3993,8 @@
3838 (Qpanel_closed, Qselection) [USE_MAC_FONT_PANEL]: Likewise. 3993 (Qpanel_closed, Qselection) [USE_MAC_FONT_PANEL]: Likewise.
3839 (syms_of_macterm): Intern and staticpro them. 3994 (syms_of_macterm): Intern and staticpro them.
3840 (init_font_name_table) [USE_ATSUI]: Add data to Vmac_atsu_font_table. 3995 (init_font_name_table) [USE_ATSUI]: Add data to Vmac_atsu_font_table.
3841 [TARGET_API_MAC_CARBON] (mac_store_event_ref_as_apple_event): New 3996 [TARGET_API_MAC_CARBON] (mac_store_event_ref_as_apple_event):
3842 function. 3997 New function.
3843 [USE_CARBON_EVENTS] (mac_handle_command_event): Use it. 3998 [USE_CARBON_EVENTS] (mac_handle_command_event): Use it.
3844 [MAC_OSX] (mac_store_services_event): Likewise. 3999 [MAC_OSX] (mac_store_services_event): Likewise.
3845 [USE_CARBON_EVENTS] (mac_handle_window_event) [MAC_OSX]: Handle 4000 [USE_CARBON_EVENTS] (mac_handle_window_event) [MAC_OSX]: Handle
@@ -3891,8 +4046,8 @@
3891 [TARGET_API_MAC_CARBON] (create_apple_event): New function. 4046 [TARGET_API_MAC_CARBON] (create_apple_event): New function.
3892 [TARGET_API_MAC_CARBON] (create_apple_event_from_event_ref): Use it. 4047 [TARGET_API_MAC_CARBON] (create_apple_event_from_event_ref): Use it.
3893 Use xrealloc instead of repeated xmalloc/xfree. 4048 Use xrealloc instead of repeated xmalloc/xfree.
3894 [TARGET_API_MAC_CARBON] (create_apple_event_from_drag_ref): New 4049 [TARGET_API_MAC_CARBON] (create_apple_event_from_drag_ref):
3895 function. 4050 New function.
3896 4051
3897 * macmenu.c (restore_menu_items, cleanup_popup_menu): Return a value. 4052 * macmenu.c (restore_menu_items, cleanup_popup_menu): Return a value.
3898 4053
@@ -5752,8 +5907,8 @@
5752 objects until we are done with the parsing. 5907 objects until we are done with the parsing.
5753 (parse_single_submenu, digest_single_submenu): New functions. 5908 (parse_single_submenu, digest_single_submenu): New functions.
5754 (single_submenu): Function deleted, replaced by those two. 5909 (single_submenu): Function deleted, replaced by those two.
5755 (install_menu_quit_handler) [HAVE_CANCELMENUTRACKING]: Don't 5910 (install_menu_quit_handler) [HAVE_CANCELMENUTRACKING]: Don't create
5756 create or dispose of EventHandlerUPP. Install hander to all submenus. 5911 or dispose of EventHandlerUPP. Install hander to all submenus.
5757 (mac_menu_show) [!HAVE_MULTILINGUAL_MENU]: Use ENCODE_MENU_STRING 5912 (mac_menu_show) [!HAVE_MULTILINGUAL_MENU]: Use ENCODE_MENU_STRING
5758 instead of ENCODE_SYSTEM. 5913 instead of ENCODE_SYSTEM.
5759 (free_frame_menubar, fill_submenu, fill_menu): Don't use NULL for 5914 (free_frame_menubar, fill_submenu, fill_menu): Don't use NULL for
diff --git a/src/ChangeLog.5 b/src/ChangeLog.5
index 7cce26c5acc..975bd646285 100644
--- a/src/ChangeLog.5
+++ b/src/ChangeLog.5
@@ -1789,7 +1789,7 @@
1789 1789
1790 * textprop.c (Fnext_property_change): Fix previous change. 1790 * textprop.c (Fnext_property_change): Fix previous change.
1791 1791
17921995-03-23 Kevin Rodgers <kevinr@ihs.com> 17921995-03-23 Kevin Rodgers <kevinr@ihs.com> (tiny change)
1793 1793
1794 * print.c (temp_output_buffer_setup): (Re)set the default 1794 * print.c (temp_output_buffer_setup): (Re)set the default
1795 directory of the temp buffer to that of the current buffer. 1795 directory of the temp buffer to that of the current buffer.
diff --git a/src/buffer.c b/src/buffer.c
index f8d5bdc76fe..09166b17cfb 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1615,6 +1615,8 @@ the current buffer's major mode. */)
1615 int count; 1615 int count;
1616 Lisp_Object function; 1616 Lisp_Object function;
1617 1617
1618 CHECK_BUFFER (buffer);
1619
1618 if (STRINGP (XBUFFER (buffer)->name) 1620 if (STRINGP (XBUFFER (buffer)->name)
1619 && strcmp (SDATA (XBUFFER (buffer)->name), "*scratch*") == 0) 1621 && strcmp (SDATA (XBUFFER (buffer)->name), "*scratch*") == 0)
1620 function = find_symbol_value (intern ("initial-major-mode")); 1622 function = find_symbol_value (intern ("initial-major-mode"));
diff --git a/src/editfns.c b/src/editfns.c
index d2cd31044ce..fa5f9c11684 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -272,7 +272,9 @@ clip_to_bounds (lower, num, upper)
272 272
273DEFUN ("goto-char", Fgoto_char, Sgoto_char, 1, 1, "NGoto char: ", 273DEFUN ("goto-char", Fgoto_char, Sgoto_char, 1, 1, "NGoto char: ",
274 doc: /* Set point to POSITION, a number or marker. 274 doc: /* Set point to POSITION, a number or marker.
275Beginning of buffer is position (point-min), end is (point-max). */) 275Beginning of buffer is position (point-min), end is (point-max).
276
277The return value is POSITION. */)
276 (position) 278 (position)
277 register Lisp_Object position; 279 register Lisp_Object position;
278{ 280{
@@ -4261,7 +4263,10 @@ Transposing beyond buffer boundaries is an error. */)
4261 int gap, len1, len_mid, len2; 4263 int gap, len1, len_mid, len2;
4262 unsigned char *start1_addr, *start2_addr, *temp; 4264 unsigned char *start1_addr, *start2_addr, *temp;
4263 4265
4264 INTERVAL cur_intv, tmp_interval1, tmp_interval_mid, tmp_interval2; 4266 INTERVAL cur_intv, tmp_interval1, tmp_interval_mid, tmp_interval2, tmp_interval3;
4267 Lisp_Object buf;
4268
4269 XSETBUFFER (buf, current_buffer);
4265 cur_intv = BUF_INTERVALS (current_buffer); 4270 cur_intv = BUF_INTERVALS (current_buffer);
4266 4271
4267 validate_region (&startr1, &endr1); 4272 validate_region (&startr1, &endr1);
@@ -4368,8 +4373,11 @@ Transposing beyond buffer boundaries is an error. */)
4368 4373
4369 tmp_interval1 = copy_intervals (cur_intv, start1, len1); 4374 tmp_interval1 = copy_intervals (cur_intv, start1, len1);
4370 tmp_interval2 = copy_intervals (cur_intv, start2, len2); 4375 tmp_interval2 = copy_intervals (cur_intv, start2, len2);
4371 Fset_text_properties (make_number (start1), make_number (end2), 4376 /* Don't use Fset_text_properties: that can cause GC, which can
4372 Qnil, Qnil); 4377 clobber objects stored in the tmp_intervals. */
4378 tmp_interval3 = validate_interval_range (buf, &startr1, &endr2, 0);
4379 if (!NULL_INTERVAL_P (tmp_interval3))
4380 set_text_properties_1 (startr1, endr2, Qnil, buf, tmp_interval3);
4373 4381
4374 /* First region smaller than second. */ 4382 /* First region smaller than second. */
4375 if (len1_byte < len2_byte) 4383 if (len1_byte < len2_byte)
@@ -4425,10 +4433,14 @@ Transposing beyond buffer boundaries is an error. */)
4425 record_change (start2, len2); 4433 record_change (start2, len2);
4426 tmp_interval1 = copy_intervals (cur_intv, start1, len1); 4434 tmp_interval1 = copy_intervals (cur_intv, start1, len1);
4427 tmp_interval2 = copy_intervals (cur_intv, start2, len2); 4435 tmp_interval2 = copy_intervals (cur_intv, start2, len2);
4428 Fset_text_properties (make_number (start1), make_number (end1), 4436
4429 Qnil, Qnil); 4437 tmp_interval3 = validate_interval_range (buf, &startr1, &endr1, 0);
4430 Fset_text_properties (make_number (start2), make_number (end2), 4438 if (!NULL_INTERVAL_P (tmp_interval3))
4431 Qnil, Qnil); 4439 set_text_properties_1 (startr1, endr1, Qnil, buf, tmp_interval3);
4440
4441 tmp_interval3 = validate_interval_range (buf, &startr2, &endr2, 0);
4442 if (!NULL_INTERVAL_P (tmp_interval3))
4443 set_text_properties_1 (startr2, endr2, Qnil, buf, tmp_interval3);
4432 4444
4433 SAFE_ALLOCA (temp, unsigned char *, len1_byte); 4445 SAFE_ALLOCA (temp, unsigned char *, len1_byte);
4434 start1_addr = BYTE_POS_ADDR (start1_byte); 4446 start1_addr = BYTE_POS_ADDR (start1_byte);
@@ -4454,8 +4466,10 @@ Transposing beyond buffer boundaries is an error. */)
4454 tmp_interval1 = copy_intervals (cur_intv, start1, len1); 4466 tmp_interval1 = copy_intervals (cur_intv, start1, len1);
4455 tmp_interval_mid = copy_intervals (cur_intv, end1, len_mid); 4467 tmp_interval_mid = copy_intervals (cur_intv, end1, len_mid);
4456 tmp_interval2 = copy_intervals (cur_intv, start2, len2); 4468 tmp_interval2 = copy_intervals (cur_intv, start2, len2);
4457 Fset_text_properties (make_number (start1), make_number (end2), 4469
4458 Qnil, Qnil); 4470 tmp_interval3 = validate_interval_range (buf, &startr1, &endr2, 0);
4471 if (!NULL_INTERVAL_P (tmp_interval3))
4472 set_text_properties_1 (startr1, endr2, Qnil, buf, tmp_interval3);
4459 4473
4460 /* holds region 2 */ 4474 /* holds region 2 */
4461 SAFE_ALLOCA (temp, unsigned char *, len2_byte); 4475 SAFE_ALLOCA (temp, unsigned char *, len2_byte);
@@ -4485,8 +4499,10 @@ Transposing beyond buffer boundaries is an error. */)
4485 tmp_interval1 = copy_intervals (cur_intv, start1, len1); 4499 tmp_interval1 = copy_intervals (cur_intv, start1, len1);
4486 tmp_interval_mid = copy_intervals (cur_intv, end1, len_mid); 4500 tmp_interval_mid = copy_intervals (cur_intv, end1, len_mid);
4487 tmp_interval2 = copy_intervals (cur_intv, start2, len2); 4501 tmp_interval2 = copy_intervals (cur_intv, start2, len2);
4488 Fset_text_properties (make_number (start1), make_number (end2), 4502
4489 Qnil, Qnil); 4503 tmp_interval3 = validate_interval_range (buf, &startr1, &endr2, 0);
4504 if (!NULL_INTERVAL_P (tmp_interval3))
4505 set_text_properties_1 (startr1, endr2, Qnil, buf, tmp_interval3);
4490 4506
4491 /* holds region 1 */ 4507 /* holds region 1 */
4492 SAFE_ALLOCA (temp, unsigned char *, len1_byte); 4508 SAFE_ALLOCA (temp, unsigned char *, len1_byte);
@@ -4521,6 +4537,8 @@ Transposing beyond buffer boundaries is an error. */)
4521 fix_start_end_in_overlays (start1, end2); 4537 fix_start_end_in_overlays (start1, end2);
4522 } 4538 }
4523 4539
4540 signal_after_change (XINT (start1), XINT (end2 - start1),
4541 XINT (end2 - start1));
4524 return Qnil; 4542 return Qnil;
4525} 4543}
4526 4544
diff --git a/src/emacs.c b/src/emacs.c
index 5219176eda9..aec551b5268 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1739,8 +1739,9 @@ main (argc, argv
1739 /* Set up for profiling. This is known to work on FreeBSD, 1739 /* Set up for profiling. This is known to work on FreeBSD,
1740 GNU/Linux and MinGW. It might work on some other systems too. 1740 GNU/Linux and MinGW. It might work on some other systems too.
1741 Give it a try and tell us if it works on your system. To compile 1741 Give it a try and tell us if it works on your system. To compile
1742 for profiling use something like: 1742 for profiling, add -pg to the switches your platform uses in
1743 `make CFLAGS="-pg -g -O -DPROFILING=1'. */ 1743 CFLAGS and LDFLAGS. For example:
1744 `make CFLAGS="-pg -g -O -DPROFILING=1" LDFLAGS="-pg -g"'. */
1744#if defined (__FreeBSD__) || defined (GNU_LINUX) || defined(__MINGW32__) 1745#if defined (__FreeBSD__) || defined (GNU_LINUX) || defined(__MINGW32__)
1745#ifdef PROFILING 1746#ifdef PROFILING
1746 if (initialized) 1747 if (initialized)
diff --git a/src/fileio.c b/src/fileio.c
index 892457603aa..d24d26561f2 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -2476,7 +2476,7 @@ uid and gid of FILE to NEWNAME. */)
2476 2476
2477 if (NILP (ok_if_already_exists) 2477 if (NILP (ok_if_already_exists)
2478 || INTEGERP (ok_if_already_exists)) 2478 || INTEGERP (ok_if_already_exists))
2479 barf_or_query_if_file_exists (encoded_newname, "copy to it", 2479 barf_or_query_if_file_exists (newname, "copy to it",
2480 INTEGERP (ok_if_already_exists), &out_st, 0); 2480 INTEGERP (ok_if_already_exists), &out_st, 0);
2481 else if (stat (SDATA (encoded_newname), &out_st) < 0) 2481 else if (stat (SDATA (encoded_newname), &out_st) < 0)
2482 out_st.st_mode = 0; 2482 out_st.st_mode = 0;
@@ -2785,7 +2785,7 @@ This is what happens in interactive use with M-x. */)
2785#endif 2785#endif
2786 if (NILP (ok_if_already_exists) 2786 if (NILP (ok_if_already_exists)
2787 || INTEGERP (ok_if_already_exists)) 2787 || INTEGERP (ok_if_already_exists))
2788 barf_or_query_if_file_exists (encoded_newname, "rename to it", 2788 barf_or_query_if_file_exists (newname, "rename to it",
2789 INTEGERP (ok_if_already_exists), 0, 0); 2789 INTEGERP (ok_if_already_exists), 0, 0);
2790#ifndef BSD4_1 2790#ifndef BSD4_1
2791 if (0 > rename (SDATA (encoded_file), SDATA (encoded_newname))) 2791 if (0 > rename (SDATA (encoded_file), SDATA (encoded_newname)))
@@ -2862,7 +2862,7 @@ This is what happens in interactive use with M-x. */)
2862 2862
2863 if (NILP (ok_if_already_exists) 2863 if (NILP (ok_if_already_exists)
2864 || INTEGERP (ok_if_already_exists)) 2864 || INTEGERP (ok_if_already_exists))
2865 barf_or_query_if_file_exists (encoded_newname, "make it a new name", 2865 barf_or_query_if_file_exists (newname, "make it a new name",
2866 INTEGERP (ok_if_already_exists), 0, 0); 2866 INTEGERP (ok_if_already_exists), 0, 0);
2867 2867
2868 unlink (SDATA (newname)); 2868 unlink (SDATA (newname));
@@ -2923,7 +2923,7 @@ This happens for interactive use with M-x. */)
2923 2923
2924 if (NILP (ok_if_already_exists) 2924 if (NILP (ok_if_already_exists)
2925 || INTEGERP (ok_if_already_exists)) 2925 || INTEGERP (ok_if_already_exists))
2926 barf_or_query_if_file_exists (encoded_linkname, "make it a link", 2926 barf_or_query_if_file_exists (linkname, "make it a link",
2927 INTEGERP (ok_if_already_exists), 0, 0); 2927 INTEGERP (ok_if_already_exists), 0, 0);
2928 if (0 > symlink (SDATA (encoded_filename), 2928 if (0 > symlink (SDATA (encoded_filename),
2929 SDATA (encoded_linkname))) 2929 SDATA (encoded_linkname)))
diff --git a/src/gmalloc.c b/src/gmalloc.c
index 3f32617fc64..50535d4940c 100644
--- a/src/gmalloc.c
+++ b/src/gmalloc.c
@@ -1,6 +1,9 @@
1/* This file is no longer automatically generated from libc. */ 1/* This file is no longer automatically generated from libc. */
2 2
3#define _MALLOC_INTERNAL 3#define _MALLOC_INTERNAL
4#ifdef HAVE_GTK_AND_PTHREAD
5#define USE_PTHREAD
6#endif
4 7
5/* The malloc headers and source files from the C library follow here. */ 8/* The malloc headers and source files from the C library follow here. */
6 9
@@ -73,6 +76,10 @@ Fifth Floor, Boston, MA 02110-1301, USA.
73#include <unistd.h> 76#include <unistd.h>
74#endif 77#endif
75 78
79#ifdef USE_PTHREAD
80#include <pthread.h>
81#endif
82
76#endif /* _MALLOC_INTERNAL. */ 83#endif /* _MALLOC_INTERNAL. */
77 84
78 85
@@ -229,6 +236,15 @@ extern __ptr_t _malloc_internal PP ((__malloc_size_t __size));
229extern __ptr_t _realloc_internal PP ((__ptr_t __ptr, __malloc_size_t __size)); 236extern __ptr_t _realloc_internal PP ((__ptr_t __ptr, __malloc_size_t __size));
230extern void _free_internal PP ((__ptr_t __ptr)); 237extern void _free_internal PP ((__ptr_t __ptr));
231 238
239#ifdef USE_PTHREAD
240extern pthread_mutex_t _malloc_mutex;
241#define LOCK() pthread_mutex_lock (&_malloc_mutex)
242#define UNLOCK() pthread_mutex_unlock (&_malloc_mutex)
243#else
244#define LOCK()
245#define UNLOCK()
246#endif
247
232#endif /* _MALLOC_INTERNAL. */ 248#endif /* _MALLOC_INTERNAL. */
233 249
234/* Given an address in the middle of a malloc'd object, 250/* Given an address in the middle of a malloc'd object,
@@ -536,13 +552,14 @@ register_heapinfo ()
536 _heapinfo[block + blocks].busy.info.size = -blocks; 552 _heapinfo[block + blocks].busy.info.size = -blocks;
537} 553}
538 554
539/* Set everything up and remember that we have. */ 555#ifdef USE_PTHREAD
540int 556static pthread_once_t malloc_init_once_control = PTHREAD_ONCE_INIT;
541__malloc_initialize () 557pthread_mutex_t _malloc_mutex;
542{ 558#endif
543 if (__malloc_initialized)
544 return 0;
545 559
560static void
561malloc_initialize_1 ()
562{
546#ifdef GC_MCHECK 563#ifdef GC_MCHECK
547 mcheck (NULL); 564 mcheck (NULL);
548#endif 565#endif
@@ -550,10 +567,21 @@ __malloc_initialize ()
550 if (__malloc_initialize_hook) 567 if (__malloc_initialize_hook)
551 (*__malloc_initialize_hook) (); 568 (*__malloc_initialize_hook) ();
552 569
570#ifdef USE_PTHREAD
571 {
572 pthread_mutexattr_t attr;
573
574 pthread_mutexattr_init (&attr);
575 pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE);
576 pthread_mutex_init (&_malloc_mutex, &attr);
577 pthread_mutexattr_destroy (&attr);
578 }
579#endif
580
553 heapsize = HEAP / BLOCKSIZE; 581 heapsize = HEAP / BLOCKSIZE;
554 _heapinfo = (malloc_info *) align (heapsize * sizeof (malloc_info)); 582 _heapinfo = (malloc_info *) align (heapsize * sizeof (malloc_info));
555 if (_heapinfo == NULL) 583 if (_heapinfo == NULL)
556 return 0; 584 return;
557 memset (_heapinfo, 0, heapsize * sizeof (malloc_info)); 585 memset (_heapinfo, 0, heapsize * sizeof (malloc_info));
558 _heapinfo[0].free.size = 0; 586 _heapinfo[0].free.size = 0;
559 _heapinfo[0].free.next = _heapinfo[0].free.prev = 0; 587 _heapinfo[0].free.next = _heapinfo[0].free.prev = 0;
@@ -565,7 +593,23 @@ __malloc_initialize ()
565 593
566 __malloc_initialized = 1; 594 __malloc_initialized = 1;
567 PROTECT_MALLOC_STATE (1); 595 PROTECT_MALLOC_STATE (1);
568 return 1; 596 return;
597}
598
599/* Set everything up and remember that we have. */
600int
601__malloc_initialize ()
602{
603#ifdef USE_PTHREAD
604 pthread_once (&malloc_init_once_control, malloc_initialize_1);
605#else
606 if (__malloc_initialized)
607 return 0;
608
609 malloc_initialize_1 ();
610#endif
611
612 return __malloc_initialized;
569} 613}
570 614
571static int morecore_recursing; 615static int morecore_recursing;
@@ -708,6 +752,7 @@ _malloc_internal (size)
708 return NULL; 752 return NULL;
709#endif 753#endif
710 754
755 LOCK ();
711 PROTECT_MALLOC_STATE (0); 756 PROTECT_MALLOC_STATE (0);
712 757
713 if (size < sizeof (struct list)) 758 if (size < sizeof (struct list))
@@ -765,7 +810,7 @@ _malloc_internal (size)
765 if (result == NULL) 810 if (result == NULL)
766 { 811 {
767 PROTECT_MALLOC_STATE (1); 812 PROTECT_MALLOC_STATE (1);
768 return NULL; 813 goto out;
769 } 814 }
770 815
771 /* Link all fragments but the first into the free list. */ 816 /* Link all fragments but the first into the free list. */
@@ -831,7 +876,7 @@ _malloc_internal (size)
831 } 876 }
832 result = morecore (wantblocks * BLOCKSIZE); 877 result = morecore (wantblocks * BLOCKSIZE);
833 if (result == NULL) 878 if (result == NULL)
834 return NULL; 879 goto out;
835 block = BLOCK (result); 880 block = BLOCK (result);
836 /* Put the new block at the end of the free list. */ 881 /* Put the new block at the end of the free list. */
837 _heapinfo[block].free.size = wantblocks; 882 _heapinfo[block].free.size = wantblocks;
@@ -886,6 +931,8 @@ _malloc_internal (size)
886 } 931 }
887 932
888 PROTECT_MALLOC_STATE (1); 933 PROTECT_MALLOC_STATE (1);
934 out:
935 UNLOCK ();
889 return result; 936 return result;
890} 937}
891 938
@@ -996,6 +1043,7 @@ _free_internal (ptr)
996 if (ptr == NULL) 1043 if (ptr == NULL)
997 return; 1044 return;
998 1045
1046 LOCK ();
999 PROTECT_MALLOC_STATE (0); 1047 PROTECT_MALLOC_STATE (0);
1000 1048
1001 for (l = _aligned_blocks; l != NULL; l = l->next) 1049 for (l = _aligned_blocks; l != NULL; l = l->next)
@@ -1221,6 +1269,7 @@ _free_internal (ptr)
1221 } 1269 }
1222 1270
1223 PROTECT_MALLOC_STATE (1); 1271 PROTECT_MALLOC_STATE (1);
1272 UNLOCK ();
1224} 1273}
1225 1274
1226/* Return memory to the heap. */ 1275/* Return memory to the heap. */
@@ -1384,6 +1433,7 @@ _realloc_internal (ptr, size)
1384 1433
1385 block = BLOCK (ptr); 1434 block = BLOCK (ptr);
1386 1435
1436 LOCK ();
1387 PROTECT_MALLOC_STATE (0); 1437 PROTECT_MALLOC_STATE (0);
1388 1438
1389 type = _heapinfo[block].busy.type; 1439 type = _heapinfo[block].busy.type;
@@ -1398,7 +1448,7 @@ _realloc_internal (ptr, size)
1398 { 1448 {
1399 memcpy (result, ptr, size); 1449 memcpy (result, ptr, size);
1400 _free_internal (ptr); 1450 _free_internal (ptr);
1401 return result; 1451 goto out;
1402 } 1452 }
1403 } 1453 }
1404 1454
@@ -1451,7 +1501,7 @@ _realloc_internal (ptr, size)
1451 (void) _malloc_internal (blocks * BLOCKSIZE); 1501 (void) _malloc_internal (blocks * BLOCKSIZE);
1452 _free_internal (previous); 1502 _free_internal (previous);
1453 } 1503 }
1454 return NULL; 1504 goto out;
1455 } 1505 }
1456 if (ptr != result) 1506 if (ptr != result)
1457 memmove (result, ptr, blocks * BLOCKSIZE); 1507 memmove (result, ptr, blocks * BLOCKSIZE);
@@ -1471,7 +1521,7 @@ _realloc_internal (ptr, size)
1471 and copy the lesser of the new size and the old. */ 1521 and copy the lesser of the new size and the old. */
1472 result = _malloc_internal (size); 1522 result = _malloc_internal (size);
1473 if (result == NULL) 1523 if (result == NULL)
1474 return NULL; 1524 goto out;
1475 memcpy (result, ptr, min (size, (__malloc_size_t) 1 << type)); 1525 memcpy (result, ptr, min (size, (__malloc_size_t) 1 << type));
1476 _free_internal (ptr); 1526 _free_internal (ptr);
1477 } 1527 }
@@ -1479,6 +1529,8 @@ _realloc_internal (ptr, size)
1479 } 1529 }
1480 1530
1481 PROTECT_MALLOC_STATE (1); 1531 PROTECT_MALLOC_STATE (1);
1532 out:
1533 UNLOCK ();
1482 return result; 1534 return result;
1483} 1535}
1484 1536
diff --git a/src/gtkutil.c b/src/gtkutil.c
index fa8e91546ce..8dfcf84f0f2 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -2506,6 +2506,7 @@ xg_update_menubar (menubar, f, list, iter, pos, val,
2506 g_list_free (*list); 2506 g_list_free (*list);
2507 *list = iter = gtk_container_get_children (GTK_CONTAINER (menubar)); 2507 *list = iter = gtk_container_get_children (GTK_CONTAINER (menubar));
2508 while (nr-- > 0) iter = g_list_next (iter); 2508 while (nr-- > 0) iter = g_list_next (iter);
2509 if (iter) iter = g_list_next (iter);
2509 val = val->next; 2510 val = val->next;
2510 ++pos; 2511 ++pos;
2511 } 2512 }
diff --git a/src/indent.c b/src/indent.c
index 23ec6d51933..c0b6b6beb6e 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -735,7 +735,9 @@ string_display_width (string, beg, end)
735DEFUN ("indent-to", Findent_to, Sindent_to, 1, 2, "NIndent to column: ", 735DEFUN ("indent-to", Findent_to, Sindent_to, 1, 2, "NIndent to column: ",
736 doc: /* Indent from point with tabs and spaces until COLUMN is reached. 736 doc: /* Indent from point with tabs and spaces until COLUMN is reached.
737Optional second argument MINIMUM says always do at least MINIMUM spaces 737Optional second argument MINIMUM says always do at least MINIMUM spaces
738even if that goes past COLUMN; by default, MINIMUM is zero. */) 738even if that goes past COLUMN; by default, MINIMUM is zero.
739
740The return value is COLUMN. */)
739 (column, minimum) 741 (column, minimum)
740 Lisp_Object column, minimum; 742 Lisp_Object column, minimum;
741{ 743{
@@ -949,7 +951,6 @@ The return value is the current column. */)
949 pos = PT; 951 pos = PT;
950 pos_byte = PT_BYTE; 952 pos_byte = PT_BYTE;
951 end = ZV; 953 end = ZV;
952 next_boundary = pos;
953 954
954 /* If we're starting past the desired column, 955 /* If we're starting past the desired column,
955 back up to beginning of line and scan from there. */ 956 back up to beginning of line and scan from there. */
@@ -961,6 +962,8 @@ The return value is the current column. */)
961 col = 0; 962 col = 0;
962 } 963 }
963 964
965 next_boundary = pos;
966
964 while (pos < end) 967 while (pos < end)
965 { 968 {
966 while (pos == next_boundary) 969 while (pos == next_boundary)
diff --git a/src/intervals.c b/src/intervals.c
index ef97aa4973a..33ff321f0db 100644
--- a/src/intervals.c
+++ b/src/intervals.c
@@ -125,18 +125,24 @@ merge_properties (source, target)
125 while (CONSP (o)) 125 while (CONSP (o))
126 { 126 {
127 sym = XCAR (o); 127 sym = XCAR (o);
128 val = Fmemq (sym, target->plist); 128 o = XCDR (o);
129 CHECK_CONS (o);
130
131 val = target->plist;
132 while (CONSP (val) && !EQ (XCAR (val), sym))
133 {
134 val = XCDR (val);
135 if (!CONSP (val))
136 break;
137 val = XCDR (val);
138 }
129 139
130 if (NILP (val)) 140 if (NILP (val))
131 { 141 {
132 o = XCDR (o);
133 CHECK_CONS (o);
134 val = XCAR (o); 142 val = XCAR (o);
135 target->plist = Fcons (sym, Fcons (val, target->plist)); 143 target->plist = Fcons (sym, Fcons (val, target->plist));
136 o = XCDR (o);
137 } 144 }
138 else 145 o = XCDR (o);
139 o = Fcdr (XCDR (o));
140 } 146 }
141} 147}
142 148
@@ -147,8 +153,8 @@ int
147intervals_equal (i0, i1) 153intervals_equal (i0, i1)
148 INTERVAL i0, i1; 154 INTERVAL i0, i1;
149{ 155{
150 register Lisp_Object i0_cdr, i0_sym, i1_val; 156 register Lisp_Object i0_cdr, i0_sym;
151 register int i1_len; 157 register Lisp_Object i1_cdr, i1_val;
152 158
153 if (DEFAULT_INTERVAL_P (i0) && DEFAULT_INTERVAL_P (i1)) 159 if (DEFAULT_INTERVAL_P (i0) && DEFAULT_INTERVAL_P (i1))
154 return 1; 160 return 1;
@@ -156,39 +162,43 @@ intervals_equal (i0, i1)
156 if (DEFAULT_INTERVAL_P (i0) || DEFAULT_INTERVAL_P (i1)) 162 if (DEFAULT_INTERVAL_P (i0) || DEFAULT_INTERVAL_P (i1))
157 return 0; 163 return 0;
158 164
159 i1_len = XFASTINT (Flength (i1->plist));
160 if (i1_len & 0x1) /* Paranoia -- plists are always even */
161 abort ();
162 i1_len /= 2;
163 i0_cdr = i0->plist; 165 i0_cdr = i0->plist;
164 while (CONSP (i0_cdr)) 166 i1_cdr = i1->plist;
167 while (CONSP (i0_cdr) && CONSP (i1_cdr))
165 { 168 {
166 /* Lengths of the two plists were unequal. */
167 if (i1_len == 0)
168 return 0;
169
170 i0_sym = XCAR (i0_cdr); 169 i0_sym = XCAR (i0_cdr);
171 i1_val = Fmemq (i0_sym, i1->plist); 170 i0_cdr = XCDR (i0_cdr);
171 if (!CONSP (i0_cdr))
172 return 0; /* abort (); */
173 i1_val = i1->plist;
174 while (CONSP (i1_val) && !EQ (XCAR (i1_val), i0_sym))
175 {
176 i1_val = XCDR (i1_val);
177 if (!CONSP (i1_val))
178 return 0; /* abort (); */
179 i1_val = XCDR (i1_val);
180 }
172 181
173 /* i0 has something i1 doesn't. */ 182 /* i0 has something i1 doesn't. */
174 if (EQ (i1_val, Qnil)) 183 if (EQ (i1_val, Qnil))
175 return 0; 184 return 0;
176 185
177 /* i0 and i1 both have sym, but it has different values in each. */ 186 /* i0 and i1 both have sym, but it has different values in each. */
178 i0_cdr = XCDR (i0_cdr); 187 if (!CONSP (i1_val)
179 CHECK_CONS (i0_cdr); 188 || (i1_val = XCDR (i1_val), !CONSP (i1_val))
180 if (!EQ (Fcar (Fcdr (i1_val)), XCAR (i0_cdr))) 189 || !EQ (XCAR (i1_val), XCAR (i0_cdr)))
181 return 0; 190 return 0;
182 191
183 i0_cdr = XCDR (i0_cdr); 192 i0_cdr = XCDR (i0_cdr);
184 i1_len--;
185 }
186 193
187 /* Lengths of the two plists were unequal. */ 194 i1_cdr = XCDR (i1_cdr);
188 if (i1_len > 0) 195 if (!CONSP (i1_cdr))
189 return 0; 196 return 0; /* abort (); */
197 i1_cdr = XCDR (i1_cdr);
198 }
190 199
191 return 1; 200 /* Lengths of the two plists were equal. */
201 return (NILP (i0_cdr) && NILP (i1_cdr));
192} 202}
193 203
194 204
@@ -2538,7 +2548,7 @@ set_intervals_multibyte_1 (i, multi_flag, start, start_byte, end, end_byte)
2538 temp = CHAR_TO_BYTE (left_end); 2548 temp = CHAR_TO_BYTE (left_end);
2539 2549
2540 /* If LEFT_END_BYTE is in the middle of a character, 2550 /* If LEFT_END_BYTE is in the middle of a character,
2541 adjust it and LEFT_END to a char boundary. */ 2551 adjust it and LEFT_END to a char boundary. */
2542 if (left_end_byte > temp) 2552 if (left_end_byte > temp)
2543 { 2553 {
2544 left_end_byte = temp; 2554 left_end_byte = temp;
@@ -2570,7 +2580,7 @@ set_intervals_multibyte_1 (i, multi_flag, start, start_byte, end, end_byte)
2570 right_start = BYTE_TO_CHAR (right_start_byte); 2580 right_start = BYTE_TO_CHAR (right_start_byte);
2571 2581
2572 /* If RIGHT_START_BYTE is in the middle of a character, 2582 /* If RIGHT_START_BYTE is in the middle of a character,
2573 adjust it and RIGHT_START to a char boundary. */ 2583 adjust it and RIGHT_START to a char boundary. */
2574 temp = CHAR_TO_BYTE (right_start); 2584 temp = CHAR_TO_BYTE (right_start);
2575 2585
2576 if (right_start_byte < temp) 2586 if (right_start_byte < temp)
diff --git a/src/keyboard.c b/src/keyboard.c
index 69199dd436c..0d091e07cf0 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1691,7 +1691,7 @@ command_loop_1 ()
1691 if (SYMBOLP (cmd)) 1691 if (SYMBOLP (cmd))
1692 { 1692 {
1693 Lisp_Object cmd1; 1693 Lisp_Object cmd1;
1694 if (cmd1 = Fcommand_remapping (cmd, Qnil), !NILP (cmd1)) 1694 if (cmd1 = Fcommand_remapping (cmd, Qnil, Qnil), !NILP (cmd1))
1695 cmd = cmd1; 1695 cmd = cmd1;
1696 } 1696 }
1697 1697
@@ -8822,9 +8822,9 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
8822 of the place where a mouse click occurred. */ 8822 of the place where a mouse click occurred. */
8823 volatile int localized_local_map = 0; 8823 volatile int localized_local_map = 0;
8824 8824
8825 /* The index in defs[] of the first keymap that has a binding for 8825 /* The index in submaps[] of the first keymap that has a binding for
8826 this key sequence. In other words, the lowest i such that 8826 this key sequence. In other words, the lowest i such that
8827 defs[i] is non-nil. */ 8827 submaps[i] is non-nil. */
8828 volatile int first_binding; 8828 volatile int first_binding;
8829 /* Index of the first key that has no binding. 8829 /* Index of the first key that has no binding.
8830 It is useless to try fkey.start larger than that. */ 8830 It is useless to try fkey.start larger than that. */
diff --git a/src/keymap.c b/src/keymap.c
index a612b0d5c6c..d953df008d7 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -1257,23 +1257,42 @@ binding KEY to DEF is added at the front of KEYMAP. */)
1257 1257
1258/* This function may GC (it calls Fkey_binding). */ 1258/* This function may GC (it calls Fkey_binding). */
1259 1259
1260DEFUN ("command-remapping", Fcommand_remapping, Scommand_remapping, 1, 2, 0, 1260DEFUN ("command-remapping", Fcommand_remapping, Scommand_remapping, 1, 3, 0,
1261 doc: /* Return the remapping for command COMMAND in current keymaps. 1261 doc: /* Return the remapping for command COMMAND.
1262Returns nil if COMMAND is not remapped (or not a symbol). 1262Returns nil if COMMAND is not remapped (or not a symbol).
1263 1263
1264If the optional argument POSITION is non-nil, it specifies a mouse 1264If the optional argument POSITION is non-nil, it specifies a mouse
1265position as returned by `event-start' and `event-end', and the 1265position as returned by `event-start' and `event-end', and the
1266remapping occurs in the keymaps associated with it. It can also be a 1266remapping occurs in the keymaps associated with it. It can also be a
1267number or marker, in which case the keymap properties at the specified 1267number or marker, in which case the keymap properties at the specified
1268buffer position instead of point are used. */) 1268buffer position instead of point are used. The KEYMAPS argument is
1269 (command, position) 1269ignored if POSITION is non-nil.
1270 Lisp_Object command, position; 1270
1271If the optional argument KEYMAPS is non-nil, it should be a list of
1272keymaps to search for command remapping. Otherwise, search for the
1273remapping in all currently active keymaps. */)
1274 (command, position, keymaps)
1275 Lisp_Object command, position, keymaps;
1271{ 1276{
1272 if (!SYMBOLP (command)) 1277 if (!SYMBOLP (command))
1273 return Qnil; 1278 return Qnil;
1274 1279
1275 ASET (command_remapping_vector, 1, command); 1280 ASET (command_remapping_vector, 1, command);
1276 return Fkey_binding (command_remapping_vector, Qnil, Qt, position); 1281
1282 if (NILP (keymaps))
1283 return Fkey_binding (command_remapping_vector, Qnil, Qt, position);
1284 else
1285 {
1286 Lisp_Object maps, binding;
1287
1288 for (maps = keymaps; !NILP (maps); maps = Fcdr (maps))
1289 {
1290 binding = Flookup_key (Fcar (maps), command_remapping_vector, Qnil);
1291 if (!NILP (binding) && !INTEGERP (binding))
1292 return binding;
1293 }
1294 return Qnil;
1295 }
1277} 1296}
1278 1297
1279/* Value is number if KEY is too long; nil if valid but has no definition. */ 1298/* Value is number if KEY is too long; nil if valid but has no definition. */
@@ -1434,8 +1453,10 @@ silly_event_symbol_error (c)
1434static Lisp_Object *cmm_modes = NULL, *cmm_maps = NULL; 1453static Lisp_Object *cmm_modes = NULL, *cmm_maps = NULL;
1435static int cmm_size = 0; 1454static int cmm_size = 0;
1436 1455
1437/* Store a pointer to an array of the keymaps of the currently active 1456/* Store a pointer to an array of the currently active minor modes in
1438 minor modes in *buf, and return the number of maps it contains. 1457 *modeptr, a pointer to an array of the keymaps of the currently
1458 active minor modes in *mapptr, and return the number of maps
1459 *mapptr contains.
1439 1460
1440 This function always returns a pointer to the same buffer, and may 1461 This function always returns a pointer to the same buffer, and may
1441 free or reallocate it, so if you want to keep it for a long time or 1462 free or reallocate it, so if you want to keep it for a long time or
@@ -1801,7 +1822,7 @@ specified buffer position instead of point are used.
1801 if (NILP (no_remap) && SYMBOLP (value)) 1822 if (NILP (no_remap) && SYMBOLP (value))
1802 { 1823 {
1803 Lisp_Object value1; 1824 Lisp_Object value1;
1804 if (value1 = Fcommand_remapping (value, position), !NILP (value1)) 1825 if (value1 = Fcommand_remapping (value, position, Qnil), !NILP (value1))
1805 value = value1; 1826 value = value1;
1806 } 1827 }
1807 1828
@@ -2546,15 +2567,6 @@ where_is_internal (definition, keymaps, firstonly, noindirect, no_remap)
2546 /* 1 means ignore all menu bindings entirely. */ 2567 /* 1 means ignore all menu bindings entirely. */
2547 int nomenus = !NILP (firstonly) && !EQ (firstonly, Qnon_ascii); 2568 int nomenus = !NILP (firstonly) && !EQ (firstonly, Qnon_ascii);
2548 2569
2549 /* If this command is remapped, then it has no key bindings
2550 of its own. */
2551 if (NILP (no_remap) && SYMBOLP (definition))
2552 {
2553 Lisp_Object tem;
2554 if (tem = Fcommand_remapping (definition, Qnil), !NILP (tem))
2555 return Qnil;
2556 }
2557
2558 found = keymaps; 2570 found = keymaps;
2559 while (CONSP (found)) 2571 while (CONSP (found))
2560 { 2572 {
@@ -2568,6 +2580,13 @@ where_is_internal (definition, keymaps, firstonly, noindirect, no_remap)
2568 found = Qnil; 2580 found = Qnil;
2569 sequences = Qnil; 2581 sequences = Qnil;
2570 2582
2583 /* If this command is remapped, then it has no key bindings
2584 of its own. */
2585 if (NILP (no_remap)
2586 && SYMBOLP (definition)
2587 && !NILP (Fcommand_remapping (definition, Qnil, keymaps)))
2588 RETURN_UNGCPRO (Qnil);
2589
2571 for (; !NILP (maps); maps = Fcdr (maps)) 2590 for (; !NILP (maps); maps = Fcdr (maps))
2572 { 2591 {
2573 /* Key sequence to reach map, and the map that it reaches */ 2592 /* Key sequence to reach map, and the map that it reaches */
diff --git a/src/keymap.h b/src/keymap.h
index 62a97b415ce..f55f76d5005 100644
--- a/src/keymap.h
+++ b/src/keymap.h
@@ -29,7 +29,7 @@ EXFUN (Fmake_sparse_keymap, 1);
29EXFUN (Fkeymap_prompt, 1); 29EXFUN (Fkeymap_prompt, 1);
30EXFUN (Fdefine_key, 3); 30EXFUN (Fdefine_key, 3);
31EXFUN (Flookup_key, 3); 31EXFUN (Flookup_key, 3);
32EXFUN (Fcommand_remapping, 2); 32EXFUN (Fcommand_remapping, 3);
33EXFUN (Fkey_binding, 4); 33EXFUN (Fkey_binding, 4);
34EXFUN (Fkey_description, 2); 34EXFUN (Fkey_description, 2);
35EXFUN (Fsingle_key_description, 2); 35EXFUN (Fsingle_key_description, 2);
diff --git a/src/lread.c b/src/lread.c
index 178b381af10..71241dc9521 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -498,20 +498,21 @@ readbyte_from_file (c, readcharfun)
498 498
499 BLOCK_INPUT; 499 BLOCK_INPUT;
500 c = getc (instream); 500 c = getc (instream);
501 UNBLOCK_INPUT;
502 501
503#ifdef EINTR 502#ifdef EINTR
504 /* Interrupted reads have been observed while reading over the network */ 503 /* Interrupted reads have been observed while reading over the network */
505 while (c == EOF && ferror (instream) && errno == EINTR) 504 while (c == EOF && ferror (instream) && errno == EINTR)
506 { 505 {
506 UNBLOCK_INPUT;
507 QUIT; 507 QUIT;
508 clearerr (instream);
509 BLOCK_INPUT; 508 BLOCK_INPUT;
509 clearerr (instream);
510 c = getc (instream); 510 c = getc (instream);
511 UNBLOCK_INPUT;
512 } 511 }
513#endif 512#endif
514 513
514 UNBLOCK_INPUT;
515
515 return (c == EOF ? -1 : c); 516 return (c == EOF ? -1 : c);
516} 517}
517 518
diff --git a/src/m/hp800.h b/src/m/hp800.h
index eed53183569..f48f4c8152e 100644
--- a/src/m/hp800.h
+++ b/src/m/hp800.h
@@ -69,10 +69,9 @@ Boston, MA 02110-1301, USA. */
69#define XSET(var, type, ptr) \ 69#define XSET(var, type, ptr) \
70 ((var) = ((int)(type) << VALBITS) + (((unsigned) (ptr) << BITS_PER_INT-VALBITS) >> BITS_PER_INT-VALBITS)) 70 ((var) = ((int)(type) << VALBITS) + (((unsigned) (ptr) << BITS_PER_INT-VALBITS) >> BITS_PER_INT-VALBITS))
71 71
72/* Definitions for GNU/Linux. (HP/UX is unsupported because of the 72/* Common definitions for HPUX and GNU/Linux. */
73 removal of unexhp9k800.c due to lack of legal papers.) */
74 73
75#ifdef GNU_LINUX 74#if defined (__hpux) || defined (GNU_LINUX)
76/* Now define a symbol for the cpu type, if your compiler 75/* Now define a symbol for the cpu type, if your compiler
77 does not define it automatically: 76 does not define it automatically:
78 Ones defined so far include vax, m68000, ns16000, pyramid, 77 Ones defined so far include vax, m68000, ns16000, pyramid,
@@ -94,6 +93,12 @@ Boston, MA 02110-1301, USA. */
94 93
95#define NO_REMAP 94#define NO_REMAP
96 95
96#endif /* __hpux or GNU_LINUX */
97
98/* Stuff for just GNU/Linux. */
99
100#ifdef GNU_LINUX
101
97/* Data type of load average, as read out of kmem. */ 102/* Data type of load average, as read out of kmem. */
98 103
99#define LOAD_AVE_TYPE long 104#define LOAD_AVE_TYPE long
@@ -104,6 +109,72 @@ Boston, MA 02110-1301, USA. */
104 109
105#endif /* GNU_LINUX */ 110#endif /* GNU_LINUX */
106 111
112/* Stuff for just HPUX. */
113
114#ifdef __hpux
115
116/* Define VIRT_ADDR_VARIES if the virtual addresses of
117 pure and impure space as loaded can vary, and even their
118 relative order cannot be relied on.
119
120 Otherwise Emacs assumes that text space precedes data space,
121 numerically. */
122
123#define VIRT_ADDR_VARIES
124
125/* the data segment on this machine always starts at address 0x40000000. */
126
127#define DATA_SEG_BITS 0x40000000
128
129#define DATA_START 0x40000000
130#define TEXT_START 0x00000000
131
132/* This machine requires completely different unexec code
133 which lives in a separate file. Specify the file name. */
134
135#define UNEXEC unexhp9k800.o
136
137#define LIBS_MACHINE
138#define LIBS_DEBUG
139
140/* Include the file bsdtty.h, since this machine has job control. */
141#define NEED_BSDTTY
142
143/* Data type of load average, as read out of kmem. */
144
145#define LOAD_AVE_TYPE double
146
147/* Convert that into an integer that is 100 for a load average of 1.0 */
148
149#define LOAD_AVE_CVT(x) ((int) (x * 100.0))
150
151/* The symbol in the kernel where the load average is found
152 is named _avenrun. At this time there are two major flavors
153 of hp-ux (there is the s800 and s300 (s200) flavors). The
154 differences are thusly moved to the corresponding machine description file.
155*/
156
157/* no underscore please */
158#define LDAV_SYMBOL "avenrun"
159
160#if 0 /* Supposedly no longer true. */
161/* In hpux, for unknown reasons, S_IFLNK is defined even though
162 symbolic links do not exist.
163 Make sure our conditionals based on S_IFLNK are not confused.
164
165 Here we assume that stat.h is included before config.h
166 so that we can override it here. */
167
168#undef S_IFLNK
169#endif
170
171/* On USG systems these have different names. */
172
173#define index strchr
174#define rindex strrchr
175
176#endif /* __hpux */
177
107/* Systems with GCC don't need to lose. */ 178/* Systems with GCC don't need to lose. */
108#ifdef __NetBSD__ 179#ifdef __NetBSD__
109# ifdef __GNUC__ 180# ifdef __GNUC__
diff --git a/src/m/sr2k.h b/src/m/sr2k.h
new file mode 100644
index 00000000000..2342bf8ef20
--- /dev/null
+++ b/src/m/sr2k.h
@@ -0,0 +1,160 @@
1/* machine description file for Hitachi SR2001/SR2201 machines.
2 Copyright (C) 1996, 2001, 2002, 2003, 2004, 2005,
3 2006, 2007 Free Software Foundation, Inc.
4
5This file is part of GNU Emacs.
6
7GNU Emacs is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2, or (at your option)
10any later version.
11
12GNU Emacs is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with GNU Emacs; see the file COPYING. If not, write to
19the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
20Boston, MA 02110-1301, USA. */
21
22
23/* The following line tells the configuration script what sort of
24 operating system this machine is likely to run.
25 USUAL-OPSYS="hpux" */
26
27/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word
28 is the most significant byte. */
29
30#define WORDS_BIG_ENDIAN
31
32/* Define NO_ARG_ARRAY if you cannot take the address of the first of a
33 * group of arguments and treat it as an array of the arguments. */
34
35#define NO_ARG_ARRAY
36
37/* Define WORD_MACHINE if addresses and such have
38 * to be corrected before they can be used as byte counts. */
39
40#undef WORD_MACHINE
41
42/* Now define a symbol for the cpu type, if your compiler
43 does not define it automatically:
44 Ones defined so far include vax, m68000, ns16000, pyramid,
45 orion, tahoe, APOLLO and many others */
46#ifndef hp9000s800
47# define hp9000s800
48#endif
49
50/* Use type int rather than a union, to represent Lisp_Object */
51/* This is desirable for most machines. */
52
53#define NO_UNION_TYPE
54
55/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend
56 the bit field into an int. In other words, if bit fields
57 are always unsigned.
58
59 If you use NO_UNION_TYPE, this flag does not matter. */
60
61#define EXPLICIT_SIGN_EXTEND
62
63/* The standard definitions of these macros would work ok,
64 but these are faster because the constants are short. */
65
66
67#define XUINT(a) (((unsigned)(a) << BITS_PER_INT-VALBITS) >> BITS_PER_INT-VALBITS)
68
69#define XSET(var, type, ptr) \
70 ((var) = ((int)(type) << VALBITS) + (((unsigned) (ptr) << BITS_PER_INT-VALBITS) >> BITS_PER_INT-VALBITS))
71
72/* #ifdef __hpux */
73/* Now define a symbol for the cpu type, if your compiler
74 does not define it automatically:
75 Ones defined so far include vax, m68000, ns16000, pyramid,
76 orion, tahoe, APOLLO and many others */
77
78#ifndef hp9000s800
79# define hp9000s800
80#endif
81
82
83/* Data type of load average, as read out of kmem. */
84
85#define LOAD_AVE_TYPE double
86
87/* Convert that into an integer that is 100 for a load average of 1.0 */
88
89#define LOAD_AVE_CVT(x) ((int) (x * 100.0))
90
91
92/* Define CANNOT_DUMP on machines where unexec does not work.
93 Then the function dump-emacs will not be defined
94 and temacs will do (load "loadup") automatically unless told otherwise. */
95
96#undef CANNOT_DUMP
97
98/* Define VIRT_ADDR_VARIES if the virtual addresses of
99 pure and impure space as loaded can vary, and even their
100 relative order cannot be relied on.
101
102 Otherwise Emacs assumes that text space precedes data space,
103 numerically. */
104
105#define VIRT_ADDR_VARIES
106
107/* the data segment on this machine always starts at address 0x40000000. */
108
109#define DATA_SEG_BITS 0x40000000
110
111#define DATA_START 0x40000000
112#define TEXT_START 0x00000000
113
114/* Define NO_REMAP if memory segmentation makes it not work well
115 to change the boundary between the text section and data section
116 when Emacs is dumped. If you define this, the preloaded Lisp
117 code will not be sharable; but that's better than failing completely. */
118
119#define NO_REMAP
120
121/* This machine requires completely different unexec code
122 which lives in a separate file. Specify the file name. */
123
124#define UNEXEC unexhp9k800.o
125
126#define LIBS_MACHINE
127#define LIBS_DEBUG
128
129/* Include the file bsdtty.h, since this machine has job control. */
130/* #define NEED_BSDTTY */
131
132/* The symbol in the kernel where the load average is found
133 is named _avenrun. At this time there are two major flavors
134 of hp-ux (there is the s800 and s300 (s200) flavors). The
135 differences are thusly moved to the corresponding machine description file.
136*/
137
138/* no underscore please */
139#define LDAV_SYMBOL "avenrun"
140
141#if 0 /* Supposedly no longer true. */
142/* In hpux, for unknown reasons, S_IFLNK is defined even though
143 symbolic links do not exist.
144 Make sure our conditionals based on S_IFLNK are not confused.
145
146 Here we assume that stat.h is included before config.h
147 so that we can override it here. */
148
149#undef S_IFLNK
150#endif
151
152/* On USG systems these have different names. */
153
154#define index strchr
155#define rindex strrchr
156
157/* #endif */
158
159/* arch-tag: 4ced5b51-ffe6-4be1-9954-eb40657023a5
160 (do not change this comment) */
diff --git a/src/macfns.c b/src/macfns.c
index 888c3bdf8e8..849b24ea69b 100644
--- a/src/macfns.c
+++ b/src/macfns.c
@@ -3105,8 +3105,8 @@ If omitted or nil, that stands for the selected frame's display. */)
3105 Lisp_Object display; 3105 Lisp_Object display;
3106{ 3106{
3107 struct mac_display_info *dpyinfo = check_x_display_info (display); 3107 struct mac_display_info *dpyinfo = check_x_display_info (display);
3108 float mm_per_pixel;
3108 3109
3109 /* Only of the main display. */
3110#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 3110#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
3111#if MAC_OS_X_VERSION_MIN_REQUIRED == 1020 3111#if MAC_OS_X_VERSION_MIN_REQUIRED == 1020
3112 if (CGDisplayScreenSize != NULL) 3112 if (CGDisplayScreenSize != NULL)
@@ -3116,9 +3116,8 @@ If omitted or nil, that stands for the selected frame's display. */)
3116 3116
3117 BLOCK_INPUT; 3117 BLOCK_INPUT;
3118 size = CGDisplayScreenSize (kCGDirectMainDisplay); 3118 size = CGDisplayScreenSize (kCGDirectMainDisplay);
3119 mm_per_pixel = size.height / CGDisplayPixelsHigh (kCGDirectMainDisplay);
3119 UNBLOCK_INPUT; 3120 UNBLOCK_INPUT;
3120
3121 return make_number ((int) (size.height + .5f));
3122 } 3121 }
3123#if MAC_OS_X_VERSION_MIN_REQUIRED == 1020 3122#if MAC_OS_X_VERSION_MIN_REQUIRED == 1020
3124 else 3123 else
@@ -3127,9 +3126,11 @@ If omitted or nil, that stands for the selected frame's display. */)
3127#if MAC_OS_X_VERSION_MAX_ALLOWED < 1030 || MAC_OS_X_VERSION_MIN_REQUIRED == 1020 3126#if MAC_OS_X_VERSION_MAX_ALLOWED < 1030 || MAC_OS_X_VERSION_MIN_REQUIRED == 1020
3128 { 3127 {
3129 /* This is an approximation. */ 3128 /* This is an approximation. */
3130 return make_number ((int) (dpyinfo->height * 25.4 / dpyinfo->resy)); 3129 mm_per_pixel = 25.4f / dpyinfo->resy;
3131 } 3130 }
3132#endif 3131#endif
3132
3133 return make_number ((int) (dpyinfo->height * mm_per_pixel + 0.5f));
3133} 3134}
3134 3135
3135DEFUN ("x-display-mm-width", Fx_display_mm_width, Sx_display_mm_width, 0, 1, 0, 3136DEFUN ("x-display-mm-width", Fx_display_mm_width, Sx_display_mm_width, 0, 1, 0,
@@ -3141,8 +3142,8 @@ If omitted or nil, that stands for the selected frame's display. */)
3141 Lisp_Object display; 3142 Lisp_Object display;
3142{ 3143{
3143 struct mac_display_info *dpyinfo = check_x_display_info (display); 3144 struct mac_display_info *dpyinfo = check_x_display_info (display);
3145 float mm_per_pixel;
3144 3146
3145 /* Only of the main display. */
3146#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 3147#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030
3147#if MAC_OS_X_VERSION_MIN_REQUIRED == 1020 3148#if MAC_OS_X_VERSION_MIN_REQUIRED == 1020
3148 if (CGDisplayScreenSize != NULL) 3149 if (CGDisplayScreenSize != NULL)
@@ -3152,9 +3153,8 @@ If omitted or nil, that stands for the selected frame's display. */)
3152 3153
3153 BLOCK_INPUT; 3154 BLOCK_INPUT;
3154 size = CGDisplayScreenSize (kCGDirectMainDisplay); 3155 size = CGDisplayScreenSize (kCGDirectMainDisplay);
3156 mm_per_pixel = size.width / CGDisplayPixelsWide (kCGDirectMainDisplay);
3155 UNBLOCK_INPUT; 3157 UNBLOCK_INPUT;
3156
3157 return make_number ((int) (size.width + .5f));
3158 } 3158 }
3159#if MAC_OS_X_VERSION_MIN_REQUIRED == 1020 3159#if MAC_OS_X_VERSION_MIN_REQUIRED == 1020
3160 else 3160 else
@@ -3163,9 +3163,11 @@ If omitted or nil, that stands for the selected frame's display. */)
3163#if MAC_OS_X_VERSION_MAX_ALLOWED < 1030 || MAC_OS_X_VERSION_MIN_REQUIRED == 1020 3163#if MAC_OS_X_VERSION_MAX_ALLOWED < 1030 || MAC_OS_X_VERSION_MIN_REQUIRED == 1020
3164 { 3164 {
3165 /* This is an approximation. */ 3165 /* This is an approximation. */
3166 return make_number ((int) (dpyinfo->width * 25.4 / dpyinfo->resx)); 3166 mm_per_pixel = 25.4f / dpyinfo->resx;
3167 } 3167 }
3168#endif 3168#endif
3169
3170 return make_number ((int) (dpyinfo->width * mm_per_pixel + 0.5f));
3169} 3171}
3170 3172
3171DEFUN ("x-display-backing-store", Fx_display_backing_store, 3173DEFUN ("x-display-backing-store", Fx_display_backing_store,
@@ -4115,6 +4117,8 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
4115 doc: /* Show STRING in a "tooltip" window on frame FRAME. 4117 doc: /* Show STRING in a "tooltip" window on frame FRAME.
4116A tooltip window is a small window displaying a string. 4118A tooltip window is a small window displaying a string.
4117 4119
4120This is an internal function; Lisp code should call `tooltip-show'.
4121
4118FRAME nil or omitted means use the selected frame. 4122FRAME nil or omitted means use the selected frame.
4119 4123
4120PARMS is an optional list of frame parameters which can be used to 4124PARMS is an optional list of frame parameters which can be used to
diff --git a/src/macselect.c b/src/macselect.c
index 8e86c7651e2..c6aa97d5be9 100644
--- a/src/macselect.c
+++ b/src/macselect.c
@@ -386,7 +386,9 @@ get_scrap_target_type_list (scrap)
386 { 386 {
387 ScrapFlavorType flavor_type = 0; 387 ScrapFlavorType flavor_type = 0;
388 388
389 if (CONSP (XCAR (rest)) && SYMBOLP (target_type = XCAR (XCAR (rest))) 389 if (CONSP (XCAR (rest))
390 && (target_type = XCAR (XCAR (rest)),
391 SYMBOLP (target_type))
390 && (flavor_type = scrap_has_target_type (scrap, target_type))) 392 && (flavor_type = scrap_has_target_type (scrap, target_type)))
391 { 393 {
392 result = Fcons (target_type, result); 394 result = Fcons (target_type, result);
@@ -449,9 +451,11 @@ x_own_selection (selection_name, selection_value)
449 for (rest = Vselection_converter_alist; CONSP (rest); rest = XCDR (rest)) 451 for (rest = Vselection_converter_alist; CONSP (rest); rest = XCDR (rest))
450 { 452 {
451 if (!(CONSP (XCAR (rest)) 453 if (!(CONSP (XCAR (rest))
452 && SYMBOLP (type = XCAR (XCAR (rest))) 454 && (type = XCAR (XCAR (rest)),
455 SYMBOLP (type))
453 && valid_scrap_target_type_p (type) 456 && valid_scrap_target_type_p (type)
454 && SYMBOLP (handler_fn = XCDR (XCAR (rest))))) 457 && (handler_fn = XCDR (XCAR (rest)),
458 SYMBOLP (handler_fn))))
455 continue; 459 continue;
456 460
457 if (!NILP (handler_fn)) 461 if (!NILP (handler_fn))
@@ -1852,10 +1856,7 @@ and the local selection value (whatever was given to `x-own-selection').
1852 1856
1853The function should return the value to send to the Scrap Manager 1857The function should return the value to send to the Scrap Manager
1854\(must be a string). A return value of nil 1858\(must be a string). A return value of nil
1855means that the conversion could not be done. 1859means that the conversion could not be done. */);
1856A return value which is the symbol `NULL'
1857means that a side-effect was executed,
1858and there is no meaningful selection value. */);
1859 Vselection_converter_alist = Qnil; 1860 Vselection_converter_alist = Qnil;
1860 1861
1861 DEFVAR_LISP ("x-lost-selection-functions", &Vx_lost_selection_functions, 1862 DEFVAR_LISP ("x-lost-selection-functions", &Vx_lost_selection_functions,
diff --git a/src/macterm.c b/src/macterm.c
index 3d122215fb3..596d74cddd9 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -7191,11 +7191,14 @@ create_text_encoding_info_alist ()
7191 Lisp_Object existing_info; 7191 Lisp_Object existing_info;
7192 7192
7193 if (!(CONSP (charset_info) 7193 if (!(CONSP (charset_info)
7194 && STRINGP (charset = XCAR (charset_info)) 7194 && (charset = XCAR (charset_info),
7195 STRINGP (charset))
7195 && CONSP (XCDR (charset_info)) 7196 && CONSP (XCDR (charset_info))
7196 && INTEGERP (text_encoding = XCAR (XCDR (charset_info))) 7197 && (text_encoding = XCAR (XCDR (charset_info)),
7198 INTEGERP (text_encoding))
7197 && CONSP (XCDR (XCDR (charset_info))) 7199 && CONSP (XCDR (XCDR (charset_info)))
7198 && SYMBOLP (coding_system = XCAR (XCDR (XCDR (charset_info)))))) 7200 && (coding_system = XCAR (XCDR (XCDR (charset_info))),
7201 SYMBOLP (coding_system))))
7199 continue; 7202 continue;
7200 7203
7201 existing_info = assq_no_quit (text_encoding, result); 7204 existing_info = assq_no_quit (text_encoding, result);
@@ -11535,8 +11538,32 @@ mac_initialize_display_info ()
11535 but this may not be what is actually used. Mac OSX can do better. */ 11538 but this may not be what is actually used. Mac OSX can do better. */
11536 dpyinfo->color_p = CGDisplaySamplesPerPixel (kCGDirectMainDisplay) > 1; 11539 dpyinfo->color_p = CGDisplaySamplesPerPixel (kCGDirectMainDisplay) > 1;
11537 dpyinfo->n_planes = CGDisplayBitsPerPixel (kCGDirectMainDisplay); 11540 dpyinfo->n_planes = CGDisplayBitsPerPixel (kCGDirectMainDisplay);
11538 dpyinfo->height = CGDisplayPixelsHigh (kCGDirectMainDisplay); 11541 {
11539 dpyinfo->width = CGDisplayPixelsWide (kCGDirectMainDisplay); 11542 CGDisplayErr err;
11543 CGDisplayCount ndisps;
11544 CGDirectDisplayID *displays;
11545
11546 err = CGGetActiveDisplayList (0, NULL, &ndisps);
11547 if (err == noErr)
11548 {
11549 displays = alloca (sizeof (CGDirectDisplayID) * ndisps);
11550 err = CGGetActiveDisplayList (ndisps, displays, &ndisps);
11551 }
11552 if (err == noErr)
11553 {
11554 CGRect bounds = CGRectMake (0, 0, 0, 0);
11555
11556 while (ndisps-- > 0)
11557 bounds = CGRectUnion (bounds, CGDisplayBounds (displays[ndisps]));
11558 dpyinfo->height = CGRectGetHeight (bounds);
11559 dpyinfo->width = CGRectGetWidth (bounds);
11560 }
11561 else
11562 {
11563 dpyinfo->height = CGDisplayPixelsHigh (kCGDirectMainDisplay);
11564 dpyinfo->width = CGDisplayPixelsWide (kCGDirectMainDisplay);
11565 }
11566 }
11540#else 11567#else
11541 { 11568 {
11542 GDHandle main_device_handle = LMGetMainDevice(); 11569 GDHandle main_device_handle = LMGetMainDevice();
diff --git a/src/print.c b/src/print.c
index eb549fd18c0..855bcce6ef6 100644
--- a/src/print.c
+++ b/src/print.c
@@ -796,7 +796,7 @@ A printed representation of an object is text which describes that object. */)
796 Lisp_Object printcharfun; 796 Lisp_Object printcharfun;
797 /* struct gcpro gcpro1, gcpro2; */ 797 /* struct gcpro gcpro1, gcpro2; */
798 Lisp_Object save_deactivate_mark; 798 Lisp_Object save_deactivate_mark;
799 int count = specpdl_ptr - specpdl; 799 int count = SPECPDL_INDEX ();
800 struct buffer *previous; 800 struct buffer *previous;
801 801
802 specbind (Qinhibit_modification_hooks, Qt); 802 specbind (Qinhibit_modification_hooks, Qt);
diff --git a/src/process.c b/src/process.c
index ad637ad6cfa..2e41267479c 100644
--- a/src/process.c
+++ b/src/process.c
@@ -1267,7 +1267,7 @@ Returns nil if format of ADDRESS is invalid. */)
1267 if (VECTORP (address)) /* AF_INET or AF_INET6 */ 1267 if (VECTORP (address)) /* AF_INET or AF_INET6 */
1268 { 1268 {
1269 register struct Lisp_Vector *p = XVECTOR (address); 1269 register struct Lisp_Vector *p = XVECTOR (address);
1270 Lisp_Object args[6]; 1270 Lisp_Object args[10];
1271 int nargs, i; 1271 int nargs, i;
1272 1272
1273 if (p->size == 4 || (p->size == 5 && !NILP (omit_port))) 1273 if (p->size == 4 || (p->size == 5 && !NILP (omit_port)))
@@ -1294,7 +1294,20 @@ Returns nil if format of ADDRESS is invalid. */)
1294 return Qnil; 1294 return Qnil;
1295 1295
1296 for (i = 0; i < nargs; i++) 1296 for (i = 0; i < nargs; i++)
1297 args[i+1] = p->contents[i]; 1297 {
1298 EMACS_INT element = XINT (p->contents[i]);
1299
1300 if (element < 0 || element > 65535)
1301 return Qnil;
1302
1303 if (nargs <= 5 /* IPv4 */
1304 && i < 4 /* host, not port */
1305 && element > 255)
1306 return Qnil;
1307
1308 args[i+1] = p->contents[i];
1309 }
1310
1298 return Fformat (nargs+1, args); 1311 return Fformat (nargs+1, args);
1299 } 1312 }
1300 1313
@@ -1304,7 +1317,6 @@ Returns nil if format of ADDRESS is invalid. */)
1304 args[0] = build_string ("<Family %d>"); 1317 args[0] = build_string ("<Family %d>");
1305 args[1] = Fcar (address); 1318 args[1] = Fcar (address);
1306 return Fformat (2, args); 1319 return Fformat (2, args);
1307
1308 } 1320 }
1309 1321
1310 return Qnil; 1322 return Qnil;
@@ -1410,7 +1422,6 @@ list_processes_1 (query_only)
1410 if (CONSP (p->status)) 1422 if (CONSP (p->status))
1411 symbol = XCAR (p->status); 1423 symbol = XCAR (p->status);
1412 1424
1413
1414 if (EQ (symbol, Qsignal)) 1425 if (EQ (symbol, Qsignal))
1415 { 1426 {
1416 Lisp_Object tem; 1427 Lisp_Object tem;
@@ -4805,8 +4816,8 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4805 subprocess termination and SIGCHLD. */ 4816 subprocess termination and SIGCHLD. */
4806 else if (nread == 0 && !NETCONN_P (proc)) 4817 else if (nread == 0 && !NETCONN_P (proc))
4807 ; 4818 ;
4808#endif /* O_NDELAY */ 4819#endif /* O_NDELAY */
4809#endif /* O_NONBLOCK */ 4820#endif /* O_NONBLOCK */
4810#ifdef HAVE_PTYS 4821#ifdef HAVE_PTYS
4811 /* On some OSs with ptys, when the process on one end of 4822 /* On some OSs with ptys, when the process on one end of
4812 a pty exits, the other end gets an error reading with 4823 a pty exits, the other end gets an error reading with
@@ -4817,11 +4828,17 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4817 get a SIGCHLD). 4828 get a SIGCHLD).
4818 4829
4819 However, it has been known to happen that the SIGCHLD 4830 However, it has been known to happen that the SIGCHLD
4820 got lost. So raise the signl again just in case. 4831 got lost. So raise the signal again just in case.
4821 It can't hurt. */ 4832 It can't hurt. */
4822 else if (nread == -1 && errno == EIO) 4833 else if (nread == -1 && errno == EIO)
4823 kill (getpid (), SIGCHLD); 4834 {
4824#endif /* HAVE_PTYS */ 4835 /* Clear the descriptor now, so we only raise the signal once. */
4836 FD_CLR (channel, &input_wait_mask);
4837 FD_CLR (channel, &non_keyboard_wait_mask);
4838
4839 kill (getpid (), SIGCHLD);
4840 }
4841#endif /* HAVE_PTYS */
4825 /* If we can detect process termination, don't consider the process 4842 /* If we can detect process termination, don't consider the process
4826 gone just because its pipe is closed. */ 4843 gone just because its pipe is closed. */
4827#ifdef SIGCHLD 4844#ifdef SIGCHLD
@@ -6407,17 +6424,12 @@ sigchld_handler (signo)
6407#define WUNTRACED 0 6424#define WUNTRACED 0
6408#endif /* no WUNTRACED */ 6425#endif /* no WUNTRACED */
6409 /* Keep trying to get a status until we get a definitive result. */ 6426 /* Keep trying to get a status until we get a definitive result. */
6410 while (1) 6427 do
6411 { 6428 {
6412 errno = 0; 6429 errno = 0;
6413 pid = wait3 (&w, WNOHANG | WUNTRACED, 0); 6430 pid = wait3 (&w, WNOHANG | WUNTRACED, 0);
6414 if (! (pid < 0 && errno == EINTR))
6415 break;
6416 /* Avoid a busyloop: wait3 is a system call, so we do not want
6417 to prevent the kernel from actually sending SIGCHLD to emacs
6418 by asking for it all the time. */
6419 sleep (1);
6420 } 6431 }
6432 while (pid < 0 && errno == EINTR);
6421 6433
6422 if (pid <= 0) 6434 if (pid <= 0)
6423 { 6435 {
diff --git a/src/s/darwin.h b/src/s/darwin.h
index 7175ea5457c..cb032429f7d 100644
--- a/src/s/darwin.h
+++ b/src/s/darwin.h
@@ -121,7 +121,7 @@ Boston, MA 02110-1301, USA. */
121 * default for process-connection-type dependent on the kernel 121 * default for process-connection-type dependent on the kernel
122 * version. 122 * version.
123 */ 123 */
124#define MIN_PTY_KERNEL_VERSION '7' 124#define MIN_PTY_KERNEL_VERSION '7'
125 125
126/* 126/*
127 * Define NONSYSTEM_DIR_LIBRARY to make Emacs emulate 127 * Define NONSYSTEM_DIR_LIBRARY to make Emacs emulate
@@ -216,9 +216,6 @@ Boston, MA 02110-1301, USA. */
216 also the name of a Mach system call. */ 216 also the name of a Mach system call. */
217#define init_process emacs_init_process 217#define init_process emacs_init_process
218 218
219/* Fix compilation problem for regex.c. */
220#define __restrict
221
222/* Used in dispnew.c. Copied from freebsd.h. */ 219/* Used in dispnew.c. Copied from freebsd.h. */
223#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base) 220#define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base)
224 221
@@ -262,9 +259,8 @@ Boston, MA 02110-1301, USA. */
262 259
263/* Definitions for how to compile & link. */ 260/* Definitions for how to compile & link. */
264 261
265/* Indicate that we are compiling for Mac OS X and where to find Mac 262/* Indicate that we are compiling for Mac OS X. */
266 specific headers. */ 263#define C_SWITCH_SYSTEM -fpascal-strings -DMAC_OSX
267#define C_SWITCH_SYSTEM -fpascal-strings -DMAC_OSX -I../mac/src
268 264
269/* Link in the Carbon lib. */ 265/* Link in the Carbon lib. */
270#ifdef HAVE_CARBON 266#ifdef HAVE_CARBON
@@ -317,13 +313,6 @@ Boston, MA 02110-1301, USA. */
317#define NO_MATHERR 313#define NO_MATHERR
318 314
319 315
320/* This prevents a compilation error in xfaces.c: struct kboard * is
321 used in a function protocol the first time this type appears in the
322 file, since MULTI_KBOARD is undefined for the Mac OS X build. */
323#ifndef NOT_C_CODE
324struct kboard;
325#endif
326
327/* The following solves the problem that Emacs hangs when evaluating 316/* The following solves the problem that Emacs hangs when evaluating
328 (make-comint "test0" "/nodir/nofile" nil "") when /nodir/nofile 317 (make-comint "test0" "/nodir/nofile" nil "") when /nodir/nofile
329 does not exist. */ 318 does not exist. */
diff --git a/src/undo.c b/src/undo.c
index 0eca97df566..7a6ba37d0f8 100644
--- a/src/undo.c
+++ b/src/undo.c
@@ -548,6 +548,8 @@ Return what remains of the list. */)
548 beg = Fcar (cdr); 548 beg = Fcar (cdr);
549 end = Fcdr (cdr); 549 end = Fcdr (cdr);
550 550
551 if (XINT (beg) < BEGV || XINT (end) > ZV)
552 error ("Changes to be undone are outside visible portion of buffer");
551 Fput_text_property (beg, end, prop, val, Qnil); 553 Fput_text_property (beg, end, prop, val, Qnil);
552 } 554 }
553 else if (INTEGERP (car) && INTEGERP (cdr)) 555 else if (INTEGERP (car) && INTEGERP (cdr))
diff --git a/src/unexhp9k800.c b/src/unexhp9k800.c
new file mode 100644
index 00000000000..495094029d6
--- /dev/null
+++ b/src/unexhp9k800.c
@@ -0,0 +1,334 @@
1/* Unexec for HP 9000 Series 800 machines.
2
3 This file is in the public domain.
4
5 Author: John V. Morris
6
7 This file was written by John V. Morris at Hewlett Packard.
8 Both the author and Hewlett Packard Co. have disclaimed the
9 copyright on this file, and it is therefore in the public domain.
10 (Search for "hp9k800" in copyright.list.)
11*/
12
13/*
14 Bob Desinger <hpsemc!bd@hplabs.hp.com>
15
16 Note that the GNU project considers support for HP operation a
17 peripheral activity which should not be allowed to divert effort
18 from development of the GNU system. Changes in this code will be
19 installed when users send them in, but aside from that we don't
20 plan to think about it, or about whether other Emacs maintenance
21 might break it.
22
23
24 Unexec creates a copy of the old a.out file, and replaces the old data
25 area with the current data area. When the new file is executed, the
26 process will see the same data structures and data values that the
27 original process had when unexec was called.
28
29 Unlike other versions of unexec, this one copies symbol table and
30 debug information to the new a.out file. Thus, the new a.out file
31 may be debugged with symbolic debuggers.
32
33 If you fix any bugs in this, I'd like to incorporate your fixes.
34 Send them to uunet!hpda!hpsemc!jmorris or jmorris%hpsemc@hplabs.HP.COM.
35
36 CAVEATS:
37 This routine saves the current value of all static and external
38 variables. This means that any data structure that needs to be
39 initialized must be explicitly reset. Variables will not have their
40 expected default values.
41
42 Unfortunately, the HP-UX signal handler has internal initialization
43 flags which are not explicitly reset. Thus, for signals to work in
44 conjunction with this routine, the following code must executed when
45 the new process starts up.
46
47 void _sigreturn ();
48 ...
49 sigsetreturn (_sigreturn);
50*/
51
52#ifdef emacs
53#include <config.h>
54#endif
55
56#include <stdio.h>
57#include <fcntl.h>
58#include <errno.h>
59
60#include <a.out.h>
61
62#ifdef HPUX_USE_SHLIBS
63#include <dl.h>
64#endif
65
66/* brk value to restore, stored as a global.
67 This is really used only if we used shared libraries. */
68static long brk_on_dump = 0;
69
70/* Called from main, if we use shared libraries. */
71int
72run_time_remap (ignored)
73 char *ignored;
74{
75 brk ((char *) brk_on_dump);
76}
77
78#undef roundup
79#define roundup(x,n) (((x) + ((n) - 1)) & ~((n) - 1)) /* n is power of 2 */
80#define min(x,y) (((x) < (y)) ? (x) : (y))
81
82
83/* Create a new a.out file, same as old but with current data space */
84
85unexec (new_name, old_name, new_end_of_text, dummy1, dummy2)
86 char new_name[]; /* name of the new a.out file to be created */
87 char old_name[]; /* name of the old a.out file */
88 char *new_end_of_text; /* ptr to new edata/etext; NOT USED YET */
89 int dummy1, dummy2; /* not used by emacs */
90{
91 int old, new;
92 int old_size, new_size;
93 struct header hdr;
94 struct som_exec_auxhdr auxhdr;
95 long i;
96
97 /* For the greatest flexibility, should create a temporary file in
98 the same directory as the new file. When everything is complete,
99 rename the temp file to the new name.
100 This way, a program could update its own a.out file even while
101 it is still executing. If problems occur, everything is still
102 intact. NOT implemented. */
103
104 /* Open the input and output a.out files */
105 old = open (old_name, O_RDONLY);
106 if (old < 0)
107 { perror (old_name); exit (1); }
108 new = open (new_name, O_CREAT|O_RDWR|O_TRUNC, 0777);
109 if (new < 0)
110 { perror (new_name); exit (1); }
111
112 /* Read the old headers */
113 read_header (old, &hdr, &auxhdr);
114
115 brk_on_dump = (long) sbrk (0);
116
117 /* Decide how large the new and old data areas are */
118 old_size = auxhdr.exec_dsize;
119 /* I suspect these two statements are separate
120 to avoid a compiler bug in hpux version 8. */
121 i = (long) sbrk (0);
122 new_size = i - auxhdr.exec_dmem;
123
124 /* Copy the old file to the new, up to the data space */
125 lseek (old, 0, 0);
126 copy_file (old, new, auxhdr.exec_dfile);
127
128 /* Skip the old data segment and write a new one */
129 lseek (old, old_size, 1);
130 save_data_space (new, &hdr, &auxhdr, new_size);
131
132 /* Copy the rest of the file */
133 copy_rest (old, new);
134
135 /* Update file pointers since we probably changed size of data area */
136 update_file_ptrs (new, &hdr, &auxhdr, auxhdr.exec_dfile, new_size-old_size);
137
138 /* Save the modified header */
139 write_header (new, &hdr, &auxhdr);
140
141 /* Close the binary file */
142 close (old);
143 close (new);
144 return 0;
145}
146
147/* Save current data space in the file, update header. */
148
149save_data_space (file, hdr, auxhdr, size)
150 int file;
151 struct header *hdr;
152 struct som_exec_auxhdr *auxhdr;
153 int size;
154{
155 /* Write the entire data space out to the file */
156 if (write (file, auxhdr->exec_dmem, size) != size)
157 { perror ("Can't save new data space"); exit (1); }
158
159 /* Update the header to reflect the new data size */
160 auxhdr->exec_dsize = size;
161 auxhdr->exec_bsize = 0;
162}
163
164/* Update the values of file pointers when something is inserted. */
165
166update_file_ptrs (file, hdr, auxhdr, location, offset)
167 int file;
168 struct header *hdr;
169 struct som_exec_auxhdr *auxhdr;
170 unsigned int location;
171 int offset;
172{
173 struct subspace_dictionary_record subspace;
174 int i;
175
176 /* Increase the overall size of the module */
177 hdr->som_length += offset;
178
179 /* Update the various file pointers in the header */
180#define update(ptr) if (ptr > location) ptr = ptr + offset
181 update (hdr->aux_header_location);
182 update (hdr->space_strings_location);
183 update (hdr->init_array_location);
184 update (hdr->compiler_location);
185 update (hdr->symbol_location);
186 update (hdr->fixup_request_location);
187 update (hdr->symbol_strings_location);
188 update (hdr->unloadable_sp_location);
189 update (auxhdr->exec_tfile);
190 update (auxhdr->exec_dfile);
191
192 /* Do for each subspace dictionary entry */
193 lseek (file, hdr->subspace_location, 0);
194 for (i = 0; i < hdr->subspace_total; i++)
195 {
196 if (read (file, &subspace, sizeof (subspace)) != sizeof (subspace))
197 { perror ("Can't read subspace record"); exit (1); }
198
199 /* If subspace has a file location, update it */
200 if (subspace.initialization_length > 0
201 && subspace.file_loc_init_value > location)
202 {
203 subspace.file_loc_init_value += offset;
204 lseek (file, -sizeof (subspace), 1);
205 if (write (file, &subspace, sizeof (subspace)) != sizeof (subspace))
206 { perror ("Can't update subspace record"); exit (1); }
207 }
208 }
209
210 /* Do for each initialization pointer record */
211 /* (I don't think it applies to executable files, only relocatables) */
212#undef update
213}
214
215/* Read in the header records from an a.out file. */
216
217read_header (file, hdr, auxhdr)
218 int file;
219 struct header *hdr;
220 struct som_exec_auxhdr *auxhdr;
221{
222
223 /* Read the header in */
224 lseek (file, 0, 0);
225 if (read (file, hdr, sizeof (*hdr)) != sizeof (*hdr))
226 { perror ("Couldn't read header from a.out file"); exit (1); }
227
228 if (hdr->a_magic != EXEC_MAGIC && hdr->a_magic != SHARE_MAGIC
229 && hdr->a_magic != DEMAND_MAGIC)
230 {
231 fprintf (stderr, "a.out file doesn't have legal magic number\n");
232 exit (1);
233 }
234
235 lseek (file, hdr->aux_header_location, 0);
236 if (read (file, auxhdr, sizeof (*auxhdr)) != sizeof (*auxhdr))
237 {
238 perror ("Couldn't read auxiliary header from a.out file");
239 exit (1);
240 }
241}
242
243/* Write out the header records into an a.out file. */
244
245write_header (file, hdr, auxhdr)
246 int file;
247 struct header *hdr;
248 struct som_exec_auxhdr *auxhdr;
249{
250 /* Update the checksum */
251 hdr->checksum = calculate_checksum (hdr);
252
253 /* Write the header back into the a.out file */
254 lseek (file, 0, 0);
255 if (write (file, hdr, sizeof (*hdr)) != sizeof (*hdr))
256 { perror ("Couldn't write header to a.out file"); exit (1); }
257 lseek (file, hdr->aux_header_location, 0);
258 if (write (file, auxhdr, sizeof (*auxhdr)) != sizeof (*auxhdr))
259 { perror ("Couldn't write auxiliary header to a.out file"); exit (1); }
260}
261
262/* Calculate the checksum of a SOM header record. */
263
264calculate_checksum (hdr)
265 struct header *hdr;
266{
267 int checksum, i, *ptr;
268
269 checksum = 0; ptr = (int *) hdr;
270
271 for (i = 0; i < sizeof (*hdr) / sizeof (int) - 1; i++)
272 checksum ^= ptr[i];
273
274 return (checksum);
275}
276
277/* Copy size bytes from the old file to the new one. */
278
279copy_file (old, new, size)
280 int new, old;
281 int size;
282{
283 int len;
284 int buffer[8192]; /* word aligned will be faster */
285
286 for (; size > 0; size -= len)
287 {
288 len = min (size, sizeof (buffer));
289 if (read (old, buffer, len) != len)
290 { perror ("Read failure on a.out file"); exit (1); }
291 if (write (new, buffer, len) != len)
292 { perror ("Write failure in a.out file"); exit (1); }
293 }
294}
295
296/* Copy the rest of the file, up to EOF. */
297
298copy_rest (old, new)
299 int new, old;
300{
301 int buffer[4096];
302 int len;
303
304 /* Copy bytes until end of file or error */
305 while ((len = read (old, buffer, sizeof (buffer))) > 0)
306 if (write (new, buffer, len) != len) break;
307
308 if (len != 0)
309 { perror ("Unable to copy the rest of the file"); exit (1); }
310}
311
312#ifdef DEBUG
313display_header (hdr, auxhdr)
314 struct header *hdr;
315 struct som_exec_auxhdr *auxhdr;
316{
317 /* Display the header information (debug) */
318 printf ("\n\nFILE HEADER\n");
319 printf ("magic number %d \n", hdr->a_magic);
320 printf ("text loc %.8x size %d \n", auxhdr->exec_tmem, auxhdr->exec_tsize);
321 printf ("data loc %.8x size %d \n", auxhdr->exec_dmem, auxhdr->exec_dsize);
322 printf ("entry %x \n", auxhdr->exec_entry);
323 printf ("Bss segment size %u\n", auxhdr->exec_bsize);
324 printf ("\n");
325 printf ("data file loc %d size %d\n",
326 auxhdr->exec_dfile, auxhdr->exec_dsize);
327 printf ("som_length %d\n", hdr->som_length);
328 printf ("unloadable sploc %d size %d\n",
329 hdr->unloadable_sp_location, hdr->unloadable_sp_size);
330}
331#endif /* DEBUG */
332
333/* arch-tag: d55a09ac-9427-4ec4-8496-cb9d7710774f
334 (do not change this comment) */
diff --git a/src/w32fns.c b/src/w32fns.c
index 5a938622383..20442941668 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -7560,6 +7560,8 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
7560 doc: /* Show STRING in a \"tooltip\" window on frame FRAME. 7560 doc: /* Show STRING in a \"tooltip\" window on frame FRAME.
7561A tooltip window is a small window displaying a string. 7561A tooltip window is a small window displaying a string.
7562 7562
7563This is an internal function; Lisp code should call `tooltip-show'.
7564
7563FRAME nil or omitted means use the selected frame. 7565FRAME nil or omitted means use the selected frame.
7564 7566
7565PARMS is an optional list of frame parameters which can be 7567PARMS is an optional list of frame parameters which can be
diff --git a/src/widget.c b/src/widget.c
index c6ba3be468b..e6388a7d158 100644
--- a/src/widget.c
+++ b/src/widget.c
@@ -953,9 +953,11 @@ EmacsFrameSetCharSize (widget, columns, rows)
953 Xt when the default font is changed. Tell Xt not to wait, 953 Xt when the default font is changed. Tell Xt not to wait,
954 depending on the value of the frame parameter 954 depending on the value of the frame parameter
955 `wait-for-wm'. */ 955 `wait-for-wm'. */
956 x_catch_errors (FRAME_X_DISPLAY (f));
956 XtVaSetValues (f->output_data.x->widget, 957 XtVaSetValues (f->output_data.x->widget,
957 XtNwaitForWm, (XtArgVal) f->output_data.x->wait_for_wm, 958 XtNwaitForWm, (XtArgVal) f->output_data.x->wait_for_wm,
958 NULL); 959 NULL);
960 x_uncatch_errors ();
959 961
960 /* Workaround: When a SIGIO or SIGALRM occurs while Xt is 962 /* Workaround: When a SIGIO or SIGALRM occurs while Xt is
961 waiting for a ConfigureNotify event (see above), this leads 963 waiting for a ConfigureNotify event (see above), this leads
@@ -972,6 +974,7 @@ EmacsFrameSetCharSize (widget, columns, rows)
972 as is because I think it can't do any harm. */ 974 as is because I think it can't do any harm. */
973 /* In April 2002, simon.marshall@misys.com reports the problem 975 /* In April 2002, simon.marshall@misys.com reports the problem
974 seems not to occur any longer. */ 976 seems not to occur any longer. */
977 x_catch_errors (FRAME_X_DISPLAY (f));
975 XtVaSetValues (f->output_data.x->widget, 978 XtVaSetValues (f->output_data.x->widget,
976 XtNheight, (XtArgVal) (outer_widget_height + hdelta), 979 XtNheight, (XtArgVal) (outer_widget_height + hdelta),
977 XtNwidth, (XtArgVal) (outer_widget_width + wdelta), 980 XtNwidth, (XtArgVal) (outer_widget_width + wdelta),
@@ -984,6 +987,8 @@ EmacsFrameSetCharSize (widget, columns, rows)
984 XtNheight, (XtArgVal) pixel_height, 987 XtNheight, (XtArgVal) pixel_height,
985 XtNwidth, (XtArgVal) pixel_width, 988 XtNwidth, (XtArgVal) pixel_width,
986 NULL); 989 NULL);
990 x_uncatch_errors ();
991
987#ifdef SIGIO 992#ifdef SIGIO
988 sigunblock (sigmask (SIGIO)); 993 sigunblock (sigmask (SIGIO));
989#endif 994#endif
diff --git a/src/window.c b/src/window.c
index 508ddadae9a..3fb558d637a 100644
--- a/src/window.c
+++ b/src/window.c
@@ -2314,6 +2314,8 @@ check_all_windows ()
2314 2314
2315DEFUN ("get-lru-window", Fget_lru_window, Sget_lru_window, 0, 2, 0, 2315DEFUN ("get-lru-window", Fget_lru_window, Sget_lru_window, 0, 2, 0,
2316 doc: /* Return the window least recently selected or used for display. 2316 doc: /* Return the window least recently selected or used for display.
2317\(LRU means Least Recently Used.)
2318
2317Return a full-width window if possible. 2319Return a full-width window if possible.
2318A minibuffer window is never a candidate. 2320A minibuffer window is never a candidate.
2319A dedicated window is never a candidate, unless DEDICATED is non-nil, 2321A dedicated window is never a candidate, unless DEDICATED is non-nil,
diff --git a/src/xdisp.c b/src/xdisp.c
index 8f1c3a6c241..5c273540c41 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -22742,7 +22742,7 @@ note_mode_line_or_margin_highlight (window, x, y, area)
22742 22742
22743 Lisp_Object mouse_face; 22743 Lisp_Object mouse_face;
22744 int original_x_pixel = x; 22744 int original_x_pixel = x;
22745 struct glyph * glyph = NULL; 22745 struct glyph * glyph = NULL, * row_start_glyph = NULL;
22746 struct glyph_row *row; 22746 struct glyph_row *row;
22747 22747
22748 if (area == ON_MODE_LINE || area == ON_HEADER_LINE) 22748 if (area == ON_MODE_LINE || area == ON_HEADER_LINE)
@@ -22760,7 +22760,7 @@ note_mode_line_or_margin_highlight (window, x, y, area)
22760 /* Find glyph */ 22760 /* Find glyph */
22761 if (row->mode_line_p && row->enabled_p) 22761 if (row->mode_line_p && row->enabled_p)
22762 { 22762 {
22763 glyph = row->glyphs[TEXT_AREA]; 22763 glyph = row_start_glyph = row->glyphs[TEXT_AREA];
22764 end = glyph + row->used[TEXT_AREA]; 22764 end = glyph + row->used[TEXT_AREA];
22765 22765
22766 for (x0 = original_x_pixel; 22766 for (x0 = original_x_pixel;
@@ -22884,12 +22884,17 @@ note_mode_line_or_margin_highlight (window, x, y, area)
22884 is converted to a flatten by emacs lisp interpreter. 22884 is converted to a flatten by emacs lisp interpreter.
22885 The internal string is an element of the structures. 22885 The internal string is an element of the structures.
22886 The displayed string is the flatten string. */ 22886 The displayed string is the flatten string. */
22887 for (tmp_glyph = glyph - 1, gpos = 0; 22887 gpos = 0;
22888 tmp_glyph->charpos >= XINT (b); 22888 if (glyph > row_start_glyph)
22889 tmp_glyph--, gpos++)
22890 { 22889 {
22891 if (!EQ (tmp_glyph->object, glyph->object)) 22890 tmp_glyph = glyph - 1;
22892 break; 22891 while (tmp_glyph >= row_start_glyph
22892 && tmp_glyph->charpos >= XINT (b)
22893 && EQ (tmp_glyph->object, glyph->object))
22894 {
22895 tmp_glyph--;
22896 gpos++;
22897 }
22893 } 22898 }
22894 22899
22895 /* Calculate the lenght(glyph sequence length: GSEQ_LENGTH) of 22900 /* Calculate the lenght(glyph sequence length: GSEQ_LENGTH) of
@@ -24370,7 +24375,7 @@ and is used only on frames for which no explicit name has been set
24370 doc: /* Maximum number of lines to keep in the message log buffer. 24375 doc: /* Maximum number of lines to keep in the message log buffer.
24371If nil, disable message logging. If t, log messages but don't truncate 24376If nil, disable message logging. If t, log messages but don't truncate
24372the buffer when it becomes large. */); 24377the buffer when it becomes large. */);
24373 Vmessage_log_max = make_number (50); 24378 Vmessage_log_max = make_number (100);
24374 24379
24375 DEFVAR_LISP ("window-size-change-functions", &Vwindow_size_change_functions, 24380 DEFVAR_LISP ("window-size-change-functions", &Vwindow_size_change_functions,
24376 doc: /* Functions called before redisplay, if window sizes have changed. 24381 doc: /* Functions called before redisplay, if window sizes have changed.
diff --git a/src/xfns.c b/src/xfns.c
index 74f20357657..9fee9c52da4 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -5267,6 +5267,8 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
5267 doc: /* Show STRING in a "tooltip" window on frame FRAME. 5267 doc: /* Show STRING in a "tooltip" window on frame FRAME.
5268A tooltip window is a small X window displaying a string. 5268A tooltip window is a small X window displaying a string.
5269 5269
5270This is an internal function; Lisp code should call `tooltip-show'.
5271
5270FRAME nil or omitted means use the selected frame. 5272FRAME nil or omitted means use the selected frame.
5271 5273
5272PARMS is an optional list of frame parameters which can be used to 5274PARMS is an optional list of frame parameters which can be used to