Now on revision 110175. ------------------------------------------------------------ revno: 110175 committer: Glenn Morris branch nick: trunk timestamp: Sun 2012-09-23 23:31:02 -0700 message: Tweak previous change diff: === modified file 'lisp/mail/emacsbug.el' --- lisp/mail/emacsbug.el 2012-09-24 00:46:47 +0000 +++ lisp/mail/emacsbug.el 2012-09-24 06:31:02 +0000 @@ -254,7 +254,7 @@ nil "-d"))) (buffer-string))))) (if (stringp lsb) - (insert "LSB Release " lsb "\n"))) + (insert "System " lsb "\n"))) (when (and system-configuration-options (not (equal system-configuration-options ""))) (insert "Configured using:\n `configure " ------------------------------------------------------------ revno: 110174 committer: Glenn Morris branch nick: trunk timestamp: Sun 2012-09-23 17:46:47 -0700 message: * lisp/mail/emacsbug.el (report-emacs-bug): Include `lsb_release -d'. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-09-23 18:21:33 +0000 +++ lisp/ChangeLog 2012-09-24 00:46:47 +0000 @@ -1,3 +1,7 @@ +2012-09-24 Glenn Morris + + * mail/emacsbug.el (report-emacs-bug): Include `lsb_release -d'. + 2012-09-23 Fabián Ezequiel Gallina * progmodes/python.el (python-indent-line): More consistent cursor === modified file 'lisp/mail/emacsbug.el' --- lisp/mail/emacsbug.el 2012-09-21 03:03:48 +0000 +++ lisp/mail/emacsbug.el 2012-09-24 00:46:47 +0000 @@ -248,6 +248,13 @@ "', version " (mapconcat 'number-to-string (x-server-version) ".") "\n") (error t))) + (let ((lsb (with-temp-buffer + (if (eq 0 (ignore-errors + (call-process "lsb_release" nil '(t nil) + nil "-d"))) + (buffer-string))))) + (if (stringp lsb) + (insert "LSB Release " lsb "\n"))) (when (and system-configuration-options (not (equal system-configuration-options ""))) (insert "Configured using:\n `configure " ------------------------------------------------------------ revno: 110173 committer: Paul Eggert branch nick: trunk timestamp: Sun 2012-09-23 15:25:22 -0700 message: Move pid_t related decls out of lisp.h. * lisp.h, syswait.h (record_child_status_change, wait_for_termination) (interruptible_wait_for_termination): Move these decls from lisp.h to syswait.h, since they use pid_t. Needed on FreeBSD; see Herbert J. Skuhra in . * callproc.c: Include syswait.h. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-09-23 19:36:31 +0000 +++ src/ChangeLog 2012-09-23 22:25:22 +0000 @@ -1,5 +1,13 @@ 2012-09-23 Paul Eggert + Move pid_t related decls out of lisp.h. + * lisp.h, syswait.h (record_child_status_change, wait_for_termination) + (interruptible_wait_for_termination): + Move these decls from lisp.h to syswait.h, since they use pid_t. + Needed on FreeBSD; see Herbert J. Skuhra in + . + * callproc.c: Include syswait.h. + gnutls.c, gtkutil.c: Use bool for boolean. * gnutls.c (gnutls_global_initialized, init_gnutls_functions) (emacs_gnutls_handle_error): === modified file 'src/callproc.c' --- src/callproc.c 2012-09-23 08:44:20 +0000 +++ src/callproc.c 2012-09-23 22:25:22 +0000 @@ -51,6 +51,7 @@ #include "process.h" #include "syssignal.h" #include "systty.h" +#include "syswait.h" #include "blockinput.h" #include "frame.h" #include "termhooks.h" === modified file 'src/lisp.h' --- src/lisp.h 2012-09-23 08:44:20 +0000 +++ src/lisp.h 2012-09-23 22:25:22 +0000 @@ -3333,7 +3333,6 @@ #endif extern void add_keyboard_wait_descriptor (int); extern void delete_keyboard_wait_descriptor (int); -extern void record_child_status_change (pid_t, int); #ifdef HAVE_GPM extern void add_gpm_wait_descriptor (int); extern void delete_gpm_wait_descriptor (int); @@ -3421,8 +3420,6 @@ extern void reset_sys_modes (struct tty_display_info *); extern void init_all_sys_modes (void); extern void reset_all_sys_modes (void); -extern void wait_for_termination (pid_t); -extern void interruptible_wait_for_termination (pid_t); extern void flush_pending_output (int) ATTRIBUTE_CONST; extern void child_setup_tty (int); extern void setup_pty (int); === modified file 'src/syswait.h' --- src/syswait.h 2012-08-02 04:14:48 +0000 +++ src/syswait.h 2012-09-23 22:25:22 +0000 @@ -51,4 +51,11 @@ #define WTERMSIG(status) ((status) & 0x7f) #endif +/* Defined in process.c. */ +extern void record_child_status_change (pid_t, int); + +/* Defined in sysdep.c. */ +extern void wait_for_termination (pid_t); +extern void interruptible_wait_for_termination (pid_t); + #endif /* EMACS_SYSWAIT_H */ ------------------------------------------------------------ revno: 110172 committer: Paul Eggert branch nick: trunk timestamp: Sun 2012-09-23 12:36:31 -0700 message: gnutls.c, gtkutil.c: Use bool for boolean. * gnutls.c (gnutls_global_initialized, init_gnutls_functions) (emacs_gnutls_handle_error): * gtkutil.c (xg_check_special_colors, xg_prepare_tooltip) (xg_hide_tooltip, xg_create_frame_widgets) (create_dialog, xg_uses_old_file_dialog) (xg_get_file_with_chooser, xg_get_file_with_selection) (xg_get_file_name, xg_have_tear_offs, create_menus, xg_create_widget) (xg_item_label_same_p, xg_update_menubar) (xg_modify_menubar_widgets, xg_event_is_for_menubar) (xg_ignore_gtk_scrollbar, xg_set_toolkit_scroll_bar_thumb) (xg_event_is_for_scrollbar, xg_pack_tool_bar, xg_make_tool_item) (is_box_type, xg_tool_item_stale_p, xg_update_tool_bar_sizes) (update_frame_tool_bar, free_frame_tool_bar): * gtkutil.c, w32term.c, xterm.c (x_wm_set_size_hint): * nsmenu.m (ns_update_menubar): * nsmenu.m, w32menu.c, xmenu.c (set_frame_menubar): * xfns.c (Fx_show_tip) [USE_GTK]: Use bool for boolean. * gtkutil.c (xg_update_frame_menubar): * xmenu.c (update_frame_menubar): Return void, not int, since caller ignores return value. * gtkutil.c (xg_change_toolbar_position): Return void, not 1. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-09-23 18:03:48 +0000 +++ src/ChangeLog 2012-09-23 19:36:31 +0000 @@ -1,3 +1,30 @@ +2012-09-23 Paul Eggert + + gnutls.c, gtkutil.c: Use bool for boolean. + * gnutls.c (gnutls_global_initialized, init_gnutls_functions) + (emacs_gnutls_handle_error): + * gtkutil.c (xg_check_special_colors, xg_prepare_tooltip) + (xg_hide_tooltip, xg_create_frame_widgets) + (create_dialog, xg_uses_old_file_dialog) + (xg_get_file_with_chooser, xg_get_file_with_selection) + (xg_get_file_name, xg_have_tear_offs, create_menus, xg_create_widget) + (xg_item_label_same_p, xg_update_menubar) + (xg_modify_menubar_widgets, xg_event_is_for_menubar) + (xg_ignore_gtk_scrollbar, xg_set_toolkit_scroll_bar_thumb) + (xg_event_is_for_scrollbar, xg_pack_tool_bar, xg_make_tool_item) + (is_box_type, xg_tool_item_stale_p, xg_update_tool_bar_sizes) + (update_frame_tool_bar, free_frame_tool_bar): + * gtkutil.c, w32term.c, xterm.c (x_wm_set_size_hint): + * nsmenu.m (ns_update_menubar): + * nsmenu.m, w32menu.c, xmenu.c (set_frame_menubar): + * xfns.c (Fx_show_tip) [USE_GTK]: + Use bool for boolean. + * gtkutil.c (xg_update_frame_menubar): + * xmenu.c (update_frame_menubar): + Return void, not int, since caller ignores return value. + * gtkutil.c (xg_change_toolbar_position): + Return void, not 1. + 2012-09-23 Juanma Barranquero * makefile.w32-in (BLOCKINPUT_H): Remove. === modified file 'src/frame.h' --- src/frame.h 2012-09-05 17:05:32 +0000 +++ src/frame.h 2012-09-23 19:36:31 +0000 @@ -1203,7 +1203,7 @@ extern void x_set_scroll_bar_default_width (struct frame *); extern void x_set_offset (struct frame *, int, int, int); extern void x_wm_set_icon_position (struct frame *, int, int); -extern void x_wm_set_size_hint (FRAME_PTR f, long flags, int user_position); +extern void x_wm_set_size_hint (FRAME_PTR f, long flags, bool user_position); extern Lisp_Object x_new_font (struct frame *, Lisp_Object, int); @@ -1249,7 +1249,7 @@ Lisp_Object component, Lisp_Object subclass); -extern void set_frame_menubar (struct frame *f, int first_time, int deep_p); +extern void set_frame_menubar (struct frame *f, bool first_time, bool deep_p); extern void x_set_window_size (struct frame *f, int change_grav, int cols, int rows); extern void x_sync (struct frame *); @@ -1283,9 +1283,6 @@ extern void x_query_colors (struct frame *f, XColor *, int); -/* In xmenu.c */ -extern void set_frame_menubar (FRAME_PTR, int, int); - #endif /* HAVE_WINDOW_SYSTEM */ INLINE_HEADER_END === modified file 'src/gnutls.c' --- src/gnutls.c 2012-09-23 09:16:57 +0000 +++ src/gnutls.c 2012-09-23 19:36:31 +0000 @@ -30,15 +30,14 @@ #include "w32.h" #endif -static int -emacs_gnutls_handle_error (gnutls_session_t, int err); +static bool emacs_gnutls_handle_error (gnutls_session_t, int); static Lisp_Object Qgnutls_dll; static Lisp_Object Qgnutls_code; static Lisp_Object Qgnutls_anon, Qgnutls_x509pki; static Lisp_Object Qgnutls_e_interrupted, Qgnutls_e_again, Qgnutls_e_invalid_session, Qgnutls_e_not_ready_for_handshake; -static int gnutls_global_initialized; +static bool gnutls_global_initialized; /* The following are for the property list of `gnutls-boot'. */ static Lisp_Object QCgnutls_bootprop_priority; @@ -141,7 +140,7 @@ gnutls_x509_crt_fmt_t)); DEF_GNUTLS_FN (int, gnutls_x509_crt_init, (gnutls_x509_crt_t *)); -static int +static bool init_gnutls_functions (void) { HMODULE library; @@ -438,7 +437,7 @@ else if (rtnval == GNUTLS_E_UNEXPECTED_PACKET_LENGTH) /* The peer closed the connection. */ return 0; - else if (emacs_gnutls_handle_error (state, rtnval) == 0) + else if (emacs_gnutls_handle_error (state, rtnval)) /* non-fatal error */ return -1; else { @@ -447,19 +446,19 @@ } } -/* report a GnuTLS error to the user. - Returns zero if the error code was successfully handled. */ -static int +/* Report a GnuTLS error to the user. + Return true if the error code was successfully handled. */ +static bool emacs_gnutls_handle_error (gnutls_session_t session, int err) { int max_log_level = 0; - int ret; + bool ret; const char *str; /* TODO: use a Lisp_Object generated by gnutls_make_error? */ if (err >= 0) - return 0; + return 1; max_log_level = global_gnutls_log_level; @@ -471,12 +470,12 @@ if (fn_gnutls_error_is_fatal (err)) { - ret = err; + ret = 0; GNUTLS_LOG2 (0, max_log_level, "fatal error:", str); } else { - ret = 0; + ret = 1; GNUTLS_LOG2 (1, max_log_level, "non-fatal error:", str); /* TODO: EAGAIN AKA Qgnutls_e_again should be level 2. */ } === modified file 'src/gtkutil.c' --- src/gtkutil.c 2012-09-23 08:44:20 +0000 +++ src/gtkutil.c 2012-09-23 19:36:31 +0000 @@ -576,16 +576,16 @@ /* Check for special colors used in face spec for region face. The colors are fetched from the Gtk+ theme. - Return 1 if color was found, 0 if not. */ + Return true if color was found, false if not. */ -int +bool xg_check_special_colors (struct frame *f, const char *color_name, XColor *color) { - int success_p = 0; - int get_bg = strcmp ("gtk_selection_bg_color", color_name) == 0; - int get_fg = !get_bg && strcmp ("gtk_selection_fg_color", color_name) == 0; + bool success_p = 0; + bool get_bg = strcmp ("gtk_selection_bg_color", color_name) == 0; + bool get_fg = !get_bg && strcmp ("gtk_selection_fg_color", color_name) == 0; if (! FRAME_GTK_WIDGET (f) || ! (get_bg || get_fg)) return success_p; @@ -604,8 +604,9 @@ gtk_style_context_get_background_color (gsty, state, &col); sprintf (buf, "rgbi:%lf/%lf/%lf", col.red, col.green, col.blue); - success_p = XParseColor (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), - buf, color); + success_p = (XParseColor (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), + buf, color) + != 0); #else GtkStyle *gsty = gtk_widget_get_style (FRAME_GTK_WIDGET (f)); GdkColor *grgb = get_bg @@ -703,9 +704,9 @@ #endif /* USE_GTK_TOOLTIP */ /* Prepare a tooltip to be shown, i.e. calculate WIDTH and HEIGHT. - Return zero if no system tooltip available, non-zero otherwise. */ + Return true if a system tooltip is available. */ -int +bool xg_prepare_tooltip (FRAME_PTR f, Lisp_Object string, int *width, @@ -778,13 +779,13 @@ } /* Hide tooltip if shown. Do nothing if not shown. - Return non-zero if tip was hidden, non-zero if not (i.e. not using + Return true if tip was hidden, false if not (i.e. not using system tooltips). */ -int +bool xg_hide_tooltip (FRAME_PTR f) { - int ret = 0; + bool ret = 0; #ifdef USE_GTK_TOOLTIP if (f->output_data.x->ttip_window) { @@ -1110,9 +1111,9 @@ } /* Create and set up the GTK widgets for frame F. - Return 0 if creation failed, non-zero otherwise. */ + Return true if creation succeeded. */ -int +bool xg_create_frame_widgets (FRAME_PTR f) { GtkWidget *wtop; @@ -1309,11 +1310,11 @@ /* Set the normal size hints for the window manager, for frame F. FLAGS is the flags word to use--or 0 meaning preserve the flags that the window now has. - If USER_POSITION is nonzero, we set the User Position + If USER_POSITION, set the User Position flag (this is useful when FLAGS is 0). */ void -x_wm_set_size_hint (FRAME_PTR f, long int flags, int user_position) +x_wm_set_size_hint (FRAME_PTR f, long int flags, bool user_position) { /* Must use GTK routines here, otherwise GTK resets the size hints to its own defaults. */ @@ -1519,7 +1520,7 @@ /* If the number of buttons is greater than 4, make two rows of buttons instead. This looks better. */ - int make_two_rows = total_buttons > 4; + bool make_two_rows = total_buttons > 4; if (right_buttons == 0) right_buttons = total_buttons/2; left_buttons = total_buttons - right_buttons; @@ -1716,10 +1717,9 @@ /*********************************************************************** File dialog functions ***********************************************************************/ -/* Return non-zero if the old file selection dialog is being used. - Return zero if not. */ +/* Return true if the old file selection dialog is being used. */ -int +bool xg_uses_old_file_dialog (void) { #ifdef HAVE_GTK_FILE_SELECTION_NEW @@ -1790,7 +1790,7 @@ F is the current frame. PROMPT is a prompt to show to the user. May not be NULL. DEFAULT_FILENAME is a default selection to be displayed. May be NULL. - If MUSTMATCH_P is non-zero, the returned file name must be an existing + If MUSTMATCH_P, the returned file name must be an existing file. (Actually, this only has cosmetic effects, the user can still enter a non-existing file.) *FUNC is set to a function that can be used to retrieve the selected file name from the returned widget. @@ -1801,7 +1801,7 @@ xg_get_file_with_chooser (FRAME_PTR f, char *prompt, char *default_filename, - int mustmatch_p, int only_dir_p, + bool mustmatch_p, bool only_dir_p, xg_get_file_func *func) { char msgbuf[1024]; @@ -1913,7 +1913,7 @@ F is the current frame. PROMPT is a prompt to show to the user. May not be NULL. DEFAULT_FILENAME is a default selection to be displayed. May be NULL. - If MUSTMATCH_P is non-zero, the returned file name must be an existing + If MUSTMATCH_P, the returned file name must be an existing file. *FUNC is set to a function that can be used to retrieve the selected file name from the returned widget. @@ -1923,7 +1923,7 @@ xg_get_file_with_selection (FRAME_PTR f, char *prompt, char *default_filename, - int mustmatch_p, int only_dir_p, + bool mustmatch_p, bool only_dir_p, xg_get_file_func *func) { GtkWidget *filewin; @@ -1955,7 +1955,7 @@ F is the current frame. PROMPT is a prompt to show to the user. May not be NULL. DEFAULT_FILENAME is a default selection to be displayed. May be NULL. - If MUSTMATCH_P is non-zero, the returned file name must be an existing + If MUSTMATCH_P, the returned file name must be an existing file. Returns a file name or NULL if no file was selected. @@ -1965,8 +1965,8 @@ xg_get_file_name (FRAME_PTR f, char *prompt, char *default_filename, - int mustmatch_p, - int only_dir_p) + bool mustmatch_p, + bool only_dir_p) { GtkWidget *w = 0; char *fn = 0; @@ -2403,9 +2403,9 @@ static int xg_detached_menus; -/* Returns non-zero if there are detached menus. */ +/* Return true if there are detached menus. */ -int +bool xg_have_tear_offs (void) { return xg_detached_menus > 0; @@ -2509,10 +2509,9 @@ SELECT_CB is the callback to use when a menu item is selected. DEACTIVATE_CB is the callback to use when a sub menu is not shown anymore. HIGHLIGHT_CB is the callback to call when entering/leaving menu items. - POP_UP_P is non-zero if we shall create a popup menu. - MENU_BAR_P is non-zero if we shall create a menu bar. - ADD_TEAROFF_P is non-zero if we shall add a tearoff menu item. Ignored - if MENU_BAR_P is non-zero. + If POP_UP_P, create a popup menu. + If MENU_BAR_P, create a menu bar. + If ADD_TEAROFF_P, add a tearoff menu item. Ignored if MENU_BAR_P. TOPMENU is the topmost GtkWidget that others shall be placed under. It may be NULL, in that case we create the appropriate widget (menu bar or menu item depending on POP_UP_P and MENU_BAR_P) @@ -2532,9 +2531,9 @@ GCallback select_cb, GCallback deactivate_cb, GCallback highlight_cb, - int pop_up_p, - int menu_bar_p, - int add_tearoff_p, + bool pop_up_p, + bool menu_bar_p, + bool add_tearoff_p, GtkWidget *topmenu, xg_menu_cb_data *cl_data, const char *name) @@ -2674,8 +2673,8 @@ GCallback highlight_cb) { GtkWidget *w = 0; - int menu_bar_p = strcmp (type, "menubar") == 0; - int pop_up_p = strcmp (type, "popup") == 0; + bool menu_bar_p = strcmp (type, "menubar") == 0; + bool pop_up_p = strcmp (type, "popup") == 0; if (strcmp (type, "dialog") == 0) { @@ -2728,12 +2727,12 @@ return gtk_label_get_label (wlabel); } -/* Return non-zero if the menu item WITEM has the text LABEL. */ +/* Return true if the menu item WITEM has the text LABEL. */ -static int +static bool xg_item_label_same_p (GtkMenuItem *witem, const char *label) { - int is_same = 0; + bool is_same = 0; char *utf8_label = get_utf8_string (label); const char *old_label = witem ? xg_get_menu_item_label (witem) : 0; @@ -2824,8 +2823,8 @@ { GtkMenuItem *witem = GTK_MENU_ITEM (iter->data); GtkMenuItem *witem2 = 0; - int val_in_menubar = 0; - int iter_in_new_menubar = 0; + bool val_in_menubar = 0; + bool iter_in_new_menubar = 0; GList *iter2; widget_value *cur; @@ -3103,7 +3102,7 @@ GList *list = 0; GList *iter; widget_value *cur; - int has_tearoff_p = 0; + bool has_tearoff_p = 0; GList *first_radio = 0; if (submenu) @@ -3225,7 +3224,7 @@ /* Update the MENUBAR. F is the frame the menu bar belongs to. VAL describes the contents of the menu bar. - If DEEP_P is non-zero, rebuild all but the top level menu names in + If DEEP_P, rebuild all but the top level menu names in the MENUBAR. If DEEP_P is zero, just rebuild the names in the menubar. SELECT_CB is the callback to use when a menu item is selected. DEACTIVATE_CB is the callback to use when a sub menu is not shown anymore. @@ -3233,7 +3232,7 @@ void xg_modify_menubar_widgets (GtkWidget *menubar, FRAME_PTR f, widget_value *val, - int deep_p, + bool deep_p, GCallback select_cb, GCallback deactivate_cb, GCallback highlight_cb) { @@ -3317,19 +3316,19 @@ } /* Recompute all the widgets of frame F, when the menu bar has been - changed. Value is non-zero if widgets were updated. */ + changed. */ -int +void xg_update_frame_menubar (FRAME_PTR f) { struct x_output *x = f->output_data.x; GtkRequisition req; if (!x->menubar_widget || gtk_widget_get_mapped (x->menubar_widget)) - return 0; + return; if (x->menubar_widget && gtk_widget_get_parent (x->menubar_widget)) - return 0; /* Already done this, happens for frames created invisible. */ + return; /* Already done this, happens for frames created invisible. */ block_input (); @@ -3352,8 +3351,6 @@ xg_height_or_width_changed (f); } unblock_input (); - - return 1; } /* Get rid of the menu bar of frame F, and free its storage. @@ -3378,7 +3375,7 @@ } } -int +bool xg_event_is_for_menubar (FRAME_PTR f, XEvent *event) { struct x_output *x = f->output_data.x; @@ -3425,7 +3422,7 @@ break; } g_list_free (list); - return iter == 0 ? 0 : 1; + return iter != 0; } @@ -3438,7 +3435,7 @@ /* Setting scroll bar values invokes the callback. Use this variable to indicate that callback should do nothing. */ -int xg_ignore_gtk_scrollbar; +bool xg_ignore_gtk_scrollbar; /* The width of the scroll bar for the current theme. */ @@ -3764,7 +3761,7 @@ int size, value; int old_size; int new_step; - int changed = 0; + bool changed = 0; adj = gtk_range_get_adjustment (GTK_RANGE (wscroll)); @@ -3829,17 +3826,15 @@ } } -/* Return non-zero if EVENT is for a scroll bar in frame F. +/* Return true if EVENT is for a scroll bar in frame F. When the same X window is used for several Gtk+ widgets, we cannot say for sure based on the X window alone if an event is for the - frame. This function does additional checks. - - Return non-zero if the event is for a scroll bar, zero otherwise. */ - -int + frame. This function does additional checks. */ + +bool xg_event_is_for_scrollbar (FRAME_PTR f, XEvent *event) { - int retval = 0; + bool retval = 0; if (f && event->type == ButtonPress && event->xbutton.button < 4) { @@ -4270,7 +4265,7 @@ xg_pack_tool_bar (FRAME_PTR f, Lisp_Object pos) { struct x_output *x = f->output_data.x; - int into_hbox = EQ (pos, Qleft) || EQ (pos, Qright); + bool into_hbox = EQ (pos, Qleft) || EQ (pos, Qright); toolbar_set_orientation (x->toolbar_widget, into_hbox @@ -4302,7 +4297,7 @@ } else { - int vbox_pos = x->menubar_widget ? 1 : 0; + bool vbox_pos = x->menubar_widget != 0; gtk_handle_box_set_handle_position (GTK_HANDLE_BOX (x->handlebox_widget), GTK_POS_LEFT); gtk_box_pack_start (GTK_BOX (x->vbox_widget), x->handlebox_widget, @@ -4393,7 +4388,7 @@ GtkWidget *wimage, GtkWidget **wbutton, const char *label, - int i, int horiz, int text_image) + int i, bool horiz, bool text_image) { GtkToolItem *ti = gtk_tool_item_new (); GtkWidget *vb = gtk_box_new (horiz @@ -4488,11 +4483,11 @@ return ti; } -static int -is_box_type (GtkWidget *vb, int is_horizontal) +static bool +is_box_type (GtkWidget *vb, bool is_horizontal) { #ifdef HAVE_GTK3 - int ret = 0; + bool ret = 0; if (GTK_IS_BOX (vb)) { GtkOrientation ori = gtk_orientable_get_orientation (GTK_ORIENTABLE (vb)); @@ -4506,10 +4501,10 @@ } -static int +static bool xg_tool_item_stale_p (GtkWidget *wbutton, const char *stock_name, const char *icon_name, const struct image *img, - const char *label, int horiz) + const char *label, bool horiz) { gpointer old; GtkWidget *wimage; @@ -4551,7 +4546,7 @@ return 0; } -static int +static bool xg_update_tool_bar_sizes (FRAME_PTR f) { struct x_output *x = f->output_data.x; @@ -4607,9 +4602,9 @@ GtkToolbar *wtoolbar; GtkToolItem *ti; GtkTextDirection dir; - int pack_tool_bar = x->handlebox_widget == NULL; + bool pack_tool_bar = x->handlebox_widget == NULL; Lisp_Object style; - int text_image, horiz; + bool text_image, horiz; struct xg_frame_tb_info *tbinfo; if (! FRAME_GTK_WIDGET (f)) @@ -4673,8 +4668,8 @@ for (i = j = 0; i < f->n_tool_bar_items; ++i) { - int enabled_p = !NILP (PROP (TOOL_BAR_ITEM_ENABLED_P)); - int selected_p = !NILP (PROP (TOOL_BAR_ITEM_SELECTED_P)); + bool enabled_p = !NILP (PROP (TOOL_BAR_ITEM_ENABLED_P)); + bool selected_p = !NILP (PROP (TOOL_BAR_ITEM_SELECTED_P)); int idx; ptrdiff_t img_id; int icon_size = 0; @@ -4687,7 +4682,7 @@ Lisp_Object rtl; GtkWidget *wbutton = NULL; Lisp_Object specified_file; - int vert_only = ! NILP (PROP (TOOL_BAR_ITEM_VERT_ONLY)); + bool vert_only = ! NILP (PROP (TOOL_BAR_ITEM_VERT_ONLY)); const char *label = (EQ (style, Qimage) || (vert_only && horiz)) ? NULL : STRINGP (PROP (TOOL_BAR_ITEM_LABEL)) @@ -4882,7 +4877,7 @@ if (x->toolbar_widget) { struct xg_frame_tb_info *tbinfo; - int is_packed = x->handlebox_widget != 0; + bool is_packed = x->handlebox_widget != 0; block_input (); /* We may have created the toolbar_widget in xg_create_tool_bar, but not the x->handlebox_widget which is created in xg_pack_tool_bar. */ @@ -4919,13 +4914,13 @@ } } -int +void xg_change_toolbar_position (FRAME_PTR f, Lisp_Object pos) { struct x_output *x = f->output_data.x; if (! x->toolbar_widget || ! x->handlebox_widget) - return 1; + return; block_input (); g_object_ref (x->handlebox_widget); @@ -4941,7 +4936,6 @@ xg_height_or_width_changed (f); unblock_input (); - return 1; } === modified file 'src/gtkutil.h' --- src/gtkutil.h 2012-09-02 10:53:46 +0000 +++ src/gtkutil.h 2012-09-23 19:36:31 +0000 @@ -79,13 +79,13 @@ extern struct _widget_value *malloc_widget_value (void); extern void free_widget_value (struct _widget_value *); -extern int xg_uses_old_file_dialog (void) ATTRIBUTE_CONST; +extern bool xg_uses_old_file_dialog (void) ATTRIBUTE_CONST; extern char *xg_get_file_name (FRAME_PTR f, char *prompt, char *default_filename, - int mustmatch_p, - int only_dir_p); + bool mustmatch_p, + bool only_dir_p); extern Lisp_Object xg_get_font (FRAME_PTR f, const char *); @@ -100,16 +100,16 @@ extern void xg_modify_menubar_widgets (GtkWidget *menubar, FRAME_PTR f, struct _widget_value *val, - int deep_p, + bool deep_p, GCallback select_cb, GCallback deactivate_cb, GCallback highlight_cb); -extern int xg_update_frame_menubar (FRAME_PTR f); - -extern int xg_event_is_for_menubar (FRAME_PTR f, XEvent *event); - -extern int xg_have_tear_offs (void); +extern void xg_update_frame_menubar (FRAME_PTR f); + +extern bool xg_event_is_for_menubar (FRAME_PTR f, XEvent *event); + +extern bool xg_have_tear_offs (void); extern ptrdiff_t xg_get_scroll_id_for_window (Display *dpy, Window wid); @@ -131,12 +131,12 @@ int portion, int position, int whole); -extern int xg_event_is_for_scrollbar (FRAME_PTR f, XEvent *event); +extern bool xg_event_is_for_scrollbar (FRAME_PTR f, XEvent *event); extern int xg_get_default_scrollbar_width (void); extern void update_frame_tool_bar (FRAME_PTR f); extern void free_frame_tool_bar (FRAME_PTR f); -extern int xg_change_toolbar_position (FRAME_PTR f, Lisp_Object pos); +extern void xg_change_toolbar_position (FRAME_PTR f, Lisp_Object pos); extern void xg_frame_resized (FRAME_PTR f, int pixelwidth, @@ -148,23 +148,23 @@ extern void xg_display_close (Display *dpy); extern GdkCursor * xg_create_default_cursor (Display *dpy); -extern int xg_create_frame_widgets (FRAME_PTR f); +extern bool xg_create_frame_widgets (FRAME_PTR f); extern void xg_free_frame_widgets (FRAME_PTR f); extern void xg_set_background_color (FRAME_PTR f, unsigned long bg); -extern int xg_check_special_colors (struct frame *f, - const char *color_name, - XColor *color); +extern bool xg_check_special_colors (struct frame *f, + const char *color_name, + XColor *color); extern void xg_set_frame_icon (FRAME_PTR f, Pixmap icon_pixmap, Pixmap icon_mask); -extern int xg_prepare_tooltip (FRAME_PTR f, - Lisp_Object string, - int *width, - int *height); +extern bool xg_prepare_tooltip (FRAME_PTR f, + Lisp_Object string, + int *width, + int *height); extern void xg_show_tooltip (FRAME_PTR f, int root_x, int root_y); -extern int xg_hide_tooltip (FRAME_PTR f); +extern bool xg_hide_tooltip (FRAME_PTR f); /* Mark all callback data that are Lisp_object:s during GC. */ @@ -175,7 +175,7 @@ /* Setting scrollbar values invokes the callback. Use this variable to indicate that the callback should do nothing. */ -extern int xg_ignore_gtk_scrollbar; +extern bool xg_ignore_gtk_scrollbar; #endif /* USE_GTK */ #endif /* GTKUTIL_H */ === modified file 'src/nsmenu.m' --- src/nsmenu.m 2012-09-23 08:44:20 +0000 +++ src/nsmenu.m 2012-09-23 19:36:31 +0000 @@ -115,13 +115,13 @@ /* -------------------------------------------------------------------------- Update menubar. Three cases: - 1) deep_p = 0, submenu = nil: Fresh switch onto a frame -- either set up + 1) ! deep_p, submenu = nil: Fresh switch onto a frame -- either set up just top-level menu strings (OS X), or goto case (2) (GNUstep). - 2) deep_p = 1, submenu = nil: Recompute all submenus. - 3) deep_p = 1, submenu = non-nil: Update contents of a single submenu. + 2) deep_p, submenu = nil: Recompute all submenus. + 3) deep_p, submenu = non-nil: Update contents of a single submenu. -------------------------------------------------------------------------- */ void -ns_update_menubar (struct frame *f, int deep_p, EmacsMenu *submenu) +ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu) { NSAutoreleasePool *pool; id menu = [NSApp mainMenu]; @@ -507,7 +507,7 @@ frame's menus have changed, and the *step representation should be updated from Lisp. */ void -set_frame_menubar (struct frame *f, int first_time, int deep_p) +set_frame_menubar (struct frame *f, bool first_time, bool deep_p) { ns_update_menubar (f, deep_p, nil); } @@ -1766,7 +1766,7 @@ } - + - (void)timeout_handler: (NSTimer *)timedEntry { NSEvent *nxev = [NSEvent otherEventWithType: NSApplicationDefined === modified file 'src/w32menu.c' --- src/w32menu.c 2012-09-23 08:44:20 +0000 +++ src/w32menu.c 2012-09-23 19:36:31 +0000 @@ -85,7 +85,7 @@ Lisp_Object Qdebug_on_next_call; -void set_frame_menubar (FRAME_PTR, int, int); +void set_frame_menubar (FRAME_PTR, bool, bool); #ifdef HAVE_DIALOGS static Lisp_Object w32_dialog_show (FRAME_PTR, int, Lisp_Object, char**); @@ -356,7 +356,7 @@ it is set the first time this is called, from initialize_frame_menubar. */ void -set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) +set_frame_menubar (FRAME_PTR f, bool first_time, bool deep_p) { HMENU menubar_widget = f->output_data.w32->menubar_widget; Lisp_Object items; === modified file 'src/w32term.c' --- src/w32term.c 2012-09-23 17:33:16 +0000 +++ src/w32term.c 2012-09-23 19:36:31 +0000 @@ -197,7 +197,7 @@ void x_lower_frame (struct frame *); void x_scroll_bar_clear (struct frame *); -void x_wm_set_size_hint (struct frame *, long, int); +void x_wm_set_size_hint (struct frame *, long, bool); void x_raise_frame (struct frame *); void x_set_window_size (struct frame *, int, int, int); void x_wm_set_window_state (struct frame *, int); @@ -5982,10 +5982,10 @@ /* Set the normal size hints for the window manager, for frame F. FLAGS is the flags word to use--or 0 meaning preserve the flags that the window now has. - If USER_POSITION is nonzero, we set the USPosition + If USER_POSITION, set the USPosition flag (this is useful when FLAGS is 0). */ void -x_wm_set_size_hint (struct frame *f, long flags, int user_position) +x_wm_set_size_hint (struct frame *f, long flags, bool user_position) { Window window = FRAME_W32_WINDOW (f); === modified file 'src/xfns.c' --- src/xfns.c 2012-09-23 08:44:20 +0000 +++ src/xfns.c 2012-09-23 19:36:31 +0000 @@ -656,8 +656,8 @@ if (EQ (new_value, old_value)) return; #ifdef USE_GTK - if (xg_change_toolbar_position (f, new_value)) - fset_tool_bar_position (f, new_value); + xg_change_toolbar_position (f, new_value); + fset_tool_bar_position (f, new_value); #endif } @@ -4985,13 +4985,14 @@ #ifdef USE_GTK if (x_gtk_use_system_tooltips) { - int ok; + bool ok; /* Hide a previous tip, if any. */ Fx_hide_tip (); block_input (); - if ((ok = xg_prepare_tooltip (f, string, &width, &height)) != 0) + ok = xg_prepare_tooltip (f, string, &width, &height); + if (ok) { compute_tip_xy (f, parms, dx, dy, width, height, &root_x, &root_y); xg_show_tooltip (f, root_x, root_y); === modified file 'src/xmenu.c' --- src/xmenu.c 2012-09-23 08:44:20 +0000 +++ src/xmenu.c 2012-09-23 19:36:31 +0000 @@ -834,13 +834,13 @@ #endif /* not USE_GTK */ /* Recompute all the widgets of frame F, when the menu bar has been - changed. Value is non-zero if widgets were updated. */ + changed. */ -static int +static void update_frame_menubar (FRAME_PTR f) { #ifdef USE_GTK - return xg_update_frame_menubar (f); + xg_update_frame_menubar (f); #else struct x_output *x; int columns, rows; @@ -851,7 +851,7 @@ x = f->output_data.x; if (!x->menubar_widget || XtIsManaged (x->menubar_widget)) - return 0; + return; block_input (); /* Save the size of the frame because the pane widget doesn't accept @@ -882,7 +882,6 @@ EmacsFrameSetCharSize (x->edit_widget, columns, rows); unblock_input (); #endif - return 1; } #ifdef USE_LUCID @@ -921,7 +920,7 @@ it is set the first time this is called, from initialize_frame_menubar. */ void -set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) +set_frame_menubar (FRAME_PTR f, bool first_time, bool deep_p) { xt_or_gtk_widget menubar_widget; #ifdef USE_X_TOOLKIT === modified file 'src/xterm.c' --- src/xterm.c 2012-09-23 10:03:35 +0000 +++ src/xterm.c 2012-09-23 19:36:31 +0000 @@ -9541,13 +9541,13 @@ /* Set the normal size hints for the window manager, for frame F. FLAGS is the flags word to use--or 0 meaning preserve the flags that the window now has. - If USER_POSITION is nonzero, we set the USPosition + If USER_POSITION, set the USPosition flag (this is useful when FLAGS is 0). - The GTK version is in gtkutils.c */ + The GTK version is in gtkutils.c. */ #ifndef USE_GTK void -x_wm_set_size_hint (struct frame *f, long flags, int user_position) +x_wm_set_size_hint (struct frame *f, long flags, bool user_position) { XSizeHints size_hints; Window window = FRAME_OUTER_WINDOW (f); ------------------------------------------------------------ revno: 110171 committer: Glenn Morris branch nick: trunk timestamp: Sun 2012-09-23 11:40:55 -0700 message: Useless use of cat diff: === modified file 'admin/notes/bugtracker' --- admin/notes/bugtracker 2012-09-12 16:00:11 +0000 +++ admin/notes/bugtracker 2012-09-23 18:40:55 +0000 @@ -610,7 +610,7 @@ All discarded messages are stored in /var/lib/mailman/spam. If a non-spam message accidentally gets discarded, just do: -cat /var/lib/mailman/spam/not-really-spam.msg | /usr/lib/debbugs/receive +/usr/lib/debbugs/receive < /var/lib/mailman/spam/not-really-spam.msg chown Debian-debbugs:Debian-debbugs /var/lib/debbugs/spool/incoming/* ... check it works ... mv /var/lib/mailman/spam/not-really-spam.msg /var/lib/mailman/not-spam/ ------------------------------------------------------------ revno: 110170 committer: Fabián Ezequiel Gallina branch nick: trunk timestamp: Sun 2012-09-23 15:21:33 -0300 message: * progmodes/python.el (python-indent-line): More consistent cursor movement behavior. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-09-23 14:50:02 +0000 +++ lisp/ChangeLog 2012-09-23 18:21:33 +0000 @@ -1,3 +1,8 @@ +2012-09-23 Fabián Ezequiel Gallina + + * progmodes/python.el (python-indent-line): More consistent cursor + movement behavior. + 2012-09-23 Stefan Merten * textmodes/rst.el: Fix compiler warning. === modified file 'lisp/progmodes/python.el' --- lisp/progmodes/python.el 2012-09-07 14:53:15 +0000 +++ lisp/progmodes/python.el 2012-09-23 18:21:33 +0000 @@ -897,16 +897,27 @@ `python-indent-levels'. Afterwards it sets the variable `python-indent-current-level' correctly so offset is equal to (`nth' `python-indent-current-level' `python-indent-levels')" - (if (or (and (eq this-command 'indent-for-tab-command) - (eq last-command this-command)) - force-toggle) - (if (not (equal python-indent-levels '(0))) - (python-indent-toggle-levels) - (python-indent-calculate-levels)) - (python-indent-calculate-levels)) - (beginning-of-line) - (delete-horizontal-space) - (indent-to (nth python-indent-current-level python-indent-levels)) + (or + (and (or (and (eq this-command 'indent-for-tab-command) + (eq last-command this-command)) + force-toggle) + (not (equal python-indent-levels '(0))) + (or (python-indent-toggle-levels) t)) + (python-indent-calculate-levels)) + (let* ((starting-pos (point-marker)) + (indent-ending-position + (+ (line-beginning-position) (current-indentation))) + (follow-indentation-p + (or (bolp) + (and (<= (line-beginning-position) starting-pos) + (>= indent-ending-position starting-pos)))) + (next-indent (nth python-indent-current-level python-indent-levels))) + (unless (= next-indent (current-indentation)) + (beginning-of-line) + (delete-horizontal-space) + (indent-to next-indent) + (goto-char starting-pos)) + (and follow-indentation-p (back-to-indentation))) (python-info-closing-block-message)) (defun python-indent-line-function () ------------------------------------------------------------ revno: 110169 committer: Juanma Barranquero branch nick: trunk timestamp: Sun 2012-09-23 20:03:48 +0200 message: src/makefile.w32-in: Update dependencies. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-09-23 17:34:30 +0000 +++ src/ChangeLog 2012-09-23 18:03:48 +0000 @@ -1,3 +1,22 @@ +2012-09-23 Juanma Barranquero + + * makefile.w32-in (BLOCKINPUT_H): Remove. + (SYSSIGNAL_H): New macro. + ($(BLD)/alloc.$(O), $(BLD)/atimer.$(O), $(BLD)/buffer.$(O)) + ($(BLD)/callproc.$(O), $(BLD)/data.$(O), $(BLD)/dired.$(O)) + ($(BLD)/dispnew.$(O), $(BLD)/editfns.$(O), $(BLD)/emacs.$(O)) + ($(BLD)/eval.$(O), $(BLD)/fileio.$(O), $(BLD)/floatfns.$(O)) + ($(BLD)/fns.$(O), $(BLD)/fontset.$(O), $(BLD)/frame.$(O)) + ($(BLD)/fringe.$(O), $(BLD)/image.$(O), $(BLD)/insdel.$(O)) + ($(BLD)/keyboard.$(O), $(BLD)/keymap.$(O), $(BLD)/lread.$(O)) + ($(BLD)/menu.$(O), $(BLD)/w32inevt.$(O), $(BLD)/w32proc.$(O)) + ($(BLD)/print.$(O), $(BLD)/process.$(O), $(BLD)/ralloc.$(O)) + ($(BLD)/search.$(O), $(BLD)/sound.$(O), $(BLD)/sysdep.$(O)) + ($(BLD)/term.$(O), $(BLD)/window.$(O), $(BLD)/xdisp.$(O)) + ($(BLD)/xfaces.$(O), $(BLD)/w32fns.$(O), $(BLD)/w32menu.$(O)) + ($(BLD)/w32term.$(O), $(BLD)/w32select.$(O), $(BLD)/w32reg.$(O)) + ($(BLD)/w32xfns.$(O)): Update dependencies. + 2012-09-23 Eli Zaretskii * .gdbinit: Set breakpoint on terminate_due_to_signal, not on === modified file 'src/makefile.w32-in' --- src/makefile.w32-in 2012-09-14 01:22:21 +0000 +++ src/makefile.w32-in 2012-09-23 18:03:48 +0000 @@ -392,8 +392,6 @@ ATIMER_H = $(SRC)/atimer.h \ $(NT_INC)/stdbool.h \ $(SYSTIME_H) -BLOCKINPUT_H = $(SRC)/blockinput.h \ - $(ATIMER_H) BUFFER_H = $(SRC)/buffer.h \ $(SYSTIME_H) C_CTYPE_H = $(GNU_LIB)/c-ctype.h \ @@ -467,6 +465,8 @@ $(SRC)/w32.h STAT_TIME_H = $(GNU_LIB)/stat-time.h \ $(NT_INC)/sys/stat.h +SYSSIGNAL_H = $(SRC)/syssignal.h \ + $(NT_INC)/stdbool.h SYSTTY_H = $(SRC)/systty.h \ $(NT_INC)/sys/ioctl.h \ $(NT_INC)/unistd.h @@ -481,11 +481,11 @@ $(BLD)/alloc.$(O) : \ $(SRC)/alloc.c \ + $(SRC)/blockinput.h \ $(SRC)/puresize.h \ $(SRC)/w32.h \ $(NT_INC)/unistd.h \ $(GNU_LIB)/verify.h \ - $(BLOCKINPUT_H) \ $(BUFFER_H) \ $(CHARACTER_H) \ $(CONFIG_H) \ @@ -499,12 +499,12 @@ $(BLD)/atimer.$(O) : \ $(SRC)/atimer.c \ - $(SRC)/syssignal.h \ + $(SRC)/blockinput.h \ $(NT_INC)/unistd.h \ $(ATIMER_H) \ - $(BLOCKINPUT_H) \ $(CONFIG_H) \ $(LISP_H) \ + $(SYSSIGNAL_H) \ $(SYSTIME_H) $(BLD)/bidi.$(O) : \ @@ -517,6 +517,7 @@ $(BLD)/buffer.$(O) : \ $(SRC)/buffer.c \ + $(SRC)/blockinput.h \ $(SRC)/commands.h \ $(SRC)/indent.h \ $(SRC)/keymap.h \ @@ -525,7 +526,6 @@ $(NT_INC)/sys/stat.h \ $(NT_INC)/unistd.h \ $(GNU_LIB)/verify.h \ - $(BLOCKINPUT_H) \ $(BUFFER_H) \ $(CHARACTER_H) \ $(CONFIG_H) \ @@ -557,14 +557,13 @@ $(BLD)/callproc.$(O) : \ $(SRC)/callproc.c \ + $(SRC)/blockinput.h \ $(SRC)/commands.h \ $(SRC)/composite.h \ $(SRC)/epaths.h \ - $(SRC)/syssignal.h \ $(SRC)/w32.h \ $(NT_INC)/sys/file.h \ $(NT_INC)/unistd.h \ - $(BLOCKINPUT_H) \ $(BUFFER_H) \ $(CCL_H) \ $(CHARACTER_H) \ @@ -573,6 +572,7 @@ $(FRAME_H) \ $(LISP_H) \ $(PROCESS_H) \ + $(SYSSIGNAL_H) \ $(SYSTTY_H) \ $(TERMHOOKS_H) @@ -690,7 +690,6 @@ $(SRC)/data.c \ $(SRC)/keymap.h \ $(SRC)/puresize.h \ - $(SRC)/syssignal.h \ $(GNU_LIB)/intprops.h \ $(BUFFER_H) \ $(CHARACTER_H) \ @@ -699,16 +698,17 @@ $(FRAME_H) \ $(KEYBOARD_H) \ $(LISP_H) \ + $(SYSSIGNAL_H) \ $(TERMHOOKS_H) $(BLD)/dired.$(O) : \ $(SRC)/dired.c \ + $(SRC)/blockinput.h \ $(SRC)/commands.h \ $(SRC)/regex.h \ $(NT_INC)/pwd.h \ $(NT_INC)/sys/stat.h \ $(NT_INC)/unistd.h \ - $(BLOCKINPUT_H) \ $(BUFFER_H) \ $(CHARACTER_H) \ $(CHARSET_H) \ @@ -723,15 +723,14 @@ $(BLD)/dispnew.$(O) : \ $(SRC)/dispnew.c \ + $(SRC)/blockinput.h \ $(SRC)/cm.h \ $(SRC)/commands.h \ $(SRC)/disptab.h \ $(SRC)/indent.h \ - $(SRC)/syssignal.h \ $(SRC)/termchar.h \ $(SRC)/termopts.h \ $(NT_INC)/unistd.h \ - $(BLOCKINPUT_H) \ $(BUFFER_H) \ $(CHARACTER_H) \ $(CONFIG_H) \ @@ -741,6 +740,7 @@ $(KEYBOARD_H) \ $(LISP_H) \ $(PROCESS_H) \ + $(SYSSIGNAL_H) \ $(SYSTIME_H) \ $(TERMHOOKS_H) \ $(W32TERM_H) \ @@ -768,12 +768,12 @@ $(BLD)/editfns.$(O) : \ $(SRC)/editfns.c \ + $(SRC)/blockinput.h \ $(NT_INC)/pwd.h \ $(NT_INC)/unistd.h \ $(GNU_LIB)/intprops.h \ $(GNU_LIB)/strftime.h \ $(GNU_LIB)/verify.h \ - $(BLOCKINPUT_H) \ $(BUFFER_H) \ $(CHARACTER_H) \ $(CODING_H) \ @@ -786,16 +786,17 @@ $(BLD)/emacs.$(O) : \ $(SRC)/emacs.c \ + $(SRC)/blockinput.h \ $(SRC)/commands.h \ $(SRC)/gnutls.h \ $(SRC)/keymap.h \ - $(SRC)/syssignal.h \ $(SRC)/unexec.h \ $(SRC)/w32.h \ $(SRC)/w32heap.h \ $(NT_INC)/sys/file.h \ $(NT_INC)/unistd.h \ - $(BLOCKINPUT_H) \ + $(GNU_LIB)/ignore-value.h \ + $(ATIMER_H) \ $(BUFFER_H) \ $(CHARACTER_H) \ $(CONFIG_H) \ @@ -804,6 +805,7 @@ $(KEYBOARD_H) \ $(LISP_H) \ $(PROCESS_H) \ + $(SYSSIGNAL_H) \ $(SYSTTY_H) \ $(TERMHOOKS_H) \ $(W32TERM_H) \ @@ -811,8 +813,8 @@ $(BLD)/eval.$(O) : \ $(SRC)/eval.c \ + $(SRC)/blockinput.h \ $(SRC)/commands.h \ - $(BLOCKINPUT_H) \ $(CONFIG_H) \ $(DISPEXTERN_H) \ $(FRAME_H) \ @@ -821,11 +823,11 @@ $(BLD)/fileio.$(O) : \ $(SRC)/fileio.c \ + $(SRC)/blockinput.h \ $(SRC)/commands.h \ $(NT_INC)/pwd.h \ $(NT_INC)/sys/stat.h \ $(NT_INC)/unistd.h \ - $(BLOCKINPUT_H) \ $(BUFFER_H) \ $(CHARACTER_H) \ $(CODING_H) \ @@ -858,17 +860,16 @@ $(BLD)/floatfns.$(O) : \ $(SRC)/floatfns.c \ - $(SRC)/syssignal.h \ $(CONFIG_H) \ $(LISP_H) $(BLD)/fns.$(O) : \ $(SRC)/fns.c \ + $(SRC)/blockinput.h \ $(SRC)/commands.h \ $(SRC)/keymap.h \ $(NT_INC)/unistd.h \ $(GNU_LIB)/intprops.h \ - $(BLOCKINPUT_H) \ $(BUFFER_H) \ $(CHARACTER_H) \ $(CODING_H) \ @@ -902,8 +903,8 @@ $(BLD)/fontset.$(O) : \ $(SRC)/fontset.c \ + $(SRC)/blockinput.h \ $(SRC)/fontset.h \ - $(BLOCKINPUT_H) \ $(BUFFER_H) \ $(CCL_H) \ $(CHARACTER_H) \ @@ -921,10 +922,10 @@ $(BLD)/frame.$(O) : \ $(SRC)/frame.c \ + $(SRC)/blockinput.h \ $(SRC)/commands.h \ $(SRC)/fontset.h \ $(SRC)/termchar.h \ - $(BLOCKINPUT_H) \ $(BUFFER_H) \ $(CHARACTER_H) \ $(CONFIG_H) \ @@ -940,7 +941,7 @@ $(BLD)/fringe.$(O) : \ $(SRC)/fringe.c \ - $(BLOCKINPUT_H) \ + $(SRC)/blockinput.h \ $(BUFFER_H) \ $(CHARACTER_H) \ $(CONFIG_H) \ @@ -973,10 +974,10 @@ $(BLD)/image.$(O) : \ $(SRC)/image.c \ + $(SRC)/blockinput.h \ $(SRC)/epaths.h \ $(SRC)/w32.h \ $(NT_INC)/unistd.h \ - $(BLOCKINPUT_H) \ $(CHARACTER_H) \ $(CODING_H) \ $(CONFIG_H) \ @@ -1011,9 +1012,9 @@ $(BLD)/insdel.$(O) : \ $(SRC)/insdel.c \ + $(SRC)/blockinput.h \ $(SRC)/region-cache.h \ $(GNU_LIB)/intprops.h \ - $(BLOCKINPUT_H) \ $(BUFFER_H) \ $(CHARACTER_H) \ $(CONFIG_H) \ @@ -1035,19 +1036,18 @@ $(BLD)/keyboard.$(O) : \ $(SRC)/keyboard.c \ + $(SRC)/blockinput.h \ $(SRC)/commands.h \ $(SRC)/disptab.h \ $(SRC)/keymap.h \ $(SRC)/macros.h \ $(SRC)/puresize.h \ $(SRC)/syntax.h \ - $(SRC)/syssignal.h \ $(SRC)/termchar.h \ $(SRC)/termopts.h \ $(NT_INC)/sys/ioctl.h \ $(NT_INC)/unistd.h \ $(ATIMER_H) \ - $(BLOCKINPUT_H) \ $(BUFFER_H) \ $(CHARACTER_H) \ $(CONFIG_H) \ @@ -1057,6 +1057,7 @@ $(KEYBOARD_H) \ $(LISP_H) \ $(PROCESS_H) \ + $(SYSSIGNAL_H) \ $(SYSTIME_H) \ $(TERMHOOKS_H) \ $(W32TERM_H) \ @@ -1064,10 +1065,10 @@ $(BLD)/keymap.$(O) : \ $(SRC)/keymap.c \ + $(SRC)/blockinput.h \ $(SRC)/commands.h \ $(SRC)/keymap.h \ $(SRC)/puresize.h \ - $(BLOCKINPUT_H) \ $(BUFFER_H) \ $(CHARACTER_H) \ $(CHARSET_H) \ @@ -1085,12 +1086,12 @@ $(BLD)/lread.$(O) : \ $(SRC)/lread.c \ + $(SRC)/blockinput.h \ $(SRC)/commands.h \ $(SRC)/epaths.h \ $(NT_INC)/sys/file.h \ $(NT_INC)/sys/stat.h \ $(NT_INC)/unistd.h \ - $(BLOCKINPUT_H) \ $(BUFFER_H) \ $(CHARACTER_H) \ $(CHARSET_H) \ @@ -1123,8 +1124,8 @@ $(BLD)/menu.$(O) : \ $(SRC)/menu.c \ + $(SRC)/blockinput.h \ $(SRC)/keymap.h \ - $(BLOCKINPUT_H) \ $(CONFIG_H) \ $(DISPEXTERN_H) \ $(FRAME_H) \ @@ -1178,10 +1179,10 @@ $(BLD)/w32inevt.$(O) : \ $(SRC)/w32inevt.c \ + $(SRC)/blockinput.h \ $(SRC)/termchar.h \ $(SRC)/w32heap.h \ $(SRC)/w32inevt.h \ - $(BLOCKINPUT_H) \ $(CONFIG_H) \ $(DISPEXTERN_H) \ $(FRAME_H) \ @@ -1193,7 +1194,6 @@ $(BLD)/w32proc.$(O) : \ $(SRC)/w32proc.c \ - $(SRC)/syssignal.h \ $(SRC)/syswait.h \ $(SRC)/w32.h \ $(SRC)/w32heap.h \ @@ -1205,6 +1205,7 @@ $(LANGINFO_H) \ $(LISP_H) \ $(PROCESS_H) \ + $(SYSSIGNAL_H) \ $(SYSTIME_H) \ $(W32TERM_H) @@ -1225,8 +1226,8 @@ $(BLD)/print.$(O) : \ $(SRC)/print.c \ + $(SRC)/blockinput.h \ $(SRC)/termchar.h \ - $(BLOCKINPUT_H) \ $(BUFFER_H) \ $(CHARACTER_H) \ $(CHARSET_H) \ @@ -1244,11 +1245,11 @@ $(BLD)/process.$(O) : \ $(SRC)/process.c \ + $(SRC)/blockinput.h \ $(SRC)/commands.h \ $(SRC)/composite.h \ $(SRC)/gnutls.h \ $(SRC)/sysselect.h \ - $(SRC)/syssignal.h \ $(SRC)/syswait.h \ $(SRC)/termopts.h \ $(NT_INC)/arpa/inet.h \ @@ -1259,7 +1260,6 @@ $(NT_INC)/sys/stat.h \ $(NT_INC)/unistd.h \ $(ATIMER_H) \ - $(BLOCKINPUT_H) \ $(BUFFER_H) \ $(CHARACTER_H) \ $(CODING_H) \ @@ -1270,6 +1270,7 @@ $(LISP_H) \ $(PROCESS_H) \ $(SOCKET_H) \ + $(SYSSIGNAL_H) \ $(SYSTIME_H) \ $(SYSTTY_H) \ $(TERMHOOKS_H) \ @@ -1278,9 +1279,9 @@ $(BLD)/ralloc.$(O) : \ $(SRC)/ralloc.c \ + $(SRC)/blockinput.h \ $(SRC)/getpagesize.h \ $(NT_INC)/unistd.h \ - $(BLOCKINPUT_H) \ $(CONFIG_H) \ $(LISP_H) @@ -1315,12 +1316,12 @@ $(BLD)/search.$(O) : \ $(SRC)/search.c \ + $(SRC)/blockinput.h \ $(SRC)/category.h \ $(SRC)/commands.h \ $(SRC)/regex.h \ $(SRC)/region-cache.h \ $(SRC)/syntax.h \ - $(BLOCKINPUT_H) \ $(BUFFER_H) \ $(CHARACTER_H) \ $(CHARSET_H) \ @@ -1330,12 +1331,12 @@ $(BLD)/sound.$(O) : \ $(SRC)/sound.c \ - $(SRC)/syssignal.h \ $(NT_INC)/unistd.h \ $(ATIMER_H) \ $(CONFIG_H) \ $(DISPEXTERN_H) \ - $(LISP_H) + $(LISP_H) \ + $(SYSSIGNAL_H) $(BLD)/syntax.$(O) : \ $(SRC)/syntax.c \ @@ -1352,9 +1353,9 @@ $(BLD)/sysdep.$(O) : \ $(SRC)/sysdep.c \ + $(SRC)/blockinput.h \ $(SRC)/cm.h \ $(SRC)/sysselect.h \ - $(SRC)/syssignal.h \ $(SRC)/syswait.h \ $(SRC)/termchar.h \ $(SRC)/termopts.h \ @@ -1367,7 +1368,6 @@ $(GNU_LIB)/execinfo.h \ $(GNU_LIB)/ignore-value.h \ $(GNU_LIB)/utimens.h \ - $(BLOCKINPUT_H) \ $(CAREADLINKAT_H) \ $(CONFIG_H) \ $(C_CTYPE_H) \ @@ -1378,6 +1378,7 @@ $(LISP_H) \ $(PROCESS_H) \ $(SOCKET_H) \ + $(SYSSIGNAL_H) \ $(SYSTIME_H) \ $(SYSTTY_H) \ $(TERMHOOKS_H) \ @@ -1385,18 +1386,17 @@ $(BLD)/term.$(O) : \ $(SRC)/term.c \ + $(SRC)/blockinput.h \ $(SRC)/cm.h \ $(SRC)/composite.h \ $(SRC)/disptab.h \ $(SRC)/keymap.h \ - $(SRC)/syssignal.h \ $(SRC)/termchar.h \ $(SRC)/termopts.h \ $(SRC)/tparam.h \ $(NT_INC)/sys/file.h \ $(NT_INC)/sys/time.h \ $(NT_INC)/unistd.h \ - $(BLOCKINPUT_H) \ $(BUFFER_H) \ $(CHARACTER_H) \ $(CHARSET_H) \ @@ -1407,6 +1407,7 @@ $(INTERVALS_H) \ $(KEYBOARD_H) \ $(LISP_H) \ + $(SYSSIGNAL_H) \ $(SYSTTY_H) \ $(TERMHOOKS_H) \ $(WINDOW_H) @@ -1461,12 +1462,12 @@ $(BLD)/window.$(O) : \ $(SRC)/window.c \ + $(SRC)/blockinput.h \ $(SRC)/commands.h \ $(SRC)/disptab.h \ $(SRC)/indent.h \ $(SRC)/keymap.h \ $(SRC)/termchar.h \ - $(BLOCKINPUT_H) \ $(BUFFER_H) \ $(CHARACTER_H) \ $(CONFIG_H) \ @@ -1481,6 +1482,7 @@ $(BLD)/xdisp.$(O) : \ $(SRC)/xdisp.c \ + $(SRC)/blockinput.h \ $(SRC)/commands.h \ $(SRC)/disptab.h \ $(SRC)/fontset.h \ @@ -1490,7 +1492,7 @@ $(SRC)/region-cache.h \ $(SRC)/termchar.h \ $(SRC)/termopts.h \ - $(BLOCKINPUT_H) \ + $(ATIMER_H) \ $(BUFFER_H) \ $(CHARACTER_H) \ $(CHARSET_H) \ @@ -1509,10 +1511,10 @@ $(BLD)/xfaces.$(O) : \ $(SRC)/xfaces.c \ + $(SRC)/blockinput.h \ $(SRC)/fontset.h \ $(SRC)/termchar.h \ $(NT_INC)/sys/stat.h \ - $(BLOCKINPUT_H) \ $(BUFFER_H) \ $(CHARACTER_H) \ $(CHARSET_H) \ @@ -1530,11 +1532,11 @@ $(BLD)/w32fns.$(O) : \ $(SRC)/w32fns.c \ + $(SRC)/blockinput.h \ $(SRC)/epaths.h \ $(SRC)/fontset.h \ $(SRC)/w32.h \ $(SRC)/w32heap.h \ - $(BLOCKINPUT_H) \ $(BUFFER_H) \ $(CCL_H) \ $(CHARACTER_H) \ @@ -1555,9 +1557,9 @@ $(BLD)/w32menu.$(O) : \ $(SRC)/w32menu.c \ + $(SRC)/blockinput.h \ $(SRC)/keymap.h \ $(SRC)/w32heap.h \ - $(BLOCKINPUT_H) \ $(BUFFER_H) \ $(CHARACTER_H) \ $(CHARSET_H) \ @@ -1574,6 +1576,7 @@ $(BLD)/w32term.$(O) : \ $(SRC)/w32term.c \ + $(SRC)/blockinput.h \ $(SRC)/disptab.h \ $(SRC)/fontset.h \ $(SRC)/keymap.h \ @@ -1582,7 +1585,6 @@ $(SRC)/w32heap.h \ $(NT_INC)/sys/stat.h \ $(ATIMER_H) \ - $(BLOCKINPUT_H) \ $(BUFFER_H) \ $(CCL_H) \ $(CHARACTER_H) \ @@ -1605,9 +1607,9 @@ $(BLD)/w32select.$(O) : \ $(SRC)/w32select.c \ + $(SRC)/blockinput.h \ $(SRC)/composite.h \ $(SRC)/w32heap.h \ - $(BLOCKINPUT_H) \ $(CHARSET_H) \ $(CODING_H) \ $(CONFIG_H) \ @@ -1616,15 +1618,15 @@ $(BLD)/w32reg.$(O) : \ $(SRC)/w32reg.c \ - $(BLOCKINPUT_H) \ + $(SRC)/blockinput.h \ $(CONFIG_H) \ $(LISP_H) \ $(W32TERM_H) $(BLD)/w32xfns.$(O) : \ $(SRC)/w32xfns.c \ + $(SRC)/blockinput.h \ $(SRC)/fontset.h \ - $(BLOCKINPUT_H) \ $(CHARSET_H) \ $(CONFIG_H) \ $(FRAME_H) \ ------------------------------------------------------------ revno: 110168 fixes bug: http://debbugs.gnu.org/12471 committer: Eli Zaretskii branch nick: trunk timestamp: Sun 2012-09-23 19:34:30 +0200 message: Clean-up left-overs after revision 110152 wrt signal handling. src/.gdbinit: Set breakpoint on terminate_due_to_signal, not on fatal_error_backtrace. src/w32proc.c (sys_kill): Undo last change: don't do anything when invoked to deliver SIGABRT to our own process. This is now handled by emacs_raise. nt/inc/ms-w32.h (emacs_raise): Redefine to invoke emacs_abort. diff: === modified file 'nt/ChangeLog' --- nt/ChangeLog 2012-09-23 08:44:20 +0000 +++ nt/ChangeLog 2012-09-23 17:34:30 +0000 @@ -1,3 +1,7 @@ +2012-09-23 Eli Zaretskii + + * inc/ms-w32.h (emacs_raise): Redefine to invoke emacs_abort. + 2012-09-23 Paul Eggert Simplify and avoid signal-handling races (Bug#12471). === modified file 'nt/inc/ms-w32.h' --- nt/inc/ms-w32.h 2012-09-23 08:44:20 +0000 +++ nt/inc/ms-w32.h 2012-09-23 17:34:30 +0000 @@ -204,7 +204,7 @@ #define signal sys_signal /* Internal signals. */ -#define emacs_raise(sig) kill (getpid (), sig) +#define emacs_raise(sig) emacs_abort() /* termcap.c calls that are emulated. */ #define tputs sys_tputs === modified file 'src/.gdbinit' --- src/.gdbinit 2012-09-22 20:35:46 +0000 +++ src/.gdbinit 2012-09-23 17:34:30 +0000 @@ -1214,8 +1214,8 @@ show environment TERM # When debugging, it is handy to be able to "return" from -# fatal_error_backtrace when an assertion failure is non-fatal. -break fatal_error_backtrace +# terminate_due_to_signal when an assertion failure is non-fatal. +break terminate_due_to_signal # x_error_quitter is defined only on X. But window-system is set up # only at run time, during Emacs startup, so we need to defer setting === modified file 'src/ChangeLog' --- src/ChangeLog 2012-09-23 17:33:16 +0000 +++ src/ChangeLog 2012-09-23 17:34:30 +0000 @@ -1,3 +1,12 @@ +2012-09-23 Eli Zaretskii + + * .gdbinit: Set breakpoint on terminate_due_to_signal, not on + fatal_error_backtrace. + + * w32proc.c (sys_kill): Undo last change: don't do anything when + invoked to deliver SIGABRT to our own process. This is now + handled by emacs_raise. + 2012-09-23 Juanma Barranquero * w32term.c (w32_read_socket): Remove leftover reference to === modified file 'src/w32proc.c' --- src/w32proc.c 2012-09-15 08:03:11 +0000 +++ src/w32proc.c 2012-09-23 17:34:30 +0000 @@ -1428,9 +1428,6 @@ int need_to_free = 0; int rc = 0; - if (pid == getpid () && sig == SIGABRT) - emacs_abort (); - /* Only handle signals that will result in the process dying */ if (sig != SIGINT && sig != SIGKILL && sig != SIGQUIT && sig != SIGHUP) { ------------------------------------------------------------ revno: 110167 committer: Juanma Barranquero branch nick: trunk timestamp: Sun 2012-09-23 19:33:16 +0200 message: src/w32term.c (w32_read_socket): Remove reference to deleted variable. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-09-23 17:05:14 +0000 +++ src/ChangeLog 2012-09-23 17:33:16 +0000 @@ -1,3 +1,8 @@ +2012-09-23 Juanma Barranquero + + * w32term.c (w32_read_socket): Remove leftover reference to + interrupt_input_pending. + 2012-09-23 Paul Eggert Do not use SA_NODEFER. === modified file 'src/w32term.c' --- src/w32term.c 2012-09-23 08:44:20 +0000 +++ src/w32term.c 2012-09-23 17:33:16 +0000 @@ -4157,7 +4157,6 @@ struct w32_display_info *dpyinfo = &one_w32_display_info; Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight; - interrupt_input_pending = 0; block_input (); /* So people can tell when we have read the available input. */ ------------------------------------------------------------ revno: 110166 committer: Paul Eggert branch nick: trunk timestamp: Sun 2012-09-23 10:05:14 -0700 message: Do not use SA_NODEFER. Problem reported by Dani Moncayo in . * alloc.c (die): * sysdep.c (emacs_abort): Do not reset signal handler. * emacs.c (terminate_due_to_signal): Reset signal handler here. * sysdep.c (init_signals): Do not use SA_NODEFER. It wasn't wanted even on POSIXish hosts, and it doesn't work on Windows. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-09-23 10:03:35 +0000 +++ src/ChangeLog 2012-09-23 17:05:14 +0000 @@ -1,3 +1,14 @@ +2012-09-23 Paul Eggert + + Do not use SA_NODEFER. + Problem reported by Dani Moncayo in + . + * alloc.c (die): + * sysdep.c (emacs_abort): Do not reset signal handler. + * emacs.c (terminate_due_to_signal): Reset signal handler here. + * sysdep.c (init_signals): Do not use SA_NODEFER. It wasn't + wanted even on POSIXish hosts, and it doesn't work on Windows. + 2012-09-23 Jan Djärv * xterm.c (x_term_init): Call fixup_locale before and after calling === modified file 'src/alloc.c' --- src/alloc.c 2012-09-23 08:44:20 +0000 +++ src/alloc.c 2012-09-23 17:05:14 +0000 @@ -6393,7 +6393,6 @@ void die (const char *msg, const char *file, int line) { - signal (SIGABRT, SIG_DFL); fprintf (stderr, "\r\n%s:%d: Emacs fatal error: %s\r\n", file, line, msg); terminate_due_to_signal (SIGABRT, INT_MAX); === modified file 'src/emacs.c' --- src/emacs.c 2012-09-23 08:44:20 +0000 +++ src/emacs.c 2012-09-23 17:05:14 +0000 @@ -285,6 +285,7 @@ _Noreturn void terminate_due_to_signal (int sig, int backtrace_limit) { + signal (sig, SIG_DFL); totally_unblock_input (); /* If fatal error occurs in code below, avoid infinite recursion. */ === modified file 'src/sysdep.c' --- src/sysdep.c 2012-09-23 08:44:20 +0000 +++ src/sysdep.c 2012-09-23 17:05:14 +0000 @@ -1763,7 +1763,7 @@ sigfillset (&process_fatal_action.sa_mask); process_fatal_action.sa_handler = deliver_fatal_signal; - process_fatal_action.sa_flags = emacs_sigaction_flags () | SA_NODEFER; + process_fatal_action.sa_flags = emacs_sigaction_flags (); sigfillset (&thread_fatal_action.sa_mask); thread_fatal_action.sa_handler = deliver_fatal_thread_signal; @@ -2044,7 +2044,6 @@ void emacs_abort (void) { - signal (SIGABRT, SIG_DFL); terminate_due_to_signal (SIGABRT, 10); } #endif ------------------------------------------------------------ revno: 110165 committer: Stefan Merten branch nick: trunk timestamp: Sun 2012-09-23 16:50:02 +0200 message: * textmodes/rst.el: Fix compiler warning. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-09-23 12:46:53 +0000 +++ lisp/ChangeLog 2012-09-23 14:50:02 +0000 @@ -1,3 +1,7 @@ +2012-09-23 Stefan Merten + + * textmodes/rst.el: Fix compiler warning. + 2012-09-23 Roland Winkler * textmodes/bibtex.el (bibtex-autokey-transcriptions): Transcribe @@ -79,7 +83,7 @@ 2012-09-22 Stefan Merten - * rst.el: Revamp section title faces. + * textmodes/rst.el: Revamp section title faces. (rst-official-version) (rst-package-emacs-version-alist): Sync with official version V1.4.0. @@ -154,7 +158,7 @@ 2012-09-20 Stefan Merten - * rst.el: Integrate support for `imenu' and `which-function'. + * textmodes/rst.el: Integrate support for `imenu' and `which-function'. Fixes feature request bug#11711. (rst-mode): Create `imenu-create-index-function'. (rst-get-stripped-line): Delete after refactoring. @@ -294,7 +298,7 @@ 2012-09-17 Stefan Merten - * rst.el: Add support for `testcover'. + * textmodes/rst.el: Add support for `testcover'. (rst-defcustom-testcover, rst-testcover-add-compose) (rst-testcover-add-1value): New functions. (rst-portable-mark-active-p): Replace by `use-region-p'. @@ -2130,7 +2134,7 @@ 2012-07-30 Stefan Merten - * rst.el: Silence `checkdoc-ispell'. + * textmodes/rst.el: Silence `checkdoc-ispell'. (rst-cvs-header, rst-svn-rev, rst-svn-timestamp) (rst-official-version, rst-official-cvs-rev) (rst-package-emacs-version-alist): Update to upstream V1.3.1. === modified file 'lisp/textmodes/rst.el' --- lisp/textmodes/rst.el 2012-09-22 09:16:00 +0000 +++ lisp/textmodes/rst.el 2012-09-23 14:50:02 +0000 @@ -118,7 +118,8 @@ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Support for `testcover' -(when (boundp 'testcover-1value-functions) +(when (and (boundp 'testcover-1value-functions) + (boundp 'testcover-compose-functions)) ;; Below `lambda' is used in a loop with varying parameters and is thus not ;; 1valued. (setq testcover-1value-functions @@ -217,7 +218,7 @@ ;; Use CVSHeader to really get information from CVS and not other version ;; control systems. (defconst rst-cvs-header - "$CVSHeader: sm/rst_el/rst.el,v 1.327.2.1 2012-09-22 09:06:56 stefan Exp $") + "$CVSHeader: sm/rst_el/rst.el,v 1.327.2.2 2012-09-23 14:44:25 stefan Exp $") (defconst rst-cvs-rev (rst-extract-version "\\$" "CVSHeader: \\S + " "[0-9]+\\(?:\\.[0-9]+\\)+" " .*" rst-cvs-header "0.0") @@ -246,7 +247,7 @@ "Official version of the package.") (defconst rst-official-cvs-rev (rst-extract-version "[%$]" "Revision: " "[0-9]+\\(?:\\.[0-9]+\\)+" " " - "$Revision: 1.327.2.1 $") + "$Revision: 1.327.2.2 $") "CVS revision of this file in the official version.") (defconst rst-version ------------------------------------------------------------ revno: 110164 committer: Roland Winkler branch nick: trunk timestamp: Sun 2012-09-23 09:42:55 -0500 message: etc/NEWS: clarify entry for proced-renice diff: === modified file 'etc/NEWS' --- etc/NEWS 2012-09-23 12:34:23 +0000 +++ etc/NEWS 2012-09-23 14:42:55 +0000 @@ -411,7 +411,7 @@ ** In Perl mode, new option `perl-indent-parens-as-block' causes non-block closing brackets to be aligned with the line of the opening bracket. -** In Proced mode, new command `proced-renice' renices selected processes. +** In Proced mode, new command `proced-renice' renices marked processes. ** Python mode ------------------------------------------------------------ revno: 110163 committer: Roland Winkler branch nick: trunk timestamp: Sun 2012-09-23 07:46:53 -0500 message: lisp/textmodes/bibtex.el: minor bugfixes diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-09-23 12:35:28 +0000 +++ lisp/ChangeLog 2012-09-23 12:46:53 +0000 @@ -1,5 +1,12 @@ 2012-09-23 Roland Winkler + * textmodes/bibtex.el (bibtex-autokey-transcriptions): Transcribe + also LaTeX hyphenation. + (bibtex-reformat): Bug fix. Do not quote twice the elements of + bibtex-reformat-previous-options. + +2012-09-23 Roland Winkler + * proced.el (proced-renice-command): New variable. (proced-marked-processes): New function. (proced-with-processes-buffer): New macro. === modified file 'lisp/textmodes/bibtex.el' --- lisp/textmodes/bibtex.el 2012-06-12 05:47:14 +0000 +++ lisp/textmodes/bibtex.el 2012-09-23 12:46:53 +0000 @@ -1002,6 +1002,7 @@ ("\\\\`\\|\\\\'\\|\\\\\\^\\|\\\\~\\|\\\\=\\|\\\\\\.\\|\\\\u\\|\\\\v\\|\\\\H\\|\\\\t\\|\\\\c\\|\\\\d\\|\\\\b" . "") ;; braces, quotes, concatenation. ("[`'\"{}#]" . "") + ("\\\\-" . "") ; \- -> ;; spaces ("\\\\?[ \t\n]+\\|~" . " ")) "Alist of (OLD-REGEXP . NEW-STRING) pairs. @@ -4893,21 +4894,22 @@ (if use-previous-options bibtex-reformat-previous-options (setq bibtex-reformat-previous-options - (mapcar (lambda (option) - (if (y-or-n-p (car option)) (cdr option))) - `(("Realign entries (recommended)? " . 'realign) - ("Remove empty optional and alternative fields? " . 'opts-or-alts) - ("Remove delimiters around pure numerical fields? " . 'numerical-fields) - (,(concat (if bibtex-comma-after-last-field "Insert" "Remove") - " comma at end of entry? ") . 'last-comma) - ("Replace double page dashes by single ones? " . 'page-dashes) - ("Delete whitespace at the beginning and end of fields? " . 'whitespace) - ("Inherit booktitle? " . 'inherit-booktitle) - ("Force delimiters? " . 'delimiters) - ("Unify case of entry types and field names? " . 'unify-case) - ("Enclose parts of field entries by braces? " . 'braces) - ("Replace parts of field entries by string constants? " . 'strings) - ("Sort fields? " . 'sort-fields)))))) + (delq nil + (mapcar (lambda (option) + (if (y-or-n-p (car option)) (cdr option))) + `(("Realign entries (recommended)? " . realign) + ("Remove empty optional and alternative fields? " . opts-or-alts) + ("Remove delimiters around pure numerical fields? " . numerical-fields) + (,(concat (if bibtex-comma-after-last-field "Insert" "Remove") + " comma at end of entry? ") . last-comma) + ("Replace double page dashes by single ones? " . page-dashes) + ("Delete whitespace at the beginning and end of fields? " . whitespace) + ("Inherit booktitle? " . inherit-booktitle) + ("Force delimiters? " . delimiters) + ("Unify case of entry types and field names? " . unify-case) + ("Enclose parts of field entries by braces? " . braces) + ("Replace parts of field entries by string constants? " . strings) + ("Sort fields? " . sort-fields))))))) ;; Do not include required-fields because `bibtex-reformat' ;; cannot handle the error messages of `bibtex-format-entry'. ;; Use `bibtex-validate' to check for required fields. ------------------------------------------------------------ revno: 110162 committer: Roland Winkler branch nick: trunk timestamp: Sun 2012-09-23 07:35:28 -0500 message: Add ChangeLog entry for previous commit diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-09-23 11:54:50 +0000 +++ lisp/ChangeLog 2012-09-23 12:35:28 +0000 @@ -1,5 +1,13 @@ 2012-09-23 Roland Winkler + * proced.el (proced-renice-command): New variable. + (proced-marked-processes): New function. + (proced-with-processes-buffer): New macro. + (proced-send-signal): Use them. + (proced-renice): New command bound to r. + +2012-09-23 Roland Winkler + * ibuf-ext.el (ibuffer-switch-to-saved-filter-groups): If list ibuffer-saved-filter-groups has one element, shortcut the call of completing-read. (Bug#12331) ------------------------------------------------------------ revno: 110161 committer: Roland Winkler branch nick: trunk timestamp: Sun 2012-09-23 07:34:23 -0500 message: lisp/proced.el: new command proced-renice diff: === modified file 'etc/NEWS' --- etc/NEWS 2012-09-23 10:46:50 +0000 +++ etc/NEWS 2012-09-23 12:34:23 +0000 @@ -411,6 +411,8 @@ ** In Perl mode, new option `perl-indent-parens-as-block' causes non-block closing brackets to be aligned with the line of the opening bracket. +** In Proced mode, new command `proced-renice' renices selected processes. + ** Python mode A new version of python.el, which provides several new features, including: === modified file 'lisp/proced.el' --- lisp/proced.el 2012-08-05 14:22:05 +0000 +++ lisp/proced.el 2012-09-23 12:34:23 +0000 @@ -28,8 +28,11 @@ ;; listed. See `proced-mode' for getting started. ;; ;; To do: -;; - interactive temporary customizability of flags in `proced-grammar-alist' -;; - allow "sudo kill PID", "renice PID" +;; - Interactive temporary customizability of flags in `proced-grammar-alist' +;; - Allow "sudo kill PID", "sudo renice PID" +;; `proced-send-signal' operates on multiple processes one by one. +;; With "sudo" we want to execute one "kill" or "renice" command +;; for all marked processes. Is there a `sudo-call-process'? ;; ;; Thoughts and Ideas ;; - Currently, `process-attributes' returns the list of @@ -62,6 +65,11 @@ :type '(choice (function :tag "function") (string :tag "command"))) +(defcustom proced-renice-command "renice" + "Name of renice command." + :group 'proced + :type '(string :tag "command")) + (defcustom proced-signal-list '( ;; signals supported on all POSIX compliant systems ("HUP" . " (1. Hangup)") @@ -491,6 +499,7 @@ (define-key km "o" 'proced-omit-processes) (define-key km "x" 'proced-send-signal) ; Dired compatibility (define-key km "k" 'proced-send-signal) ; kill processes + (define-key km "r" 'proced-renice) ; renice processes ;; misc (define-key km "h" 'describe-mode) (define-key km "?" 'proced-help) @@ -561,8 +570,11 @@ :style toggle :selected (eval proced-auto-update-flag) :help "Auto Update of Proced Buffer"] + "--" ["Send signal" proced-send-signal - :help "Send Signal to Marked Processes"])) + :help "Send Signal to Marked Processes"] + ["Renice" proced-renice + :help "Renice Marked Processes"])) ;; helper functions (defun proced-marker-regexp () @@ -1686,14 +1698,11 @@ Preserves point and marks." (proced-update t)) -(defun proced-send-signal (&optional signal) - "Send a SIGNAL to the marked processes. -If no process is marked, operate on current process. -SIGNAL may be a string (HUP, INT, TERM, etc.) or a number. -If SIGNAL is nil display marked processes and query interactively for SIGNAL. -After sending the signal, this command runs the normal hook -`proced-after-send-signal-hook'." - (interactive) +(defun proced-marked-processes () + "Return marked processes as alist of PIDs. +If no process is marked return alist with the PID of the process point is on. +The cdrs of the alist are the text strings displayed by Proced for these +processes. They are used for error messages." (let ((regexp (proced-marker-regexp)) process-alist) ;; collect marked processes @@ -1706,102 +1715,183 @@ (+ 2 (line-beginning-position)) (line-end-position))) process-alist))) - (setq process-alist - (if process-alist - (nreverse process-alist) - ;; take current process - (list (cons (proced-pid-at-point) + (if process-alist + (nreverse process-alist) + ;; take current process + (let ((pid (proced-pid-at-point))) + (if pid + (list (cons pid (buffer-substring-no-properties (+ 2 (line-beginning-position)) - (line-end-position)))))) + (line-end-position))))))))) + +(defmacro proced-with-processes-buffer (process-alist &rest body) + "Execute the forms in BODY in a temporary buffer displaying PROCESS-ALIST. +PROCESS-ALIST is an alist of process PIDs as in `proced-process-alist'. +The value returned is the value of the last form in BODY." + (declare (indent 1) (debug t)) + ;; Use leading space in buffer name to make this buffer ephemeral + `(let ((bufname " *Marked Processes*") + (header-line (substring-no-properties proced-header-line))) + (with-current-buffer (get-buffer-create bufname) + (setq truncate-lines t + proced-header-line header-line ; inherit header line + header-line-format '(:eval (proced-header-line))) + (add-hook 'post-command-hook 'force-mode-line-update nil t) + (let ((inhibit-read-only t)) + (erase-buffer) + (buffer-disable-undo) + (setq buffer-read-only t) + (dolist (process ,process-alist) + (insert " " (cdr process) "\n")) + (delete-char -1) + (goto-char (point-min))) + (save-window-excursion + ;; Analogous to `dired-pop-to-buffer' + ;; Don't split window horizontally. (Bug#1806) + (let (split-width-threshold) + (pop-to-buffer (current-buffer))) + (fit-window-to-buffer (get-buffer-window) nil 1) + ,@body)))) + +(defun proced-send-signal (&optional signal process-alist) + "Send a SIGNAL to processes in PROCESS-ALIST. +PROCESS-ALIST is an alist as returned by `proced-marked-processes'. +Interactively, PROCESS-ALIST contains the marked processes. +If no process is marked, it contains the process point is on, +SIGNAL may be a string (HUP, INT, TERM, etc.) or a number. +After sending SIGNAL to all processes in PROCESS-ALIST, this command +runs the normal hook `proced-after-send-signal-hook'. + +For backward compatibility SIGNAL and PROCESS-ALIST may be nil. +Then PROCESS-ALIST contains the marked processes or the process point is on +and SIGNAL is queried interactively. This noninteractive usage is still +supported but discouraged. It will be removed in a future version of Emacs." + (interactive + (let* ((process-alist (proced-marked-processes)) + (pnum (if (= 1 (length process-alist)) + "1 process" + (format "%d processes" (length process-alist)))) + (completion-ignore-case t) + (completion-extra-properties + '(:annotation-function + (lambda (s) (cdr (assoc s proced-signal-list)))))) + (proced-with-processes-buffer process-alist + (list (completing-read (concat "Send signal [" pnum + "] (default TERM): ") + proced-signal-list + nil nil nil nil "TERM") + process-alist)))) + + (unless (and signal process-alist) + ;; Discouraged usge (supported for backward compatibility): + ;; The new calling sequence separates more cleanly between the parts + ;; of the code required for interactive and noninteractive calls so that + ;; the command can be used more flexibly in noninteractive ways, too. + (unless (get 'proced-send-signal 'proced-outdated) + (put 'proced-send-signal 'proced-outdated t) + (message "Outdated usage of `proced-send-signal'") + (sit-for 2)) + (setq process-alist (proced-marked-processes)) (unless signal - ;; Display marked processes (code taken from `dired-mark-pop-up'). - (let ((bufname " *Marked Processes*") ; use leading space in buffer name - ; to make this buffer ephemeral - (header-line (substring-no-properties proced-header-line))) - (with-current-buffer (get-buffer-create bufname) - (setq truncate-lines t - proced-header-line header-line ; inherit header line - header-line-format '(:eval (proced-header-line))) - (add-hook 'post-command-hook 'force-mode-line-update nil t) - (let ((inhibit-read-only t)) - (erase-buffer) - (buffer-disable-undo) - (setq buffer-read-only t) - (dolist (process process-alist) - (insert " " (cdr process) "\n")) - (delete-char -1) - (goto-char (point-min))) - (save-window-excursion - ;; Analogous to `dired-pop-to-buffer' - ;; Don't split window horizontally. (Bug#1806) - (let (split-width-threshold) - (pop-to-buffer (current-buffer))) - (fit-window-to-buffer (get-buffer-window) nil 1) - (let* ((completion-ignore-case t) - (pnum (if (= 1 (length process-alist)) - "1 process" - (format "%d processes" (length process-alist)))) - (completion-extra-properties - '(:annotation-function - (lambda (s) (cdr (assoc s proced-signal-list)))))) - (setq signal - (completing-read (concat "Send signal [" pnum - "] (default TERM): ") - proced-signal-list - nil nil nil nil "TERM"))))))) - ;; send signal - (let ((count 0) - failures) - ;; Why not always use `signal-process'? See - ;; http://lists.gnu.org/archive/html/emacs-devel/2008-03/msg02955.html - (if (functionp proced-signal-function) - ;; use built-in `signal-process' - (let ((signal (if (stringp signal) - (if (string-match "\\`[0-9]+\\'" signal) - (string-to-number signal) - (make-symbol signal)) - signal))) ; number - (dolist (process process-alist) - (condition-case err - (if (zerop (funcall - proced-signal-function (car process) signal)) - (setq count (1+ count)) - (proced-log "%s\n" (cdr process)) - (push (cdr process) failures)) - (error ; catch errors from failed signals - (proced-log "%s\n" err) - (proced-log "%s\n" (cdr process)) - (push (cdr process) failures))))) - ;; use external system call - (let ((signal (concat "-" (if (numberp signal) - (number-to-string signal) signal)))) + (let ((pnum (if (= 1 (length process-alist)) + "1 process" + (format "%d processes" (length process-alist)))) + (completion-ignore-case t) + (completion-extra-properties + '(:annotation-function + (lambda (s) (cdr (assoc s proced-signal-list)))))) + (proced-with-processes-buffer process-alist + (setq signal (completing-read (concat "Send signal [" pnum + "] (default TERM): ") + proced-signal-list + nil nil nil nil "TERM")))))) + + (let (failures) + ;; Why not always use `signal-process'? See + ;; http://lists.gnu.org/archive/html/emacs-devel/2008-03/msg02955.html + (if (functionp proced-signal-function) + ;; use built-in `signal-process' + (let ((signal (if (stringp signal) + (if (string-match "\\`[0-9]+\\'" signal) + (string-to-number signal) + (make-symbol signal)) + signal))) ; number (dolist (process process-alist) - (with-temp-buffer - (condition-case nil - (if (zerop (call-process - proced-signal-function nil t nil - signal (number-to-string (car process)))) - (setq count (1+ count)) - (proced-log (current-buffer)) - (proced-log "%s\n" (cdr process)) - (push (cdr process) failures)) - (error ; catch errors from failed signals - (proced-log (current-buffer)) - (proced-log "%s\n" (cdr process)) - (push (cdr process) failures))))))) - (if failures - ;; Proced error message are not always very precise. - ;; Can we issue a useful one-line summary in the - ;; message area (using FAILURES) if only one signal failed? - (proced-log-summary - signal - (format "%d of %d signal%s failed" - (length failures) (length process-alist) - (if (= 1 (length process-alist)) "" "s"))) - (proced-success-message "Sent signal to" count))) - ;; final clean-up - (run-hooks 'proced-after-send-signal-hook))) + (condition-case err + (unless (zerop (funcall + proced-signal-function (car process) signal)) + (proced-log "%s\n" (cdr process)) + (push (cdr process) failures)) + (error ; catch errors from failed signals + (proced-log "%s\n" err) + (proced-log "%s\n" (cdr process)) + (push (cdr process) failures))))) + ;; use external system call + (let ((signal (format "-%s" signal))) + (dolist (process process-alist) + (with-temp-buffer + (condition-case nil + (unless (zerop (call-process + proced-signal-function nil t nil + signal (number-to-string (car process)))) + (proced-log (current-buffer)) + (proced-log "%s\n" (cdr process)) + (push (cdr process) failures)) + (error ; catch errors from failed signals + (proced-log (current-buffer)) + (proced-log "%s\n" (cdr process)) + (push (cdr process) failures))))))) + (if failures + ;; Proced error message are not always very precise. + ;; Can we issue a useful one-line summary in the + ;; message area (using FAILURES) if only one signal failed? + (proced-log-summary + (format "Signal %s" signal) + (format "%d of %d signal%s failed" + (length failures) (length process-alist) + (if (= 1 (length process-alist)) "" "s"))) + (proced-success-message "Sent signal to" (length process-alist)))) + ;; final clean-up + (run-hooks 'proced-after-send-signal-hook)) + +(defun proced-renice (priority process-alist) + "Renice the processes in PROCESS-ALIST to PRIORITY. +PROCESS-ALIST is an alist as returned by `proced-marked-processes'. +Interactively, PROCESS-ALIST contains the marked processes. +If no process is marked, it contains the process point is on, +After renicing all processes in PROCESS-ALIST, this command runs +the normal hook `proced-after-send-signal-hook'." + (interactive + (let ((process-alist (proced-marked-processes))) + (proced-with-processes-buffer process-alist + (list (read-number "New priority: ") + process-alist)))) + (if (numberp priority) + (setq priority (number-to-string priority))) + (let (failures) + (dolist (process process-alist) + (with-temp-buffer + (condition-case nil + (unless (zerop (call-process + proced-renice-command nil t nil + priority (number-to-string (car process)))) + (proced-log (current-buffer)) + (proced-log "%s\n" (cdr process)) + (push (cdr process) failures)) + (error ; catch errors from failed renice + (proced-log (current-buffer)) + (proced-log "%s\n" (cdr process)) + (push (cdr process) failures))))) + (if failures + (proced-log-summary + (format "Renice %s" priority) + (format "%d of %d renice%s failed" + (length failures) (length process-alist) + (if (= 1 (length process-alist)) "" "s"))) + (proced-success-message "Reniced" (length process-alist)))) + ;; final clean-up + (run-hooks 'proced-after-send-signal-hook)) ;; similar to `dired-why' (defun proced-why () ------------------------------------------------------------ revno: 110160 committer: Roland Winkler branch nick: trunk timestamp: Sun 2012-09-23 06:54:50 -0500 message: lisp/ibuf-ext.el (ibuffer-switch-to-saved-filter-groups): Shortcut completing-read if not needed diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-09-23 10:21:34 +0000 +++ lisp/ChangeLog 2012-09-23 11:54:50 +0000 @@ -1,3 +1,9 @@ +2012-09-23 Roland Winkler + + * ibuf-ext.el (ibuffer-switch-to-saved-filter-groups): If list + ibuffer-saved-filter-groups has one element, shortcut the call of + completing-read. (Bug#12331) + 2012-09-23 Chong Yidong * bindings.el (mode-line-toggle-read-only): === modified file 'lisp/ibuf-ext.el' --- lisp/ibuf-ext.el 2012-07-11 23:13:41 +0000 +++ lisp/ibuf-ext.el 2012-09-23 11:54:50 +0000 @@ -755,10 +755,16 @@ The value from `ibuffer-saved-filter-groups' is used." (interactive (list - (if (null ibuffer-saved-filter-groups) - (error "No saved filters") - (completing-read "Switch to saved filter group: " - ibuffer-saved-filter-groups nil t)))) + (cond ((null ibuffer-saved-filter-groups) + (error "No saved filters")) + ;; `ibuffer-saved-filter-groups' is a user variable that defaults + ;; to nil. We assume that with one element in this list the user + ;; knows what she wants. See bug#12331. + ((null (cdr ibuffer-saved-filter-groups)) + (caar ibuffer-saved-filter-groups)) + (t + (completing-read "Switch to saved filter group: " + ibuffer-saved-filter-groups nil t))))) (setq ibuffer-filter-groups (cdr (assoc name ibuffer-saved-filter-groups)) ibuffer-hidden-filter-groups nil) (ibuffer-update nil t)) ------------------------------------------------------------ revno: 110159 committer: Chong Yidong branch nick: trunk timestamp: Sun 2012-09-23 18:46:50 +0800 message: Doc updates for read-only-mode. * buffers.texi (Misc Buffer): Replace toggle-read-only with read-only-mode. * files.texi (Visiting): Likewise. * backups.texi (Auto-Saving): Refer to Minor Mode Conventions for calling conventions. * buffers.texi (Read Only Buffers): Document read-only-mode. * keymaps.texi (Alias Menu Items): Replace toggle-read-only with read-only-mode. diff: === modified file 'doc/emacs/ChangeLog' --- doc/emacs/ChangeLog 2012-09-22 19:27:25 +0000 +++ doc/emacs/ChangeLog 2012-09-23 10:46:50 +0000 @@ -1,3 +1,10 @@ +2012-09-23 Chong Yidong + + * buffers.texi (Misc Buffer): Replace toggle-read-only with + read-only-mode. + + * files.texi (Visiting): Likewise. + 2012-09-22 Paul Eggert * trouble.texi (Crashing): Document ulimit -c. === modified file 'doc/emacs/buffers.texi' --- doc/emacs/buffers.texi 2012-07-13 07:06:09 +0000 +++ doc/emacs/buffers.texi 2012-09-23 10:46:50 +0000 @@ -212,7 +212,7 @@ @table @kbd @item C-x C-q -Toggle read-only status of buffer (@code{toggle-read-only}). +Toggle read-only status of buffer (@code{read-only-mode}). @item M-x rename-buffer @key{RET} @var{name} @key{RET} Change the name of the current buffer. @item M-x rename-uniquely @@ -231,9 +231,9 @@ have special commands to operate on the text; also by visiting a file whose access control says you cannot write it. -@findex toggle-read-only +@findex read-only-mode @vindex view-read-only - The command @kbd{C-x C-q} (@code{toggle-read-only}) makes a read-only + The command @kbd{C-x C-q} (@code{read-only-mode}) makes a read-only buffer writable, and makes a writable buffer read-only. This works by setting the variable @code{buffer-read-only}, which has a local value in each buffer and makes the buffer read-only if its value is === modified file 'doc/emacs/files.texi' --- doc/emacs/files.texi 2012-06-17 05:13:40 +0000 +++ doc/emacs/files.texi 2012-09-23 10:46:50 +0000 @@ -246,7 +246,7 @@ or that is marked read-only, Emacs makes the buffer read-only too, so that you won't go ahead and make changes that you'll have trouble saving afterward. You can make the buffer writable with @kbd{C-x C-q} -(@code{toggle-read-only}). @xref{Misc Buffer}. +(@code{read-only-mode}). @xref{Misc Buffer}. @kindex C-x C-r @findex find-file-read-only === modified file 'doc/lispref/ChangeLog' --- doc/lispref/ChangeLog 2012-09-22 15:24:26 +0000 +++ doc/lispref/ChangeLog 2012-09-23 10:46:50 +0000 @@ -1,3 +1,13 @@ +2012-09-23 Chong Yidong + + * buffers.texi (Read Only Buffers): Document read-only-mode. + + * keymaps.texi (Alias Menu Items): Replace toggle-read-only with + read-only-mode. + + * backups.texi (Auto-Saving): Refer to Minor Mode Conventions for + calling conventions. + 2012-09-22 Chong Yidong * searching.texi (Replacing Match): Minor clarification. === modified file 'doc/lispref/backups.texi' --- doc/lispref/backups.texi 2012-05-27 01:34:14 +0000 +++ doc/lispref/backups.texi 2012-09-23 10:46:50 +0000 @@ -441,12 +441,14 @@ @end defvar @deffn Command auto-save-mode arg -When used interactively without an argument, this command is a toggle -switch: it turns on auto-saving of the current buffer if it is off, -and vice versa. When called from Lisp with no argument, it turns -auto-saving on. With an argument @var{arg}, it turns auto-saving on -if the value of @var{arg} is @code{t}, a nonempty list, or a positive -integer; otherwise, it turns auto-saving off. +This is the mode command for Auto Save mode, a buffer-local minor +mode. When Auto Save mode is enabled, auto-saving is enabled in the +buffer. The calling convention is the same as for other minor mode +commands (@pxref{Minor Mode Conventions}). + +Unlike most minor modes, there is no @code{auto-save-mode} variable. +Auto Save mode is enabled if @code{buffer-auto-save-file-name} is +non-@code{nil} and @code{buffer-saved-size} (see below) is non-zero. @end deffn @defun auto-save-file-name-p filename === modified file 'doc/lispref/buffers.texi' --- doc/lispref/buffers.texi 2012-07-13 07:06:09 +0000 +++ doc/lispref/buffers.texi 2012-09-23 10:46:50 +0000 @@ -740,31 +740,25 @@ of the list (comparison is done with @code{eq}). @end defvar -@deffn Command toggle-read-only &optional arg message -This command toggles whether the current buffer is read-only, by -setting the variable @code{buffer-read-only}. If @var{arg} is -non-@code{nil}, it should be a raw prefix argument; the command then -makes the buffer read-only if the numeric value of that prefix -argument is positive, and makes the buffer writable otherwise. -@xref{Prefix Command Arguments}. - -If called interactively, or if called from Lisp with @var{message} is -non-@code{nil}, the command prints a message reporting the buffer's -new read-only status. - -When making the buffer read-only, this command also enables View mode +@deffn Command read-only-mode &optional arg +This is the mode command for Read Only minor mode, a buffer-local +minor mode. When the mode is enabled, @code{buffer-read-only} is +non-@code{nil} in the buffer; when disabled, @code{buffer-read-only} +is @code{nil} in the buffer. The calling convention is the same as +for other minor mode commands (@pxref{Minor Mode Conventions}). + +This minor mode mainly serves as a wrapper for +@code{buffer-read-only}; unlike most minor modes, there is no separate +@code{read-only-mode} variable. Even when Read Only mode is disabled, +characters with non-@code{nil} @code{read-only} text properties remain +read-only. To temporarily ignore all read-only states, bind +@code{inhibit-read-only}, as described above. + +When enabling Read Only mode, this mode command also enables View mode if the option @code{view-read-only} is non-@code{nil}. @xref{Misc Buffer,,Miscellaneous Buffer Operations, emacs, The GNU Emacs Manual}. -When making the buffer writable, it disables View mode if View mode -was enabled. - -Lisp programs should only call @code{toggle-read-only} if they really -intend to do the same thing as the user command, including possibly -enabling or disabling View mode. Note also that this command works by -setting @code{buffer-read-only}, so even if you make the buffer -writable, characters with non-@code{nil} @code{read-only} text -properties will remain read-only. To temporarily ignore all read-only -states, bind @code{inhibit-read-only}, as described above. +When disabling Read Only mode, it disables View mode if View mode was +enabled. @end deffn @defun barf-if-buffer-read-only === modified file 'doc/lispref/keymaps.texi' --- doc/lispref/keymaps.texi 2012-08-04 14:33:00 +0000 +++ doc/lispref/keymaps.texi 2012-09-23 10:46:50 +0000 @@ -2288,12 +2288,12 @@ in Emacs now is with extended menu items; before that feature existed, it could be done by defining alias commands and using them in menu items. Here's an example that makes two aliases for -@code{toggle-read-only} and gives them different enable conditions: +@code{read-only-mode} and gives them different enable conditions: @example -(defalias 'make-read-only 'toggle-read-only) +(defalias 'make-read-only 'read-only-mode) (put 'make-read-only 'menu-enable '(not buffer-read-only)) -(defalias 'make-writable 'toggle-read-only) +(defalias 'make-writable 'read-only-mode) (put 'make-writable 'menu-enable 'buffer-read-only) @end example @@ -2310,7 +2310,7 @@ @noindent causes menu items for @code{make-read-only} and @code{make-writable} to -show the keyboard bindings for @code{toggle-read-only}. +show the keyboard bindings for @code{read-only-mode}. @node Toolkit Differences @subsubsection Toolkit Differences === modified file 'etc/NEWS' --- etc/NEWS 2012-09-22 17:19:28 +0000 +++ etc/NEWS 2012-09-23 10:46:50 +0000 @@ -94,7 +94,7 @@ next and previous path separator, respectively. ** Mode line changes - +--- *** New option `mode-line-default-help-echo' specifies the help text (shown in a tooltip or in the echo area) for any part of the mode line that does not have its own specialized help text. @@ -143,6 +143,7 @@ ** In the Package Menu, newly-available packages are listed as "new", and sorted above the other "available" packages by default. ++++ ** `C-x C-q' is now bound to the new minor mode `read-only-mode'. This minor mode replaces `toggle-read-only', which is now obsolete. ------------------------------------------------------------ revno: 110158 committer: Chong Yidong branch nick: trunk timestamp: Sun 2012-09-23 18:21:34 +0800 message: Convert toggle-read-only calls to read-only-mode. * bindings.el (mode-line-toggle-read-only): * bs.el (bs-toggle-readonly): * buff-menu.el (Buffer-menu-toggle-read-only): * dired.el (dired-toggle-read-only): * ibuffer.el (ibuffer-do-toggle-read-only): Use read-only-mode. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-09-23 09:16:57 +0000 +++ lisp/ChangeLog 2012-09-23 10:21:34 +0000 @@ -1,5 +1,13 @@ 2012-09-23 Chong Yidong + * bindings.el (mode-line-toggle-read-only): + * bs.el (bs-toggle-readonly): + * buff-menu.el (Buffer-menu-toggle-read-only): + * dired.el (dired-toggle-read-only): + * ibuffer.el (ibuffer-do-toggle-read-only): Use read-only-mode. + +2012-09-23 Chong Yidong + * image.el (image-type-available-p): Adapt to init-image-library argument changes. === modified file 'lisp/bindings.el' --- lisp/bindings.el 2012-08-15 16:29:11 +0000 +++ lisp/bindings.el 2012-09-23 10:21:34 +0000 @@ -40,7 +40,7 @@ (interactive "e") (save-selected-window (select-window (posn-window (event-start event))) - (call-interactively 'toggle-read-only))) + (read-only-mode 'toggle))) (defun mode-line-toggle-modified (event) "Toggle the buffer-modified flag from the mode-line." === modified file 'lisp/bs.el' --- lisp/bs.el 2012-08-12 17:29:53 +0000 +++ lisp/bs.el 2012-09-23 10:21:34 +0000 @@ -962,7 +962,7 @@ Uses function `toggle-read-only'." (interactive) (with-current-buffer (bs--current-buffer) - (call-interactively 'toggle-read-only)) + (read-only-mode 'toggle)) (bs--update-current-line)) (defun bs-clear-modified () === modified file 'lisp/buff-menu.el' --- lisp/buff-menu.el 2012-08-15 16:29:11 +0000 +++ lisp/buff-menu.el 2012-09-23 10:21:34 +0000 @@ -520,7 +520,7 @@ (interactive) (let ((read-only (with-current-buffer (Buffer-menu-buffer t) - (call-interactively 'toggle-read-only) + (read-only-mode 'toggle) buffer-read-only))) (tabulated-list-set-col 1 (if read-only "%" " ") t))) === modified file 'lisp/dired.el' --- lisp/dired.el 2012-09-22 22:57:11 +0000 +++ lisp/dired.el 2012-09-23 10:21:34 +0000 @@ -1964,7 +1964,7 @@ (interactive) (if (derived-mode-p 'dired-mode) (wdired-change-to-wdired-mode) - (call-interactively 'toggle-read-only))) + (read-only-mode 'toggle))) (defun dired-next-line (arg) "Move down lines then position at filename. === modified file 'lisp/ibuffer.el' --- lisp/ibuffer.el 2012-09-17 05:41:04 +0000 +++ lisp/ibuffer.el 2012-09-23 10:21:34 +0000 @@ -1283,7 +1283,7 @@ (:opstring "toggled read only status in" :interactive "P" :modifier-p t) - (call-interactively 'toggle-read-only)) + (read-only-mode 'toggle)) (define-ibuffer-op ibuffer-do-delete () "Kill marked buffers as with `kill-this-buffer'." ------------------------------------------------------------ revno: 110157 fixes bug: http://debbugs.gnu.org/12392 committer: Jan D. branch nick: trunk timestamp: Sun 2012-09-23 12:03:35 +0200 message: * xterm.c (x_term_init): Call fixup_locale before and after calling gtk_init. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-09-23 09:22:38 +0000 +++ src/ChangeLog 2012-09-23 10:03:35 +0000 @@ -1,3 +1,8 @@ +2012-09-23 Jan Djärv + + * xterm.c (x_term_init): Call fixup_locale before and after calling + gtk_init (Bug#12392). + 2012-09-23 Chong Yidong * w32.c (w32_delayed_load): Remove LIBRARIES argument; always use === modified file 'src/xterm.c' --- src/xterm.c 2012-09-23 08:44:20 +0000 +++ src/xterm.c 2012-09-23 10:03:35 +0000 @@ -9957,11 +9957,13 @@ Call before gtk_init so Gtk+ event filters comes after our. */ gdk_window_add_filter (NULL, event_handler_gdk, NULL); + /* gtk_init does set_locale. Fix locale before and after. */ + fixup_locale (); gtk_init (&argc, &argv2); + fixup_locale (); + g_log_remove_handler ("GLib", id); - /* gtk_init does set_locale. We must fix locale after calling it. */ - fixup_locale (); xg_initialize (); dpy = DEFAULT_GDK_DISPLAY (); ------------------------------------------------------------ revno: 110156 committer: Chong Yidong branch nick: trunk timestamp: Sun 2012-09-23 17:25:21 +0800 message: Really fix last change. diff: === modified file 'src/image.c' --- src/image.c 2012-09-23 09:22:38 +0000 +++ src/image.c 2012-09-23 09:25:21 +0000 @@ -561,7 +561,7 @@ /* Function prototypes. */ -static struct image_type *define_image_type (struct image_type *, Lisp_Object); +static struct image_type *define_image_type (struct image_type *); static struct image_type *lookup_image_type (Lisp_Object); static void image_error (const char *format, Lisp_Object, Lisp_Object); static void x_laplace (struct frame *, struct image *); ------------------------------------------------------------ revno: 110155 committer: Chong Yidong branch nick: trunk timestamp: Sun 2012-09-23 17:22:38 +0800 message: Fix last change. * image.c (valid_image_p, make_image): Fix caller to lookup_image_type. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-09-23 09:16:57 +0000 +++ src/ChangeLog 2012-09-23 09:22:38 +0000 @@ -17,6 +17,7 @@ (init_tiff_functions, init_gif_functions, init_svg_functions): Arglist and w32_delayed_load calling convention changed. (gs_type): Remove init_gs_functions; there is no such function. + (valid_image_p, make_image): Fix caller to lookup_image_type. 2012-09-23 Paul Eggert === modified file 'src/image.c' --- src/image.c 2012-09-23 09:16:57 +0000 +++ src/image.c 2012-09-23 09:22:38 +0000 @@ -562,7 +562,7 @@ /* Function prototypes. */ static struct image_type *define_image_type (struct image_type *, Lisp_Object); -static struct image_type *lookup_image_type (Lisp_Object, Lisp_Object); +static struct image_type *lookup_image_type (Lisp_Object); static void image_error (const char *format, Lisp_Object, Lisp_Object); static void x_laplace (struct frame *, struct image *); static void x_emboss (struct frame *, struct image *); @@ -648,7 +648,7 @@ if (CONSP (tem) && SYMBOLP (XCAR (tem))) { struct image_type *type; - type = lookup_image_type (XCAR (tem), Qnil); + type = lookup_image_type (XCAR (tem)); if (type) valid_p = type->valid_p (object); } @@ -981,7 +981,7 @@ eassert (valid_image_p (spec)); img->dependencies = NILP (file) ? Qnil : list1 (file); - img->type = lookup_image_type (image_spec_value (spec, QCtype, NULL), Qnil); + img->type = lookup_image_type (image_spec_value (spec, QCtype, NULL)); eassert (img->type != NULL); img->spec = spec; img->lisp_data = Qnil; ------------------------------------------------------------ revno: 110154 committer: Paul Eggert branch nick: trunk timestamp: Sun 2012-09-23 02:18:24 -0700 message: * Makefile.in (bootstrap): Set MAKEFILE_NAME when building Makefile, to avoid problems with recursion when using GNU make. diff: === modified file 'ChangeLog' --- ChangeLog 2012-09-22 10:59:13 +0000 +++ ChangeLog 2012-09-23 09:18:24 +0000 @@ -1,3 +1,8 @@ +2012-09-23 Paul Eggert + + * Makefile.in (bootstrap): Set MAKEFILE_NAME when building Makefile, + to avoid problems with recursion when using GNU make. + 2012-09-22 Paul Eggert * Makefile.in (bootstrap): Simplify build procedure. === modified file 'Makefile.in' --- Makefile.in 2012-09-22 10:59:13 +0000 +++ Makefile.in 2012-09-23 09:18:24 +0000 @@ -355,6 +355,10 @@ # config.status overrides MAKEFILE_NAME with a bogus name when creating # src/epaths.h, so that 'make epaths-force' does not recursively invoke # config.status and overwrite config.status while executing it (Bug#11214). +# +# 'make bootstrap' overrides MAKEFILE_NAME to a nonexistent file but +# then attempts to build that file. This forces 'Makefile', 'lib/Makefile', +# etc. to be built without running into similar recursion problems. MAKEFILE_NAME = Makefile $(MAKEFILE_NAME): config.status $(srcdir)/src/config.in \ $(srcdir)/Makefile.in $(SUBDIR_MAKEFILES_IN) @@ -895,7 +899,7 @@ # * Do the actual build. bootstrap: bootstrap-clean FRC cd $(srcdir) && { ./autogen.sh || autogen/copy_autogen; } - $(MAKE) $(MFLAGS) Makefile + $(MAKE) $(MFLAGS) MAKEFILE_NAME=force-Makefile force-Makefile $(MAKE) $(MFLAGS) info all .PHONY: check-declare ------------------------------------------------------------ revno: 110153 committer: Chong Yidong branch nick: trunk timestamp: Sun 2012-09-23 17:16:57 +0800 message: Remove LIBRARIES arg from w32_delayed_load and friends. These always use Vdynamic_library_alist anyway. * src/image.c (Finit_image_library, lookup_image_type) (define_image_type): Remove now-unneeded second arg. (init_xpm_functions, init_png_functions, init_jpeg_functions) (init_tiff_functions, init_gif_functions, init_svg_functions): Arglist and w32_delayed_load calling convention changed. (gs_type): Remove init_gs_functions; there is no such function. * src/gnutls.c (init_gnutls_functions): Caller changed; remove arg. (Fgnutls_available_p): Caller changed. * src/xml.c (init_libxml2_functions, Flibxml_parse_html_region) (Flibxml_parse_xml_region): Likewise. * src/dispextern.h (struct image_type): Remove arg from init function. * src/w32.c (w32_delayed_load): Remove LIBRARIES argument; always use Vdynamic_library_alist. * lisp/image.el (image-type-available-p): Change caller to init-image-library. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-09-22 22:57:11 +0000 +++ lisp/ChangeLog 2012-09-23 09:16:57 +0000 @@ -1,3 +1,8 @@ +2012-09-23 Chong Yidong + + * image.el (image-type-available-p): Adapt to init-image-library + argument changes. + 2012-09-22 Juri Linkov * dired.el (dired-mode-map): Add [remap read-only-mode] for === modified file 'lisp/image.el' --- lisp/image.el 2012-09-13 06:09:45 +0000 +++ lisp/image.el 2012-09-23 09:16:57 +0000 @@ -346,7 +346,7 @@ "Return non-nil if image type TYPE is available. Image types are symbols like `xbm' or `jpeg'." (and (fboundp 'init-image-library) - (init-image-library type dynamic-library-alist))) + (init-image-library type))) ;;;###autoload === modified file 'src/ChangeLog' --- src/ChangeLog 2012-09-23 08:44:20 +0000 +++ src/ChangeLog 2012-09-23 09:16:57 +0000 @@ -1,3 +1,23 @@ +2012-09-23 Chong Yidong + + * w32.c (w32_delayed_load): Remove LIBRARIES argument; always use + Vdynamic_library_alist. + + * gnutls.c (init_gnutls_functions): Caller changed; remove arg. + (Fgnutls_available_p): Caller changed. + + * xml.c (init_libxml2_functions, Flibxml_parse_html_region) + (Flibxml_parse_xml_region): Likewise. + + * dispextern.h (struct image_type): Remove arg from init function. + + * image.c (Finit_image_library, lookup_image_type) + (define_image_type): Remove now-unneeded second arg. + (init_xpm_functions, init_png_functions, init_jpeg_functions) + (init_tiff_functions, init_gif_functions, init_svg_functions): + Arglist and w32_delayed_load calling convention changed. + (gs_type): Remove init_gs_functions; there is no such function. + 2012-09-23 Paul Eggert Simplify and avoid signal-handling races (Bug#12471). === modified file 'src/dispextern.h' --- src/dispextern.h 2012-09-22 14:10:24 +0000 +++ src/dispextern.h 2012-09-23 09:16:57 +0000 @@ -2769,7 +2769,7 @@ /* Initialization function (used for dynamic loading of image libraries on Windows), or NULL if none. */ - int (* init) (Lisp_Object); + int (* init) (void); /* Next in list of all supported image types. */ struct image_type *next; === modified file 'src/gnutls.c' --- src/gnutls.c 2012-09-15 07:06:56 +0000 +++ src/gnutls.c 2012-09-23 09:16:57 +0000 @@ -142,12 +142,12 @@ DEF_GNUTLS_FN (int, gnutls_x509_crt_init, (gnutls_x509_crt_t *)); static int -init_gnutls_functions (Lisp_Object libraries) +init_gnutls_functions (void) { HMODULE library; int max_log_level = 1; - if (!(library = w32_delayed_load (libraries, Qgnutls_dll))) + if (!(library = w32_delayed_load (Qgnutls_dll))) { GNUTLS_LOG (1, max_log_level, "GnuTLS library not found"); return 0; @@ -656,7 +656,7 @@ else { Lisp_Object status; - status = init_gnutls_functions (Vdynamic_library_alist) ? Qt : Qnil; + status = init_gnutls_functions () ? Qt : Qnil; Vlibrary_cache = Fcons (Fcons (Qgnutls_dll, status), Vlibrary_cache); return status; } === modified file 'src/image.c' --- src/image.c 2012-09-23 08:44:20 +0000 +++ src/image.c 2012-09-23 09:16:57 +0000 @@ -579,15 +579,10 @@ do { Vimage_types = Fcons (type, Vimage_types); } while (0) /* Define a new image type from TYPE. This adds a copy of TYPE to - image_types and caches the loading status of TYPE. - - LIBRARIES is an alist associating dynamic libraries to external - files implementing them, which is passed to the image library - initialization function if necessary. A nil value defaults to - Vdynamic_library_alist. */ + image_types and caches the loading status of TYPE. */ static struct image_type * -define_image_type (struct image_type *type, Lisp_Object libraries) +define_image_type (struct image_type *type) { struct image_type *p = NULL; Lisp_Object target_type = *type->type; @@ -609,7 +604,7 @@ else #endif { - type_valid = type->init (libraries); + type_valid = type->init (); CACHE_IMAGE_TYPE (target_type, type_valid ? Qt : Qnil); } } @@ -3053,7 +3048,7 @@ }; #ifdef HAVE_NTGUI -static int init_xpm_functions (Lisp_Object); +static int init_xpm_functions (void); #else #define init_xpm_functions NULL #endif @@ -3267,11 +3262,11 @@ DEF_IMGLIB_FN (void, XImageFree, (xpm_XImage *)); static int -init_xpm_functions (Lisp_Object libraries) +init_xpm_functions (void) { HMODULE library; - if (!(library = w32_delayed_load (libraries, Qxpm))) + if (!(library = w32_delayed_load (Qxpm))) return 0; LOAD_IMGLIB_FN (library, XpmFreeAttributes); @@ -5397,7 +5392,7 @@ }; #ifdef HAVE_NTGUI -static int init_png_functions (Lisp_Object); +static int init_png_functions (void); #else #define init_png_functions NULL #endif @@ -5469,11 +5464,11 @@ #endif /* libpng version >= 1.5 */ static int -init_png_functions (Lisp_Object libraries) +init_png_functions (void) { HMODULE library; - if (!(library = w32_delayed_load (libraries, Qpng))) + if (!(library = w32_delayed_load (Qpng))) return 0; LOAD_IMGLIB_FN (library, png_get_io_ptr); @@ -6056,7 +6051,7 @@ }; #ifdef HAVE_NTGUI -static int init_jpeg_functions (Lisp_Object); +static int init_jpeg_functions (void); #else #define init_jpeg_functions NULL #endif @@ -6125,11 +6120,11 @@ DEF_IMGLIB_FN (boolean, jpeg_resync_to_restart, (j_decompress_ptr, int)); static int -init_jpeg_functions (Lisp_Object libraries) +init_jpeg_functions (void) { HMODULE library; - if (!(library = w32_delayed_load (libraries, Qjpeg))) + if (!(library = w32_delayed_load (Qjpeg))) return 0; LOAD_IMGLIB_FN (library, jpeg_finish_decompress); @@ -6648,7 +6643,7 @@ }; #ifdef HAVE_NTGUI -static int init_tiff_functions (Lisp_Object); +static int init_tiff_functions (void); #else #define init_tiff_functions NULL #endif @@ -6702,11 +6697,11 @@ DEF_IMGLIB_FN (int, TIFFSetDirectory, (TIFF *, tdir_t)); static int -init_tiff_functions (Lisp_Object libraries) +init_tiff_functions (void) { HMODULE library; - if (!(library = w32_delayed_load (libraries, Qtiff))) + if (!(library = w32_delayed_load (Qtiff))) return 0; LOAD_IMGLIB_FN (library, TIFFSetErrorHandler); @@ -7103,7 +7098,7 @@ }; #ifdef HAVE_NTGUI -static int init_gif_functions (Lisp_Object); +static int init_gif_functions (void); #else #define init_gif_functions NULL #endif @@ -7175,11 +7170,11 @@ DEF_IMGLIB_FN (GifFileType *, DGifOpenFileName, (const char *)); static int -init_gif_functions (Lisp_Object libraries) +init_gif_functions (void) { HMODULE library; - if (!(library = w32_delayed_load (libraries, Qgif))) + if (!(library = w32_delayed_load (Qgif))) return 0; LOAD_IMGLIB_FN (library, DGifCloseFile); @@ -7600,7 +7595,7 @@ }; #ifdef HAVE_NTGUI -static int init_imagemagick_functions (Lisp_Object); +static int init_imagemagick_functions (void); #else #define init_imagemagick_functions NULL #endif @@ -8154,7 +8149,7 @@ }; #ifdef HAVE_NTGUI -static int init_svg_functions (Lisp_Object); +static int init_svg_functions (void); #else #define init_svg_functions NULL #endif @@ -8218,14 +8213,14 @@ Lisp_Object Qgdk_pixbuf, Qglib, Qgobject; static int -init_svg_functions (Lisp_Object libraries) +init_svg_functions (void) { HMODULE library, gdklib, glib, gobject; - if (!(glib = w32_delayed_load (libraries, Qglib)) - || !(gobject = w32_delayed_load (libraries, Qgobject)) - || !(gdklib = w32_delayed_load (libraries, Qgdk_pixbuf)) - || !(library = w32_delayed_load (libraries, Qsvg))) + if (!(glib = w32_delayed_load (Qglib)) + || !(gobject = w32_delayed_load (Qgobject)) + || !(gdklib = w32_delayed_load (Qgdk_pixbuf)) + || !(library = w32_delayed_load (Qsvg))) return 0; LOAD_IMGLIB_FN (library, rsvg_handle_new); @@ -8549,12 +8544,6 @@ {":background", IMAGE_STRING_OR_NIL_VALUE, 0} }; -#ifdef HAVE_NTGUI -static int init_gs_functions (Lisp_Object); -#else -#define init_gs_functions NULL -#endif - /* Structure describing the image type `ghostscript'. */ static struct image_type gs_type = @@ -8563,7 +8552,7 @@ gs_image_p, gs_load, gs_clear_image, - init_gs_functions, + NULL, NULL }; @@ -8826,77 +8815,69 @@ Initialization ***********************************************************************/ -DEFUN ("init-image-library", Finit_image_library, Sinit_image_library, 2, 2, 0, +DEFUN ("init-image-library", Finit_image_library, Sinit_image_library, 1, 1, 0, doc: /* Initialize image library implementing image type TYPE. Return non-nil if TYPE is a supported image type. -Image types pbm and xbm are prebuilt; other types are loaded here. -Libraries to load are specified in alist LIBRARIES (usually, the value -of `dynamic-library-alist', which see). */) - (Lisp_Object type, Lisp_Object libraries) +If image libraries are loaded dynamically (currently only the case on +MS-Windows), load the library for TYPE if it is not yet loaded, using +the library file(s) specified by `dynamic-library-alist'. */) + (Lisp_Object type) { - return lookup_image_type (type, libraries) ? Qt : Qnil; + return lookup_image_type (type) ? Qt : Qnil; } /* Look up image type TYPE, and return a pointer to its image_type - structure. Return 0 if TYPE is not a known image type. - - LIBRARIES is an alist associating dynamic libraries to external - files implementing them, which is passed to the image library - initialization function if necessary. A nil value defaults to - Vdynamic_library_alist. */ + structure. Return 0 if TYPE is not a known image type. */ static struct image_type * -lookup_image_type (Lisp_Object type, Lisp_Object libraries) +lookup_image_type (Lisp_Object type) { - if (NILP (libraries)) - libraries = Vdynamic_library_alist; - /* Types pbm and xbm are built-in and always available. */ if (EQ (type, Qpbm)) - return define_image_type (&pbm_type, libraries); + return define_image_type (&pbm_type); if (EQ (type, Qxbm)) - return define_image_type (&xbm_type, libraries); + return define_image_type (&xbm_type); #if defined (HAVE_XPM) || defined (HAVE_NS) if (EQ (type, Qxpm)) - return define_image_type (&xpm_type, libraries); + return define_image_type (&xpm_type); #endif #if defined (HAVE_JPEG) || defined (HAVE_NS) if (EQ (type, Qjpeg)) - return define_image_type (&jpeg_type, libraries); + return define_image_type (&jpeg_type); #endif #if defined (HAVE_TIFF) || defined (HAVE_NS) if (EQ (type, Qtiff)) - return define_image_type (&tiff_type, libraries); + return define_image_type (&tiff_type); #endif #if defined (HAVE_GIF) || defined (HAVE_NS) if (EQ (type, Qgif)) - return define_image_type (&gif_type, libraries); + return define_image_type (&gif_type); #endif #if defined (HAVE_PNG) || defined (HAVE_NS) if (EQ (type, Qpng)) - return define_image_type (&png_type, libraries); + return define_image_type (&png_type); #endif #if defined (HAVE_RSVG) if (EQ (type, Qsvg)) - return define_image_type (&svg_type, libraries); + return define_image_type (&svg_type); #endif #if defined (HAVE_IMAGEMAGICK) if (EQ (type, Qimagemagick)) - return define_image_type (&imagemagick_type, libraries); + return define_image_type (&imagemagick_type); #endif #ifdef HAVE_GHOSTSCRIPT if (EQ (type, Qpostscript)) - return define_image_type (&gs_type, libraries); + return define_image_type (&gs_type); #endif return NULL; === modified file 'src/w32.c' --- src/w32.c 2012-09-15 08:03:11 +0000 +++ src/w32.c 2012-09-23 09:16:57 +0000 @@ -6525,29 +6525,27 @@ Lisp_Object Vlibrary_cache; -/* The argument LIBRARIES is an alist that associates a symbol - LIBRARY_ID, identifying an external DLL library known to Emacs, to - a list of filenames under which the library is usually found. In - most cases, the argument passed as LIBRARIES is the variable - `dynamic-library-alist', which is initialized to a list of common - library names. If the function loads the library successfully, it - returns the handle of the DLL, and records the filename in the - property :loaded-from of LIBRARY_ID; it returns NULL if the library - could not be found, or when it was already loaded (because the - handle is not recorded anywhere, and so is lost after use). It - would be trivial to save the handle too in :loaded-from, but - currently there's no use case for it. */ +/* Try loading LIBRARY_ID from the file(s) specified in + Vdynamic_library_alist. If the library is loaded successfully, + return the handle of the DLL, and record the filename in the + property :loaded-from of LIBRARY_ID. If the library could not be + found, or when it was already loaded (because the handle is not + recorded anywhere, and so is lost after use), return NULL. + + We could also save the handle in :loaded-from, but currently + there's no use case for it. */ HMODULE -w32_delayed_load (Lisp_Object libraries, Lisp_Object library_id) +w32_delayed_load (Lisp_Object library_id) { HMODULE library_dll = NULL; CHECK_SYMBOL (library_id); - if (CONSP (libraries) && NILP (Fassq (library_id, Vlibrary_cache))) + if (CONSP (Vdynamic_library_alist) + && NILP (Fassq (library_id, Vlibrary_cache))) { Lisp_Object found = Qnil; - Lisp_Object dlls = Fassq (library_id, libraries); + Lisp_Object dlls = Fassq (library_id, Vdynamic_library_alist); if (CONSP (dlls)) for (dlls = XCDR (dlls); CONSP (dlls); dlls = XCDR (dlls)) === modified file 'src/w32.h' --- src/w32.h 2012-08-04 14:17:10 +0000 +++ src/w32.h 2012-09-23 09:16:57 +0000 @@ -146,7 +146,7 @@ extern int _sys_wait_accept (int fd); extern Lisp_Object Vlibrary_cache, QCloaded_from; -extern HMODULE w32_delayed_load (Lisp_Object, Lisp_Object); +extern HMODULE w32_delayed_load (Lisp_Object); #ifdef HAVE_GNUTLS #include === modified file 'src/xml.c' --- src/xml.c 2012-09-15 07:06:56 +0000 +++ src/xml.c 2012-09-23 09:16:57 +0000 @@ -82,7 +82,7 @@ #endif /* !WINDOWSNT */ static int -init_libxml2_functions (Lisp_Object libraries) +init_libxml2_functions (void) { #ifdef WINDOWSNT if (libxml2_loaded_p ()) @@ -91,7 +91,7 @@ { HMODULE library; - if (!(library = w32_delayed_load (libraries, Qlibxml2_dll))) + if (!(library = w32_delayed_load (Qlibxml2_dll))) { message ("%s", "libxml2 library not found"); return 0; @@ -257,7 +257,7 @@ If BASE-URL is non-nil, it is used to expand relative URLs. */) (Lisp_Object start, Lisp_Object end, Lisp_Object base_url) { - if (init_libxml2_functions (Vdynamic_library_alist)) + if (init_libxml2_functions ()) return parse_region (start, end, base_url, 1); return Qnil; } @@ -269,7 +269,7 @@ If BASE-URL is non-nil, it is used to expand relative URLs. */) (Lisp_Object start, Lisp_Object end, Lisp_Object base_url) { - if (init_libxml2_functions (Vdynamic_library_alist)) + if (init_libxml2_functions ()) return parse_region (start, end, base_url, 0); return Qnil; } ------------------------------------------------------------ revno: 110152 fixes bug: http://debbugs.gnu.org/12471 committer: Paul Eggert branch nick: trunk timestamp: Sun 2012-09-23 01:44:20 -0700 message: Simplify and avoid signal-handling races. * nt/inc/ms-w32.h (emacs_raise): New macro. * src/alloc.c (die): * src/sysdep.c (emacs_abort) [HAVE_NTGUI]: Avoid recursive loop if there's a fatal error in the function itself. * src/atimer.c (pending_atimers): * src/blockinput.h: Don't include "atimer.h"; no longer needed. (interrupt_input_pending): Remove. All uses removed. pending_signals now counts both atimers and ordinary interrupts. This is less racy than having three separate pending-signal flags. (block_input, unblock_input, totally_unblock_input, unblock_input_to) (input_blocked_p): Rename from their upper-case counterparts BLOCK_INPUT, UNBLOCK_INPUT, TOTALLY_UNBLOCK_INPUT, UNBLOCK_INPUT_TO, INPUT_BLOCKED_P, and turn into functions. All uses changed. This makes it easier to access volatile variables more accurately. (BLOCK_INPUT_RESIGNAL): Remove. All uses replaced by unblock_input (). (input_blocked_p): Prefer this to 'interrupt_input_blocked', as that's more reliable if the code is buggy and sets interrupt_input_blocked to a negative value. All uses changed. * src/atimer.c (deliver_alarm_signal): Remove. No need to deliver this to the parent; any thread can handle this signal now. All uses replaced by underlying handler. * src/atimer.c (turn_on_atimers): * src/dispnew.c (handle_window_change_signal): * src/emacs.c (handle_danger_signal): * src/keyboard.c (kbd_buffer_get_event): Don't reestablish signal handler; not needed with sigaction. * src/blockinput.h (UNBLOCK_INPUT_TO, TOTALLY_UNBLOCK_INPUT) (UNBLOCK_INPUT_TO): Rework to avoid unnecessary accesses to volatile variables. (UNBLOCK_INPUT_TO): Now a function. (totally_unblock_input, unblock_input): New decls. * src/data.c (handle_arith_signal, deliver_arith_signal): Move to sysdep.c (init_data): Remove. Necessary stuff now done in init_signal. * src/emacs.c, src/xdisp.c: Include "atimer.h", since we invoke atimer functions. * src/emacs.c (handle_fatal_signal, deliver_fatal_signal): Move to sysdep.c. (fatal_error_code): Remove; no longer needed. (terminate_due_to_signal): Rename from fatal_error_backtrace, since it doesn't always backtrace. All uses changed. No need to reset signal to default, since sigaction and/or die does that for us now. Use emacs_raise (FOO), not kill (getpid (), FOO). (main): Check more-accurately whether we're dumping. Move fatal-error setup to sysdep.c * src/floatfns.c: Do not include "syssignal.h"; no longer needed. * src/gtkutil.c (xg_get_file_name, xg_get_font): Remove no-longer-needed signal-mask manipulation. * src/keyboard.c, src/process.c (POLL_FOR_INPUT): Don't depend on USE_ASYNC_EVENTS, a symbol that is never defined. * src/keyboard.c (read_avail_input): Remove. All uses replaced by gobble_input. (Ftop_level): Use TOTALLY_UNBLOCK_INPUT rather than open code. (kbd_buffer_store_event_hold, gobble_input): (record_asynch_buffer_change) [USABLE_SIGIO]: (store_user_signal_events): No need to mess with signal mask. (gobble_input): If blocking input and there are terminals, simply set pending_signals to 1 and return. All hooks changed to not worry about whether input is blocked. (process_pending_signals): Clear pending_signals before processing them, in case a signal comes in while we're processing. By convention callers now test pending_signals before calling us. (UNBLOCK_INPUT_TO, unblock_input, totally_unblock_input): New functions, to support changes to blockinput.h. (handle_input_available_signal): Now extern. (reinvoke_input_signal): Remove. All uses replaced by handle_async_input. (quit_count): Now volatile, since a signal handler uses it. (handle_interrupt): Now takes bool IN_SIGNAL_HANDLER as arg. All callers changed. Block SIGINT only if not already blocked. Clear sigmask reliably, even if Fsignal returns, which it can. Omit unnecessary accesses to volatile var. (quit_throw_to_read_char): No need to restore sigmask. * src/keyboard.c (gobble_input, handle_user_signal): * src/process.c (wait_reading_process_output): Call signal-handling code rather than killing ourselves. * src/lisp.h: Include , for... (IEEE_FLOATING_POINT): New macro, moved here to avoid duplication. (pending_signals): Now volatile. (syms_of_data): Now const if IEEE floating point. (handle_input_available_signal) [USABLE_SIGIO]: (terminate_due_to_signal, record_child_status_change): New decls. * src/process.c (create_process): Avoid disaster if memory is exhausted while we're processing a vfork, by tightening the critical section around the vfork. (send_process_frame, process_sent_to, handle_pipe_signal) (deliver_pipe_signal): Remove. No longer needed, as Emacs now ignores SIGPIPE. (send_process): No need for setjmp/longjmp any more, since the SIGPIPE stuff is now gone. Instead, report an error if errno is EPIPE. (record_child_status_change): Now extern. PID and W are now args. Return void, not bool. All callers changed. * src/sysdep.c (wait_debugging) [(BSD_SYSTEM || HPUX) && !defined (__GNU__)]: Remove. All uses removed. This bug should be fixed now in a different way. (wait_for_termination_1): Use waitpid rather than sigsuspend, and record the child status change directly. This avoids the need to futz with the signal mask. (process_fatal_action): Move here from emacs.c. (emacs_sigaction_flags): New function, containing much of what used to be in emacs_sigaction_init. (emacs_sigaction_init): Use it. Block nonfatal system signals that are caught by emacs, to make races less likely. (deliver_process_signal): Rename from handle_on_main_thread. All uses changed. (BACKTRACE_LIMIT_MAX): Now at top level. (thread_backtrace_buffer, threadback_backtrace_pointers): New static vars. (deliver_thread_signal, deliver_fatal_thread_signal): New functions, for more-accurate delivery of thread-specific signals. (handle_fatal_signal, deliver_fatal_signal): Move here from emacs.c. (deliver_arith_signal): Handle in this thread, not in the main thread, since it's triggered by this thread. (maybe_fatal_sig): New function. (init_signals): New arg DUMPING so that we can be more accurate about whether we're dumping. Caller changed. Treat thread-specific signals differently from process-general signals. Block all signals while handling fatal error; that's safer. xsignal from SIGFPE only on non-IEEE hosts, treating it as fatal on IEEE hosts. When batch, ignore SIGHUP, SIGINT, SIGTERM if they were already ignored. Ignore SIGPIPE unless batch. (emacs_backtrace): Output backtrace for the appropriate thread, which is not necessarily the main thread. * src/syssignal.h: Include . (emacs_raise): New macro. * src/xterm.c (x_connection_signal): Remove; no longer needed now that we use sigaction. (x_connection_closed): No need to mess with sigmask now. (x_initialize): No need to reset SIGPIPE handler here, since init_signals does this for us now. diff: === modified file 'nt/ChangeLog' --- nt/ChangeLog 2012-09-18 10:49:33 +0000 +++ nt/ChangeLog 2012-09-23 08:44:20 +0000 @@ -1,3 +1,8 @@ +2012-09-23 Paul Eggert + + Simplify and avoid signal-handling races (Bug#12471). + * inc/ms-w32.h (emacs_raise): New macro. + 2012-09-18 Eli Zaretskii * configure.bat: Include stddef.h before gif_lib.h, to have size_t === modified file 'nt/inc/ms-w32.h' --- nt/inc/ms-w32.h 2012-09-07 08:20:07 +0000 +++ nt/inc/ms-w32.h 2012-09-23 08:44:20 +0000 @@ -203,6 +203,9 @@ #define kill sys_kill #define signal sys_signal +/* Internal signals. */ +#define emacs_raise(sig) kill (getpid (), sig) + /* termcap.c calls that are emulated. */ #define tputs sys_tputs #define tgetstr sys_tgetstr === modified file 'src/ChangeLog' --- src/ChangeLog 2012-09-23 08:28:12 +0000 +++ src/ChangeLog 2012-09-23 08:44:20 +0000 @@ -1,3 +1,137 @@ +2012-09-23 Paul Eggert + + Simplify and avoid signal-handling races (Bug#12471). + * alloc.c (die): + * sysdep.c (emacs_abort) [HAVE_NTGUI]: + Avoid recursive loop if there's a fatal error in the function itself. + * atimer.c (pending_atimers): + * blockinput.h: Don't include "atimer.h"; no longer needed. + (interrupt_input_pending): Remove. All uses removed. + pending_signals now counts both atimers and ordinary interrupts. + This is less racy than having three separate pending-signal flags. + (block_input, unblock_input, totally_unblock_input, unblock_input_to) + (input_blocked_p): + Rename from their upper-case counterparts BLOCK_INPUT, + UNBLOCK_INPUT, TOTALLY_UNBLOCK_INPUT, UNBLOCK_INPUT_TO, + INPUT_BLOCKED_P, and turn into functions. All uses changed. + This makes it easier to access volatile variables more accurately. + (BLOCK_INPUT_RESIGNAL): Remove. All uses replaced by unblock_input (). + (input_blocked_p): Prefer this to 'interrupt_input_blocked', as + that's more reliable if the code is buggy and sets + interrupt_input_blocked to a negative value. All uses changed. + * atimer.c (deliver_alarm_signal): + Remove. No need to deliver this to the parent; any thread can + handle this signal now. All uses replaced by underlying handler. + * atimer.c (turn_on_atimers): + * dispnew.c (handle_window_change_signal): + * emacs.c (handle_danger_signal): + * keyboard.c (kbd_buffer_get_event): + Don't reestablish signal handler; not needed with sigaction. + * blockinput.h (UNBLOCK_INPUT_TO, TOTALLY_UNBLOCK_INPUT) + (UNBLOCK_INPUT_TO): + Rework to avoid unnecessary accesses to volatile variables. + (UNBLOCK_INPUT_TO): Now a function. + (totally_unblock_input, unblock_input): New decls. + * data.c (handle_arith_signal, deliver_arith_signal): Move to sysdep.c + (init_data): Remove. Necessary stuff now done in init_signal. + * emacs.c, xdisp.c: Include "atimer.h", since we invoke atimer functions. + * emacs.c (handle_fatal_signal, deliver_fatal_signal): Move to sysdep.c. + (fatal_error_code): Remove; no longer needed. + (terminate_due_to_signal): Rename from fatal_error_backtrace, since + it doesn't always backtrace. All uses changed. No need to reset + signal to default, since sigaction and/or die does that for us now. + Use emacs_raise (FOO), not kill (getpid (), FOO). + (main): Check more-accurately whether we're dumping. + Move fatal-error setup to sysdep.c + * floatfns.c: Do not include "syssignal.h"; no longer needed. + * gtkutil.c (xg_get_file_name, xg_get_font): + Remove no-longer-needed signal-mask manipulation. + * keyboard.c, process.c (POLL_FOR_INPUT): + Don't depend on USE_ASYNC_EVENTS, a symbol that is never defined. + * keyboard.c (read_avail_input): Remove. + All uses replaced by gobble_input. + (Ftop_level): Use TOTALLY_UNBLOCK_INPUT rather than open code. + (kbd_buffer_store_event_hold, gobble_input): + (record_asynch_buffer_change) [USABLE_SIGIO]: + (store_user_signal_events): + No need to mess with signal mask. + (gobble_input): If blocking input and there are terminals, simply + set pending_signals to 1 and return. All hooks changed to not + worry about whether input is blocked. + (process_pending_signals): Clear pending_signals before processing + them, in case a signal comes in while we're processing. + By convention callers now test pending_signals before calling us. + (UNBLOCK_INPUT_TO, unblock_input, totally_unblock_input): + New functions, to support changes to blockinput.h. + (handle_input_available_signal): Now extern. + (reinvoke_input_signal): Remove. All uses replaced by + handle_async_input. + (quit_count): Now volatile, since a signal handler uses it. + (handle_interrupt): Now takes bool IN_SIGNAL_HANDLER as arg. All + callers changed. Block SIGINT only if not already blocked. + Clear sigmask reliably, even if Fsignal returns, which it can. + Omit unnecessary accesses to volatile var. + (quit_throw_to_read_char): No need to restore sigmask. + * keyboard.c (gobble_input, handle_user_signal): + * process.c (wait_reading_process_output): + Call signal-handling code rather than killing ourselves. + * lisp.h: Include , for... + (IEEE_FLOATING_POINT): New macro, moved here to avoid duplication. + (pending_signals): Now volatile. + (syms_of_data): Now const if IEEE floating point. + (handle_input_available_signal) [USABLE_SIGIO]: + (terminate_due_to_signal, record_child_status_change): New decls. + * process.c (create_process): Avoid disaster if memory is exhausted + while we're processing a vfork, by tightening the critical section + around the vfork. + (send_process_frame, process_sent_to, handle_pipe_signal) + (deliver_pipe_signal): Remove. No longer needed, as Emacs now + ignores SIGPIPE. + (send_process): No need for setjmp/longjmp any more, since the + SIGPIPE stuff is now gone. Instead, report an error if errno + is EPIPE. + (record_child_status_change): Now extern. PID and W are now args. + Return void, not bool. All callers changed. + * sysdep.c (wait_debugging) [(BSD_SYSTEM || HPUX) && !defined (__GNU__)]: + Remove. All uses removed. This bug should be fixed now in a + different way. + (wait_for_termination_1): Use waitpid rather than sigsuspend, + and record the child status change directly. This avoids the + need to futz with the signal mask. + (process_fatal_action): Move here from emacs.c. + (emacs_sigaction_flags): New function, containing + much of what used to be in emacs_sigaction_init. + (emacs_sigaction_init): Use it. Block nonfatal system signals that are + caught by emacs, to make races less likely. + (deliver_process_signal): Rename from handle_on_main_thread. + All uses changed. + (BACKTRACE_LIMIT_MAX): Now at top level. + (thread_backtrace_buffer, threadback_backtrace_pointers): + New static vars. + (deliver_thread_signal, deliver_fatal_thread_signal): + New functions, for more-accurate delivery of thread-specific signals. + (handle_fatal_signal, deliver_fatal_signal): Move here from emacs.c. + (deliver_arith_signal): Handle in this thread, not + in the main thread, since it's triggered by this thread. + (maybe_fatal_sig): New function. + (init_signals): New arg DUMPING so that we can be more accurate + about whether we're dumping. Caller changed. + Treat thread-specific signals differently from process-general signals. + Block all signals while handling fatal error; that's safer. + xsignal from SIGFPE only on non-IEEE hosts, treating it as fatal + on IEEE hosts. + When batch, ignore SIGHUP, SIGINT, SIGTERM if they were already ignored. + Ignore SIGPIPE unless batch. + (emacs_backtrace): Output backtrace for the appropriate thread, + which is not necessarily the main thread. + * syssignal.h: Include . + (emacs_raise): New macro. + * xterm.c (x_connection_signal): Remove; no longer needed + now that we use sigaction. + (x_connection_closed): No need to mess with sigmask now. + (x_initialize): No need to reset SIGPIPE handler here, since + init_signals does this for us now. + 2012-09-23 Jan Djärv * nsterm.m (ns_dumpglyphs_image): dr is a new rect to draw image into, === modified file 'src/alloc.c' --- src/alloc.c 2012-09-20 03:10:52 +0000 +++ src/alloc.c 2012-09-23 08:44:20 +0000 @@ -633,13 +633,13 @@ malloc_block_input (void) { if (block_input_in_memory_allocators) - BLOCK_INPUT; + block_input (); } static void malloc_unblock_input (void) { if (block_input_in_memory_allocators) - UNBLOCK_INPUT; + unblock_input (); } # define MALLOC_BLOCK_INPUT malloc_block_input () # define MALLOC_UNBLOCK_INPUT malloc_unblock_input () @@ -5125,7 +5125,7 @@ if (garbage_collection_messages) message1_nolog ("Garbage collecting..."); - BLOCK_INPUT; + block_input (); shrink_regexp_cache (); @@ -5242,7 +5242,7 @@ dump_zombies (); #endif - UNBLOCK_INPUT; + unblock_input (); check_cons_list (); @@ -6393,9 +6393,10 @@ void die (const char *msg, const char *file, int line) { + signal (SIGABRT, SIG_DFL); fprintf (stderr, "\r\n%s:%d: Emacs fatal error: %s\r\n", file, line, msg); - fatal_error_backtrace (SIGABRT, INT_MAX); + terminate_due_to_signal (SIGABRT, INT_MAX); } #endif === modified file 'src/atimer.c' --- src/atimer.c 2012-09-16 21:43:55 +0000 +++ src/atimer.c 2012-09-23 08:44:20 +0000 @@ -40,14 +40,6 @@ static struct atimer *atimers; -/* Non-zero means alarm signal handler has found ripe timers but - interrupt_input_blocked was non-zero. In this case, timer - functions are not called until the next UNBLOCK_INPUT because timer - functions are expected to call X, and X cannot be assumed to be - reentrant. */ - -int pending_atimers; - /* Block/unblock SIGALRM. */ static void @@ -341,16 +333,11 @@ static void run_timers (void) { - EMACS_TIME now; + EMACS_TIME now = current_emacs_time (); - while (atimers - && (pending_atimers = interrupt_input_blocked) == 0 - && (now = current_emacs_time (), - EMACS_TIME_LE (atimers->expiration, now))) + while (atimers && EMACS_TIME_LE (atimers->expiration, now)) { - struct atimer *t; - - t = atimers; + struct atimer *t = atimers; atimers = atimers->next; t->fn (t); @@ -366,16 +353,7 @@ } } - if (! atimers) - pending_atimers = 0; - - if (pending_atimers) - pending_signals = 1; - else - { - pending_signals = interrupt_input_pending; - set_alarm (); - } + set_alarm (); } @@ -385,23 +363,16 @@ static void handle_alarm_signal (int sig) { - pending_atimers = 1; pending_signals = 1; } -static void -deliver_alarm_signal (int sig) -{ - handle_on_main_thread (sig, handle_alarm_signal); -} - - -/* Call alarm signal handler for pending timers. */ + +/* Do pending timers. */ void do_pending_atimers (void) { - if (pending_atimers) + if (atimers) { block_atimers (); run_timers (); @@ -417,12 +388,7 @@ turn_on_atimers (bool on) { if (on) - { - struct sigaction action; - emacs_sigaction_init (&action, deliver_alarm_signal); - sigaction (SIGALRM, &action, 0); - set_alarm (); - } + set_alarm (); else alarm (0); } @@ -433,8 +399,7 @@ { struct sigaction action; free_atimers = stopped_atimers = atimers = NULL; - pending_atimers = 0; /* pending_signals is initialized in init_keyboard.*/ - emacs_sigaction_init (&action, deliver_alarm_signal); + emacs_sigaction_init (&action, handle_alarm_signal); sigaction (SIGALRM, &action, 0); } === modified file 'src/blockinput.h' --- src/blockinput.h 2012-09-13 02:21:28 +0000 +++ src/blockinput.h 2012-09-23 08:44:20 +0000 @@ -19,103 +19,57 @@ #ifndef EMACS_BLOCKINPUT_H #define EMACS_BLOCKINPUT_H -#include "atimer.h" - -/* When Emacs is using signal-driven input, the processing of those - input signals can get pretty hairy. For example, when Emacs is - running under X windows, handling an input signal can entail - retrieving events from the X event queue, or making other X calls. - - If an input signal occurs while Emacs is in the midst of some - non-reentrant code, and the signal processing invokes that same - code, we lose. For example, malloc and the Xlib functions aren't - usually re-entrant, and both are used by the X input signal handler - - if we try to process an input signal in the midst of executing - any of these functions, we'll lose. +INLINE_HEADER_BEGIN +#ifndef BLOCKINPUT_INLINE +# define BLOCKINPUT_INLINE INLINE +#endif + +/* Emacs should avoid doing anything hairy in a signal handler, because + so many system functions are non-reentrant. For example, malloc + and the Xlib functions aren't usually re-entrant, so if they were + used by the SIGIO handler, we'd lose. To avoid this, we make the following requirements: - * Everyone must evaluate BLOCK_INPUT before entering these functions, - and then call UNBLOCK_INPUT after performing them. Calls - BLOCK_INPUT and UNBLOCK_INPUT may be nested. + * Everyone must evaluate BLOCK_INPUT before performing actions that + might conflict with a signal handler, and then call UNBLOCK_INPUT + after performing them. Calls BLOCK_INPUT and UNBLOCK_INPUT may be + nested. * Any complicated interrupt handling code should test - interrupt_input_blocked, and put off its work until later. + INPUT_BLOCKED_P, and put off its work until later. * If the interrupt handling code wishes, it may set - interrupt_input_pending to a non-zero value. If that flag is set - when input becomes unblocked, UNBLOCK_INPUT will send a new SIGIO. */ + pending_signals to a non-zero value. If that flag is set + when input becomes unblocked, UNBLOCK_INPUT will then read + input and process timers. + + Historically, Emacs signal handlers did much more than they do now, + and this caused many BLOCK_INPUT calls to be sprinkled around the code. + FIXME: Remove calls that aren't needed now. */ extern volatile int interrupt_input_blocked; -/* Nonzero means an input interrupt has arrived - during the current critical section. */ -extern int interrupt_input_pending; - - -/* Non-zero means asynchronous timers should be run when input is - unblocked. */ - -extern int pending_atimers; - - /* Begin critical section. */ -#define BLOCK_INPUT (interrupt_input_blocked++) - -/* End critical section. - - If doing signal-driven input, and a signal came in when input was - blocked, reinvoke the signal handler now to deal with it. - - Always test interrupt_input_pending; that's not too expensive, and - it'll never get set if we don't need to resignal. This is simpler - than dealing here with every configuration option that might affect - whether interrupt_input_pending can be nonzero. */ - -#define UNBLOCK_INPUT \ - do \ - { \ - --interrupt_input_blocked; \ - if (interrupt_input_blocked == 0) \ - { \ - if (interrupt_input_pending) \ - reinvoke_input_signal (); \ - if (pending_atimers) \ - do_pending_atimers (); \ - } \ - else if (interrupt_input_blocked < 0) \ - emacs_abort (); \ - } \ - while (0) - -/* Undo any number of BLOCK_INPUT calls, - and also reinvoke any pending signal. */ - -#define TOTALLY_UNBLOCK_INPUT \ - do if (interrupt_input_blocked != 0) \ - { \ - interrupt_input_blocked = 1; \ - UNBLOCK_INPUT; \ - } \ - while (0) - -/* Undo any number of BLOCK_INPUT calls down to level LEVEL, - and also (if the level is now 0) reinvoke any pending signal. */ - -#define UNBLOCK_INPUT_TO(LEVEL) \ - do \ - { \ - interrupt_input_blocked = (LEVEL) + 1; \ - UNBLOCK_INPUT; \ - } \ - while (0) - -#define UNBLOCK_INPUT_RESIGNAL UNBLOCK_INPUT + +BLOCKINPUT_INLINE void +block_input (void) +{ + interrupt_input_blocked++; +} + +extern void unblock_input (void); +extern void totally_unblock_input (void); +extern void unblock_input_to (int); /* In critical section ? */ -#define INPUT_BLOCKED_P (interrupt_input_blocked > 0) - -/* Defined in keyboard.c */ -extern void reinvoke_input_signal (void); + +BLOCKINPUT_INLINE bool +input_blocked_p (void) +{ + return 0 < interrupt_input_blocked; +} + +INLINE_HEADER_END #endif /* EMACS_BLOCKINPUT_H */ === modified file 'src/buffer.c' --- src/buffer.c 2012-09-22 03:07:39 +0000 +++ src/buffer.c 2012-09-23 08:44:20 +0000 @@ -550,11 +550,11 @@ b->indirections = 0; BUF_GAP_SIZE (b) = 20; - BLOCK_INPUT; + block_input (); /* We allocate extra 1-byte at the tail and keep it always '\0' for anchoring a search. */ alloc_buffer_text (b, BUF_GAP_SIZE (b) + 1); - UNBLOCK_INPUT; + unblock_input (); if (! BUF_BEG_ADDR (b)) buffer_memory_full (BUF_GAP_SIZE (b) + 1); @@ -1923,7 +1923,7 @@ bset_name (b, Qnil); - BLOCK_INPUT; + block_input (); if (b->base_buffer) { /* Notify our base buffer that we don't share the text anymore. */ @@ -1946,7 +1946,7 @@ b->width_run_cache = 0; } bset_width_table (b, Qnil); - UNBLOCK_INPUT; + unblock_input (); bset_undo_list (b, Qnil); /* Run buffer-list-update-hook. */ @@ -5032,7 +5032,7 @@ { void *p; - BLOCK_INPUT; + block_input (); #if defined USE_MMAP_FOR_BUFFERS p = mmap_alloc ((void **) &b->text->beg, nbytes); #elif defined REL_ALLOC @@ -5043,12 +5043,12 @@ if (p == NULL) { - UNBLOCK_INPUT; + unblock_input (); memory_full (nbytes); } b->text->beg = (unsigned char *) p; - UNBLOCK_INPUT; + unblock_input (); } /* Enlarge buffer B's text buffer by DELTA bytes. DELTA < 0 means @@ -5060,7 +5060,7 @@ void *p; ptrdiff_t nbytes = (BUF_Z_BYTE (b) - BUF_BEG_BYTE (b) + BUF_GAP_SIZE (b) + 1 + delta); - BLOCK_INPUT; + block_input (); #if defined USE_MMAP_FOR_BUFFERS p = mmap_realloc ((void **) &b->text->beg, nbytes); #elif defined REL_ALLOC @@ -5071,12 +5071,12 @@ if (p == NULL) { - UNBLOCK_INPUT; + unblock_input (); memory_full (nbytes); } BUF_BEG_ADDR (b) = (unsigned char *) p; - UNBLOCK_INPUT; + unblock_input (); } @@ -5085,7 +5085,7 @@ static void free_buffer_text (struct buffer *b) { - BLOCK_INPUT; + block_input (); #if defined USE_MMAP_FOR_BUFFERS mmap_free ((void **) &b->text->beg); @@ -5096,7 +5096,7 @@ #endif BUF_BEG_ADDR (b) = NULL; - UNBLOCK_INPUT; + unblock_input (); } === modified file 'src/callproc.c' --- src/callproc.c 2012-09-17 01:02:11 +0000 +++ src/callproc.c 2012-09-23 08:44:20 +0000 @@ -582,7 +582,7 @@ 0, current_dir); #else /* not WINDOWSNT */ - BLOCK_INPUT; + block_input (); /* vfork, and prevent local vars from being clobbered by the vfork. */ { @@ -626,15 +626,14 @@ setpgrp (pid, pid); #endif /* USG */ - /* GConf causes us to ignore SIGPIPE, make sure it is restored - in the child. */ + /* Emacs ignores SIGPIPE, but the child should not. */ signal (SIGPIPE, SIG_DFL); child_setup (filefd, fd1, fd_error, (char **) new_argv, 0, current_dir); } - UNBLOCK_INPUT; + unblock_input (); #endif /* not WINDOWSNT */ @@ -976,9 +975,9 @@ { int fd; - BLOCK_INPUT; + block_input (); fd = mkstemp (tempfile); - UNBLOCK_INPUT; + unblock_input (); if (fd == -1) report_file_error ("Failed to open temporary file", Fcons (build_string (tempfile), Qnil)); === modified file 'src/data.c' --- src/data.c 2012-09-15 07:06:56 +0000 +++ src/data.c 2012-09-23 08:44:20 +0000 @@ -34,14 +34,6 @@ #include "font.h" #include "keymap.h" -#include -#if (FLT_RADIX == 2 && FLT_MANT_DIG == 24 \ - && FLT_MIN_EXP == -125 && FLT_MAX_EXP == 128) -#define IEEE_FLOATING_POINT 1 -#else -#define IEEE_FLOATING_POINT 0 -#endif - Lisp_Object Qnil, Qt, Qquote, Qlambda, Qunbound; static Lisp_Object Qsubr; Lisp_Object Qerror_conditions, Qerror_message, Qtop_level; @@ -3179,32 +3171,3 @@ Vmost_negative_fixnum = make_number (MOST_NEGATIVE_FIXNUM); XSYMBOL (intern_c_string ("most-negative-fixnum"))->constant = 1; } - -static _Noreturn void -handle_arith_signal (int sig) -{ - pthread_sigmask (SIG_SETMASK, &empty_mask, 0); - xsignal0 (Qarith_error); -} - -static void -deliver_arith_signal (int sig) -{ - handle_on_main_thread (sig, handle_arith_signal); -} - -void -init_data (void) -{ - struct sigaction action; - /* Don't do this if just dumping out. - We don't want to call `signal' in this case - so that we don't have trouble with dumping - signal-delivering routines in an inconsistent state. */ -#ifndef CANNOT_DUMP - if (!initialized) - return; -#endif /* CANNOT_DUMP */ - emacs_sigaction_init (&action, deliver_arith_signal); - sigaction (SIGFPE, &action, 0); -} === modified file 'src/dired.c' --- src/dired.c 2012-09-15 07:06:56 +0000 +++ src/dired.c 2012-09-23 08:44:20 +0000 @@ -101,9 +101,9 @@ directory_files_internal_unwind (Lisp_Object dh) { DIR *d = (DIR *) XSAVE_VALUE (dh)->pointer; - BLOCK_INPUT; + block_input (); closedir (d); - UNBLOCK_INPUT; + unblock_input (); return Qnil; } @@ -164,9 +164,9 @@ /* Now *bufp is the compiled form of MATCH; don't call anything which might compile a new regexp until we're done with the loop! */ - BLOCK_INPUT; + block_input (); d = opendir (SSDATA (dirfilename)); - UNBLOCK_INPUT; + unblock_input (); if (d == NULL) report_file_error ("Opening directory", Fcons (directory, Qnil)); @@ -310,9 +310,9 @@ } } - BLOCK_INPUT; + block_input (); closedir (d); - UNBLOCK_INPUT; + unblock_input (); #ifdef WINDOWSNT if (attrs) Vw32_get_true_file_attributes = w32_save; @@ -486,9 +486,9 @@ encoded_dir = ENCODE_FILE (dirname); - BLOCK_INPUT; + block_input (); d = opendir (SSDATA (Fdirectory_file_name (encoded_dir))); - UNBLOCK_INPUT; + unblock_input (); if (!d) report_file_error ("Opening directory", Fcons (dirname, Qnil)); @@ -962,10 +962,10 @@ if (!(NILP (id_format) || EQ (id_format, Qinteger))) { - BLOCK_INPUT; + block_input (); uname = stat_uname (&s); gname = stat_gname (&s); - UNBLOCK_INPUT; + unblock_input (); } if (uname) values[2] = DECODE_SYSTEM (build_string (uname)); === modified file 'src/dispnew.c' --- src/dispnew.c 2012-09-20 01:37:07 +0000 +++ src/dispnew.c 2012-09-23 08:44:20 +0000 @@ -1834,7 +1834,7 @@ { /* Block input so that expose events and other events that access glyph matrices are not processed while we are changing them. */ - BLOCK_INPUT; + block_input (); if (f) adjust_frame_glyphs (f); @@ -1846,7 +1846,7 @@ adjust_frame_glyphs (XFRAME (lisp_frame)); } - UNBLOCK_INPUT; + unblock_input (); } @@ -2242,7 +2242,7 @@ { /* Block interrupt input so that we don't get surprised by an X event while we're in an inconsistent state. */ - BLOCK_INPUT; + block_input (); f->glyphs_initialized_p = 0; /* Release window sub-matrices. */ @@ -2287,7 +2287,7 @@ f->desired_pool = f->current_pool = NULL; } - UNBLOCK_INPUT; + unblock_input (); } } @@ -5563,10 +5563,6 @@ int width, height; struct tty_display_info *tty; - struct sigaction action; - emacs_sigaction_init (&action, deliver_window_change_signal); - sigaction (SIGWINCH, &action, 0); - /* The frame size change obviously applies to a single termcap-controlled terminal, but we can't decide which. Therefore, we resize the frames corresponding to each tty. @@ -5599,7 +5595,7 @@ static void deliver_window_change_signal (int sig) { - handle_on_main_thread (sig, handle_window_change_signal); + deliver_process_signal (sig, handle_window_change_signal); } #endif /* SIGWINCH */ @@ -5708,7 +5704,7 @@ && new_frame_total_cols == FRAME_TOTAL_COLS (f)) return; - BLOCK_INPUT; + block_input (); #ifdef MSDOS /* We only can set screen dimensions to certain values supported @@ -5760,7 +5756,7 @@ SET_FRAME_GARBAGED (f); f->resized_p = 1; - UNBLOCK_INPUT; + unblock_input (); record_unwind_current_buffer (); @@ -5791,9 +5787,9 @@ if (tty->termscript != 0) { - BLOCK_INPUT; + block_input (); fclose (tty->termscript); - UNBLOCK_INPUT; + unblock_input (); } tty->termscript = 0; @@ -5824,7 +5820,7 @@ /* ??? Perhaps we should do something special for multibyte strings here. */ CHECK_STRING (string); - BLOCK_INPUT; + block_input (); if (!t) error ("Unknown terminal device"); @@ -5849,7 +5845,7 @@ } fwrite (SDATA (string), 1, SBYTES (string), out); fflush (out); - UNBLOCK_INPUT; + unblock_input (); return Qnil; } === modified file 'src/dosfns.c' --- src/dosfns.c 2012-09-15 07:06:56 +0000 +++ src/dosfns.c 2012-09-23 08:44:20 +0000 @@ -480,9 +480,9 @@ if (FRAME_MSDOS_P (f)) { - BLOCK_INPUT; + block_input (); w95_set_virtual_machine_title (SDATA (name)); - UNBLOCK_INPUT; + unblock_input (); } } #endif /* !HAVE_X_WINDOWS */ === modified file 'src/editfns.c' --- src/editfns.c 2012-09-22 15:24:26 +0000 +++ src/editfns.c 2012-09-23 08:44:20 +0000 @@ -1219,9 +1219,9 @@ return Vuser_login_name; CONS_TO_INTEGER (uid, uid_t, id); - BLOCK_INPUT; + block_input (); pw = getpwuid (id); - UNBLOCK_INPUT; + unblock_input (); return (pw ? build_string (pw->pw_name) : Qnil); } @@ -1279,15 +1279,15 @@ { uid_t u; CONS_TO_INTEGER (uid, uid_t, u); - BLOCK_INPUT; + block_input (); pw = getpwuid (u); - UNBLOCK_INPUT; + unblock_input (); } else if (STRINGP (uid)) { - BLOCK_INPUT; + block_input (); pw = getpwnam (SSDATA (uid)); - UNBLOCK_INPUT; + unblock_input (); } else error ("Invalid UID specification"); @@ -1763,14 +1763,14 @@ while (1) { time_t *taddr = emacs_secs_addr (&t); - BLOCK_INPUT; + block_input (); synchronize_system_time_locale (); tm = ut ? gmtime (taddr) : localtime (taddr); if (! tm) { - UNBLOCK_INPUT; + unblock_input (); time_overflow (); } *tmp = *tm; @@ -1782,14 +1782,14 @@ /* Buffer was too small, so make it bigger and try again. */ len = emacs_nmemftime (NULL, SIZE_MAX, format, formatlen, tm, ut, ns); - UNBLOCK_INPUT; + unblock_input (); if (STRING_BYTES_BOUND <= len) string_overflow (); size = len + 1; buf = SAFE_ALLOCA (size); } - UNBLOCK_INPUT; + unblock_input (); bufstring = make_unibyte_string (buf, len); SAFE_FREE (); return code_convert_string_norecord (bufstring, Vlocale_coding_system, 0); @@ -1817,11 +1817,11 @@ struct tm *decoded_time; Lisp_Object list_args[9]; - BLOCK_INPUT; + block_input (); decoded_time = localtime (&time_spec); if (decoded_time) save_tm = *decoded_time; - UNBLOCK_INPUT; + unblock_input (); if (! (decoded_time && MOST_NEGATIVE_FIXNUM - TM_YEAR_BASE <= save_tm.tm_year && save_tm.tm_year <= MOST_POSITIVE_FIXNUM - TM_YEAR_BASE)) @@ -1837,13 +1837,13 @@ XSETFASTINT (list_args[6], save_tm.tm_wday); list_args[7] = save_tm.tm_isdst ? Qt : Qnil; - BLOCK_INPUT; + block_input (); decoded_time = gmtime (&time_spec); if (decoded_time == 0) list_args[8] = Qnil; else XSETINT (list_args[8], tm_diff (&save_tm, decoded_time)); - UNBLOCK_INPUT; + unblock_input (); return Flist (9, list_args); } @@ -1901,9 +1901,9 @@ zone = XCAR (zone); if (NILP (zone)) { - BLOCK_INPUT; + block_input (); value = mktime (&tm); - UNBLOCK_INPUT; + unblock_input (); } else { @@ -1928,7 +1928,7 @@ else error ("Invalid time zone specification"); - BLOCK_INPUT; + block_input (); /* Set TZ before calling mktime; merely adjusting mktime's returned value doesn't suffice, since that would mishandle leap seconds. */ @@ -1942,7 +1942,7 @@ #ifdef LOCALTIME_CACHE tzset (); #endif - UNBLOCK_INPUT; + unblock_input (); xfree (newenv); } @@ -1978,7 +1978,7 @@ newline, and without the 4-digit year limit. Don't use asctime or ctime, as they might dump core if the year is outside the range -999 .. 9999. */ - BLOCK_INPUT; + block_input (); tm = localtime (&value); if (tm) { @@ -1994,7 +1994,7 @@ tm->tm_hour, tm->tm_min, tm->tm_sec, tm->tm_year + year_base); } - UNBLOCK_INPUT; + unblock_input (); if (! tm) time_overflow (); @@ -2050,11 +2050,11 @@ zone_offset = Qnil; value = make_emacs_time (lisp_seconds_argument (specified_time), 0); zone_name = format_time_string ("%Z", sizeof "%Z" - 1, value, 0, &localtm); - BLOCK_INPUT; + block_input (); t = gmtime (emacs_secs_addr (&value)); if (t) offset = tm_diff (&localtm, t); - UNBLOCK_INPUT; + unblock_input (); if (t) { @@ -2101,7 +2101,7 @@ if (! (NILP (tz) || EQ (tz, Qt))) CHECK_STRING (tz); - BLOCK_INPUT; + block_input (); /* When called for the first time, save the original TZ. */ old_environbuf = environbuf; @@ -2118,7 +2118,7 @@ set_time_zone_rule (tzstring); environbuf = environ; - UNBLOCK_INPUT; + unblock_input (); xfree (old_environbuf); return Qnil; === modified file 'src/emacs.c' --- src/emacs.c 2012-09-22 08:22:49 +0000 +++ src/emacs.c 2012-09-23 08:44:20 +0000 @@ -54,6 +54,7 @@ #include "window.h" #include "systty.h" +#include "atimer.h" #include "blockinput.h" #include "syssignal.h" #include "process.h" @@ -269,9 +270,6 @@ section of the Emacs manual or the file BUGS.\n" -/* Signal code for the fatal signal that was received. */ -static int fatal_error_code; - /* True if handling a fatal error already. */ bool fatal_error_in_progress; @@ -282,28 +280,12 @@ -/* Handle bus errors, invalid instruction, etc. */ -static void -handle_fatal_signal (int sig) -{ - fatal_error_backtrace (sig, 10); -} - -static void -deliver_fatal_signal (int sig) -{ - handle_on_main_thread (sig, handle_fatal_signal); -} - /* Report a fatal error due to signal SIG, output a backtrace of at most BACKTRACE_LIMIT lines, and exit. */ _Noreturn void -fatal_error_backtrace (int sig, int backtrace_limit) +terminate_due_to_signal (int sig, int backtrace_limit) { - fatal_error_code = sig; - signal (sig, SIG_DFL); - - TOTALLY_UNBLOCK_INPUT; + totally_unblock_input (); /* If fatal error occurs in code below, avoid infinite recursion. */ if (! fatal_error_in_progress) @@ -318,19 +300,18 @@ } /* Signal the same code; this time it will really be fatal. - Remember that since we're in a signal handler, the signal we're - going to send is probably blocked, so we have to unblock it if we - want to really receive it. */ + Since we're in a signal handler, the signal is blocked, so we + have to unblock it if we want to really receive it. */ #ifndef MSDOS { sigset_t unblocked; sigemptyset (&unblocked); - sigaddset (&unblocked, fatal_error_code); + sigaddset (&unblocked, sig); pthread_sigmask (SIG_UNBLOCK, &unblocked, 0); } #endif - kill (getpid (), fatal_error_code); + emacs_raise (sig); /* This shouldn't be executed, but it prevents a warning. */ exit (1); @@ -339,15 +320,9 @@ #ifdef SIGDANGER /* Handler for SIGDANGER. */ -static void deliver_danger_signal (int); - static void handle_danger_signal (int sig) { - struct sigaction action; - emacs_sigaction_init (&action, deliver_danger_signal); - sigaction (sig, &action, 0); - malloc_warning ("Operating system warns that virtual memory is running low.\n"); /* It might be unsafe to call do_auto_save now. */ @@ -357,7 +332,7 @@ static void deliver_danger_signal (int sig) { - handle_on_main_thread (sig, handle_danger_signal); + deliver_process_signal (sig, handle_danger_signal); } #endif @@ -680,6 +655,7 @@ #endif char stack_bottom_variable; bool do_initial_setlocale; + bool dumping; int skip_args = 0; #ifdef HAVE_SETRLIMIT struct rlimit rlim; @@ -691,7 +667,6 @@ char dname_arg2[80]; #endif char *ch_to_dir; - struct sigaction fatal_error_action; #if GC_MARK_STACK stack_base = &dummy; @@ -777,12 +752,11 @@ exit (1); } + dumping = !initialized && (strcmp (argv[argc - 1], "dump") == 0 + || strcmp (argv[argc - 1], "bootstrap") == 0); #ifdef HAVE_PERSONALITY_LINUX32 - if (!initialized - && (strcmp (argv[argc-1], "dump") == 0 - || strcmp (argv[argc-1], "bootstrap") == 0) - && ! getenv ("EMACS_HEAP_EXEC")) + if (dumping && ! getenv ("EMACS_HEAP_EXEC")) { static char heapexec[] = "EMACS_HEAP_EXEC=true"; /* Set this so we only do this once. */ @@ -1107,119 +1081,7 @@ #endif } - init_signals (); - emacs_sigaction_init (&fatal_error_action, deliver_fatal_signal); - - /* Don't catch SIGHUP if dumping. */ - if (1 -#ifndef CANNOT_DUMP - && initialized -#endif - ) - { - /* In --batch mode, don't catch SIGHUP if already ignored. - That makes nohup work. */ - bool catch_SIGHUP = !noninteractive; - if (!catch_SIGHUP) - { - struct sigaction old_action; - sigaction (SIGHUP, 0, &old_action); - catch_SIGHUP = old_action.sa_handler != SIG_IGN; - } - if (catch_SIGHUP) - sigaction (SIGHUP, &fatal_error_action, 0); - } - - if ( -#ifndef CANNOT_DUMP - ! noninteractive || initialized -#else - 1 -#endif - ) - { - /* Don't catch these signals in batch mode if dumping. - On some machines, this sets static data that would make - signal fail to work right when the dumped Emacs is run. */ - sigaction (SIGQUIT, &fatal_error_action, 0); - sigaction (SIGILL, &fatal_error_action, 0); - sigaction (SIGTRAP, &fatal_error_action, 0); -#ifdef SIGUSR1 - add_user_signal (SIGUSR1, "sigusr1"); -#endif -#ifdef SIGUSR2 - add_user_signal (SIGUSR2, "sigusr2"); -#endif -#ifdef SIGABRT - sigaction (SIGABRT, &fatal_error_action, 0); -#endif -#ifdef SIGHWE - sigaction (SIGHWE, &fatal_error_action, 0); -#endif -#ifdef SIGPRE - sigaction (SIGPRE, &fatal_error_action, 0); -#endif -#ifdef SIGORE - sigaction (SIGORE, &fatal_error_action, 0); -#endif -#ifdef SIGUME - sigaction (SIGUME, &fatal_error_action, 0); -#endif -#ifdef SIGDLK - sigaction (SIGDLK, &fatal_error_action, 0); -#endif -#ifdef SIGCPULIM - sigaction (SIGCPULIM, &fatal_error_action, 0); -#endif -#ifdef SIGIOT - /* This is missing on some systems - OS/2, for example. */ - sigaction (SIGIOT, &fatal_error_action, 0); -#endif -#ifdef SIGEMT - sigaction (SIGEMT, &fatal_error_action, 0); -#endif - sigaction (SIGFPE, &fatal_error_action, 0); -#ifdef SIGBUS - sigaction (SIGBUS, &fatal_error_action, 0); -#endif - sigaction (SIGSEGV, &fatal_error_action, 0); -#ifdef SIGSYS - sigaction (SIGSYS, &fatal_error_action, 0); -#endif - /* May need special treatment on MS-Windows. See - http://lists.gnu.org/archive/html/emacs-devel/2010-09/msg01062.html - Please update the doc of kill-emacs, kill-emacs-hook, and - NEWS if you change this. - */ - if (noninteractive) - sigaction (SIGINT, &fatal_error_action, 0); - sigaction (SIGTERM, &fatal_error_action, 0); -#ifdef SIGXCPU - sigaction (SIGXCPU, &fatal_error_action, 0); -#endif -#ifdef SIGXFSZ - sigaction (SIGXFSZ, &fatal_error_action, 0); -#endif /* SIGXFSZ */ - -#ifdef SIGDANGER - /* This just means available memory is getting low. */ - { - struct sigaction action; - emacs_sigaction_init (&action, deliver_danger_signal); - sigaction (SIGDANGER, &action, 0); - } -#endif - -#ifdef AIX -/* 20 is SIGCHLD, 21 is SIGTTIN, 22 is SIGTTOU. */ - sigaction (SIGXCPU, &fatal_error_action, 0); - sigaction (SIGIOINT, &fatal_error_action, 0); - sigaction (SIGGRANT, &fatal_error_action, 0); - sigaction (SIGRETRACT, &fatal_error_action, 0); - sigaction (SIGSOUND, &fatal_error_action, 0); - sigaction (SIGMSG, &fatal_error_action, 0); -#endif /* AIX */ - } + init_signals (dumping); noninteractive1 = noninteractive; @@ -1281,7 +1143,6 @@ } init_eval (); - init_data (); init_atimer (); running_asynch_code = 0; init_random (); @@ -1407,8 +1268,7 @@ /* egetenv is a pretty low-level facility, which may get called in many circumstances; it seems flimsy to put off initializing it until calling init_callproc. Do not do it when dumping. */ - if (initialized || ((strcmp (argv[argc-1], "dump") != 0 - && strcmp (argv[argc-1], "bootstrap") != 0))) + if (! dumping) set_initial_environment (); /* AIX crashes are reported in system versions 3.2.3 and 3.2.4 === modified file 'src/eval.c' --- src/eval.c 2012-09-21 03:03:48 +0000 +++ src/eval.c 2012-09-23 08:44:20 +0000 @@ -1076,7 +1076,7 @@ /* Unwind the specbind, catch, and handler stacks back to CATCH, and jump to that CATCH, returning VALUE as the value of that catch. - This is the guts Fthrow and Fsignal; they differ only in the way + This is the guts of Fthrow and Fsignal; they differ only in the way they choose the catch tag to throw to. A catch tag for a condition-case form has a TAG of Qnil. @@ -1085,7 +1085,7 @@ the handler stack as we go, so that the proper handlers are in effect for each unwind-protect clause we run. At the end, restore some static info saved in CATCH, and longjmp to the location - specified in the + specified there. This is used for correct unwinding in Fthrow and Fsignal. */ @@ -1099,7 +1099,7 @@ /* Restore certain special C variables. */ set_poll_suppress_count (catch->poll_suppress_count); - UNBLOCK_INPUT_TO (catch->interrupt_input_blocked); + unblock_input_to (catch->interrupt_input_blocked); immediate_quit = 0; do @@ -1114,16 +1114,6 @@ } while (! last_time); -#if HAVE_X_WINDOWS - /* If x_catch_errors was done, turn it off now. - (First we give unbind_to a chance to do that.) */ -#if 0 /* This would disable x_catch_errors after x_connection_closed. - The catch must remain in effect during that delicate - state. --lorentey */ - x_fully_uncatch_errors (); -#endif -#endif - byte_stack_list = catch->byte_stack; gcprolist = catch->gcpro; #ifdef DEBUG_GCPRO @@ -1713,7 +1703,7 @@ if ( /* Don't try to run the debugger with interrupts blocked. The editing loop would return anyway. */ - ! INPUT_BLOCKED_P + ! input_blocked_p () && NILP (Vinhibit_debugger) /* Does user want to enter debugger for this kind of error? */ && (EQ (sig, Qquit) === modified file 'src/fileio.c' --- src/fileio.c 2012-09-21 03:03:48 +0000 +++ src/fileio.c 2012-09-23 08:44:20 +0000 @@ -1025,9 +1025,9 @@ memcpy (o, nm, p - nm); o [p - nm] = 0; - BLOCK_INPUT; + block_input (); pw = (struct passwd *) getpwnam (o + 1); - UNBLOCK_INPUT; + unblock_input (); if (pw) { newdir = pw->pw_dir; @@ -1413,9 +1413,9 @@ o[len] = 0; /* Look up the user name. */ - BLOCK_INPUT; + block_input (); pw = (struct passwd *) getpwnam (o + 1); - UNBLOCK_INPUT; + unblock_input (); if (!pw) error ("\"%s\" isn't a registered user", o + 1); @@ -1531,9 +1531,9 @@ /* If we have ~user and `user' exists, discard everything up to ~. But if `user' does not exist, leave ~user alone, it might be a literal file name. */ - BLOCK_INPUT; + block_input (); pw = getpwnam (o + 1); - UNBLOCK_INPUT; + unblock_input (); if (pw) return p; } @@ -2999,10 +2999,10 @@ mode_t realmask; Lisp_Object value; - BLOCK_INPUT; + block_input (); realmask = umask (0); umask (realmask); - UNBLOCK_INPUT; + unblock_input (); XSETINT (value, (~ realmask) & 0777); return value; @@ -5235,9 +5235,9 @@ auto_saving = 0; if (stream != NULL) { - BLOCK_INPUT; + block_input (); fclose (stream); - UNBLOCK_INPUT; + unblock_input (); } return Qnil; } @@ -5368,7 +5368,7 @@ if (STRINGP (BVAR (b, auto_save_file_name)) && stream != NULL && do_handled_files == 0) { - BLOCK_INPUT; + block_input (); if (!NILP (BVAR (b, filename))) { fwrite (SDATA (BVAR (b, filename)), 1, @@ -5378,7 +5378,7 @@ fwrite (SDATA (BVAR (b, auto_save_file_name)), 1, SBYTES (BVAR (b, auto_save_file_name)), stream); putc ('\n', stream); - UNBLOCK_INPUT; + unblock_input (); } if (!NILP (current_only) === modified file 'src/floatfns.c' --- src/floatfns.c 2012-09-15 07:06:56 +0000 +++ src/floatfns.c 2012-09-23 08:44:20 +0000 @@ -31,15 +31,6 @@ #include #include "lisp.h" -#include "syssignal.h" - -#include -#if (FLT_RADIX == 2 && FLT_MANT_DIG == 24 \ - && FLT_MIN_EXP == -125 && FLT_MAX_EXP == 128) -#define IEEE_FLOATING_POINT 1 -#else -#define IEEE_FLOATING_POINT 0 -#endif #include === modified file 'src/fns.c' --- src/fns.c 2012-09-15 07:06:56 +0000 +++ src/fns.c 2012-09-23 08:44:20 +0000 @@ -1838,13 +1838,6 @@ halftail = XCDR (halftail); if (EQ (tail, halftail)) break; - -#if 0 /* Unsafe version. */ - /* This function can be called asynchronously - (setup_coding_system). Don't QUIT in that case. */ - if (!interrupt_input_blocked) - QUIT; -#endif } return Qnil; === modified file 'src/fontset.c' --- src/fontset.c 2012-09-15 07:06:56 +0000 +++ src/fontset.c 2012-09-23 08:44:20 +0000 @@ -1275,7 +1275,7 @@ doesn't remove FACE from a cache. Until we find a solution, we suppress this code, and simply use Fclear_face_cache even though that is not efficient. */ - BLOCK_INPUT; + block_input (); for (id = 0; id < ASIZE (Vfontset_table); id++) { Lisp_Object this = AREF (Vfontset_table, id); @@ -1296,7 +1296,7 @@ } } } - UNBLOCK_INPUT; + unblock_input (); #else /* not 0 */ /* But, we don't have to call Fclear_face_cache if no fontset has been realized from BASE. */ === modified file 'src/frame.c' --- src/frame.c 2012-09-19 17:28:13 +0000 +++ src/frame.c 2012-09-23 08:44:20 +0000 @@ -3533,9 +3533,9 @@ f->alpha[i] = newval[i]; #if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI) || defined (NS_IMPL_COCOA) - BLOCK_INPUT; + block_input (); x_set_frame_alpha (f); - UNBLOCK_INPUT; + unblock_input (); #endif return; === modified file 'src/fringe.c' --- src/fringe.c 2012-09-15 07:06:56 +0000 +++ src/fringe.c 2012-09-23 08:44:20 +0000 @@ -872,7 +872,7 @@ void draw_row_fringe_bitmaps (struct window *w, struct glyph_row *row) { - eassert (interrupt_input_blocked); + eassert (input_blocked_p ()); /* If row is completely invisible, because of vscrolling, we don't have to draw anything. */ === modified file 'src/ftxfont.c' --- src/ftxfont.c 2012-09-15 07:06:56 +0000 +++ src/ftxfont.c 2012-09-23 08:44:20 +0000 @@ -98,7 +98,7 @@ new->colors[0].pixel = background; new->colors[1].pixel = foreground; - BLOCK_INPUT; + block_input (); XQueryColors (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), new->colors, 2); for (i = 1; i < 7; i++) { @@ -115,14 +115,14 @@ new->gcs[i - 1] = XCreateGC (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), GCForeground, &xgcv); } - UNBLOCK_INPUT; + unblock_input (); if (i < 7) { - BLOCK_INPUT; + block_input (); for (i--; i >= 0; i--) XFreeGC (FRAME_X_DISPLAY (f), new->gcs[i]); - UNBLOCK_INPUT; + unblock_input (); if (prev) prev->next = new->next; else if (data) @@ -282,7 +282,7 @@ n[0] = n[1] = n[2] = n[3] = n[4] = n[5] = n[6] = 0; - BLOCK_INPUT; + block_input (); if (with_background) ftxfont_draw_background (f, font, s->gc, x, y, s->width); code = alloca (sizeof (unsigned) * len); @@ -332,7 +332,7 @@ } } - UNBLOCK_INPUT; + unblock_input (); return len; } @@ -342,7 +342,7 @@ { struct ftxfont_frame_data *data = font_get_frame_data (f, &ftxfont_driver); - BLOCK_INPUT; + block_input (); while (data) { struct ftxfont_frame_data *next = data->next; @@ -353,7 +353,7 @@ free (data); data = next; } - UNBLOCK_INPUT; + unblock_input (); font_put_frame_data (f, &ftxfont_driver, NULL); return 0; } === modified file 'src/gtkutil.c' --- src/gtkutil.c 2012-09-21 03:03:48 +0000 +++ src/gtkutil.c 2012-09-23 08:44:20 +0000 @@ -590,7 +590,7 @@ if (! FRAME_GTK_WIDGET (f) || ! (get_bg || get_fg)) return success_p; - BLOCK_INPUT; + block_input (); { #ifdef HAVE_GTK3 GtkStyleContext *gsty @@ -620,7 +620,7 @@ #endif } - UNBLOCK_INPUT; + unblock_input (); return success_p; } @@ -725,7 +725,7 @@ if (!x->ttip_lbl) return 0; - BLOCK_INPUT; + block_input (); encoded_string = ENCODE_UTF_8 (string); widget = GTK_WIDGET (x->ttip_lbl); gwin = gtk_widget_get_window (GTK_WIDGET (x->ttip_window)); @@ -753,7 +753,7 @@ if (width) *width = req.width; if (height) *height = req.height; - UNBLOCK_INPUT; + unblock_input (); return 1; #endif /* USE_GTK_TOOLTIP */ @@ -769,10 +769,10 @@ struct x_output *x = f->output_data.x; if (x->ttip_window) { - BLOCK_INPUT; + block_input (); gtk_window_move (x->ttip_window, root_x, root_y); gtk_widget_show_all (GTK_WIDGET (x->ttip_window)); - UNBLOCK_INPUT; + unblock_input (); } #endif } @@ -789,7 +789,7 @@ if (f->output_data.x->ttip_window) { GtkWindow *win = f->output_data.x->ttip_window; - BLOCK_INPUT; + block_input (); gtk_widget_hide (GTK_WIDGET (win)); if (g_object_get_data (G_OBJECT (win), "restore-tt")) @@ -799,7 +799,7 @@ GtkSettings *settings = gtk_settings_get_for_screen (screen); g_object_set (settings, "gtk-enable-tooltips", TRUE, NULL); } - UNBLOCK_INPUT; + unblock_input (); ret = 1; } @@ -1007,7 +1007,7 @@ gpointer gdkwin; GtkWidget *gwdesc = 0; - BLOCK_INPUT; + block_input (); gdkwin = gdk_x11_window_lookup_for_display (gdk_x11_lookup_xdisplay (dpy), wdesc); @@ -1019,7 +1019,7 @@ gwdesc = gtk_get_event_widget (&event); } - UNBLOCK_INPUT; + unblock_input (); return gwdesc; } @@ -1123,7 +1123,7 @@ #endif char *title = 0; - BLOCK_INPUT; + block_input (); if (FRAME_X_EMBEDDED_P (f)) { @@ -1161,7 +1161,7 @@ if (whbox) gtk_widget_destroy (whbox); if (wfixed) gtk_widget_destroy (wfixed); - UNBLOCK_INPUT; + unblock_input (); return 0; } @@ -1275,7 +1275,7 @@ } } - UNBLOCK_INPUT; + unblock_input (); return 1; } @@ -1397,12 +1397,12 @@ &f->output_data.x->size_hints, sizeof (size_hints)) != 0) { - BLOCK_INPUT; + block_input (); gtk_window_set_geometry_hints (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)), NULL, &size_hints, hint_flags); f->output_data.x->size_hints = size_hints; f->output_data.x->hint_flags = hint_flags; - UNBLOCK_INPUT; + unblock_input (); } } @@ -1417,9 +1417,9 @@ { if (FRAME_GTK_WIDGET (f)) { - BLOCK_INPUT; + block_input (); xg_set_widget_bg (f, FRAME_GTK_WIDGET (f), FRAME_BACKGROUND_PIXEL (f)); - UNBLOCK_INPUT; + unblock_input (); } } @@ -1637,14 +1637,14 @@ struct Lisp_Save_Value *p = XSAVE_VALUE (arg); struct xg_dialog_data *dd = (struct xg_dialog_data *) p->pointer; - BLOCK_INPUT; + block_input (); if (dd->w) gtk_widget_destroy (dd->w); if (dd->timerid != 0) g_source_remove (dd->timerid); g_main_loop_quit (dd->loop); g_main_loop_unref (dd->loop); - UNBLOCK_INPUT; + unblock_input (); return Qnil; } @@ -1973,16 +1973,6 @@ int filesel_done = 0; xg_get_file_func func; -#if defined (HAVE_PTHREAD) && defined (__SIGRTMIN) - /* I really don't know why this is needed, but without this the GLIBC add on - library linuxthreads hangs when the Gnome file chooser backend creates - threads. */ - sigset_t blocked; - sigemptyset (&blocked); - sigaddset (&blocked, __SIGRTMIN); - pthread_sigmask (SIG_BLOCK, &blocked, 0); -#endif /* HAVE_PTHREAD */ - #ifdef HAVE_GTK_FILE_SELECTION_NEW if (xg_uses_old_file_dialog ()) @@ -2000,11 +1990,6 @@ gtk_widget_set_name (w, "emacs-filedialog"); filesel_done = xg_dialog_run (f, w); - -#if defined (HAVE_PTHREAD) && defined (__SIGRTMIN) - pthread_sigmask (SIG_UNBLOCK, &blocked, 0); -#endif - if (filesel_done == GTK_RESPONSE_OK) fn = (*func) (w); @@ -2057,13 +2042,6 @@ int done = 0; Lisp_Object font = Qnil; -#if defined (HAVE_PTHREAD) && defined (__SIGRTMIN) - sigset_t blocked; - sigemptyset (&blocked); - sigaddset (&blocked, __SIGRTMIN); - pthread_sigmask (SIG_BLOCK, &blocked, 0); -#endif /* HAVE_PTHREAD */ - w = gtk_font_chooser_dialog_new ("Pick a font", GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f))); @@ -2088,11 +2066,6 @@ gtk_widget_set_name (w, "emacs-fontdialog"); done = xg_dialog_run (f, w); - -#if defined (HAVE_PTHREAD) && defined (__SIGRTMIN) - pthread_sigmask (SIG_UNBLOCK, &blocked, 0); -#endif - if (done == GTK_RESPONSE_OK) { #if USE_NEW_GTK_FONT_CHOOSER @@ -3358,7 +3331,7 @@ if (x->menubar_widget && gtk_widget_get_parent (x->menubar_widget)) return 0; /* Already done this, happens for frames created invisible. */ - BLOCK_INPUT; + block_input (); gtk_box_pack_start (GTK_BOX (x->vbox_widget), x->menubar_widget, FALSE, FALSE, 0); @@ -3378,7 +3351,7 @@ FRAME_MENUBAR_HEIGHT (f) = req.height; xg_height_or_width_changed (f); } - UNBLOCK_INPUT; + unblock_input (); return 1; } @@ -3393,7 +3366,7 @@ if (x->menubar_widget) { - BLOCK_INPUT; + block_input (); gtk_container_remove (GTK_CONTAINER (x->vbox_widget), x->menubar_widget); /* The menubar and its children shall be deleted when removed from @@ -3401,7 +3374,7 @@ x->menubar_widget = 0; FRAME_MENUBAR_HEIGHT (f) = 0; xg_height_or_width_changed (f); - UNBLOCK_INPUT; + unblock_input (); } } @@ -3838,7 +3811,7 @@ if (changed || int_gtk_range_get_value (GTK_RANGE (wscroll)) != value) { - BLOCK_INPUT; + block_input (); /* gtk_range_set_value invokes the callback. Set ignore_gtk_scrollbar to make the callback do nothing */ @@ -3851,7 +3824,7 @@ xg_ignore_gtk_scrollbar = 0; - UNBLOCK_INPUT; + unblock_input (); } } } @@ -4642,7 +4615,7 @@ if (! FRAME_GTK_WIDGET (f)) return; - BLOCK_INPUT; + block_input (); if (RANGED_INTEGERP (1, Vtool_bar_button_margin, INT_MAX)) { @@ -4684,7 +4657,7 @@ && ! NILP (Fequal (tbinfo->style, style)) && ! NILP (Fequal (tbinfo->last_tool_bar, f->tool_bar_items))) { - UNBLOCK_INPUT; + unblock_input (); return; } @@ -4895,7 +4868,7 @@ xg_height_or_width_changed (f); } - UNBLOCK_INPUT; + unblock_input (); } /* Deallocate all resources for the tool bar on frame F. @@ -4910,7 +4883,7 @@ { struct xg_frame_tb_info *tbinfo; int is_packed = x->handlebox_widget != 0; - BLOCK_INPUT; + block_input (); /* We may have created the toolbar_widget in xg_create_tool_bar, but not the x->handlebox_widget which is created in xg_pack_tool_bar. */ if (is_packed) @@ -4942,7 +4915,7 @@ xg_height_or_width_changed (f); - UNBLOCK_INPUT; + unblock_input (); } } @@ -4954,7 +4927,7 @@ if (! x->toolbar_widget || ! x->handlebox_widget) return 1; - BLOCK_INPUT; + block_input (); g_object_ref (x->handlebox_widget); if (x->toolbar_in_hbox) gtk_container_remove (GTK_CONTAINER (x->hbox_widget), @@ -4967,7 +4940,7 @@ if (xg_update_tool_bar_sizes (f)) xg_height_or_width_changed (f); - UNBLOCK_INPUT; + unblock_input (); return 1; } === modified file 'src/image.c' --- src/image.c 2012-09-22 14:10:24 +0000 +++ src/image.c 2012-09-23 08:44:20 +0000 @@ -407,9 +407,9 @@ if (--bm->refcount == 0) { - BLOCK_INPUT; + block_input (); free_bitmap_record (dpyinfo, bm); - UNBLOCK_INPUT; + unblock_input (); } } } @@ -470,19 +470,19 @@ width = x_bitmap_width (f, id); height = x_bitmap_height (f, id); - BLOCK_INPUT; + block_input (); ximg = XGetImage (FRAME_X_DISPLAY (f), pixmap, 0, 0, width, height, ~0, ZPixmap); if (!ximg) { - UNBLOCK_INPUT; + unblock_input (); return -1; } result = x_create_x_image_and_pixmap (f, width, height, 1, &mask_img, &mask); - UNBLOCK_INPUT; + unblock_input (); if (!result) { XDestroyImage (ximg); @@ -514,7 +514,7 @@ } } - eassert (interrupt_input_blocked); + eassert (input_blocked_p ()); gc = XCreateGC (FRAME_X_DISPLAY (f), mask, 0, NULL); XPutImage (FRAME_X_DISPLAY (f), mask, gc, mask_img, 0, 0, 0, 0, width, height); @@ -593,7 +593,7 @@ Lisp_Object target_type = *type->type; int type_valid = 1; - BLOCK_INPUT; + block_input (); for (p = image_types; p; p = p->next) if (EQ (*p->type, target_type)) @@ -625,7 +625,7 @@ } done: - UNBLOCK_INPUT; + unblock_input (); return p; } @@ -1328,9 +1328,9 @@ static void x_clear_image (struct frame *f, struct image *img) { - BLOCK_INPUT; + block_input (); x_clear_image_1 (f, img, 1, 1, 1); - UNBLOCK_INPUT; + unblock_input (); } @@ -1485,7 +1485,7 @@ /* Block input so that we won't be interrupted by a SIGIO while being in an inconsistent state. */ - BLOCK_INPUT; + block_input (); if (!NILP (filter)) { @@ -1551,7 +1551,7 @@ ++windows_or_buffers_changed; } - UNBLOCK_INPUT; + unblock_input (); } } @@ -1716,7 +1716,7 @@ /* If not found, create a new image and cache it. */ if (img == NULL) { - BLOCK_INPUT; + block_input (); img = make_image (spec, hash); cache_image (f, img); img->load_failed_p = img->type->load (f, img) == 0; @@ -1787,7 +1787,7 @@ postprocess_image (f, img); } - UNBLOCK_INPUT; + unblock_input (); } /* We're using IMG, so set its timestamp to `now'. */ @@ -1940,7 +1940,7 @@ Window window = FRAME_X_WINDOW (f); Screen *screen = FRAME_X_SCREEN (f); - eassert (interrupt_input_blocked); + eassert (input_blocked_p ()); if (depth <= 0) depth = DefaultDepthOfScreen (screen); @@ -2078,7 +2078,7 @@ static void x_destroy_x_image (XImagePtr ximg) { - eassert (interrupt_input_blocked); + eassert (input_blocked_p ()); if (ximg) { #ifdef HAVE_X_WINDOWS @@ -2107,7 +2107,7 @@ #ifdef HAVE_X_WINDOWS GC gc; - eassert (interrupt_input_blocked); + eassert (input_blocked_p ()); gc = XCreateGC (FRAME_X_DISPLAY (f), pixmap, 0, NULL); XPutImage (FRAME_X_DISPLAY (f), pixmap, gc, ximg, 0, 0, 0, 0, width, height); XFreeGC (FRAME_X_DISPLAY (f), gc); @@ -4311,12 +4311,12 @@ x_query_color (f, &color); rc = x_alloc_nearest_color (f, cmap, &color); #else - BLOCK_INPUT; + block_input (); cmap = DefaultColormapOfScreen (FRAME_X_SCREEN (f)); color.pixel = pixel; XQueryColor (NULL, cmap, &color); rc = x_alloc_nearest_color (f, cmap, &color); - UNBLOCK_INPUT; + unblock_input (); #endif /* HAVE_X_WINDOWS */ if (rc) @@ -8656,11 +8656,11 @@ if (x_check_image_size (0, img->width, img->height)) { /* Only W32 version did BLOCK_INPUT here. ++kfs */ - BLOCK_INPUT; + block_input (); img->pixmap = XCreatePixmap (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), img->width, img->height, DefaultDepthOfScreen (FRAME_X_SCREEN (f))); - UNBLOCK_INPUT; + unblock_input (); } if (!img->pixmap) @@ -8736,7 +8736,7 @@ { XImagePtr ximg; - BLOCK_INPUT; + block_input (); /* Try to get an XImage for img->pixmep. */ ximg = XGetImage (FRAME_X_DISPLAY (f), img->pixmap, @@ -8779,15 +8779,15 @@ image_error ("Cannot get X image of `%s'; colors will not be freed", img->spec, Qnil); - UNBLOCK_INPUT; + unblock_input (); } #endif /* HAVE_X_WINDOWS */ /* Now that we have the pixmap, compute mask and transform the image if requested. */ - BLOCK_INPUT; + block_input (); postprocess_image (f, img); - UNBLOCK_INPUT; + unblock_input (); } #endif /* HAVE_GHOSTSCRIPT */ === modified file 'src/keyboard.c' --- src/keyboard.c 2012-09-23 08:24:44 +0000 +++ src/keyboard.c 2012-09-23 08:44:20 +0000 @@ -19,6 +19,7 @@ #include +#define BLOCKINPUT_INLINE EXTERN_INLINE #define KEYBOARD_INLINE EXTERN_INLINE #include @@ -72,19 +73,12 @@ /* Variables for blockinput.h: */ -/* Non-zero if interrupt input is blocked right now. */ +/* Positive if interrupt input is blocked right now. */ volatile int interrupt_input_blocked; -/* Nonzero means an input interrupt has arrived - during the current critical section. */ -int interrupt_input_pending; - -/* This var should be (interrupt_input_pending || pending_atimers). - The QUIT macro checks this instead of interrupt_input_pending and - pending_atimers separately, to reduce code size. So, any code that - changes interrupt_input_pending or pending_atimers should update - this too. */ -int pending_signals; +/* Nonzero means an input interrupt or alarm signal has arrived. + The QUIT macro checks this. */ +volatile int pending_signals; #define KBD_BUFFER_SIZE 4096 @@ -225,7 +219,11 @@ last event came from a macro. We use this to determine when to generate switch-frame events. This may be cleared by functions like Fselect_frame, to make sure that a switch-frame event is - generated by the next character. */ + generated by the next character. + + FIXME: This is modified by a signal handler so it should be volatile. + It's exported to Lisp, though, so it can't simply be marked + 'volatile' here. */ Lisp_Object internal_last_event_frame; /* The timestamp of the last input event we received from the X server. @@ -389,7 +387,7 @@ /* If we support a window system, turn on the code to poll periodically to detect C-g. It isn't actually used when doing interrupt input. */ -#if defined (HAVE_WINDOW_SYSTEM) && !defined (USE_ASYNC_EVENTS) +#ifdef HAVE_WINDOW_SYSTEM #define POLL_FOR_INPUT #endif @@ -413,7 +411,6 @@ /* Function for init_keyboard to call with no args (if nonzero). */ static void (*keyboard_init_hook) (void); -static int read_avail_input (void); static void get_input_pending (int *, int); static int readable_events (int); static Lisp_Object read_char_x_menu_prompt (ptrdiff_t, Lisp_Object *, @@ -440,7 +437,7 @@ #ifdef USABLE_SIGIO static void deliver_input_available_signal (int signo); #endif -static void handle_interrupt (void); +static void handle_interrupt (bool); static _Noreturn void quit_throw_to_read_char (int); static void process_special_events (void); static void timer_start_idle (void); @@ -823,7 +820,7 @@ /* If we enter while input is blocked, don't lock up here. This may happen through the debugger during redisplay. */ - if (INPUT_BLOCKED_P) + if (input_blocked_p ()) return Qnil; command_loop_level++; @@ -1216,8 +1213,7 @@ /* Unblock input if we enter with input blocked. This may happen if redisplay traps e.g. during tool-bar update with input blocked. */ - while (INPUT_BLOCKED_P) - UNBLOCK_INPUT; + totally_unblock_input (); Fthrow (Qtop_level, Qnil); } @@ -1460,15 +1456,6 @@ } } -#if 0 - /* Select the frame that the last event came from. Usually, - switch-frame events will take care of this, but if some lisp - code swallows a switch-frame event, we'll fix things up here. - Is this a good idea? */ - if (FRAMEP (internal_last_event_frame) - && !EQ (internal_last_event_frame, selected_frame)) - Fselect_frame (internal_last_event_frame, Qnil); -#endif /* If it has changed current-menubar from previous value, really recompute the menubar from the value. */ if (! NILP (Vlucid_menu_bar_dirty_flag) @@ -2008,9 +1995,9 @@ void poll_for_input_1 (void) { - if (interrupt_input_blocked == 0 + if (! input_blocked_p () && !waiting_for_input) - read_avail_input (); + gobble_input (); } /* Timer callback function for poll_timer. TIMER is equal to @@ -2020,10 +2007,7 @@ poll_for_input (struct atimer *timer) { if (poll_suppress_count == 0) - { - interrupt_input_pending = 1; - pending_signals = 1; - } + pending_signals = 1; } #endif /* POLL_FOR_INPUT */ @@ -3344,7 +3328,7 @@ If you, dear reader, have a better idea, you've got the source. :-) */ if (dribble) { - BLOCK_INPUT; + block_input (); if (INTEGERP (c)) { if (XUINT (c) < 0x100) @@ -3370,7 +3354,7 @@ } fflush (dribble); - UNBLOCK_INPUT; + unblock_input (); } } @@ -3514,10 +3498,8 @@ Else, if EVENT is a quit event, store the quit event in HOLD_QUIT, and return (thus ignoring further events). - This is used in read_avail_input to postpone the processing - of the quit event until all subsequent input events have been - parsed (and discarded). - */ + This is used to postpone the processing of the quit event until all + subsequent input events have been parsed (and discarded). */ void kbd_buffer_store_event_hold (register struct input_event *event, @@ -3587,7 +3569,8 @@ } last_event_timestamp = event->timestamp; - handle_interrupt (); + + handle_interrupt (0); return; } @@ -3643,7 +3626,6 @@ if (immediate_quit && NILP (Vinhibit_quit)) { immediate_quit = 0; - pthread_sigmask (SIG_SETMASK, &empty_mask, 0); QUIT; } } @@ -3793,14 +3775,6 @@ /* Start reading input again, we have processed enough so we can accept new events again. */ unhold_keyboard_input (); -#ifdef USABLE_SIGIO - if (!noninteractive) - { - struct sigaction action; - emacs_sigaction_init (&action, deliver_input_available_signal); - sigaction (SIGIO, &action, 0); - } -#endif start_polling (); } #endif /* subprocesses */ @@ -3869,7 +3843,7 @@ wait_reading_process_output (0, 0, -1, 1, Qnil, NULL, 0); if (!interrupt_input && kbd_fetch_ptr == kbd_store_ptr) - read_avail_input (); + gobble_input (); } if (CONSP (Vunread_command_events)) @@ -6752,41 +6726,6 @@ *addr = (!NILP (Vquit_flag) || readable_events (flags)); } -/* Interface to read_avail_input, blocking SIGIO or SIGALRM if necessary. */ - -void -gobble_input (void) -{ -#ifdef USABLE_SIGIO - if (interrupt_input) - { - sigset_t blocked, procmask; - sigemptyset (&blocked); - sigaddset (&blocked, SIGIO); - pthread_sigmask (SIG_BLOCK, &blocked, &procmask); - read_avail_input (); - pthread_sigmask (SIG_SETMASK, &procmask, 0); - } - else -#ifdef POLL_FOR_INPUT - /* XXX This condition was (read_socket_hook && !interrupt_input), - but read_socket_hook is not global anymore. Let's pretend that - it's always set. */ - if (!interrupt_input && poll_suppress_count == 0) - { - sigset_t blocked, procmask; - sigemptyset (&blocked); - sigaddset (&blocked, SIGALRM); - pthread_sigmask (SIG_BLOCK, &blocked, &procmask); - read_avail_input (); - pthread_sigmask (SIG_SETMASK, &procmask, 0); - } - else -#endif -#endif - read_avail_input (); -} - /* Put a BUFFER_SWITCH_EVENT in the buffer so that read_key_sequence will notice the new current buffer. */ @@ -6814,14 +6753,7 @@ /* Make sure no interrupt happens while storing the event. */ #ifdef USABLE_SIGIO if (interrupt_input) - { - sigset_t blocked, procmask; - sigemptyset (&blocked); - sigaddset (&blocked, SIGIO); - pthread_sigmask (SIG_BLOCK, &blocked, &procmask); - kbd_buffer_store_event (&event); - pthread_sigmask (SIG_SETMASK, &procmask, 0); - } + kbd_buffer_store_event (&event); else #endif { @@ -6834,13 +6766,11 @@ /* Read any terminal input already buffered up by the system into the kbd_buffer, but do not wait. - EXPECTED should be nonzero if the caller knows there is some input. - - Returns the number of keyboard chars read, or -1 meaning + Return the number of keyboard chars read, or -1 meaning this is a bad time to try to read input. */ -static int -read_avail_input (void) +int +gobble_input (void) { int nread = 0; int err = 0; @@ -6860,11 +6790,17 @@ int nr; struct input_event hold_quit; + if (input_blocked_p ()) + { + pending_signals = 1; + break; + } + EVENT_INIT (hold_quit); hold_quit.kind = NO_EVENT; /* No need for FIONREAD or fcntl; just say don't wait. */ - while (0 < (nr = (*t->read_socket_hook) (t, &hold_quit))) + while (0 < (nr = (*t->read_socket_hook) (t, &hold_quit))) nread += nr; if (nr == -1) /* Not OK to read input now. */ @@ -6885,7 +6821,7 @@ this process rather than to the whole process group? Perhaps on systems with FIONREAD Emacs is alone in its group. */ - kill (getpid (), SIGHUP); + terminate_due_to_signal (SIGHUP, 10); /* XXX Is calling delete_terminal safe here? It calls delete_frame. */ { @@ -7174,34 +7110,68 @@ static void handle_async_input (void) { - interrupt_input_pending = 0; - pending_signals = pending_atimers; - +#ifdef USABLE_SIGIO while (1) { - int nread = read_avail_input (); + int nread = gobble_input (); /* -1 means it's not ok to read the input now. UNBLOCK_INPUT will read it later; now, avoid infinite loop. 0 means there was no keyboard input available. */ if (nread <= 0) break; } +#endif } void process_pending_signals (void) { - if (interrupt_input_pending) - handle_async_input (); + pending_signals = 0; + handle_async_input (); do_pending_atimers (); } +/* Undo any number of BLOCK_INPUT calls down to level LEVEL, + and also (if the level is now 0) reinvoke any pending signal. */ + +void +unblock_input_to (int level) +{ + interrupt_input_blocked = level; + if (level == 0) + { + if (pending_signals) + process_pending_signals (); + } + else if (level < 0) + emacs_abort (); +} + +/* End critical section. + + If doing signal-driven input, and a signal came in when input was + blocked, reinvoke the signal handler now to deal with it. */ + +void +unblock_input (void) +{ + unblock_input_to (interrupt_input_blocked - 1); +} + +/* Undo any number of BLOCK_INPUT calls, + and also reinvoke any pending signal. */ + +void +totally_unblock_input (void) +{ + unblock_input_to (0); +} + #ifdef USABLE_SIGIO -static void +void handle_input_available_signal (int sig) { - interrupt_input_pending = 1; pending_signals = 1; if (input_available_clear_time) @@ -7211,25 +7181,10 @@ static void deliver_input_available_signal (int sig) { - handle_on_main_thread (sig, handle_input_available_signal); + deliver_process_signal (sig, handle_input_available_signal); } #endif /* USABLE_SIGIO */ -/* Send ourselves a SIGIO. - - This function exists so that the UNBLOCK_INPUT macro in - blockinput.h can have some way to take care of input we put off - dealing with, without assuming that every file which uses - UNBLOCK_INPUT also has #included the files necessary to get SIGIO. */ -void -reinvoke_input_signal (void) -{ -#ifdef USABLE_SIGIO - handle_async_input (); -#endif -} - - /* User signal events. */ @@ -7300,7 +7255,7 @@ p->npending++; #ifdef USABLE_SIGIO if (interrupt_input) - kill (getpid (), SIGIO); + handle_input_available_signal (sig); else #endif { @@ -7316,7 +7271,7 @@ static void deliver_user_signal (int sig) { - handle_on_main_thread (sig, handle_user_signal); + deliver_process_signal (sig, handle_user_signal); } static char * @@ -7341,8 +7296,6 @@ for (p = user_signals; p; p = p->next) if (p->npending > 0) { - sigset_t blocked, procmask; - if (! buf_initialized) { memset (&buf, 0, sizeof buf); @@ -7351,10 +7304,6 @@ buf_initialized = 1; } - sigemptyset (&blocked); - sigaddset (&blocked, p->sig); - pthread_sigmask (SIG_BLOCK, &blocked, &procmask); - do { buf.code = p->sig; @@ -7362,8 +7311,6 @@ p->npending--; } while (p->npending > 0); - - pthread_sigmask (SIG_SETMASK, &procmask, 0); } } @@ -10568,9 +10515,9 @@ { if (dribble) { - BLOCK_INPUT; + block_input (); fclose (dribble); - UNBLOCK_INPUT; + unblock_input (); dribble = 0; } if (!NILP (file)) @@ -10759,21 +10706,21 @@ from the controlling tty. */ internal_last_event_frame = terminal->display_info.tty->top_frame; - handle_interrupt (); + handle_interrupt (1); } } static void deliver_interrupt_signal (int sig) { - handle_on_main_thread (sig, handle_interrupt_signal); + deliver_process_signal (sig, handle_interrupt_signal); } /* If Emacs is stuck because `inhibit-quit' is true, then keep track of the number of times C-g has been requested. If C-g is pressed enough times, then quit anyway. See bug#6585. */ -static int force_quit_count; +static int volatile force_quit_count; /* This routine is called at interrupt level in response to C-g. @@ -10787,7 +10734,7 @@ non-nil, it stops the job right away. */ static void -handle_interrupt (void) +handle_interrupt (bool in_signal_handler) { char c; @@ -10796,13 +10743,16 @@ /* XXX This code needs to be revised for multi-tty support. */ if (!NILP (Vquit_flag) && get_named_tty ("/dev/tty")) { - /* If SIGINT isn't blocked, don't let us be interrupted by - another SIGINT, it might be harmful due to non-reentrancy - in I/O functions. */ - sigset_t blocked; - sigemptyset (&blocked); - sigaddset (&blocked, SIGINT); - pthread_sigmask (SIG_BLOCK, &blocked, 0); + if (! in_signal_handler) + { + /* If SIGINT isn't blocked, don't let us be interrupted by + a SIGINT. It might be harmful due to non-reentrancy + in I/O functions. */ + sigset_t blocked; + sigemptyset (&blocked); + sigaddset (&blocked, SIGINT); + pthread_sigmask (SIG_BLOCK, &blocked, 0); + } fflush (stdout); reset_all_sys_modes (); @@ -10873,7 +10823,6 @@ #endif /* not MSDOS */ fflush (stdout); init_all_sys_modes (); - pthread_sigmask (SIG_SETMASK, &empty_mask, 0); } else { @@ -10891,15 +10840,14 @@ GCPRO4 (saved.object, saved.global_code, saved.current_syntax_table, saved.old_prop); Fsignal (Qquit, Qnil); - /* FIXME: AFAIK, `quit' can never return, so this code is dead! */ gl_state = saved; UNGCPRO; } else { /* Else request quit when it's safe. */ - if (NILP (Vquit_flag)) - force_quit_count = 0; - if (++force_quit_count == 3) + int count = NILP (Vquit_flag) ? 1 : force_quit_count + 1; + force_quit_count = count; + if (count == 3) { immediate_quit = 1; Vinhibit_quit = Qnil; @@ -10908,6 +10856,8 @@ } } + pthread_sigmask (SIG_SETMASK, &empty_mask, 0); + /* TODO: The longjmp in this call throws the NS event loop integration off, and it seems to do fine without this. Probably some attention needs to be paid to the setting of waiting_for_input in @@ -10917,7 +10867,7 @@ separate event loop thread like W32. */ #ifndef HAVE_NS if (waiting_for_input && !echoing) - quit_throw_to_read_char (1); + quit_throw_to_read_char (in_signal_handler); #endif } @@ -10931,22 +10881,12 @@ if (!from_signal && EQ (Vquit_flag, Qkill_emacs)) Fkill_emacs (Qnil); - pthread_sigmask (SIG_SETMASK, &empty_mask, 0); /* Prevent another signal from doing this before we finish. */ clear_waiting_for_input (); input_pending = 0; Vunread_command_events = Qnil; -#if 0 /* Currently, sit_for is called from read_char without turning - off polling. And that can call set_waiting_for_input. - It seems to be harmless. */ -#ifdef POLL_FOR_INPUT - /* May be > 1 if in recursive minibuffer. */ - if (poll_suppress_count == 0) - emacs_abort (); -#endif -#endif if (FRAMEP (internal_last_event_frame) && !EQ (internal_last_event_frame, selected_frame)) do_switch_frame (make_lispy_switch_frame (internal_last_event_frame), @@ -11337,7 +11277,6 @@ #endif input_pending = 0; interrupt_input_blocked = 0; - interrupt_input_pending = 0; pending_signals = 0; /* This means that command_loop_1 won't try to select anything the first @@ -11358,7 +11297,7 @@ /* Before multi-tty support, these handlers used to be installed only if the current session was a tty session. Now an Emacs session may have multiple display types, so we always handle - SIGINT. There is special code in interrupt_signal to exit + SIGINT. There is special code in handle_interrupt_signal to exit Emacs on SIGINT when there are no termcap frames on the controlling terminal. */ struct sigaction action; === modified file 'src/keyboard.h' --- src/keyboard.h 2012-09-20 01:37:07 +0000 +++ src/keyboard.h 2012-09-23 08:44:20 +0000 @@ -523,7 +523,7 @@ extern void start_polling (void); extern void stop_polling (void); extern void set_poll_suppress_count (int); -extern void gobble_input (void); +extern int gobble_input (void); extern int input_polling_used (void); extern void clear_input_pending (void); extern int requeued_events_pending_p (void); === modified file 'src/keymap.c' --- src/keymap.c 2012-09-15 07:06:56 +0000 +++ src/keymap.c 2012-09-23 08:44:20 +0000 @@ -1477,7 +1477,7 @@ /* Use malloc here. See the comment above this function. Avoid realloc here; it causes spurious traps on GNU/Linux [KFS] */ - BLOCK_INPUT; + block_input (); newmodes = malloc (allocsize); if (newmodes) { @@ -1501,7 +1501,7 @@ } cmm_maps = newmaps; } - UNBLOCK_INPUT; + unblock_input (); if (newmodes == NULL || newmaps == NULL) break; === modified file 'src/lisp.h' --- src/lisp.h 2012-09-16 21:43:55 +0000 +++ src/lisp.h 2012-09-23 08:44:20 +0000 @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -1487,6 +1488,16 @@ #define XFLOAT_DATA(f) (0 ? XFLOAT (f)->u.data : XFLOAT (f)->u.data) #define XFLOAT_INIT(f, n) (XFLOAT (f)->u.data = (n)) +/* Most hosts nowadays use IEEE floating point, so they use IEC 60559 + representations, have infinities and NaNs, and do not trap on + exceptions. Define IEEE_FLOATING_POINT if this host is one of the + typical ones. The C11 macro __STDC_IEC_559__ is close to what is + wanted here, but is not quite right because Emacs does not require + all the features of C11 Annex F (and does not require C11 at all, + for that matter). */ +#define IEEE_FLOATING_POINT (FLT_RADIX == 2 && FLT_MANT_DIG == 24 \ + && FLT_MIN_EXP == -125 && FLT_MAX_EXP == 128) + /* A character, declared with the following typedef, is a member of some character set associated with the current buffer. */ #ifndef _UCHAR_T /* Protect against something in ctab.h on AIX. */ @@ -2108,7 +2119,7 @@ a request to exit Emacs when it is safe to do. */ extern void process_pending_signals (void); -extern int pending_signals; +extern int volatile pending_signals; extern void process_quit_flag (void); #define QUIT \ @@ -2633,7 +2644,6 @@ extern Lisp_Object do_symval_forwarding (union Lisp_Fwd *); extern void set_internal (Lisp_Object, Lisp_Object, Lisp_Object, bool); extern void syms_of_data (void); -extern void init_data (void); extern void swap_in_global_binding (struct Lisp_Symbol *); /* Defined in cmds.c */ @@ -3227,6 +3237,9 @@ extern Lisp_Object menu_bar_items (Lisp_Object); extern Lisp_Object tool_bar_items (Lisp_Object, int *); extern void discard_mouse_events (void); +#ifdef USABLE_SIGIO +void handle_input_available_signal (int); +#endif extern Lisp_Object pending_funcalls; extern int detect_input_pending (void); extern int detect_input_pending_ignore_squeezables (void); @@ -3269,7 +3282,7 @@ extern Lisp_Object decode_env_path (const char *, const char *); extern Lisp_Object empty_unibyte_string, empty_multibyte_string; extern Lisp_Object Qfile_name_handler_alist; -extern _Noreturn void fatal_error_backtrace (int, int); +extern _Noreturn void terminate_due_to_signal (int, int); extern Lisp_Object Qkill_emacs; #if HAVE_SETLOCALE void fixup_locale (void); @@ -3320,6 +3333,7 @@ #endif extern void add_keyboard_wait_descriptor (int); extern void delete_keyboard_wait_descriptor (int); +extern void record_child_status_change (pid_t, int); #ifdef HAVE_GPM extern void add_gpm_wait_descriptor (int); extern void delete_gpm_wait_descriptor (int); === modified file 'src/lread.c' --- src/lread.c 2012-09-15 07:06:56 +0000 +++ src/lread.c 2012-09-23 08:44:20 +0000 @@ -408,9 +408,9 @@ { if (load_each_byte) { - BLOCK_INPUT; + block_input (); ungetc (c, instream); - UNBLOCK_INPUT; + unblock_input (); } else unread_char = c; @@ -431,28 +431,28 @@ { if (c >= 0) { - BLOCK_INPUT; + block_input (); ungetc (c, instream); - UNBLOCK_INPUT; + unblock_input (); return 0; } - BLOCK_INPUT; + block_input (); c = getc (instream); #ifdef EINTR /* Interrupted reads have been observed while reading over the network. */ while (c == EOF && ferror (instream) && errno == EINTR) { - UNBLOCK_INPUT; + unblock_input (); QUIT; - BLOCK_INPUT; + block_input (); clearerr (instream); c = getc (instream); } #endif - UNBLOCK_INPUT; + unblock_input (); return (c == EOF ? -1 : c); } @@ -753,9 +753,9 @@ (void) { register Lisp_Object val; - BLOCK_INPUT; + block_input (); XSETINT (val, getc (instream)); - UNBLOCK_INPUT; + unblock_input (); return val; } @@ -1350,9 +1350,9 @@ FILE *stream = (FILE *) XSAVE_VALUE (arg)->pointer; if (stream != NULL) { - BLOCK_INPUT; + block_input (); fclose (stream); - UNBLOCK_INPUT; + unblock_input (); } return Qnil; } === modified file 'src/menu.c' --- src/menu.c 2012-09-15 07:06:56 +0000 +++ src/menu.c 2012-09-23 08:44:20 +0000 @@ -573,9 +573,9 @@ { widget_value *value; - BLOCK_INPUT; + block_input (); value = malloc_widget_value (); - UNBLOCK_INPUT; + unblock_input (); return value; } @@ -602,9 +602,9 @@ free_menubar_widget_value_tree (wv->next); wv->next = (widget_value *) 0xDEADBEEF; } - BLOCK_INPUT; + block_input (); free_widget_value (wv); - UNBLOCK_INPUT; + unblock_input (); } /* Create a tree of widget_value objects @@ -1313,7 +1313,7 @@ #endif /* Display them in a menu. */ - BLOCK_INPUT; + block_input (); /* FIXME: Use a terminal hook! */ #if defined HAVE_NTGUI @@ -1332,7 +1332,7 @@ last_event_timestamp); #endif - UNBLOCK_INPUT; + unblock_input (); #ifdef HAVE_NS unbind_to (specpdl_count, Qnil); === modified file 'src/msdos.c' --- src/msdos.c 2012-09-04 17:34:54 +0000 +++ src/msdos.c 2012-09-23 08:44:20 +0000 @@ -1229,7 +1229,7 @@ if (display_info->termscript) fprintf (display_info->termscript, "\n\nmouse_face_mouse_frame = NULL; } - UNBLOCK_INPUT; + unblock_input (); } static void @@ -1302,13 +1302,13 @@ if (hlinfo->mouse_face_deferred_gc || (f && f == hlinfo->mouse_face_mouse_frame)) { - BLOCK_INPUT; + block_input (); if (hlinfo->mouse_face_mouse_frame) note_mouse_highlight (hlinfo->mouse_face_mouse_frame, hlinfo->mouse_face_mouse_x, hlinfo->mouse_face_mouse_y); hlinfo->mouse_face_deferred_gc = 0; - UNBLOCK_INPUT; + unblock_input (); } /* Set the cursor type to whatever they wanted. In a minibuffer === modified file 'src/nsfns.m' --- src/nsfns.m 2012-09-19 06:47:01 +0000 +++ src/nsfns.m 2012-09-23 08:44:20 +0000 @@ -615,7 +615,7 @@ if (f->explicit_name || ! NILP (f->title) || ns_in_resize) return; - BLOCK_INPUT; + block_input (); pool = [[NSAutoreleasePool alloc] init]; filename = BVAR (XBUFFER (buf), filename); name = BVAR (XBUFFER (buf), name); @@ -640,7 +640,7 @@ if (title && (! strcmp (title, SSDATA (encoded_name)))) { [pool release]; - UNBLOCK_INPUT; + unblock_input (); return; } @@ -678,7 +678,7 @@ } [pool release]; - UNBLOCK_INPUT; + unblock_input (); } @@ -689,11 +689,11 @@ NSAutoreleasePool *pool; if (!MINI_WINDOW_P (XWINDOW (f->selected_window))) { - BLOCK_INPUT; + block_input (); pool = [[NSAutoreleasePool alloc] init]; [[view window] setDocumentEdited: !NILP (arg)]; [pool release]; - UNBLOCK_INPUT; + unblock_input (); } } @@ -771,14 +771,14 @@ NSTRACE (ns_implicitly_set_icon_type); - BLOCK_INPUT; + block_input (); pool = [[NSAutoreleasePool alloc] init]; if (f->output_data.ns->miniimage && [[NSString stringWithUTF8String: SSDATA (f->name)] isEqualToString: [(NSImage *)f->output_data.ns->miniimage name]]) { [pool release]; - UNBLOCK_INPUT; + unblock_input (); return; } @@ -786,7 +786,7 @@ if (CONSP (tem) && ! NILP (XCDR (tem))) { [pool release]; - UNBLOCK_INPUT; + unblock_input (); return; } @@ -826,7 +826,7 @@ f->output_data.ns->miniimage = image; [view setMiniwindowImage: setMini]; [pool release]; - UNBLOCK_INPUT; + unblock_input (); } @@ -1232,7 +1232,7 @@ f->resx = dpyinfo->resx; f->resy = dpyinfo->resy; - BLOCK_INPUT; + block_input (); register_font_driver (&nsfont_driver, f); x_default_parameter (f, parms, Qfont_backend, Qnil, "fontBackend", "FontBackend", RES_TYPE_STRING); @@ -1247,7 +1247,7 @@ build_string ([[font fontName] UTF8String]), "font", "Font", RES_TYPE_STRING); } - UNBLOCK_INPUT; + unblock_input (); x_default_parameter (f, parms, Qborder_width, make_number (0), "borderwidth", "BorderWidth", RES_TYPE_NUMBER); @@ -1411,10 +1411,10 @@ if (dpyinfo->x_focus_frame != f) { EmacsView *view = FRAME_NS_VIEW (f); - BLOCK_INPUT; + block_input (); [NSApp activateIgnoringOtherApps: YES]; [[view window] makeKeyAndOrderFront: view]; - UNBLOCK_INPUT; + unblock_input (); } return Qnil; @@ -1511,7 +1511,7 @@ [panel setDelegate: fileDelegate]; panelOK = 0; - BLOCK_INPUT; + block_input (); if (NILP (mustmatch)) { ret = [panel runModalForDirectory: dirS file: initS]; @@ -1528,7 +1528,7 @@ fname = build_string ([[panel filename] UTF8String]); [[FRAME_NS_VIEW (SELECTED_FRAME ()) window] makeKeyWindow]; - UNBLOCK_INPUT; + unblock_input (); return ret ? fname : Qnil; } @@ -1899,7 +1899,7 @@ error ("non-Nextstep frame used in `ns-list-colors'"); } - BLOCK_INPUT; + block_input (); colorlists = [[NSColorList availableColorLists] objectEnumerator]; while ((clist = [colorlists nextObject])) @@ -1917,7 +1917,7 @@ } } - UNBLOCK_INPUT; + unblock_input (); return list; } @@ -2115,7 +2115,7 @@ CHECK_STRING (script); check_ns (); - BLOCK_INPUT; + block_input (); as_script = script; as_result = &result; @@ -2141,7 +2141,7 @@ as_status = 0; as_script = Qnil; as_result = 0; - UNBLOCK_INPUT; + unblock_input (); if (status == 0) return result; else if (!STRINGP (result)) @@ -2548,7 +2548,7 @@ else CHECK_NUMBER (dy); - BLOCK_INPUT; + block_input (); if (ns_tooltip == nil) ns_tooltip = [[EmacsTooltip alloc] init]; else @@ -2563,7 +2563,7 @@ &root_x, &root_y); [ns_tooltip showAtX: root_x Y: root_y for: XINT (timeout)]; - UNBLOCK_INPUT; + unblock_input (); UNGCPRO; return unbind_to (count, Qnil); === modified file 'src/nsfont.m' --- src/nsfont.m 2012-09-15 07:06:56 +0000 +++ src/nsfont.m 2012-09-23 08:44:20 +0000 @@ -821,7 +821,7 @@ font_info->glyphs = xzalloc (0x100 * sizeof *font_info->glyphs); font_info->metrics = xzalloc (0x100 * sizeof *font_info->metrics); - BLOCK_INPUT; + block_input (); /* for metrics */ sfont = [nsfont screenFont]; @@ -932,7 +932,7 @@ font->props[FONT_FULLNAME_INDEX] = make_unibyte_string (font_info->name, strlen (font_info->name)); } - UNBLOCK_INPUT; + unblock_input (); return font_object; } @@ -1316,7 +1316,7 @@ fprintf (stderr, "%p\tFinding glyphs for glyphs in block %d\n", font_info, block); - BLOCK_INPUT; + block_input (); #ifdef NS_IMPL_COCOA if (firstTime) @@ -1373,7 +1373,7 @@ #endif } - UNBLOCK_INPUT; + unblock_input (); xfree (unichars); } @@ -1398,7 +1398,7 @@ numGlyphs = 0x10000; #endif - BLOCK_INPUT; + block_input (); sfont = [font_info->nsfont screenFont]; font_info->metrics[block] = xzalloc (0x100 * sizeof (struct font_metrics)); @@ -1427,7 +1427,7 @@ metrics->ascent = r.size.height - metrics->descent; /*-lrint (hshrink* [sfont descender] - expand * hd/2); */ } - UNBLOCK_INPUT; + unblock_input (); } === modified file 'src/nsmenu.m' --- src/nsmenu.m 2012-09-16 21:43:55 +0000 +++ src/nsmenu.m 2012-09-23 08:44:20 +0000 @@ -146,7 +146,7 @@ XSETFRAME (Vmenu_updating_frame, f); /*fprintf (stderr, "ns_update_menubar: frame: %p\tdeep: %d\tsub: %p\n", f, deep_p, submenu); */ - BLOCK_INPUT; + block_input (); pool = [[NSAutoreleasePool alloc] init]; /* Menu may have been created automatically; if so, discard it. */ @@ -271,7 +271,7 @@ discard_menu_items (); unbind_to (specpdl_count, Qnil); [pool release]; - UNBLOCK_INPUT; + unblock_input (); return; } @@ -333,7 +333,7 @@ discard_menu_items (); unbind_to (specpdl_count, Qnil); [pool release]; - UNBLOCK_INPUT; + unblock_input (); return; } } @@ -404,7 +404,7 @@ { free_menubar_widget_value_tree (first_wv); [pool release]; - UNBLOCK_INPUT; + unblock_input (); return; } @@ -435,7 +435,7 @@ { free_menubar_widget_value_tree (first_wv); [pool release]; - UNBLOCK_INPUT; + unblock_input (); return; } } @@ -498,7 +498,7 @@ [NSApp setMainMenu: menu]; [pool release]; - UNBLOCK_INPUT; + unblock_input (); } @@ -1012,10 +1012,10 @@ Under NS we just hide the toolbar until it might be needed again. -------------------------------------------------------------------------- */ { - BLOCK_INPUT; + block_input (); [[FRAME_NS_VIEW (f) toolbar] setVisible: NO]; FRAME_TOOLBAR_HEIGHT (f) = 0; - UNBLOCK_INPUT; + unblock_input (); } void @@ -1029,7 +1029,7 @@ NSWindow *window = [view window]; EmacsToolbar *toolbar = [view toolbar]; - BLOCK_INPUT; + block_input (); [toolbar clearActive]; /* update EmacsToolbar as in GtkUtils, build items list */ @@ -1115,7 +1115,7 @@ FRAME_TOOLBAR_HEIGHT (f) = NSHeight ([window frameRectForContentRect: NSMakeRect (0, 0, 0, 0)]) - FRAME_NS_TITLEBAR_HEIGHT (f); - UNBLOCK_INPUT; + unblock_input (); } @@ -1355,7 +1355,7 @@ struct Lisp_Save_Value *p = XSAVE_VALUE (arg); struct Popdown_data *unwind_data = (struct Popdown_data *) p->pointer; - BLOCK_INPUT; + block_input (); if (popup_activated_flag) { EmacsDialogPanel *panel = unwind_data->dialog; @@ -1366,7 +1366,7 @@ } xfree (unwind_data); - UNBLOCK_INPUT; + unblock_input (); return Qnil; } @@ -1434,7 +1434,7 @@ the dialog. */ contents = Fcons (title, Fcons (Fcons (build_string ("Ok"), Qt), Qnil)); - BLOCK_INPUT; + block_input (); pool = [[NSAutoreleasePool alloc] init]; dialog = [[EmacsDialogPanel alloc] initFromContents: contents isQuestion: isQ]; @@ -1452,7 +1452,7 @@ unbind_to (specpdl_count, Qnil); /* calls pop_down_menu */ } - UNBLOCK_INPUT; + unblock_input (); return tem; } === modified file 'src/nsterm.m' --- src/nsterm.m 2012-09-23 08:28:12 +0000 +++ src/nsterm.m 2012-09-23 08:44:20 +0000 @@ -581,7 +581,7 @@ #endif #ifdef NS_IMPL_COCOA #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 - BLOCK_INPUT; + block_input (); NSTRACE (ns_update_auto_hide_menu_bar); @@ -612,7 +612,7 @@ } } - UNBLOCK_INPUT; + unblock_input (); #endif #endif } @@ -662,7 +662,7 @@ updated_window = w; set_output_cursor (&w->cursor); - BLOCK_INPUT; + block_input (); if (f == hlinfo->mouse_face_mouse_frame) { @@ -677,7 +677,7 @@ /* (further code for mouse faces ifdef'd out in other terms elided) */ } - UNBLOCK_INPUT; + unblock_input (); } @@ -694,7 +694,7 @@ /* note: this fn is nearly identical in all terms */ if (!w->pseudo_window_p) { - BLOCK_INPUT; + block_input (); if (cursor_on_p) display_and_set_cursor (w, 1, @@ -704,7 +704,7 @@ if (draw_window_fringes (w, 1)) x_draw_vertical_border (w); - UNBLOCK_INPUT; + unblock_input (); } /* If a row with mouse-face was overwritten, arrange for @@ -733,7 +733,7 @@ /* if (f == MOUSE_HL_INFO (f)->mouse_face_mouse_frame) */ MOUSE_HL_INFO (f)->mouse_face_defer = 0; - BLOCK_INPUT; + block_input (); #ifdef NS_IMPL_GNUSTEP /* trigger flush only in the rectangle we tracked as being drawn */ @@ -745,7 +745,7 @@ [view unlockFocus]; [[view window] flushWindow]; - UNBLOCK_INPUT; + unblock_input (); ns_updating_frame = NULL; NSTRACE (ns_update_end); } @@ -902,7 +902,7 @@ struct frame *frame = SELECTED_FRAME (); NSView *view; - BLOCK_INPUT; + block_input (); pool = [[NSAutoreleasePool alloc] init]; view = FRAME_NS_VIEW (frame); @@ -929,7 +929,7 @@ ns_unfocus (frame); } [pool release]; - UNBLOCK_INPUT; + unblock_input (); } else { @@ -970,13 +970,13 @@ { NSView *view = FRAME_NS_VIEW (f); check_ns (); - BLOCK_INPUT; + block_input (); FRAME_SAMPLE_VISIBILITY (f); if (FRAME_VISIBLE_P (f)) { [[view window] makeKeyAndOrderFront: NSApp]; } - UNBLOCK_INPUT; + unblock_input (); } @@ -988,9 +988,9 @@ { NSView *view = FRAME_NS_VIEW (f); check_ns (); - BLOCK_INPUT; + block_input (); [[view window] orderBack: NSApp]; - UNBLOCK_INPUT; + unblock_input (); } @@ -1126,7 +1126,7 @@ [(EmacsView *)view setWindowClosing: YES]; /* may not have been informed */ - BLOCK_INPUT; + block_input (); free_frame_menubar (f); @@ -1154,7 +1154,7 @@ xfree (f->output_data.ns); - UNBLOCK_INPUT; + unblock_input (); } void @@ -1183,7 +1183,7 @@ NSTRACE (x_set_offset); - BLOCK_INPUT; + block_input (); f->left_pos = xoff; f->top_pos = yoff; @@ -1215,7 +1215,7 @@ f->size_hint_flags &= ~(XNegative|YNegative); } - UNBLOCK_INPUT; + unblock_input (); } @@ -1240,7 +1240,7 @@ /*fprintf (stderr, "\tsetWindowSize: %d x %d, font size %d x %d\n", cols, rows, FRAME_COLUMN_WIDTH (f), FRAME_LINE_HEIGHT (f)); */ - BLOCK_INPUT; + block_input (); check_frame_size (f, &rows, &cols); @@ -1302,7 +1302,7 @@ mark_window_cursors_off (XWINDOW (f->root_window)); cancel_mouse_face (f); - UNBLOCK_INPUT; + unblock_input (); } @@ -1414,7 +1414,7 @@ NSString *nsname = [NSString stringWithUTF8String: name]; /*fprintf (stderr, "ns_get_color: '%s'\n", name); */ - BLOCK_INPUT; + block_input (); if ([nsname isEqualToString: @"ns_selection_color"]) { @@ -1461,7 +1461,7 @@ if (r >= 0.0) { *col = [NSColor colorWithCalibratedRed: r green: g blue: b alpha: 1.0]; - UNBLOCK_INPUT; + unblock_input (); return 0; } @@ -1493,7 +1493,7 @@ if (new) *col = [new colorUsingColorSpaceName: NSCalibratedRGBColorSpace]; - UNBLOCK_INPUT; + unblock_input (); return new ? 0 : 1; } @@ -1524,12 +1524,12 @@ const char *str; NSTRACE (ns_color_to_lisp); - BLOCK_INPUT; + block_input (); if ([[col colorSpaceName] isEqualToString: NSNamedColorSpace]) if ((str =[[col colorNameComponent] UTF8String])) { - UNBLOCK_INPUT; + unblock_input (); return build_string ((char *)str); } @@ -1541,14 +1541,14 @@ getWhite: &gray alpha: &alpha]; snprintf (buf, sizeof (buf), "#%2.2lx%2.2lx%2.2lx", lrint (gray * 0xff), lrint (gray * 0xff), lrint (gray * 0xff)); - UNBLOCK_INPUT; + unblock_input (); return build_string (buf); } snprintf (buf, sizeof (buf), "#%2.2lx%2.2lx%2.2lx", lrint (red*0xff), lrint (green*0xff), lrint (blue*0xff)); - UNBLOCK_INPUT; + unblock_input (); return build_string (buf); } @@ -1592,16 +1592,16 @@ NSColor *col; NSTRACE (ns_defined_color); - BLOCK_INPUT; + block_input (); if (ns_get_color (name, &col) != 0) /* Color not found */ { - UNBLOCK_INPUT; + unblock_input (); return 0; } if (makeIndex && alloc) color_def->pixel = ns_index_color (col, f); ns_query_color (col, color_def, !makeIndex); - UNBLOCK_INPUT; + unblock_input (); return 1; } @@ -1767,7 +1767,7 @@ dpyinfo = FRAME_NS_DISPLAY_INFO (*fp); - BLOCK_INPUT; + block_input (); if (last_mouse_scroll_bar != nil && insist == 0) { @@ -1812,7 +1812,7 @@ } } - UNBLOCK_INPUT; + unblock_input (); } @@ -1832,7 +1832,7 @@ if ((hlinfo->mouse_face_deferred_gc || f ==hlinfo->mouse_face_mouse_frame) /*&& hlinfo->mouse_face_mouse_frame*/) { - BLOCK_INPUT; + block_input (); ns_update_begin(f); if (hlinfo->mouse_face_mouse_frame) note_mouse_highlight (hlinfo->mouse_face_mouse_frame, @@ -1840,7 +1840,7 @@ hlinfo->mouse_face_mouse_y); hlinfo->mouse_face_deferred_gc = 0; ns_update_end(f); - UNBLOCK_INPUT; + unblock_input (); } } } @@ -1955,7 +1955,7 @@ r = [view bounds]; - BLOCK_INPUT; + block_input (); ns_focus (f, &r, 1); [ns_lookup_indexed_color (NS_FACE_BACKGROUND (FRAME_DEFAULT_FACE (f)), f) set]; NSRectFill (r); @@ -1967,7 +1967,7 @@ /* as of 2006/11 or so this is now needed */ ns_redraw_scroll_bars (f); - UNBLOCK_INPUT; + unblock_input (); } @@ -2068,7 +2068,7 @@ if (height == 0) return; - BLOCK_INPUT; + block_input (); updated_window = w; x_clear_cursor (w); @@ -2083,7 +2083,7 @@ ns_unfocus (f); } - UNBLOCK_INPUT; + unblock_input (); } @@ -2117,12 +2117,12 @@ { int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y)); - BLOCK_INPUT; + block_input (); ns_clear_frame_area (f, 0, y, width, height); ns_clear_frame_area (f, FRAME_PIXEL_WIDTH (f) - width, y, width, height); - UNBLOCK_INPUT; + unblock_input (); } } @@ -2489,12 +2489,12 @@ if (hourglass_shown_p) return; - BLOCK_INPUT; + block_input (); /* TODO: add NSProgressIndicator to selected frame (see macfns.c) */ hourglass_shown_p = 1; - UNBLOCK_INPUT; + unblock_input (); } @@ -2504,12 +2504,12 @@ if (!hourglass_shown_p) return; - BLOCK_INPUT; + block_input (); /* TODO: remove NSProgressIndicator from all frames */ hourglass_shown_p = 0; - UNBLOCK_INPUT; + unblock_input (); } @@ -3352,17 +3352,7 @@ if ([NSApp modalWindow] != nil) return -1; - if (interrupt_input_blocked) - { - interrupt_input_pending = 1; - pending_signals = 1; - return -1; - } - - interrupt_input_pending = 0; - pending_signals = pending_atimers; - - BLOCK_INPUT; + block_input (); n_emacs_events_pending = 0; EVENT_INIT (ev); emacs_event = &ev; @@ -3407,7 +3397,7 @@ nevents = n_emacs_events_pending; n_emacs_events_pending = 0; emacs_event = q_event_ptr = NULL; - UNBLOCK_INPUT; + unblock_input (); return nevents; } @@ -3487,7 +3477,7 @@ } EVENT_INIT (event); - BLOCK_INPUT; + block_input (); emacs_event = &event; if (++apploopnr != 1) { @@ -3501,7 +3491,7 @@ c = 's'; write (selfds[1], &c, 1); } - UNBLOCK_INPUT; + unblock_input (); ev = last_appdefined_event; @@ -3613,7 +3603,7 @@ || WINDOW_RIGHT_MARGIN_COLS (window) == 0)); XSETWINDOW (win, window); - BLOCK_INPUT; + block_input (); /* we want at least 5 lines to display a scrollbar */ if (WINDOW_TOTAL_LINES (window) < 5) @@ -3625,7 +3615,7 @@ wset_vertical_scroll_bar (window, Qnil); } ns_clear_frame_area (f, sb_left, top, width, height); - UNBLOCK_INPUT; + unblock_input (); return; } @@ -3657,7 +3647,7 @@ } [bar setPosition: position portion: portion whole: whole]; - UNBLOCK_INPUT; + unblock_input (); } @@ -3901,11 +3891,11 @@ if (!terminal->name) return; - BLOCK_INPUT; + block_input (); x_destroy_all_bitmaps (dpyinfo); ns_delete_display (dpyinfo); - UNBLOCK_INPUT; + unblock_input (); } @@ -3983,7 +3973,7 @@ /* count object allocs (About, click icon); on OS X use ObjectAlloc tool */ /*GSDebugAllocationActive (YES); */ - BLOCK_INPUT; + block_input (); baud_rate = 38400; Fset_input_interrupt_mode (Qnil); @@ -4052,7 +4042,7 @@ terminal->name = xstrdup (SSDATA (display_name)); - UNBLOCK_INPUT; + unblock_input (); if (!inhibit_x_resources) { @@ -6370,13 +6360,13 @@ - (void)setFrame: (NSRect)newRect { NSTRACE (EmacsScroller_setFrame); -/* BLOCK_INPUT; */ +/* block_input (); */ pixel_height = NSHeight (newRect); if (pixel_height == 0) pixel_height = 1; min_portion = 20 / pixel_height; [super setFrame: newRect]; [self display]; -/* UNBLOCK_INPUT; */ +/* unblock_input (); */ } @@ -6411,14 +6401,14 @@ if (condemned) { EmacsView *view; - BLOCK_INPUT; + block_input (); /* ensure other scrollbar updates after deletion */ view = (EmacsView *)FRAME_NS_VIEW (frame); if (view != nil) view->scrollbarsNeedingUpdate++; [self removeFromSuperview]; [self release]; - UNBLOCK_INPUT; + unblock_input (); } return self; } === modified file 'src/print.c' --- src/print.c 2012-09-15 07:06:56 +0000 +++ src/print.c 2012-09-23 08:44:20 +0000 @@ -753,9 +753,9 @@ { if (initial_stderr_stream != NULL) { - BLOCK_INPUT; + block_input (); fclose (stderr); - UNBLOCK_INPUT; + unblock_input (); } stderr = initial_stderr_stream; initial_stderr_stream = NULL; === modified file 'src/process.c' --- src/process.c 2012-09-17 01:02:11 +0000 +++ src/process.c 2012-09-23 08:44:20 +0000 @@ -255,11 +255,12 @@ static void deactivate_process (Lisp_Object); static void status_notify (struct Lisp_Process *); static int read_process_output (Lisp_Object, int); +static void handle_child_signal (int); static void create_pty (Lisp_Object); /* If we support a window system, turn on the code to poll periodically to detect C-g. It isn't actually used when doing interrupt input. */ -#if defined (HAVE_WINDOW_SYSTEM) && !defined (USE_ASYNC_EVENTS) +#ifdef HAVE_WINDOW_SYSTEM #define POLL_FOR_INPUT #endif @@ -1610,11 +1611,16 @@ int wait_child_setup[2]; #endif #ifdef SIGCHLD - sigset_t blocked, procmask; + sigset_t blocked; #endif /* Use volatile to protect variables from being clobbered by vfork. */ volatile int forkin, forkout; volatile int pty_flag = 0; + volatile Lisp_Object lisp_pty_name = Qnil; + volatile Lisp_Object encoded_current_dir; +#if HAVE_WORKING_VFORK + char **volatile save_environ; +#endif inchannel = outchannel = -1; @@ -1640,6 +1646,7 @@ forkin = forkout = -1; #endif /* not USG, or USG_SUBTTY_WORKS */ pty_flag = 1; + lisp_pty_name = build_string (pty_name); } else #endif /* HAVE_PTYS */ @@ -1704,14 +1711,6 @@ XPROCESS (process)->pty_flag = pty_flag; pset_status (XPROCESS (process), Qrun); -#ifdef SIGCHLD - /* Delay interrupts until we have a chance to store - the new fork's pid in its process structure */ - sigemptyset (&blocked); - sigaddset (&blocked, SIGCHLD); - pthread_sigmask (SIG_BLOCK, &blocked, &procmask); -#endif - FD_SET (inchannel, &input_wait_mask); FD_SET (inchannel, &non_keyboard_wait_mask); if (inchannel > max_process_desc) @@ -1729,89 +1728,99 @@ error. */ setup_process_coding_systems (process); - BLOCK_INPUT; - - { - /* child_setup must clobber environ on systems with true vfork. - Protect it from permanent change. */ - char **save_environ = environ; - volatile Lisp_Object encoded_current_dir = ENCODE_FILE (current_dir); + encoded_current_dir = ENCODE_FILE (current_dir); + + block_input (); + +#ifdef SIGCHLD + /* Block SIGCHLD until we have a chance to store the new fork's + pid in its process structure. */ + sigemptyset (&blocked); + sigaddset (&blocked, SIGCHLD); + pthread_sigmask (SIG_BLOCK, &blocked, 0); +#endif + +#if HAVE_WORKING_VFORK + /* child_setup must clobber environ on systems with true vfork. + Protect it from permanent change. */ + save_environ = environ; +#endif #ifndef WINDOWSNT - pid = vfork (); - if (pid == 0) + pid = vfork (); + if (pid == 0) #endif /* not WINDOWSNT */ - { - int xforkin = forkin; - int xforkout = forkout; + { + int xforkin = forkin; + int xforkout = forkout; - /* Make the pty be the controlling terminal of the process. */ + /* Make the pty be the controlling terminal of the process. */ #ifdef HAVE_PTYS - /* First, disconnect its current controlling terminal. */ + /* First, disconnect its current controlling terminal. */ #ifdef HAVE_SETSID - /* We tried doing setsid only if pty_flag, but it caused - process_set_signal to fail on SGI when using a pipe. */ - setsid (); - /* Make the pty's terminal the controlling terminal. */ - if (pty_flag && xforkin >= 0) - { + /* We tried doing setsid only if pty_flag, but it caused + process_set_signal to fail on SGI when using a pipe. */ + setsid (); + /* Make the pty's terminal the controlling terminal. */ + if (pty_flag && xforkin >= 0) + { #ifdef TIOCSCTTY - /* We ignore the return value - because faith@cs.unc.edu says that is necessary on Linux. */ - ioctl (xforkin, TIOCSCTTY, 0); + /* We ignore the return value + because faith@cs.unc.edu says that is necessary on Linux. */ + ioctl (xforkin, TIOCSCTTY, 0); #endif - } + } #else /* not HAVE_SETSID */ #ifdef USG - /* It's very important to call setpgrp here and no time - afterwards. Otherwise, we lose our controlling tty which - is set when we open the pty. */ - setpgrp (); + /* It's very important to call setpgrp here and no time + afterwards. Otherwise, we lose our controlling tty which + is set when we open the pty. */ + setpgrp (); #endif /* USG */ #endif /* not HAVE_SETSID */ #if defined (LDISC1) - if (pty_flag && xforkin >= 0) - { - struct termios t; - tcgetattr (xforkin, &t); - t.c_lflag = LDISC1; - if (tcsetattr (xforkin, TCSANOW, &t) < 0) - emacs_write (1, "create_process/tcsetattr LDISC1 failed\n", 39); - } + if (pty_flag && xforkin >= 0) + { + struct termios t; + tcgetattr (xforkin, &t); + t.c_lflag = LDISC1; + if (tcsetattr (xforkin, TCSANOW, &t) < 0) + emacs_write (1, "create_process/tcsetattr LDISC1 failed\n", 39); + } #else #if defined (NTTYDISC) && defined (TIOCSETD) - if (pty_flag && xforkin >= 0) - { - /* Use new line discipline. */ - int ldisc = NTTYDISC; - ioctl (xforkin, TIOCSETD, &ldisc); - } + if (pty_flag && xforkin >= 0) + { + /* Use new line discipline. */ + int ldisc = NTTYDISC; + ioctl (xforkin, TIOCSETD, &ldisc); + } #endif #endif #ifdef TIOCNOTTY - /* In 4.3BSD, the TIOCSPGRP bug has been fixed, and now you - can do TIOCSPGRP only to the process's controlling tty. */ - if (pty_flag) - { - /* I wonder: would just ioctl (0, TIOCNOTTY, 0) work here? - I can't test it since I don't have 4.3. */ - int j = emacs_open ("/dev/tty", O_RDWR, 0); - if (j >= 0) - { - ioctl (j, TIOCNOTTY, 0); - emacs_close (j); - } + /* In 4.3BSD, the TIOCSPGRP bug has been fixed, and now you + can do TIOCSPGRP only to the process's controlling tty. */ + if (pty_flag) + { + /* I wonder: would just ioctl (0, TIOCNOTTY, 0) work here? + I can't test it since I don't have 4.3. */ + int j = emacs_open ("/dev/tty", O_RDWR, 0); + if (j >= 0) + { + ioctl (j, TIOCNOTTY, 0); + emacs_close (j); + } #ifndef USG - /* In order to get a controlling terminal on some versions - of BSD, it is necessary to put the process in pgrp 0 - before it opens the terminal. */ + /* In order to get a controlling terminal on some versions + of BSD, it is necessary to put the process in pgrp 0 + before it opens the terminal. */ #ifdef HAVE_SETPGID - setpgid (0, 0); + setpgid (0, 0); #else - setpgrp (0, 0); -#endif -#endif - } + setpgrp (0, 0); +#endif +#endif + } #endif /* TIOCNOTTY */ #if !defined (DONT_REOPEN_PTY) @@ -1823,70 +1832,79 @@ both HAVE_SETSID and TIOCSCTTY are defined. */ /* Now close the pty (if we had it open) and reopen it. This makes the pty the controlling terminal of the subprocess. */ - if (pty_flag) - { - - /* I wonder if emacs_close (emacs_open (pty_name, ...)) - would work? */ - if (xforkin >= 0) - emacs_close (xforkin); - xforkout = xforkin = emacs_open (pty_name, O_RDWR, 0); - - if (xforkin < 0) - { - emacs_write (1, "Couldn't open the pty terminal ", 31); - emacs_write (1, pty_name, strlen (pty_name)); - emacs_write (1, "\n", 1); - _exit (1); - } - - } + if (pty_flag) + { + + /* I wonder if emacs_close (emacs_open (pty_name, ...)) + would work? */ + if (xforkin >= 0) + emacs_close (xforkin); + xforkout = xforkin = emacs_open (pty_name, O_RDWR, 0); + + if (xforkin < 0) + { + emacs_write (1, "Couldn't open the pty terminal ", 31); + emacs_write (1, pty_name, strlen (pty_name)); + emacs_write (1, "\n", 1); + _exit (1); + } + + } #endif /* not DONT_REOPEN_PTY */ #ifdef SETUP_SLAVE_PTY - if (pty_flag) - { - SETUP_SLAVE_PTY; - } + if (pty_flag) + { + SETUP_SLAVE_PTY; + } #endif /* SETUP_SLAVE_PTY */ #ifdef AIX - /* On AIX, we've disabled SIGHUP above once we start a child on a pty. - Now reenable it in the child, so it will die when we want it to. */ - if (pty_flag) - signal (SIGHUP, SIG_DFL); + /* On AIX, we've disabled SIGHUP above once we start a child on a pty. + Now reenable it in the child, so it will die when we want it to. */ + if (pty_flag) + signal (SIGHUP, SIG_DFL); #endif #endif /* HAVE_PTYS */ - signal (SIGINT, SIG_DFL); - signal (SIGQUIT, SIG_DFL); - /* GConf causes us to ignore SIGPIPE, make sure it is restored - in the child. */ - signal (SIGPIPE, SIG_DFL); + signal (SIGINT, SIG_DFL); + signal (SIGQUIT, SIG_DFL); + + /* Emacs ignores SIGPIPE, but the child should not. */ + signal (SIGPIPE, SIG_DFL); #ifdef SIGCHLD /* Stop blocking signals in the child. */ - pthread_sigmask (SIG_SETMASK, &procmask, 0); + pthread_sigmask (SIG_SETMASK, &empty_mask, 0); #endif - if (pty_flag) - child_setup_tty (xforkout); + if (pty_flag) + child_setup_tty (xforkout); #ifdef WINDOWSNT - pid = child_setup (xforkin, xforkout, xforkout, - new_argv, 1, encoded_current_dir); + pid = child_setup (xforkin, xforkout, xforkout, + new_argv, 1, encoded_current_dir); #else /* not WINDOWSNT */ #ifdef FD_CLOEXEC - emacs_close (wait_child_setup[0]); + emacs_close (wait_child_setup[0]); #endif - child_setup (xforkin, xforkout, xforkout, - new_argv, 1, encoded_current_dir); + child_setup (xforkin, xforkout, xforkout, + new_argv, 1, encoded_current_dir); #endif /* not WINDOWSNT */ - } - environ = save_environ; - } - - UNBLOCK_INPUT; - - /* This runs in the Emacs process. */ + } + + /* Back in the parent process. */ + +#if HAVE_WORKING_VFORK + environ = save_environ; +#endif + + XPROCESS (process)->pid = pid; + + /* Stop blocking signals in the parent. */ +#ifdef SIGCHLD + pthread_sigmask (SIG_SETMASK, &empty_mask, 0); +#endif + unblock_input (); + if (pid < 0) { if (forkin >= 0) @@ -1897,7 +1915,6 @@ else { /* vfork succeeded. */ - XPROCESS (process)->pid = pid; #ifdef WINDOWSNT register_child (pid, inchannel); @@ -1923,12 +1940,7 @@ if (forkin != forkout && forkout >= 0) emacs_close (forkout); -#ifdef HAVE_PTYS - if (pty_flag) - pset_tty_name (XPROCESS (process), build_string (pty_name)); - else -#endif - pset_tty_name (XPROCESS (process), Qnil); + pset_tty_name (XPROCESS (process), lisp_pty_name); #if !defined (WINDOWSNT) && defined (FD_CLOEXEC) /* Wait for child_setup to complete in case that vfork is @@ -1945,11 +1957,6 @@ #endif } -#ifdef SIGCHLD - /* Stop blocking signals in the parent. */ - pthread_sigmask (SIG_SETMASK, &procmask, 0); -#endif - /* Now generate the error if vfork failed. */ if (pid < 0) report_file_error ("Doing vfork", Qnil); @@ -3402,9 +3409,9 @@ #ifdef HAVE_GETADDRINFO if (res != &ai) { - BLOCK_INPUT; + block_input (); freeaddrinfo (res); - UNBLOCK_INPUT; + unblock_input (); } #endif @@ -4372,7 +4379,7 @@ Otherwise, do pending quit if requested. */ if (read_kbd >= 0) QUIT; - else + else if (pending_signals) process_pending_signals (); /* Exit now if the cell we're waiting for became non-nil. */ @@ -4739,21 +4746,6 @@ check_write = 0; } -#if 0 /* When polling is used, interrupt_input is 0, - so get_input_pending should read the input. - So this should not be needed. */ - /* If we are using polling for input, - and we see input available, make it get read now. - Otherwise it might not actually get read for a second. - And on hpux, since we turn off polling in wait_reading_process_output, - it might never get read at all if we don't spend much time - outside of wait_reading_process_output. */ - if (read_kbd && interrupt_input - && keyboard_bit_set (&Available) - && input_polling_used ()) - kill (getpid (), SIGALRM); -#endif - /* Check for keyboard input */ /* If there is any, return immediately to give it higher priority than subprocesses */ @@ -4817,7 +4809,7 @@ if (read_kbd && interrupt_input && keyboard_bit_set (&Available) && ! noninteractive) - kill (getpid (), SIGIO); + handle_input_available_signal (SIGIO); #endif if (! wait_proc) @@ -4937,7 +4929,7 @@ pset_status (p, Qfailed); } else - kill (getpid (), SIGCHLD); + handle_child_signal (SIGCHLD); } #endif /* HAVE_PTYS */ /* If we can detect process termination, don't consider the @@ -5393,25 +5385,6 @@ /* Sending data to subprocess */ -static sys_jmp_buf send_process_frame; -static Lisp_Object process_sent_to; - -static _Noreturn void -handle_pipe_signal (int sig) -{ - sigset_t unblocked; - sigemptyset (&unblocked); - sigaddset (&unblocked, SIGPIPE); - pthread_sigmask (SIG_UNBLOCK, &unblocked, 0); - sys_longjmp (send_process_frame, 1); -} - -static void -deliver_pipe_signal (int sig) -{ - handle_on_main_thread (sig, handle_pipe_signal); -} - /* In send_process, when a write fails temporarily, wait_reading_process_output is called. It may execute user code, e.g. timers, that attempts to write new data to the same process. @@ -5495,14 +5468,12 @@ This function can evaluate Lisp code and can garbage collect. */ static void -send_process (volatile Lisp_Object proc, const char *volatile buf, - volatile ptrdiff_t len, volatile Lisp_Object object) +send_process (Lisp_Object proc, const char *buf, ptrdiff_t len, + Lisp_Object object) { - /* Use volatile to protect variables from being clobbered by longjmp. */ struct Lisp_Process *p = XPROCESS (proc); ssize_t rv; struct coding_system *coding; - struct sigaction old_sigpipe_action; if (p->raw_status_new) update_status (p); @@ -5609,145 +5580,126 @@ pty_max_bytes--; } - /* 2000-09-21: Emacs 20.7, sparc-sun-solaris-2.6, GCC 2.95.2, - CFLAGS="-g -O": The value of the parameter `proc' is clobbered - when returning with longjmp despite being declared volatile. */ - if (!sys_setjmp (send_process_frame)) + /* If there is already data in the write_queue, put the new data + in the back of queue. Otherwise, ignore it. */ + if (!NILP (p->write_queue)) + write_queue_push (p, object, buf, len, 0); + + do /* while !NILP (p->write_queue) */ { - p = XPROCESS (proc); /* Repair any setjmp clobbering. */ - process_sent_to = proc; - - /* If there is already data in the write_queue, put the new data - in the back of queue. Otherwise, ignore it. */ - if (!NILP (p->write_queue)) - write_queue_push (p, object, buf, len, 0); - - do /* while !NILP (p->write_queue) */ - { - ptrdiff_t cur_len = -1; - const char *cur_buf; - Lisp_Object cur_object; - - /* If write_queue is empty, ignore it. */ - if (!write_queue_pop (p, &cur_object, &cur_buf, &cur_len)) - { - cur_len = len; - cur_buf = buf; - cur_object = object; - } - - while (cur_len > 0) - { - /* Send this batch, using one or more write calls. */ - ptrdiff_t written = 0; - int outfd = p->outfd; - struct sigaction action; - emacs_sigaction_init (&action, deliver_pipe_signal); - sigaction (SIGPIPE, &action, &old_sigpipe_action); + ptrdiff_t cur_len = -1; + const char *cur_buf; + Lisp_Object cur_object; + + /* If write_queue is empty, ignore it. */ + if (!write_queue_pop (p, &cur_object, &cur_buf, &cur_len)) + { + cur_len = len; + cur_buf = buf; + cur_object = object; + } + + while (cur_len > 0) + { + /* Send this batch, using one or more write calls. */ + ptrdiff_t written = 0; + int outfd = p->outfd; #ifdef DATAGRAM_SOCKETS - if (DATAGRAM_CHAN_P (outfd)) - { - rv = sendto (outfd, cur_buf, cur_len, - 0, datagram_address[outfd].sa, - datagram_address[outfd].len); - if (0 <= rv) - written = rv; - else if (errno == EMSGSIZE) - { - sigaction (SIGPIPE, &old_sigpipe_action, 0); - report_file_error ("sending datagram", - Fcons (proc, Qnil)); - } - } + if (DATAGRAM_CHAN_P (outfd)) + { + rv = sendto (outfd, cur_buf, cur_len, + 0, datagram_address[outfd].sa, + datagram_address[outfd].len); + if (0 <= rv) + written = rv; + else if (errno == EMSGSIZE) + report_file_error ("sending datagram", Fcons (proc, Qnil)); + } + else +#endif + { +#ifdef HAVE_GNUTLS + if (p->gnutls_p) + written = emacs_gnutls_write (p, cur_buf, cur_len); else #endif - { -#ifdef HAVE_GNUTLS - if (p->gnutls_p) - written = emacs_gnutls_write (p, cur_buf, cur_len); - else -#endif - written = emacs_write (outfd, cur_buf, cur_len); - rv = (written ? 0 : -1); + written = emacs_write (outfd, cur_buf, cur_len); + rv = (written ? 0 : -1); #ifdef ADAPTIVE_READ_BUFFERING - if (p->read_output_delay > 0 - && p->adaptive_read_buffering == 1) - { - p->read_output_delay = 0; - process_output_delay_count--; - p->read_output_skip = 0; - } + if (p->read_output_delay > 0 + && p->adaptive_read_buffering == 1) + { + p->read_output_delay = 0; + process_output_delay_count--; + p->read_output_skip = 0; + } #endif - } - sigaction (SIGPIPE, &old_sigpipe_action, 0); + } - if (rv < 0) - { - if (0 + if (rv < 0) + { + if (0 #ifdef EWOULDBLOCK - || errno == EWOULDBLOCK + || errno == EWOULDBLOCK #endif #ifdef EAGAIN - || errno == EAGAIN + || errno == EAGAIN #endif - ) - /* Buffer is full. Wait, accepting input; - that may allow the program - to finish doing output and read more. */ - { + ) + /* Buffer is full. Wait, accepting input; + that may allow the program + to finish doing output and read more. */ + { #ifdef BROKEN_PTY_READ_AFTER_EAGAIN - /* A gross hack to work around a bug in FreeBSD. - In the following sequence, read(2) returns - bogus data: - - write(2) 1022 bytes - write(2) 954 bytes, get EAGAIN - read(2) 1024 bytes in process_read_output - read(2) 11 bytes in process_read_output - - That is, read(2) returns more bytes than have - ever been written successfully. The 1033 bytes - read are the 1022 bytes written successfully - after processing (for example with CRs added if - the terminal is set up that way which it is - here). The same bytes will be seen again in a - later read(2), without the CRs. */ - - if (errno == EAGAIN) - { - int flags = FWRITE; - ioctl (p->outfd, TIOCFLUSH, &flags); - } + /* A gross hack to work around a bug in FreeBSD. + In the following sequence, read(2) returns + bogus data: + + write(2) 1022 bytes + write(2) 954 bytes, get EAGAIN + read(2) 1024 bytes in process_read_output + read(2) 11 bytes in process_read_output + + That is, read(2) returns more bytes than have + ever been written successfully. The 1033 bytes + read are the 1022 bytes written successfully + after processing (for example with CRs added if + the terminal is set up that way which it is + here). The same bytes will be seen again in a + later read(2), without the CRs. */ + + if (errno == EAGAIN) + { + int flags = FWRITE; + ioctl (p->outfd, TIOCFLUSH, &flags); + } #endif /* BROKEN_PTY_READ_AFTER_EAGAIN */ - /* Put what we should have written in wait_queue. */ - write_queue_push (p, cur_object, cur_buf, cur_len, 1); - wait_reading_process_output (0, 20 * 1000 * 1000, - 0, 0, Qnil, NULL, 0); - /* Reread queue, to see what is left. */ - break; - } - else - /* This is a real error. */ - report_file_error ("writing to process", Fcons (proc, Qnil)); - } - cur_buf += written; - cur_len -= written; + /* Put what we should have written in wait_queue. */ + write_queue_push (p, cur_object, cur_buf, cur_len, 1); + wait_reading_process_output (0, 20 * 1000 * 1000, + 0, 0, Qnil, NULL, 0); + /* Reread queue, to see what is left. */ + break; + } + else if (errno == EPIPE) + { + p->raw_status_new = 0; + pset_status (p, list2 (Qexit, make_number (256))); + p->tick = ++process_tick; + deactivate_process (proc); + error ("process %s no longer connected to pipe; closed it", + SDATA (p->name)); + } + else + /* This is a real error. */ + report_file_error ("writing to process", Fcons (proc, Qnil)); } + cur_buf += written; + cur_len -= written; } - while (!NILP (p->write_queue)); - } - else - { - sigaction (SIGPIPE, &old_sigpipe_action, 0); - proc = process_sent_to; - p = XPROCESS (proc); - p->raw_status_new = 0; - pset_status (p, Fcons (Qexit, Fcons (make_number (256), Qnil))); - p->tick = ++process_tick; - deactivate_process (proc); - error ("SIGPIPE raised on process %s; closed it", SDATA (p->name)); - } + } + while (!NILP (p->write_queue)); } DEFUN ("process-send-region", Fprocess_send_region, Sprocess_send_region, @@ -6178,39 +6130,27 @@ #ifdef SIGUSR2 parse_signal ("usr2", SIGUSR2); #endif -#ifdef SIGTERM parse_signal ("term", SIGTERM); -#endif #ifdef SIGHUP parse_signal ("hup", SIGHUP); #endif -#ifdef SIGINT parse_signal ("int", SIGINT); -#endif #ifdef SIGQUIT parse_signal ("quit", SIGQUIT); #endif -#ifdef SIGILL parse_signal ("ill", SIGILL); -#endif -#ifdef SIGABRT parse_signal ("abrt", SIGABRT); -#endif #ifdef SIGEMT parse_signal ("emt", SIGEMT); #endif #ifdef SIGKILL parse_signal ("kill", SIGKILL); #endif -#ifdef SIGFPE parse_signal ("fpe", SIGFPE); -#endif #ifdef SIGBUS parse_signal ("bus", SIGBUS); #endif -#ifdef SIGSEGV parse_signal ("segv", SIGSEGV); -#endif #ifdef SIGSYS parse_signal ("sys", SIGSYS); #endif @@ -6375,27 +6315,15 @@ ** Malloc WARNING: This should never call malloc either directly or indirectly; if it does, that is a bug */ +/* Record the changed status of the child process PID with wait status W. */ +void +record_child_status_change (pid_t pid, int w) +{ #ifdef SIGCHLD - -/* Record one child's changed status. Return true if a child was found. */ -static bool -record_child_status_change (void) -{ Lisp_Object proc; struct Lisp_Process *p; - pid_t pid; - int w; Lisp_Object tail; - do - pid = waitpid (-1, &w, WNOHANG | WUNTRACED); - while (pid < 0 && errno == EINTR); - - /* PID == 0 means no processes found, PID == -1 means a real failure. - Either way, we have done all our job. */ - if (pid <= 0) - return false; - /* Find the process that signaled us, and record its status. */ /* The process can have been deleted by Fdelete_process. */ @@ -6406,7 +6334,7 @@ || (FLOATP (xpid) && pid == XFLOAT_DATA (xpid))) { XSETCAR (tail, Qnil); - return true; + return; } } @@ -6476,10 +6404,11 @@ if (input_available_clear_time) *input_available_clear_time = make_emacs_time (0, 0); } - - return true; +#endif } +#ifdef SIGCHLD + /* On some systems, the SIGCHLD handler must return right away. If any more processes want to signal us, we will get another signal. Otherwise, loop around to use up all the processes that have @@ -6495,14 +6424,29 @@ static void handle_child_signal (int sig) { - while (record_child_status_change () && CAN_HANDLE_MULTIPLE_CHILDREN) - continue; + do + { + pid_t pid; + int status; + + do + pid = waitpid (-1, &status, WNOHANG | WUNTRACED); + while (pid < 0 && errno == EINTR); + + /* PID == 0 means no processes found, PID == -1 means a real failure. + Either way, we have done all our job. */ + if (pid <= 0) + break; + + record_child_status_change (pid, status); + } + while (CAN_HANDLE_MULTIPLE_CHILDREN); } static void deliver_child_signal (int sig) { - handle_on_main_thread (sig, handle_child_signal); + deliver_process_signal (sig, handle_child_signal); } #endif /* SIGCHLD */ === modified file 'src/ralloc.c' --- src/ralloc.c 2012-09-17 08:22:32 +0000 +++ src/ralloc.c 2012-09-23 08:44:20 +0000 @@ -1199,9 +1199,9 @@ #endif #ifdef DOUG_LEA_MALLOC - BLOCK_INPUT; + block_input (); mallopt (M_TOP_PAD, 64 * 4096); - UNBLOCK_INPUT; + unblock_input (); #else #ifndef SYSTEM_MALLOC /* Give GNU malloc's morecore some hysteresis so that we move all === modified file 'src/search.c' --- src/search.c 2012-09-22 15:24:26 +0000 +++ src/search.c 2012-09-23 08:44:20 +0000 @@ -156,7 +156,7 @@ re_set_whitespace_regexp (NULL); re_set_syntax (old); - /* UNBLOCK_INPUT; */ + /* unblock_input (); */ if (val) xsignal1 (Qinvalid_regexp, build_string (val)); === modified file 'src/sysdep.c' --- src/sysdep.c 2012-09-16 21:43:55 +0000 +++ src/sysdep.c 2012-09-23 08:44:20 +0000 @@ -279,10 +279,6 @@ -/* Set nonzero to make following function work under dbx - (at least for bsd). */ -int wait_debugging EXTERNALLY_VISIBLE; - #ifndef MSDOS static void @@ -290,48 +286,24 @@ { while (1) { -#if (defined (BSD_SYSTEM) || defined (HPUX)) && !defined (__GNU__) - /* Note that kill returns -1 even if the process is just a zombie now. - But inevitably a SIGCHLD interrupt should be generated - and child_sig will do waitpid and make the process go away. */ - /* There is some indication that there is a bug involved with - termination of subprocesses, perhaps involving a kernel bug too, - but no idea what it is. Just as a hunch we signal SIGCHLD to see - if that causes the problem to go away or get worse. */ - sigset_t sigchild_mask; - sigemptyset (&sigchild_mask); - sigaddset (&sigchild_mask, SIGCHLD); - pthread_sigmask (SIG_SETMASK, &sigchild_mask, 0); - - if (0 > kill (pid, 0)) - { - pthread_sigmask (SIG_SETMASK, &empty_mask, 0); - kill (getpid (), SIGCHLD); - break; - } - if (wait_debugging) - sleep (1); - else - sigsuspend (&empty_mask); -#else /* not BSD_SYSTEM, and not HPUX version >= 6 */ #ifdef WINDOWSNT wait (0); break; #else /* not WINDOWSNT */ - sigset_t blocked; - sigemptyset (&blocked); - sigaddset (&blocked, SIGCHLD); - pthread_sigmask (SIG_BLOCK, &blocked, 0); - errno = 0; - if (kill (pid, 0) == -1 && errno == ESRCH) - { - pthread_sigmask (SIG_UNBLOCK, &blocked, 0); + int status; + int wait_result = waitpid (pid, &status, 0); + if (wait_result < 0) + { + if (errno != EINTR) + break; + } + else + { + record_child_status_change (wait_result, status); break; } - sigsuspend (&empty_mask); #endif /* not WINDOWSNT */ -#endif /* not BSD_SYSTEM, and not HPUX version >= 6 */ if (interruptible) QUIT; } @@ -1438,40 +1410,77 @@ sigset_t empty_mask; +static struct sigaction process_fatal_action; + +static int +emacs_sigaction_flags (void) +{ +#ifdef SA_RESTART + /* SA_RESTART causes interruptible functions with timeouts (e.g., + 'select') to reset their timeout on some platforms (e.g., + HP-UX 11), which is not what we want. Also, when Emacs is + interactive, we don't want SA_RESTART because we need to poll + for pending input so we need long-running syscalls to be interrupted + after a signal that sets pending_signals. + + Non-interactive keyboard input goes through stdio, where we + always want restartable system calls. */ + if (noninteractive) + return SA_RESTART; +#endif + return 0; +} + /* Store into *ACTION a signal action suitable for Emacs, with handler HANDLER. */ void emacs_sigaction_init (struct sigaction *action, signal_handler_t handler) { sigemptyset (&action->sa_mask); + + /* When handling a signal, block nonfatal system signals that are caught + by Emacs. This makes race conditions less likely. */ + sigaddset (&action->sa_mask, SIGALRM); +#ifdef SIGCHLD + sigaddset (&action->sa_mask, SIGCHLD); +#endif +#ifdef SIGDANGER + sigaddset (&action->sa_mask, SIGDANGER); +#endif +#ifdef SIGWINCH + sigaddset (&action->sa_mask, SIGWINCH); +#endif + if (! noninteractive) + { + sigaddset (&action->sa_mask, SIGINT); + sigaddset (&action->sa_mask, SIGQUIT); +#ifdef USABLE_SIGIO + sigaddset (&action->sa_mask, SIGIO); +#endif + } + + if (! IEEE_FLOATING_POINT) + sigaddset (&action->sa_mask, SIGFPE); + action->sa_handler = handler; - action->sa_flags = 0; -#if defined (SA_RESTART) - /* SA_RESTART causes interruptible functions with timeouts (e.g., - 'select') to reset their timeout on some platforms (e.g., - HP-UX 11), which is not what we want. Also, when Emacs is - interactive, we don't want SA_RESTART because we need to poll - for pending input so we need long-running syscalls to be interrupted - after a signal that sets the interrupt_input_pending flag. */ - /* Non-interactive keyboard input goes through stdio, where we always - want restartable system calls. */ - if (noninteractive) - action->sa_flags = SA_RESTART; -#endif + action->sa_flags = emacs_sigaction_flags (); } #ifdef FORWARD_SIGNAL_TO_MAIN_THREAD static pthread_t main_thread; #endif -/* If we are on the main thread, handle the signal SIG with HANDLER. +/* SIG has arrived at the current process. Deliver it to the main + thread, which should handle it with HANDLER. + + If we are on the main thread, handle the signal SIG with HANDLER. Otherwise, redirect the signal to the main thread, blocking it from this thread. POSIX says any thread can receive a signal that is associated with a process, process group, or asynchronous event. On GNU/Linux that is not true, but for other systems (FreeBSD at least) it is. */ void -handle_on_main_thread (int sig, signal_handler_t handler) +deliver_process_signal (int sig, signal_handler_t handler) { /* Preserve errno, to avoid race conditions with signal handlers that might change errno. Races can occur even in single-threaded hosts. */ @@ -1494,6 +1503,39 @@ errno = old_errno; } + +/* Static location to save a fatal backtrace in a thread. + FIXME: If two subsidiary threads fail simultaneously, the resulting + backtrace may be garbage. */ +enum { BACKTRACE_LIMIT_MAX = 500 }; +static void *thread_backtrace_buffer[BACKTRACE_LIMIT_MAX + 1]; +static int thread_backtrace_npointers; + +/* SIG has arrived at the current thread. + If we are on the main thread, handle the signal SIG with HANDLER. + Otherwise, this is a fatal error in the handling thread. */ +static void +deliver_thread_signal (int sig, signal_handler_t handler) +{ + int old_errno = errno; + +#ifdef FORWARD_SIGNAL_TO_MAIN_THREAD + if (! pthread_equal (pthread_self (), main_thread)) + { + thread_backtrace_npointers + = backtrace (thread_backtrace_buffer, BACKTRACE_LIMIT_MAX); + sigaction (sig, &process_fatal_action, 0); + pthread_kill (main_thread, sig); + + /* Avoid further damage while the main thread is exiting. */ + while (1) + sigsuspend (&empty_mask); + } +#endif + + handler (sig); + errno = old_errno; +} #if !defined HAVE_STRSIGNAL && !HAVE_DECL_SYS_SIGLIST static char *my_sys_siglist[NSIG]; @@ -1503,9 +1545,60 @@ # define sys_siglist my_sys_siglist #endif +/* Handle bus errors, invalid instruction, etc. */ +static void +handle_fatal_signal (int sig) +{ + terminate_due_to_signal (sig, 10); +} + +static void +deliver_fatal_signal (int sig) +{ + deliver_process_signal (sig, handle_fatal_signal); +} + +static void +deliver_fatal_thread_signal (int sig) +{ + deliver_thread_signal (sig, handle_fatal_signal); +} + +static _Noreturn void +handle_arith_signal (int sig) +{ + pthread_sigmask (SIG_SETMASK, &empty_mask, 0); + xsignal0 (Qarith_error); +} + +static void +deliver_arith_signal (int sig) +{ + deliver_thread_signal (sig, handle_arith_signal); +} + +/* Treat SIG as a terminating signal, unless it is already ignored and + we are in --batch mode. Among other things, this makes nohup work. */ +static void +maybe_fatal_sig (int sig) +{ + bool catch_sig = !noninteractive; + if (!catch_sig) + { + struct sigaction old_action; + sigaction (sig, 0, &old_action); + catch_sig = old_action.sa_handler != SIG_IGN; + } + if (catch_sig) + sigaction (sig, &process_fatal_action, 0); +} + void -init_signals (void) +init_signals (bool dumping) { + struct sigaction thread_fatal_action; + struct sigaction action; + sigemptyset (&empty_mask); #ifdef FORWARD_SIGNAL_TO_MAIN_THREAD @@ -1515,9 +1608,7 @@ #if !defined HAVE_STRSIGNAL && !HAVE_DECL_SYS_SIGLIST if (! initialized) { -# ifdef SIGABRT sys_siglist[SIGABRT] = "Aborted"; -# endif # ifdef SIGAIO sys_siglist[SIGAIO] = "LAN I/O interrupt"; # endif @@ -1545,9 +1636,7 @@ # ifdef SIGEMT sys_siglist[SIGEMT] = "Emulation trap"; # endif -# ifdef SIGFPE sys_siglist[SIGFPE] = "Arithmetic exception"; -# endif # ifdef SIGFREEZE sys_siglist[SIGFREEZE] = "SIGFREEZE"; # endif @@ -1557,12 +1646,8 @@ # ifdef SIGHUP sys_siglist[SIGHUP] = "Hangup"; # endif -# ifdef SIGILL sys_siglist[SIGILL] = "Illegal instruction"; -# endif -# ifdef SIGINT sys_siglist[SIGINT] = "Interrupt"; -# endif # ifdef SIGIO sys_siglist[SIGIO] = "I/O possible"; # endif @@ -1611,9 +1696,7 @@ # ifdef SIGSAK sys_siglist[SIGSAK] = "Secure attention"; # endif -# ifdef SIGSEGV sys_siglist[SIGSEGV] = "Segmentation violation"; -# endif # ifdef SIGSOUND sys_siglist[SIGSOUND] = "Sound completed"; # endif @@ -1626,9 +1709,7 @@ # ifdef SIGSYS sys_siglist[SIGSYS] = "Bad argument to system call"; # endif -# ifdef SIGTERM sys_siglist[SIGTERM] = "Terminated"; -# endif # ifdef SIGTHAW sys_siglist[SIGTHAW] = "SIGTHAW"; # endif @@ -1673,6 +1754,129 @@ # endif } #endif /* !defined HAVE_STRSIGNAL && !defined HAVE_DECL_SYS_SIGLIST */ + + /* Don't alter signal handlers if dumping. On some machines, + changing signal handlers sets static data that would make signals + fail to work right when the dumped Emacs is run. */ + if (dumping) + return; + + sigfillset (&process_fatal_action.sa_mask); + process_fatal_action.sa_handler = deliver_fatal_signal; + process_fatal_action.sa_flags = emacs_sigaction_flags () | SA_NODEFER; + + sigfillset (&thread_fatal_action.sa_mask); + thread_fatal_action.sa_handler = deliver_fatal_thread_signal; + thread_fatal_action.sa_flags = process_fatal_action.sa_flags; + + /* SIGINT may need special treatment on MS-Windows. See + http://lists.gnu.org/archive/html/emacs-devel/2010-09/msg01062.html + Please update the doc of kill-emacs, kill-emacs-hook, and + NEWS if you change this. */ + + maybe_fatal_sig (SIGHUP); + maybe_fatal_sig (SIGINT); + maybe_fatal_sig (SIGTERM); + + /* Emacs checks for write errors, so it can safely ignore SIGPIPE. + However, in batch mode leave SIGPIPE alone, as that causes Emacs + to behave more like typical batch applications do. */ + if (! noninteractive) + signal (SIGPIPE, SIG_IGN); + + sigaction (SIGQUIT, &process_fatal_action, 0); + sigaction (SIGILL, &thread_fatal_action, 0); + sigaction (SIGTRAP, &thread_fatal_action, 0); + + /* Typically SIGFPE is thread-specific and is fatal, like SIGILL. + But on a non-IEEE host SIGFPE can come from a trap in the Lisp + interpreter's floating point operations, so treat SIGFPE as an + arith-error if it arises in the main thread. */ + if (IEEE_FLOATING_POINT) + sigaction (SIGFPE, &thread_fatal_action, 0); + else + { + emacs_sigaction_init (&action, deliver_arith_signal); + sigaction (SIGFPE, &action, 0); + } + +#ifdef SIGUSR1 + add_user_signal (SIGUSR1, "sigusr1"); +#endif +#ifdef SIGUSR2 + add_user_signal (SIGUSR2, "sigusr2"); +#endif + sigaction (SIGABRT, &thread_fatal_action, 0); +#ifdef SIGPRE + sigaction (SIGPRE, &thread_fatal_action, 0); +#endif +#ifdef SIGORE + sigaction (SIGORE, &thread_fatal_action, 0); +#endif +#ifdef SIGUME + sigaction (SIGUME, &thread_fatal_action, 0); +#endif +#ifdef SIGDLK + sigaction (SIGDLK, &process_fatal_action, 0); +#endif +#ifdef SIGCPULIM + sigaction (SIGCPULIM, &process_fatal_action, 0); +#endif +#ifdef SIGIOT + sigaction (SIGIOT, &thread_fatal_action, 0); +#endif +#ifdef SIGEMT + sigaction (SIGEMT, &thread_fatal_action, 0); +#endif +#ifdef SIGBUS + sigaction (SIGBUS, &thread_fatal_action, 0); +#endif + sigaction (SIGSEGV, &thread_fatal_action, 0); +#ifdef SIGSYS + sigaction (SIGSYS, &thread_fatal_action, 0); +#endif + sigaction (SIGTERM, &process_fatal_action, 0); +#ifdef SIGPROF + sigaction (SIGPROF, &process_fatal_action, 0); +#endif +#ifdef SIGVTALRM + sigaction (SIGVTALRM, &process_fatal_action, 0); +#endif +#ifdef SIGXCPU + sigaction (SIGXCPU, &process_fatal_action, 0); +#endif +#ifdef SIGXFSZ + sigaction (SIGXFSZ, &process_fatal_action, 0); +#endif + +#ifdef SIGDANGER + /* This just means available memory is getting low. */ + emacs_sigaction_init (&action, deliver_danger_signal); + sigaction (SIGDANGER, &action, 0); +#endif + + /* AIX-specific signals. */ +#ifdef SIGGRANT + sigaction (SIGGRANT, &process_fatal_action, 0); +#endif +#ifdef SIGMIGRATE + sigaction (SIGMIGRATE, &process_fatal_action, 0); +#endif +#ifdef SIGMSG + sigaction (SIGMSG, &process_fatal_action, 0); +#endif +#ifdef SIGRETRACT + sigaction (SIGRETRACT, &process_fatal_action, 0); +#endif +#ifdef SIGSAK + sigaction (SIGSAK, &process_fatal_action, 0); +#endif +#ifdef SIGSOUND + sigaction (SIGSOUND, &process_fatal_action, 0); +#endif +#ifdef SIGTALRM + sigaction (SIGTALRM, &thread_fatal_action, 0); +#endif } #ifndef HAVE_RANDOM @@ -1811,23 +2015,37 @@ void emacs_backtrace (int backtrace_limit) { - enum { BACKTRACE_LIMIT_MAX = 500 }; - void *buffer[BACKTRACE_LIMIT_MAX + 1]; + void *main_backtrace_buffer[BACKTRACE_LIMIT_MAX + 1]; int bounded_limit = min (backtrace_limit, BACKTRACE_LIMIT_MAX); - int npointers = backtrace (buffer, bounded_limit + 1); + void *buffer; + int npointers; + + if (thread_backtrace_npointers) + { + buffer = thread_backtrace_buffer; + npointers = thread_backtrace_npointers; + } + else + { + buffer = main_backtrace_buffer; + npointers = backtrace (buffer, bounded_limit + 1); + } + if (npointers) - ignore_value (write (STDERR_FILENO, "\nBacktrace:\n", 12)); - backtrace_symbols_fd (buffer, bounded_limit, STDERR_FILENO); - if (bounded_limit < npointers) - ignore_value (write (STDERR_FILENO, "...\n", 4)); + { + ignore_value (write (STDERR_FILENO, "\nBacktrace:\n", 12)); + backtrace_symbols_fd (buffer, npointers, STDERR_FILENO); + if (bounded_limit < npointers) + ignore_value (write (STDERR_FILENO, "...\n", 4)); + } } #ifndef HAVE_NTGUI -/* Using emacs_abort lets GDB return from a breakpoint here. */ void emacs_abort (void) { - fatal_error_backtrace (SIGABRT, 10); + signal (SIGABRT, SIG_DFL); + terminate_due_to_signal (SIGABRT, 10); } #endif @@ -1910,7 +2128,8 @@ { /* I originally used `QUIT' but that might causes files to be truncated if you hit C-g in the middle of it. --Stef */ - process_pending_signals (); + if (pending_signals) + process_pending_signals (); continue; } else @@ -1975,11 +2194,11 @@ char *npath, *spath; extern char *getcwd (char *, size_t); - BLOCK_INPUT; /* getcwd uses malloc */ + block_input (); /* getcwd uses malloc */ spath = npath = getcwd ((char *) 0, MAXPATHLEN); if (spath == 0) { - UNBLOCK_INPUT; + unblock_input (); return spath; } /* On Altos 3068, getcwd can return @hostname/dir, so discard @@ -1988,7 +2207,7 @@ npath++; strcpy (pathname, npath); free (spath); /* getcwd uses malloc */ - UNBLOCK_INPUT; + unblock_input (); return pathname; } @@ -2422,7 +2641,7 @@ FILE *fup; EMACS_TIME up = make_emacs_time (0, 0); - BLOCK_INPUT; + block_input (); fup = fopen ("/proc/uptime", "r"); if (fup) @@ -2453,7 +2672,7 @@ } fclose (fup); } - UNBLOCK_INPUT; + unblock_input (); return up; } @@ -2467,7 +2686,7 @@ FILE *fdev = NULL; char name[PATH_MAX]; - BLOCK_INPUT; + block_input (); fdev = fopen ("/proc/tty/drivers", "r"); if (fdev) @@ -2499,7 +2718,7 @@ } fclose (fdev); } - UNBLOCK_INPUT; + unblock_input (); return build_string (name); } @@ -2509,7 +2728,7 @@ FILE *fmem = NULL; unsigned long retval = 2 * 1024 * 1024; /* default: 2GB */ - BLOCK_INPUT; + block_input (); fmem = fopen ("/proc/meminfo", "r"); if (fmem) @@ -2528,7 +2747,7 @@ } fclose (fmem); } - UNBLOCK_INPUT; + unblock_input (); return retval; } @@ -2574,17 +2793,17 @@ /* euid egid */ uid = st.st_uid; attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (uid)), attrs); - BLOCK_INPUT; + block_input (); pw = getpwuid (uid); - UNBLOCK_INPUT; + unblock_input (); if (pw) attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs); gid = st.st_gid; attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (gid)), attrs); - BLOCK_INPUT; + block_input (); gr = getgrgid (gid); - UNBLOCK_INPUT; + unblock_input (); if (gr) attrs = Fcons (Fcons (Qgroup, build_string (gr->gr_name)), attrs); @@ -2812,17 +3031,17 @@ /* euid egid */ uid = st.st_uid; attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (uid)), attrs); - BLOCK_INPUT; + block_input (); pw = getpwuid (uid); - UNBLOCK_INPUT; + unblock_input (); if (pw) attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs); gid = st.st_gid; attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (gid)), attrs); - BLOCK_INPUT; + block_input (); gr = getgrgid (gid); - UNBLOCK_INPUT; + unblock_input (); if (gr) attrs = Fcons (Fcons (Qgroup, build_string (gr->gr_name)), attrs); @@ -2943,17 +3162,17 @@ attrs = Fcons (Fcons (Qeuid, make_fixnum_or_float (proc.ki_uid)), attrs); - BLOCK_INPUT; + block_input (); pw = getpwuid (proc.ki_uid); - UNBLOCK_INPUT; + unblock_input (); if (pw) attrs = Fcons (Fcons (Quser, build_string (pw->pw_name)), attrs); attrs = Fcons (Fcons (Qegid, make_fixnum_or_float (proc.ki_svgid)), attrs); - BLOCK_INPUT; + block_input (); gr = getgrgid (proc.ki_svgid); - UNBLOCK_INPUT; + unblock_input (); if (gr) attrs = Fcons (Fcons (Qgroup, build_string (gr->gr_name)), attrs); @@ -2993,9 +3212,9 @@ attrs = Fcons (Fcons (Qpgrp, make_fixnum_or_float (proc.ki_pgid)), attrs); attrs = Fcons (Fcons (Qsess, make_fixnum_or_float (proc.ki_sid)), attrs); - BLOCK_INPUT; + block_input (); ttyname = proc.ki_tdev == NODEV ? NULL : devname (proc.ki_tdev, S_IFCHR); - UNBLOCK_INPUT; + unblock_input (); if (ttyname) attrs = Fcons (Fcons (Qtty, build_string (ttyname)), attrs); === modified file 'src/syssignal.h' --- src/syssignal.h 2012-09-16 21:43:55 +0000 +++ src/syssignal.h 2012-09-23 08:44:20 +0000 @@ -18,8 +18,9 @@ along with GNU Emacs. If not, see . */ #include +#include -extern void init_signals (void); +extern void init_signals (bool); #ifdef HAVE_PTHREAD #include @@ -39,6 +40,10 @@ # define NSIG NSIG_MINIMUM #endif +#ifndef emacs_raise +# define emacs_raise(sig) raise (sig) +#endif + /* On bsd, [man says] kill does not accept a negative number to kill a pgrp. Must do that using the killpg call. */ #ifdef BSD_SYSTEM @@ -64,4 +69,4 @@ char *strsignal (int); #endif -void handle_on_main_thread (int, signal_handler_t); +void deliver_process_signal (int, signal_handler_t); === modified file 'src/term.c' --- src/term.c 2012-09-15 07:06:56 +0000 +++ src/term.c 2012-09-23 08:44:20 +0000 @@ -753,13 +753,13 @@ conversion_buffer = encode_terminal_code (string, n, coding); if (coding->produced > 0) { - BLOCK_INPUT; + block_input (); fwrite (conversion_buffer, 1, coding->produced, tty->output); if (ferror (tty->output)) clearerr (tty->output); if (tty->termscript) fwrite (conversion_buffer, 1, coding->produced, tty->termscript); - UNBLOCK_INPUT; + unblock_input (); } string += n; @@ -814,13 +814,13 @@ conversion_buffer = encode_terminal_code (string, len, coding); if (coding->produced > 0) { - BLOCK_INPUT; + block_input (); fwrite (conversion_buffer, 1, coding->produced, tty->output); if (ferror (tty->output)) clearerr (tty->output); if (tty->termscript) fwrite (conversion_buffer, 1, coding->produced, tty->termscript); - UNBLOCK_INPUT; + unblock_input (); } /* Turn appearance modes off. */ @@ -900,13 +900,13 @@ if (coding->produced > 0) { - BLOCK_INPUT; + block_input (); fwrite (conversion_buffer, 1, coding->produced, tty->output); if (ferror (tty->output)) clearerr (tty->output); if (tty->termscript) fwrite (conversion_buffer, 1, coding->produced, tty->termscript); - UNBLOCK_INPUT; + unblock_input (); } OUTPUT1_IF (tty, tty->TS_pad_inserted_char); === modified file 'src/termhooks.h' --- src/termhooks.h 2012-09-20 01:37:07 +0000 +++ src/termhooks.h 2012-09-23 08:44:20 +0000 @@ -591,8 +591,7 @@ /* Called to read input events. TERMINAL indicates which terminal device to read from. Input - events should be read into BUF, the size of which is given in - SIZE. + events should be read into HOLD_QUIT. A positive return value indicates that that many input events were read into BUF. === modified file 'src/w16select.c' --- src/w16select.c 2012-09-15 08:03:11 +0000 +++ src/w16select.c 2012-09-23 08:44:20 +0000 @@ -459,7 +459,7 @@ if ( !FRAME_MSDOS_P (XFRAME (frame))) goto done; - BLOCK_INPUT; + block_input (); if (!open_clipboard ()) goto error; @@ -520,7 +520,7 @@ unblock: xfree (dst); - UNBLOCK_INPUT; + unblock_input (); /* Notify user if the text is too large to fit into DOS memory. (This will happen somewhere after 600K bytes (470K in DJGPP v1.x), @@ -565,7 +565,7 @@ if ( !FRAME_MSDOS_P (XFRAME (frame))) goto done; - BLOCK_INPUT; + block_input (); if (!open_clipboard ()) goto unblock; @@ -626,7 +626,7 @@ close_clipboard (); unblock: - UNBLOCK_INPUT; + unblock_input (); done: === modified file 'src/w32fns.c' --- src/w32fns.c 2012-09-15 08:03:11 +0000 +++ src/w32fns.c 2012-09-23 08:44:20 +0000 @@ -364,7 +364,7 @@ XSETINT (rgb, RGB (XUINT (red), XUINT (green), XUINT (blue))); - BLOCK_INPUT; + block_input (); /* replace existing entry in w32-color-map or add new entry. */ entry = Fassoc (name, Vw32_color_map); @@ -379,7 +379,7 @@ Fsetcdr (entry, rgb); } - UNBLOCK_INPUT; + unblock_input (); return (oldrgb); } @@ -642,7 +642,7 @@ colormap_t *pc = w32_color_map; Lisp_Object cmap; - BLOCK_INPUT; + block_input (); cmap = Qnil; @@ -652,7 +652,7 @@ make_number (pc->colorref)), cmap); - UNBLOCK_INPUT; + unblock_input (); return (cmap); } @@ -669,7 +669,7 @@ { Lisp_Object tail, ret = Qnil; - BLOCK_INPUT; + block_input (); for (tail = Vw32_color_map; CONSP (tail); tail = XCDR (tail)) { @@ -689,7 +689,7 @@ QUIT; } - UNBLOCK_INPUT; + unblock_input (); return ret; } @@ -701,7 +701,7 @@ HKEY colors_key; /* Other registry operations are done with input blocked. */ - BLOCK_INPUT; + block_input (); /* Look for "Control Panel/Colors" under User and Machine registry settings. */ @@ -739,7 +739,7 @@ RegCloseKey (colors_key); } - UNBLOCK_INPUT; + unblock_input (); } @@ -748,7 +748,7 @@ { register Lisp_Object ret = Qnil; - BLOCK_INPUT; + block_input (); if (colorname[0] == '#') { @@ -801,7 +801,7 @@ pos += 0x8; if (i == 2) { - UNBLOCK_INPUT; + unblock_input (); XSETINT (ret, colorval); return ret; } @@ -855,7 +855,7 @@ { if (*end != '\0') break; - UNBLOCK_INPUT; + unblock_input (); XSETINT (ret, colorval); return ret; } @@ -897,7 +897,7 @@ { if (*end != '\0') break; - UNBLOCK_INPUT; + unblock_input (); XSETINT (ret, colorval); return ret; } @@ -932,7 +932,7 @@ } } - UNBLOCK_INPUT; + unblock_input (); return ret; } @@ -1235,7 +1235,7 @@ f->output_data.w32->mouse_pixel = FRAME_FOREGROUND_PIXEL (f); #if 0 /* TODO : Mouse cursor customization. */ - BLOCK_INPUT; + block_input (); /* It's not okay to crash if the user selects a screwy cursor. */ count = x_catch_errors (FRAME_W32_DISPLAY (f)); @@ -1358,7 +1358,7 @@ f->output_data.w32->hand_cursor = hand_cursor; XFlush (FRAME_W32_DISPLAY (f)); - UNBLOCK_INPUT; + unblock_input (); update_face_from_frame_parameter (f, Qmouse_color, arg); #endif /* TODO */ @@ -1390,12 +1390,12 @@ if (FRAME_W32_WINDOW (f) != 0) { - BLOCK_INPUT; + block_input (); /* Update frame's cursor_gc. */ f->output_data.w32->cursor_gc->foreground = fore_pixel; f->output_data.w32->cursor_gc->background = pixel; - UNBLOCK_INPUT; + unblock_input (); if (FRAME_VISIBLE_P (f)) { @@ -1466,16 +1466,16 @@ if (SYMBOLP (arg) && SYMBOLP (oldval) && EQ (arg, oldval)) return; - BLOCK_INPUT; + block_input (); result = x_bitmap_icon (f, arg); if (result) { - UNBLOCK_INPUT; + unblock_input (); error ("No icon window available"); } - UNBLOCK_INPUT; + unblock_input (); } void @@ -1495,7 +1495,7 @@ if (f->output_data.w32->icon_bitmap != 0) return; - BLOCK_INPUT; + block_input (); result = x_text_icon (f, SSDATA ((!NILP (f->icon_name) @@ -1506,7 +1506,7 @@ if (result) { - UNBLOCK_INPUT; + unblock_input (); error ("No icon window available"); } @@ -1521,7 +1521,7 @@ } XFlush (FRAME_W32_DISPLAY (f)); - UNBLOCK_INPUT; + unblock_input (); #endif } @@ -1623,13 +1623,13 @@ int width = FRAME_PIXEL_WIDTH (f); int y = nlines * FRAME_LINE_HEIGHT (f); - BLOCK_INPUT; + block_input (); { HDC hdc = get_frame_dc (f); w32_clear_area (f, hdc, 0, y, width, height); release_frame_dc (f, hdc); } - UNBLOCK_INPUT; + unblock_input (); if (WINDOWP (f->tool_bar_window)) clear_glyph_matrix (XWINDOW (f->tool_bar_window)->current_matrix); @@ -1697,9 +1697,9 @@ if (STRING_MULTIBYTE (name)) name = ENCODE_SYSTEM (name); - BLOCK_INPUT; + block_input (); SetWindowText (FRAME_W32_WINDOW (f), SDATA (name)); - UNBLOCK_INPUT; + unblock_input (); } } @@ -1743,9 +1743,9 @@ if (STRING_MULTIBYTE (name)) name = ENCODE_SYSTEM (name); - BLOCK_INPUT; + block_input (); SetWindowText (FRAME_W32_WINDOW (f), SDATA (name)); - UNBLOCK_INPUT; + unblock_input (); } } @@ -3896,7 +3896,7 @@ static void w32_window (struct frame *f, long window_prompting, int minibuffer_only) { - BLOCK_INPUT; + block_input (); /* Use the resource name as the top-level window name for looking up resources. Make a non-Lisp copy @@ -3928,7 +3928,7 @@ x_set_name (f, name, explicit); } - UNBLOCK_INPUT; + unblock_input (); if (!minibuffer_only && FRAME_EXTERNAL_MENU_BAR (f)) initialize_frame_menubar (f); @@ -3959,7 +3959,7 @@ else if (!EQ (icon_x, Qunbound) || !EQ (icon_y, Qunbound)) error ("Both left and top icon corners of icon must be specified"); - BLOCK_INPUT; + block_input (); if (! EQ (icon_x, Qunbound)) x_wm_set_icon_position (f, XINT (icon_x), XINT (icon_y)); @@ -3976,7 +3976,7 @@ : f->name))); #endif - UNBLOCK_INPUT; + unblock_input (); } @@ -3985,7 +3985,7 @@ { XGCValues gc_values; - BLOCK_INPUT; + block_input (); /* Create the GC's of this frame. Note that many default values are used. */ @@ -4005,7 +4005,7 @@ f->output_data.w32->white_relief.gc = 0; f->output_data.w32->black_relief.gc = 0; - UNBLOCK_INPUT; + unblock_input (); } @@ -4351,9 +4351,9 @@ /* Tell the server what size and position, etc, we want, and how badly we want them. This should be done after we have the menu bar so that its size can be taken into account. */ - BLOCK_INPUT; + block_input (); x_wm_set_size_hint (f, window_prompting, 0); - UNBLOCK_INPUT; + unblock_input (); /* Make the window appear on the frame and enable display, unless the caller says not to. However, with explicit parent, Emacs @@ -4862,11 +4862,11 @@ if (dpyinfo->reference_count > 0) error ("Display still has frames on it"); - BLOCK_INPUT; + block_input (); x_destroy_all_bitmaps (dpyinfo); x_delete_display (dpyinfo); - UNBLOCK_INPUT; + unblock_input (); return Qnil; } @@ -4935,7 +4935,7 @@ CHECK_STRING (prop); CHECK_STRING (value); - BLOCK_INPUT; + block_input (); prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), SDATA (prop), False); XChangeProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), prop_atom, XA_STRING, 8, PropModeReplace, @@ -4943,7 +4943,7 @@ /* Make sure the property is set when we return. */ XFlush (FRAME_W32_DISPLAY (f)); - UNBLOCK_INPUT; + unblock_input (); return value; } @@ -4959,13 +4959,13 @@ Atom prop_atom; CHECK_STRING (prop); - BLOCK_INPUT; + block_input (); prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), SDATA (prop), False); XDeleteProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), prop_atom); /* Make sure the property is removed when we return. */ XFlush (FRAME_W32_DISPLAY (f)); - UNBLOCK_INPUT; + unblock_input (); return prop; } @@ -5001,7 +5001,7 @@ unsigned long actual_size, bytes_remaining; CHECK_STRING (prop); - BLOCK_INPUT; + block_input (); prop_atom = XInternAtom (FRAME_W32_DISPLAY (f), SDATA (prop), False); rc = XGetWindowProperty (FRAME_W32_DISPLAY (f), FRAME_W32_WINDOW (f), prop_atom, 0, 0, False, XA_STRING, @@ -5026,7 +5026,7 @@ XFree (tmp_data); } - UNBLOCK_INPUT; + unblock_input (); return prop_value; @@ -5349,9 +5349,9 @@ f->left_fringe_width = 0; f->right_fringe_width = 0; - BLOCK_INPUT; + block_input (); my_create_tip_window (f); - UNBLOCK_INPUT; + unblock_input (); x_make_gc (f); @@ -5457,11 +5457,11 @@ max_x = x_display_pixel_width (FRAME_W32_DISPLAY_INFO (f)); max_y = x_display_pixel_height (FRAME_W32_DISPLAY_INFO (f)); - BLOCK_INPUT; + block_input (); GetCursorPos (&pt); *root_x = pt.x; *root_y = pt.y; - UNBLOCK_INPUT; + unblock_input (); /* If multiple monitor support is available, constrain the tip onto the current monitor. This improves the above by allowing negative @@ -5596,7 +5596,7 @@ call1 (Qcancel_timer, timer); } - BLOCK_INPUT; + block_input (); compute_tip_xy (f, parms, dx, dy, FRAME_PIXEL_WIDTH (f), FRAME_PIXEL_HEIGHT (f), &root_x, &root_y); @@ -5610,7 +5610,7 @@ 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOACTIVATE); - UNBLOCK_INPUT; + unblock_input (); goto start_timer; } } @@ -5637,7 +5637,7 @@ /* Block input until the tip has been fully drawn, to avoid crashes when drawing tips in menus. */ - BLOCK_INPUT; + block_input (); /* Create a frame for the tooltip, and record it in the global variable tip_frame. */ @@ -5809,7 +5809,7 @@ w->must_be_updated_p = 1; update_single_window (w, 1); - UNBLOCK_INPUT; + unblock_input (); /* Restore original current buffer. */ set_buffer_internal_1 (old_buffer); @@ -6002,7 +6002,7 @@ /* Prevent redisplay. */ specbind (Qinhibit_redisplay, Qt); - BLOCK_INPUT; + block_input (); memset (&new_file_details, 0, sizeof (new_file_details)); /* Apparently NT4 crashes if you give it an unexpected size. @@ -6041,7 +6041,7 @@ file_opened = GetOpenFileName (file_details); - UNBLOCK_INPUT; + unblock_input (); if (file_opened) { === modified file 'src/w32inevt.c' --- src/w32inevt.c 2012-09-20 01:37:07 +0000 +++ src/w32inevt.c 2012-09-23 08:44:20 +0000 @@ -567,7 +567,7 @@ Lisp_Object *y, Time *time) { - BLOCK_INPUT; + block_input (); insist = insist; @@ -580,7 +580,7 @@ XSETINT (*y, movement_pos.Y); *time = movement_time; - UNBLOCK_INPUT; + unblock_input (); } /* Remember mouse motion and notify emacs. */ @@ -749,14 +749,7 @@ int nev, add; int isdead; - if (interrupt_input_blocked) - { - interrupt_input_pending = 1; - return -1; - } - - interrupt_input_pending = 0; - BLOCK_INPUT; + block_input (); for (;;) { @@ -818,6 +811,6 @@ if (!w32_use_full_screen_buffer) maybe_generate_resize_event (); - UNBLOCK_INPUT; + unblock_input (); return nev; } === modified file 'src/w32menu.c' --- src/w32menu.c 2012-09-15 08:03:11 +0000 +++ src/w32menu.c 2012-09-23 08:44:20 +0000 @@ -221,9 +221,9 @@ list_of_panes (Fcons (contents, Qnil)); /* Display them in a dialog box. */ - BLOCK_INPUT; + block_input (); selection = w32_dialog_show (f, 0, title, header, &error_name); - UNBLOCK_INPUT; + unblock_input (); discard_menu_items (); FRAME_X_DISPLAY_INFO (f)->grabbed = 0; @@ -571,7 +571,7 @@ /* Create or update the menu bar widget. */ - BLOCK_INPUT; + block_input (); if (menubar_widget) { @@ -601,7 +601,7 @@ x_set_window_size (f, 0, FRAME_COLS (f), FRAME_LINES (f)); } - UNBLOCK_INPUT; + unblock_input (); } /* Called from Fx_create_frame to create the initial menubar of a frame @@ -624,7 +624,7 @@ void free_frame_menubar (FRAME_PTR f) { - BLOCK_INPUT; + block_input (); { HMENU old = GetMenu (FRAME_W32_WINDOW (f)); @@ -633,7 +633,7 @@ DestroyMenu (old); } - UNBLOCK_INPUT; + unblock_input (); } === modified file 'src/w32reg.c' --- src/w32reg.c 2012-09-15 08:03:11 +0000 +++ src/w32reg.c 2012-09-23 08:44:20 +0000 @@ -84,7 +84,7 @@ trykey: - BLOCK_INPUT; + block_input (); /* Check both the current user and the local machine to see if we have any resources */ @@ -115,7 +115,7 @@ RegCloseKey (hrootkey); } - UNBLOCK_INPUT; + unblock_input (); if (!ok) { === modified file 'src/w32select.c' --- src/w32select.c 2012-09-15 08:03:11 +0000 +++ src/w32select.c 2012-09-23 08:44:20 +0000 @@ -391,7 +391,7 @@ extern int waiting_for_input; /* from keyboard.c */ int owfi; - BLOCK_INPUT; + block_input (); /* Fsignal calls emacs_abort () if it sees that waiting_for_input is set. */ @@ -402,7 +402,7 @@ waiting_for_input = owfi; - UNBLOCK_INPUT; + unblock_input (); } static Lisp_Object @@ -694,7 +694,7 @@ current_num_nls = 0; current_requires_encoding = 0; - BLOCK_INPUT; + block_input (); /* Check for non-ASCII characters. While we are at it, count the number of LFs, so we know how many CRs we will have to add later @@ -782,7 +782,7 @@ current_coding_system = Qnil; done: - UNBLOCK_INPUT; + unblock_input (); return (ok ? string : Qnil); } @@ -810,7 +810,7 @@ setup_config (); actual_clipboard_type = cfg_clipboard_type; - BLOCK_INPUT; + block_input (); if (!OpenClipboard (clipboard_owner)) goto done; @@ -1000,7 +1000,7 @@ CloseClipboard (); done: - UNBLOCK_INPUT; + unblock_input (); return (ret); } === modified file 'src/w32term.c' --- src/w32term.c 2012-09-20 01:37:07 +0000 +++ src/w32term.c 2012-09-23 08:44:20 +0000 @@ -563,7 +563,7 @@ updated_window = w; set_output_cursor (&w->cursor); - BLOCK_INPUT; + block_input (); if (f == hlinfo->mouse_face_mouse_frame) { @@ -602,7 +602,7 @@ #endif /* 0 */ } - UNBLOCK_INPUT; + unblock_input (); } /* Draw a vertical window border from (x,y0) to (x,y1) */ @@ -652,7 +652,7 @@ if (!w->pseudo_window_p) { - BLOCK_INPUT; + block_input (); if (cursor_on_p) display_and_set_cursor (w, 1, output_cursor.hpos, @@ -662,7 +662,7 @@ if (draw_window_fringes (w, 1)) x_draw_vertical_border (w); - UNBLOCK_INPUT; + unblock_input (); } /* If a row with mouse-face was overwritten, arrange for @@ -714,13 +714,13 @@ if (hlinfo->mouse_face_deferred_gc || f == hlinfo->mouse_face_mouse_frame) { - BLOCK_INPUT; + block_input (); if (hlinfo->mouse_face_mouse_frame) note_mouse_highlight (hlinfo->mouse_face_mouse_frame, hlinfo->mouse_face_mouse_x, hlinfo->mouse_face_mouse_y); hlinfo->mouse_face_deferred_gc = 0; - UNBLOCK_INPUT; + unblock_input (); } } } @@ -761,7 +761,7 @@ { int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y)); - BLOCK_INPUT; + block_input (); { HDC hdc = get_frame_dc (f); w32_clear_area (f, hdc, 0, y, width, height); @@ -769,7 +769,7 @@ y, width, height); release_frame_dc (f, hdc); } - UNBLOCK_INPUT; + unblock_input (); } } @@ -2646,7 +2646,7 @@ /* We don't set the output cursor here because there will always follow an explicit cursor_to. */ - BLOCK_INPUT; + block_input (); w32_clear_window (f); @@ -2654,7 +2654,7 @@ colors or something like that, then they should be notified. */ x_scroll_bar_clear (f); - UNBLOCK_INPUT; + unblock_input (); } @@ -2663,7 +2663,7 @@ static void w32_ring_bell (struct frame *f) { - BLOCK_INPUT; + block_input (); if (FRAME_W32_P (f) && visible_bell) { @@ -2680,7 +2680,7 @@ else w32_sys_ring_bell (f); - UNBLOCK_INPUT; + unblock_input (); } @@ -2779,7 +2779,7 @@ expect_dirty = CreateRectRgn (x, y, x + width, to_y); } - BLOCK_INPUT; + block_input (); /* Cursor off. Will be switched on again in x_update_window_end. */ updated_window = w; @@ -2813,7 +2813,7 @@ DeleteObject (combined); } - UNBLOCK_INPUT; + unblock_input (); DeleteObject (expect_dirty); } @@ -2998,9 +2998,9 @@ /* Make static so we can always return it */ static char value[100]; - BLOCK_INPUT; + block_input (); GetKeyNameText (keysym, value, 100); - UNBLOCK_INPUT; + unblock_input (); return value; } @@ -3308,7 +3308,7 @@ { FRAME_PTR f1; - BLOCK_INPUT; + block_input (); if (! NILP (last_mouse_scroll_bar) && insist == 0) x_scroll_bar_report_motion (fp, bar_window, part, x, y, time); @@ -3382,7 +3382,7 @@ } } - UNBLOCK_INPUT; + unblock_input (); } @@ -3480,12 +3480,12 @@ if (draggingp) { int near_bottom_p; - BLOCK_INPUT; + block_input (); si.cbSize = sizeof (si); si.fMask = SIF_POS | SIF_PAGE; GetScrollInfo (w, SB_CTL, &si); near_bottom_p = si.nPos + si.nPage >= range; - UNBLOCK_INPUT; + unblock_input (); if (!near_bottom_p) return; } @@ -3514,7 +3514,7 @@ sb_page = max (sb_page, VERTICAL_SCROLL_BAR_MIN_HANDLE); - BLOCK_INPUT; + block_input (); si.cbSize = sizeof (si); si.fMask = SIF_PAGE | SIF_POS; @@ -3523,7 +3523,7 @@ SetScrollInfo (w, SB_CTL, &si, TRUE); - UNBLOCK_INPUT; + unblock_input (); } @@ -3614,7 +3614,7 @@ = XSCROLL_BAR (Fmake_vector (make_number (SCROLL_BAR_VEC_SIZE), Qnil)); Lisp_Object barobj; - BLOCK_INPUT; + block_input (); XSETWINDOW (bar->window, w); XSETINT (bar->top, top); @@ -3650,7 +3650,7 @@ if (! NILP (bar->next)) XSETVECTOR (XSCROLL_BAR (bar->next)->prev, bar); - UNBLOCK_INPUT; + unblock_input (); return bar; } @@ -3664,7 +3664,7 @@ { FRAME_PTR f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); - BLOCK_INPUT; + block_input (); /* Destroy the window. */ my_destroy_window (f, SCROLL_BAR_W32_WINDOW (bar)); @@ -3672,7 +3672,7 @@ /* Dissociate this scroll bar from its window. */ wset_vertical_scroll_bar (XWINDOW (bar->window), Qnil); - UNBLOCK_INPUT; + unblock_input (); } /* Set the handle of the vertical scroll bar for WINDOW to indicate @@ -3727,7 +3727,7 @@ if (NILP (w->vertical_scroll_bar)) { HDC hdc; - BLOCK_INPUT; + block_input (); if (width > 0 && height > 0) { hdc = get_frame_dc (f); @@ -3737,7 +3737,7 @@ w32_clear_area (f, hdc, left, top, width, height); release_frame_dc (f, hdc); } - UNBLOCK_INPUT; + unblock_input (); bar = x_scroll_bar_create (w, top, sb_left, sb_width, height); } @@ -3765,7 +3765,7 @@ HDC hdc; SCROLLINFO si; - BLOCK_INPUT; + block_input (); if (width && height) { hdc = get_frame_dc (f); @@ -3801,7 +3801,7 @@ XSETINT (bar->width, sb_width); XSETINT (bar->height, height); - UNBLOCK_INPUT; + unblock_input (); } } bar->fringe_extended_p = fringe_extended_p ? Qt : Qnil; @@ -4043,7 +4043,7 @@ int top_range = VERTICAL_SCROLL_BAR_TOP_RANGE (f, XINT (bar->height)); SCROLLINFO si; - BLOCK_INPUT; + block_input (); *fp = f; *bar_window = bar->window; @@ -4080,7 +4080,7 @@ *time = last_mouse_movement_time; - UNBLOCK_INPUT; + unblock_input (); } @@ -4157,15 +4157,8 @@ struct w32_display_info *dpyinfo = &one_w32_display_info; Mouse_HLInfo *hlinfo = &dpyinfo->mouse_highlight; - if (interrupt_input_blocked) - { - interrupt_input_pending = 1; - pending_signals = 1; - return -1; - } - interrupt_input_pending = 0; - BLOCK_INPUT; + block_input (); /* So people can tell when we have read the available input. */ input_signal_count++; @@ -4961,7 +4954,7 @@ } } - UNBLOCK_INPUT; + unblock_input (); return count; } @@ -5476,7 +5469,7 @@ } x_calc_absolute_position (f); - BLOCK_INPUT; + block_input (); x_wm_set_size_hint (f, (long) 0, 0); modified_left = f->left_pos; @@ -5487,7 +5480,7 @@ modified_left, modified_top, 0, 0, SWP_NOZORDER | SWP_NOSIZE | SWP_NOACTIVATE); - UNBLOCK_INPUT; + unblock_input (); } @@ -5528,7 +5521,7 @@ { int pixelwidth, pixelheight; - BLOCK_INPUT; + block_input (); check_frame_size (f, &rows, &cols); f->scroll_bar_actual_width @@ -5608,7 +5601,7 @@ cancel_mouse_face (f); #endif - UNBLOCK_INPUT; + unblock_input (); } /* Mouse warping. */ @@ -5638,7 +5631,7 @@ RECT rect; POINT pt; - BLOCK_INPUT; + block_input (); GetClientRect (FRAME_W32_WINDOW (f), &rect); pt.x = rect.left + pix_x; @@ -5647,7 +5640,7 @@ SetCursorPos (pt.x, pt.y); - UNBLOCK_INPUT; + unblock_input (); } @@ -5659,7 +5652,7 @@ struct w32_display_info *dpyinfo = &one_w32_display_info; /* Give input focus to frame. */ - BLOCK_INPUT; + block_input (); #if 0 /* Try not to change its Z-order if possible. */ if (x_window_to_frame (dpyinfo, GetForegroundWindow ())) @@ -5667,7 +5660,7 @@ else #endif my_set_foreground_window (FRAME_W32_WINDOW (f)); - UNBLOCK_INPUT; + unblock_input (); } void @@ -5679,7 +5672,7 @@ void x_raise_frame (struct frame *f) { - BLOCK_INPUT; + block_input (); /* Strictly speaking, raise-frame should only change the frame's Z order, leaving input focus unchanged. This is reasonable behavior @@ -5734,19 +5727,19 @@ my_bring_window_to_top (FRAME_W32_WINDOW (f)); } - UNBLOCK_INPUT; + unblock_input (); } /* Lower frame F. */ void x_lower_frame (struct frame *f) { - BLOCK_INPUT; + block_input (); my_set_window_pos (FRAME_W32_WINDOW (f), HWND_BOTTOM, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE); - UNBLOCK_INPUT; + unblock_input (); } static void @@ -5775,7 +5768,7 @@ { Lisp_Object type; - BLOCK_INPUT; + block_input (); type = x_icon_type (f); if (!NILP (type)) @@ -5827,7 +5820,7 @@ int count; /* This must come after we set COUNT. */ - UNBLOCK_INPUT; + unblock_input (); XSETFRAME (frame, f); @@ -5870,7 +5863,7 @@ if (FRAME_W32_DISPLAY_INFO (f)->x_highlight_frame == f) FRAME_W32_DISPLAY_INFO (f)->x_highlight_frame = 0; - BLOCK_INPUT; + block_input (); my_show_window (f, FRAME_W32_WINDOW (f), SW_HIDE); @@ -5884,7 +5877,7 @@ f->async_visible = 0; f->async_iconified = 0; - UNBLOCK_INPUT; + unblock_input (); } /* Change window state from mapped to iconified. */ @@ -5901,7 +5894,7 @@ if (f->async_iconified) return; - BLOCK_INPUT; + block_input (); type = x_icon_type (f); if (!NILP (type)) @@ -5910,7 +5903,7 @@ /* Simulate the user minimizing the frame. */ SendMessage (FRAME_W32_WINDOW (f), WM_SYSCOMMAND, SC_MINIMIZE, 0); - UNBLOCK_INPUT; + unblock_input (); } @@ -5922,7 +5915,7 @@ struct w32_display_info *dpyinfo = FRAME_W32_DISPLAY_INFO (f); Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); - BLOCK_INPUT; + block_input (); /* We must free faces before destroying windows because some font-driver (e.g. xft) access a window while finishing a @@ -5970,7 +5963,7 @@ hlinfo->mouse_face_mouse_frame = 0; } - UNBLOCK_INPUT; + unblock_input (); } @@ -6254,10 +6247,10 @@ if (!terminal->name) return; - BLOCK_INPUT; + block_input (); x_delete_display (dpyinfo); - UNBLOCK_INPUT; + unblock_input (); } struct w32_display_info * @@ -6267,7 +6260,7 @@ struct terminal *terminal; HDC hdc; - BLOCK_INPUT; + block_input (); if (!w32_initialized) { @@ -6329,7 +6322,7 @@ init_sigio (connection); #endif /* ! defined (SIGIO) */ - UNBLOCK_INPUT; + unblock_input (); return dpyinfo; } === modified file 'src/widget.c' --- src/widget.c 2012-09-15 07:06:56 +0000 +++ src/widget.c 2012-09-23 08:44:20 +0000 @@ -677,13 +677,13 @@ if (! s) emacs_abort (); if (! s->output_data.x) emacs_abort (); - BLOCK_INPUT; + block_input (); x_free_gcs (s); if (s->output_data.x->white_relief.gc) XFreeGC (XtDisplay (widget), s->output_data.x->white_relief.gc); if (s->output_data.x->black_relief.gc) XFreeGC (XtDisplay (widget), s->output_data.x->black_relief.gc); - UNBLOCK_INPUT; + unblock_input (); } static void === modified file 'src/window.c' --- src/window.c 2012-09-22 12:56:08 +0000 +++ src/window.c 2012-09-23 08:44:20 +0000 @@ -2819,7 +2819,7 @@ } } - BLOCK_INPUT; + block_input (); if (!FRAME_INITIAL_P (f)) { Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); @@ -2961,7 +2961,7 @@ } adjust_glyphs (f); - UNBLOCK_INPUT; + unblock_input (); run_window_configuration_change_hook (f); @@ -3696,14 +3696,14 @@ (horflag ? r->total_cols : r->total_lines))) return Qnil; - BLOCK_INPUT; + block_input (); window_resize_apply (r, horflag); windows_or_buffers_changed++; FRAME_WINDOW_SIZES_CHANGED (f) = 1; adjust_glyphs (f); - UNBLOCK_INPUT; + unblock_input (); run_window_configuration_change_hook (f); @@ -3973,13 +3973,13 @@ wset_new_total (n, total_size); wset_new_normal (n, normal_size); - BLOCK_INPUT; + block_input (); window_resize_apply (p, horflag); adjust_glyphs (f); /* Set buffer of NEW to buffer of reference window. Don't run any hooks. */ set_window_buffer (new, r->buffer, 0, 1); - UNBLOCK_INPUT; + unblock_input (); /* Maybe we should run the scroll functions in Elisp (which already runs the configuration change hook). */ @@ -4060,7 +4060,7 @@ { /* Block input. */ - BLOCK_INPUT; + block_input (); window_resize_apply (p, horflag); /* If this window is referred to by the dpyinfo's mouse @@ -4132,7 +4132,7 @@ else fset_selected_window (f, new_selected_window); - UNBLOCK_INPUT; + unblock_input (); /* Now look whether `get-mru-window' gets us something. */ mru_window = call1 (Qget_mru_window, frame); @@ -4147,7 +4147,7 @@ fset_selected_window (f, new_selected_window); } else - UNBLOCK_INPUT; + unblock_input (); /* Must be run by the caller: run_window_configuration_change_hook (f); */ @@ -4197,7 +4197,7 @@ root, make_number (- delta)); if (INTEGERP (value) && window_resize_check (r, 0)) { - BLOCK_INPUT; + block_input (); window_resize_apply (r, 0); /* Grow the mini-window. */ @@ -4209,7 +4209,7 @@ w->last_overlay_modified = 0; adjust_glyphs (f); - UNBLOCK_INPUT; + unblock_input (); } } @@ -4234,7 +4234,7 @@ root, make_number (size - 1)); if (INTEGERP (value) && window_resize_check (r, 0)) { - BLOCK_INPUT; + block_input (); window_resize_apply (r, 0); /* Shrink the mini-window. */ @@ -4246,7 +4246,7 @@ w->last_overlay_modified = 0; adjust_glyphs (f); - UNBLOCK_INPUT; + unblock_input (); } /* If the above failed for whatever strange reason we must make a one window frame here. The same routine will be needed when @@ -4278,7 +4278,7 @@ && XINT (w->new_total) > 0 && height == XINT (r->new_total) + XINT (w->new_total)) { - BLOCK_INPUT; + block_input (); window_resize_apply (r, 0); wset_total_lines (w, w->new_total); @@ -4288,7 +4288,7 @@ windows_or_buffers_changed++; FRAME_WINDOW_SIZES_CHANGED (f) = 1; adjust_glyphs (f); - UNBLOCK_INPUT; + unblock_input (); run_window_configuration_change_hook (f); return Qt; @@ -5624,7 +5624,7 @@ /* The mouse highlighting code could get screwed up if it runs during this. */ - BLOCK_INPUT; + block_input (); if (data->frame_lines != previous_frame_lines || data->frame_cols != previous_frame_cols) @@ -5875,7 +5875,7 @@ } adjust_glyphs (f); - UNBLOCK_INPUT; + unblock_input (); /* Scan dead buffer windows. */ for (; CONSP (dead_windows); dead_windows = XCDR (dead_windows)) === modified file 'src/xdisp.c' --- src/xdisp.c 2012-09-22 12:31:05 +0000 +++ src/xdisp.c 2012-09-23 08:44:20 +0000 @@ -275,6 +275,7 @@ #include #include "lisp.h" +#include "atimer.h" #include "keyboard.h" #include "frame.h" #include "window.h" @@ -11402,11 +11403,11 @@ This will also set the cursor position of W. */ if (updated_window == NULL) { - BLOCK_INPUT; + block_input (); display_and_set_cursor (w, 1, hpos, vpos, x, y); if (FRAME_RIF (SELECTED_FRAME ())->flush_display_optional) FRAME_RIF (SELECTED_FRAME ())->flush_display_optional (SELECTED_FRAME ()); - UNBLOCK_INPUT; + unblock_input (); } } @@ -11520,11 +11521,11 @@ /* Redisplay that happens asynchronously due to an expose event may access f->tool_bar_items. Make sure we update both variables within BLOCK_INPUT so no such event interrupts. */ - BLOCK_INPUT; + block_input (); fset_tool_bar_items (f, new_tool_bar); f->n_tool_bar_items = new_n_tool_bar; w->update_mode_line = 1; - UNBLOCK_INPUT; + unblock_input (); } UNGCPRO; @@ -16205,10 +16206,10 @@ || w->pseudo_window_p))) { update_begin (f); - BLOCK_INPUT; + block_input (); if (draw_window_fringes (w, 1)) x_draw_vertical_border (w); - UNBLOCK_INPUT; + unblock_input (); update_end (f); } #endif /* HAVE_WINDOW_SYSTEM */ @@ -25327,7 +25328,7 @@ if (updated_row->reversed_p && chpos >= updated_row->used[TEXT_AREA]) chpos = updated_row->used[TEXT_AREA] - 1; - BLOCK_INPUT; + block_input (); /* Write glyphs. */ @@ -25345,7 +25346,7 @@ && chpos < hpos + len) updated_window->phys_cursor_on_p = 0; - UNBLOCK_INPUT; + unblock_input (); /* Advance the output cursor. */ output_cursor.hpos += len; @@ -25368,7 +25369,7 @@ ptrdiff_t hpos; eassert (updated_window && updated_row); - BLOCK_INPUT; + block_input (); w = updated_window; f = XFRAME (WINDOW_FRAME (w)); @@ -25402,7 +25403,7 @@ /* Advance the output cursor. */ output_cursor.hpos += len; output_cursor.x += shift_by_width; - UNBLOCK_INPUT; + unblock_input (); } @@ -25471,10 +25472,10 @@ /* Prevent inadvertently clearing to end of the X window. */ if (to_x > from_x && to_y > from_y) { - BLOCK_INPUT; + block_input (); FRAME_RIF (f)->clear_frame_area (f, from_x, from_y, to_x - from_x, to_y - from_y); - UNBLOCK_INPUT; + unblock_input (); } } @@ -25801,7 +25802,7 @@ { int i, x; - BLOCK_INPUT; + block_input (); x = 0; for (i = 0; i < row->used[area];) @@ -25829,7 +25830,7 @@ } } - UNBLOCK_INPUT; + unblock_input (); } @@ -26047,7 +26048,7 @@ || (0 <= hpos && hpos < glyph_row->used[TEXT_AREA])) glyph = glyph_row->glyphs[TEXT_AREA] + hpos; - eassert (interrupt_input_blocked); + eassert (input_blocked_p ()); /* Set new_cursor_type to the cursor we want to be displayed. */ new_cursor_type = get_window_cursor_type (w, glyph, @@ -26117,10 +26118,10 @@ if (row->reversed_p && hpos >= row->used[TEXT_AREA]) hpos = row->used[TEXT_AREA] - 1; - BLOCK_INPUT; + block_input (); display_and_set_cursor (w, on, hpos, vpos, w->phys_cursor.x, w->phys_cursor.y); - UNBLOCK_INPUT; + unblock_input (); } } @@ -26298,10 +26299,10 @@ if (row->reversed_p && hpos >= row->used[TEXT_AREA]) hpos = row->used[TEXT_AREA] - 1; - BLOCK_INPUT; + block_input (); display_and_set_cursor (w, 1, hpos, w->phys_cursor.vpos, w->phys_cursor.x, w->phys_cursor.y); - UNBLOCK_INPUT; + unblock_input (); } #endif /* HAVE_WINDOW_SYSTEM */ } @@ -28116,11 +28117,11 @@ Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (XFRAME (w->frame)); Lisp_Object window; - BLOCK_INPUT; + block_input (); XSETWINDOW (window, w); if (EQ (window, hlinfo->mouse_face_window)) clear_mouse_face (hlinfo); - UNBLOCK_INPUT; + unblock_input (); } === modified file 'src/xfaces.c' --- src/xfaces.c 2012-09-15 07:06:56 +0000 +++ src/xfaces.c 2012-09-23 08:44:20 +0000 @@ -605,9 +605,9 @@ x_create_gc (struct frame *f, long unsigned int mask, XGCValues *xgcv) { GC gc; - BLOCK_INPUT; + block_input (); gc = XCreateGC (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), mask, xgcv); - UNBLOCK_INPUT; + unblock_input (); IF_DEBUG (++ngcs); return gc; } @@ -618,7 +618,7 @@ static inline void x_free_gc (struct frame *f, GC gc) { - eassert (interrupt_input_blocked); + eassert (input_blocked_p ()); IF_DEBUG (eassert (--ngcs >= 0)); XFreeGC (FRAME_X_DISPLAY (f), gc); } @@ -632,9 +632,9 @@ x_create_gc (struct frame *f, unsigned long mask, XGCValues *xgcv) { GC gc; - BLOCK_INPUT; + block_input (); gc = XCreateGC (NULL, FRAME_W32_WINDOW (f), mask, xgcv); - UNBLOCK_INPUT; + unblock_input (); IF_DEBUG (++ngcs); return gc; } @@ -907,7 +907,7 @@ CHECK_TYPE (!NILP (Fbitmap_spec_p (name)), Qbitmap_spec_p, name); - BLOCK_INPUT; + block_input (); if (CONSP (name)) { /* Decode a bitmap spec into a bitmap. */ @@ -927,7 +927,7 @@ /* It must be a string -- a file name. */ bitmap_id = x_create_bitmap_from_file (f, name); } - UNBLOCK_INPUT; + unblock_input (); if (bitmap_id < 0) { @@ -1364,9 +1364,9 @@ #ifdef HAVE_X_WINDOWS if (pixel != -1) { - BLOCK_INPUT; + block_input (); x_free_colors (f, &pixel, 1); - UNBLOCK_INPUT; + unblock_input (); } #endif } @@ -1382,7 +1382,7 @@ if (face->colors_copied_bitwise_p) return; - BLOCK_INPUT; + block_input (); if (!face->foreground_defaulted_p) { @@ -1424,7 +1424,7 @@ IF_DEBUG (--ncolors_allocated); } - UNBLOCK_INPUT; + unblock_input (); #endif /* HAVE_X_WINDOWS */ } @@ -3438,10 +3438,10 @@ CHECK_STRING (resource); CHECK_STRING (class); CHECK_LIVE_FRAME (frame); - BLOCK_INPUT; + block_input (); value = display_x_get_resource (FRAME_X_DISPLAY_INFO (XFRAME (frame)), resource, class, Qnil, Qnil); - UNBLOCK_INPUT; + unblock_input (); return value; } @@ -4114,12 +4114,12 @@ free_face_fontset (f, face); if (face->gc) { - BLOCK_INPUT; + block_input (); if (face->font) font_done_for_face (f, face); x_free_gc (f, face->gc); face->gc = 0; - UNBLOCK_INPUT; + unblock_input (); } free_face_colors (f, face); @@ -4153,7 +4153,7 @@ xgcv.graphics_exposures = False; #endif - BLOCK_INPUT; + block_input (); #ifdef HAVE_X_WINDOWS if (face->stipple) { @@ -4165,7 +4165,7 @@ face->gc = x_create_gc (f, mask, &xgcv); if (face->font) font_prepare_for_face (f, face); - UNBLOCK_INPUT; + unblock_input (); } #endif /* HAVE_WINDOW_SYSTEM */ } @@ -4263,12 +4263,12 @@ struct face *face = c->faces_by_id[i]; if (face && face->gc) { - BLOCK_INPUT; + block_input (); if (face->font) font_done_for_face (c->f, face); x_free_gc (c->f, face->gc); face->gc = 0; - UNBLOCK_INPUT; + unblock_input (); } } #endif /* HAVE_WINDOW_SYSTEM */ @@ -4292,7 +4292,7 @@ /* We must block input here because we can't process X events safely while only some faces are freed, or when the frame's current matrix still references freed faces. */ - BLOCK_INPUT; + block_input (); for (i = 0; i < c->used; ++i) { @@ -4314,7 +4314,7 @@ ++windows_or_buffers_changed; } - UNBLOCK_INPUT; + unblock_input (); } } @@ -5275,7 +5275,7 @@ /* Block input here so that we won't be surprised by an X expose event, for instance, without having the faces set up. */ - BLOCK_INPUT; + block_input (); specbind (Qscalable_fonts_allowed, Qt); if (realize_default_face (f)) @@ -5306,7 +5306,7 @@ } unbind_to (count, Qnil); - UNBLOCK_INPUT; + unblock_input (); return success_p; } @@ -6352,7 +6352,7 @@ int red, green, blue; int num; - BLOCK_INPUT; + block_input (); while (fgets (buf, sizeof (buf), fp) != NULL) { if (sscanf (buf, "%u %u %u %n", &red, &green, &blue, &num) == 3) @@ -6372,7 +6372,7 @@ } fclose (fp); - UNBLOCK_INPUT; + unblock_input (); } return cmap; === modified file 'src/xfns.c' --- src/xfns.c 2012-09-15 07:06:56 +0000 +++ src/xfns.c 2012-09-23 08:44:20 +0000 @@ -425,7 +425,7 @@ unsigned char *tmp_data = NULL; Atom target_type = XA_CARDINAL; - BLOCK_INPUT; + block_input (); x_catch_errors (dpy); @@ -543,7 +543,7 @@ x_uncatch_errors (); - UNBLOCK_INPUT; + unblock_input (); if (had_errors) return; @@ -587,7 +587,7 @@ Display *dpy = FRAME_X_DISPLAY (f); Colormap cmap = FRAME_X_COLORMAP (f); - BLOCK_INPUT; + block_input (); #ifdef USE_GTK success_p = xg_check_special_colors (f, color_name, color); #endif @@ -595,7 +595,7 @@ success_p = XParseColor (dpy, cmap, color_name, color); if (success_p && alloc_p) success_p = x_alloc_nearest_color (f, cmap, color); - UNBLOCK_INPUT; + unblock_input (); return success_p; } @@ -679,7 +679,7 @@ GdkPixbuf *pixbuf; GError *err = NULL; char *filename = SSDATA (found); - BLOCK_INPUT; + block_input (); pixbuf = gdk_pixbuf_new_from_file (filename, &err); @@ -694,7 +694,7 @@ else g_error_free (err); - UNBLOCK_INPUT; + unblock_input (); } return result; @@ -737,7 +737,7 @@ { Display *dpy = FRAME_X_DISPLAY (f); - BLOCK_INPUT; + block_input (); XSetForeground (dpy, x->normal_gc, fg); XSetBackground (dpy, x->reverse_gc, fg); @@ -748,7 +748,7 @@ XSetBackground (dpy, x->cursor_gc, x->cursor_pixel); } - UNBLOCK_INPUT; + unblock_input (); update_face_from_frame_parameter (f, Qforeground_color, arg); @@ -773,7 +773,7 @@ { Display *dpy = FRAME_X_DISPLAY (f); - BLOCK_INPUT; + block_input (); XSetBackground (dpy, x->normal_gc, bg); XSetForeground (dpy, x->reverse_gc, bg); XSetWindowBackground (dpy, FRAME_X_WINDOW (f), bg); @@ -797,7 +797,7 @@ } #endif /* USE_TOOLKIT_SCROLL_BARS */ - UNBLOCK_INPUT; + unblock_input (); update_face_from_frame_parameter (f, Qbackground_color, arg); if (FRAME_VISIBLE_P (f)) @@ -854,7 +854,7 @@ unload_color (f, x->mouse_pixel); x->mouse_pixel = pixel; - BLOCK_INPUT; + block_input (); /* It's not okay to crash if the user selects a screwy cursor. */ x_catch_errors (dpy); @@ -974,7 +974,7 @@ x->horizontal_drag_cursor = horizontal_drag_cursor; XFlush (dpy); - UNBLOCK_INPUT; + unblock_input (); update_face_from_frame_parameter (f, Qmouse_color, arg); } @@ -1031,10 +1031,10 @@ if (FRAME_X_WINDOW (f) != 0) { - BLOCK_INPUT; + block_input (); XSetBackground (FRAME_X_DISPLAY (f), x->cursor_gc, x->cursor_pixel); XSetForeground (FRAME_X_DISPLAY (f), x->cursor_gc, fore_pixel); - UNBLOCK_INPUT; + unblock_input (); if (FRAME_VISIBLE_P (f)) { @@ -1058,9 +1058,9 @@ if (FRAME_X_WINDOW (f) != 0 && f->border_width > 0) { - BLOCK_INPUT; + block_input (); XSetWindowBorder (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), pix); - UNBLOCK_INPUT; + unblock_input (); if (FRAME_VISIBLE_P (f)) redraw_frame (f); @@ -1112,7 +1112,7 @@ else if (!STRINGP (oldval) && EQ (oldval, Qnil) == EQ (arg, Qnil)) return; - BLOCK_INPUT; + block_input (); if (NILP (arg)) result = x_text_icon (f, SSDATA ((!NILP (f->icon_name) @@ -1123,12 +1123,12 @@ if (result) { - UNBLOCK_INPUT; + unblock_input (); error ("No icon window available"); } XFlush (FRAME_X_DISPLAY (f)); - UNBLOCK_INPUT; + unblock_input (); } static void @@ -1149,7 +1149,7 @@ if (f->output_data.x->icon_bitmap != 0) return; - BLOCK_INPUT; + block_input (); result = x_text_icon (f, SSDATA ((!NILP (f->icon_name) @@ -1160,12 +1160,12 @@ if (result) { - UNBLOCK_INPUT; + unblock_input (); error ("No icon window available"); } XFlush (FRAME_X_DISPLAY (f)); - UNBLOCK_INPUT; + unblock_input (); } @@ -1228,10 +1228,10 @@ { y = FRAME_TOP_MARGIN_HEIGHT (f); - BLOCK_INPUT; + block_input (); x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 0, y, width, height, False); - UNBLOCK_INPUT; + unblock_input (); } if (nlines > 1 && nlines > olines) @@ -1239,10 +1239,10 @@ y = (olines == 0 ? 1 : olines) * FRAME_LINE_HEIGHT (f); height = nlines * FRAME_LINE_HEIGHT (f) - y; - BLOCK_INPUT; + block_input (); x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 0, y, width, height, False); - UNBLOCK_INPUT; + unblock_input (); } if (nlines == 0 && WINDOWP (f->menu_bar_window)) @@ -1338,10 +1338,10 @@ /* height can be zero here. */ if (height > 0 && width > 0) { - BLOCK_INPUT; + block_input (); x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 0, y, width, height, False); - UNBLOCK_INPUT; + unblock_input (); } if (WINDOWP (f->tool_bar_window)) @@ -1494,7 +1494,7 @@ { if (FRAME_X_WINDOW (f)) { - BLOCK_INPUT; + block_input (); { XTextProperty text, icon; ptrdiff_t bytes; @@ -1586,7 +1586,7 @@ if (do_free_text_value) xfree (text.value); } - UNBLOCK_INPUT; + unblock_input (); } } @@ -1779,7 +1779,7 @@ int need_focus = 1; int need_save = 1; - BLOCK_INPUT; + block_input (); { Atom type; unsigned char *catoms; @@ -1827,7 +1827,7 @@ XA_ATOM, 32, PropModeAppend, (unsigned char *) props, count); } - UNBLOCK_INPUT; + unblock_input (); } #endif @@ -2350,7 +2350,7 @@ Arg al [25]; int ac; - BLOCK_INPUT; + block_input (); /* Use the resource name as the top-level widget name for looking up resources. Make a non-Lisp copy @@ -2572,7 +2572,7 @@ f->output_data.x->current_cursor = f->output_data.x->text_cursor); - UNBLOCK_INPUT; + unblock_input (); /* This is a no-op, except under Motif. Make sure main areas are set to something reasonable, in case we get an error later. */ @@ -2591,7 +2591,7 @@ FRAME_XIC (f) = NULL; if (use_xim) { - BLOCK_INPUT; + block_input (); create_frame_xic (f); if (FRAME_XIC (f)) { @@ -2613,7 +2613,7 @@ attribute_mask, &attributes); } } - UNBLOCK_INPUT; + unblock_input (); } #endif } @@ -2638,7 +2638,7 @@ attribute_mask = (CWBackPixel | CWBorderPixel | CWBitGravity | CWEventMask | CWColormap); - BLOCK_INPUT; + block_input (); FRAME_X_WINDOW (f) = XCreateWindow (FRAME_X_DISPLAY (f), f->output_data.x->parent_desc, @@ -2715,7 +2715,7 @@ f->output_data.x->current_cursor = f->output_data.x->text_cursor); - UNBLOCK_INPUT; + unblock_input (); if (FRAME_X_WINDOW (f) == 0) error ("Unable to create window"); @@ -2768,7 +2768,7 @@ else if (!EQ (icon_x, Qunbound) || !EQ (icon_y, Qunbound)) error ("Both left and top icon corners of icon must be specified"); - BLOCK_INPUT; + block_input (); if (! EQ (icon_x, Qunbound)) x_wm_set_icon_position (f, XINT (icon_x), XINT (icon_y)); @@ -2787,7 +2787,7 @@ ? f->icon_name : f->name))); - UNBLOCK_INPUT; + unblock_input (); } /* Make the GCs needed for this window, setting the @@ -2799,7 +2799,7 @@ { XGCValues gc_values; - BLOCK_INPUT; + block_input (); /* Create the GCs of this frame. Note that many default values are used. */ @@ -2847,7 +2847,7 @@ FRAME_BACKGROUND_PIXEL (f), DefaultDepth (FRAME_X_DISPLAY (f), FRAME_X_SCREEN_NUMBER (f)))); - UNBLOCK_INPUT; + unblock_input (); } @@ -2858,7 +2858,7 @@ { Display *dpy = FRAME_X_DISPLAY (f); - BLOCK_INPUT; + block_input (); if (f->output_data.x->normal_gc) { @@ -2884,7 +2884,7 @@ f->output_data.x->border_tile = 0; } - UNBLOCK_INPUT; + unblock_input (); } @@ -3007,10 +3007,10 @@ if (NILP (frame)) frame = selected_frame; f = XFRAME (frame); - BLOCK_INPUT; + block_input (); if (FRAME_X_P (f)) x_wm_set_size_hint (f, 0, 0); - UNBLOCK_INPUT; + unblock_input (); return Qnil; } @@ -3405,9 +3405,9 @@ /* Tell the server what size and position, etc, we want, and how badly we want them. This should be done after we have the menu bar so that its size can be taken into account. */ - BLOCK_INPUT; + block_input (); x_wm_set_size_hint (f, window_prompting, 0); - UNBLOCK_INPUT; + unblock_input (); /* Make the window appear on the frame and enable display, unless the caller says not to. However, with explicit parent, Emacs @@ -3431,7 +3431,7 @@ } } - BLOCK_INPUT; + block_input (); /* Set machine name and pid for the purpose of window managers. */ set_machine_and_pid_properties (f); @@ -3447,7 +3447,7 @@ (unsigned char *) &dpyinfo->client_leader_window, 1); } - UNBLOCK_INPUT; + unblock_input (); /* Initialize `default-minibuffer-frame' in case this is the first frame on this terminal. */ @@ -3506,7 +3506,7 @@ struct frame *f = check_x_frame (frame); Display *dpy = FRAME_X_DISPLAY (f); - BLOCK_INPUT; + block_input (); x_catch_errors (dpy); if (FRAME_X_EMBEDDED_P (f)) @@ -3524,7 +3524,7 @@ } x_uncatch_errors (); - UNBLOCK_INPUT; + unblock_input (); return Qnil; } @@ -4152,9 +4152,9 @@ void x_sync (FRAME_PTR f) { - BLOCK_INPUT; + block_input (); XSync (FRAME_X_DISPLAY (f), False); - UNBLOCK_INPUT; + unblock_input (); } @@ -4229,7 +4229,7 @@ nelements = SBYTES (value); } - BLOCK_INPUT; + block_input (); prop_atom = XInternAtom (FRAME_X_DISPLAY (f), SSDATA (prop), False); if (! NILP (type)) { @@ -4248,7 +4248,7 @@ /* Make sure the property is set when we return. */ XFlush (FRAME_X_DISPLAY (f)); - UNBLOCK_INPUT; + unblock_input (); return value; } @@ -4264,13 +4264,13 @@ Atom prop_atom; CHECK_STRING (prop); - BLOCK_INPUT; + block_input (); prop_atom = XInternAtom (FRAME_X_DISPLAY (f), SSDATA (prop), False); XDeleteProperty (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), prop_atom); /* Make sure the property is removed when we return. */ XFlush (FRAME_X_DISPLAY (f)); - UNBLOCK_INPUT; + unblock_input (); return prop; } @@ -4318,7 +4318,7 @@ target_window = FRAME_X_DISPLAY_INFO (f)->root_window; } - BLOCK_INPUT; + block_input (); if (STRINGP (type)) { if (strcmp ("AnyPropertyType", SSDATA (type)) == 0) @@ -4384,7 +4384,7 @@ if (tmp_data) XFree (tmp_data); } - UNBLOCK_INPUT; + unblock_input (); UNGCPRO; return prop_value; } @@ -4415,7 +4415,7 @@ { Lisp_Object rest, frame; - BLOCK_INPUT; + block_input (); FOR_EACH_FRAME (rest, frame) { @@ -4459,7 +4459,7 @@ } hourglass_shown_p = 1; - UNBLOCK_INPUT; + unblock_input (); } } @@ -4474,7 +4474,7 @@ { Lisp_Object rest, frame; - BLOCK_INPUT; + block_input (); FOR_EACH_FRAME (rest, frame) { struct frame *f = XFRAME (frame); @@ -4493,7 +4493,7 @@ } hourglass_shown_p = 0; - UNBLOCK_INPUT; + unblock_input (); } } @@ -4743,7 +4743,7 @@ unsigned long mask; Atom type = FRAME_X_DISPLAY_INFO (f)->Xatom_net_window_type_tooltip; - BLOCK_INPUT; + block_input (); mask = CWBackPixel | CWOverrideRedirect | CWEventMask; if (DoesSaveUnders (dpyinfo->screen)) mask |= CWSaveUnder; @@ -4770,7 +4770,7 @@ FRAME_X_DISPLAY_INFO (f)->Xatom_net_window_type, XA_ATOM, 32, PropModeReplace, (unsigned char *)&type, 1); - UNBLOCK_INPUT; + unblock_input (); } x_make_gc (f); @@ -4884,10 +4884,10 @@ show it. */ if (!INTEGERP (left) || !INTEGERP (top)) { - BLOCK_INPUT; + block_input (); XQueryPointer (FRAME_X_DISPLAY (f), FRAME_X_DISPLAY_INFO (f)->root_window, &root, &child, root_x, root_y, &win_x, &win_y, &pmask); - UNBLOCK_INPUT; + unblock_input (); } if (INTEGERP (top)) @@ -4990,7 +4990,7 @@ /* Hide a previous tip, if any. */ Fx_hide_tip (); - BLOCK_INPUT; + block_input (); if ((ok = xg_prepare_tooltip (f, string, &width, &height)) != 0) { compute_tip_xy (f, parms, dx, dy, width, height, &root_x, &root_y); @@ -4998,7 +4998,7 @@ /* This is used in Fx_hide_tip. */ XSETFRAME (tip_frame, f); } - UNBLOCK_INPUT; + unblock_input (); if (ok) goto start_timer; } #endif /* USE_GTK */ @@ -5026,12 +5026,12 @@ call1 (Qcancel_timer, timer); } - BLOCK_INPUT; + block_input (); compute_tip_xy (tip_f, parms, dx, dy, FRAME_PIXEL_WIDTH (tip_f), FRAME_PIXEL_HEIGHT (tip_f), &root_x, &root_y); XMoveWindow (FRAME_X_DISPLAY (tip_f), FRAME_X_WINDOW (tip_f), root_x, root_y); - UNBLOCK_INPUT; + unblock_input (); goto start_timer; } } @@ -5185,11 +5185,11 @@ show it. */ compute_tip_xy (f, parms, dx, dy, width, height, &root_x, &root_y); - BLOCK_INPUT; + block_input (); XMoveResizeWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), root_x, root_y, width, height); XMapRaised (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f)); - UNBLOCK_INPUT; + unblock_input (); /* Draw into the window. */ w->must_be_updated_p = 1; @@ -5261,9 +5261,9 @@ if (!DoesSaveUnders (FRAME_X_DISPLAY_INFO (f)->screen) && w != NULL) { - BLOCK_INPUT; + block_input (); xlwmenu_redisplay (w); - UNBLOCK_INPUT; + unblock_input (); } } #endif /* USE_LUCID */ @@ -5327,11 +5327,11 @@ Widget dialog = (Widget) p->pointer; /* Clean up. */ - BLOCK_INPUT; + block_input (); XtUnmanageChild (dialog); XtDestroyWidget (dialog); x_menu_set_in_use (0); - UNBLOCK_INPUT; + unblock_input (); return Qnil; } @@ -5372,7 +5372,7 @@ /* Prevent redisplay. */ specbind (Qinhibit_redisplay, Qt); - BLOCK_INPUT; + block_input (); /* Create the dialog with PROMPT as title, using DIR as initial directory and using "*" as pattern. */ @@ -5486,7 +5486,7 @@ else file = Qnil; - UNBLOCK_INPUT; + unblock_input (); UNGCPRO; /* Make "Cancel" equivalent to C-g. */ @@ -5543,7 +5543,7 @@ specbind (Qinhibit_redisplay, Qt); record_unwind_protect (clean_up_dialog, Qnil); - BLOCK_INPUT; + block_input (); if (STRINGP (default_filename)) cdef_file = SSDATA (default_filename); @@ -5560,7 +5560,7 @@ xfree (fn); } - UNBLOCK_INPUT; + unblock_input (); UNGCPRO; /* Make "Cancel" equivalent to C-g. */ @@ -5600,7 +5600,7 @@ specbind (Qinhibit_redisplay, Qt); record_unwind_protect (clean_up_dialog, Qnil); - BLOCK_INPUT; + block_input (); GCPRO2 (font_param, font); @@ -5618,7 +5618,7 @@ font = xg_get_font (f, default_name); xfree (default_name); - UNBLOCK_INPUT; + unblock_input (); if (NILP (font)) Fsignal (Qquit, Qnil); @@ -5655,14 +5655,14 @@ Lisp_Object have_keys; int major, minor, op, event, error_code; - BLOCK_INPUT; + block_input (); /* Check library version in case we're dynamically linked. */ major = XkbMajorVersion; minor = XkbMinorVersion; if (!XkbLibraryVersion (&major, &minor)) { - UNBLOCK_INPUT; + unblock_input (); return Qlambda; } @@ -5671,7 +5671,7 @@ minor = XkbMinorVersion; if (!XkbQueryExtension (dpy, &op, &event, &error_code, &major, &minor)) { - UNBLOCK_INPUT; + unblock_input (); return Qlambda; } @@ -5724,7 +5724,7 @@ && XKeysymToKeycode (dpy, XK_BackSpace) == backspace_keycode) have_keys = Qt; } - UNBLOCK_INPUT; + unblock_input (); return have_keys; #else /* not HAVE_XKBGETKEYBOARD */ return Qlambda; === modified file 'src/xfont.c' --- src/xfont.c 2012-09-15 07:06:56 +0000 +++ src/xfont.c 2012-09-23 08:44:20 +0000 @@ -362,7 +362,7 @@ } } - BLOCK_INPUT; + block_input (); x_catch_errors (display); for (limit = 512; ; limit *= 2) @@ -479,7 +479,7 @@ } x_uncatch_errors (); - UNBLOCK_INPUT; + unblock_input (); FONT_ADD_LOG ("xfont-list", build_string (pattern), list); return list; @@ -588,7 +588,7 @@ if (xfont_encode_coding_xlfd (name) < 0) return Qnil; - BLOCK_INPUT; + block_input (); entity = Qnil; xfont = XLoadQueryFont (display, name); if (xfont) @@ -615,7 +615,7 @@ } XFreeFont (display, xfont); } - UNBLOCK_INPUT; + unblock_input (); FONT_ADD_LOG ("xfont-match", spec, entity); return entity; @@ -632,7 +632,7 @@ char *last_family IF_LINT (= 0); int last_len; - BLOCK_INPUT; + block_input (); x_catch_errors (dpyinfo->display); names = XListFonts (dpyinfo->display, "-*-*-*-*-*-*-*-*-*-*-*-*-*-*", 0x8000, &num_fonts); @@ -673,7 +673,7 @@ XFreeFontNames (names); x_uncatch_errors (); - UNBLOCK_INPUT; + unblock_input (); return list; } @@ -717,7 +717,7 @@ return Qnil; } - BLOCK_INPUT; + block_input (); x_catch_errors (display); xfont = XLoadQueryFont (display, name); if (x_had_errors_p (display)) @@ -784,7 +784,7 @@ XFree (p0); } x_uncatch_errors (); - UNBLOCK_INPUT; + unblock_input (); if (! xfont) { @@ -866,7 +866,7 @@ } } - BLOCK_INPUT; + block_input (); font->underline_thickness = (XGetFontProperty (xfont, XA_UNDERLINE_THICKNESS, &value) ? (long) value : 0); @@ -882,7 +882,7 @@ font->default_ascent = (XGetFontProperty (xfont, dpyinfo->Xatom_MULE_DEFAULT_ASCENT, &value) ? (long) value : 0); - UNBLOCK_INPUT; + unblock_input (); if (NILP (fullname)) fullname = AREF (font_object, FONT_NAME_INDEX); @@ -897,18 +897,18 @@ static void xfont_close (FRAME_PTR f, struct font *font) { - BLOCK_INPUT; + block_input (); XFreeFont (FRAME_X_DISPLAY (f), ((struct xfont_info *) font)->xfont); - UNBLOCK_INPUT; + unblock_input (); } static int xfont_prepare_face (FRAME_PTR f, struct face *face) { - BLOCK_INPUT; + block_input (); XSetFont (FRAME_X_DISPLAY (f), face->gc, ((struct xfont_info *) face->font)->xfont->fid); - UNBLOCK_INPUT; + unblock_input (); return 0; } @@ -1028,9 +1028,9 @@ if (s->gc != s->face->gc) { - BLOCK_INPUT; + block_input (); XSetFont (s->display, gc, xfont->fid); - UNBLOCK_INPUT; + unblock_input (); } if (xfont->min_byte1 == 0 && xfont->max_byte1 == 0) @@ -1039,7 +1039,7 @@ char *str = SAFE_ALLOCA (len); for (i = 0; i < len ; i++) str[i] = XCHAR2B_BYTE2 (s->char2b + from + i); - BLOCK_INPUT; + block_input (); if (with_background) { if (s->padding_p) @@ -1060,12 +1060,12 @@ XDrawString (FRAME_X_DISPLAY (s->f), FRAME_X_WINDOW (s->f), gc, x, y, str, len); } - UNBLOCK_INPUT; + unblock_input (); SAFE_FREE (); return s->nchars; } - BLOCK_INPUT; + block_input (); if (with_background) { if (s->padding_p) @@ -1086,7 +1086,7 @@ XDrawString16 (FRAME_X_DISPLAY (s->f), FRAME_X_WINDOW (s->f), gc, x, y, s->char2b + from, len); } - UNBLOCK_INPUT; + unblock_input (); return len; } === modified file 'src/xftfont.c' --- src/xftfont.c 2012-09-15 07:06:56 +0000 +++ src/xftfont.c 2012-09-23 08:44:20 +0000 @@ -93,7 +93,7 @@ XGCValues xgcv; bool fg_done = 0, bg_done = 0; - BLOCK_INPUT; + block_input (); XGetGCValues (FRAME_X_DISPLAY (f), gc, GCForeground | GCBackground, &xgcv); if (xftface_info) @@ -131,7 +131,7 @@ bg->color.blue = colors[1].blue; } } - UNBLOCK_INPUT; + unblock_input (); } } @@ -324,7 +324,7 @@ FcPatternAddInteger (pat, FC_INDEX, XINT (idx)); - BLOCK_INPUT; + block_input (); /* Make sure that the Xrender extension is added before the Xft one. Otherwise, the close-display hook set by Xft is called after the one for Xrender, and the former tries to re-add the latter. This @@ -345,12 +345,12 @@ xftfont = XftFontOpenPattern (display, match); if (!xftfont) { - UNBLOCK_INPUT; + unblock_input (); XftPatternDestroy (match); return Qnil; } ft_face = XftLockFace (xftfont); - UNBLOCK_INPUT; + unblock_input (); /* We should not destroy PAT here because it is kept in XFTFONT and destroyed automatically when XFTFONT is closed. */ @@ -399,7 +399,7 @@ for (ch = 0; ch < 95; ch++) ascii_printable[ch] = ' ' + ch; } - BLOCK_INPUT; + block_input (); /* Unfortunately Xft doesn't provide a way to get minimum char width. So, we set min_width to space_width. */ @@ -425,7 +425,7 @@ XftTextExtents8 (display, xftfont, ascii_printable + 1, 94, &extents); font->average_width = (font->space_width + extents.xOff) / 95; } - UNBLOCK_INPUT; + unblock_input (); font->ascent = xftfont->ascent; font->descent = xftfont->descent; @@ -494,10 +494,10 @@ if (xftfont_info->otf) OTF_close (xftfont_info->otf); #endif - BLOCK_INPUT; + block_input (); XftUnlockFace (xftfont_info->xftfont); XftFontClose (xftfont_info->display, xftfont_info->xftfont); - UNBLOCK_INPUT; + unblock_input (); } static int @@ -581,10 +581,10 @@ struct xftfont_info *xftfont_info = (struct xftfont_info *) font; XGlyphInfo extents; - BLOCK_INPUT; + block_input (); XftGlyphExtents (xftfont_info->display, xftfont_info->xftfont, code, nglyphs, &extents); - UNBLOCK_INPUT; + unblock_input (); if (metrics) { metrics->lbearing = - extents.x; @@ -603,12 +603,12 @@ if (! xft_draw) { - BLOCK_INPUT; + block_input (); xft_draw= XftDrawCreate (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), FRAME_X_VISUAL (f), FRAME_X_COLORMAP (f)); - UNBLOCK_INPUT; + unblock_input (); eassert (xft_draw != NULL); font_put_frame_data (f, &xftfont_driver, xft_draw); } @@ -633,7 +633,7 @@ xftface_info = (struct xftface_info *) face->extra; xftfont_get_colors (f, face, s->gc, xftface_info, &fg, with_background ? &bg : NULL); - BLOCK_INPUT; + block_input (); if (s->num_clips > 0) XftDrawSetClipRectangles (xft_draw, 0, 0, s->clip, s->num_clips); else @@ -654,7 +654,7 @@ else XftDrawGlyphs (xft_draw, &fg, xftfont_info->xftfont, x, y, code, len); - UNBLOCK_INPUT; + unblock_input (); return len; } @@ -690,9 +690,9 @@ if (xft_draw) { - BLOCK_INPUT; + block_input (); XftDrawDestroy (xft_draw); - UNBLOCK_INPUT; + unblock_input (); font_put_frame_data (f, &xftfont_driver, NULL); } return 0; === modified file 'src/xmenu.c' --- src/xmenu.c 2012-09-15 07:06:56 +0000 +++ src/xmenu.c 2012-09-23 08:44:20 +0000 @@ -165,7 +165,7 @@ if (! FRAME_X_P (f)) emacs_abort (); - BLOCK_INPUT; + block_input (); XQueryPointer (FRAME_X_DISPLAY (f), DefaultRootWindow (FRAME_X_DISPLAY (f)), @@ -186,7 +186,7 @@ we don't care. */ (unsigned int *) &dummy); - UNBLOCK_INPUT; + unblock_input (); /* xmenu_show expects window coordinates, not root window coordinates. Translate. */ @@ -328,9 +328,9 @@ list_of_panes (Fcons (contents, Qnil)); /* Display them in a dialog box. */ - BLOCK_INPUT; + block_input (); selection = xdialog_show (f, 0, title, header, &error_name); - UNBLOCK_INPUT; + unblock_input (); unbind_to (specpdl_count, Qnil); discard_menu_items (); @@ -490,7 +490,7 @@ XEvent ev; FRAME_PTR f = check_x_frame (frame); Widget menubar; - BLOCK_INPUT; + block_input (); if (FRAME_EXTERNAL_MENU_BAR (f)) set_frame_menubar (f, 0, 1); @@ -548,7 +548,7 @@ } } - UNBLOCK_INPUT; + unblock_input (); return Qnil; } @@ -569,9 +569,9 @@ FRAME_PTR f; /* gcc 2.95 doesn't accept the FRAME_PTR declaration after - BLOCK_INPUT. */ + block_input (). */ - BLOCK_INPUT; + block_input (); f = check_x_frame (frame); if (FRAME_EXTERNAL_MENU_BAR (f)) @@ -590,7 +590,7 @@ g_list_free (children); } } - UNBLOCK_INPUT; + unblock_input (); return Qnil; } @@ -642,7 +642,7 @@ #endif set_frame_menubar (f, 0, 1); - BLOCK_INPUT; + block_input (); popup_activated_flag = 1; #ifdef USE_GTK XPutBackEvent (f->output_data.x->display_info->display, @@ -650,7 +650,7 @@ #else XtDispatchEvent (f->output_data.x->saved_menu_event); #endif - UNBLOCK_INPUT; + unblock_input (); /* Ignore this if we get it a second time. */ f->output_data.x->saved_menu_event->type = 0; @@ -803,10 +803,10 @@ sit-for will exit at once if the focus event follows the menu selection event. */ - BLOCK_INPUT; + block_input (); while (gtk_events_pending ()) gtk_main_iteration (); - UNBLOCK_INPUT; + unblock_input (); find_and_call_menu_selection (cb_data->cl_data->f, cb_data->cl_data->menu_bar_items_used, @@ -853,7 +853,7 @@ if (!x->menubar_widget || XtIsManaged (x->menubar_widget)) return 0; - BLOCK_INPUT; + block_input (); /* Save the size of the frame because the pane widget doesn't accept to resize itself. So force it. */ columns = FRAME_COLS (f); @@ -880,7 +880,7 @@ /* Force the pane widget to resize itself with the right values. */ EmacsFrameSetCharSize (x->edit_widget, columns, rows); - UNBLOCK_INPUT; + unblock_input (); #endif return 1; } @@ -1164,7 +1164,7 @@ /* Create or update the menu bar widget. */ - BLOCK_INPUT; + block_input (); #ifdef USE_GTK xg_crazy_callback_abort = 1; @@ -1264,7 +1264,7 @@ xg_crazy_callback_abort = 0; #endif - UNBLOCK_INPUT; + unblock_input (); } /* Called from Fx_create_frame to create the initial menubar of a frame @@ -1313,7 +1313,7 @@ Position x0, y0, x1, y1; #endif - BLOCK_INPUT; + block_input (); #ifdef USE_MOTIF if (f->output_data.x->widget) @@ -1332,7 +1332,7 @@ #endif x_set_window_size (f, 0, FRAME_COLS (f), FRAME_LINES (f)); } - UNBLOCK_INPUT; + unblock_input (); } } #endif /* not USE_GTK */ @@ -1417,9 +1417,9 @@ struct Lisp_Save_Value *p = XSAVE_VALUE (arg); popup_activated_flag = 0; - BLOCK_INPUT; + block_input (); gtk_widget_destroy (GTK_WIDGET (p->pointer)); - UNBLOCK_INPUT; + unblock_input (); return Qnil; } @@ -1527,9 +1527,9 @@ LWLIB_ID id = (XINT (XCAR (arg)) << 4 * sizeof (LWLIB_ID) | XINT (XCDR (arg))); - BLOCK_INPUT; + block_input (); lw_destroy_all_widgets (id); - UNBLOCK_INPUT; + unblock_input (); popup_activated_flag = 0; return Qnil; @@ -1955,9 +1955,9 @@ if ((intptr_t) client_data != -1) menu_item_selection = (Lisp_Object *) client_data; - BLOCK_INPUT; + block_input (); lw_destroy_all_widgets (id); - UNBLOCK_INPUT; + unblock_input (); popup_activated_flag = 0; } @@ -2251,7 +2251,7 @@ FRAME_PTR f = p1->pointer; XMenu *menu = p2->pointer; - BLOCK_INPUT; + block_input (); #ifndef MSDOS XUngrabPointer (FRAME_X_DISPLAY (f), CurrentTime); XUngrabKeyboard (FRAME_X_DISPLAY (f), CurrentTime); @@ -2271,7 +2271,7 @@ #endif /* HAVE_X_WINDOWS */ - UNBLOCK_INPUT; + unblock_input (); return Qnil; } === modified file 'src/xselect.c' --- src/xselect.c 2012-09-15 07:06:56 +0000 +++ src/xselect.c 2012-09-23 08:44:20 +0000 @@ -247,9 +247,9 @@ if (!SYMBOLP (sym)) emacs_abort (); TRACE1 (" XInternAtom %s", SSDATA (SYMBOL_NAME (sym))); - BLOCK_INPUT; + block_input (); val = XInternAtom (dpyinfo->display, SSDATA (SYMBOL_NAME (sym)), False); - UNBLOCK_INPUT; + unblock_input (); return val; } @@ -307,16 +307,16 @@ if (atom == dpyinfo->Xatom_NULL) return QNULL; - BLOCK_INPUT; + block_input (); str = XGetAtomName (dpy, atom); - UNBLOCK_INPUT; + unblock_input (); TRACE1 ("XGetAtomName --> %s", str); if (! str) return Qnil; val = intern (str); - BLOCK_INPUT; + block_input (); /* This was allocated by Xlib, so use XFree. */ XFree (str); - UNBLOCK_INPUT; + unblock_input (); return val; } @@ -336,12 +336,12 @@ Time timestamp = last_event_timestamp; Atom selection_atom = symbol_to_x_atom (dpyinfo, selection_name); - BLOCK_INPUT; + block_input (); x_catch_errors (display); XSetSelectionOwner (display, selection_atom, selecting_window, timestamp); x_check_errors (display, "Can't set selection: %s"); x_uncatch_errors (); - UNBLOCK_INPUT; + unblock_input (); /* Now update the local cache */ { @@ -469,12 +469,12 @@ /* The reason for the error may be that the receiver has died in the meantime. Handle that case. */ - BLOCK_INPUT; + block_input (); x_catch_errors (reply->display); XSendEvent (reply->display, reply->requestor, False, 0L, &reply_base); XFlush (reply->display); x_uncatch_errors (); - UNBLOCK_INPUT; + unblock_input (); } /* This is the selection request currently being processed. @@ -536,9 +536,9 @@ static Lisp_Object x_catch_errors_unwind (Lisp_Object dummy) { - BLOCK_INPUT; + block_input (); x_uncatch_errors (); - UNBLOCK_INPUT; + unblock_input (); return Qnil; } @@ -610,7 +610,7 @@ if (reply->property == None) reply->property = reply->target; - BLOCK_INPUT; + block_input (); /* The protected block contains wait_for_property_change, which can run random lisp code (process handlers) or signal. Therefore, we put the x_uncatch_errors call in an unwind. */ @@ -682,7 +682,7 @@ { int format_bytes = cs->format / 8; int had_errors = x_had_errors_p (display); - UNBLOCK_INPUT; + unblock_input (); bytes_remaining = cs->size; bytes_remaining *= format_bytes; @@ -703,7 +703,7 @@ int i = ((bytes_remaining < max_bytes) ? bytes_remaining : max_bytes) / format_bytes; - BLOCK_INPUT; + block_input (); cs->wait_object = expect_property_change (display, window, cs->property, @@ -722,7 +722,7 @@ : format_bytes); XFlush (display); had_errors = x_had_errors_p (display); - UNBLOCK_INPUT; + unblock_input (); if (had_errors) break; @@ -735,7 +735,7 @@ /* Now write a zero-length chunk to the property to tell the requestor that we're done. */ - BLOCK_INPUT; + block_input (); if (! waiting_for_other_props_on_window (display, window)) XSelectInput (display, window, 0L); @@ -757,15 +757,15 @@ /* 2004-09-10: XSync and UNBLOCK so that possible protocol errors are delivered before uncatch errors. */ XSync (display, False); - UNBLOCK_INPUT; + unblock_input (); /* GTK queues events in addition to the queue in Xlib. So we UNBLOCK to enter the event loop and get possible errors delivered, and then BLOCK again because x_uncatch_errors requires it. */ - BLOCK_INPUT; + block_input (); /* This calls x_uncatch_errors. */ unbind_to (count, Qnil); - UNBLOCK_INPUT; + unblock_input (); } /* Handle a SelectionRequest event EVENT. @@ -1232,7 +1232,7 @@ if (! NILP (time_stamp)) CONS_TO_INTEGER (time_stamp, Time, requestor_time); - BLOCK_INPUT; + block_input (); TRACE2 ("Get selection %s, type %s", XGetAtomName (display, type_atom), XGetAtomName (display, target_property)); @@ -1257,7 +1257,7 @@ record_unwind_protect (queue_selection_requests_unwind, Qnil); #endif - UNBLOCK_INPUT; + unblock_input (); /* This allows quits. Also, don't wait forever. */ timeout = max (0, x_selection_timeout); @@ -1309,7 +1309,7 @@ ? min (PTRDIFF_MAX, SIZE_MAX) - 1 : LONG_MAX * x_long_size); - BLOCK_INPUT; + block_input (); /* First probe the thing to find out how big it is. */ result = XGetWindowProperty (display, window, property, @@ -1410,19 +1410,19 @@ data[offset] = '\0'; done: - UNBLOCK_INPUT; + unblock_input (); *data_ret = data; *bytes_ret = offset; return; size_overflow: free (data); - UNBLOCK_INPUT; + unblock_input (); memory_full (SIZE_MAX); memory_exhausted: free (data); - UNBLOCK_INPUT; + unblock_input (); memory_full (total_size + 1); } @@ -1454,7 +1454,7 @@ that property, then reading the property, then deleting it to ack. We are done when the sender places a property of length 0. */ - BLOCK_INPUT; + block_input (); XSelectInput (display, window, STANDARD_EVENT_SET | PropertyChangeMask); TRACE1 (" Delete property %s", SDATA (SYMBOL_NAME (x_atom_to_symbol (display, property)))); @@ -1464,7 +1464,7 @@ wait_object = expect_property_change (display, window, property, PropertyNewValue); XFlush (display); - UNBLOCK_INPUT; + unblock_input (); while (1) { @@ -1496,14 +1496,14 @@ break; } - BLOCK_INPUT; + block_input (); TRACE1 (" ACK by deleting property %s", XGetAtomName (display, property)); XDeleteProperty (display, window, property); wait_object = expect_property_change (display, window, property, PropertyNewValue); XFlush (display); - UNBLOCK_INPUT; + unblock_input (); if (*size_bytes_ret - offset < tmp_size_bytes) *data_ret = xpalloc (*data_ret, size_bytes_ret, @@ -1545,10 +1545,10 @@ if (! data) { int there_is_a_selection_owner; - BLOCK_INPUT; + block_input (); there_is_a_selection_owner = XGetSelectionOwner (display, selection_atom); - UNBLOCK_INPUT; + unblock_input (); if (there_is_a_selection_owner) signal_error ("Selection owner couldn't convert", actual_type @@ -1565,22 +1565,22 @@ /* That wasn't really the data, just the beginning. */ unsigned int min_size_bytes = * ((unsigned int *) data); - BLOCK_INPUT; + block_input (); /* Use xfree, not XFree, because x_get_window_property calls xmalloc itself. */ xfree (data); - UNBLOCK_INPUT; + unblock_input (); receive_incremental_selection (display, window, property, target_type, min_size_bytes, &data, &bytes, &actual_type, &actual_format, &actual_size); } - BLOCK_INPUT; + block_input (); TRACE1 (" Delete property %s", XGetAtomName (display, property)); XDeleteProperty (display, window, property); XFlush (display); - UNBLOCK_INPUT; + unblock_input (); /* It's been read. Now convert it to a lisp object in some semi-rational manner. */ @@ -2096,13 +2096,13 @@ selection_atom = symbol_to_x_atom (dpyinfo, selection); - BLOCK_INPUT; + block_input (); if (NILP (time_object)) timestamp = last_event_timestamp; else CONS_TO_INTEGER (time_object, Time, timestamp); XSetSelectionOwner (dpyinfo->display, selection_atom, None, timestamp); - UNBLOCK_INPUT; + unblock_input (); /* It doesn't seem to be guaranteed that a SelectionClear event will be generated for a window which owns the selection when that window sets @@ -2179,9 +2179,9 @@ atom = symbol_to_x_atom (dpyinfo, selection); if (atom == 0) return Qnil; - BLOCK_INPUT; + block_input (); owner = XGetSelectionOwner (dpyinfo->display, atom); - UNBLOCK_INPUT; + unblock_input (); return (owner ? Qt : Qnil); } @@ -2353,9 +2353,9 @@ val = cons_to_signed (o, LONG_MIN, LONG_MAX); else if (STRINGP (o)) { - BLOCK_INPUT; + block_input (); val = (long) XInternAtom (dpy, SSDATA (o), False); - UNBLOCK_INPUT; + unblock_input (); } else error ("Wrong type, must be string, number or cons"); @@ -2413,7 +2413,7 @@ Window root, dummy_window; int dummy; - BLOCK_INPUT; + block_input (); XQueryPointer (FRAME_X_DISPLAY (f), DefaultRootWindow (FRAME_X_DISPLAY (f)), @@ -2439,7 +2439,7 @@ *x -= f->left_pos + FRAME_OUTER_TO_INNER_DIFF_X (f); *y -= f->top_pos + FRAME_OUTER_TO_INNER_DIFF_Y (f); - UNBLOCK_INPUT; + unblock_input (); } DEFUN ("x-get-atom-name", Fx_get_atom_name, @@ -2462,7 +2462,7 @@ CONS_TO_INTEGER (value, Atom, atom); - BLOCK_INPUT; + block_input (); x_catch_errors (dpy); name = atom ? XGetAtomName (dpy, atom) : empty; had_errors = x_had_errors_p (dpy); @@ -2474,7 +2474,7 @@ if (atom && name) XFree (name); if (NILP (ret)) ret = empty_unibyte_string; - UNBLOCK_INPUT; + unblock_input (); return ret; } @@ -2496,9 +2496,9 @@ x_atom = symbol_to_x_atom (dpyinfo, atom); else if (STRINGP (atom)) { - BLOCK_INPUT; + block_input (); x_atom = XInternAtom (FRAME_X_DISPLAY (f), SSDATA (atom), False); - UNBLOCK_INPUT; + unblock_input (); } else error ("ATOM must be a symbol or a string"); @@ -2657,7 +2657,7 @@ if (wdest == 0) wdest = dpyinfo->root_window; to_root = wdest == dpyinfo->root_window; - BLOCK_INPUT; + block_input (); event.xclient.message_type = message_type; event.xclient.display = dpyinfo->display; @@ -2683,7 +2683,7 @@ XFlush (dpyinfo->display); } x_uncatch_errors (); - UNBLOCK_INPUT; + unblock_input (); } === modified file 'src/xsettings.c' --- src/xsettings.c 2012-09-15 07:06:56 +0000 +++ src/xsettings.c 2012-09-23 08:44:20 +0000 @@ -929,7 +929,7 @@ { Display *dpy = dpyinfo->display; - BLOCK_INPUT; + block_input (); /* Select events so we can detect client messages sent when selection owner changes. */ @@ -939,7 +939,7 @@ if (dpyinfo->xsettings_window != None) read_and_apply_settings (dpyinfo, False); - UNBLOCK_INPUT; + unblock_input (); } void === modified file 'src/xterm.c' --- src/xterm.c 2012-09-20 01:37:07 +0000 +++ src/xterm.c 2012-09-23 08:44:20 +0000 @@ -353,7 +353,7 @@ if (!NILP (Vinhibit_redisplay)) return; - BLOCK_INPUT; + block_input (); if (f == NULL) { Lisp_Object rest, frame; @@ -363,7 +363,7 @@ } else if (FRAME_X_P (f)) XFlush (FRAME_X_DISPLAY (f)); - UNBLOCK_INPUT; + unblock_input (); } @@ -564,7 +564,7 @@ updated_window = w; set_output_cursor (&w->cursor); - BLOCK_INPUT; + block_input (); if (f == hlinfo->mouse_face_mouse_frame) { @@ -577,7 +577,7 @@ hlinfo->mouse_face_window = Qnil; } - UNBLOCK_INPUT; + unblock_input (); } @@ -618,7 +618,7 @@ if (!w->pseudo_window_p) { - BLOCK_INPUT; + block_input (); if (cursor_on_p) display_and_set_cursor (w, 1, output_cursor.hpos, @@ -628,7 +628,7 @@ if (draw_window_fringes (w, 1)) x_draw_vertical_border (w); - UNBLOCK_INPUT; + unblock_input (); } /* If a row with mouse-face was overwritten, arrange for @@ -654,9 +654,9 @@ MOUSE_HL_INFO (f)->mouse_face_defer = 0; #ifndef XFlush - BLOCK_INPUT; + block_input (); XFlush (FRAME_X_DISPLAY (f)); - UNBLOCK_INPUT; + unblock_input (); #endif } @@ -675,13 +675,13 @@ if (hlinfo->mouse_face_deferred_gc || f == hlinfo->mouse_face_mouse_frame) { - BLOCK_INPUT; + block_input (); if (hlinfo->mouse_face_mouse_frame) note_mouse_highlight (hlinfo->mouse_face_mouse_frame, hlinfo->mouse_face_mouse_x, hlinfo->mouse_face_mouse_y); hlinfo->mouse_face_deferred_gc = 0; - UNBLOCK_INPUT; + unblock_input (); } } } @@ -722,13 +722,13 @@ { int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y)); - BLOCK_INPUT; + block_input (); x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 0, y, width, height, False); x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), FRAME_PIXEL_WIDTH (f) - width, y, width, height, False); - UNBLOCK_INPUT; + unblock_input (); } } @@ -1789,10 +1789,10 @@ XColor color; color.pixel = pixel; - BLOCK_INPUT; + block_input (); x_query_color (f, &color); XAllocColor (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), &color); - UNBLOCK_INPUT; + unblock_input (); #ifdef DEBUG_X_COLORS register_color (pixel); #endif @@ -3028,7 +3028,7 @@ /* We don't set the output cursor here because there will always follow an explicit cursor_to. */ - BLOCK_INPUT; + block_input (); XClearWindow (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f)); @@ -3045,7 +3045,7 @@ XFlush (FRAME_X_DISPLAY (f)); - UNBLOCK_INPUT; + unblock_input (); } @@ -3055,7 +3055,7 @@ static void XTflash (struct frame *f) { - BLOCK_INPUT; + block_input (); { #ifdef USE_GTK @@ -3208,14 +3208,14 @@ } } - UNBLOCK_INPUT; + unblock_input (); } static void XTtoggle_invisible_pointer (FRAME_PTR f, int invisible) { - BLOCK_INPUT; + block_input (); if (invisible) { if (FRAME_X_DISPLAY_INFO (f)->invisible_cursor != 0) @@ -3226,7 +3226,7 @@ XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), f->output_data.x->current_cursor); f->pointer_invisible = invisible; - UNBLOCK_INPUT; + unblock_input (); } @@ -3241,10 +3241,10 @@ XTflash (f); else { - BLOCK_INPUT; + block_input (); XBell (FRAME_X_DISPLAY (f), 0); XFlush (FRAME_X_DISPLAY (f)); - UNBLOCK_INPUT; + unblock_input (); } } } @@ -3341,7 +3341,7 @@ height = run->height; } - BLOCK_INPUT; + block_input (); /* Cursor off. Will be switched on again in x_update_window_end. */ updated_window = w; @@ -3354,7 +3354,7 @@ width, height, x, to_y); - UNBLOCK_INPUT; + unblock_input (); } @@ -3371,7 +3371,7 @@ the ICCCM (section 4.1.6) says that the window's border pixmap and border pixel are window attributes which are "private to the client", so we can always change it to whatever we want. */ - BLOCK_INPUT; + block_input (); /* I recently started to get errors in this XSetWindowBorder, depending on the window-manager in use, tho something more is at play since I've been using that same window-manager binary for ever. Let's not crash just @@ -3380,7 +3380,7 @@ XSetWindowBorder (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), f->output_data.x->border_pixel); x_uncatch_errors (); - UNBLOCK_INPUT; + unblock_input (); x_update_cursor (f, 1); x_set_frame_alpha (f); } @@ -3392,13 +3392,13 @@ the ICCCM (section 4.1.6) says that the window's border pixmap and border pixel are window attributes which are "private to the client", so we can always change it to whatever we want. */ - BLOCK_INPUT; + block_input (); /* Same as above for XSetWindowBorder (bug#9310). */ x_catch_errors (FRAME_X_DISPLAY (f)); XSetWindowBorderPixmap (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), f->output_data.x->border_tile); x_uncatch_errors (); - UNBLOCK_INPUT; + unblock_input (); x_update_cursor (f, 1); x_set_frame_alpha (f); } @@ -3765,9 +3765,9 @@ { char *value; - BLOCK_INPUT; + block_input (); value = XKeysymToString (keysym); - UNBLOCK_INPUT; + unblock_input (); return value; } @@ -3897,7 +3897,7 @@ { FRAME_PTR f1; - BLOCK_INPUT; + block_input (); if (! NILP (last_mouse_scroll_bar) && insist == 0) x_scroll_bar_report_motion (fp, bar_window, part, x, y, timestamp); @@ -4078,7 +4078,7 @@ } } - UNBLOCK_INPUT; + unblock_input (); } @@ -4267,7 +4267,7 @@ struct frame *f = XFRAME (w->frame); ptrdiff_t i; - BLOCK_INPUT; + block_input (); /* Construct a ClientMessage event to send to the frame. */ ev->type = ClientMessage; @@ -4314,7 +4314,7 @@ be sent to the client that created the window, and if that window no longer exists, no event will be sent. */ XSendEvent (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), False, 0, &event); - UNBLOCK_INPUT; + unblock_input (); } @@ -4405,9 +4405,9 @@ int slider_size; /* Get the slider size. */ - BLOCK_INPUT; + block_input (); XtVaGetValues (widget, XmNsliderSize, &slider_size, NULL); - UNBLOCK_INPUT; + unblock_input (); whole = XM_SB_MAX - slider_size; portion = min (cs->value, whole); @@ -4528,9 +4528,9 @@ int part; /* Get the size of the thumb, a value between 0 and 1. */ - BLOCK_INPUT; + block_input (); XtVaGetValues (widget, XtNshown, &shown, XtNheight, &height, NULL); - UNBLOCK_INPUT; + unblock_input (); whole = 10000000; portion = shown < 1 ? top * whole : 0; @@ -4570,9 +4570,9 @@ int part; /* Get the height of the scroll bar. */ - BLOCK_INPUT; + block_input (); XtVaGetValues (widget, XtNheight, &height, NULL); - UNBLOCK_INPUT; + unblock_input (); if (eabs (position) >= height) part = (position < 0) ? scroll_bar_above_handle : scroll_bar_below_handle; @@ -4603,11 +4603,11 @@ { const char *scroll_bar_name = SCROLL_BAR_NAME; - BLOCK_INPUT; + block_input (); xg_create_scroll_bar (f, bar, G_CALLBACK (xg_scroll_callback), G_CALLBACK (xg_end_scroll_callback), scroll_bar_name); - UNBLOCK_INPUT; + unblock_input (); } #else /* not USE_GTK */ @@ -4622,7 +4622,7 @@ const char *scroll_bar_name = SCROLL_BAR_NAME; unsigned long pixel; - BLOCK_INPUT; + block_input (); #ifdef USE_MOTIF /* Set resources. Create the widget. */ @@ -4806,7 +4806,7 @@ xwindow = XtWindow (widget); bar->x_window = xwindow; - UNBLOCK_INPUT; + unblock_input (); } #endif /* not USE_GTK */ @@ -4830,7 +4830,7 @@ Widget widget = SCROLL_BAR_X_WIDGET (FRAME_X_DISPLAY (f), bar); float top, shown; - BLOCK_INPUT; + block_input (); #ifdef USE_MOTIF @@ -4921,7 +4921,7 @@ } #endif /* !USE_MOTIF */ - UNBLOCK_INPUT; + unblock_input (); } #endif /* not USE_GTK */ @@ -4946,7 +4946,7 @@ = ALLOCATE_PSEUDOVECTOR (struct scroll_bar, x_window, PVEC_OTHER); Lisp_Object barobj; - BLOCK_INPUT; + block_input (); #ifdef USE_TOOLKIT_SCROLL_BARS x_create_toolkit_scroll_bar (f, bar); @@ -5034,7 +5034,7 @@ XMapRaised (FRAME_X_DISPLAY (f), bar->x_window); #endif /* not USE_TOOLKIT_SCROLL_BARS */ - UNBLOCK_INPUT; + unblock_input (); return bar; } @@ -5068,7 +5068,7 @@ && end == bar->end) return; - BLOCK_INPUT; + block_input (); { int inside_width = VERTICAL_SCROLL_BAR_INSIDE_WIDTH (f, bar->width); @@ -5144,7 +5144,7 @@ } - UNBLOCK_INPUT; + unblock_input (); } #endif /* !USE_TOOLKIT_SCROLL_BARS */ @@ -5156,7 +5156,7 @@ x_scroll_bar_remove (struct scroll_bar *bar) { struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (bar->window))); - BLOCK_INPUT; + block_input (); #ifdef USE_TOOLKIT_SCROLL_BARS #ifdef USE_GTK @@ -5171,7 +5171,7 @@ /* Dissociate this scroll bar from its window. */ wset_vertical_scroll_bar (XWINDOW (bar->window), Qnil); - UNBLOCK_INPUT; + unblock_input (); } @@ -5239,7 +5239,7 @@ { if (width > 0 && height > 0) { - BLOCK_INPUT; + block_input (); #ifdef USE_TOOLKIT_SCROLL_BARS if (fringe_extended_p) x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), @@ -5248,7 +5248,7 @@ #endif x_clear_area (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), left, top, width, height, False); - UNBLOCK_INPUT; + unblock_input (); } bar = x_scroll_bar_create (w, top, sb_left, sb_width, height); @@ -5260,7 +5260,7 @@ bar = XSCROLL_BAR (w->vertical_scroll_bar); - BLOCK_INPUT; + block_input (); if (sb_left != bar->left) mask |= CWX; @@ -5357,7 +5357,7 @@ bar->width = sb_width; bar->height = height; - UNBLOCK_INPUT; + unblock_input (); } #ifdef USE_TOOLKIT_SCROLL_BARS @@ -5508,7 +5508,7 @@ GC gc = f->output_data.x->normal_gc; int width_trim = VERTICAL_SCROLL_BAR_WIDTH_TRIM; - BLOCK_INPUT; + block_input (); x_scroll_bar_set_handle (bar, bar->start, bar->end, 1); @@ -5530,7 +5530,7 @@ XSetForeground (FRAME_X_DISPLAY (f), gc, FRAME_FOREGROUND_PIXEL (f)); - UNBLOCK_INPUT; + unblock_input (); } #endif /* not USE_TOOLKIT_SCROLL_BARS */ @@ -5643,7 +5643,7 @@ int dummy_coord; unsigned int dummy_mask; - BLOCK_INPUT; + block_input (); /* Get the mouse's position relative to the scroll bar window, and report that. */ @@ -5695,7 +5695,7 @@ *timestamp = last_mouse_movement_time; - UNBLOCK_INPUT; + unblock_input (); } @@ -5816,7 +5816,7 @@ { XEvent *xev = (XEvent *) gxev; - BLOCK_INPUT; + block_input (); if (current_count >= 0) { struct x_display_info *dpyinfo; @@ -5831,7 +5831,7 @@ && dpyinfo && x_filter_event (dpyinfo, xev)) { - UNBLOCK_INPUT; + unblock_input (); return GDK_FILTER_REMOVE; } #endif @@ -5846,7 +5846,7 @@ else current_finish = x_dispatch_event (xev, xev->xany.display); - UNBLOCK_INPUT; + unblock_input (); if (current_finish == X_EVENT_GOTO_OUT || current_finish == X_EVENT_DROP) return GDK_FILTER_REMOVE; @@ -7041,10 +7041,10 @@ default: OTHER: #ifdef USE_X_TOOLKIT - BLOCK_INPUT; + block_input (); if (*finish != X_EVENT_DROP) XtDispatchEvent (&event); - UNBLOCK_INPUT; + unblock_input (); #endif /* USE_X_TOOLKIT */ break; } @@ -7122,16 +7122,7 @@ int count = 0; int event_found = 0; - if (interrupt_input_blocked) - { - interrupt_input_pending = 1; - pending_signals = 1; - return -1; - } - - interrupt_input_pending = 0; - pending_signals = pending_atimers; - BLOCK_INPUT; + block_input (); /* So people can tell when we have read the available input. */ input_signal_count++; @@ -7224,7 +7215,7 @@ pending_autoraise_frame = 0; } - UNBLOCK_INPUT; + unblock_input (); return count; } @@ -7660,7 +7651,7 @@ { struct x_error_message_stack *tmp; - BLOCK_INPUT; + block_input (); /* The display may have been closed before this function is called. Check if it is still open before calling XSync. */ @@ -7670,7 +7661,7 @@ tmp = x_error_message; x_error_message = x_error_message->prev; xfree (tmp); - UNBLOCK_INPUT; + unblock_input (); } /* If any X protocol errors have arrived since the last call to @@ -7733,26 +7724,6 @@ #endif /* ! 0 */ -/* Handle SIGPIPE, which can happen when the connection to a server - simply goes away. SIGPIPE is handled by x_connection_signal. - Don't need to do anything, because the write which caused the - SIGPIPE will fail, causing Xlib to invoke the X IO error handler, - which will do the appropriate cleanup for us. */ - -static void -x_connection_signal (int signalnum) /* If we don't have an argument, */ - /* some compilers complain in signal calls. */ -{ -#ifdef USG - /* USG systems forget handlers when they are used; - must reestablish each time */ - struct sigaction action; - emacs_sigaction_init (&action, x_connection_signal); - sigaction (signalnum, &action, 0); -#endif /* USG */ -} - - /************************************************************************ Handling X errors ************************************************************************/ @@ -7856,17 +7827,7 @@ /* NOTREACHED */ } - /* Ordinary stack unwind doesn't deal with these. */ - { - sigset_t unblocked; - sigemptyset (&unblocked); -#ifdef USABLE_SIGIO - sigaddset (&unblocked, SIGIO); -#endif - sigaddset (&unblocked, SIGALRM); - pthread_sigmask (SIG_UNBLOCK, &unblocked, 0); - } - TOTALLY_UNBLOCK_INPUT; + totally_unblock_input (); unbind_to (idx, Qnil); clear_waiting_for_input (); @@ -8005,9 +7966,9 @@ if (FRAME_XIC (f) && (FRAME_XIC_STYLE (f) & (XIMPreeditPosition | XIMStatusArea))) { - BLOCK_INPUT; + block_input (); xic_set_xfontset (f, SSDATA (fontset_ascii (fontset))); - UNBLOCK_INPUT; + unblock_input (); } #endif @@ -8033,7 +7994,7 @@ struct x_display_info *dpyinfo = (struct x_display_info *) client_data; Lisp_Object frame, tail; - BLOCK_INPUT; + block_input (); /* No need to call XDestroyIC.. */ FOR_EACH_FRAME (tail, frame) @@ -8049,7 +8010,7 @@ /* No need to call XCloseIM. */ dpyinfo->xim = NULL; XFree (dpyinfo->xim_styles); - UNBLOCK_INPUT; + unblock_input (); } #endif /* HAVE_X11R6 */ @@ -8124,7 +8085,7 @@ { Lisp_Object tail, frame; - BLOCK_INPUT; + block_input (); FOR_EACH_FRAME (tail, frame) { struct frame *f = XFRAME (frame); @@ -8144,7 +8105,7 @@ } } - UNBLOCK_INPUT; + unblock_input (); } } @@ -8291,7 +8252,7 @@ } x_calc_absolute_position (f); - BLOCK_INPUT; + block_input (); x_wm_set_size_hint (f, (long) 0, 0); modified_left = f->left_pos; @@ -8330,7 +8291,7 @@ && FRAME_X_OUTPUT (f)->move_offset_top == 0)))) x_check_expected_move (f, modified_left, modified_top); - UNBLOCK_INPUT; + unblock_input (); } /* Return non-zero if _NET_SUPPORTING_WM_CHECK window exists and _NET_SUPPORTED @@ -8353,7 +8314,7 @@ unsigned char *tmp_data = NULL; Atom target_type = XA_WINDOW; - BLOCK_INPUT; + block_input (); x_catch_errors (dpy); rc = XGetWindowProperty (dpy, target_window, @@ -8366,7 +8327,7 @@ { if (tmp_data) XFree (tmp_data); x_uncatch_errors (); - UNBLOCK_INPUT; + unblock_input (); return 0; } @@ -8379,7 +8340,7 @@ if (x_had_errors_p (dpy)) { x_uncatch_errors (); - UNBLOCK_INPUT; + unblock_input (); return 0; } @@ -8404,7 +8365,7 @@ { if (tmp_data) XFree (tmp_data); x_uncatch_errors (); - UNBLOCK_INPUT; + unblock_input (); return 0; } @@ -8419,7 +8380,7 @@ rc = dpyinfo->net_supported_atoms[i] == want_atom; x_uncatch_errors (); - UNBLOCK_INPUT; + unblock_input (); return rc; } @@ -8478,7 +8439,7 @@ *sticky = 0; *size_state = FULLSCREEN_NONE; - BLOCK_INPUT; + block_input (); x_catch_errors (dpy); rc = XGetWindowProperty (dpy, window, dpyinfo->Xatom_net_wm_state, 0, max_len, False, target_type, @@ -8489,7 +8450,7 @@ { if (tmp_data) XFree (tmp_data); x_uncatch_errors (); - UNBLOCK_INPUT; + unblock_input (); return ! f->iconified; } @@ -8524,7 +8485,7 @@ } if (tmp_data) XFree (tmp_data); - UNBLOCK_INPUT; + unblock_input (); return ! is_hidden; } @@ -8604,10 +8565,10 @@ { if (f->async_visible) { - BLOCK_INPUT; + block_input (); x_check_fullscreen (f); x_sync (f); - UNBLOCK_INPUT; + unblock_input (); } } @@ -8792,10 +8753,10 @@ while (pending_event_wait.eventtype) { - interrupt_input_pending = 1; - TOTALLY_UNBLOCK_INPUT; + pending_signals = 1; + totally_unblock_input (); /* XTread_socket is called after unblock. */ - BLOCK_INPUT; + block_input (); interrupt_input_blocked = level; FD_ZERO (&fds); @@ -8886,7 +8847,7 @@ void x_set_window_size (struct frame *f, int change_gravity, int cols, int rows) { - BLOCK_INPUT; + block_input (); if (NILP (tip_frame) || XFRAME (tip_frame) != f) { @@ -8934,7 +8895,7 @@ so don't try--just let the highlighting be done afresh with new size. */ cancel_mouse_face (f); - UNBLOCK_INPUT; + unblock_input (); } /* Mouse warping. */ @@ -8953,11 +8914,11 @@ if (pix_y < 0) pix_y = 0; if (pix_y > FRAME_PIXEL_HEIGHT (f)) pix_y = FRAME_PIXEL_HEIGHT (f); - BLOCK_INPUT; + block_input (); XWarpPointer (FRAME_X_DISPLAY (f), None, FRAME_X_WINDOW (f), 0, 0, 0, 0, pix_x, pix_y); - UNBLOCK_INPUT; + unblock_input (); } /* Move the mouse to position pixel PIX_X, PIX_Y relative to frame F. */ @@ -8965,11 +8926,11 @@ void x_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y) { - BLOCK_INPUT; + block_input (); XWarpPointer (FRAME_X_DISPLAY (f), None, FRAME_X_WINDOW (f), 0, 0, 0, 0, pix_x, pix_y); - UNBLOCK_INPUT; + unblock_input (); } /* Raise frame F. */ @@ -8977,12 +8938,12 @@ void x_raise_frame (struct frame *f) { - BLOCK_INPUT; + block_input (); if (f->async_visible) XRaiseWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f)); XFlush (FRAME_X_DISPLAY (f)); - UNBLOCK_INPUT; + unblock_input (); } /* Lower frame F. */ @@ -8992,10 +8953,10 @@ { if (f->async_visible) { - BLOCK_INPUT; + block_input (); XLowerWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f)); XFlush (FRAME_X_DISPLAY (f)); - UNBLOCK_INPUT; + unblock_input (); } } @@ -9104,7 +9065,7 @@ retry: - BLOCK_INPUT; + block_input (); type = x_icon_type (f); if (!NILP (type)) @@ -9163,7 +9124,7 @@ original_top = f->top_pos; /* This must come after we set COUNT. */ - UNBLOCK_INPUT; + unblock_input (); /* We unblock here so that arriving X events are processed. */ @@ -9186,7 +9147,7 @@ int x, y; unsigned int width, height, border, depth; - BLOCK_INPUT; + block_input (); /* On some window managers (such as FVWM) moving an existing window, even to the same place, causes the window manager @@ -9202,7 +9163,7 @@ XMoveWindow (FRAME_X_DISPLAY (f), FRAME_OUTER_WINDOW (f), original_left, original_top); - UNBLOCK_INPUT; + unblock_input (); } XSETFRAME (frame, f); @@ -9269,7 +9230,7 @@ if (FRAME_X_DISPLAY_INFO (f)->x_highlight_frame == f) FRAME_X_DISPLAY_INFO (f)->x_highlight_frame = 0; - BLOCK_INPUT; + block_input (); /* Before unmapping the window, update the WM_SIZE_HINTS property to claim that the current position of the window is user-specified, rather than @@ -9292,7 +9253,7 @@ if (! XWithdrawWindow (FRAME_X_DISPLAY (f), window, DefaultScreen (FRAME_X_DISPLAY (f)))) { - UNBLOCK_INPUT_RESIGNAL; + unblock_input (); error ("Can't notify window manager of window withdrawal"); } } @@ -9309,7 +9270,7 @@ x_sync (f); - UNBLOCK_INPUT; + unblock_input (); } /* Change window state from mapped to iconified. */ @@ -9329,7 +9290,7 @@ if (f->async_iconified) return; - BLOCK_INPUT; + block_input (); FRAME_SAMPLE_VISIBILITY (f); @@ -9348,7 +9309,7 @@ f->visible = 1; f->async_iconified = 1; f->async_visible = 0; - UNBLOCK_INPUT; + unblock_input (); return; } #endif @@ -9368,14 +9329,14 @@ f->visible = 1; f->async_iconified = 1; f->async_visible = 0; - UNBLOCK_INPUT; + unblock_input (); return; } result = XIconifyWindow (FRAME_X_DISPLAY (f), XtWindow (f->output_data.x->widget), DefaultScreen (FRAME_X_DISPLAY (f))); - UNBLOCK_INPUT; + unblock_input (); if (!result) error ("Can't notify window manager of iconification"); @@ -9384,9 +9345,9 @@ f->async_visible = 0; - BLOCK_INPUT; + block_input (); XFlush (FRAME_X_DISPLAY (f)); - UNBLOCK_INPUT; + unblock_input (); #else /* not USE_X_TOOLKIT */ /* Make sure the X server knows where the window should be positioned, @@ -9416,7 +9377,7 @@ SubstructureRedirectMask | SubstructureNotifyMask, &msg)) { - UNBLOCK_INPUT_RESIGNAL; + unblock_input (); error ("Can't notify window manager of iconification"); } } @@ -9435,7 +9396,7 @@ f->async_visible = 0; XFlush (FRAME_X_DISPLAY (f)); - UNBLOCK_INPUT; + unblock_input (); #endif /* not USE_X_TOOLKIT */ } @@ -9452,7 +9413,7 @@ struct scroll_bar *b; #endif - BLOCK_INPUT; + block_input (); /* If a display connection is dead, don't try sending more commands to the X server. */ @@ -9555,7 +9516,7 @@ hlinfo->mouse_face_mouse_frame = 0; } - UNBLOCK_INPUT; + unblock_input (); } @@ -9935,7 +9896,7 @@ Mouse_HLInfo *hlinfo; ptrdiff_t lim; - BLOCK_INPUT; + block_input (); if (!x_initialized) { @@ -10067,7 +10028,7 @@ /* Detect failure. */ if (dpy == 0) { - UNBLOCK_INPUT; + unblock_input (); return 0; } @@ -10114,12 +10075,12 @@ /* Temporarily hide the partially initialized terminal. */ terminal_list = terminal->next_terminal; - UNBLOCK_INPUT; + unblock_input (); kset_system_key_alist (terminal->kboard, call1 (Qvendor_specific_keysyms, vendor ? build_string (vendor) : empty_unibyte_string)); - BLOCK_INPUT; + block_input (); terminal->next_terminal = terminal_list; terminal_list = terminal; UNGCPRO; @@ -10468,7 +10429,7 @@ x_session_initialize (dpyinfo); #endif - UNBLOCK_INPUT; + unblock_input (); return dpyinfo; } @@ -10548,7 +10509,7 @@ static void x_process_timeouts (struct atimer *timer) { - BLOCK_INPUT; + block_input (); x_timeout_atimer_activated_flag = 0; if (toolkit_scroll_bar_interaction || popup_activated ()) { @@ -10557,7 +10518,7 @@ /* Reactivate the atimer for next time. */ x_activate_timeout_atimer (); } - UNBLOCK_INPUT; + unblock_input (); } /* Install an asynchronous timer that processes Xt timeout events @@ -10571,14 +10532,14 @@ void x_activate_timeout_atimer (void) { - BLOCK_INPUT; + block_input (); if (!x_timeout_atimer_activated_flag) { EMACS_TIME interval = make_emacs_time (0, 100 * 1000 * 1000); start_atimer (ATIMER_RELATIVE, interval, x_process_timeouts, 0); x_timeout_atimer_activated_flag = 1; } - UNBLOCK_INPUT; + unblock_input (); } #endif /* USE_X_TOOLKIT */ @@ -10631,7 +10592,7 @@ if (!terminal->name) return; - BLOCK_INPUT; + block_input (); #ifdef HAVE_X_I18N /* We must close our connection to the XIM server before closing the X display. */ @@ -10686,7 +10647,7 @@ /* Mark as dead. */ dpyinfo->display = NULL; x_delete_display (dpyinfo); - UNBLOCK_INPUT; + unblock_input (); } /* Create a struct terminal, initialize it with the X11 specific @@ -10743,8 +10704,6 @@ void x_initialize (void) { - struct sigaction action; - baud_rate = 19200; x_noop_count = 0; @@ -10790,9 +10749,6 @@ original error handler. */ XSetErrorHandler (x_error_handler); XSetIOErrorHandler (x_io_error_quitter); - - emacs_sigaction_init (&action, x_connection_signal); - sigaction (SIGPIPE, &action, 0); } ------------------------------------------------------------ revno: 110151 fixes bug: http://debbugs.gnu.org/12445 committer: Jan D. branch nick: trunk timestamp: Sun 2012-09-23 10:28:12 +0200 message: * nsterm.m (ns_dumpglyphs_image): dr is a new rect to draw image into, background rect may be larger. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-09-23 08:24:44 +0000 +++ src/ChangeLog 2012-09-23 08:28:12 +0000 @@ -1,3 +1,8 @@ +2012-09-23 Jan Djärv + + * nsterm.m (ns_dumpglyphs_image): dr is a new rect to draw image into, + background rect may be larger (Bug#12445). + 2012-09-23 Chong Yidong * keyboard.c (timer_check): Avoid quitting during Fcopy_sequence. === modified file 'src/nsterm.m' --- src/nsterm.m 2012-09-20 01:37:07 +0000 +++ src/nsterm.m 2012-09-23 08:28:12 +0000 @@ -2979,7 +2979,8 @@ if (img != nil) { #if !defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 - [img drawInRect: br + NSRect dr = NSMakeRect (x, y, s->slice.width, s->slice.height); + [img drawInRect: dr fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0 ------------------------------------------------------------ revno: 110150 committer: Chong Yidong branch nick: trunk timestamp: Sun 2012-09-23 16:24:44 +0800 message: * keyboard.c (timer_check): Avoid quitting during Fcopy_sequence. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-09-22 20:35:46 +0000 +++ src/ChangeLog 2012-09-23 08:24:44 +0000 @@ -1,3 +1,7 @@ +2012-09-23 Chong Yidong + + * keyboard.c (timer_check): Avoid quitting during Fcopy_sequence. + 2012-09-22 Paul Eggert * .gdbinit: Just stop at fatal_error_backtrace. === modified file 'src/keyboard.c' --- src/keyboard.c 2012-09-22 13:16:03 +0000 +++ src/keyboard.c 2012-09-23 08:24:44 +0000 @@ -4496,6 +4496,9 @@ Lisp_Object timers, idle_timers; struct gcpro gcpro1, gcpro2; + Lisp_Object tem = Vinhibit_quit; + Vinhibit_quit = Qt; + /* We use copies of the timers' lists to allow a timer to add itself again, without locking up Emacs if the newly added timer is already ripe when added. */ @@ -4508,6 +4511,8 @@ else idle_timers = Qnil; + Vinhibit_quit = tem; + GCPRO2 (timers, idle_timers); do ------------------------------------------------------------ revno: 110149 fixes bug: http://debbugs.gnu.org/12462 committer: Juri Linkov branch nick: trunk timestamp: Sun 2012-09-23 01:57:11 +0300 message: * lisp/dired.el (dired-mode-map): Add [remap read-only-mode] for `dired-toggle-read-only'. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-09-22 18:11:11 +0000 +++ lisp/ChangeLog 2012-09-22 22:57:11 +0000 @@ -1,3 +1,8 @@ +2012-09-22 Juri Linkov + + * dired.el (dired-mode-map): Add [remap read-only-mode] for + `dired-toggle-read-only'. (Bug#12462) + 2012-09-22 Martin Rudalics * subr.el (temp-output-buffer-show): New function. === modified file 'lisp/dired.el' --- lisp/dired.el 2012-09-20 21:57:13 +0000 +++ lisp/dired.el 2012-09-22 22:57:11 +0000 @@ -1493,6 +1493,8 @@ (define-key map (kbd "M-s f C-s") 'dired-isearch-filenames) (define-key map (kbd "M-s f M-C-s") 'dired-isearch-filenames-regexp) ;; misc + (define-key map [remap read-only-mode] 'dired-toggle-read-only) + ;; `toggle-read-only' is an obsolete alias for `read-only-mode' (define-key map [remap toggle-read-only] 'dired-toggle-read-only) (define-key map "?" 'dired-summary) (define-key map "\177" 'dired-unmark-backward)