aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKaroly Lorentey2007-04-22 12:42:47 +0000
committerKaroly Lorentey2007-04-22 12:42:47 +0000
commit9d0799072a0d09bc14a99eaf372b262d1ba61399 (patch)
tree76acd4ae0559776a5ec27fbd5c25598285ec71d1 /src
parente18c709364b095ea0be8ecabe458ac9a642a252f (diff)
parenta20becf321f023c6dc1831595712576d64e2ef4b (diff)
downloademacs-9d0799072a0d09bc14a99eaf372b262d1ba61399.tar.gz
emacs-9d0799072a0d09bc14a99eaf372b262d1ba61399.zip
Merged from emacs@sv.gnu.org
Patches applied: * emacs@sv.gnu.org/emacs--devo--0--patch-674 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-675 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-676 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-677 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-678 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-679 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-680 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-681 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-682 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-683 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-684 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-685 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-686 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-687 Release ERC 5.2. * emacs@sv.gnu.org/emacs--devo--0--patch-688 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-689 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-690 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-691 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-692 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-693 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-694 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-695 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-696 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-697 Merge from gnus--rel--5.10 * emacs@sv.gnu.org/emacs--devo--0--patch-698 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-699 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-700 Update from CVS * emacs@sv.gnu.org/emacs--devo--0--patch-701 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-209 Merge from emacs--devo--0 * emacs@sv.gnu.org/gnus--rel--5.10--patch-210 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-211 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-212 Merge from emacs--devo--0 * emacs@sv.gnu.org/gnus--rel--5.10--patch-213 Update from CVS * emacs@sv.gnu.org/gnus--rel--5.10--patch-214 Merge from emacs--devo--0 * emacs@sv.gnu.org/gnus--rel--5.10--patch-215 Update from CVS git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-601
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog251
-rw-r--r--src/ChangeLog.52
-rw-r--r--src/alloc.c4
-rw-r--r--src/buffer.c11
-rw-r--r--src/dispnew.c35
-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.c6
-rw-r--r--src/m/hp800.h77
-rw-r--r--src/m/sr2k.h160
-rw-r--r--src/mac.c5
-rw-r--r--src/macfns.c20
-rw-r--r--src/macselect.c15
-rw-r--r--src/macterm.c197
-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.c81
-rw-r--r--src/xfns.c2
32 files changed, 1301 insertions, 247 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 76414a593f6..e325d82f04a 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,208 @@
12007-04-16 Chong Yidong <cyd@stupidchicken.com>
2
3 * dispnew.c (adjust_frame_glyphs_for_frame_redisplay): Set
4 garbaged flag in presence of window margins.
5 (showing_window_margins_p): New function.
6
7 * xdisp.c (cursor_row_p): Only end row on newline if it's a
8 display string. Suggested by Lennart Borgman.
9
102007-04-16 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
11
12 * alloc.c (mem_insert): Set min_heap_address and max_heap_address
13 if they are not yet initialized.
14
152007-04-15 Chong Yidong <cyd@stupidchicken.com>
16
17 * xdisp.c (redisplay_window): When deciding whether or not to
18 recenter, don't use the reset values of BEG_UNCHANGED and
19 END_UNCHANGED.
20
212007-04-13 Kim F. Storm <storm@cua.dk>
22
23 * buffer.c (Fkill_buffer): gcpro BUF during kill_buffer_processes
24 and check that buffer is still alive upon return.
25
262007-04-13 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
27
28 * macterm.c [!TARGET_API_MAC_CARBON]: Include Displays.h.
29 (mac_screen_config_changed): New variable.
30 (mac_handle_dm_notification, init_dm_notification_handler)
31 (mac_get_screen_info): New functions.
32 [MAC_OS8] (main): Call init_dm_notification_handler.
33 (mac_initialize) [MAC_OSX]: Likewise.
34 (XTread_socket): Call mac_get_screen_info if screen config changed.
35 (mac_initialized): Make static.
36 (mac_initialize_display_info): Remove function.
37 (mac_term_init): Call mac_get_screen_info. Add partial contents of
38 mac_initialize_display_info.
39
402007-04-12 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
41
42 * mac.c (xrm_get_preference_database, Fmac_get_preference)
43 [TARGET_API_MAC_CARBON]: Use CFPreferencesAppSynchronize.
44
45 * macterm.c [TARGET_API_MAC_CARBON] (mac_post_mouse_moved_event):
46 Use GetGlobalMouse instead of GetMouse and LocalToGlobal.
47 (mac_initialize_display_info) [MAC_OSX]: Use CGRectZero.
48 (mac_initialize_display_info) [!MAC_OSX]: dpyinfo->height and
49 dpyinfo->width are those of whole screen.
50
512007-04-10 Chong Yidong <cyd@stupidchicken.com>
52
53 * xdisp.c (note_mode_line_or_margin_highlight): Don't decrement
54 glyph pointer before start of glyph row.
55
562007-04-09 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
57
58 * s/darwin.h (__restrict, struct kboard): Remove outdated workarounds.
59 (C_SWITCH_SYSTEM): Remove `-I../mac/src'.
60
612007-04-09 Martin Rudalics <rudalics@gmx.at>
62
63 * indent.c (Fmove_to_column): Set next_boundary with correct start pt.
64
652007-04-08 Richard Stallman <rms@gnu.org>
66
67 * xdisp.c (syms_of_xdisp) <message-log-max>: Default 100.
68
692007-04-07 Chong Yidong <cyd@stupidchicken.com>
70
71 * editfns.c (Ftranspose_regions): Validate interval before setting
72 text properties.
73
742007-04-03 Eli Zaretskii <eliz@gnu.org>
75
76 * emacs.c (main): Fix instructions for building Emacs for profiling.
77
782007-04-03 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
79
80 * gtkutil.c (xg_update_menubar): Call g_list_next after moving
81 menu bar item.
82
832007-04-02 Juanma Barranquero <lekktu@gmail.com>
84
85 * print.c (Fprin1_to_string): Use macro SPECPDL_INDEX.
86
872007-04-01 Chong Yidong <cyd@stupidchicken.com>
88
89 * keymap.c (Fcommand_remapping): New optional argument.
90 (where_is_internal): Use new keymaps argument.
91 (Fkey_binding): Caller changed.
92
93 * keyboard.c (command_loop_1): Caller changed.
94
952007-03-31 Eli Zaretskii <eliz@gnu.org>
96
97 * window.c (Fget_lru_window): Doc fix.
98
992007-03-30 Chong Yidong <cyd@stupidchicken.com>
100
101 * undo.c (Fprimitive_undo): Give clearer error message when trying
102 to change text properties outside accessible part of buffer.
103
1042007-03-29 Kim F. Storm <storm@cua.dk>
105
106 * process.c (wait_reading_process_output) [HAVE_PTYS]:
107 When EIO happens, clear channel from descriptor masks before raising
108 SIGCHLD signal to avoid busy loop between read and sigchld_handler.
109 (sigchld_handler): Remove sleep (2007-03-11 & 2007-03-26 changes).
110
1112007-03-29 Juanma Barranquero <lekktu@gmail.com>
112
113 * buffer.c (Fset_buffer_major_mode): Check that BUFFER is valid.
114
115 * process.c (Fformat_network_address): Return nil when the
116 argument vector contains invalid values.
117
1182007-03-28 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
119
120 * gmalloc.c [HAVE_GTK_AND_PTHREAD]: Define USE_PTHREAD.
121 [USE_PTHREAD]: Include pthread.h.
122 (malloc_init_once_control, _malloc_mutex) [USE_PTHREAD]: New variables.
123 (malloc_initialize_1): New function created from __malloc_initialize.
124 (__malloc_initialize): Use it.
125 (LOCK, UNLOCK): New macros to make malloc etc. thread safe.
126 (_malloc_internal, _free_internal, _realloc_internal): Use them.
127
128 * lread.c (readchar): Extend BLOCK_INPUT block to ferror/clearerr.
129
1302007-03-27 Juanma Barranquero <lekktu@gmail.com>
131
132 * process.c (Fformat_network_address): Make args array big enough
133 to format IPv6 addresses.
134
1352007-03-27 Glenn Morris <rgm@gnu.org>
136
137 * m/hp800.h: Restore HP-UX support (removed 2007-01-29).
138
1392007-03-26 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
140
141 * macfns.c (Fx_display_mm_height, Fx_display_mm_width): Scale whole
142 screen size in pixels by millimeters per pixel of main display.
143
144 * macselect.c (get_scrap_target_type_list, x_own_selection):
145 Move assignments outside predicate macros.
146 (Vselection_converter_alist): Doc fix.
147
148 * macterm.c (create_text_encoding_info_alist): Move assignments
149 outside predicate macros.
150 (mac_initialize_display_info) [MAC_OSX]: dpyinfo->height and
151 dpyinfo->width are those of whole screen.
152
1532007-03-26 Sam Steingold <sds@gnu.org>
154
155 * process.c (sigchld_handler): Delay by 1ms instead of 1s to
156 alleviate sluggishness (the original problem is still fixed).
157
1582007-03-25 Kim F. Storm <storm@cua.dk>
159
160 * intervals.c (merge_properties): Use explicit loop instead of
161 Fplist_member to avoid QUIT. Don't use Fcdr.
162 (intervals_equal): Likewise. Rewrite loop to perform length check
163 on the fly rather than calling Flength. Don't use Fcar.
164
1652007-03-24 Eli Zaretskii <eliz@gnu.org>
166
167 * editfns.c (Fgoto_char): Doc fix.
168
169 * indent.c (Findent_to): Doc fix.
170
1712007-03-24 Chong Yidong <cyd@stupidchicken.com>
172
173 * editfns.c (Ftranspose_regions): Use set_text_properties_1
174 instead of Fset_text_properties to avoid GC. Signal after change.
175
1762007-03-24 Eli Zaretskii <eliz@gnu.org>
177
178 * xfns.c (Fx_show_tip): Doc fix.
179
180 * macfns.c (Fx_show_tip): Doc fix.
181
182 * w32fns.c (Fx_show_tip): Doc fix.
183
1842007-03-23 Kim F. Storm <storm@cua.dk>
185
186 * intervals.c (merge_properties, intervals_equal):
187 Use Fplist_member instead of Fmemq to find properties.
188
1892007-03-23 Glenn Morris <rgm@gnu.org>
190
191 * unexhp9k800.c: Restore file with clarified legal status.
192 * m/sr2k.h: Restore since dependency unexhp9k800.c is restored.
193
1942007-03-22 Chong Yidong <cyd@stupidchicken.com>
195
196 * widget.c (EmacsFrameSetCharSize): Catch X errors.
197
1982007-03-22 Kenichi Handa <handa@m17n.org>
199
200 * fileio.c (Fcopy_file): Call barf_or_query_if_file_exists with
201 non-encoded file name.
202 (Frename_file): Likewise.
203 (Fadd_name_to_file): Likewise.
204 (Fmake_symbolic_link): Likewise.
205
12007-03-20 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> 2062007-03-20 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
2 207
3 * Makefile.in (alloca.o, gtkutil.o): Depend on systime.h. 208 * Makefile.in (alloca.o, gtkutil.o): Depend on systime.h.
@@ -25,9 +230,9 @@
25 * print.c: Include blockinput.h. 230 * print.c: Include blockinput.h.
26 (Fredirect_debugging_output): Add BLOCK_INPUT around fclose. 231 (Fredirect_debugging_output): Add BLOCK_INPUT around fclose.
27 232
28 * process.c (Fmake_network_process) [HAVE_GETADDRINFO]: Clear 233 * process.c (Fmake_network_process) [HAVE_GETADDRINFO]:
29 immediate_quit before calling freeaddrinfo. Add BLOCK_INPUT 234 Clear immediate_quit before calling freeaddrinfo.
30 around freeaddrinfo. 235 Add BLOCK_INPUT around freeaddrinfo.
31 236
32 * term.c: Include blockinput.h. 237 * term.c: Include blockinput.h.
33 (write_glyphs, insert_glyphs): Add BLOCK_INPUT around fwrite. 238 (write_glyphs, insert_glyphs): Add BLOCK_INPUT around fwrite.
@@ -51,8 +256,8 @@
51 (x_activate_menubar, mac_menu_show): Set it during menu tracking. 256 (x_activate_menubar, mac_menu_show): Set it during menu tracking.
52 (popup_activated): New function. 257 (popup_activated): New function.
53 258
54 * xdisp.c (redisplay_internal, note_mouse_highlight): Check 259 * xdisp.c (redisplay_internal, note_mouse_highlight):
55 popup_activated for MAC_OS. 260 Check popup_activated for MAC_OS.
56 261
572007-03-17 Juanma Barranquero <lekktu@gmail.com> 2622007-03-17 Juanma Barranquero <lekktu@gmail.com>
58 263
@@ -491,9 +696,9 @@
491 696
4922007-01-22 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> 6972007-01-22 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp>
493 698
494 * macselect.c [TARGET_API_MAC_CARBON] (mac_do_receive_drag): Don't 699 * macselect.c [TARGET_API_MAC_CARBON] (mac_do_receive_drag):
495 pass keyboard modifiers to mac_store_drag_event, but put them as 700 Don't pass keyboard modifiers to mac_store_drag_event, but put
496 kEventParamKeyModifiers Apple event parameter. 701 them as kEventParamKeyModifiers Apple event parameter.
497 702
4982007-01-21 Chong Yidong <cyd@stupidchicken.com> 7032007-01-21 Chong Yidong <cyd@stupidchicken.com>
499 704
@@ -577,8 +782,8 @@
577 (mac_dialog) [TARGET_API_MAC_CARBON]: Remove function. 782 (mac_dialog) [TARGET_API_MAC_CARBON]: Remove function.
578 (mac_dialog_show) [TARGET_API_MAC_CARBON]: Use create_and_show_dialog. 783 (mac_dialog_show) [TARGET_API_MAC_CARBON]: Use create_and_show_dialog.
579 784
580 * macterm.c (x_free_frame_resources) [USE_CG_DRAWING]: Call 785 * macterm.c (x_free_frame_resources) [USE_CG_DRAWING]:
581 mac_prepare_for_quickdraw. 786 Call mac_prepare_for_quickdraw.
582 (quit_char, make_ctrl_char) [TARGET_API_MAC_CARBON]: Move externs 787 (quit_char, make_ctrl_char) [TARGET_API_MAC_CARBON]: Move externs
583 outside #ifdef MAC_OSX. 788 outside #ifdef MAC_OSX.
584 (mac_quit_char_key_p) [TARGET_API_MAC_CARBON]: Move function 789 (mac_quit_char_key_p) [TARGET_API_MAC_CARBON]: Move function
@@ -2230,8 +2435,8 @@
2230 2435
22312006-08-28 Kenichi Handa <handa@m17n.org> 24362006-08-28 Kenichi Handa <handa@m17n.org>
2232 2437
2233 * coding.c (Fdetect_coding_region, Fdetect_coding_string): Fix 2438 * coding.c (Fdetect_coding_region, Fdetect_coding_string):
2234 docstring about ISO-2022 control characters. 2439 Fix docstring about ISO-2022 control characters.
2235 2440
22362006-08-28 Kim F. Storm <storm@cua.dk> 24412006-08-28 Kim F. Storm <storm@cua.dk>
2237 2442
@@ -2454,7 +2659,7 @@
24542006-08-09 Kenichi Handa <handa@m17n.org> 26592006-08-09 Kenichi Handa <handa@m17n.org>
2455 2660
2456 * coding.c (syms_of_coding): Improve the docstring 2661 * coding.c (syms_of_coding): Improve the docstring
2457 file-coding-system-alist. 2662 of file-coding-system-alist.
2458 2663
24592006-08-07 Andreas Schwab <schwab@suse.de> 26642006-08-07 Andreas Schwab <schwab@suse.de>
2460 2665
@@ -3402,8 +3607,8 @@
3402 * macterm.c (font_panel_shown_p) [USE_MAC_FONT_PANEL]: New variable. 3607 * macterm.c (font_panel_shown_p) [USE_MAC_FONT_PANEL]: New variable.
3403 (mac_font_panel_visible_p, mac_show_hide_font_panel) 3608 (mac_font_panel_visible_p, mac_show_hide_font_panel)
3404 [USE_MAC_FONT_PANEL]: New functions. 3609 [USE_MAC_FONT_PANEL]: New functions.
3405 [USE_MAC_FONT_PANEL] (mac_set_font_info_for_selection): Return 3610 [USE_MAC_FONT_PANEL] (mac_set_font_info_for_selection):
3406 immediately if font panel is not visible. 3611 Return immediately if font panel is not visible.
3407 3612
3408 * macterm.h (mac_font_panel_visible_p, mac_show_hide_font_panel): 3613 * macterm.h (mac_font_panel_visible_p, mac_show_hide_font_panel):
3409 Add externs. 3614 Add externs.
@@ -3422,8 +3627,8 @@
3422 3627
34232006-05-29 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> 36282006-05-29 Jan Dj,Ad(Brv <jan.h.d@swipnet.se>
3424 3629
3425 * sound.c (alsa_open, alsa_configure, alsa_write): Move 3630 * sound.c (alsa_open, alsa_configure, alsa_write):
3426 assignment to err out of if-statement. 3631 Move assignment to err out of if-statement.
3427 3632
3428 * gtkutil.c (menu_nav_ended): New function. 3633 * gtkutil.c (menu_nav_ended): New function.
3429 (create_menus): Connect menu_nav_ended to "selection-done" to fix 3634 (create_menus): Connect menu_nav_ended to "selection-done" to fix
@@ -3838,8 +4043,8 @@
3838 (Qpanel_closed, Qselection) [USE_MAC_FONT_PANEL]: Likewise. 4043 (Qpanel_closed, Qselection) [USE_MAC_FONT_PANEL]: Likewise.
3839 (syms_of_macterm): Intern and staticpro them. 4044 (syms_of_macterm): Intern and staticpro them.
3840 (init_font_name_table) [USE_ATSUI]: Add data to Vmac_atsu_font_table. 4045 (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 4046 [TARGET_API_MAC_CARBON] (mac_store_event_ref_as_apple_event):
3842 function. 4047 New function.
3843 [USE_CARBON_EVENTS] (mac_handle_command_event): Use it. 4048 [USE_CARBON_EVENTS] (mac_handle_command_event): Use it.
3844 [MAC_OSX] (mac_store_services_event): Likewise. 4049 [MAC_OSX] (mac_store_services_event): Likewise.
3845 [USE_CARBON_EVENTS] (mac_handle_window_event) [MAC_OSX]: Handle 4050 [USE_CARBON_EVENTS] (mac_handle_window_event) [MAC_OSX]: Handle
@@ -3891,8 +4096,8 @@
3891 [TARGET_API_MAC_CARBON] (create_apple_event): New function. 4096 [TARGET_API_MAC_CARBON] (create_apple_event): New function.
3892 [TARGET_API_MAC_CARBON] (create_apple_event_from_event_ref): Use it. 4097 [TARGET_API_MAC_CARBON] (create_apple_event_from_event_ref): Use it.
3893 Use xrealloc instead of repeated xmalloc/xfree. 4098 Use xrealloc instead of repeated xmalloc/xfree.
3894 [TARGET_API_MAC_CARBON] (create_apple_event_from_drag_ref): New 4099 [TARGET_API_MAC_CARBON] (create_apple_event_from_drag_ref):
3895 function. 4100 New function.
3896 4101
3897 * macmenu.c (restore_menu_items, cleanup_popup_menu): Return a value. 4102 * macmenu.c (restore_menu_items, cleanup_popup_menu): Return a value.
3898 4103
@@ -5752,8 +5957,8 @@
5752 objects until we are done with the parsing. 5957 objects until we are done with the parsing.
5753 (parse_single_submenu, digest_single_submenu): New functions. 5958 (parse_single_submenu, digest_single_submenu): New functions.
5754 (single_submenu): Function deleted, replaced by those two. 5959 (single_submenu): Function deleted, replaced by those two.
5755 (install_menu_quit_handler) [HAVE_CANCELMENUTRACKING]: Don't 5960 (install_menu_quit_handler) [HAVE_CANCELMENUTRACKING]: Don't create
5756 create or dispose of EventHandlerUPP. Install hander to all submenus. 5961 or dispose of EventHandlerUPP. Install hander to all submenus.
5757 (mac_menu_show) [!HAVE_MULTILINGUAL_MENU]: Use ENCODE_MENU_STRING 5962 (mac_menu_show) [!HAVE_MULTILINGUAL_MENU]: Use ENCODE_MENU_STRING
5758 instead of ENCODE_SYSTEM. 5963 instead of ENCODE_SYSTEM.
5759 (free_frame_menubar, fill_submenu, fill_menu): Don't use NULL for 5964 (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/alloc.c b/src/alloc.c
index fe13b84b5a7..574196059f8 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -3618,9 +3618,9 @@ mem_insert (start, end, type)
3618{ 3618{
3619 struct mem_node *c, *parent, *x; 3619 struct mem_node *c, *parent, *x;
3620 3620
3621 if (start < min_heap_address) 3621 if (min_heap_address == NULL || start < min_heap_address)
3622 min_heap_address = start; 3622 min_heap_address = start;
3623 if (end > max_heap_address) 3623 if (max_heap_address == NULL || end > max_heap_address)
3624 max_heap_address = end; 3624 max_heap_address = end;
3625 3625
3626 /* See where in the tree a node for START belongs. In this 3626 /* See where in the tree a node for START belongs. In this
diff --git a/src/buffer.c b/src/buffer.c
index 6e2f097ae88..15cb9f29356 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -1471,7 +1471,16 @@ with SIGHUP. */)
1471 unlock_buffer (b); 1471 unlock_buffer (b);
1472#endif /* CLASH_DETECTION */ 1472#endif /* CLASH_DETECTION */
1473 1473
1474 GCPRO1 (buf);
1474 kill_buffer_processes (buf); 1475 kill_buffer_processes (buf);
1476 UNGCPRO;
1477
1478 /* Killing buffer processes may run sentinels which may
1479 have called kill-buffer. */
1480
1481 if (NILP (b->name))
1482 return Qnil;
1483
1475 clear_charpos_cache (b); 1484 clear_charpos_cache (b);
1476 1485
1477 tem = Vinhibit_quit; 1486 tem = Vinhibit_quit;
@@ -1644,6 +1653,8 @@ the current buffer's major mode. */)
1644 int count; 1653 int count;
1645 Lisp_Object function; 1654 Lisp_Object function;
1646 1655
1656 CHECK_BUFFER (buffer);
1657
1647 if (STRINGP (XBUFFER (buffer)->name) 1658 if (STRINGP (XBUFFER (buffer)->name)
1648 && strcmp (SDATA (XBUFFER (buffer)->name), "*scratch*") == 0) 1659 && strcmp (SDATA (XBUFFER (buffer)->name), "*scratch*") == 0)
1649 function = find_symbol_value (intern ("initial-major-mode")); 1660 function = find_symbol_value (intern ("initial-major-mode"));
diff --git a/src/dispnew.c b/src/dispnew.c
index 697773f4daf..86e73da3848 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -120,6 +120,7 @@ struct dim
120 120
121static struct glyph_matrix *save_current_matrix P_ ((struct frame *)); 121static struct glyph_matrix *save_current_matrix P_ ((struct frame *));
122static void restore_current_matrix P_ ((struct frame *, struct glyph_matrix *)); 122static void restore_current_matrix P_ ((struct frame *, struct glyph_matrix *));
123static int showing_window_margins_p P_ ((struct window *));
123static void fake_current_matrices P_ ((Lisp_Object)); 124static void fake_current_matrices P_ ((Lisp_Object));
124static void redraw_overlapping_rows P_ ((struct window *, int)); 125static void redraw_overlapping_rows P_ ((struct window *, int));
125static void redraw_overlapped_rows P_ ((struct window *, int)); 126static void redraw_overlapped_rows P_ ((struct window *, int));
@@ -2153,6 +2154,33 @@ adjust_frame_glyphs (f)
2153 f->glyphs_initialized_p = 1; 2154 f->glyphs_initialized_p = 1;
2154} 2155}
2155 2156
2157/* Return 1 if any window in the tree has nonzero window margins. See
2158 the hack at the end of adjust_frame_glyphs_for_frame_redisplay. */
2159static int
2160showing_window_margins_p (w)
2161 struct window *w;
2162{
2163 while (w)
2164 {
2165 if (!NILP (w->hchild))
2166 {
2167 if (showing_window_margins_p (XWINDOW (w->hchild)))
2168 return 1;
2169 }
2170 else if (!NILP (w->vchild))
2171 {
2172 if (showing_window_margins_p (XWINDOW (w->vchild)))
2173 return 1;
2174 }
2175 else if (!NILP (w->left_margin_cols)
2176 || !NILP (w->right_margin_cols))
2177 return 1;
2178
2179 w = NILP (w->next) ? 0 : XWINDOW (w->next);
2180 }
2181 return 0;
2182}
2183
2156 2184
2157/* In the window tree with root W, build current matrices of leaf 2185/* In the window tree with root W, build current matrices of leaf
2158 windows from the frame's current matrix. */ 2186 windows from the frame's current matrix. */
@@ -2340,7 +2368,12 @@ adjust_frame_glyphs_for_frame_redisplay (f)
2340 if (display_completed 2368 if (display_completed
2341 && !FRAME_GARBAGED_P (f) 2369 && !FRAME_GARBAGED_P (f)
2342 && matrix_dim.width == f->current_matrix->matrix_w 2370 && matrix_dim.width == f->current_matrix->matrix_w
2343 && matrix_dim.height == f->current_matrix->matrix_h) 2371 && matrix_dim.height == f->current_matrix->matrix_h
2372 /* For some reason, the frame glyph matrix gets corrupted if
2373 any of the windows contain margins. I haven't been able
2374 to hunt down the reason, but for the moment this prevents
2375 the problem from manifesting. -- cyd */
2376 && !showing_window_margins_p (XWINDOW (FRAME_ROOT_WINDOW (f))))
2344 { 2377 {
2345 struct glyph_matrix *copy = save_current_matrix (f); 2378 struct glyph_matrix *copy = save_current_matrix (f);
2346 adjust_glyph_matrix (NULL, f->desired_matrix, 0, 0, matrix_dim); 2379 adjust_glyph_matrix (NULL, f->desired_matrix, 0, 0, matrix_dim);
diff --git a/src/editfns.c b/src/editfns.c
index fc99bf977d0..2ab852d2925 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -274,7 +274,9 @@ clip_to_bounds (lower, num, upper)
274 274
275DEFUN ("goto-char", Fgoto_char, Sgoto_char, 1, 1, "NGoto char: ", 275DEFUN ("goto-char", Fgoto_char, Sgoto_char, 1, 1, "NGoto char: ",
276 doc: /* Set point to POSITION, a number or marker. 276 doc: /* Set point to POSITION, a number or marker.
277Beginning of buffer is position (point-min), end is (point-max). */) 277Beginning of buffer is position (point-min), end is (point-max).
278
279The return value is POSITION. */)
278 (position) 280 (position)
279 register Lisp_Object position; 281 register Lisp_Object position;
280{ 282{
@@ -4117,7 +4119,10 @@ Transposing beyond buffer boundaries is an error. */)
4117 int gap, len1, len_mid, len2; 4119 int gap, len1, len_mid, len2;
4118 unsigned char *start1_addr, *start2_addr, *temp; 4120 unsigned char *start1_addr, *start2_addr, *temp;
4119 4121
4120 INTERVAL cur_intv, tmp_interval1, tmp_interval_mid, tmp_interval2; 4122 INTERVAL cur_intv, tmp_interval1, tmp_interval_mid, tmp_interval2, tmp_interval3;
4123 Lisp_Object buf;
4124
4125 XSETBUFFER (buf, current_buffer);
4121 cur_intv = BUF_INTERVALS (current_buffer); 4126 cur_intv = BUF_INTERVALS (current_buffer);
4122 4127
4123 validate_region (&startr1, &endr1); 4128 validate_region (&startr1, &endr1);
@@ -4224,8 +4229,11 @@ Transposing beyond buffer boundaries is an error. */)
4224 4229
4225 tmp_interval1 = copy_intervals (cur_intv, start1, len1); 4230 tmp_interval1 = copy_intervals (cur_intv, start1, len1);
4226 tmp_interval2 = copy_intervals (cur_intv, start2, len2); 4231 tmp_interval2 = copy_intervals (cur_intv, start2, len2);
4227 Fset_text_properties (make_number (start1), make_number (end2), 4232 /* Don't use Fset_text_properties: that can cause GC, which can
4228 Qnil, Qnil); 4233 clobber objects stored in the tmp_intervals. */
4234 tmp_interval3 = validate_interval_range (buf, &startr1, &endr2, 0);
4235 if (!NULL_INTERVAL_P (tmp_interval3))
4236 set_text_properties_1 (startr1, endr2, Qnil, buf, tmp_interval3);
4229 4237
4230 /* First region smaller than second. */ 4238 /* First region smaller than second. */
4231 if (len1_byte < len2_byte) 4239 if (len1_byte < len2_byte)
@@ -4281,10 +4289,14 @@ Transposing beyond buffer boundaries is an error. */)
4281 record_change (start2, len2); 4289 record_change (start2, len2);
4282 tmp_interval1 = copy_intervals (cur_intv, start1, len1); 4290 tmp_interval1 = copy_intervals (cur_intv, start1, len1);
4283 tmp_interval2 = copy_intervals (cur_intv, start2, len2); 4291 tmp_interval2 = copy_intervals (cur_intv, start2, len2);
4284 Fset_text_properties (make_number (start1), make_number (end1), 4292
4285 Qnil, Qnil); 4293 tmp_interval3 = validate_interval_range (buf, &startr1, &endr1, 0);
4286 Fset_text_properties (make_number (start2), make_number (end2), 4294 if (!NULL_INTERVAL_P (tmp_interval3))
4287 Qnil, Qnil); 4295 set_text_properties_1 (startr1, endr1, Qnil, buf, tmp_interval3);
4296
4297 tmp_interval3 = validate_interval_range (buf, &startr2, &endr2, 0);
4298 if (!NULL_INTERVAL_P (tmp_interval3))
4299 set_text_properties_1 (startr2, endr2, Qnil, buf, tmp_interval3);
4288 4300
4289 SAFE_ALLOCA (temp, unsigned char *, len1_byte); 4301 SAFE_ALLOCA (temp, unsigned char *, len1_byte);
4290 start1_addr = BYTE_POS_ADDR (start1_byte); 4302 start1_addr = BYTE_POS_ADDR (start1_byte);
@@ -4310,8 +4322,10 @@ Transposing beyond buffer boundaries is an error. */)
4310 tmp_interval1 = copy_intervals (cur_intv, start1, len1); 4322 tmp_interval1 = copy_intervals (cur_intv, start1, len1);
4311 tmp_interval_mid = copy_intervals (cur_intv, end1, len_mid); 4323 tmp_interval_mid = copy_intervals (cur_intv, end1, len_mid);
4312 tmp_interval2 = copy_intervals (cur_intv, start2, len2); 4324 tmp_interval2 = copy_intervals (cur_intv, start2, len2);
4313 Fset_text_properties (make_number (start1), make_number (end2), 4325
4314 Qnil, Qnil); 4326 tmp_interval3 = validate_interval_range (buf, &startr1, &endr2, 0);
4327 if (!NULL_INTERVAL_P (tmp_interval3))
4328 set_text_properties_1 (startr1, endr2, Qnil, buf, tmp_interval3);
4315 4329
4316 /* holds region 2 */ 4330 /* holds region 2 */
4317 SAFE_ALLOCA (temp, unsigned char *, len2_byte); 4331 SAFE_ALLOCA (temp, unsigned char *, len2_byte);
@@ -4341,8 +4355,10 @@ Transposing beyond buffer boundaries is an error. */)
4341 tmp_interval1 = copy_intervals (cur_intv, start1, len1); 4355 tmp_interval1 = copy_intervals (cur_intv, start1, len1);
4342 tmp_interval_mid = copy_intervals (cur_intv, end1, len_mid); 4356 tmp_interval_mid = copy_intervals (cur_intv, end1, len_mid);
4343 tmp_interval2 = copy_intervals (cur_intv, start2, len2); 4357 tmp_interval2 = copy_intervals (cur_intv, start2, len2);
4344 Fset_text_properties (make_number (start1), make_number (end2), 4358
4345 Qnil, Qnil); 4359 tmp_interval3 = validate_interval_range (buf, &startr1, &endr2, 0);
4360 if (!NULL_INTERVAL_P (tmp_interval3))
4361 set_text_properties_1 (startr1, endr2, Qnil, buf, tmp_interval3);
4346 4362
4347 /* holds region 1 */ 4363 /* holds region 1 */
4348 SAFE_ALLOCA (temp, unsigned char *, len1_byte); 4364 SAFE_ALLOCA (temp, unsigned char *, len1_byte);
@@ -4377,6 +4393,8 @@ Transposing beyond buffer boundaries is an error. */)
4377 fix_start_end_in_overlays (start1, end2); 4393 fix_start_end_in_overlays (start1, end2);
4378 } 4394 }
4379 4395
4396 signal_after_change (XINT (start1), XINT (end2 - start1),
4397 XINT (end2 - start1));
4380 return Qnil; 4398 return Qnil;
4381} 4399}
4382 4400
diff --git a/src/emacs.c b/src/emacs.c
index d49d81e70bb..1f8ec6a268f 100644
--- a/src/emacs.c
+++ b/src/emacs.c
@@ -1723,8 +1723,9 @@ main (argc, argv
1723 /* Set up for profiling. This is known to work on FreeBSD, 1723 /* Set up for profiling. This is known to work on FreeBSD,
1724 GNU/Linux and MinGW. It might work on some other systems too. 1724 GNU/Linux and MinGW. It might work on some other systems too.
1725 Give it a try and tell us if it works on your system. To compile 1725 Give it a try and tell us if it works on your system. To compile
1726 for profiling use something like: 1726 for profiling, add -pg to the switches your platform uses in
1727 `make CFLAGS="-pg -g -O -DPROFILING=1'. */ 1727 CFLAGS and LDFLAGS. For example:
1728 `make CFLAGS="-pg -g -O -DPROFILING=1" LDFLAGS="-pg -g"'. */
1728#if defined (__FreeBSD__) || defined (GNU_LINUX) || defined(__MINGW32__) 1729#if defined (__FreeBSD__) || defined (GNU_LINUX) || defined(__MINGW32__)
1729#ifdef PROFILING 1730#ifdef PROFILING
1730 if (initialized) 1731 if (initialized)
diff --git a/src/fileio.c b/src/fileio.c
index 7cb45a72db7..b9f9334a062 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -2473,7 +2473,7 @@ uid and gid of FILE to NEWNAME. */)
2473 2473
2474 if (NILP (ok_if_already_exists) 2474 if (NILP (ok_if_already_exists)
2475 || INTEGERP (ok_if_already_exists)) 2475 || INTEGERP (ok_if_already_exists))
2476 barf_or_query_if_file_exists (encoded_newname, "copy to it", 2476 barf_or_query_if_file_exists (newname, "copy to it",
2477 INTEGERP (ok_if_already_exists), &out_st, 0); 2477 INTEGERP (ok_if_already_exists), &out_st, 0);
2478 else if (stat (SDATA (encoded_newname), &out_st) < 0) 2478 else if (stat (SDATA (encoded_newname), &out_st) < 0)
2479 out_st.st_mode = 0; 2479 out_st.st_mode = 0;
@@ -2782,7 +2782,7 @@ This is what happens in interactive use with M-x. */)
2782#endif 2782#endif
2783 if (NILP (ok_if_already_exists) 2783 if (NILP (ok_if_already_exists)
2784 || INTEGERP (ok_if_already_exists)) 2784 || INTEGERP (ok_if_already_exists))
2785 barf_or_query_if_file_exists (encoded_newname, "rename to it", 2785 barf_or_query_if_file_exists (newname, "rename to it",
2786 INTEGERP (ok_if_already_exists), 0, 0); 2786 INTEGERP (ok_if_already_exists), 0, 0);
2787#ifndef BSD4_1 2787#ifndef BSD4_1
2788 if (0 > rename (SDATA (encoded_file), SDATA (encoded_newname))) 2788 if (0 > rename (SDATA (encoded_file), SDATA (encoded_newname)))
@@ -2859,7 +2859,7 @@ This is what happens in interactive use with M-x. */)
2859 2859
2860 if (NILP (ok_if_already_exists) 2860 if (NILP (ok_if_already_exists)
2861 || INTEGERP (ok_if_already_exists)) 2861 || INTEGERP (ok_if_already_exists))
2862 barf_or_query_if_file_exists (encoded_newname, "make it a new name", 2862 barf_or_query_if_file_exists (newname, "make it a new name",
2863 INTEGERP (ok_if_already_exists), 0, 0); 2863 INTEGERP (ok_if_already_exists), 0, 0);
2864 2864
2865 unlink (SDATA (newname)); 2865 unlink (SDATA (newname));
@@ -2920,7 +2920,7 @@ This happens for interactive use with M-x. */)
2920 2920
2921 if (NILP (ok_if_already_exists) 2921 if (NILP (ok_if_already_exists)
2922 || INTEGERP (ok_if_already_exists)) 2922 || INTEGERP (ok_if_already_exists))
2923 barf_or_query_if_file_exists (encoded_linkname, "make it a link", 2923 barf_or_query_if_file_exists (linkname, "make it a link",
2924 INTEGERP (ok_if_already_exists), 0, 0); 2924 INTEGERP (ok_if_already_exists), 0, 0);
2925 if (0 > symlink (SDATA (encoded_filename), 2925 if (0 > symlink (SDATA (encoded_filename),
2926 SDATA (encoded_linkname))) 2926 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 0f0e2e763ef..20a6e244a66 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 93ff40ba640..8495d43cb9c 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -737,7 +737,9 @@ string_display_width (string, beg, end)
737DEFUN ("indent-to", Findent_to, Sindent_to, 1, 2, "NIndent to column: ", 737DEFUN ("indent-to", Findent_to, Sindent_to, 1, 2, "NIndent to column: ",
738 doc: /* Indent from point with tabs and spaces until COLUMN is reached. 738 doc: /* Indent from point with tabs and spaces until COLUMN is reached.
739Optional second argument MINIMUM says always do at least MINIMUM spaces 739Optional second argument MINIMUM says always do at least MINIMUM spaces
740even if that goes past COLUMN; by default, MINIMUM is zero. */) 740even if that goes past COLUMN; by default, MINIMUM is zero.
741
742The return value is COLUMN. */)
741 (column, minimum) 743 (column, minimum)
742 Lisp_Object column, minimum; 744 Lisp_Object column, minimum;
743{ 745{
@@ -951,7 +953,6 @@ The return value is the current column. */)
951 pos = PT; 953 pos = PT;
952 pos_byte = PT_BYTE; 954 pos_byte = PT_BYTE;
953 end = ZV; 955 end = ZV;
954 next_boundary = pos;
955 956
956 /* If we're starting past the desired column, 957 /* If we're starting past the desired column,
957 back up to beginning of line and scan from there. */ 958 back up to beginning of line and scan from there. */
@@ -963,6 +964,8 @@ The return value is the current column. */)
963 col = 0; 964 col = 0;
964 } 965 }
965 966
967 next_boundary = pos;
968
966 while (pos < end) 969 while (pos < end)
967 { 970 {
968 while (pos == next_boundary) 971 while (pos == next_boundary)
diff --git a/src/intervals.c b/src/intervals.c
index 861cb24c598..5d9550da791 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 686d16a504f..3404c60a93a 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -1764,7 +1764,7 @@ command_loop_1 ()
1764 if (SYMBOLP (cmd)) 1764 if (SYMBOLP (cmd))
1765 { 1765 {
1766 Lisp_Object cmd1; 1766 Lisp_Object cmd1;
1767 if (cmd1 = Fcommand_remapping (cmd, Qnil), !NILP (cmd1)) 1767 if (cmd1 = Fcommand_remapping (cmd, Qnil, Qnil), !NILP (cmd1))
1768 cmd = cmd1; 1768 cmd = cmd1;
1769 } 1769 }
1770 1770
@@ -9008,9 +9008,9 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last,
9008 of the place where a mouse click occurred. */ 9008 of the place where a mouse click occurred. */
9009 volatile int localized_local_map = 0; 9009 volatile int localized_local_map = 0;
9010 9010
9011 /* The index in defs[] of the first keymap that has a binding for 9011 /* The index in submaps[] of the first keymap that has a binding for
9012 this key sequence. In other words, the lowest i such that 9012 this key sequence. In other words, the lowest i such that
9013 defs[i] is non-nil. */ 9013 submaps[i] is non-nil. */
9014 volatile int first_binding; 9014 volatile int first_binding;
9015 /* Index of the first key that has no binding. 9015 /* Index of the first key that has no binding.
9016 It is useless to try fkey.start larger than that. */ 9016 It is useless to try fkey.start larger than that. */
diff --git a/src/keymap.c b/src/keymap.c
index 0aaf9373ba1..a5d50b7fbf1 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -1217,23 +1217,42 @@ binding KEY to DEF is added at the front of KEYMAP. */)
1217 1217
1218/* This function may GC (it calls Fkey_binding). */ 1218/* This function may GC (it calls Fkey_binding). */
1219 1219
1220DEFUN ("command-remapping", Fcommand_remapping, Scommand_remapping, 1, 2, 0, 1220DEFUN ("command-remapping", Fcommand_remapping, Scommand_remapping, 1, 3, 0,
1221 doc: /* Return the remapping for command COMMAND in current keymaps. 1221 doc: /* Return the remapping for command COMMAND.
1222Returns nil if COMMAND is not remapped (or not a symbol). 1222Returns nil if COMMAND is not remapped (or not a symbol).
1223 1223
1224If the optional argument POSITION is non-nil, it specifies a mouse 1224If the optional argument POSITION is non-nil, it specifies a mouse
1225position as returned by `event-start' and `event-end', and the 1225position as returned by `event-start' and `event-end', and the
1226remapping occurs in the keymaps associated with it. It can also be a 1226remapping occurs in the keymaps associated with it. It can also be a
1227number or marker, in which case the keymap properties at the specified 1227number or marker, in which case the keymap properties at the specified
1228buffer position instead of point are used. */) 1228buffer position instead of point are used. The KEYMAPS argument is
1229 (command, position) 1229ignored if POSITION is non-nil.
1230 Lisp_Object command, position; 1230
1231If the optional argument KEYMAPS is non-nil, it should be a list of
1232keymaps to search for command remapping. Otherwise, search for the
1233remapping in all currently active keymaps. */)
1234 (command, position, keymaps)
1235 Lisp_Object command, position, keymaps;
1231{ 1236{
1232 if (!SYMBOLP (command)) 1237 if (!SYMBOLP (command))
1233 return Qnil; 1238 return Qnil;
1234 1239
1235 ASET (command_remapping_vector, 1, command); 1240 ASET (command_remapping_vector, 1, command);
1236 return Fkey_binding (command_remapping_vector, Qnil, Qt, position); 1241
1242 if (NILP (keymaps))
1243 return Fkey_binding (command_remapping_vector, Qnil, Qt, position);
1244 else
1245 {
1246 Lisp_Object maps, binding;
1247
1248 for (maps = keymaps; !NILP (maps); maps = Fcdr (maps))
1249 {
1250 binding = Flookup_key (Fcar (maps), command_remapping_vector, Qnil);
1251 if (!NILP (binding) && !INTEGERP (binding))
1252 return binding;
1253 }
1254 return Qnil;
1255 }
1237} 1256}
1238 1257
1239/* Value is number if KEY is too long; nil if valid but has no definition. */ 1258/* Value is number if KEY is too long; nil if valid but has no definition. */
@@ -1394,8 +1413,10 @@ silly_event_symbol_error (c)
1394static Lisp_Object *cmm_modes = NULL, *cmm_maps = NULL; 1413static Lisp_Object *cmm_modes = NULL, *cmm_maps = NULL;
1395static int cmm_size = 0; 1414static int cmm_size = 0;
1396 1415
1397/* Store a pointer to an array of the keymaps of the currently active 1416/* Store a pointer to an array of the currently active minor modes in
1398 minor modes in *buf, and return the number of maps it contains. 1417 *modeptr, a pointer to an array of the keymaps of the currently
1418 active minor modes in *mapptr, and return the number of maps
1419 *mapptr contains.
1399 1420
1400 This function always returns a pointer to the same buffer, and may 1421 This function always returns a pointer to the same buffer, and may
1401 free or reallocate it, so if you want to keep it for a long time or 1422 free or reallocate it, so if you want to keep it for a long time or
@@ -1761,7 +1782,7 @@ specified buffer position instead of point are used.
1761 if (NILP (no_remap) && SYMBOLP (value)) 1782 if (NILP (no_remap) && SYMBOLP (value))
1762 { 1783 {
1763 Lisp_Object value1; 1784 Lisp_Object value1;
1764 if (value1 = Fcommand_remapping (value, position), !NILP (value1)) 1785 if (value1 = Fcommand_remapping (value, position, Qnil), !NILP (value1))
1765 value = value1; 1786 value = value1;
1766 } 1787 }
1767 1788
@@ -2570,15 +2591,6 @@ where_is_internal (definition, keymaps, firstonly, noindirect, no_remap)
2570 /* 1 means ignore all menu bindings entirely. */ 2591 /* 1 means ignore all menu bindings entirely. */
2571 int nomenus = !NILP (firstonly) && !EQ (firstonly, Qnon_ascii); 2592 int nomenus = !NILP (firstonly) && !EQ (firstonly, Qnon_ascii);
2572 2593
2573 /* If this command is remapped, then it has no key bindings
2574 of its own. */
2575 if (NILP (no_remap) && SYMBOLP (definition))
2576 {
2577 Lisp_Object tem;
2578 if (tem = Fcommand_remapping (definition, Qnil), !NILP (tem))
2579 return Qnil;
2580 }
2581
2582 found = keymaps; 2594 found = keymaps;
2583 while (CONSP (found)) 2595 while (CONSP (found))
2584 { 2596 {
@@ -2592,6 +2604,13 @@ where_is_internal (definition, keymaps, firstonly, noindirect, no_remap)
2592 found = Qnil; 2604 found = Qnil;
2593 sequences = Qnil; 2605 sequences = Qnil;
2594 2606
2607 /* If this command is remapped, then it has no key bindings
2608 of its own. */
2609 if (NILP (no_remap)
2610 && SYMBOLP (definition)
2611 && !NILP (Fcommand_remapping (definition, Qnil, keymaps)))
2612 RETURN_UNGCPRO (Qnil);
2613
2595 for (; !NILP (maps); maps = Fcdr (maps)) 2614 for (; !NILP (maps); maps = Fcdr (maps))
2596 { 2615 {
2597 /* Key sequence to reach map, and the map that it reaches */ 2616 /* Key sequence to reach map, and the map that it reaches */
diff --git a/src/keymap.h b/src/keymap.h
index 9614f578f37..b305a318944 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 cee6cf5a92e..cc3ae7627d1 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -329,18 +329,18 @@ readchar (readcharfun)
329 { 329 {
330 BLOCK_INPUT; 330 BLOCK_INPUT;
331 c = getc (instream); 331 c = getc (instream);
332 UNBLOCK_INPUT;
333#ifdef EINTR 332#ifdef EINTR
334 /* Interrupted reads have been observed while reading over the network */ 333 /* Interrupted reads have been observed while reading over the network */
335 while (c == EOF && ferror (instream) && errno == EINTR) 334 while (c == EOF && ferror (instream) && errno == EINTR)
336 { 335 {
336 UNBLOCK_INPUT;
337 QUIT; 337 QUIT;
338 clearerr (instream);
339 BLOCK_INPUT; 338 BLOCK_INPUT;
339 clearerr (instream);
340 c = getc (instream); 340 c = getc (instream);
341 UNBLOCK_INPUT;
342 } 341 }
343#endif 342#endif
343 UNBLOCK_INPUT;
344 return c; 344 return c;
345 } 345 }
346 346
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/mac.c b/src/mac.c
index 5084a02b27d..8363326cc05 100644
--- a/src/mac.c
+++ b/src/mac.c
@@ -1835,6 +1835,8 @@ xrm_get_preference_database (application)
1835 if (app_id == NULL) 1835 if (app_id == NULL)
1836 goto out; 1836 goto out;
1837 } 1837 }
1838 if (!CFPreferencesAppSynchronize (app_id))
1839 goto out;
1838 1840
1839 key_set = CFSetCreateMutable (NULL, 0, &kCFCopyStringSetCallBacks); 1841 key_set = CFSetCreateMutable (NULL, 0, &kCFCopyStringSetCallBacks);
1840 if (key_set == NULL) 1842 if (key_set == NULL)
@@ -4650,6 +4652,9 @@ otherwise. */)
4650 if (app_id == NULL) 4652 if (app_id == NULL)
4651 goto out; 4653 goto out;
4652 } 4654 }
4655 if (!CFPreferencesAppSynchronize (app_id))
4656 goto out;
4657
4653 key_str = cfstring_create_with_string (XCAR (key)); 4658 key_str = cfstring_create_with_string (XCAR (key));
4654 if (key_str == NULL) 4659 if (key_str == NULL)
4655 goto out; 4660 goto out;
diff --git a/src/macfns.c b/src/macfns.c
index c05906d6499..6ce4b66031e 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 f26c06680bc..316e61cc537 100644
--- a/src/macterm.c
+++ b/src/macterm.c
@@ -52,6 +52,7 @@ Boston, MA 02110-1301, USA. */
52#include <LowMem.h> 52#include <LowMem.h>
53#include <Controls.h> 53#include <Controls.h>
54#include <Windows.h> 54#include <Windows.h>
55#include <Displays.h>
55#if defined (__MRC__) || (__MSL__ >= 0x6000) 56#if defined (__MRC__) || (__MSL__ >= 0x6000)
56#include <ControlDefinitions.h> 57#include <ControlDefinitions.h>
57#endif 58#endif
@@ -7172,11 +7173,14 @@ create_text_encoding_info_alist ()
7172 Lisp_Object existing_info; 7173 Lisp_Object existing_info;
7173 7174
7174 if (!(CONSP (charset_info) 7175 if (!(CONSP (charset_info)
7175 && STRINGP (charset = XCAR (charset_info)) 7176 && (charset = XCAR (charset_info),
7177 STRINGP (charset))
7176 && CONSP (XCDR (charset_info)) 7178 && CONSP (XCDR (charset_info))
7177 && INTEGERP (text_encoding = XCAR (XCDR (charset_info))) 7179 && (text_encoding = XCAR (XCDR (charset_info)),
7180 INTEGERP (text_encoding))
7178 && CONSP (XCDR (XCDR (charset_info))) 7181 && CONSP (XCDR (XCDR (charset_info)))
7179 && SYMBOLP (coding_system = XCAR (XCDR (XCDR (charset_info)))))) 7182 && (coding_system = XCAR (XCDR (XCDR (charset_info))),
7183 SYMBOLP (coding_system))))
7180 continue; 7184 continue;
7181 7185
7182 existing_info = assq_no_quit (text_encoding, result); 7186 existing_info = assq_no_quit (text_encoding, result);
@@ -8866,6 +8870,9 @@ int mac_pass_control_to_system;
8866 Carbon/Apple event handlers. */ 8870 Carbon/Apple event handlers. */
8867static struct input_event *read_socket_inev = NULL; 8871static struct input_event *read_socket_inev = NULL;
8868 8872
8873/* Whether or not the screen configuration has changed. */
8874static int mac_screen_config_changed = 0;
8875
8869Point saved_menu_event_location; 8876Point saved_menu_event_location;
8870 8877
8871/* Apple Events */ 8878/* Apple Events */
@@ -10396,6 +10403,87 @@ remove_window_handler (window)
10396} 10403}
10397 10404
10398 10405
10406static pascal void
10407mac_handle_dm_notification (event)
10408 AppleEvent *event;
10409{
10410 mac_screen_config_changed = 1;
10411}
10412
10413static OSErr
10414init_dm_notification_handler ()
10415{
10416 OSErr err;
10417 static DMNotificationUPP handle_dm_notificationUPP = NULL;
10418 ProcessSerialNumber psn;
10419
10420 if (handle_dm_notificationUPP == NULL)
10421 handle_dm_notificationUPP =
10422 NewDMNotificationUPP (mac_handle_dm_notification);
10423
10424 err = GetCurrentProcess (&psn);
10425 if (err == noErr)
10426 err = DMRegisterNotifyProc (handle_dm_notificationUPP, &psn);
10427
10428 return err;
10429}
10430
10431static void
10432mac_get_screen_info (dpyinfo)
10433 struct mac_display_info *dpyinfo;
10434{
10435#ifdef MAC_OSX
10436 /* HasDepth returns true if it is possible to have a 32 bit display,
10437 but this may not be what is actually used. Mac OSX can do better. */
10438 dpyinfo->color_p = CGDisplaySamplesPerPixel (kCGDirectMainDisplay) > 1;
10439 dpyinfo->n_planes = CGDisplayBitsPerPixel (kCGDirectMainDisplay);
10440 {
10441 CGDisplayErr err;
10442 CGDisplayCount ndisps;
10443 CGDirectDisplayID *displays;
10444
10445 err = CGGetActiveDisplayList (0, NULL, &ndisps);
10446 if (err == noErr)
10447 {
10448 displays = alloca (sizeof (CGDirectDisplayID) * ndisps);
10449 err = CGGetActiveDisplayList (ndisps, displays, &ndisps);
10450 }
10451 if (err == noErr)
10452 {
10453 CGRect bounds = CGRectZero;
10454
10455 while (ndisps-- > 0)
10456 bounds = CGRectUnion (bounds, CGDisplayBounds (displays[ndisps]));
10457 dpyinfo->height = CGRectGetHeight (bounds);
10458 dpyinfo->width = CGRectGetWidth (bounds);
10459 }
10460 else
10461 {
10462 dpyinfo->height = CGDisplayPixelsHigh (kCGDirectMainDisplay);
10463 dpyinfo->width = CGDisplayPixelsWide (kCGDirectMainDisplay);
10464 }
10465 }
10466#else /* !MAC_OSX */
10467 {
10468 GDHandle gdh = GetMainDevice ();
10469 Rect rect = (**gdh).gdRect;
10470
10471 dpyinfo->color_p = TestDeviceAttribute (gdh, gdDevType);
10472 for (dpyinfo->n_planes = 32; dpyinfo->n_planes > 0; dpyinfo->n_planes >>= 1)
10473 if (HasDepth (gdh, dpyinfo->n_planes, gdDevType, dpyinfo->color_p))
10474 break;
10475
10476 for (gdh = DMGetFirstScreenDevice (dmOnlyActiveDisplays); gdh;
10477 gdh = DMGetNextScreenDevice (gdh, dmOnlyActiveDisplays))
10478 UnionRect (&rect, &(**gdh).gdRect, &rect);
10479
10480 dpyinfo->height = rect.bottom - rect.top;
10481 dpyinfo->width = rect.right - rect.left;
10482 }
10483#endif /* !MAC_OSX */
10484}
10485
10486
10399#if __profile__ 10487#if __profile__
10400void 10488void
10401profiler_exit_proc () 10489profiler_exit_proc ()
@@ -10453,6 +10541,8 @@ main (void)
10453 10541
10454 init_apple_event_handler (); 10542 init_apple_event_handler ();
10455 10543
10544 init_dm_notification_handler ();
10545
10456 { 10546 {
10457 char **argv; 10547 char **argv;
10458 int argc = 0; 10548 int argc = 0;
@@ -10530,8 +10620,7 @@ mac_post_mouse_moved_event ()
10530 { 10620 {
10531 Point mouse_pos; 10621 Point mouse_pos;
10532 10622
10533 GetMouse (&mouse_pos); 10623 GetGlobalMouse (&mouse_pos);
10534 LocalToGlobal (&mouse_pos);
10535 err = SetEventParameter (event, kEventParamMouseLocation, typeQDPoint, 10624 err = SetEventParameter (event, kEventParamMouseLocation, typeQDPoint,
10536 sizeof (Point), &mouse_pos); 10625 sizeof (Point), &mouse_pos);
10537 } 10626 }
@@ -11375,6 +11464,12 @@ XTread_socket (sd, expected, hold_quit)
11375 pending_autoraise_frame = 0; 11464 pending_autoraise_frame = 0;
11376 } 11465 }
11377 11466
11467 if (mac_screen_config_changed)
11468 {
11469 mac_get_screen_info (dpyinfo);
11470 mac_screen_config_changed = 0;
11471 }
11472
11378#if !USE_CARBON_EVENTS 11473#if !USE_CARBON_EVENTS
11379 /* Check which frames are still visible. We do this here because 11474 /* Check which frames are still visible. We do this here because
11380 there doesn't seem to be any direct notification from the Window 11475 there doesn't seem to be any direct notification from the Window
@@ -11509,62 +11604,7 @@ make_mac_terminal_frame (struct frame *f)
11509 Initialization 11604 Initialization
11510 ***********************************************************************/ 11605 ***********************************************************************/
11511 11606
11512int mac_initialized = 0; 11607static int mac_initialized = 0;
11513
11514void
11515mac_initialize_display_info ()
11516{
11517 struct mac_display_info *dpyinfo = &one_mac_display_info;
11518
11519 bzero (dpyinfo, sizeof (*dpyinfo));
11520
11521#ifdef MAC_OSX
11522 dpyinfo->mac_id_name
11523 = (char *) xmalloc (SCHARS (Vinvocation_name)
11524 + SCHARS (Vsystem_name)
11525 + 2);
11526 sprintf (dpyinfo->mac_id_name, "%s@%s",
11527 SDATA (Vinvocation_name), SDATA (Vsystem_name));
11528#else
11529 dpyinfo->mac_id_name = (char *) xmalloc (strlen ("Mac Display") + 1);
11530 strcpy (dpyinfo->mac_id_name, "Mac Display");
11531#endif
11532
11533 dpyinfo->reference_count = 0;
11534 dpyinfo->resx = 72.0;
11535 dpyinfo->resy = 72.0;
11536#ifdef MAC_OSX
11537 /* HasDepth returns true if it is possible to have a 32 bit display,
11538 but this may not be what is actually used. Mac OSX can do better. */
11539 dpyinfo->color_p = CGDisplaySamplesPerPixel (kCGDirectMainDisplay) > 1;
11540 dpyinfo->n_planes = CGDisplayBitsPerPixel (kCGDirectMainDisplay);
11541 dpyinfo->height = CGDisplayPixelsHigh (kCGDirectMainDisplay);
11542 dpyinfo->width = CGDisplayPixelsWide (kCGDirectMainDisplay);
11543#else
11544 {
11545 GDHandle main_device_handle = LMGetMainDevice();
11546
11547 dpyinfo->color_p = TestDeviceAttribute (main_device_handle, gdDevType);
11548 for (dpyinfo->n_planes = 32; dpyinfo->n_planes > 0; dpyinfo->n_planes >>= 1)
11549 if (HasDepth (main_device_handle, dpyinfo->n_planes,
11550 gdDevType, dpyinfo->color_p))
11551 break;
11552 dpyinfo->height = (**main_device_handle).gdRect.bottom;
11553 dpyinfo->width = (**main_device_handle).gdRect.right;
11554 }
11555#endif
11556 dpyinfo->grabbed = 0;
11557 dpyinfo->root_window = NULL;
11558 dpyinfo->image_cache = make_image_cache ();
11559
11560 dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1;
11561 dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1;
11562 dpyinfo->mouse_face_face_id = DEFAULT_FACE_ID;
11563 dpyinfo->mouse_face_window = Qnil;
11564 dpyinfo->mouse_face_overlay = Qnil;
11565 dpyinfo->mouse_face_hidden = 0;
11566}
11567
11568 11608
11569static XrmDatabase 11609static XrmDatabase
11570mac_make_rdb (xrm_option) 11610mac_make_rdb (xrm_option)
@@ -11598,9 +11638,37 @@ mac_term_init (display_name, xrm_option, resource_name)
11598 if (x_display_list) 11638 if (x_display_list)
11599 error ("Sorry, this version can only handle one display"); 11639 error ("Sorry, this version can only handle one display");
11600 11640
11601 mac_initialize_display_info ();
11602
11603 dpyinfo = &one_mac_display_info; 11641 dpyinfo = &one_mac_display_info;
11642 bzero (dpyinfo, sizeof (*dpyinfo));
11643
11644#ifdef MAC_OSX
11645 dpyinfo->mac_id_name
11646 = (char *) xmalloc (SCHARS (Vinvocation_name)
11647 + SCHARS (Vsystem_name)
11648 + 2);
11649 sprintf (dpyinfo->mac_id_name, "%s@%s",
11650 SDATA (Vinvocation_name), SDATA (Vsystem_name));
11651#else
11652 dpyinfo->mac_id_name = (char *) xmalloc (strlen ("Mac Display") + 1);
11653 strcpy (dpyinfo->mac_id_name, "Mac Display");
11654#endif
11655
11656 dpyinfo->reference_count = 0;
11657 dpyinfo->resx = 72.0;
11658 dpyinfo->resy = 72.0;
11659
11660 mac_get_screen_info (dpyinfo);
11661
11662 dpyinfo->grabbed = 0;
11663 dpyinfo->root_window = NULL;
11664 dpyinfo->image_cache = make_image_cache ();
11665
11666 dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1;
11667 dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1;
11668 dpyinfo->mouse_face_face_id = DEFAULT_FACE_ID;
11669 dpyinfo->mouse_face_window = Qnil;
11670 dpyinfo->mouse_face_overlay = Qnil;
11671 dpyinfo->mouse_face_hidden = 0;
11604 11672
11605 dpyinfo->xrdb = mac_make_rdb (xrm_option); 11673 dpyinfo->xrdb = mac_make_rdb (xrm_option);
11606 11674
@@ -11618,6 +11686,7 @@ mac_term_init (display_name, xrm_option, resource_name)
11618 11686
11619 return dpyinfo; 11687 return dpyinfo;
11620} 11688}
11689
11621/* Get rid of display DPYINFO, assuming all frames are already gone. */ 11690/* Get rid of display DPYINFO, assuming all frames are already gone. */
11622 11691
11623void 11692void
@@ -11838,6 +11907,8 @@ mac_initialize ()
11838 11907
11839 init_apple_event_handler (); 11908 init_apple_event_handler ();
11840 11909
11910 init_dm_notification_handler ();
11911
11841 if (!inhibit_window_system) 11912 if (!inhibit_window_system)
11842 { 11913 {
11843 static const ProcessSerialNumber psn = {0, kCurrentProcess}; 11914 static const ProcessSerialNumber psn = {0, kCurrentProcess};
diff --git a/src/print.c b/src/print.c
index cbf5830a85b..250b62ec3a5 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 6d84d4c4a87..56e4335ca2c 100644
--- a/src/process.c
+++ b/src/process.c
@@ -1268,7 +1268,7 @@ Returns nil if format of ADDRESS is invalid. */)
1268 if (VECTORP (address)) /* AF_INET or AF_INET6 */ 1268 if (VECTORP (address)) /* AF_INET or AF_INET6 */
1269 { 1269 {
1270 register struct Lisp_Vector *p = XVECTOR (address); 1270 register struct Lisp_Vector *p = XVECTOR (address);
1271 Lisp_Object args[6]; 1271 Lisp_Object args[10];
1272 int nargs, i; 1272 int nargs, i;
1273 1273
1274 if (p->size == 4 || (p->size == 5 && !NILP (omit_port))) 1274 if (p->size == 4 || (p->size == 5 && !NILP (omit_port)))
@@ -1295,7 +1295,20 @@ Returns nil if format of ADDRESS is invalid. */)
1295 return Qnil; 1295 return Qnil;
1296 1296
1297 for (i = 0; i < nargs; i++) 1297 for (i = 0; i < nargs; i++)
1298 args[i+1] = p->contents[i]; 1298 {
1299 EMACS_INT element = XINT (p->contents[i]);
1300
1301 if (element < 0 || element > 65535)
1302 return Qnil;
1303
1304 if (nargs <= 5 /* IPv4 */
1305 && i < 4 /* host, not port */
1306 && element > 255)
1307 return Qnil;
1308
1309 args[i+1] = p->contents[i];
1310 }
1311
1299 return Fformat (nargs+1, args); 1312 return Fformat (nargs+1, args);
1300 } 1313 }
1301 1314
@@ -1305,7 +1318,6 @@ Returns nil if format of ADDRESS is invalid. */)
1305 args[0] = build_string ("<Family %d>"); 1318 args[0] = build_string ("<Family %d>");
1306 args[1] = Fcar (address); 1319 args[1] = Fcar (address);
1307 return Fformat (2, args); 1320 return Fformat (2, args);
1308
1309 } 1321 }
1310 1322
1311 return Qnil; 1323 return Qnil;
@@ -1411,7 +1423,6 @@ list_processes_1 (query_only)
1411 if (CONSP (p->status)) 1423 if (CONSP (p->status))
1412 symbol = XCAR (p->status); 1424 symbol = XCAR (p->status);
1413 1425
1414
1415 if (EQ (symbol, Qsignal)) 1426 if (EQ (symbol, Qsignal))
1416 { 1427 {
1417 Lisp_Object tem; 1428 Lisp_Object tem;
@@ -4811,8 +4822,8 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4811 subprocess termination and SIGCHLD. */ 4822 subprocess termination and SIGCHLD. */
4812 else if (nread == 0 && !NETCONN_P (proc)) 4823 else if (nread == 0 && !NETCONN_P (proc))
4813 ; 4824 ;
4814#endif /* O_NDELAY */ 4825#endif /* O_NDELAY */
4815#endif /* O_NONBLOCK */ 4826#endif /* O_NONBLOCK */
4816#ifdef HAVE_PTYS 4827#ifdef HAVE_PTYS
4817 /* On some OSs with ptys, when the process on one end of 4828 /* On some OSs with ptys, when the process on one end of
4818 a pty exits, the other end gets an error reading with 4829 a pty exits, the other end gets an error reading with
@@ -4823,11 +4834,17 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display,
4823 get a SIGCHLD). 4834 get a SIGCHLD).
4824 4835
4825 However, it has been known to happen that the SIGCHLD 4836 However, it has been known to happen that the SIGCHLD
4826 got lost. So raise the signl again just in case. 4837 got lost. So raise the signal again just in case.
4827 It can't hurt. */ 4838 It can't hurt. */
4828 else if (nread == -1 && errno == EIO) 4839 else if (nread == -1 && errno == EIO)
4829 kill (getpid (), SIGCHLD); 4840 {
4830#endif /* HAVE_PTYS */ 4841 /* Clear the descriptor now, so we only raise the signal once. */
4842 FD_CLR (channel, &input_wait_mask);
4843 FD_CLR (channel, &non_keyboard_wait_mask);
4844
4845 kill (getpid (), SIGCHLD);
4846 }
4847#endif /* HAVE_PTYS */
4831 /* If we can detect process termination, don't consider the process 4848 /* If we can detect process termination, don't consider the process
4832 gone just because its pipe is closed. */ 4849 gone just because its pipe is closed. */
4833#ifdef SIGCHLD 4850#ifdef SIGCHLD
@@ -6506,17 +6523,12 @@ sigchld_handler (signo)
6506#define WUNTRACED 0 6523#define WUNTRACED 0
6507#endif /* no WUNTRACED */ 6524#endif /* no WUNTRACED */
6508 /* Keep trying to get a status until we get a definitive result. */ 6525 /* Keep trying to get a status until we get a definitive result. */
6509 while (1) 6526 do
6510 { 6527 {
6511 errno = 0; 6528 errno = 0;
6512 pid = wait3 (&w, WNOHANG | WUNTRACED, 0); 6529 pid = wait3 (&w, WNOHANG | WUNTRACED, 0);
6513 if (! (pid < 0 && errno == EINTR))
6514 break;
6515 /* Avoid a busyloop: wait3 is a system call, so we do not want
6516 to prevent the kernel from actually sending SIGCHLD to emacs
6517 by asking for it all the time. */
6518 sleep (1);
6519 } 6530 }
6531 while (pid < 0 && errno == EINTR);
6520 6532
6521 if (pid <= 0) 6533 if (pid <= 0)
6522 { 6534 {
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 e4961a6bfbe..8cac4ea2376 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -7498,6 +7498,8 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
7498 doc: /* Show STRING in a \"tooltip\" window on frame FRAME. 7498 doc: /* Show STRING in a \"tooltip\" window on frame FRAME.
7499A tooltip window is a small window displaying a string. 7499A tooltip window is a small window displaying a string.
7500 7500
7501This is an internal function; Lisp code should call `tooltip-show'.
7502
7501FRAME nil or omitted means use the selected frame. 7503FRAME nil or omitted means use the selected frame.
7502 7504
7503PARMS is an optional list of frame parameters which can be 7505PARMS is an optional list of frame parameters which can be
diff --git a/src/widget.c b/src/widget.c
index 883be9a23f4..bcb038340a5 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 94e56d10371..154743e5b5d 100644
--- a/src/window.c
+++ b/src/window.c
@@ -2316,6 +2316,8 @@ check_all_windows ()
2316 2316
2317DEFUN ("get-lru-window", Fget_lru_window, Sget_lru_window, 0, 2, 0, 2317DEFUN ("get-lru-window", Fget_lru_window, Sget_lru_window, 0, 2, 0,
2318 doc: /* Return the window least recently selected or used for display. 2318 doc: /* Return the window least recently selected or used for display.
2319\(LRU means Least Recently Used.)
2320
2319Return a full-width window if possible. 2321Return a full-width window if possible.
2320A minibuffer window is never a candidate. 2322A minibuffer window is never a candidate.
2321A dedicated window is never a candidate, unless DEDICATED is non-nil, 2323A dedicated window is never a candidate, unless DEDICATED is non-nil,
diff --git a/src/xdisp.c b/src/xdisp.c
index aea7ab515ab..66629f659ac 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -12786,6 +12786,8 @@ redisplay_window (window, just_this_one_p)
12786 int rc; 12786 int rc;
12787 int centering_position = -1; 12787 int centering_position = -1;
12788 int last_line_misfit = 0; 12788 int last_line_misfit = 0;
12789 int save_beg_unchanged = BEG_UNCHANGED;
12790 int save_end_unchanged = END_UNCHANGED;
12789 12791
12790 SET_TEXT_POS (lpoint, PT, PT_BYTE); 12792 SET_TEXT_POS (lpoint, PT, PT_BYTE);
12791 opoint = lpoint; 12793 opoint = lpoint;
@@ -13154,11 +13156,20 @@ redisplay_window (window, just_this_one_p)
13154 && NILP (do_mouse_tracking) 13156 && NILP (do_mouse_tracking)
13155 && CHARPOS (startp) > BEGV) 13157 && CHARPOS (startp) > BEGV)
13156 { 13158 {
13157 /* Make sure beg_unchanged and end_unchanged are up to date. 13159#if 0
13158 Do it only if buffer has really changed. This may or may 13160 /* The following code tried to make BEG_UNCHANGED and
13159 not have been done by try_window_id (see which) already. */ 13161 END_UNCHANGED up to date (similar to try_window_id).
13162 Is it important to do so?
13163
13164 The trouble is that it's a little too strict when it
13165 comes to overlays: modify_overlay can call
13166 BUF_COMPUTE_UNCHANGED, which alters BUF_BEG_UNCHANGED and
13167 BUF_END_UNCHANGED directly without moving the gap.
13168
13169 This can result in spurious recentering when overlays are
13170 altered in the buffer. So unless it's proven necessary,
13171 let's leave this commented out for now. -- cyd. */
13160 if (MODIFF > SAVE_MODIFF 13172 if (MODIFF > SAVE_MODIFF
13161 /* This seems to happen sometimes after saving a buffer. */
13162 || BEG_UNCHANGED + END_UNCHANGED > Z_BYTE) 13173 || BEG_UNCHANGED + END_UNCHANGED > Z_BYTE)
13163 { 13174 {
13164 if (GPT - BEG < BEG_UNCHANGED) 13175 if (GPT - BEG < BEG_UNCHANGED)
@@ -13166,9 +13177,10 @@ redisplay_window (window, just_this_one_p)
13166 if (Z - GPT < END_UNCHANGED) 13177 if (Z - GPT < END_UNCHANGED)
13167 END_UNCHANGED = Z - GPT; 13178 END_UNCHANGED = Z - GPT;
13168 } 13179 }
13180#endif
13169 13181
13170 if (CHARPOS (startp) > BEG + BEG_UNCHANGED 13182 if (CHARPOS (startp) > BEG + save_beg_unchanged
13171 && CHARPOS (startp) <= Z - END_UNCHANGED) 13183 && CHARPOS (startp) <= Z - save_end_unchanged)
13172 { 13184 {
13173 /* There doesn't seems to be a simple way to find a new 13185 /* There doesn't seems to be a simple way to find a new
13174 window start that is near the old window start, so 13186 window start that is near the old window start, so
@@ -15865,13 +15877,37 @@ cursor_row_p (w, row)
15865 15877
15866 if (PT == MATRIX_ROW_END_CHARPOS (row)) 15878 if (PT == MATRIX_ROW_END_CHARPOS (row))
15867 { 15879 {
15868 /* If the row ends with a newline from a string, we don't want 15880 /* Suppose the row ends on a string.
15869 the cursor there, but we still want it at the start of the 15881 Unless the row is continued, that means it ends on a newline
15870 string if the string starts in this row. 15882 in the string. If it's anything other than a display string
15871 If the row is continued it doesn't end in a newline. */ 15883 (e.g. a before-string from an overlay), we don't want the
15884 cursor there. (This heuristic seems to give the optimal
15885 behavior for the various types of multi-line strings.) */
15872 if (CHARPOS (row->end.string_pos) >= 0) 15886 if (CHARPOS (row->end.string_pos) >= 0)
15873 cursor_row_p = (row->continued_p 15887 {
15874 || PT >= MATRIX_ROW_START_CHARPOS (row)); 15888 if (row->continued_p)
15889 cursor_row_p = 1;
15890 else
15891 {
15892 /* Check for `display' property. */
15893 struct glyph *beg = row->glyphs[TEXT_AREA];
15894 struct glyph *end = beg + row->used[TEXT_AREA] - 1;
15895 struct glyph *glyph;
15896
15897 cursor_row_p = 0;
15898 for (glyph = end; glyph >= beg; --glyph)
15899 if (STRINGP (glyph->object))
15900 {
15901 Lisp_Object prop
15902 = Fget_char_property (make_number (PT),
15903 Qdisplay, Qnil);
15904 cursor_row_p =
15905 (!NILP (prop)
15906 && display_prop_string_p (prop, glyph->object));
15907 break;
15908 }
15909 }
15910 }
15875 else if (MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row)) 15911 else if (MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row))
15876 { 15912 {
15877 /* If the row ends in middle of a real character, 15913 /* If the row ends in middle of a real character,
@@ -22451,7 +22487,7 @@ note_mode_line_or_margin_highlight (window, x, y, area)
22451 22487
22452 Lisp_Object mouse_face; 22488 Lisp_Object mouse_face;
22453 int original_x_pixel = x; 22489 int original_x_pixel = x;
22454 struct glyph * glyph = NULL; 22490 struct glyph * glyph = NULL, * row_start_glyph = NULL;
22455 struct glyph_row *row; 22491 struct glyph_row *row;
22456 22492
22457 if (area == ON_MODE_LINE || area == ON_HEADER_LINE) 22493 if (area == ON_MODE_LINE || area == ON_HEADER_LINE)
@@ -22469,7 +22505,7 @@ note_mode_line_or_margin_highlight (window, x, y, area)
22469 /* Find glyph */ 22505 /* Find glyph */
22470 if (row->mode_line_p && row->enabled_p) 22506 if (row->mode_line_p && row->enabled_p)
22471 { 22507 {
22472 glyph = row->glyphs[TEXT_AREA]; 22508 glyph = row_start_glyph = row->glyphs[TEXT_AREA];
22473 end = glyph + row->used[TEXT_AREA]; 22509 end = glyph + row->used[TEXT_AREA];
22474 22510
22475 for (x0 = original_x_pixel; 22511 for (x0 = original_x_pixel;
@@ -22593,12 +22629,17 @@ note_mode_line_or_margin_highlight (window, x, y, area)
22593 is converted to a flatten by emacs lisp interpreter. 22629 is converted to a flatten by emacs lisp interpreter.
22594 The internal string is an element of the structures. 22630 The internal string is an element of the structures.
22595 The displayed string is the flatten string. */ 22631 The displayed string is the flatten string. */
22596 for (tmp_glyph = glyph - 1, gpos = 0; 22632 gpos = 0;
22597 tmp_glyph->charpos >= XINT (b); 22633 if (glyph > row_start_glyph)
22598 tmp_glyph--, gpos++)
22599 { 22634 {
22600 if (!EQ (tmp_glyph->object, glyph->object)) 22635 tmp_glyph = glyph - 1;
22601 break; 22636 while (tmp_glyph >= row_start_glyph
22637 && tmp_glyph->charpos >= XINT (b)
22638 && EQ (tmp_glyph->object, glyph->object))
22639 {
22640 tmp_glyph--;
22641 gpos++;
22642 }
22602 } 22643 }
22603 22644
22604 /* Calculate the lenght(glyph sequence length: GSEQ_LENGTH) of 22645 /* Calculate the lenght(glyph sequence length: GSEQ_LENGTH) of
@@ -24081,7 +24122,7 @@ and is used only on frames for which no explicit name has been set
24081 doc: /* Maximum number of lines to keep in the message log buffer. 24122 doc: /* Maximum number of lines to keep in the message log buffer.
24082If nil, disable message logging. If t, log messages but don't truncate 24123If nil, disable message logging. If t, log messages but don't truncate
24083the buffer when it becomes large. */); 24124the buffer when it becomes large. */);
24084 Vmessage_log_max = make_number (50); 24125 Vmessage_log_max = make_number (100);
24085 24126
24086 DEFVAR_LISP ("window-size-change-functions", &Vwindow_size_change_functions, 24127 DEFVAR_LISP ("window-size-change-functions", &Vwindow_size_change_functions,
24087 doc: /* Functions called before redisplay, if window sizes have changed. 24128 doc: /* Functions called before redisplay, if window sizes have changed.
diff --git a/src/xfns.c b/src/xfns.c
index ec9d54dcf93..f2c85814847 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -5036,6 +5036,8 @@ DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
5036 doc: /* Show STRING in a "tooltip" window on frame FRAME. 5036 doc: /* Show STRING in a "tooltip" window on frame FRAME.
5037A tooltip window is a small X window displaying a string. 5037A tooltip window is a small X window displaying a string.
5038 5038
5039This is an internal function; Lisp code should call `tooltip-show'.
5040
5039FRAME nil or omitted means use the selected frame. 5041FRAME nil or omitted means use the selected frame.
5040 5042
5041PARMS is an optional list of frame parameters which can be used to 5043PARMS is an optional list of frame parameters which can be used to