diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ChangeLog | 251 | ||||
-rw-r--r-- | src/ChangeLog.5 | 2 | ||||
-rw-r--r-- | src/alloc.c | 4 | ||||
-rw-r--r-- | src/buffer.c | 11 | ||||
-rw-r--r-- | src/dispnew.c | 35 | ||||
-rw-r--r-- | src/editfns.c | 42 | ||||
-rw-r--r-- | src/emacs.c | 5 | ||||
-rw-r--r-- | src/fileio.c | 8 | ||||
-rw-r--r-- | src/gmalloc.c | 78 | ||||
-rw-r--r-- | src/gtkutil.c | 1 | ||||
-rw-r--r-- | src/indent.c | 7 | ||||
-rw-r--r-- | src/intervals.c | 68 | ||||
-rw-r--r-- | src/keyboard.c | 6 | ||||
-rw-r--r-- | src/keymap.c | 55 | ||||
-rw-r--r-- | src/keymap.h | 2 | ||||
-rw-r--r-- | src/lread.c | 6 | ||||
-rw-r--r-- | src/m/hp800.h | 77 | ||||
-rw-r--r-- | src/m/sr2k.h | 160 | ||||
-rw-r--r-- | src/mac.c | 5 | ||||
-rw-r--r-- | src/macfns.c | 20 | ||||
-rw-r--r-- | src/macselect.c | 15 | ||||
-rw-r--r-- | src/macterm.c | 197 | ||||
-rw-r--r-- | src/print.c | 2 | ||||
-rw-r--r-- | src/process.c | 46 | ||||
-rw-r--r-- | src/s/darwin.h | 17 | ||||
-rw-r--r-- | src/undo.c | 2 | ||||
-rw-r--r-- | src/unexhp9k800.c | 334 | ||||
-rw-r--r-- | src/w32fns.c | 2 | ||||
-rw-r--r-- | src/widget.c | 5 | ||||
-rw-r--r-- | src/window.c | 2 | ||||
-rw-r--r-- | src/xdisp.c | 81 | ||||
-rw-r--r-- | src/xfns.c | 2 |
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 @@ +2007-04-16 Chong Yidong <cyd@stupidchicken.com> + + * dispnew.c (adjust_frame_glyphs_for_frame_redisplay): Set + garbaged flag in presence of window margins. + (showing_window_margins_p): New function. + + * xdisp.c (cursor_row_p): Only end row on newline if it's a + display string. Suggested by Lennart Borgman. + +2007-04-16 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> + + * alloc.c (mem_insert): Set min_heap_address and max_heap_address + if they are not yet initialized. + +2007-04-15 Chong Yidong <cyd@stupidchicken.com> + + * xdisp.c (redisplay_window): When deciding whether or not to + recenter, don't use the reset values of BEG_UNCHANGED and + END_UNCHANGED. + +2007-04-13 Kim F. Storm <storm@cua.dk> + + * buffer.c (Fkill_buffer): gcpro BUF during kill_buffer_processes + and check that buffer is still alive upon return. + +2007-04-13 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> + + * macterm.c [!TARGET_API_MAC_CARBON]: Include Displays.h. + (mac_screen_config_changed): New variable. + (mac_handle_dm_notification, init_dm_notification_handler) + (mac_get_screen_info): New functions. + [MAC_OS8] (main): Call init_dm_notification_handler. + (mac_initialize) [MAC_OSX]: Likewise. + (XTread_socket): Call mac_get_screen_info if screen config changed. + (mac_initialized): Make static. + (mac_initialize_display_info): Remove function. + (mac_term_init): Call mac_get_screen_info. Add partial contents of + mac_initialize_display_info. + +2007-04-12 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> + + * mac.c (xrm_get_preference_database, Fmac_get_preference) + [TARGET_API_MAC_CARBON]: Use CFPreferencesAppSynchronize. + + * macterm.c [TARGET_API_MAC_CARBON] (mac_post_mouse_moved_event): + Use GetGlobalMouse instead of GetMouse and LocalToGlobal. + (mac_initialize_display_info) [MAC_OSX]: Use CGRectZero. + (mac_initialize_display_info) [!MAC_OSX]: dpyinfo->height and + dpyinfo->width are those of whole screen. + +2007-04-10 Chong Yidong <cyd@stupidchicken.com> + + * xdisp.c (note_mode_line_or_margin_highlight): Don't decrement + glyph pointer before start of glyph row. + +2007-04-09 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> + + * s/darwin.h (__restrict, struct kboard): Remove outdated workarounds. + (C_SWITCH_SYSTEM): Remove `-I../mac/src'. + +2007-04-09 Martin Rudalics <rudalics@gmx.at> + + * indent.c (Fmove_to_column): Set next_boundary with correct start pt. + +2007-04-08 Richard Stallman <rms@gnu.org> + + * xdisp.c (syms_of_xdisp) <message-log-max>: Default 100. + +2007-04-07 Chong Yidong <cyd@stupidchicken.com> + + * editfns.c (Ftranspose_regions): Validate interval before setting + text properties. + +2007-04-03 Eli Zaretskii <eliz@gnu.org> + + * emacs.c (main): Fix instructions for building Emacs for profiling. + +2007-04-03 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> + + * gtkutil.c (xg_update_menubar): Call g_list_next after moving + menu bar item. + +2007-04-02 Juanma Barranquero <lekktu@gmail.com> + + * print.c (Fprin1_to_string): Use macro SPECPDL_INDEX. + +2007-04-01 Chong Yidong <cyd@stupidchicken.com> + + * keymap.c (Fcommand_remapping): New optional argument. + (where_is_internal): Use new keymaps argument. + (Fkey_binding): Caller changed. + + * keyboard.c (command_loop_1): Caller changed. + +2007-03-31 Eli Zaretskii <eliz@gnu.org> + + * window.c (Fget_lru_window): Doc fix. + +2007-03-30 Chong Yidong <cyd@stupidchicken.com> + + * undo.c (Fprimitive_undo): Give clearer error message when trying + to change text properties outside accessible part of buffer. + +2007-03-29 Kim F. Storm <storm@cua.dk> + + * process.c (wait_reading_process_output) [HAVE_PTYS]: + When EIO happens, clear channel from descriptor masks before raising + SIGCHLD signal to avoid busy loop between read and sigchld_handler. + (sigchld_handler): Remove sleep (2007-03-11 & 2007-03-26 changes). + +2007-03-29 Juanma Barranquero <lekktu@gmail.com> + + * buffer.c (Fset_buffer_major_mode): Check that BUFFER is valid. + + * process.c (Fformat_network_address): Return nil when the + argument vector contains invalid values. + +2007-03-28 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> + + * gmalloc.c [HAVE_GTK_AND_PTHREAD]: Define USE_PTHREAD. + [USE_PTHREAD]: Include pthread.h. + (malloc_init_once_control, _malloc_mutex) [USE_PTHREAD]: New variables. + (malloc_initialize_1): New function created from __malloc_initialize. + (__malloc_initialize): Use it. + (LOCK, UNLOCK): New macros to make malloc etc. thread safe. + (_malloc_internal, _free_internal, _realloc_internal): Use them. + + * lread.c (readchar): Extend BLOCK_INPUT block to ferror/clearerr. + +2007-03-27 Juanma Barranquero <lekktu@gmail.com> + + * process.c (Fformat_network_address): Make args array big enough + to format IPv6 addresses. + +2007-03-27 Glenn Morris <rgm@gnu.org> + + * m/hp800.h: Restore HP-UX support (removed 2007-01-29). + +2007-03-26 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> + + * macfns.c (Fx_display_mm_height, Fx_display_mm_width): Scale whole + screen size in pixels by millimeters per pixel of main display. + + * macselect.c (get_scrap_target_type_list, x_own_selection): + Move assignments outside predicate macros. + (Vselection_converter_alist): Doc fix. + + * macterm.c (create_text_encoding_info_alist): Move assignments + outside predicate macros. + (mac_initialize_display_info) [MAC_OSX]: dpyinfo->height and + dpyinfo->width are those of whole screen. + +2007-03-26 Sam Steingold <sds@gnu.org> + + * process.c (sigchld_handler): Delay by 1ms instead of 1s to + alleviate sluggishness (the original problem is still fixed). + +2007-03-25 Kim F. Storm <storm@cua.dk> + + * intervals.c (merge_properties): Use explicit loop instead of + Fplist_member to avoid QUIT. Don't use Fcdr. + (intervals_equal): Likewise. Rewrite loop to perform length check + on the fly rather than calling Flength. Don't use Fcar. + +2007-03-24 Eli Zaretskii <eliz@gnu.org> + + * editfns.c (Fgoto_char): Doc fix. + + * indent.c (Findent_to): Doc fix. + +2007-03-24 Chong Yidong <cyd@stupidchicken.com> + + * editfns.c (Ftranspose_regions): Use set_text_properties_1 + instead of Fset_text_properties to avoid GC. Signal after change. + +2007-03-24 Eli Zaretskii <eliz@gnu.org> + + * xfns.c (Fx_show_tip): Doc fix. + + * macfns.c (Fx_show_tip): Doc fix. + + * w32fns.c (Fx_show_tip): Doc fix. + +2007-03-23 Kim F. Storm <storm@cua.dk> + + * intervals.c (merge_properties, intervals_equal): + Use Fplist_member instead of Fmemq to find properties. + +2007-03-23 Glenn Morris <rgm@gnu.org> + + * unexhp9k800.c: Restore file with clarified legal status. + * m/sr2k.h: Restore since dependency unexhp9k800.c is restored. + +2007-03-22 Chong Yidong <cyd@stupidchicken.com> + + * widget.c (EmacsFrameSetCharSize): Catch X errors. + +2007-03-22 Kenichi Handa <handa@m17n.org> + + * fileio.c (Fcopy_file): Call barf_or_query_if_file_exists with + non-encoded file name. + (Frename_file): Likewise. + (Fadd_name_to_file): Likewise. + (Fmake_symbolic_link): Likewise. + 2007-03-20 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> * Makefile.in (alloca.o, gtkutil.o): Depend on systime.h. @@ -25,9 +230,9 @@ * print.c: Include blockinput.h. (Fredirect_debugging_output): Add BLOCK_INPUT around fclose. - * process.c (Fmake_network_process) [HAVE_GETADDRINFO]: Clear - immediate_quit before calling freeaddrinfo. Add BLOCK_INPUT - around freeaddrinfo. + * process.c (Fmake_network_process) [HAVE_GETADDRINFO]: + Clear immediate_quit before calling freeaddrinfo. + Add BLOCK_INPUT around freeaddrinfo. * term.c: Include blockinput.h. (write_glyphs, insert_glyphs): Add BLOCK_INPUT around fwrite. @@ -51,8 +256,8 @@ (x_activate_menubar, mac_menu_show): Set it during menu tracking. (popup_activated): New function. - * xdisp.c (redisplay_internal, note_mouse_highlight): Check - popup_activated for MAC_OS. + * xdisp.c (redisplay_internal, note_mouse_highlight): + Check popup_activated for MAC_OS. 2007-03-17 Juanma Barranquero <lekktu@gmail.com> @@ -491,9 +696,9 @@ 2007-01-22 YAMAMOTO Mitsuharu <mituharu@math.s.chiba-u.ac.jp> - * macselect.c [TARGET_API_MAC_CARBON] (mac_do_receive_drag): Don't - pass keyboard modifiers to mac_store_drag_event, but put them as - kEventParamKeyModifiers Apple event parameter. + * macselect.c [TARGET_API_MAC_CARBON] (mac_do_receive_drag): + Don't pass keyboard modifiers to mac_store_drag_event, but put + them as kEventParamKeyModifiers Apple event parameter. 2007-01-21 Chong Yidong <cyd@stupidchicken.com> @@ -577,8 +782,8 @@ (mac_dialog) [TARGET_API_MAC_CARBON]: Remove function. (mac_dialog_show) [TARGET_API_MAC_CARBON]: Use create_and_show_dialog. - * macterm.c (x_free_frame_resources) [USE_CG_DRAWING]: Call - mac_prepare_for_quickdraw. + * macterm.c (x_free_frame_resources) [USE_CG_DRAWING]: + Call mac_prepare_for_quickdraw. (quit_char, make_ctrl_char) [TARGET_API_MAC_CARBON]: Move externs outside #ifdef MAC_OSX. (mac_quit_char_key_p) [TARGET_API_MAC_CARBON]: Move function @@ -2230,8 +2435,8 @@ 2006-08-28 Kenichi Handa <handa@m17n.org> - * coding.c (Fdetect_coding_region, Fdetect_coding_string): Fix - docstring about ISO-2022 control characters. + * coding.c (Fdetect_coding_region, Fdetect_coding_string): + Fix docstring about ISO-2022 control characters. 2006-08-28 Kim F. Storm <storm@cua.dk> @@ -2454,7 +2659,7 @@ 2006-08-09 Kenichi Handa <handa@m17n.org> * coding.c (syms_of_coding): Improve the docstring - file-coding-system-alist. + of file-coding-system-alist. 2006-08-07 Andreas Schwab <schwab@suse.de> @@ -3402,8 +3607,8 @@ * macterm.c (font_panel_shown_p) [USE_MAC_FONT_PANEL]: New variable. (mac_font_panel_visible_p, mac_show_hide_font_panel) [USE_MAC_FONT_PANEL]: New functions. - [USE_MAC_FONT_PANEL] (mac_set_font_info_for_selection): Return - immediately if font panel is not visible. + [USE_MAC_FONT_PANEL] (mac_set_font_info_for_selection): + Return immediately if font panel is not visible. * macterm.h (mac_font_panel_visible_p, mac_show_hide_font_panel): Add externs. @@ -3422,8 +3627,8 @@ 2006-05-29 Jan Dj,Ad(Brv <jan.h.d@swipnet.se> - * sound.c (alsa_open, alsa_configure, alsa_write): Move - assignment to err out of if-statement. + * sound.c (alsa_open, alsa_configure, alsa_write): + Move assignment to err out of if-statement. * gtkutil.c (menu_nav_ended): New function. (create_menus): Connect menu_nav_ended to "selection-done" to fix @@ -3838,8 +4043,8 @@ (Qpanel_closed, Qselection) [USE_MAC_FONT_PANEL]: Likewise. (syms_of_macterm): Intern and staticpro them. (init_font_name_table) [USE_ATSUI]: Add data to Vmac_atsu_font_table. - [TARGET_API_MAC_CARBON] (mac_store_event_ref_as_apple_event): New - function. + [TARGET_API_MAC_CARBON] (mac_store_event_ref_as_apple_event): + New function. [USE_CARBON_EVENTS] (mac_handle_command_event): Use it. [MAC_OSX] (mac_store_services_event): Likewise. [USE_CARBON_EVENTS] (mac_handle_window_event) [MAC_OSX]: Handle @@ -3891,8 +4096,8 @@ [TARGET_API_MAC_CARBON] (create_apple_event): New function. [TARGET_API_MAC_CARBON] (create_apple_event_from_event_ref): Use it. Use xrealloc instead of repeated xmalloc/xfree. - [TARGET_API_MAC_CARBON] (create_apple_event_from_drag_ref): New - function. + [TARGET_API_MAC_CARBON] (create_apple_event_from_drag_ref): + New function. * macmenu.c (restore_menu_items, cleanup_popup_menu): Return a value. @@ -5752,8 +5957,8 @@ objects until we are done with the parsing. (parse_single_submenu, digest_single_submenu): New functions. (single_submenu): Function deleted, replaced by those two. - (install_menu_quit_handler) [HAVE_CANCELMENUTRACKING]: Don't - create or dispose of EventHandlerUPP. Install hander to all submenus. + (install_menu_quit_handler) [HAVE_CANCELMENUTRACKING]: Don't create + or dispose of EventHandlerUPP. Install hander to all submenus. (mac_menu_show) [!HAVE_MULTILINGUAL_MENU]: Use ENCODE_MENU_STRING instead of ENCODE_SYSTEM. (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 @@ * textprop.c (Fnext_property_change): Fix previous change. -1995-03-23 Kevin Rodgers <kevinr@ihs.com> +1995-03-23 Kevin Rodgers <kevinr@ihs.com> (tiny change) * print.c (temp_output_buffer_setup): (Re)set the default 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) { struct mem_node *c, *parent, *x; - if (start < min_heap_address) + if (min_heap_address == NULL || start < min_heap_address) min_heap_address = start; - if (end > max_heap_address) + if (max_heap_address == NULL || end > max_heap_address) max_heap_address = end; /* 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. */) unlock_buffer (b); #endif /* CLASH_DETECTION */ + GCPRO1 (buf); kill_buffer_processes (buf); + UNGCPRO; + + /* Killing buffer processes may run sentinels which may + have called kill-buffer. */ + + if (NILP (b->name)) + return Qnil; + clear_charpos_cache (b); tem = Vinhibit_quit; @@ -1644,6 +1653,8 @@ the current buffer's major mode. */) int count; Lisp_Object function; + CHECK_BUFFER (buffer); + if (STRINGP (XBUFFER (buffer)->name) && strcmp (SDATA (XBUFFER (buffer)->name), "*scratch*") == 0) 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 static struct glyph_matrix *save_current_matrix P_ ((struct frame *)); static void restore_current_matrix P_ ((struct frame *, struct glyph_matrix *)); +static int showing_window_margins_p P_ ((struct window *)); static void fake_current_matrices P_ ((Lisp_Object)); static void redraw_overlapping_rows P_ ((struct window *, int)); static void redraw_overlapped_rows P_ ((struct window *, int)); @@ -2153,6 +2154,33 @@ adjust_frame_glyphs (f) f->glyphs_initialized_p = 1; } +/* Return 1 if any window in the tree has nonzero window margins. See + the hack at the end of adjust_frame_glyphs_for_frame_redisplay. */ +static int +showing_window_margins_p (w) + struct window *w; +{ + while (w) + { + if (!NILP (w->hchild)) + { + if (showing_window_margins_p (XWINDOW (w->hchild))) + return 1; + } + else if (!NILP (w->vchild)) + { + if (showing_window_margins_p (XWINDOW (w->vchild))) + return 1; + } + else if (!NILP (w->left_margin_cols) + || !NILP (w->right_margin_cols)) + return 1; + + w = NILP (w->next) ? 0 : XWINDOW (w->next); + } + return 0; +} + /* In the window tree with root W, build current matrices of leaf windows from the frame's current matrix. */ @@ -2340,7 +2368,12 @@ adjust_frame_glyphs_for_frame_redisplay (f) if (display_completed && !FRAME_GARBAGED_P (f) && matrix_dim.width == f->current_matrix->matrix_w - && matrix_dim.height == f->current_matrix->matrix_h) + && matrix_dim.height == f->current_matrix->matrix_h + /* For some reason, the frame glyph matrix gets corrupted if + any of the windows contain margins. I haven't been able + to hunt down the reason, but for the moment this prevents + the problem from manifesting. -- cyd */ + && !showing_window_margins_p (XWINDOW (FRAME_ROOT_WINDOW (f)))) { struct glyph_matrix *copy = save_current_matrix (f); 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) DEFUN ("goto-char", Fgoto_char, Sgoto_char, 1, 1, "NGoto char: ", doc: /* Set point to POSITION, a number or marker. -Beginning of buffer is position (point-min), end is (point-max). */) +Beginning of buffer is position (point-min), end is (point-max). + +The return value is POSITION. */) (position) register Lisp_Object position; { @@ -4117,7 +4119,10 @@ Transposing beyond buffer boundaries is an error. */) int gap, len1, len_mid, len2; unsigned char *start1_addr, *start2_addr, *temp; - INTERVAL cur_intv, tmp_interval1, tmp_interval_mid, tmp_interval2; + INTERVAL cur_intv, tmp_interval1, tmp_interval_mid, tmp_interval2, tmp_interval3; + Lisp_Object buf; + + XSETBUFFER (buf, current_buffer); cur_intv = BUF_INTERVALS (current_buffer); validate_region (&startr1, &endr1); @@ -4224,8 +4229,11 @@ Transposing beyond buffer boundaries is an error. */) tmp_interval1 = copy_intervals (cur_intv, start1, len1); tmp_interval2 = copy_intervals (cur_intv, start2, len2); - Fset_text_properties (make_number (start1), make_number (end2), - Qnil, Qnil); + /* Don't use Fset_text_properties: that can cause GC, which can + clobber objects stored in the tmp_intervals. */ + tmp_interval3 = validate_interval_range (buf, &startr1, &endr2, 0); + if (!NULL_INTERVAL_P (tmp_interval3)) + set_text_properties_1 (startr1, endr2, Qnil, buf, tmp_interval3); /* First region smaller than second. */ if (len1_byte < len2_byte) @@ -4281,10 +4289,14 @@ Transposing beyond buffer boundaries is an error. */) record_change (start2, len2); tmp_interval1 = copy_intervals (cur_intv, start1, len1); tmp_interval2 = copy_intervals (cur_intv, start2, len2); - Fset_text_properties (make_number (start1), make_number (end1), - Qnil, Qnil); - Fset_text_properties (make_number (start2), make_number (end2), - Qnil, Qnil); + + tmp_interval3 = validate_interval_range (buf, &startr1, &endr1, 0); + if (!NULL_INTERVAL_P (tmp_interval3)) + set_text_properties_1 (startr1, endr1, Qnil, buf, tmp_interval3); + + tmp_interval3 = validate_interval_range (buf, &startr2, &endr2, 0); + if (!NULL_INTERVAL_P (tmp_interval3)) + set_text_properties_1 (startr2, endr2, Qnil, buf, tmp_interval3); SAFE_ALLOCA (temp, unsigned char *, len1_byte); start1_addr = BYTE_POS_ADDR (start1_byte); @@ -4310,8 +4322,10 @@ Transposing beyond buffer boundaries is an error. */) tmp_interval1 = copy_intervals (cur_intv, start1, len1); tmp_interval_mid = copy_intervals (cur_intv, end1, len_mid); tmp_interval2 = copy_intervals (cur_intv, start2, len2); - Fset_text_properties (make_number (start1), make_number (end2), - Qnil, Qnil); + + tmp_interval3 = validate_interval_range (buf, &startr1, &endr2, 0); + if (!NULL_INTERVAL_P (tmp_interval3)) + set_text_properties_1 (startr1, endr2, Qnil, buf, tmp_interval3); /* holds region 2 */ SAFE_ALLOCA (temp, unsigned char *, len2_byte); @@ -4341,8 +4355,10 @@ Transposing beyond buffer boundaries is an error. */) tmp_interval1 = copy_intervals (cur_intv, start1, len1); tmp_interval_mid = copy_intervals (cur_intv, end1, len_mid); tmp_interval2 = copy_intervals (cur_intv, start2, len2); - Fset_text_properties (make_number (start1), make_number (end2), - Qnil, Qnil); + + tmp_interval3 = validate_interval_range (buf, &startr1, &endr2, 0); + if (!NULL_INTERVAL_P (tmp_interval3)) + set_text_properties_1 (startr1, endr2, Qnil, buf, tmp_interval3); /* holds region 1 */ SAFE_ALLOCA (temp, unsigned char *, len1_byte); @@ -4377,6 +4393,8 @@ Transposing beyond buffer boundaries is an error. */) fix_start_end_in_overlays (start1, end2); } + signal_after_change (XINT (start1), XINT (end2 - start1), + XINT (end2 - start1)); return Qnil; } 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 /* Set up for profiling. This is known to work on FreeBSD, GNU/Linux and MinGW. It might work on some other systems too. Give it a try and tell us if it works on your system. To compile - for profiling use something like: - `make CFLAGS="-pg -g -O -DPROFILING=1'. */ + for profiling, add -pg to the switches your platform uses in + CFLAGS and LDFLAGS. For example: + `make CFLAGS="-pg -g -O -DPROFILING=1" LDFLAGS="-pg -g"'. */ #if defined (__FreeBSD__) || defined (GNU_LINUX) || defined(__MINGW32__) #ifdef PROFILING 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. */) if (NILP (ok_if_already_exists) || INTEGERP (ok_if_already_exists)) - barf_or_query_if_file_exists (encoded_newname, "copy to it", + barf_or_query_if_file_exists (newname, "copy to it", INTEGERP (ok_if_already_exists), &out_st, 0); else if (stat (SDATA (encoded_newname), &out_st) < 0) out_st.st_mode = 0; @@ -2782,7 +2782,7 @@ This is what happens in interactive use with M-x. */) #endif if (NILP (ok_if_already_exists) || INTEGERP (ok_if_already_exists)) - barf_or_query_if_file_exists (encoded_newname, "rename to it", + barf_or_query_if_file_exists (newname, "rename to it", INTEGERP (ok_if_already_exists), 0, 0); #ifndef BSD4_1 if (0 > rename (SDATA (encoded_file), SDATA (encoded_newname))) @@ -2859,7 +2859,7 @@ This is what happens in interactive use with M-x. */) if (NILP (ok_if_already_exists) || INTEGERP (ok_if_already_exists)) - barf_or_query_if_file_exists (encoded_newname, "make it a new name", + barf_or_query_if_file_exists (newname, "make it a new name", INTEGERP (ok_if_already_exists), 0, 0); unlink (SDATA (newname)); @@ -2920,7 +2920,7 @@ This happens for interactive use with M-x. */) if (NILP (ok_if_already_exists) || INTEGERP (ok_if_already_exists)) - barf_or_query_if_file_exists (encoded_linkname, "make it a link", + barf_or_query_if_file_exists (linkname, "make it a link", INTEGERP (ok_if_already_exists), 0, 0); if (0 > symlink (SDATA (encoded_filename), 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 @@ /* This file is no longer automatically generated from libc. */ #define _MALLOC_INTERNAL +#ifdef HAVE_GTK_AND_PTHREAD +#define USE_PTHREAD +#endif /* The malloc headers and source files from the C library follow here. */ @@ -73,6 +76,10 @@ Fifth Floor, Boston, MA 02110-1301, USA. #include <unistd.h> #endif +#ifdef USE_PTHREAD +#include <pthread.h> +#endif + #endif /* _MALLOC_INTERNAL. */ @@ -229,6 +236,15 @@ extern __ptr_t _malloc_internal PP ((__malloc_size_t __size)); extern __ptr_t _realloc_internal PP ((__ptr_t __ptr, __malloc_size_t __size)); extern void _free_internal PP ((__ptr_t __ptr)); +#ifdef USE_PTHREAD +extern pthread_mutex_t _malloc_mutex; +#define LOCK() pthread_mutex_lock (&_malloc_mutex) +#define UNLOCK() pthread_mutex_unlock (&_malloc_mutex) +#else +#define LOCK() +#define UNLOCK() +#endif + #endif /* _MALLOC_INTERNAL. */ /* Given an address in the middle of a malloc'd object, @@ -536,13 +552,14 @@ register_heapinfo () _heapinfo[block + blocks].busy.info.size = -blocks; } -/* Set everything up and remember that we have. */ -int -__malloc_initialize () -{ - if (__malloc_initialized) - return 0; +#ifdef USE_PTHREAD +static pthread_once_t malloc_init_once_control = PTHREAD_ONCE_INIT; +pthread_mutex_t _malloc_mutex; +#endif +static void +malloc_initialize_1 () +{ #ifdef GC_MCHECK mcheck (NULL); #endif @@ -550,10 +567,21 @@ __malloc_initialize () if (__malloc_initialize_hook) (*__malloc_initialize_hook) (); +#ifdef USE_PTHREAD + { + pthread_mutexattr_t attr; + + pthread_mutexattr_init (&attr); + pthread_mutexattr_settype (&attr, PTHREAD_MUTEX_RECURSIVE); + pthread_mutex_init (&_malloc_mutex, &attr); + pthread_mutexattr_destroy (&attr); + } +#endif + heapsize = HEAP / BLOCKSIZE; _heapinfo = (malloc_info *) align (heapsize * sizeof (malloc_info)); if (_heapinfo == NULL) - return 0; + return; memset (_heapinfo, 0, heapsize * sizeof (malloc_info)); _heapinfo[0].free.size = 0; _heapinfo[0].free.next = _heapinfo[0].free.prev = 0; @@ -565,7 +593,23 @@ __malloc_initialize () __malloc_initialized = 1; PROTECT_MALLOC_STATE (1); - return 1; + return; +} + +/* Set everything up and remember that we have. */ +int +__malloc_initialize () +{ +#ifdef USE_PTHREAD + pthread_once (&malloc_init_once_control, malloc_initialize_1); +#else + if (__malloc_initialized) + return 0; + + malloc_initialize_1 (); +#endif + + return __malloc_initialized; } static int morecore_recursing; @@ -708,6 +752,7 @@ _malloc_internal (size) return NULL; #endif + LOCK (); PROTECT_MALLOC_STATE (0); if (size < sizeof (struct list)) @@ -765,7 +810,7 @@ _malloc_internal (size) if (result == NULL) { PROTECT_MALLOC_STATE (1); - return NULL; + goto out; } /* Link all fragments but the first into the free list. */ @@ -831,7 +876,7 @@ _malloc_internal (size) } result = morecore (wantblocks * BLOCKSIZE); if (result == NULL) - return NULL; + goto out; block = BLOCK (result); /* Put the new block at the end of the free list. */ _heapinfo[block].free.size = wantblocks; @@ -886,6 +931,8 @@ _malloc_internal (size) } PROTECT_MALLOC_STATE (1); + out: + UNLOCK (); return result; } @@ -996,6 +1043,7 @@ _free_internal (ptr) if (ptr == NULL) return; + LOCK (); PROTECT_MALLOC_STATE (0); for (l = _aligned_blocks; l != NULL; l = l->next) @@ -1221,6 +1269,7 @@ _free_internal (ptr) } PROTECT_MALLOC_STATE (1); + UNLOCK (); } /* Return memory to the heap. */ @@ -1384,6 +1433,7 @@ _realloc_internal (ptr, size) block = BLOCK (ptr); + LOCK (); PROTECT_MALLOC_STATE (0); type = _heapinfo[block].busy.type; @@ -1398,7 +1448,7 @@ _realloc_internal (ptr, size) { memcpy (result, ptr, size); _free_internal (ptr); - return result; + goto out; } } @@ -1451,7 +1501,7 @@ _realloc_internal (ptr, size) (void) _malloc_internal (blocks * BLOCKSIZE); _free_internal (previous); } - return NULL; + goto out; } if (ptr != result) memmove (result, ptr, blocks * BLOCKSIZE); @@ -1471,7 +1521,7 @@ _realloc_internal (ptr, size) and copy the lesser of the new size and the old. */ result = _malloc_internal (size); if (result == NULL) - return NULL; + goto out; memcpy (result, ptr, min (size, (__malloc_size_t) 1 << type)); _free_internal (ptr); } @@ -1479,6 +1529,8 @@ _realloc_internal (ptr, size) } PROTECT_MALLOC_STATE (1); + out: + UNLOCK (); return result; } 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, g_list_free (*list); *list = iter = gtk_container_get_children (GTK_CONTAINER (menubar)); while (nr-- > 0) iter = g_list_next (iter); + if (iter) iter = g_list_next (iter); val = val->next; ++pos; } 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) DEFUN ("indent-to", Findent_to, Sindent_to, 1, 2, "NIndent to column: ", doc: /* Indent from point with tabs and spaces until COLUMN is reached. Optional second argument MINIMUM says always do at least MINIMUM spaces -even if that goes past COLUMN; by default, MINIMUM is zero. */) +even if that goes past COLUMN; by default, MINIMUM is zero. + +The return value is COLUMN. */) (column, minimum) Lisp_Object column, minimum; { @@ -951,7 +953,6 @@ The return value is the current column. */) pos = PT; pos_byte = PT_BYTE; end = ZV; - next_boundary = pos; /* If we're starting past the desired column, back up to beginning of line and scan from there. */ @@ -963,6 +964,8 @@ The return value is the current column. */) col = 0; } + next_boundary = pos; + while (pos < end) { 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) while (CONSP (o)) { sym = XCAR (o); - val = Fmemq (sym, target->plist); + o = XCDR (o); + CHECK_CONS (o); + + val = target->plist; + while (CONSP (val) && !EQ (XCAR (val), sym)) + { + val = XCDR (val); + if (!CONSP (val)) + break; + val = XCDR (val); + } if (NILP (val)) { - o = XCDR (o); - CHECK_CONS (o); val = XCAR (o); target->plist = Fcons (sym, Fcons (val, target->plist)); - o = XCDR (o); } - else - o = Fcdr (XCDR (o)); + o = XCDR (o); } } @@ -147,8 +153,8 @@ int intervals_equal (i0, i1) INTERVAL i0, i1; { - register Lisp_Object i0_cdr, i0_sym, i1_val; - register int i1_len; + register Lisp_Object i0_cdr, i0_sym; + register Lisp_Object i1_cdr, i1_val; if (DEFAULT_INTERVAL_P (i0) && DEFAULT_INTERVAL_P (i1)) return 1; @@ -156,39 +162,43 @@ intervals_equal (i0, i1) if (DEFAULT_INTERVAL_P (i0) || DEFAULT_INTERVAL_P (i1)) return 0; - i1_len = XFASTINT (Flength (i1->plist)); - if (i1_len & 0x1) /* Paranoia -- plists are always even */ - abort (); - i1_len /= 2; i0_cdr = i0->plist; - while (CONSP (i0_cdr)) + i1_cdr = i1->plist; + while (CONSP (i0_cdr) && CONSP (i1_cdr)) { - /* Lengths of the two plists were unequal. */ - if (i1_len == 0) - return 0; - i0_sym = XCAR (i0_cdr); - i1_val = Fmemq (i0_sym, i1->plist); + i0_cdr = XCDR (i0_cdr); + if (!CONSP (i0_cdr)) + return 0; /* abort (); */ + i1_val = i1->plist; + while (CONSP (i1_val) && !EQ (XCAR (i1_val), i0_sym)) + { + i1_val = XCDR (i1_val); + if (!CONSP (i1_val)) + return 0; /* abort (); */ + i1_val = XCDR (i1_val); + } /* i0 has something i1 doesn't. */ if (EQ (i1_val, Qnil)) return 0; /* i0 and i1 both have sym, but it has different values in each. */ - i0_cdr = XCDR (i0_cdr); - CHECK_CONS (i0_cdr); - if (!EQ (Fcar (Fcdr (i1_val)), XCAR (i0_cdr))) + if (!CONSP (i1_val) + || (i1_val = XCDR (i1_val), !CONSP (i1_val)) + || !EQ (XCAR (i1_val), XCAR (i0_cdr))) return 0; i0_cdr = XCDR (i0_cdr); - i1_len--; - } - /* Lengths of the two plists were unequal. */ - if (i1_len > 0) - return 0; + i1_cdr = XCDR (i1_cdr); + if (!CONSP (i1_cdr)) + return 0; /* abort (); */ + i1_cdr = XCDR (i1_cdr); + } - return 1; + /* Lengths of the two plists were equal. */ + return (NILP (i0_cdr) && NILP (i1_cdr)); } @@ -2538,7 +2548,7 @@ set_intervals_multibyte_1 (i, multi_flag, start, start_byte, end, end_byte) temp = CHAR_TO_BYTE (left_end); /* If LEFT_END_BYTE is in the middle of a character, - adjust it and LEFT_END to a char boundary. */ + adjust it and LEFT_END to a char boundary. */ if (left_end_byte > temp) { left_end_byte = temp; @@ -2570,7 +2580,7 @@ set_intervals_multibyte_1 (i, multi_flag, start, start_byte, end, end_byte) right_start = BYTE_TO_CHAR (right_start_byte); /* If RIGHT_START_BYTE is in the middle of a character, - adjust it and RIGHT_START to a char boundary. */ + adjust it and RIGHT_START to a char boundary. */ temp = CHAR_TO_BYTE (right_start); 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 () if (SYMBOLP (cmd)) { Lisp_Object cmd1; - if (cmd1 = Fcommand_remapping (cmd, Qnil), !NILP (cmd1)) + if (cmd1 = Fcommand_remapping (cmd, Qnil, Qnil), !NILP (cmd1)) cmd = cmd1; } @@ -9008,9 +9008,9 @@ read_key_sequence (keybuf, bufsize, prompt, dont_downcase_last, of the place where a mouse click occurred. */ volatile int localized_local_map = 0; - /* The index in defs[] of the first keymap that has a binding for + /* The index in submaps[] of the first keymap that has a binding for this key sequence. In other words, the lowest i such that - defs[i] is non-nil. */ + submaps[i] is non-nil. */ volatile int first_binding; /* Index of the first key that has no binding. 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. */) /* This function may GC (it calls Fkey_binding). */ -DEFUN ("command-remapping", Fcommand_remapping, Scommand_remapping, 1, 2, 0, - doc: /* Return the remapping for command COMMAND in current keymaps. +DEFUN ("command-remapping", Fcommand_remapping, Scommand_remapping, 1, 3, 0, + doc: /* Return the remapping for command COMMAND. Returns nil if COMMAND is not remapped (or not a symbol). If the optional argument POSITION is non-nil, it specifies a mouse position as returned by `event-start' and `event-end', and the remapping occurs in the keymaps associated with it. It can also be a number or marker, in which case the keymap properties at the specified -buffer position instead of point are used. */) - (command, position) - Lisp_Object command, position; +buffer position instead of point are used. The KEYMAPS argument is +ignored if POSITION is non-nil. + +If the optional argument KEYMAPS is non-nil, it should be a list of +keymaps to search for command remapping. Otherwise, search for the +remapping in all currently active keymaps. */) + (command, position, keymaps) + Lisp_Object command, position, keymaps; { if (!SYMBOLP (command)) return Qnil; ASET (command_remapping_vector, 1, command); - return Fkey_binding (command_remapping_vector, Qnil, Qt, position); + + if (NILP (keymaps)) + return Fkey_binding (command_remapping_vector, Qnil, Qt, position); + else + { + Lisp_Object maps, binding; + + for (maps = keymaps; !NILP (maps); maps = Fcdr (maps)) + { + binding = Flookup_key (Fcar (maps), command_remapping_vector, Qnil); + if (!NILP (binding) && !INTEGERP (binding)) + return binding; + } + return Qnil; + } } /* Value is number if KEY is too long; nil if valid but has no definition. */ @@ -1394,8 +1413,10 @@ silly_event_symbol_error (c) static Lisp_Object *cmm_modes = NULL, *cmm_maps = NULL; static int cmm_size = 0; -/* Store a pointer to an array of the keymaps of the currently active - minor modes in *buf, and return the number of maps it contains. +/* Store a pointer to an array of the currently active minor modes in + *modeptr, a pointer to an array of the keymaps of the currently + active minor modes in *mapptr, and return the number of maps + *mapptr contains. This function always returns a pointer to the same buffer, and may 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. if (NILP (no_remap) && SYMBOLP (value)) { Lisp_Object value1; - if (value1 = Fcommand_remapping (value, position), !NILP (value1)) + if (value1 = Fcommand_remapping (value, position, Qnil), !NILP (value1)) value = value1; } @@ -2570,15 +2591,6 @@ where_is_internal (definition, keymaps, firstonly, noindirect, no_remap) /* 1 means ignore all menu bindings entirely. */ int nomenus = !NILP (firstonly) && !EQ (firstonly, Qnon_ascii); - /* If this command is remapped, then it has no key bindings - of its own. */ - if (NILP (no_remap) && SYMBOLP (definition)) - { - Lisp_Object tem; - if (tem = Fcommand_remapping (definition, Qnil), !NILP (tem)) - return Qnil; - } - found = keymaps; while (CONSP (found)) { @@ -2592,6 +2604,13 @@ where_is_internal (definition, keymaps, firstonly, noindirect, no_remap) found = Qnil; sequences = Qnil; + /* If this command is remapped, then it has no key bindings + of its own. */ + if (NILP (no_remap) + && SYMBOLP (definition) + && !NILP (Fcommand_remapping (definition, Qnil, keymaps))) + RETURN_UNGCPRO (Qnil); + for (; !NILP (maps); maps = Fcdr (maps)) { /* 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); EXFUN (Fkeymap_prompt, 1); EXFUN (Fdefine_key, 3); EXFUN (Flookup_key, 3); -EXFUN (Fcommand_remapping, 2); +EXFUN (Fcommand_remapping, 3); EXFUN (Fkey_binding, 4); EXFUN (Fkey_description, 2); EXFUN (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) { BLOCK_INPUT; c = getc (instream); - UNBLOCK_INPUT; #ifdef EINTR /* Interrupted reads have been observed while reading over the network */ while (c == EOF && ferror (instream) && errno == EINTR) { + UNBLOCK_INPUT; QUIT; - clearerr (instream); BLOCK_INPUT; + clearerr (instream); c = getc (instream); - UNBLOCK_INPUT; } #endif + UNBLOCK_INPUT; return c; } 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. */ #define XSET(var, type, ptr) \ ((var) = ((int)(type) << VALBITS) + (((unsigned) (ptr) << BITS_PER_INT-VALBITS) >> BITS_PER_INT-VALBITS)) -/* Definitions for GNU/Linux. (HP/UX is unsupported because of the - removal of unexhp9k800.c due to lack of legal papers.) */ +/* Common definitions for HPUX and GNU/Linux. */ -#ifdef GNU_LINUX +#if defined (__hpux) || defined (GNU_LINUX) /* Now define a symbol for the cpu type, if your compiler does not define it automatically: Ones defined so far include vax, m68000, ns16000, pyramid, @@ -94,6 +93,12 @@ Boston, MA 02110-1301, USA. */ #define NO_REMAP +#endif /* __hpux or GNU_LINUX */ + +/* Stuff for just GNU/Linux. */ + +#ifdef GNU_LINUX + /* Data type of load average, as read out of kmem. */ #define LOAD_AVE_TYPE long @@ -104,6 +109,72 @@ Boston, MA 02110-1301, USA. */ #endif /* GNU_LINUX */ +/* Stuff for just HPUX. */ + +#ifdef __hpux + +/* Define VIRT_ADDR_VARIES if the virtual addresses of + pure and impure space as loaded can vary, and even their + relative order cannot be relied on. + + Otherwise Emacs assumes that text space precedes data space, + numerically. */ + +#define VIRT_ADDR_VARIES + +/* the data segment on this machine always starts at address 0x40000000. */ + +#define DATA_SEG_BITS 0x40000000 + +#define DATA_START 0x40000000 +#define TEXT_START 0x00000000 + +/* This machine requires completely different unexec code + which lives in a separate file. Specify the file name. */ + +#define UNEXEC unexhp9k800.o + +#define LIBS_MACHINE +#define LIBS_DEBUG + +/* Include the file bsdtty.h, since this machine has job control. */ +#define NEED_BSDTTY + +/* Data type of load average, as read out of kmem. */ + +#define LOAD_AVE_TYPE double + +/* Convert that into an integer that is 100 for a load average of 1.0 */ + +#define LOAD_AVE_CVT(x) ((int) (x * 100.0)) + +/* The symbol in the kernel where the load average is found + is named _avenrun. At this time there are two major flavors + of hp-ux (there is the s800 and s300 (s200) flavors). The + differences are thusly moved to the corresponding machine description file. +*/ + +/* no underscore please */ +#define LDAV_SYMBOL "avenrun" + +#if 0 /* Supposedly no longer true. */ +/* In hpux, for unknown reasons, S_IFLNK is defined even though + symbolic links do not exist. + Make sure our conditionals based on S_IFLNK are not confused. + + Here we assume that stat.h is included before config.h + so that we can override it here. */ + +#undef S_IFLNK +#endif + +/* On USG systems these have different names. */ + +#define index strchr +#define rindex strrchr + +#endif /* __hpux */ + /* Systems with GCC don't need to lose. */ #ifdef __NetBSD__ # 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 @@ +/* machine description file for Hitachi SR2001/SR2201 machines. + Copyright (C) 1996, 2001, 2002, 2003, 2004, 2005, + 2006, 2007 Free Software Foundation, Inc. + +This file is part of GNU Emacs. + +GNU Emacs is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2, or (at your option) +any later version. + +GNU Emacs is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with GNU Emacs; see the file COPYING. If not, write to +the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +Boston, MA 02110-1301, USA. */ + + +/* The following line tells the configuration script what sort of + operating system this machine is likely to run. + USUAL-OPSYS="hpux" */ + +/* Define WORDS_BIG_ENDIAN iff lowest-numbered byte in a word + is the most significant byte. */ + +#define WORDS_BIG_ENDIAN + +/* Define NO_ARG_ARRAY if you cannot take the address of the first of a + * group of arguments and treat it as an array of the arguments. */ + +#define NO_ARG_ARRAY + +/* Define WORD_MACHINE if addresses and such have + * to be corrected before they can be used as byte counts. */ + +#undef WORD_MACHINE + +/* Now define a symbol for the cpu type, if your compiler + does not define it automatically: + Ones defined so far include vax, m68000, ns16000, pyramid, + orion, tahoe, APOLLO and many others */ +#ifndef hp9000s800 +# define hp9000s800 +#endif + +/* Use type int rather than a union, to represent Lisp_Object */ +/* This is desirable for most machines. */ + +#define NO_UNION_TYPE + +/* Define EXPLICIT_SIGN_EXTEND if XINT must explicitly sign-extend + the bit field into an int. In other words, if bit fields + are always unsigned. + + If you use NO_UNION_TYPE, this flag does not matter. */ + +#define EXPLICIT_SIGN_EXTEND + +/* The standard definitions of these macros would work ok, + but these are faster because the constants are short. */ + + +#define XUINT(a) (((unsigned)(a) << BITS_PER_INT-VALBITS) >> BITS_PER_INT-VALBITS) + +#define XSET(var, type, ptr) \ + ((var) = ((int)(type) << VALBITS) + (((unsigned) (ptr) << BITS_PER_INT-VALBITS) >> BITS_PER_INT-VALBITS)) + +/* #ifdef __hpux */ +/* Now define a symbol for the cpu type, if your compiler + does not define it automatically: + Ones defined so far include vax, m68000, ns16000, pyramid, + orion, tahoe, APOLLO and many others */ + +#ifndef hp9000s800 +# define hp9000s800 +#endif + + +/* Data type of load average, as read out of kmem. */ + +#define LOAD_AVE_TYPE double + +/* Convert that into an integer that is 100 for a load average of 1.0 */ + +#define LOAD_AVE_CVT(x) ((int) (x * 100.0)) + + +/* Define CANNOT_DUMP on machines where unexec does not work. + Then the function dump-emacs will not be defined + and temacs will do (load "loadup") automatically unless told otherwise. */ + +#undef CANNOT_DUMP + +/* Define VIRT_ADDR_VARIES if the virtual addresses of + pure and impure space as loaded can vary, and even their + relative order cannot be relied on. + + Otherwise Emacs assumes that text space precedes data space, + numerically. */ + +#define VIRT_ADDR_VARIES + +/* the data segment on this machine always starts at address 0x40000000. */ + +#define DATA_SEG_BITS 0x40000000 + +#define DATA_START 0x40000000 +#define TEXT_START 0x00000000 + +/* Define NO_REMAP if memory segmentation makes it not work well + to change the boundary between the text section and data section + when Emacs is dumped. If you define this, the preloaded Lisp + code will not be sharable; but that's better than failing completely. */ + +#define NO_REMAP + +/* This machine requires completely different unexec code + which lives in a separate file. Specify the file name. */ + +#define UNEXEC unexhp9k800.o + +#define LIBS_MACHINE +#define LIBS_DEBUG + +/* Include the file bsdtty.h, since this machine has job control. */ +/* #define NEED_BSDTTY */ + +/* The symbol in the kernel where the load average is found + is named _avenrun. At this time there are two major flavors + of hp-ux (there is the s800 and s300 (s200) flavors). The + differences are thusly moved to the corresponding machine description file. +*/ + +/* no underscore please */ +#define LDAV_SYMBOL "avenrun" + +#if 0 /* Supposedly no longer true. */ +/* In hpux, for unknown reasons, S_IFLNK is defined even though + symbolic links do not exist. + Make sure our conditionals based on S_IFLNK are not confused. + + Here we assume that stat.h is included before config.h + so that we can override it here. */ + +#undef S_IFLNK +#endif + +/* On USG systems these have different names. */ + +#define index strchr +#define rindex strrchr + +/* #endif */ + +/* arch-tag: 4ced5b51-ffe6-4be1-9954-eb40657023a5 + (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) if (app_id == NULL) goto out; } + if (!CFPreferencesAppSynchronize (app_id)) + goto out; key_set = CFSetCreateMutable (NULL, 0, &kCFCopyStringSetCallBacks); if (key_set == NULL) @@ -4650,6 +4652,9 @@ otherwise. */) if (app_id == NULL) goto out; } + if (!CFPreferencesAppSynchronize (app_id)) + goto out; + key_str = cfstring_create_with_string (XCAR (key)); if (key_str == NULL) 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. */) Lisp_Object display; { struct mac_display_info *dpyinfo = check_x_display_info (display); + float mm_per_pixel; - /* Only of the main display. */ #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 #if MAC_OS_X_VERSION_MIN_REQUIRED == 1020 if (CGDisplayScreenSize != NULL) @@ -3116,9 +3116,8 @@ If omitted or nil, that stands for the selected frame's display. */) BLOCK_INPUT; size = CGDisplayScreenSize (kCGDirectMainDisplay); + mm_per_pixel = size.height / CGDisplayPixelsHigh (kCGDirectMainDisplay); UNBLOCK_INPUT; - - return make_number ((int) (size.height + .5f)); } #if MAC_OS_X_VERSION_MIN_REQUIRED == 1020 else @@ -3127,9 +3126,11 @@ If omitted or nil, that stands for the selected frame's display. */) #if MAC_OS_X_VERSION_MAX_ALLOWED < 1030 || MAC_OS_X_VERSION_MIN_REQUIRED == 1020 { /* This is an approximation. */ - return make_number ((int) (dpyinfo->height * 25.4 / dpyinfo->resy)); + mm_per_pixel = 25.4f / dpyinfo->resy; } #endif + + return make_number ((int) (dpyinfo->height * mm_per_pixel + 0.5f)); } DEFUN ("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. */) Lisp_Object display; { struct mac_display_info *dpyinfo = check_x_display_info (display); + float mm_per_pixel; - /* Only of the main display. */ #if MAC_OS_X_VERSION_MAX_ALLOWED >= 1030 #if MAC_OS_X_VERSION_MIN_REQUIRED == 1020 if (CGDisplayScreenSize != NULL) @@ -3152,9 +3153,8 @@ If omitted or nil, that stands for the selected frame's display. */) BLOCK_INPUT; size = CGDisplayScreenSize (kCGDirectMainDisplay); + mm_per_pixel = size.width / CGDisplayPixelsWide (kCGDirectMainDisplay); UNBLOCK_INPUT; - - return make_number ((int) (size.width + .5f)); } #if MAC_OS_X_VERSION_MIN_REQUIRED == 1020 else @@ -3163,9 +3163,11 @@ If omitted or nil, that stands for the selected frame's display. */) #if MAC_OS_X_VERSION_MAX_ALLOWED < 1030 || MAC_OS_X_VERSION_MIN_REQUIRED == 1020 { /* This is an approximation. */ - return make_number ((int) (dpyinfo->width * 25.4 / dpyinfo->resx)); + mm_per_pixel = 25.4f / dpyinfo->resx; } #endif + + return make_number ((int) (dpyinfo->width * mm_per_pixel + 0.5f)); } DEFUN ("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, doc: /* Show STRING in a "tooltip" window on frame FRAME. A tooltip window is a small window displaying a string. +This is an internal function; Lisp code should call `tooltip-show'. + FRAME nil or omitted means use the selected frame. PARMS 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) { ScrapFlavorType flavor_type = 0; - if (CONSP (XCAR (rest)) && SYMBOLP (target_type = XCAR (XCAR (rest))) + if (CONSP (XCAR (rest)) + && (target_type = XCAR (XCAR (rest)), + SYMBOLP (target_type)) && (flavor_type = scrap_has_target_type (scrap, target_type))) { result = Fcons (target_type, result); @@ -449,9 +451,11 @@ x_own_selection (selection_name, selection_value) for (rest = Vselection_converter_alist; CONSP (rest); rest = XCDR (rest)) { if (!(CONSP (XCAR (rest)) - && SYMBOLP (type = XCAR (XCAR (rest))) + && (type = XCAR (XCAR (rest)), + SYMBOLP (type)) && valid_scrap_target_type_p (type) - && SYMBOLP (handler_fn = XCDR (XCAR (rest))))) + && (handler_fn = XCDR (XCAR (rest)), + SYMBOLP (handler_fn)))) continue; if (!NILP (handler_fn)) @@ -1852,10 +1856,7 @@ and the local selection value (whatever was given to `x-own-selection'). The function should return the value to send to the Scrap Manager \(must be a string). A return value of nil -means that the conversion could not be done. -A return value which is the symbol `NULL' -means that a side-effect was executed, -and there is no meaningful selection value. */); +means that the conversion could not be done. */); Vselection_converter_alist = Qnil; 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. */ #include <LowMem.h> #include <Controls.h> #include <Windows.h> +#include <Displays.h> #if defined (__MRC__) || (__MSL__ >= 0x6000) #include <ControlDefinitions.h> #endif @@ -7172,11 +7173,14 @@ create_text_encoding_info_alist () Lisp_Object existing_info; if (!(CONSP (charset_info) - && STRINGP (charset = XCAR (charset_info)) + && (charset = XCAR (charset_info), + STRINGP (charset)) && CONSP (XCDR (charset_info)) - && INTEGERP (text_encoding = XCAR (XCDR (charset_info))) + && (text_encoding = XCAR (XCDR (charset_info)), + INTEGERP (text_encoding)) && CONSP (XCDR (XCDR (charset_info))) - && SYMBOLP (coding_system = XCAR (XCDR (XCDR (charset_info)))))) + && (coding_system = XCAR (XCDR (XCDR (charset_info))), + SYMBOLP (coding_system)))) continue; existing_info = assq_no_quit (text_encoding, result); @@ -8866,6 +8870,9 @@ int mac_pass_control_to_system; Carbon/Apple event handlers. */ static struct input_event *read_socket_inev = NULL; +/* Whether or not the screen configuration has changed. */ +static int mac_screen_config_changed = 0; + Point saved_menu_event_location; /* Apple Events */ @@ -10396,6 +10403,87 @@ remove_window_handler (window) } +static pascal void +mac_handle_dm_notification (event) + AppleEvent *event; +{ + mac_screen_config_changed = 1; +} + +static OSErr +init_dm_notification_handler () +{ + OSErr err; + static DMNotificationUPP handle_dm_notificationUPP = NULL; + ProcessSerialNumber psn; + + if (handle_dm_notificationUPP == NULL) + handle_dm_notificationUPP = + NewDMNotificationUPP (mac_handle_dm_notification); + + err = GetCurrentProcess (&psn); + if (err == noErr) + err = DMRegisterNotifyProc (handle_dm_notificationUPP, &psn); + + return err; +} + +static void +mac_get_screen_info (dpyinfo) + struct mac_display_info *dpyinfo; +{ +#ifdef MAC_OSX + /* HasDepth returns true if it is possible to have a 32 bit display, + but this may not be what is actually used. Mac OSX can do better. */ + dpyinfo->color_p = CGDisplaySamplesPerPixel (kCGDirectMainDisplay) > 1; + dpyinfo->n_planes = CGDisplayBitsPerPixel (kCGDirectMainDisplay); + { + CGDisplayErr err; + CGDisplayCount ndisps; + CGDirectDisplayID *displays; + + err = CGGetActiveDisplayList (0, NULL, &ndisps); + if (err == noErr) + { + displays = alloca (sizeof (CGDirectDisplayID) * ndisps); + err = CGGetActiveDisplayList (ndisps, displays, &ndisps); + } + if (err == noErr) + { + CGRect bounds = CGRectZero; + + while (ndisps-- > 0) + bounds = CGRectUnion (bounds, CGDisplayBounds (displays[ndisps])); + dpyinfo->height = CGRectGetHeight (bounds); + dpyinfo->width = CGRectGetWidth (bounds); + } + else + { + dpyinfo->height = CGDisplayPixelsHigh (kCGDirectMainDisplay); + dpyinfo->width = CGDisplayPixelsWide (kCGDirectMainDisplay); + } + } +#else /* !MAC_OSX */ + { + GDHandle gdh = GetMainDevice (); + Rect rect = (**gdh).gdRect; + + dpyinfo->color_p = TestDeviceAttribute (gdh, gdDevType); + for (dpyinfo->n_planes = 32; dpyinfo->n_planes > 0; dpyinfo->n_planes >>= 1) + if (HasDepth (gdh, dpyinfo->n_planes, gdDevType, dpyinfo->color_p)) + break; + + for (gdh = DMGetFirstScreenDevice (dmOnlyActiveDisplays); gdh; + gdh = DMGetNextScreenDevice (gdh, dmOnlyActiveDisplays)) + UnionRect (&rect, &(**gdh).gdRect, &rect); + + dpyinfo->height = rect.bottom - rect.top; + dpyinfo->width = rect.right - rect.left; + } +#endif /* !MAC_OSX */ +} + + #if __profile__ void profiler_exit_proc () @@ -10453,6 +10541,8 @@ main (void) init_apple_event_handler (); + init_dm_notification_handler (); + { char **argv; int argc = 0; @@ -10530,8 +10620,7 @@ mac_post_mouse_moved_event () { Point mouse_pos; - GetMouse (&mouse_pos); - LocalToGlobal (&mouse_pos); + GetGlobalMouse (&mouse_pos); err = SetEventParameter (event, kEventParamMouseLocation, typeQDPoint, sizeof (Point), &mouse_pos); } @@ -11375,6 +11464,12 @@ XTread_socket (sd, expected, hold_quit) pending_autoraise_frame = 0; } + if (mac_screen_config_changed) + { + mac_get_screen_info (dpyinfo); + mac_screen_config_changed = 0; + } + #if !USE_CARBON_EVENTS /* Check which frames are still visible. We do this here because there doesn't seem to be any direct notification from the Window @@ -11509,62 +11604,7 @@ make_mac_terminal_frame (struct frame *f) Initialization ***********************************************************************/ -int mac_initialized = 0; - -void -mac_initialize_display_info () -{ - struct mac_display_info *dpyinfo = &one_mac_display_info; - - bzero (dpyinfo, sizeof (*dpyinfo)); - -#ifdef MAC_OSX - dpyinfo->mac_id_name - = (char *) xmalloc (SCHARS (Vinvocation_name) - + SCHARS (Vsystem_name) - + 2); - sprintf (dpyinfo->mac_id_name, "%s@%s", - SDATA (Vinvocation_name), SDATA (Vsystem_name)); -#else - dpyinfo->mac_id_name = (char *) xmalloc (strlen ("Mac Display") + 1); - strcpy (dpyinfo->mac_id_name, "Mac Display"); -#endif - - dpyinfo->reference_count = 0; - dpyinfo->resx = 72.0; - dpyinfo->resy = 72.0; -#ifdef MAC_OSX - /* HasDepth returns true if it is possible to have a 32 bit display, - but this may not be what is actually used. Mac OSX can do better. */ - dpyinfo->color_p = CGDisplaySamplesPerPixel (kCGDirectMainDisplay) > 1; - dpyinfo->n_planes = CGDisplayBitsPerPixel (kCGDirectMainDisplay); - dpyinfo->height = CGDisplayPixelsHigh (kCGDirectMainDisplay); - dpyinfo->width = CGDisplayPixelsWide (kCGDirectMainDisplay); -#else - { - GDHandle main_device_handle = LMGetMainDevice(); - - dpyinfo->color_p = TestDeviceAttribute (main_device_handle, gdDevType); - for (dpyinfo->n_planes = 32; dpyinfo->n_planes > 0; dpyinfo->n_planes >>= 1) - if (HasDepth (main_device_handle, dpyinfo->n_planes, - gdDevType, dpyinfo->color_p)) - break; - dpyinfo->height = (**main_device_handle).gdRect.bottom; - dpyinfo->width = (**main_device_handle).gdRect.right; - } -#endif - dpyinfo->grabbed = 0; - dpyinfo->root_window = NULL; - dpyinfo->image_cache = make_image_cache (); - - dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; - dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; - dpyinfo->mouse_face_face_id = DEFAULT_FACE_ID; - dpyinfo->mouse_face_window = Qnil; - dpyinfo->mouse_face_overlay = Qnil; - dpyinfo->mouse_face_hidden = 0; -} - +static int mac_initialized = 0; static XrmDatabase mac_make_rdb (xrm_option) @@ -11598,9 +11638,37 @@ mac_term_init (display_name, xrm_option, resource_name) if (x_display_list) error ("Sorry, this version can only handle one display"); - mac_initialize_display_info (); - dpyinfo = &one_mac_display_info; + bzero (dpyinfo, sizeof (*dpyinfo)); + +#ifdef MAC_OSX + dpyinfo->mac_id_name + = (char *) xmalloc (SCHARS (Vinvocation_name) + + SCHARS (Vsystem_name) + + 2); + sprintf (dpyinfo->mac_id_name, "%s@%s", + SDATA (Vinvocation_name), SDATA (Vsystem_name)); +#else + dpyinfo->mac_id_name = (char *) xmalloc (strlen ("Mac Display") + 1); + strcpy (dpyinfo->mac_id_name, "Mac Display"); +#endif + + dpyinfo->reference_count = 0; + dpyinfo->resx = 72.0; + dpyinfo->resy = 72.0; + + mac_get_screen_info (dpyinfo); + + dpyinfo->grabbed = 0; + dpyinfo->root_window = NULL; + dpyinfo->image_cache = make_image_cache (); + + dpyinfo->mouse_face_beg_row = dpyinfo->mouse_face_beg_col = -1; + dpyinfo->mouse_face_end_row = dpyinfo->mouse_face_end_col = -1; + dpyinfo->mouse_face_face_id = DEFAULT_FACE_ID; + dpyinfo->mouse_face_window = Qnil; + dpyinfo->mouse_face_overlay = Qnil; + dpyinfo->mouse_face_hidden = 0; dpyinfo->xrdb = mac_make_rdb (xrm_option); @@ -11618,6 +11686,7 @@ mac_term_init (display_name, xrm_option, resource_name) return dpyinfo; } + /* Get rid of display DPYINFO, assuming all frames are already gone. */ void @@ -11838,6 +11907,8 @@ mac_initialize () init_apple_event_handler (); + init_dm_notification_handler (); + if (!inhibit_window_system) { 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. */) Lisp_Object printcharfun; /* struct gcpro gcpro1, gcpro2; */ Lisp_Object save_deactivate_mark; - int count = specpdl_ptr - specpdl; + int count = SPECPDL_INDEX (); struct buffer *previous; 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. */) if (VECTORP (address)) /* AF_INET or AF_INET6 */ { register struct Lisp_Vector *p = XVECTOR (address); - Lisp_Object args[6]; + Lisp_Object args[10]; int nargs, i; if (p->size == 4 || (p->size == 5 && !NILP (omit_port))) @@ -1295,7 +1295,20 @@ Returns nil if format of ADDRESS is invalid. */) return Qnil; for (i = 0; i < nargs; i++) - args[i+1] = p->contents[i]; + { + EMACS_INT element = XINT (p->contents[i]); + + if (element < 0 || element > 65535) + return Qnil; + + if (nargs <= 5 /* IPv4 */ + && i < 4 /* host, not port */ + && element > 255) + return Qnil; + + args[i+1] = p->contents[i]; + } + return Fformat (nargs+1, args); } @@ -1305,7 +1318,6 @@ Returns nil if format of ADDRESS is invalid. */) args[0] = build_string ("<Family %d>"); args[1] = Fcar (address); return Fformat (2, args); - } return Qnil; @@ -1411,7 +1423,6 @@ list_processes_1 (query_only) if (CONSP (p->status)) symbol = XCAR (p->status); - if (EQ (symbol, Qsignal)) { Lisp_Object tem; @@ -4811,8 +4822,8 @@ wait_reading_process_output (time_limit, microsecs, read_kbd, do_display, subprocess termination and SIGCHLD. */ else if (nread == 0 && !NETCONN_P (proc)) ; -#endif /* O_NDELAY */ -#endif /* O_NONBLOCK */ +#endif /* O_NDELAY */ +#endif /* O_NONBLOCK */ #ifdef HAVE_PTYS /* On some OSs with ptys, when the process on one end of 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, get a SIGCHLD). However, it has been known to happen that the SIGCHLD - got lost. So raise the signl again just in case. + got lost. So raise the signal again just in case. It can't hurt. */ else if (nread == -1 && errno == EIO) - kill (getpid (), SIGCHLD); -#endif /* HAVE_PTYS */ + { + /* Clear the descriptor now, so we only raise the signal once. */ + FD_CLR (channel, &input_wait_mask); + FD_CLR (channel, &non_keyboard_wait_mask); + + kill (getpid (), SIGCHLD); + } +#endif /* HAVE_PTYS */ /* If we can detect process termination, don't consider the process gone just because its pipe is closed. */ #ifdef SIGCHLD @@ -6506,17 +6523,12 @@ sigchld_handler (signo) #define WUNTRACED 0 #endif /* no WUNTRACED */ /* Keep trying to get a status until we get a definitive result. */ - while (1) - { + do + { errno = 0; pid = wait3 (&w, WNOHANG | WUNTRACED, 0); - if (! (pid < 0 && errno == EINTR)) - break; - /* Avoid a busyloop: wait3 is a system call, so we do not want - to prevent the kernel from actually sending SIGCHLD to emacs - by asking for it all the time. */ - sleep (1); } + while (pid < 0 && errno == EINTR); if (pid <= 0) { 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. */ * default for process-connection-type dependent on the kernel * version. */ -#define MIN_PTY_KERNEL_VERSION '7' +#define MIN_PTY_KERNEL_VERSION '7' /* * Define NONSYSTEM_DIR_LIBRARY to make Emacs emulate @@ -216,9 +216,6 @@ Boston, MA 02110-1301, USA. */ also the name of a Mach system call. */ #define init_process emacs_init_process -/* Fix compilation problem for regex.c. */ -#define __restrict - /* Used in dispnew.c. Copied from freebsd.h. */ #define PENDING_OUTPUT_COUNT(FILE) ((FILE)->_p - (FILE)->_bf._base) @@ -262,9 +259,8 @@ Boston, MA 02110-1301, USA. */ /* Definitions for how to compile & link. */ -/* Indicate that we are compiling for Mac OS X and where to find Mac - specific headers. */ -#define C_SWITCH_SYSTEM -fpascal-strings -DMAC_OSX -I../mac/src +/* Indicate that we are compiling for Mac OS X. */ +#define C_SWITCH_SYSTEM -fpascal-strings -DMAC_OSX /* Link in the Carbon lib. */ #ifdef HAVE_CARBON @@ -317,13 +313,6 @@ Boston, MA 02110-1301, USA. */ #define NO_MATHERR -/* This prevents a compilation error in xfaces.c: struct kboard * is - used in a function protocol the first time this type appears in the - file, since MULTI_KBOARD is undefined for the Mac OS X build. */ -#ifndef NOT_C_CODE -struct kboard; -#endif - /* The following solves the problem that Emacs hangs when evaluating (make-comint "test0" "/nodir/nofile" nil "") when /nodir/nofile 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. */) beg = Fcar (cdr); end = Fcdr (cdr); + if (XINT (beg) < BEGV || XINT (end) > ZV) + error ("Changes to be undone are outside visible portion of buffer"); Fput_text_property (beg, end, prop, val, Qnil); } 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 @@ +/* Unexec for HP 9000 Series 800 machines. + + This file is in the public domain. + + Author: John V. Morris + + This file was written by John V. Morris at Hewlett Packard. + Both the author and Hewlett Packard Co. have disclaimed the + copyright on this file, and it is therefore in the public domain. + (Search for "hp9k800" in copyright.list.) +*/ + +/* + Bob Desinger <hpsemc!bd@hplabs.hp.com> + + Note that the GNU project considers support for HP operation a + peripheral activity which should not be allowed to divert effort + from development of the GNU system. Changes in this code will be + installed when users send them in, but aside from that we don't + plan to think about it, or about whether other Emacs maintenance + might break it. + + + Unexec creates a copy of the old a.out file, and replaces the old data + area with the current data area. When the new file is executed, the + process will see the same data structures and data values that the + original process had when unexec was called. + + Unlike other versions of unexec, this one copies symbol table and + debug information to the new a.out file. Thus, the new a.out file + may be debugged with symbolic debuggers. + + If you fix any bugs in this, I'd like to incorporate your fixes. + Send them to uunet!hpda!hpsemc!jmorris or jmorris%hpsemc@hplabs.HP.COM. + + CAVEATS: + This routine saves the current value of all static and external + variables. This means that any data structure that needs to be + initialized must be explicitly reset. Variables will not have their + expected default values. + + Unfortunately, the HP-UX signal handler has internal initialization + flags which are not explicitly reset. Thus, for signals to work in + conjunction with this routine, the following code must executed when + the new process starts up. + + void _sigreturn (); + ... + sigsetreturn (_sigreturn); +*/ + +#ifdef emacs +#include <config.h> +#endif + +#include <stdio.h> +#include <fcntl.h> +#include <errno.h> + +#include <a.out.h> + +#ifdef HPUX_USE_SHLIBS +#include <dl.h> +#endif + +/* brk value to restore, stored as a global. + This is really used only if we used shared libraries. */ +static long brk_on_dump = 0; + +/* Called from main, if we use shared libraries. */ +int +run_time_remap (ignored) + char *ignored; +{ + brk ((char *) brk_on_dump); +} + +#undef roundup +#define roundup(x,n) (((x) + ((n) - 1)) & ~((n) - 1)) /* n is power of 2 */ +#define min(x,y) (((x) < (y)) ? (x) : (y)) + + +/* Create a new a.out file, same as old but with current data space */ + +unexec (new_name, old_name, new_end_of_text, dummy1, dummy2) + char new_name[]; /* name of the new a.out file to be created */ + char old_name[]; /* name of the old a.out file */ + char *new_end_of_text; /* ptr to new edata/etext; NOT USED YET */ + int dummy1, dummy2; /* not used by emacs */ +{ + int old, new; + int old_size, new_size; + struct header hdr; + struct som_exec_auxhdr auxhdr; + long i; + + /* For the greatest flexibility, should create a temporary file in + the same directory as the new file. When everything is complete, + rename the temp file to the new name. + This way, a program could update its own a.out file even while + it is still executing. If problems occur, everything is still + intact. NOT implemented. */ + + /* Open the input and output a.out files */ + old = open (old_name, O_RDONLY); + if (old < 0) + { perror (old_name); exit (1); } + new = open (new_name, O_CREAT|O_RDWR|O_TRUNC, 0777); + if (new < 0) + { perror (new_name); exit (1); } + + /* Read the old headers */ + read_header (old, &hdr, &auxhdr); + + brk_on_dump = (long) sbrk (0); + + /* Decide how large the new and old data areas are */ + old_size = auxhdr.exec_dsize; + /* I suspect these two statements are separate + to avoid a compiler bug in hpux version 8. */ + i = (long) sbrk (0); + new_size = i - auxhdr.exec_dmem; + + /* Copy the old file to the new, up to the data space */ + lseek (old, 0, 0); + copy_file (old, new, auxhdr.exec_dfile); + + /* Skip the old data segment and write a new one */ + lseek (old, old_size, 1); + save_data_space (new, &hdr, &auxhdr, new_size); + + /* Copy the rest of the file */ + copy_rest (old, new); + + /* Update file pointers since we probably changed size of data area */ + update_file_ptrs (new, &hdr, &auxhdr, auxhdr.exec_dfile, new_size-old_size); + + /* Save the modified header */ + write_header (new, &hdr, &auxhdr); + + /* Close the binary file */ + close (old); + close (new); + return 0; +} + +/* Save current data space in the file, update header. */ + +save_data_space (file, hdr, auxhdr, size) + int file; + struct header *hdr; + struct som_exec_auxhdr *auxhdr; + int size; +{ + /* Write the entire data space out to the file */ + if (write (file, auxhdr->exec_dmem, size) != size) + { perror ("Can't save new data space"); exit (1); } + + /* Update the header to reflect the new data size */ + auxhdr->exec_dsize = size; + auxhdr->exec_bsize = 0; +} + +/* Update the values of file pointers when something is inserted. */ + +update_file_ptrs (file, hdr, auxhdr, location, offset) + int file; + struct header *hdr; + struct som_exec_auxhdr *auxhdr; + unsigned int location; + int offset; +{ + struct subspace_dictionary_record subspace; + int i; + + /* Increase the overall size of the module */ + hdr->som_length += offset; + + /* Update the various file pointers in the header */ +#define update(ptr) if (ptr > location) ptr = ptr + offset + update (hdr->aux_header_location); + update (hdr->space_strings_location); + update (hdr->init_array_location); + update (hdr->compiler_location); + update (hdr->symbol_location); + update (hdr->fixup_request_location); + update (hdr->symbol_strings_location); + update (hdr->unloadable_sp_location); + update (auxhdr->exec_tfile); + update (auxhdr->exec_dfile); + + /* Do for each subspace dictionary entry */ + lseek (file, hdr->subspace_location, 0); + for (i = 0; i < hdr->subspace_total; i++) + { + if (read (file, &subspace, sizeof (subspace)) != sizeof (subspace)) + { perror ("Can't read subspace record"); exit (1); } + + /* If subspace has a file location, update it */ + if (subspace.initialization_length > 0 + && subspace.file_loc_init_value > location) + { + subspace.file_loc_init_value += offset; + lseek (file, -sizeof (subspace), 1); + if (write (file, &subspace, sizeof (subspace)) != sizeof (subspace)) + { perror ("Can't update subspace record"); exit (1); } + } + } + + /* Do for each initialization pointer record */ + /* (I don't think it applies to executable files, only relocatables) */ +#undef update +} + +/* Read in the header records from an a.out file. */ + +read_header (file, hdr, auxhdr) + int file; + struct header *hdr; + struct som_exec_auxhdr *auxhdr; +{ + + /* Read the header in */ + lseek (file, 0, 0); + if (read (file, hdr, sizeof (*hdr)) != sizeof (*hdr)) + { perror ("Couldn't read header from a.out file"); exit (1); } + + if (hdr->a_magic != EXEC_MAGIC && hdr->a_magic != SHARE_MAGIC + && hdr->a_magic != DEMAND_MAGIC) + { + fprintf (stderr, "a.out file doesn't have legal magic number\n"); + exit (1); + } + + lseek (file, hdr->aux_header_location, 0); + if (read (file, auxhdr, sizeof (*auxhdr)) != sizeof (*auxhdr)) + { + perror ("Couldn't read auxiliary header from a.out file"); + exit (1); + } +} + +/* Write out the header records into an a.out file. */ + +write_header (file, hdr, auxhdr) + int file; + struct header *hdr; + struct som_exec_auxhdr *auxhdr; +{ + /* Update the checksum */ + hdr->checksum = calculate_checksum (hdr); + + /* Write the header back into the a.out file */ + lseek (file, 0, 0); + if (write (file, hdr, sizeof (*hdr)) != sizeof (*hdr)) + { perror ("Couldn't write header to a.out file"); exit (1); } + lseek (file, hdr->aux_header_location, 0); + if (write (file, auxhdr, sizeof (*auxhdr)) != sizeof (*auxhdr)) + { perror ("Couldn't write auxiliary header to a.out file"); exit (1); } +} + +/* Calculate the checksum of a SOM header record. */ + +calculate_checksum (hdr) + struct header *hdr; +{ + int checksum, i, *ptr; + + checksum = 0; ptr = (int *) hdr; + + for (i = 0; i < sizeof (*hdr) / sizeof (int) - 1; i++) + checksum ^= ptr[i]; + + return (checksum); +} + +/* Copy size bytes from the old file to the new one. */ + +copy_file (old, new, size) + int new, old; + int size; +{ + int len; + int buffer[8192]; /* word aligned will be faster */ + + for (; size > 0; size -= len) + { + len = min (size, sizeof (buffer)); + if (read (old, buffer, len) != len) + { perror ("Read failure on a.out file"); exit (1); } + if (write (new, buffer, len) != len) + { perror ("Write failure in a.out file"); exit (1); } + } +} + +/* Copy the rest of the file, up to EOF. */ + +copy_rest (old, new) + int new, old; +{ + int buffer[4096]; + int len; + + /* Copy bytes until end of file or error */ + while ((len = read (old, buffer, sizeof (buffer))) > 0) + if (write (new, buffer, len) != len) break; + + if (len != 0) + { perror ("Unable to copy the rest of the file"); exit (1); } +} + +#ifdef DEBUG +display_header (hdr, auxhdr) + struct header *hdr; + struct som_exec_auxhdr *auxhdr; +{ + /* Display the header information (debug) */ + printf ("\n\nFILE HEADER\n"); + printf ("magic number %d \n", hdr->a_magic); + printf ("text loc %.8x size %d \n", auxhdr->exec_tmem, auxhdr->exec_tsize); + printf ("data loc %.8x size %d \n", auxhdr->exec_dmem, auxhdr->exec_dsize); + printf ("entry %x \n", auxhdr->exec_entry); + printf ("Bss segment size %u\n", auxhdr->exec_bsize); + printf ("\n"); + printf ("data file loc %d size %d\n", + auxhdr->exec_dfile, auxhdr->exec_dsize); + printf ("som_length %d\n", hdr->som_length); + printf ("unloadable sploc %d size %d\n", + hdr->unloadable_sp_location, hdr->unloadable_sp_size); +} +#endif /* DEBUG */ + +/* arch-tag: d55a09ac-9427-4ec4-8496-cb9d7710774f + (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, doc: /* Show STRING in a \"tooltip\" window on frame FRAME. A tooltip window is a small window displaying a string. +This is an internal function; Lisp code should call `tooltip-show'. + FRAME nil or omitted means use the selected frame. PARMS 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) Xt when the default font is changed. Tell Xt not to wait, depending on the value of the frame parameter `wait-for-wm'. */ + x_catch_errors (FRAME_X_DISPLAY (f)); XtVaSetValues (f->output_data.x->widget, XtNwaitForWm, (XtArgVal) f->output_data.x->wait_for_wm, NULL); + x_uncatch_errors (); /* Workaround: When a SIGIO or SIGALRM occurs while Xt is waiting for a ConfigureNotify event (see above), this leads @@ -972,6 +974,7 @@ EmacsFrameSetCharSize (widget, columns, rows) as is because I think it can't do any harm. */ /* In April 2002, simon.marshall@misys.com reports the problem seems not to occur any longer. */ + x_catch_errors (FRAME_X_DISPLAY (f)); XtVaSetValues (f->output_data.x->widget, XtNheight, (XtArgVal) (outer_widget_height + hdelta), XtNwidth, (XtArgVal) (outer_widget_width + wdelta), @@ -984,6 +987,8 @@ EmacsFrameSetCharSize (widget, columns, rows) XtNheight, (XtArgVal) pixel_height, XtNwidth, (XtArgVal) pixel_width, NULL); + x_uncatch_errors (); + #ifdef SIGIO sigunblock (sigmask (SIGIO)); #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 () DEFUN ("get-lru-window", Fget_lru_window, Sget_lru_window, 0, 2, 0, doc: /* Return the window least recently selected or used for display. +\(LRU means Least Recently Used.) + Return a full-width window if possible. A minibuffer window is never a candidate. A 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) int rc; int centering_position = -1; int last_line_misfit = 0; + int save_beg_unchanged = BEG_UNCHANGED; + int save_end_unchanged = END_UNCHANGED; SET_TEXT_POS (lpoint, PT, PT_BYTE); opoint = lpoint; @@ -13154,11 +13156,20 @@ redisplay_window (window, just_this_one_p) && NILP (do_mouse_tracking) && CHARPOS (startp) > BEGV) { - /* Make sure beg_unchanged and end_unchanged are up to date. - Do it only if buffer has really changed. This may or may - not have been done by try_window_id (see which) already. */ +#if 0 + /* The following code tried to make BEG_UNCHANGED and + END_UNCHANGED up to date (similar to try_window_id). + Is it important to do so? + + The trouble is that it's a little too strict when it + comes to overlays: modify_overlay can call + BUF_COMPUTE_UNCHANGED, which alters BUF_BEG_UNCHANGED and + BUF_END_UNCHANGED directly without moving the gap. + + This can result in spurious recentering when overlays are + altered in the buffer. So unless it's proven necessary, + let's leave this commented out for now. -- cyd. */ if (MODIFF > SAVE_MODIFF - /* This seems to happen sometimes after saving a buffer. */ || BEG_UNCHANGED + END_UNCHANGED > Z_BYTE) { if (GPT - BEG < BEG_UNCHANGED) @@ -13166,9 +13177,10 @@ redisplay_window (window, just_this_one_p) if (Z - GPT < END_UNCHANGED) END_UNCHANGED = Z - GPT; } +#endif - if (CHARPOS (startp) > BEG + BEG_UNCHANGED - && CHARPOS (startp) <= Z - END_UNCHANGED) + if (CHARPOS (startp) > BEG + save_beg_unchanged + && CHARPOS (startp) <= Z - save_end_unchanged) { /* There doesn't seems to be a simple way to find a new window start that is near the old window start, so @@ -15865,13 +15877,37 @@ cursor_row_p (w, row) if (PT == MATRIX_ROW_END_CHARPOS (row)) { - /* If the row ends with a newline from a string, we don't want - the cursor there, but we still want it at the start of the - string if the string starts in this row. - If the row is continued it doesn't end in a newline. */ + /* Suppose the row ends on a string. + Unless the row is continued, that means it ends on a newline + in the string. If it's anything other than a display string + (e.g. a before-string from an overlay), we don't want the + cursor there. (This heuristic seems to give the optimal + behavior for the various types of multi-line strings.) */ if (CHARPOS (row->end.string_pos) >= 0) - cursor_row_p = (row->continued_p - || PT >= MATRIX_ROW_START_CHARPOS (row)); + { + if (row->continued_p) + cursor_row_p = 1; + else + { + /* Check for `display' property. */ + struct glyph *beg = row->glyphs[TEXT_AREA]; + struct glyph *end = beg + row->used[TEXT_AREA] - 1; + struct glyph *glyph; + + cursor_row_p = 0; + for (glyph = end; glyph >= beg; --glyph) + if (STRINGP (glyph->object)) + { + Lisp_Object prop + = Fget_char_property (make_number (PT), + Qdisplay, Qnil); + cursor_row_p = + (!NILP (prop) + && display_prop_string_p (prop, glyph->object)); + break; + } + } + } else if (MATRIX_ROW_ENDS_IN_MIDDLE_OF_CHAR_P (row)) { /* If the row ends in middle of a real character, @@ -22451,7 +22487,7 @@ note_mode_line_or_margin_highlight (window, x, y, area) Lisp_Object mouse_face; int original_x_pixel = x; - struct glyph * glyph = NULL; + struct glyph * glyph = NULL, * row_start_glyph = NULL; struct glyph_row *row; if (area == ON_MODE_LINE || area == ON_HEADER_LINE) @@ -22469,7 +22505,7 @@ note_mode_line_or_margin_highlight (window, x, y, area) /* Find glyph */ if (row->mode_line_p && row->enabled_p) { - glyph = row->glyphs[TEXT_AREA]; + glyph = row_start_glyph = row->glyphs[TEXT_AREA]; end = glyph + row->used[TEXT_AREA]; for (x0 = original_x_pixel; @@ -22593,12 +22629,17 @@ note_mode_line_or_margin_highlight (window, x, y, area) is converted to a flatten by emacs lisp interpreter. The internal string is an element of the structures. The displayed string is the flatten string. */ - for (tmp_glyph = glyph - 1, gpos = 0; - tmp_glyph->charpos >= XINT (b); - tmp_glyph--, gpos++) + gpos = 0; + if (glyph > row_start_glyph) { - if (!EQ (tmp_glyph->object, glyph->object)) - break; + tmp_glyph = glyph - 1; + while (tmp_glyph >= row_start_glyph + && tmp_glyph->charpos >= XINT (b) + && EQ (tmp_glyph->object, glyph->object)) + { + tmp_glyph--; + gpos++; + } } /* 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 doc: /* Maximum number of lines to keep in the message log buffer. If nil, disable message logging. If t, log messages but don't truncate the buffer when it becomes large. */); - Vmessage_log_max = make_number (50); + Vmessage_log_max = make_number (100); DEFVAR_LISP ("window-size-change-functions", &Vwindow_size_change_functions, 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, doc: /* Show STRING in a "tooltip" window on frame FRAME. A tooltip window is a small X window displaying a string. +This is an internal function; Lisp code should call `tooltip-show'. + FRAME nil or omitted means use the selected frame. PARMS is an optional list of frame parameters which can be used to |