Now on revision 110505. ------------------------------------------------------------ revno: 110505 committer: Paul Eggert branch nick: trunk timestamp: Wed 2012-10-10 21:33:12 -0700 message: * marker.c (cached_modiff): EMACS_INT, not int. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-10-11 00:32:25 +0000 +++ src/ChangeLog 2012-10-11 04:33:12 +0000 @@ -1,5 +1,7 @@ 2012-10-11 Paul Eggert + * marker.c (cached_modiff): EMACS_INT, not int. + * w32select.c (waiting_for_input): Declare by including "keyboard.h" instead of having a wrong decl. * nsmenu.m (waiting_for_input): Remove wrong decl. === modified file 'src/marker.c' --- src/marker.c 2012-10-01 06:36:54 +0000 +++ src/marker.c 2012-10-11 04:33:12 +0000 @@ -29,7 +29,7 @@ static ptrdiff_t cached_charpos; static ptrdiff_t cached_bytepos; static struct buffer *cached_buffer; -static int cached_modiff; +static EMACS_INT cached_modiff; /* Juanma Barranquero reported ~3x increased bootstrap time when byte_char_debug_check is enabled; so this ------------------------------------------------------------ revno: 110504 committer: Paul Eggert branch nick: trunk timestamp: Wed 2012-10-10 17:32:25 -0700 message: * w32select.c (waiting_for_input): Declare by including "keyboard.h" instead of having a wrong decl. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-10-11 00:26:58 +0000 +++ src/ChangeLog 2012-10-11 00:32:25 +0000 @@ -1,5 +1,7 @@ 2012-10-11 Paul Eggert + * w32select.c (waiting_for_input): Declare by including "keyboard.h" + instead of having a wrong decl. * nsmenu.m (waiting_for_input): Remove wrong decl. 2012-10-10 Paul Eggert === modified file 'src/w32select.c' --- src/w32select.c 2012-10-08 12:53:18 +0000 +++ src/w32select.c 2012-10-11 00:32:25 +0000 @@ -76,6 +76,7 @@ #include "lisp.h" #include "w32term.h" /* for all of the w32 includes */ #include "w32common.h" /* os_subtype */ +#include "keyboard.h" #include "blockinput.h" #include "charset.h" #include "coding.h" @@ -393,7 +394,6 @@ with global variables and calling strange looking functions. Is this really the right way to run Lisp callbacks? */ - extern int waiting_for_input; /* from keyboard.c */ int owfi; block_input (); ------------------------------------------------------------ revno: 110503 committer: Paul Eggert branch nick: trunk timestamp: Wed 2012-10-10 17:26:58 -0700 message: * nsmenu.m (waiting_for_input): Remove wrong decl. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-10-10 20:09:47 +0000 +++ src/ChangeLog 2012-10-11 00:26:58 +0000 @@ -1,3 +1,7 @@ +2012-10-11 Paul Eggert + + * nsmenu.m (waiting_for_input): Remove wrong decl. + 2012-10-10 Paul Eggert keyboard.c, keymap.c: Use bool for booleans. === modified file 'src/nsmenu.m' --- src/nsmenu.m 2012-10-10 20:09:47 +0000 +++ src/nsmenu.m 2012-10-11 00:26:58 +0000 @@ -128,7 +128,6 @@ static EmacsMenu *last_submenu = nil; BOOL needsSet = NO; const char *submenuTitle = [[submenu title] UTF8String]; - extern int waiting_for_input; bool owfi; Lisp_Object items; widget_value *wv, *first_wv, *prev_wv = 0; ------------------------------------------------------------ revno: 110502 committer: Paul Eggert branch nick: trunk timestamp: Wed 2012-10-10 13:09:47 -0700 message: keyboard.c, keymap.c: Use bool for booleans. * dispnew.c (sit_for): Distinguish between 3-way display_option and boolean do_display. * keyboard.c (single_kboard, this_command_key_count_reset) (waiting_for_input, echoing, immediate_quit, input_pending) (interrupt_input, interrupts_deferred, pop_kboard) (temporarily_switch_to_single_kboard, ignore_mouse_drag_p) (command_loop_1, adjust_point_for_property) (safe_run_hooks_error, input_polling_used, read_char): (help_char_p, readable_events, kbd_buffer_events_waiting) (kbd_buffer_get_event, timer_check_2, make_lispy_event) (lucid_event_type_list_p, get_input_pending): (gobble_input, menu_separator_name_p, menu_bar_item) (parse_menu_item, parse_tool_bar_item, read_char_x_menu_prompt) (read_char_minibuf_menu_prompt, access_keymap_keyremap) (keyremap_step, test_undefined, read_key_sequence) (detect_input_pending, detect_input_pending_ignore_squeezables) (detect_input_pending_run_timers, requeued_events_pending_p) (quit_throw_to_read_char, Fset_input_interrupt_mode): * keymap.c (get_keymap, keymap_parent, keymap_memberp) (access_keymap_1, access_keymap, map_keymap, get_keyelt) (Fdefine_key, Flookup_key, struct accessible_keymaps_data) (accessible_keymaps_1, Fkey_description, push_key_description): (shadow_lookup, struct where_is_internal_data) (where_is_internal, Fwhere_is_internal, where_is_internal_1) (Fdescribe_buffer_bindings, describe_map_tree, struct describe_map_elt) (describe_map, describe_vector): * menu.c (single_menu_item): * nsmenu.m (ns_update_menubar): * process.c (wait_reading_process_output): * search.c (scan_buffer, scan_newline): Use bool for boolean. * keyboard.c (timers_run, swallow_events) (detect_input_pending_run_timers): * process.c (wait_reading_process_output): Use unsigned for counter where wraparound-on-overflow is desired, since unsigned is guaranteed to have that behavior and signed is not. (read_char): Use ptrdiff_t for string length. (get_input_pending): Remove first argument, since it was always the same pointer-to-int (now pointer-to-boolean) &input_pending, and behave as if it had that value. Return new value of input_pending. All callers changed. * keyboard.h (struct kboard): Use unsigned : 1 for boolean member immediate_echo. Use ptrdiff_t for echo_after_prompt, since it's a string length. * keymap.c (push_key_description): Omit last arg, which was always 1. All callers changed. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-10-10 19:53:26 +0000 +++ src/ChangeLog 2012-10-10 20:09:47 +0000 @@ -1,5 +1,53 @@ 2012-10-10 Paul Eggert + keyboard.c, keymap.c: Use bool for booleans. + * dispnew.c (sit_for): Distinguish between 3-way display_option + and boolean do_display. + * keyboard.c (single_kboard, this_command_key_count_reset) + (waiting_for_input, echoing, immediate_quit, input_pending) + (interrupt_input, interrupts_deferred, pop_kboard) + (temporarily_switch_to_single_kboard, ignore_mouse_drag_p) + (command_loop_1, adjust_point_for_property) + (safe_run_hooks_error, input_polling_used, read_char): + (help_char_p, readable_events, kbd_buffer_events_waiting) + (kbd_buffer_get_event, timer_check_2, make_lispy_event) + (lucid_event_type_list_p, get_input_pending): + (gobble_input, menu_separator_name_p, menu_bar_item) + (parse_menu_item, parse_tool_bar_item, read_char_x_menu_prompt) + (read_char_minibuf_menu_prompt, access_keymap_keyremap) + (keyremap_step, test_undefined, read_key_sequence) + (detect_input_pending, detect_input_pending_ignore_squeezables) + (detect_input_pending_run_timers, requeued_events_pending_p) + (quit_throw_to_read_char, Fset_input_interrupt_mode): + * keymap.c (get_keymap, keymap_parent, keymap_memberp) + (access_keymap_1, access_keymap, map_keymap, get_keyelt) + (Fdefine_key, Flookup_key, struct accessible_keymaps_data) + (accessible_keymaps_1, Fkey_description, push_key_description): + (shadow_lookup, struct where_is_internal_data) + (where_is_internal, Fwhere_is_internal, where_is_internal_1) + (Fdescribe_buffer_bindings, describe_map_tree, struct describe_map_elt) + (describe_map, describe_vector): + * menu.c (single_menu_item): + * nsmenu.m (ns_update_menubar): + * process.c (wait_reading_process_output): + * search.c (scan_buffer, scan_newline): + Use bool for boolean. + * keyboard.c (timers_run, swallow_events) + (detect_input_pending_run_timers): + * process.c (wait_reading_process_output): + Use unsigned for counter where wraparound-on-overflow is desired, + since unsigned is guaranteed to have that behavior and signed is not. + (read_char): Use ptrdiff_t for string length. + (get_input_pending): Remove first argument, since it was always + the same pointer-to-int (now pointer-to-boolean) &input_pending, + and behave as if it had that value. Return new value of + input_pending. All callers changed. + * keyboard.h (struct kboard): Use unsigned : 1 for boolean member + immediate_echo. Use ptrdiff_t for echo_after_prompt, since it's + a string length. + * keymap.c (push_key_description): Omit last arg, which was always 1. + All callers changed. + * regex.c (immediate_quit) [emacs]: Remove duplicate decl. 2012-10-10 Juanma Barranquero === modified file 'src/dispnew.c' --- src/dispnew.c 2012-10-10 15:10:57 +0000 +++ src/dispnew.c 2012-10-10 20:09:47 +0000 @@ -5918,15 +5918,16 @@ TIMEOUT is number of seconds to wait (float or integer), or t to wait forever. READING is true if reading input. - If DO_DISPLAY is >0 display process output while waiting. - If DO_DISPLAY is >1 perform an initial redisplay before waiting. + If DISPLAY_OPTION is >0 display process output while waiting. + If DISPLAY_OPTION is >1 perform an initial redisplay before waiting. */ Lisp_Object -sit_for (Lisp_Object timeout, bool reading, int do_display) +sit_for (Lisp_Object timeout, bool reading, int display_option) { intmax_t sec; int nsec; + bool do_display = display_option > 0; swallow_events (do_display); @@ -5934,7 +5935,7 @@ || !NILP (Vexecuting_kbd_macro)) return Qnil; - if (do_display >= 2) + if (display_option > 1) redisplay_preserve_echo_area (2); if (INTEGERP (timeout)) === modified file 'src/keyboard.c' --- src/keyboard.c 2012-10-08 22:14:39 +0000 +++ src/keyboard.c 2012-10-10 20:09:47 +0000 @@ -86,8 +86,8 @@ KBOARD *current_kboard; KBOARD *all_kboards; -/* Nonzero in the single-kboard state, 0 in the any-kboard state. */ -static int single_kboard; +/* True in the single-kboard state, false in the any-kboard state. */ +static bool single_kboard; /* Non-nil disable property on a command means do not execute it; call disabled-command-function's value instead. */ @@ -113,9 +113,9 @@ Lisp_Object this_command_keys; ptrdiff_t this_command_key_count; -/* 1 after calling Freset_this_command_lengths. - Usually it is 0. */ -static int this_command_key_count_reset; +/* True after calling Freset_this_command_lengths. + Usually it is false. */ +static bool this_command_key_count_reset; /* This vector is used as a buffer to record the events that were actually read by read_key_sequence. */ @@ -140,11 +140,11 @@ static sys_jmp_buf getcjmp; /* True while doing kbd input. */ -int waiting_for_input; +bool waiting_for_input; /* True while displaying for echoing. Delays C-g throwing. */ -static int echoing; +static bool echoing; /* Non-null means we can start echoing at the next input pause even though there is something in the echo area. */ @@ -163,8 +163,8 @@ Lisp_Object echo_message_buffer; -/* Nonzero means C-g should cause immediate error-signal. */ -int immediate_quit; +/* True means C-g should cause immediate error-signal. */ +bool immediate_quit; /* Character that causes a quit. Normally C-g. @@ -270,7 +270,7 @@ static FILE *dribble; /* Nonzero if input is available. */ -int input_pending; +bool input_pending; /* Circular buffer for pre-read keyboard input. */ @@ -372,18 +372,18 @@ static Lisp_Object Qpolling_period; /* Incremented whenever a timer is run. */ -int timers_run; +unsigned timers_run; /* Address (if not 0) of EMACS_TIME to zero out if a SIGIO interrupt happens. */ EMACS_TIME *input_available_clear_time; -/* Nonzero means use SIGIO interrupts; zero means use CBREAK mode. - Default is 1 if INTERRUPT_INPUT is defined. */ -int interrupt_input; +/* True means use SIGIO interrupts; false means use CBREAK mode. + Default is true if INTERRUPT_INPUT is defined. */ +bool interrupt_input; /* Nonzero while interrupts are temporarily deferred during redisplay. */ -int interrupts_deferred; +bool interrupts_deferred; /* 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. */ @@ -411,10 +411,10 @@ /* Function for init_keyboard to call with no args (if nonzero). */ static void (*keyboard_init_hook) (void); -static void get_input_pending (int *, int); -static int readable_events (int); +static bool get_input_pending (int); +static bool readable_events (int); static Lisp_Object read_char_x_menu_prompt (ptrdiff_t, Lisp_Object *, - Lisp_Object, int *); + Lisp_Object, bool *); static Lisp_Object read_char_minibuf_menu_prompt (int, ptrdiff_t, Lisp_Object *); static Lisp_Object make_lispy_event (struct input_event *); @@ -428,7 +428,7 @@ Lisp_Object, const char *const *, Lisp_Object *, ptrdiff_t); static Lisp_Object make_lispy_switch_frame (Lisp_Object); -static int help_char_p (Lisp_Object); +static bool help_char_p (Lisp_Object); static void save_getcjmp (sys_jmp_buf); static void restore_getcjmp (sys_jmp_buf); static Lisp_Object apply_modifiers (int, Lisp_Object); @@ -438,7 +438,7 @@ static void deliver_input_available_signal (int signo); #endif static void handle_interrupt (bool); -static _Noreturn void quit_throw_to_read_char (int); +static _Noreturn void quit_throw_to_read_char (bool); static void process_special_events (void); static void timer_start_idle (void); static void timer_stop_idle (void); @@ -516,7 +516,7 @@ if (INTEGERP (c)) { - ptr = push_key_description (XINT (c), ptr, 1); + ptr = push_key_description (XINT (c), ptr); } else if (SYMBOLP (c)) { @@ -925,7 +925,7 @@ { struct terminal *t; struct kboard_stack *p = kboard_stack; - int found = 0; + bool found = 0; for (t = terminal_list; t; t = t->next_terminal) { if (t->kboard == p->kboard) @@ -958,7 +958,7 @@ void temporarily_switch_to_single_kboard (struct frame *f) { - int was_locked = single_kboard; + bool was_locked = single_kboard; if (was_locked) { if (f != NULL && FRAME_KBOARD (f) != current_kboard) @@ -1057,12 +1057,7 @@ Vprint_length = old_length; Vquit_flag = Qnil; - Vinhibit_quit = Qnil; -#if 0 /* This shouldn't be necessary anymore. --lorentey */ - if (command_loop_level == 0 && minibuf_level == 0) - any_kboard_state (); -#endif return make_number (0); } @@ -1149,12 +1144,6 @@ while (1) { internal_catch (Qtop_level, top_level_1, Qnil); -#if 0 /* This shouldn't be necessary anymore. --lorentey */ - /* Reset single_kboard in case top-level set it while - evaluating an -f option, or we are stuck there for some - other reason. */ - any_kboard_state (); -#endif internal_catch (Qtop_level, command_loop_2, Qnil); executing_kbd_macro = Qnil; @@ -1265,8 +1254,7 @@ if (!readable_events (READABLE_EVENTS_DO_TIMERS_NOW)) { redisplay_preserve_echo_area (6); - get_input_pending (&input_pending, - READABLE_EVENTS_DO_TIMERS_NOW); + get_input_pending (READABLE_EVENTS_DO_TIMERS_NOW); } } return Qnil; @@ -1301,7 +1289,7 @@ #if !defined HAVE_WINDOW_SYSTEM || defined USE_GTK || defined HAVE_NS static #endif -int ignore_mouse_drag_p; +bool ignore_mouse_drag_p; static FRAME_PTR some_mouse_moved (void) @@ -1329,9 +1317,9 @@ sans error-handling encapsulation. */ static int read_key_sequence (Lisp_Object *, int, Lisp_Object, - int, int, int); + bool, bool, bool); void safe_run_hooks (Lisp_Object); -static void adjust_point_for_property (ptrdiff_t, int); +static void adjust_point_for_property (ptrdiff_t, bool); /* Cancel hourglass from protect_unwind. ARG is not used. */ @@ -1359,10 +1347,7 @@ int i; EMACS_INT prev_modiff = 0; struct buffer *prev_buffer = NULL; -#if 0 /* This shouldn't be necessary anymore. --lorentey */ - int was_locked = single_kboard; -#endif - int already_adjusted = 0; + bool already_adjusted = 0; kset_prefix_arg (current_kboard, Qnil); kset_last_prefix_arg (current_kboard, Qnil); @@ -1731,10 +1716,6 @@ if (!NILP (KVAR (current_kboard, defining_kbd_macro)) && NILP (KVAR (current_kboard, Vprefix_arg))) finalize_kbd_macro_chars (); -#if 0 /* This shouldn't be necessary anymore. --lorentey */ - if (!was_locked) - any_kboard_state (); -#endif } } @@ -1744,7 +1725,7 @@ LAST_PT is the last position of point. */ static void -adjust_point_for_property (ptrdiff_t last_pt, int modified) +adjust_point_for_property (ptrdiff_t last_pt, bool modified) { ptrdiff_t beg, end; Lisp_Object val, overlay, tmp; @@ -1752,7 +1733,7 @@ suppress the point adjustment for automatic composition so that a user can keep inserting another character at point or keep deleting characters around point. */ - int check_composition = ! modified, check_display = 1, check_invisible = 1; + bool check_composition = ! modified, check_display = 1, check_invisible = 1; ptrdiff_t orig_pt = PT; /* FIXME: cycling is probably not necessary because these properties @@ -1791,7 +1772,8 @@ check_display = 0; if (check_invisible && PT > BEGV && PT < ZV) { - int inv, ellipsis = 0; + int inv; + bool ellipsis = 0; beg = end = PT; /* Find boundaries `beg' and `end' of the invisible area, if any. */ @@ -1920,7 +1902,7 @@ if (SYMBOLP (hook)) { Lisp_Object val; - int found = 0; + bool found = 0; Lisp_Object newval = Qnil; for (val = find_symbol_value (hook); CONSP (val); val = XCDR (val)) if (EQ (fun, XCAR (val))) @@ -2050,9 +2032,9 @@ #endif } -/* Nonzero if we are using polling to handle input asynchronously. */ +/* True if we are using polling to handle input asynchronously. */ -int +bool input_polling_used (void) { #ifdef POLL_FOR_INPUT @@ -2228,7 +2210,7 @@ /* Input of single characters from keyboard */ -static Lisp_Object kbd_buffer_get_event (KBOARD **kbp, int *used_mouse_menu, +static Lisp_Object kbd_buffer_get_event (KBOARD **kbp, bool *used_mouse_menu, EMACS_TIME *end_time); static void record_char (Lisp_Object c); @@ -2265,9 +2247,9 @@ not to run input methods, but in other respects to act as if not reading a key sequence. - If USED_MOUSE_MENU is non-null, then we set *USED_MOUSE_MENU to 1 - if we used a mouse menu to read the input, or zero otherwise. If - USED_MOUSE_MENU is null, we don't dereference it. + If USED_MOUSE_MENU is non-null, then set *USED_MOUSE_MENU to true + if we used a mouse menu to read the input, or false otherwise. If + USED_MOUSE_MENU is null, don't dereference it. Value is -2 when we find input on another keyboard. A second call to read_char will read it. @@ -2281,7 +2263,7 @@ Lisp_Object read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps, Lisp_Object prev_event, - int *used_mouse_menu, EMACS_TIME *end_time) + bool *used_mouse_menu, EMACS_TIME *end_time) { Lisp_Object c; ptrdiff_t jmpcount; @@ -2290,9 +2272,9 @@ Lisp_Object tem, save; volatile Lisp_Object previous_echo_area_message; volatile Lisp_Object also_record; - volatile int reread; + volatile bool reread; struct gcpro gcpro1, gcpro2; - int volatile polling_stopped_here = 0; + bool volatile polling_stopped_here = 0; struct kboard *orig_kboard = current_kboard; also_record = Qnil; @@ -2328,7 +2310,7 @@ if (CONSP (Vunread_command_events)) { - int was_disabled = 0; + bool was_disabled = 0; c = XCAR (Vunread_command_events); Vunread_command_events = XCDR (Vunread_command_events); @@ -2430,7 +2412,7 @@ /* if redisplay was requested */ if (commandflag >= 0) { - int echo_current = EQ (echo_message_buffer, echo_area_buffer[0]); + bool echo_current = EQ (echo_message_buffer, echo_area_buffer[0]); /* If there is pending input, process any events which are not user-visible, such as X selection_request events. */ @@ -2862,12 +2844,6 @@ if (!NILP (tem)) { struct buffer *prev_buffer = current_buffer; -#if 0 /* This shouldn't be necessary anymore. --lorentey */ - int was_locked = single_kboard; - ptrdiff_t count = SPECPDL_INDEX (); - record_single_kboard_state (); -#endif - last_input_event = c; Fcommand_execute (tem, Qnil, Fvector (1, &last_input_event), Qt); @@ -2878,13 +2854,6 @@ example banishing the mouse under mouse-avoidance-mode. */ timer_resume_idle (); -#if 0 /* This shouldn't be necessary anymore. --lorentey */ - /* Resume allowing input from any kboard, if that was true before. */ - if (!was_locked) - any_kboard_state (); - unbind_to (count, Qnil); -#endif - if (current_buffer != prev_buffer) { /* The command may have changed the keymaps. Pretend there @@ -2992,15 +2961,15 @@ { Lisp_Object keys; ptrdiff_t key_count; - int key_count_reset; + bool key_count_reset; struct gcpro gcpro1; ptrdiff_t count = SPECPDL_INDEX (); /* Save the echo status. */ - int saved_immediate_echo = current_kboard->immediate_echo; + bool saved_immediate_echo = current_kboard->immediate_echo; struct kboard *saved_ok_to_echo = ok_to_echo_at_next_pause; Lisp_Object saved_echo_string = KVAR (current_kboard, echo_string); - int saved_echo_after_prompt = current_kboard->echo_after_prompt; + ptrdiff_t saved_echo_after_prompt = current_kboard->echo_after_prompt; #if 0 if (before_command_restore_flag) @@ -3201,9 +3170,9 @@ num_input_events++; } -/* Return 1 if should recognize C as "the help character". */ +/* Return true if should recognize C as "the help character". */ -static int +static bool help_char_p (Lisp_Object c) { Lisp_Object tail; @@ -3375,7 +3344,7 @@ /* Return true if there are any events in the queue that read-char would return. If this returns false, a read-char would block. */ -static int +static bool readable_events (int flags) { if (flags & READABLE_EVENTS_DO_TIMERS_NOW) @@ -3714,15 +3683,14 @@ } -/* Return non-zero if there are any real events waiting in the event +/* Return true if there are any real events waiting in the event buffer, not counting `NO_EVENT's. - If DISCARD is non-zero, discard NO_EVENT events at the front of - the input queue, possibly leaving the input queue empty if there - are no real input events. */ + Discard NO_EVENT events at the front of the input queue, possibly + leaving the input queue empty if there are no real input events. */ -int -kbd_buffer_events_waiting (int discard) +bool +kbd_buffer_events_waiting (void) { struct input_event *sp; @@ -3734,9 +3702,7 @@ sp = kbd_buffer; } - if (discard) - kbd_fetch_ptr = sp; - + kbd_fetch_ptr = sp; return sp != kbd_store_ptr && sp->kind != NO_EVENT; } @@ -3758,7 +3724,7 @@ static Lisp_Object kbd_buffer_get_event (KBOARD **kbp, - int *used_mouse_menu, + bool *used_mouse_menu, EMACS_TIME *end_time) { Lisp_Object obj; @@ -4203,14 +4169,14 @@ are ripe, and return, without reading any user-visible events. */ void -swallow_events (int do_display) +swallow_events (bool do_display) { - int old_timers_run; + unsigned old_timers_run; process_special_events (); old_timers_run = timers_run; - get_input_pending (&input_pending, READABLE_EVENTS_DO_TIMERS_NOW); + get_input_pending (READABLE_EVENTS_DO_TIMERS_NOW); if (timers_run != old_timers_run && do_display) redisplay_preserve_echo_area (7); @@ -4337,7 +4303,7 @@ EMACS_TIME difference; EMACS_TIME timer_difference = invalid_emacs_time (); EMACS_TIME idle_timer_difference = invalid_emacs_time (); - int ripe, timer_ripe = 0, idle_timer_ripe = 0; + bool ripe, timer_ripe = 0, idle_timer_ripe = 0; /* Set TIMER and TIMER_DIFFERENCE based on the next ordinary timer. @@ -5441,7 +5407,7 @@ #endif { int button = event->code; - int is_double; + bool is_double; Lisp_Object position; Lisp_Object *start_pos_ptr; Lisp_Object start_pos; @@ -5722,7 +5688,7 @@ struct frame *fr; int fuzz; int symbol_num; - int is_double; + bool is_double; if (WINDOWP (event->frame_or_window)) fr = XFRAME (XWINDOW (event->frame_or_window)->frame); @@ -6664,11 +6630,11 @@ return 0; } -/* Return 1 if EVENT is a list whose elements are all integers or symbols. +/* Return true if EVENT is a list whose elements are all integers or symbols. Such a list is not valid as an event, but it can be a Lucid-style event type list. */ -int +bool lucid_event_type_list_p (Lisp_Object object) { Lisp_Object tail; @@ -6693,8 +6659,10 @@ return NILP (tail); } -/* Store into *addr a value nonzero if terminal input chars are available. - Serves the purpose of ioctl (0, FIONREAD, addr) +/* Return true if terminal input chars are available. + Also, store the return value into INPUT_PENDING. + + Serves the purpose of ioctl (0, FIONREAD, ...) but works even if FIONREAD does not exist. (In fact, this may actually read some input.) @@ -6705,19 +6673,21 @@ If READABLE_EVENTS_IGNORE_SQUEEZABLES is set in FLAGS, ignore mouse movements and toolkit scroll bar thumb drags. */ -static void -get_input_pending (int *addr, int flags) +static bool +get_input_pending (int flags) { /* First of all, have we already counted some input? */ - *addr = (!NILP (Vquit_flag) || readable_events (flags)); + input_pending = (!NILP (Vquit_flag) || readable_events (flags)); /* If input is being read as it arrives, and we have none, there is none. */ - if (*addr > 0 || (interrupt_input && ! interrupts_deferred)) - return; + if (!input_pending && (!interrupt_input || interrupts_deferred)) + { + /* Try to read some input and see how much we get. */ + gobble_input (); + input_pending = (!NILP (Vquit_flag) || readable_events (flags)); + } - /* Try to read some input and see how much we get. */ - gobble_input (); - *addr = (!NILP (Vquit_flag) || readable_events (flags)); + return input_pending; } /* Put a BUFFER_SWITCH_EVENT in the buffer @@ -6767,7 +6737,7 @@ gobble_input (void) { int nread = 0; - int err = 0; + bool err = 0; struct terminal *t; /* Store pending user signal events, if any. */ @@ -7337,9 +7307,9 @@ 0, }; -/* Return non-zero if LABEL specifies a separator. */ +/* Return true if LABEL specifies a separator. */ -int +bool menu_separator_name_p (const char *label) { if (!label) @@ -7514,6 +7484,7 @@ { struct gcpro gcpro1; int i; + bool parsed; Lisp_Object tem; if (EQ (item, Qundefined)) @@ -7545,9 +7516,9 @@ parse_menu_item, so that if it turns out it wasn't a menu item, it still correctly hides any further menu item. */ GCPRO1 (key); - i = parse_menu_item (item, 1); + parsed = parse_menu_item (item, 1); UNGCPRO; - if (!i) + if (!parsed) return; item = AREF (item_properties, ITEM_PROPERTY_DEF); @@ -7623,7 +7594,7 @@ parse_menu_item returns true if the item is a menu item and false otherwise. */ -int +bool parse_menu_item (Lisp_Object item, int inmenubar) { Lisp_Object def, tem, item_string, start; @@ -7923,7 +7894,7 @@ static void init_tool_bar_items (Lisp_Object); static void process_tool_bar_item (Lisp_Object, Lisp_Object, Lisp_Object, void*); -static int parse_tool_bar_item (Lisp_Object, Lisp_Object); +static bool parse_tool_bar_item (Lisp_Object, Lisp_Object); static void append_tool_bar_item (void); @@ -8056,7 +8027,7 @@ /* Parse a tool bar item specification ITEM for key KEY and return the - result in tool_bar_item_properties. Value is zero if ITEM is + result in tool_bar_item_properties. Value is false if ITEM is invalid. ITEM is a list `(menu-item CAPTION BINDING PROPS...)'. @@ -8101,12 +8072,13 @@ A text label to show with the tool bar button if labels are enabled. */ -static int +static bool parse_tool_bar_item (Lisp_Object key, Lisp_Object item) { Lisp_Object filter = Qnil; Lisp_Object caption; - int i, have_label = 0; + int i; + bool have_label = 0; /* Definition looks like `(menu-item CAPTION BINDING PROPS...)'. Rule out items that aren't lists, don't start with @@ -8363,9 +8335,9 @@ PREV_EVENT is the previous input event, or nil if we are reading the first event of a key sequence. - If USED_MOUSE_MENU is non-null, then we set *USED_MOUSE_MENU to 1 - if we used a mouse menu to read the input, or zero otherwise. If - USED_MOUSE_MENU is null, we don't dereference it. + If USED_MOUSE_MENU is non-null, set *USED_MOUSE_MENU to true + if we used a mouse menu to read the input, or false otherwise. If + USED_MOUSE_MENU is null, don't dereference it. The prompting is done based on the prompt-string of the map and the strings associated with various map elements. @@ -8378,7 +8350,7 @@ static Lisp_Object read_char_x_menu_prompt (ptrdiff_t nmaps, Lisp_Object *maps, - Lisp_Object prev_event, int *used_mouse_menu) + Lisp_Object prev_event, bool *used_mouse_menu) { #ifdef HAVE_MENUS ptrdiff_t mapno; @@ -8472,7 +8444,7 @@ /* FIXME: Use the minibuffer's frame width. */ ptrdiff_t width = FRAME_COLS (SELECTED_FRAME ()) - 4; ptrdiff_t idx = -1; - int nobindings = 1; + bool nobindings = 1; Lisp_Object rest, vector; char *menu; @@ -8520,7 +8492,7 @@ /* Present the documented bindings, a line at a time. */ while (1) { - int notfirst = 0; + bool notfirst = 0; ptrdiff_t i = nlength; Lisp_Object obj; Lisp_Object orig_defn_macro; @@ -8576,8 +8548,8 @@ /* Ignore the element if it has no prompt string. */ if (INTEGERP (event) && parse_menu_item (elt, -1)) { - /* 1 if the char to type matches the string. */ - int char_matches; + /* True if the char to type matches the string. */ + bool char_matches; Lisp_Object upcased_event, downcased_event; Lisp_Object desc = Qnil; Lisp_Object s @@ -8629,7 +8601,7 @@ i += 2; } notfirst = 1; - nobindings = 0 ; + nobindings = 0; /* If the char to type doesn't match the string's first char, explicitly show what char to type. */ @@ -8763,14 +8735,14 @@ /* Lookup KEY in MAP. MAP is a keymap mapping keys to key vectors or functions. - If the mapping is a function and DO_FUNCTION is non-zero, then + If the mapping is a function and DO_FUNCALL is true, the function is called with PROMPT as parameter and its return value is used as the return value of this function (after checking that it is indeed a vector). */ static Lisp_Object access_keymap_keyremap (Lisp_Object map, Lisp_Object key, Lisp_Object prompt, - int do_funcall) + bool do_funcall) { Lisp_Object next; @@ -8809,15 +8781,15 @@ BUFSIZE is its maximum size. FKEY is a pointer to the keyremap structure to use. INPUT is the index of the last element in KEYBUF. - DOIT if non-zero says that the remapping can actually take place. + DOIT if true says that the remapping can actually take place. DIFF is used to return the number of keys added/removed by the remapping. PARENT is the root of the keymap. PROMPT is the prompt to use if the remapping happens through a function. - The return value is non-zero if the remapping actually took place. */ + Return true if the remapping actually took place. */ -static int +static bool keyremap_step (Lisp_Object *keybuf, int bufsize, volatile keyremap *fkey, - int input, int doit, int *diff, Lisp_Object prompt) + int input, bool doit, int *diff, Lisp_Object prompt) { Lisp_Object next, key; @@ -8871,7 +8843,7 @@ return 0; } -static int +static bool test_undefined (Lisp_Object binding) { return (EQ (binding, Qundefined) @@ -8913,13 +8885,13 @@ off the switch-frame event until later; the next call to read_char will return it. - If FIX_CURRENT_BUFFER is nonzero, we restore current_buffer + If FIX_CURRENT_BUFFER, we restore current_buffer from the selected window's buffer. */ static int read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, - int dont_downcase_last, int can_return_switch_frame, - int fix_current_buffer) + bool dont_downcase_last, bool can_return_switch_frame, + bool fix_current_buffer) { Lisp_Object from_string; ptrdiff_t count = SPECPDL_INDEX (); @@ -8952,7 +8924,7 @@ key sequence. */ Lisp_Object orig_keymap; - /* 1 if we have already considered switching to the local-map property + /* Positive if we have already considered switching to the local-map property of the place where a mouse click occurred. */ int localized_local_map = 0; @@ -8992,10 +8964,10 @@ /* Likewise, for key_translation_map and input-decode-map. */ keyremap keytran, indec; - /* Non-zero if we are trying to map a key by changing an upper-case + /* True if we are trying to map a key by changing an upper-case letter to lower case, or a shifted function key to an unshifted one. */ - int shift_translated = 0; + bool shift_translated = 0; /* If we receive a `switch-frame' or `select-window' event in the middle of a key sequence, we put it off for later. @@ -9011,7 +8983,7 @@ int original_uppercase_position = -1; /* Gets around Microsoft compiler limitations. */ - int dummyflag = 0; + bool dummyflag = 0; struct buffer *starting_buffer; @@ -9173,7 +9145,7 @@ : (/* indec.start < t || fkey.start < t || */ keytran.start < t)) { Lisp_Object key; - int used_mouse_menu = 0; + bool used_mouse_menu = 0; /* Where the last real key started. If we need to throw away a key that has expanded into more than one element of keybuf @@ -9267,7 +9239,7 @@ return. Any better way to fix this? -- cyd */ || (interrupted_kboard != current_kboard)) { - int found = 0; + bool found = 0; struct kboard *k; for (k = all_kboards; k; k = k->next_kboard) @@ -9821,7 +9793,8 @@ while (indec.end < t) { struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; - int done, diff; + bool done; + int diff; GCPRO4 (indec.map, fkey.map, keytran.map, delayed_switch_frame); done = keyremap_step (keybuf, bufsize, &indec, max (t, mock_input), @@ -9855,7 +9828,8 @@ while (fkey.end < indec.start) { struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; - int done, diff; + bool done; + int diff; GCPRO4 (indec.map, fkey.map, keytran.map, delayed_switch_frame); done = keyremap_step (keybuf, bufsize, &fkey, @@ -9884,7 +9858,8 @@ while (keytran.end < fkey.start) { struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; - int done, diff; + bool done; + int diff; GCPRO4 (indec.map, fkey.map, keytran.map, delayed_switch_frame); done = keyremap_step (keybuf, bufsize, &keytran, max (t, mock_input), @@ -10270,38 +10245,32 @@ -/* Return nonzero if input events are pending. */ +/* Return true if input events are pending. */ -int +bool detect_input_pending (void) { - if (!input_pending) - get_input_pending (&input_pending, 0); - - return input_pending; + return input_pending || get_input_pending (0); } -/* Return nonzero if input events other than mouse movements are +/* Return true if input events other than mouse movements are pending. */ -int +bool detect_input_pending_ignore_squeezables (void) { - if (!input_pending) - get_input_pending (&input_pending, READABLE_EVENTS_IGNORE_SQUEEZABLES); - - return input_pending; + return input_pending || get_input_pending (READABLE_EVENTS_IGNORE_SQUEEZABLES); } -/* Return nonzero if input events are pending, and run any pending timers. */ +/* Return true if input events are pending, and run any pending timers. */ -int -detect_input_pending_run_timers (int do_display) +bool +detect_input_pending_run_timers (bool do_display) { - int old_timers_run = timers_run; + unsigned old_timers_run = timers_run; if (!input_pending) - get_input_pending (&input_pending, READABLE_EVENTS_DO_TIMERS_NOW); + get_input_pending (READABLE_EVENTS_DO_TIMERS_NOW); if (old_timers_run != timers_run && do_display) { @@ -10332,13 +10301,13 @@ input_pending = 0; } -/* Return nonzero if there are pending requeued events. +/* Return true if there are pending requeued events. This isn't used yet. The hope is to make wait_reading_process_output call it, and return if it runs Lisp code that unreads something. The problem is, kbd_buffer_get_event needs to be fixed to know what to do in that case. It isn't trivial. */ -int +bool requeued_events_pending_p (void) { return (!NILP (Vunread_command_events)); @@ -10359,10 +10328,9 @@ /* Process non-user-visible events (Bug#10195). */ process_special_events (); - get_input_pending (&input_pending, - READABLE_EVENTS_DO_TIMERS_NOW - | READABLE_EVENTS_FILTER_EVENTS); - return input_pending > 0 ? Qt : Qnil; + return (get_input_pending (READABLE_EVENTS_DO_TIMERS_NOW + | READABLE_EVENTS_FILTER_EVENTS) + ? Qt : Qnil); } DEFUN ("recent-keys", Frecent_keys, Srecent_keys, 0, 0, 0, @@ -10868,7 +10836,7 @@ /* Handle a C-g by making read_char return C-g. */ static void -quit_throw_to_read_char (int from_signal) +quit_throw_to_read_char (bool from_signal) { /* When not called from a signal handler it is safe to call Lisp. */ @@ -10898,7 +10866,7 @@ See also `current-input-mode'. */) (Lisp_Object interrupt) { - int new_interrupt_input; + bool new_interrupt_input; #ifdef USABLE_SIGIO #ifdef HAVE_X_WINDOWS if (x_display_list != NULL) === modified file 'src/keyboard.h' --- src/keyboard.h 2012-10-07 22:31:58 +0000 +++ src/keyboard.h 2012-10-10 20:09:47 +0000 @@ -169,12 +169,12 @@ reading from this KBOARD again until more input arrives. */ char kbd_queue_has_data; - /* Nonzero means echo each character as typed. */ - char immediate_echo; + /* True means echo each character as typed. */ + unsigned immediate_echo : 1; /* If we have echoed a prompt string specified by the user, this is its length in characters. Otherwise this is -1. */ - char echo_after_prompt; + ptrdiff_t echo_after_prompt; }; KEYBOARD_INLINE void @@ -463,14 +463,14 @@ extern Lisp_Object Qmode_line, Qvertical_line, Qheader_line; /* True while doing kbd input. */ -extern int waiting_for_input; +extern bool waiting_for_input; /* Address (if not 0) of EMACS_TIME to zero out if a SIGIO interrupt happens. */ extern EMACS_TIME *input_available_clear_time; #if defined HAVE_WINDOW_SYSTEM && !defined USE_GTK && !defined HAVE_NS -extern int ignore_mouse_drag_p; +extern bool ignore_mouse_drag_p; #endif /* The primary selection. */ @@ -482,7 +482,7 @@ extern Lisp_Object parse_modifiers (Lisp_Object); extern Lisp_Object reorder_modifiers (Lisp_Object); extern Lisp_Object read_char (int, ptrdiff_t, Lisp_Object *, Lisp_Object, - int *, EMACS_TIME *); + bool *, EMACS_TIME *); extern int parse_solitary_modifier (Lisp_Object symbol); @@ -506,10 +506,10 @@ extern int quit_char; -extern int timers_run; +extern unsigned int timers_run; -extern int menu_separator_name_p (const char *); -extern int parse_menu_item (Lisp_Object, int); +extern bool menu_separator_name_p (const char *); +extern bool parse_menu_item (Lisp_Object, int); extern void init_kboard (KBOARD *); extern void delete_kboard (KBOARD *); @@ -524,15 +524,15 @@ extern void stop_polling (void); extern void set_poll_suppress_count (int); extern int gobble_input (void); -extern int input_polling_used (void); +extern bool input_polling_used (void); extern void clear_input_pending (void); -extern int requeued_events_pending_p (void); +extern bool requeued_events_pending_p (void); extern void bind_polling_period (int); extern int make_ctrl_char (int) ATTRIBUTE_CONST; extern void stuff_buffered_input (Lisp_Object); extern void clear_waiting_for_input (void); -extern void swallow_events (int); -extern int lucid_event_type_list_p (Lisp_Object); +extern void swallow_events (bool); +extern bool lucid_event_type_list_p (Lisp_Object); extern void kbd_buffer_store_event (struct input_event *); extern void kbd_buffer_store_event_hold (struct input_event *, struct input_event *); @@ -544,7 +544,7 @@ Lisp_Object, ptrdiff_t); extern void kbd_buffer_store_help_event (Lisp_Object, Lisp_Object); extern Lisp_Object menu_item_eval_property (Lisp_Object); -extern int kbd_buffer_events_waiting (int); +extern bool kbd_buffer_events_waiting (void); extern void add_user_signal (int, const char *); extern int tty_read_avail_input (struct terminal *, struct input_event *); === modified file 'src/keymap.c' --- src/keymap.c 2012-09-23 08:44:20 +0000 +++ src/keymap.c 2012-10-10 20:09:47 +0000 @@ -99,12 +99,12 @@ static void describe_translation (Lisp_Object, Lisp_Object); static void describe_map (Lisp_Object, Lisp_Object, void (*) (Lisp_Object, Lisp_Object), - int, Lisp_Object, Lisp_Object*, int, int); + bool, Lisp_Object, Lisp_Object*, bool, bool); static void describe_vector (Lisp_Object, Lisp_Object, Lisp_Object, - void (*) (Lisp_Object, Lisp_Object), int, - Lisp_Object, Lisp_Object, int, int); + void (*) (Lisp_Object, Lisp_Object), bool, + Lisp_Object, Lisp_Object, bool, bool); static void silly_event_symbol_error (Lisp_Object); -static Lisp_Object get_keyelt (Lisp_Object, int); +static Lisp_Object get_keyelt (Lisp_Object, bool); /* Keymap object support - constructors and predicates. */ @@ -207,15 +207,12 @@ /* Check that OBJECT is a keymap (after dereferencing through any symbols). If it is, return it. - If AUTOLOAD is non-zero and OBJECT is a symbol whose function value + If AUTOLOAD and if OBJECT is a symbol whose function value is an autoload form, do the autoload and try again. - If AUTOLOAD is nonzero, callers must assume GC is possible. - - If the map needs to be autoloaded, but AUTOLOAD is zero (and ERROR - is zero as well), return Qt. + If AUTOLOAD, callers must assume GC is possible. ERROR_IF_NOT_KEYMAP controls how we respond if OBJECT isn't a keymap. - If ERROR_IF_NOT_KEYMAP is non-zero, signal an error; otherwise, + If ERROR_IF_NOT_KEYMAP, signal an error; otherwise, just return Qnil. Note that most of the time, we don't want to pursue autoloads. @@ -224,11 +221,11 @@ but it seems to me that only read_key_sequence, Flookup_key, and Fdefine_key should cause keymaps to be autoloaded. - This function can GC when AUTOLOAD is non-zero, because it calls + This function can GC when AUTOLOAD is true, because it calls Fautoload_do_load which can GC. */ Lisp_Object -get_keymap (Lisp_Object object, int error_if_not_keymap, int autoload) +get_keymap (Lisp_Object object, bool error_if_not_keymap, bool autoload) { Lisp_Object tem; @@ -280,7 +277,7 @@ We assume that KEYMAP is a valid keymap. */ static Lisp_Object -keymap_parent (Lisp_Object keymap, int autoload) +keymap_parent (Lisp_Object keymap, bool autoload) { Lisp_Object list; @@ -307,7 +304,7 @@ } /* Check whether MAP is one of MAPS parents. */ -static int +static bool keymap_memberp (Lisp_Object map, Lisp_Object maps) { if (NILP (map)) return 0; @@ -365,19 +362,20 @@ MAP must be a keymap or a list of keymaps. - If T_OK is non-zero, bindings for Qt are treated as default + If T_OK, bindings for Qt are treated as default bindings; any key left unmentioned by other tables and bindings is given the binding of Qt. - If T_OK is zero, bindings for Qt are not treated specially. + If not T_OK, bindings for Qt are not treated specially. If NOINHERIT, don't accept a subkeymap found in an inherited keymap. - Returns Qunbound if no binding was found (and returns Qnil if a nil + Return Qunbound if no binding was found (and return Qnil if a nil binding was found). */ static Lisp_Object -access_keymap_1 (Lisp_Object map, Lisp_Object idx, int t_ok, int noinherit, int autoload) +access_keymap_1 (Lisp_Object map, Lisp_Object idx, + bool t_ok, bool noinherit, bool autoload) { /* If idx is a list (some sort of mouse click, perhaps?), the index we want to use is the car of the list, which @@ -547,7 +545,7 @@ Lisp_Object access_keymap (Lisp_Object map, Lisp_Object idx, - int t_ok, int noinherit, int autoload) + bool t_ok, bool noinherit, bool autoload) { Lisp_Object val = access_keymap_1 (map, idx, t_ok, noinherit, autoload); return EQ (val, Qunbound) ? Qnil : val; @@ -630,9 +628,10 @@ } /* Same as map_keymap_internal, but traverses parent keymaps as well. - A non-zero AUTOLOAD indicates that autoloaded keymaps should be loaded. */ + AUTOLOAD indicates that autoloaded keymaps should be loaded. */ void -map_keymap (Lisp_Object map, map_keymap_function_t fun, Lisp_Object args, void *data, int autoload) +map_keymap (Lisp_Object map, map_keymap_function_t fun, Lisp_Object args, + void *data, bool autoload) { struct gcpro gcpro1; GCPRO1 (args); @@ -711,13 +710,13 @@ Also if OBJECT has a menu string as the first element, remove that. Also remove a menu help string as second element. - If AUTOLOAD is nonzero, load autoloadable keymaps + If AUTOLOAD, load autoloadable keymaps that are referred to with indirection. This can GC because menu_item_eval_property calls Feval. */ static Lisp_Object -get_keyelt (Lisp_Object object, int autoload) +get_keyelt (Lisp_Object object, bool autoload) { while (1) { @@ -1114,10 +1113,10 @@ binding KEY to DEF is added at the front of KEYMAP. */) (Lisp_Object keymap, Lisp_Object key, Lisp_Object def) { - register ptrdiff_t idx; - register Lisp_Object c; - register Lisp_Object cmd; - int metized = 0; + ptrdiff_t idx; + Lisp_Object c; + Lisp_Object cmd; + bool metized = 0; int meta_bit; ptrdiff_t length; struct gcpro gcpro1, gcpro2, gcpro3; @@ -1271,11 +1270,11 @@ recognize the default bindings, just as `read-key-sequence' does. */) (Lisp_Object keymap, Lisp_Object key, Lisp_Object accept_default) { - register ptrdiff_t idx; - register Lisp_Object cmd; - register Lisp_Object c; + ptrdiff_t idx; + Lisp_Object cmd; + Lisp_Object c; ptrdiff_t length; - int t_ok = !NILP (accept_default); + bool t_ok = !NILP (accept_default); struct gcpro gcpro1, gcpro2; GCPRO2 (keymap, key); @@ -1887,7 +1886,7 @@ struct accessible_keymaps_data { Lisp_Object maps, tail, thisseq; /* Does the current sequence end in the meta-prefix-char? */ - int is_metized; + bool is_metized; }; static void @@ -1898,7 +1897,7 @@ Lisp_Object maps = d->maps; Lisp_Object tail = d->tail; Lisp_Object thisseq = d->thisseq; - int is_metized = d->is_metized && INTEGERP (key); + bool is_metized = d->is_metized && INTEGERP (key); Lisp_Object tem; cmd = get_keymap (get_keyelt (cmd, 0), 0, 0); @@ -2060,7 +2059,7 @@ Lisp_Object sep = build_string (" "); Lisp_Object key; Lisp_Object result; - int add_meta = 0; + bool add_meta = 0; USE_SAFE_ALLOCA; if (!NILP (prefix)) @@ -2155,9 +2154,10 @@ char * -push_key_description (EMACS_INT ch, char *p, int force_multibyte) +push_key_description (EMACS_INT ch, char *p) { - int c, c2, tab_as_ci; + int c, c2; + bool tab_as_ci; /* Clear all the meaningless bits above the meta bit. */ c = ch & (meta_modifier | ~ - meta_modifier); @@ -2256,21 +2256,12 @@ *p++ = 'P'; *p++ = 'C'; } - else if (c < 128 - || (NILP (BVAR (current_buffer, enable_multibyte_characters)) - && SINGLE_BYTE_CHAR_P (c) - && !force_multibyte)) - { - *p++ = c; - } + else if (c < 128) + *p++ = c; else { /* Now we are sure that C is a valid character code. */ - if (NILP (BVAR (current_buffer, enable_multibyte_characters)) - && ! force_multibyte) - *p++ = multibyte_char_to_unibyte (c); - else - p += CHAR_STRING (c, (unsigned char *) p); + p += CHAR_STRING (c, (unsigned char *) p); } return p; @@ -2299,9 +2290,8 @@ if (INTEGERP (key)) /* Normal character. */ { - char tem[KEY_DESCRIPTION_SIZE], *p; - - p = push_key_description (XINT (key), tem, 1); + char tem[KEY_DESCRIPTION_SIZE]; + char *p = push_key_description (XINT (key), tem); *p = 0; return make_specified_string (tem, -1, p - tem, 1); } @@ -2429,7 +2419,7 @@ static Lisp_Object shadow_lookup (Lisp_Object shadow, Lisp_Object key, Lisp_Object flag, - int remap) + bool remap) { Lisp_Object tail, value; @@ -2461,7 +2451,7 @@ struct where_is_internal_data { Lisp_Object definition, this, last; - int last_is_meta, noindirect; + bool last_is_meta, noindirect; Lisp_Object sequences; }; @@ -2474,7 +2464,7 @@ static Lisp_Object where_is_internal (Lisp_Object definition, Lisp_Object keymaps, - int noindirect, int nomenus) + bool noindirect, bool nomenus) { Lisp_Object maps = Qnil; Lisp_Object found; @@ -2523,7 +2513,7 @@ [M-CHAR] sequences, check if last character of the sequence is the meta-prefix char. */ Lisp_Object last; - int last_is_meta; + bool last_is_meta; this = Fcar (XCAR (maps)); map = Fcdr (XCAR (maps)); @@ -2606,7 +2596,7 @@ /* Actually relevant bindings. */ Lisp_Object found = Qnil; /* 1 means ignore all menu bindings entirely. */ - int nomenus = !NILP (firstonly) && !EQ (firstonly, Qnon_ascii); + bool nomenus = !NILP (firstonly) && !EQ (firstonly, Qnon_ascii); struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; /* List of sequences found via remapping. Keep them in a separate variable, so as to push them later, since we prefer @@ -2615,7 +2605,7 @@ /* Whether or not we're handling remapped sequences. This is needed because remapping is not done recursively by Fcommand_remapping: you can't remap a remapped command. */ - int remapped = 0; + bool remapped = 0; Lisp_Object tem = Qnil; /* Refresh the C version of the modifier preference. */ @@ -2767,10 +2757,10 @@ { struct where_is_internal_data *d = data; /* Cast! */ Lisp_Object definition = d->definition; - int noindirect = d->noindirect; + bool noindirect = d->noindirect; Lisp_Object this = d->this; Lisp_Object last = d->last; - int last_is_meta = d->last_is_meta; + bool last_is_meta = d->last_is_meta; Lisp_Object sequence; /* Search through indirections unless that's not wanted. */ @@ -2821,8 +2811,8 @@ (Lisp_Object buffer, Lisp_Object prefix, Lisp_Object menus) { Lisp_Object outbuf, shadow; - int nomenu = NILP (menus); - register Lisp_Object start1; + bool nomenu = NILP (menus); + Lisp_Object start1; struct gcpro gcpro1; const char *alternate_heading @@ -2857,10 +2847,10 @@ alternate_heading = 0; } - bufend = push_key_description (translate[c], buf, 1); + bufend = push_key_description (translate[c], buf); insert (buf, bufend - buf); Findent_to (make_number (16), make_number (1)); - bufend = push_key_description (c, buf, 1); + bufend = push_key_description (c, buf); insert (buf, bufend - buf); insert ("\n", 1); @@ -2977,34 +2967,34 @@ /* Insert a description of the key bindings in STARTMAP, followed by those of all maps reachable through STARTMAP. - If PARTIAL is nonzero, omit certain "uninteresting" commands + If PARTIAL, omit certain "uninteresting" commands (such as `undefined'). If SHADOW is non-nil, it is a list of maps; don't mention keys which would be shadowed by any of them. PREFIX, if non-nil, says mention only keys that start with PREFIX. TITLE, if not 0, is a string to insert at the beginning. TITLE should not end with a colon or a newline; we supply that. - If NOMENU is not 0, then omit menu-bar commands. + If NOMENU, then omit menu-bar commands. - If TRANSL is nonzero, the definitions are actually key translations + If TRANSL, the definitions are actually key translations so print strings and vectors differently. - If ALWAYS_TITLE is nonzero, print the title even if there are no maps + If ALWAYS_TITLE, print the title even if there are no maps to look through. - If MENTION_SHADOW is nonzero, then when something is shadowed by SHADOW, + If MENTION_SHADOW, then when something is shadowed by SHADOW, don't omit it; instead, mention it but say it is shadowed. Any inserted text ends in two newlines (used by `help-make-xrefs'). */ void -describe_map_tree (Lisp_Object startmap, int partial, Lisp_Object shadow, - Lisp_Object prefix, const char *title, int nomenu, int transl, - int always_title, int mention_shadow) +describe_map_tree (Lisp_Object startmap, bool partial, Lisp_Object shadow, + Lisp_Object prefix, const char *title, bool nomenu, + bool transl, bool always_title, bool mention_shadow) { Lisp_Object maps, orig_maps, seen, sub_shadows; struct gcpro gcpro1, gcpro2, gcpro3; - int something = 0; + bool something = 0; const char *key_heading = "\ key binding\n\ @@ -3179,7 +3169,12 @@ into an array of `struct describe_map_elt', then sorts them by the events. */ -struct describe_map_elt { Lisp_Object event; Lisp_Object definition; int shadowed; }; +struct describe_map_elt +{ + Lisp_Object event; + Lisp_Object definition; + bool shadowed; +}; /* qsort comparison function for sorting `struct describe_map_elt' by the event field. */ @@ -3209,14 +3204,14 @@ static void describe_map (Lisp_Object map, Lisp_Object prefix, void (*elt_describer) (Lisp_Object, Lisp_Object), - int partial, Lisp_Object shadow, - Lisp_Object *seen, int nomenu, int mention_shadow) + bool partial, Lisp_Object shadow, + Lisp_Object *seen, bool nomenu, bool mention_shadow) { Lisp_Object tail, definition, event; Lisp_Object tem; Lisp_Object suppress; Lisp_Object kludge; - int first = 1; + bool first = 1; struct gcpro gcpro1, gcpro2, gcpro3; /* These accumulate the values from sparse keymap bindings, @@ -3258,7 +3253,7 @@ 1, mention_shadow); else if (CONSP (XCAR (tail))) { - int this_shadowed = 0; + bool this_shadowed = 0; event = XCAR (XCAR (tail)); @@ -3428,7 +3423,7 @@ of bytes that lead to the character set or portion of a character set described by this chartable. - If PARTIAL is nonzero, it means do not mention suppressed commands + If PARTIAL, it means do not mention suppressed commands (that assumes the vector is in a keymap). SHADOW is a list of keymaps that shadow this map. @@ -3448,8 +3443,8 @@ static void describe_vector (Lisp_Object vector, Lisp_Object prefix, Lisp_Object args, void (*elt_describer) (Lisp_Object, Lisp_Object), - int partial, Lisp_Object shadow, Lisp_Object entire_map, - int keymap_p, int mention_shadow) + bool partial, Lisp_Object shadow, Lisp_Object entire_map, + bool keymap_p, bool mention_shadow) { Lisp_Object definition; Lisp_Object tem2; @@ -3457,7 +3452,7 @@ int i; Lisp_Object suppress; Lisp_Object kludge; - int first = 1; + bool first = 1; struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; /* Range of elements to be handled. */ int from, to, stop; @@ -3497,7 +3492,7 @@ for (i = from; ; i++) { - int this_shadowed = 0; + bool this_shadowed = 0; int range_beg, range_end; Lisp_Object val; === modified file 'src/keymap.h' --- src/keymap.h 2012-07-03 18:24:42 +0000 +++ src/keymap.h 2012-10-10 20:09:47 +0000 @@ -34,11 +34,11 @@ extern Lisp_Object Qremap; extern Lisp_Object Qmenu_item; extern Lisp_Object current_global_map; -extern char *push_key_description (EMACS_INT, char *, int); -extern Lisp_Object access_keymap (Lisp_Object, Lisp_Object, int, int, int); -extern Lisp_Object get_keymap (Lisp_Object, int, int); -extern void describe_map_tree (Lisp_Object, int, Lisp_Object, Lisp_Object, - const char *, int, int, int, int); +extern char *push_key_description (EMACS_INT, char *); +extern Lisp_Object access_keymap (Lisp_Object, Lisp_Object, bool, bool, bool); +extern Lisp_Object get_keymap (Lisp_Object, bool, bool); +extern void describe_map_tree (Lisp_Object, bool, Lisp_Object, Lisp_Object, + const char *, bool, bool, bool, bool); extern ptrdiff_t current_minor_maps (Lisp_Object **, Lisp_Object **); extern void initial_define_key (Lisp_Object, int, const char *); extern void initial_define_lispy_key (Lisp_Object, const char *, const char *); @@ -47,7 +47,8 @@ typedef void (*map_keymap_function_t) (Lisp_Object key, Lisp_Object val, Lisp_Object args, void* data); -extern void map_keymap (Lisp_Object map, map_keymap_function_t fun, Lisp_Object largs, void* cargs, int autoload); +extern void map_keymap (Lisp_Object, map_keymap_function_t, Lisp_Object, + void *, bool); extern void map_keymap_canonical (Lisp_Object map, map_keymap_function_t fun, Lisp_Object args, void *data); === modified file 'src/lisp.h' --- src/lisp.h 2012-10-10 15:31:21 +0000 +++ src/lisp.h 2012-10-10 20:09:47 +0000 @@ -3198,9 +3198,9 @@ extern ptrdiff_t fast_looking_at (Lisp_Object, ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t, Lisp_Object); extern ptrdiff_t scan_buffer (int, ptrdiff_t, ptrdiff_t, ptrdiff_t, - ptrdiff_t *, int); + ptrdiff_t *, bool); extern EMACS_INT scan_newline (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t, - EMACS_INT, int); + EMACS_INT, bool); extern ptrdiff_t find_next_newline (ptrdiff_t, int); extern ptrdiff_t find_next_newline_no_quit (ptrdiff_t, ptrdiff_t); extern ptrdiff_t find_before_next_newline (ptrdiff_t, ptrdiff_t, ptrdiff_t); @@ -3243,7 +3243,7 @@ extern Lisp_Object Qup, Qdown, Qbottom; extern Lisp_Object Qtop; extern Lisp_Object last_undo_boundary; -extern int input_pending; +extern bool input_pending; extern Lisp_Object menu_bar_items (Lisp_Object); extern Lisp_Object tool_bar_items (Lisp_Object, int *); extern void discard_mouse_events (void); @@ -3251,9 +3251,9 @@ 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); -extern int detect_input_pending_run_timers (int); +extern bool detect_input_pending (void); +extern bool detect_input_pending_ignore_squeezables (void); +extern bool detect_input_pending_run_timers (bool); extern void safe_run_hooks (Lisp_Object); extern void cmd_error_internal (Lisp_Object, const char *); extern Lisp_Object command_loop_1 (void); @@ -3332,7 +3332,7 @@ extern Lisp_Object QCtype, Qlocal; extern Lisp_Object Qprocessp; extern void kill_buffer_processes (Lisp_Object); -extern int wait_reading_process_output (intmax_t, int, int, int, +extern int wait_reading_process_output (intmax_t, int, int, bool, Lisp_Object, struct Lisp_Process *, int); @@ -3559,7 +3559,8 @@ Used during startup to detect startup of dumped Emacs. */ extern bool initialized; -extern int immediate_quit; /* Nonzero means ^G can quit instantly. */ +/* True means ^G can quit instantly. */ +extern bool immediate_quit; extern void *xmalloc (size_t); extern void *xzalloc (size_t); === modified file 'src/menu.c' --- src/menu.c 2012-10-07 22:31:58 +0000 +++ src/menu.c 2012-10-10 20:09:47 +0000 @@ -331,7 +331,7 @@ { Lisp_Object map, item_string, enabled; struct gcpro gcpro1, gcpro2; - int res; + bool res; struct skp *skp = skp_v; /* Parse the menu item and leave the result in item_properties. */ === modified file 'src/nsmenu.m' --- src/nsmenu.m 2012-10-07 10:07:23 +0000 +++ src/nsmenu.m 2012-10-10 20:09:47 +0000 @@ -129,7 +129,7 @@ BOOL needsSet = NO; const char *submenuTitle = [[submenu title] UTF8String]; extern int waiting_for_input; - int owfi; + bool owfi; Lisp_Object items; widget_value *wv, *first_wv, *prev_wv = 0; int i; === modified file 'src/process.c' --- src/process.c 2012-10-07 22:31:58 +0000 +++ src/process.c 2012-10-10 20:09:47 +0000 @@ -4302,7 +4302,7 @@ -1 meaning caller will actually read the input, so don't throw to the quit handler, or - DO_DISPLAY != 0 means redisplay should be done to show subprocess + DO_DISPLAY means redisplay should be done to show subprocess output that arrives. If WAIT_FOR_CELL is a cons cell, wait until its car is non-nil @@ -4322,7 +4322,7 @@ int wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, - int do_display, + bool do_display, Lisp_Object wait_for_cell, struct Lisp_Process *wait_proc, int just_wait_proc) { @@ -4419,7 +4419,7 @@ do { - int old_timers_run = timers_run; + unsigned old_timers_run = timers_run; struct buffer *old_buffer = current_buffer; Lisp_Object old_window = selected_window; @@ -4753,7 +4753,7 @@ if (read_kbd != 0) { - int old_timers_run = timers_run; + unsigned old_timers_run = timers_run; struct buffer *old_buffer = current_buffer; Lisp_Object old_window = selected_window; int leave = 0; @@ -6821,14 +6821,14 @@ see full version for other parameters. We know that wait_proc will always be NULL, since `subprocesses' isn't defined. - DO_DISPLAY != 0 means redisplay should be done to show subprocess + DO_DISPLAY means redisplay should be done to show subprocess output that arrives. Return true if we received input from any process. */ int wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, - int do_display, + bool do_display, Lisp_Object wait_for_cell, struct Lisp_Process *wait_proc, int just_wait_proc) { @@ -6904,7 +6904,7 @@ do { - int old_timers_run = timers_run; + unsigned old_timers_run = timers_run; timer_delay = timer_check (); if (timers_run != old_timers_run && do_display) /* We must retry, since a timer may have requeued itself === modified file 'src/search.c' --- src/search.c 2012-09-23 08:44:20 +0000 +++ src/search.c 2012-10-10 20:09:47 +0000 @@ -636,12 +636,12 @@ If we don't find COUNT instances before reaching END, set *SHORTAGE to the number of TARGETs left unfound, and return END. - If ALLOW_QUIT is non-zero, set immediate_quit. That's good to do + If ALLOW_QUIT, set immediate_quit. That's good to do except when inside redisplay. */ ptrdiff_t -scan_buffer (register int target, ptrdiff_t start, ptrdiff_t end, - ptrdiff_t count, ptrdiff_t *shortage, int allow_quit) +scan_buffer (int target, ptrdiff_t start, ptrdiff_t end, + ptrdiff_t count, ptrdiff_t *shortage, bool allow_quit) { struct region_cache *newline_cache; int direction; @@ -837,23 +837,23 @@ the number of line boundaries left unfound, and position at the limit we bumped up against. - If ALLOW_QUIT is non-zero, set immediate_quit. That's good to do + If ALLOW_QUIT, set immediate_quit. That's good to do except in special cases. */ EMACS_INT scan_newline (ptrdiff_t start, ptrdiff_t start_byte, ptrdiff_t limit, ptrdiff_t limit_byte, - register EMACS_INT count, int allow_quit) + EMACS_INT count, bool allow_quit) { int direction = ((count > 0) ? 1 : -1); - register unsigned char *cursor; + unsigned char *cursor; unsigned char *base; ptrdiff_t ceiling; - register unsigned char *ceiling_addr; + unsigned char *ceiling_addr; - int old_immediate_quit = immediate_quit; + bool old_immediate_quit = immediate_quit; /* The code that follows is like scan_buffer but checks for either newline or carriage return. */ === modified file 'src/termopts.h' --- src/termopts.h 2012-10-10 15:10:57 +0000 +++ src/termopts.h 2012-10-10 20:09:47 +0000 @@ -18,7 +18,7 @@ /* Nonzero means use interrupt-driven input. */ -extern int interrupt_input; +extern bool interrupt_input; /* Nonzero while interrupts are temporarily deferred during redisplay. */ -extern int interrupts_deferred; +extern bool interrupts_deferred; ------------------------------------------------------------ revno: 110501 committer: Paul Eggert branch nick: trunk timestamp: Wed 2012-10-10 12:53:26 -0700 message: * regex.c (immediate_quit) [emacs]: Remove duplicate decl. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-10-10 15:59:49 +0000 +++ src/ChangeLog 2012-10-10 19:53:26 +0000 @@ -1,3 +1,7 @@ +2012-10-10 Paul Eggert + + * regex.c (immediate_quit) [emacs]: Remove duplicate decl. + 2012-10-10 Juanma Barranquero * makefile.w32-in ($(BLD)/dispnew.$(O), $(BLD)/indent.$(O)) === modified file 'src/regex.c' --- src/regex.c 2012-09-16 21:43:55 +0000 +++ src/regex.c 2012-10-10 19:53:26 +0000 @@ -1834,7 +1834,6 @@ /* Explicit quit checking is needed for Emacs, which uses polling to process input events. */ #ifdef emacs -extern int immediate_quit; # define IMMEDIATE_QUIT_CHECK \ do { \ if (immediate_quit) QUIT; \ ------------------------------------------------------------ revno: 110500 committer: Juanma Barranquero branch nick: trunk timestamp: Wed 2012-10-10 17:59:49 +0200 message: src/makefile.w32-in: Update dependencies. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-10-10 15:31:21 +0000 +++ src/ChangeLog 2012-10-10 15:59:49 +0000 @@ -1,3 +1,8 @@ +2012-10-10 Juanma Barranquero + + * makefile.w32-in ($(BLD)/dispnew.$(O), $(BLD)/indent.$(O)) + ($(BLD)/term.$(O)): Update dependencies. + 2012-10-10 Dmitry Antipov * alloc.c (mark_object): Use meaningful PVEC_NORMAL_VECTOR. === modified file 'src/makefile.w32-in' --- src/makefile.w32-in 2012-10-08 14:37:04 +0000 +++ src/makefile.w32-in 2012-10-10 15:59:49 +0000 @@ -735,7 +735,6 @@ $(SRC)/disptab.h \ $(SRC)/indent.h \ $(SRC)/termchar.h \ - $(SRC)/termopts.h \ $(NT_INC)/unistd.h \ $(BUFFER_H) \ $(CHARACTER_H) \ @@ -1015,7 +1014,6 @@ $(SRC)/indent.h \ $(SRC)/region-cache.h \ $(SRC)/termchar.h \ - $(SRC)/termopts.h \ $(BUFFER_H) \ $(CHARACTER_H) \ $(CONFIG_H) \ @@ -1412,7 +1410,6 @@ $(SRC)/disptab.h \ $(SRC)/keymap.h \ $(SRC)/termchar.h \ - $(SRC)/termopts.h \ $(SRC)/tparam.h \ $(NT_INC)/sys/file.h \ $(NT_INC)/sys/time.h \ ------------------------------------------------------------ revno: 110499 committer: Dmitry Antipov branch nick: trunk timestamp: Wed 2012-10-10 19:31:21 +0400 message: * alloc.c (mark_object): Use meaningful PVEC_NORMAL_VECTOR. * lisp.h (enum pvec_type): Adjust comments and omit explicit initializer for PVEC_NORMAL_VECTOR. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-10-10 15:10:57 +0000 +++ src/ChangeLog 2012-10-10 15:31:21 +0000 @@ -1,3 +1,9 @@ +2012-10-10 Dmitry Antipov + + * alloc.c (mark_object): Use meaningful PVEC_NORMAL_VECTOR. + * lisp.h (enum pvec_type): Adjust comments and omit explicit + initializer for PVEC_NORMAL_VECTOR. + 2012-10-10 Paul Eggert Clean out old termopts cruft. === modified file 'src/alloc.c' --- src/alloc.c 2012-10-10 14:45:07 +0000 +++ src/alloc.c 2012-10-10 15:31:21 +0000 @@ -5689,7 +5689,7 @@ pvectype = ((ptr->header.size & PVEC_TYPE_MASK) >> PSEUDOVECTOR_SIZE_BITS); else - pvectype = 0; + pvectype = PVEC_NORMAL_VECTOR; if (pvectype != PVEC_SUBR && pvectype != PVEC_BUFFER) CHECK_LIVE (live_vector_p); === modified file 'src/lisp.h' --- src/lisp.h 2012-10-04 05:52:49 +0000 +++ src/lisp.h 2012-10-10 15:31:21 +0000 @@ -345,15 +345,11 @@ = PSEUDOVECTOR_FLAG; /* In a pseudovector, the size field actually contains a word with one - PSEUDOVECTOR_FLAG bit set, and exactly one of the following bits to - indicate the actual type. - We use a bitset, even tho only one of the bits can be set at any - particular time just so as to be able to use micro-optimizations such as - testing membership of a particular subset of pseudovectors in Fequal. - It is not crucial, but there are plenty of bits here, so why not do it? */ + PSEUDOVECTOR_FLAG bit set, and one of the following values extracted + with PVEC_TYPE_MASK to indicate the actual type. */ enum pvec_type { - PVEC_NORMAL_VECTOR = 0, /* Unused! */ + PVEC_NORMAL_VECTOR, PVEC_FREE, PVEC_PROCESS, PVEC_FRAME, ------------------------------------------------------------ revno: 110498 committer: Paul Eggert branch nick: trunk timestamp: Wed 2012-10-10 08:10:57 -0700 message: Clean out old termopts cruft. * termopts.h (flow_control, meta_key): Remove unused decls. * dispnew.c, indent.c, nsterm.m, term.c, xsettings.c, xsmfns.c: Don't include termopts.h. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-10-10 14:45:07 +0000 +++ src/ChangeLog 2012-10-10 15:10:57 +0000 @@ -1,3 +1,10 @@ +2012-10-10 Paul Eggert + + Clean out old termopts cruft. + * termopts.h (flow_control, meta_key): Remove unused decls. + * dispnew.c, indent.c, nsterm.m, term.c, xsettings.c, xsmfns.c: + Don't include termopts.h. + 2012-10-10 Dmitry Antipov * alloc.c (gc_sweep): Use pointer-to-a-pointer loop for buffers. === modified file 'src/dispnew.c' --- src/dispnew.c 2012-10-01 06:36:54 +0000 +++ src/dispnew.c 2012-10-10 15:10:57 +0000 @@ -26,7 +26,6 @@ #include "lisp.h" #include "termchar.h" -#include "termopts.h" /* cm.h must come after dispextern.h on Windows. */ #include "dispextern.h" #include "cm.h" === modified file 'src/indent.c' --- src/indent.c 2012-09-24 21:38:23 +0000 +++ src/indent.c 2012-10-10 15:10:57 +0000 @@ -30,7 +30,6 @@ #include "frame.h" #include "window.h" #include "termchar.h" -#include "termopts.h" #include "disptab.h" #include "intervals.h" #include "dispextern.h" === modified file 'src/nsterm.m' --- src/nsterm.m 2012-10-07 11:09:04 +0000 +++ src/nsterm.m 2012-10-10 15:10:57 +0000 @@ -55,7 +55,6 @@ #include "ccl.h" #include "termhooks.h" -#include "termopts.h" #include "termchar.h" #include "window.h" @@ -1315,7 +1314,7 @@ ns_fullscreen_hook (FRAME_PTR f) { EmacsView *view = (EmacsView *)FRAME_NS_VIEW (f); - + if (! f->async_visible) return; #ifndef NEW_STYLE_FS if (f->want_fullscreen == FULLSCREEN_BOTH) @@ -5942,7 +5941,7 @@ [w setBackgroundColor: col]; if ([col alphaComponent] != 1.0) [w setOpaque: NO]; - + f->border_width = bwidth; FRAME_NS_TITLEBAR_HEIGHT (f) = tibar_height; FRAME_TOOLBAR_HEIGHT (f) = tobar_height; @@ -5995,7 +5994,7 @@ } break; } - + emacsframe->want_fullscreen = FULLSCREEN_NONE; } === modified file 'src/term.c' --- src/term.c 2012-09-23 08:44:20 +0000 +++ src/term.c 2012-10-10 15:10:57 +0000 @@ -28,7 +28,6 @@ #include "lisp.h" #include "termchar.h" -#include "termopts.h" #include "tparam.h" #include "character.h" #include "buffer.h" === modified file 'src/termopts.h' --- src/termopts.h 2012-01-19 07:21:25 +0000 +++ src/termopts.h 2012-10-10 15:10:57 +0000 @@ -17,15 +17,8 @@ along with GNU Emacs. If not, see . */ -/* Nonzero means use ^S/^Q as cretinous flow control. */ -extern int flow_control; - /* Nonzero means use interrupt-driven input. */ extern int interrupt_input; /* Nonzero while interrupts are temporarily deferred during redisplay. */ extern int interrupts_deferred; - -/* Terminal has meta key */ -extern int meta_key; - === modified file 'src/xsettings.c' --- src/xsettings.c 2012-09-23 08:44:20 +0000 +++ src/xsettings.c 2012-10-10 15:10:57 +0000 @@ -29,7 +29,6 @@ #include "keyboard.h" #include "blockinput.h" #include "termhooks.h" -#include "termopts.h" #include === modified file 'src/xsmfns.c' --- src/xsmfns.c 2012-09-15 07:06:56 +0000 +++ src/xsmfns.c 2012-10-10 15:10:57 +0000 @@ -35,7 +35,6 @@ #include "sysselect.h" #include "frame.h" #include "termhooks.h" -#include "termopts.h" #include "xterm.h" #include "process.h" #include "keyboard.h" ------------------------------------------------------------ revno: 110497 [merge] committer: Kenichi Handa branch nick: trunk timestamp: Wed 2012-10-10 23:48:24 +0900 message: select.el (xselect--encode-string): If a coding is specified for selection, and that is compatible with COMPOUND_TEXT, use it. diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-10-10 09:36:45 +0000 +++ lisp/ChangeLog 2012-10-10 14:45:26 +0000 @@ -1,3 +1,8 @@ +2012-10-10 Kenichi Handa + + * select.el (xselect--encode-string): If a coding is specified for + selection, and that is compatible with COMPOUND_TEXT, use it. + 2012-10-10 Martin Rudalics * window.el (switch-to-buffer-preserve-window-point): New option. === modified file 'lisp/select.el' --- lisp/select.el 2012-05-09 03:06:08 +0000 +++ lisp/select.el 2012-10-10 14:45:26 +0000 @@ -248,7 +248,17 @@ (setq non-unicode t) (setq eight-bit t))))) str) - (setq type (if non-unicode 'COMPOUND_TEXT + (setq type (if (or non-unicode + (and + non-latin-1 + ;; If a coding is specified for + ;; selection, and that is + ;; compatible with COMPOUND_TEXT, + ;; use it. + coding + (eq (coding-system-get coding :mime-charset) + 'x-ctext))) + 'COMPOUND_TEXT (if non-latin-1 'UTF8_STRING (if eight-bit 'C_STRING 'STRING)))))))) ------------------------------------------------------------ revno: 110496 committer: Dmitry Antipov branch nick: trunk timestamp: Wed 2012-10-10 18:45:07 +0400 message: * alloc.c (gc_sweep): Use pointer-to-a-pointer loop for buffers. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-10-10 06:39:16 +0000 +++ src/ChangeLog 2012-10-10 14:45:07 +0000 @@ -1,3 +1,7 @@ +2012-10-10 Dmitry Antipov + + * alloc.c (gc_sweep): Use pointer-to-a-pointer loop for buffers. + 2012-10-10 Paul Eggert * commands.h (immediate_quit): Remove duplicate decl. === modified file 'src/alloc.c' --- src/alloc.c 2012-10-01 06:36:54 +0000 +++ src/alloc.c 2012-10-10 14:45:07 +0000 @@ -6311,19 +6311,14 @@ /* Free all unmarked buffers */ { - register struct buffer *buffer = all_buffers, *prev = 0, *next; + register struct buffer *buffer, **bprev = &all_buffers; total_buffers = 0; - while (buffer) + for (buffer = all_buffers; buffer; buffer = *bprev) if (!VECTOR_MARKED_P (buffer)) { - if (prev) - prev->header.next = buffer->header.next; - else - all_buffers = buffer->header.next.buffer; - next = buffer->header.next.buffer; + *bprev = buffer->header.next.buffer; lisp_free (buffer); - buffer = next; } else { @@ -6331,7 +6326,7 @@ /* Do not use buffer_(set|get)_intervals here. */ buffer->text->intervals = balance_intervals (buffer->text->intervals); total_buffers++; - prev = buffer, buffer = buffer->header.next.buffer; + bprev = &buffer->header.next.buffer; } } ------------------------------------------------------------ revno: 110495 committer: martin rudalics branch nick: trunk timestamp: Wed 2012-10-10 11:36:45 +0200 message: In switch-to-buffer optionally restore window point (Bug#4041). * window.el (switch-to-buffer-preserve-window-point): New option. (switch-to-buffer): Obey `switch-to-buffer-preserve-window-point' (Bug#4041). diff: === modified file 'lisp/ChangeLog' --- lisp/ChangeLog 2012-10-09 16:37:51 +0000 +++ lisp/ChangeLog 2012-10-10 09:36:45 +0000 @@ -1,3 +1,9 @@ +2012-10-10 Martin Rudalics + + * window.el (switch-to-buffer-preserve-window-point): New option. + (switch-to-buffer): Obey + `switch-to-buffer-preserve-window-point' (Bug#4041). + 2012-10-09 Stefan Monnier * newcomment.el (comment-start-skip, comment-end-skip, comment-end): === modified file 'lisp/window.el' --- lisp/window.el 2012-10-07 15:54:30 +0000 +++ lisp/window.el 2012-10-10 09:36:45 +0000 @@ -5818,6 +5818,26 @@ buffer)) (other-buffer))) +(defcustom switch-to-buffer-preserve-window-point nil + "If non-nil, `switch-to-buffer' tries to preserve `window-point'. +If this is nil, `switch-to-buffer' displays the buffer at that +buffer's `point'. If this is `already-displayed', it tries to +display the buffer at its pevious position in the selected +window, provided the buffer is currently displayed in some other +window on any visible or iconified frame. If this is t, it +unconditionally tries to display the buffer at its previous +position in the selected window. + +This variable is ignored if the the buffer is already displayed +in the selected window or never appeared in it before, or if +`switch-to-buffer' calls `pop-to-buffer' to display the buffer." + :type '(choice + (const :tag "Never" nil) + (const :tag "If already displayed elsewhere" already-displayed) + (const :tag "Always" t)) + :group 'windows + :version "24.3") + (defun switch-to-buffer (buffer-or-name &optional norecord force-same-window) "Switch to buffer BUFFER-OR-NAME in the selected window. If the selected window cannot display the specified @@ -5843,6 +5863,10 @@ must be displayed in the selected window; if that is impossible, signal an error rather than calling `pop-to-buffer'. +The option `switch-to-buffer-preserve-window-point' can be used +to make the buffer appear at its last position in the selected +window. + Return the buffer switched to." (interactive (list (read-buffer-to-switch "Switch to buffer: ") nil 'force-same-window)) @@ -5859,7 +5883,19 @@ (if force-same-window (user-error "Cannot switch buffers in a dedicated window") (pop-to-buffer buffer norecord))) - (t (set-window-buffer nil buffer))) + (t + (let* ((entry (assq buffer (window-prev-buffers))) + (displayed (and (eq switch-to-buffer-preserve-window-point + 'already-displayed) + (get-buffer-window buffer 0)))) + (set-window-buffer nil buffer) + (when (and entry + (or (eq switch-to-buffer-preserve-window-point t) + displayed)) + ;; Try to restore start and point of buffer in the selected + ;; window (Bug#4041). + (set-window-start (selected-window) (nth 1 entry) t) + (set-window-point nil (nth 2 entry)))))) (unless norecord (select-window (selected-window))) ------------------------------------------------------------ revno: 110494 committer: Paul Eggert branch nick: trunk timestamp: Tue 2012-10-09 23:39:16 -0700 message: * commands.h (immediate_quit): Remove duplicate decl. diff: === modified file 'src/ChangeLog' --- src/ChangeLog 2012-10-09 18:33:01 +0000 +++ src/ChangeLog 2012-10-10 06:39:16 +0000 @@ -1,3 +1,7 @@ +2012-10-10 Paul Eggert + + * commands.h (immediate_quit): Remove duplicate decl. + 2012-10-09 Jan Djärv * nsfont.m (Vfonts_in_cache): Remove, not needed as font.c handles === modified file 'src/commands.h' --- src/commands.h 2012-01-19 07:21:25 +0000 +++ src/commands.h 2012-10-10 06:39:16 +0000 @@ -36,9 +36,6 @@ events until a non-ASCII event is acceptable as input. */ extern Lisp_Object unread_switch_frame; -/* Nonzero means ^G can quit instantly */ -extern int immediate_quit; - /* Nonzero if input is coming from the keyboard */ #define INTERACTIVE (NILP (Vexecuting_kbd_macro) && !noninteractive) ------------------------------------------------------------ Use --include-merged or -n0 to see merged revisions.