aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2012-10-12 11:45:45 +0200
committerEli Zaretskii2012-10-12 11:45:45 +0200
commit0dc9ee4adad0b566c32036a4c201a1de882ac65b (patch)
treea61f585563633f0f38838012771dae63a3cef098 /src
parent182b170f7ec712b7f89ada65095aae5bb8fe553e (diff)
parent81749a2374c78d656888b462f3b29301e4cbd1c7 (diff)
downloademacs-0dc9ee4adad0b566c32036a4c201a1de882ac65b.tar.gz
emacs-0dc9ee4adad0b566c32036a4c201a1de882ac65b.zip
Merge from trunk.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog131
-rw-r--r--src/alloc.c15
-rw-r--r--src/buffer.c33
-rw-r--r--src/commands.h3
-rw-r--r--src/dispnew.c10
-rw-r--r--src/editfns.c17
-rw-r--r--src/eval.c8
-rw-r--r--src/indent.c1
-rw-r--r--src/keyboard.c312
-rw-r--r--src/keyboard.h28
-rw-r--r--src/keymap.c159
-rw-r--r--src/keymap.h13
-rw-r--r--src/lisp.h29
-rw-r--r--src/lread.c166
-rw-r--r--src/macros.c2
-rw-r--r--src/makefile.w32-in3
-rw-r--r--src/marker.c18
-rw-r--r--src/menu.c29
-rw-r--r--src/menu.h8
-rw-r--r--src/minibuf.c27
-rw-r--r--src/nsfont.m6
-rw-r--r--src/nsmenu.m12
-rw-r--r--src/nsterm.h4
-rw-r--r--src/nsterm.m7
-rw-r--r--src/process.c14
-rw-r--r--src/regex.c1
-rw-r--r--src/search.c16
-rw-r--r--src/term.c1
-rw-r--r--src/termopts.h11
-rw-r--r--src/w32select.c2
-rw-r--r--src/xmenu.c25
-rw-r--r--src/xsettings.c1
-rw-r--r--src/xsmfns.c1
33 files changed, 592 insertions, 521 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 25a4e92a1ca..34e730183de 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,134 @@
12012-10-12 Glenn Morris <rgm@gnu.org>
2
3 * buffer.c (Fset_buffer): Doc fix. (Bug#12624)
4
52012-10-11 Stefan Monnier <monnier@iro.umontreal.ca>
6
7 * buffer.c (Fkill_buffer): Null out the overlay list(s) as well.
8
9 * eval.c (Fautoload): Remember previous autoload status in load-history.
10
112012-10-11 Paul Eggert <eggert@cs.ucla.edu>
12
13 lread.c, macros.c, marker.c, menu.c, minibuf.c: Use bool for booleans.
14 * lread.c (load_each_byte, new_backquote_flag, readchar)
15 (read_filtered_event, lisp_file_lexically_bound_p)
16 (safe_to_load_version, Fload, complete_filename_p, openp)
17 (build_load_history, readevalloop, read_escape, read1)
18 (string_to_number, read_vector, read_list):
19 * macros.c (Fstart_kbd_macro):
20 * marker.c (CONSIDER):
21 * menu.c (parse_single_submenu, digest_single_submenu)
22 (find_and_return_menu_selection, Fx_popup_menu):
23 * minibuf.c (read_minibuf_noninteractive, read_minibuf)
24 (Ftry_completion):
25 * nsmenu.m (ns_update_menubar, runMenuAt:forFrame:keymaps:):
26 (ns_menu_show):
27 * xmenu.c (set_frame_menubar, create_and_show_popup_menu)
28 (xmenu_show, xdialog_show):
29 Use bool for booleans.
30 * lread.c (safe_to_load_version): Rename from safe_to_load_p,
31 as it's not a predicate. All uses changed. Omit unnecessary
32 buffer termination.
33
342012-10-11 Dmitry Antipov <dmantipov@yandex.ru>
35
36 * editfns.c (save_excursion_save): Use nil if mark points to nowhere.
37 (save_excursion_restore): Do not restore mark if it was not saved.
38
392012-10-11 Paul Eggert <eggert@cs.ucla.edu>
40
41 * marker.c (cached_modiff): EMACS_INT, not int.
42
43 * w32select.c (waiting_for_input): Declare by including "keyboard.h"
44 instead of having a wrong decl.
45 * nsmenu.m (waiting_for_input): Remove wrong decl.
46
472012-10-10 Paul Eggert <eggert@cs.ucla.edu>
48
49 keyboard.c, keymap.c: Use bool for booleans.
50 * dispnew.c (sit_for): Distinguish between 3-way display_option
51 and boolean do_display.
52 * keyboard.c (single_kboard, this_command_key_count_reset)
53 (waiting_for_input, echoing, immediate_quit, input_pending)
54 (interrupt_input, interrupts_deferred, pop_kboard)
55 (temporarily_switch_to_single_kboard, ignore_mouse_drag_p)
56 (command_loop_1, adjust_point_for_property)
57 (safe_run_hooks_error, input_polling_used, read_char):
58 (help_char_p, readable_events, kbd_buffer_events_waiting)
59 (kbd_buffer_get_event, timer_check_2, make_lispy_event)
60 (lucid_event_type_list_p, get_input_pending):
61 (gobble_input, menu_separator_name_p, menu_bar_item)
62 (parse_menu_item, parse_tool_bar_item, read_char_x_menu_prompt)
63 (read_char_minibuf_menu_prompt, access_keymap_keyremap)
64 (keyremap_step, test_undefined, read_key_sequence)
65 (detect_input_pending, detect_input_pending_ignore_squeezables)
66 (detect_input_pending_run_timers, requeued_events_pending_p)
67 (quit_throw_to_read_char, Fset_input_interrupt_mode):
68 * keymap.c (get_keymap, keymap_parent, keymap_memberp)
69 (access_keymap_1, access_keymap, map_keymap, get_keyelt)
70 (Fdefine_key, Flookup_key, struct accessible_keymaps_data)
71 (accessible_keymaps_1, Fkey_description, push_key_description):
72 (shadow_lookup, struct where_is_internal_data)
73 (where_is_internal, Fwhere_is_internal, where_is_internal_1)
74 (Fdescribe_buffer_bindings, describe_map_tree, struct describe_map_elt)
75 (describe_map, describe_vector):
76 * menu.c (single_menu_item):
77 * nsmenu.m (ns_update_menubar):
78 * process.c (wait_reading_process_output):
79 * search.c (scan_buffer, scan_newline):
80 Use bool for boolean.
81 * keyboard.c (timers_run, swallow_events)
82 (detect_input_pending_run_timers):
83 * process.c (wait_reading_process_output):
84 Use unsigned for counter where wraparound-on-overflow is desired,
85 since unsigned is guaranteed to have that behavior and signed is not.
86 (read_char): Use ptrdiff_t for string length.
87 (get_input_pending): Remove first argument, since it was always
88 the same pointer-to-int (now pointer-to-boolean) &input_pending,
89 and behave as if it had that value. Return new value of
90 input_pending. All callers changed.
91 * keyboard.h (struct kboard): Use unsigned : 1 for boolean member
92 immediate_echo. Use ptrdiff_t for echo_after_prompt, since it's
93 a string length.
94 * keymap.c (push_key_description): Omit last arg, which was always 1.
95 All callers changed.
96
97 * regex.c (immediate_quit) [emacs]: Remove duplicate decl.
98
992012-10-10 Juanma Barranquero <lekktu@gmail.com>
100
101 * makefile.w32-in ($(BLD)/dispnew.$(O), $(BLD)/indent.$(O))
102 ($(BLD)/term.$(O)): Update dependencies.
103
1042012-10-10 Dmitry Antipov <dmantipov@yandex.ru>
105
106 * alloc.c (mark_object): Use meaningful PVEC_NORMAL_VECTOR.
107 * lisp.h (enum pvec_type): Adjust comments and omit explicit
108 initializer for PVEC_NORMAL_VECTOR.
109
1102012-10-10 Paul Eggert <eggert@cs.ucla.edu>
111
112 Clean out old termopts cruft.
113 * termopts.h (flow_control, meta_key): Remove unused decls.
114 * dispnew.c, indent.c, nsterm.m, term.c, xsettings.c, xsmfns.c:
115 Don't include termopts.h.
116
1172012-10-10 Dmitry Antipov <dmantipov@yandex.ru>
118
119 * alloc.c (gc_sweep): Use pointer-to-a-pointer loop for buffers.
120
1212012-10-10 Paul Eggert <eggert@cs.ucla.edu>
122
123 * commands.h (immediate_quit): Remove duplicate decl.
124
1252012-10-09 Jan Djärv <jan.h.d@swipnet.se>
126
127 * nsfont.m (Vfonts_in_cache): Remove, not needed as font.c handles
128 caching.
129 (nsfont_open): Remove setting of Vfonts_in_cache.
130 (syms_of_nsfont): Remove initialization of Vfonts_in_cache
131
12012-10-09 Eli Zaretskii <eliz@gnu.org> 1322012-10-09 Eli Zaretskii <eliz@gnu.org>
2 133
3 * w32fns.c (w32_last_error): Change the return value to DWORD, to 134 * w32fns.c (w32_last_error): Change the return value to DWORD, to
diff --git a/src/alloc.c b/src/alloc.c
index dd3a93ae019..4fd659bd001 100644
--- a/src/alloc.c
+++ b/src/alloc.c
@@ -5689,7 +5689,7 @@ mark_object (Lisp_Object arg)
5689 pvectype = ((ptr->header.size & PVEC_TYPE_MASK) 5689 pvectype = ((ptr->header.size & PVEC_TYPE_MASK)
5690 >> PSEUDOVECTOR_SIZE_BITS); 5690 >> PSEUDOVECTOR_SIZE_BITS);
5691 else 5691 else
5692 pvectype = 0; 5692 pvectype = PVEC_NORMAL_VECTOR;
5693 5693
5694 if (pvectype != PVEC_SUBR && pvectype != PVEC_BUFFER) 5694 if (pvectype != PVEC_SUBR && pvectype != PVEC_BUFFER)
5695 CHECK_LIVE (live_vector_p); 5695 CHECK_LIVE (live_vector_p);
@@ -6311,19 +6311,14 @@ gc_sweep (void)
6311 6311
6312 /* Free all unmarked buffers */ 6312 /* Free all unmarked buffers */
6313 { 6313 {
6314 register struct buffer *buffer = all_buffers, *prev = 0, *next; 6314 register struct buffer *buffer, **bprev = &all_buffers;
6315 6315
6316 total_buffers = 0; 6316 total_buffers = 0;
6317 while (buffer) 6317 for (buffer = all_buffers; buffer; buffer = *bprev)
6318 if (!VECTOR_MARKED_P (buffer)) 6318 if (!VECTOR_MARKED_P (buffer))
6319 { 6319 {
6320 if (prev) 6320 *bprev = buffer->header.next.buffer;
6321 prev->header.next = buffer->header.next;
6322 else
6323 all_buffers = buffer->header.next.buffer;
6324 next = buffer->header.next.buffer;
6325 lisp_free (buffer); 6321 lisp_free (buffer);
6326 buffer = next;
6327 } 6322 }
6328 else 6323 else
6329 { 6324 {
@@ -6331,7 +6326,7 @@ gc_sweep (void)
6331 /* Do not use buffer_(set|get)_intervals here. */ 6326 /* Do not use buffer_(set|get)_intervals here. */
6332 buffer->text->intervals = balance_intervals (buffer->text->intervals); 6327 buffer->text->intervals = balance_intervals (buffer->text->intervals);
6333 total_buffers++; 6328 total_buffers++;
6334 prev = buffer, buffer = buffer->header.next.buffer; 6329 bprev = &buffer->header.next.buffer;
6335 } 6330 }
6336 } 6331 }
6337 6332
diff --git a/src/buffer.c b/src/buffer.c
index 425d05ca790..861a89b5a0f 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -897,6 +897,8 @@ delete_all_overlays (struct buffer *b)
897{ 897{
898 struct Lisp_Overlay *ov, *next; 898 struct Lisp_Overlay *ov, *next;
899 899
900 /* FIXME: Since each drop_overlay will scan BUF_MARKERS to unlink its
901 markers, we have an unneeded O(N^2) behavior here. */
900 for (ov = b->overlays_before; ov; ov = next) 902 for (ov = b->overlays_before; ov; ov = next)
901 { 903 {
902 drop_overlay (b, ov); 904 drop_overlay (b, ov);
@@ -1886,16 +1888,19 @@ cleaning up all windows currently displaying the buffer to be killed. */)
1886 1888
1887 if (b->base_buffer) 1889 if (b->base_buffer)
1888 { 1890 {
1889 /* Unchain all markers that belong to this indirect buffer. 1891 { /* Unchain all markers that belong to this indirect buffer.
1890 Don't unchain the markers that belong to the base buffer 1892 Don't unchain the markers that belong to the base buffer
1891 or its other indirect buffers. */ 1893 or its other indirect buffers. */
1892 for (m = BUF_MARKERS (b); m; ) 1894 struct Lisp_Marker **mp;
1893 { 1895 for (mp = &BUF_MARKERS (b); *mp; )
1894 struct Lisp_Marker *next = m->next; 1896 {
1895 if (m->buffer == b) 1897 struct Lisp_Marker *m = *mp;
1896 unchain_marker (m); 1898 if (m->buffer == b)
1897 m = next; 1899 *mp = m->next;
1898 } 1900 else
1901 mp = &m->next;
1902 }
1903 }
1899 } 1904 }
1900 else 1905 else
1901 { 1906 {
@@ -1911,8 +1916,12 @@ cleaning up all windows currently displaying the buffer to be killed. */)
1911 BUF_MARKERS (b) = NULL; 1916 BUF_MARKERS (b) = NULL;
1912 set_buffer_intervals (b, NULL); 1917 set_buffer_intervals (b, NULL);
1913 1918
1914 /* Perhaps we should explicitly free the interval tree here... */ 1919 /* Perhaps we should explicitly free the interval tree here... */
1915 } 1920 }
1921 /* Since we've unlinked the markers, the overlays can't be here any more
1922 either. */
1923 b->overlays_before = NULL;
1924 b->overlays_after = NULL;
1916 1925
1917 /* Reset the local variables, so that this buffer's local values 1926 /* Reset the local variables, so that this buffer's local values
1918 won't be protected from GC. They would be protected 1927 won't be protected from GC. They would be protected
@@ -2176,7 +2185,7 @@ set_buffer_temp (struct buffer *b)
2176DEFUN ("set-buffer", Fset_buffer, Sset_buffer, 1, 1, 0, 2185DEFUN ("set-buffer", Fset_buffer, Sset_buffer, 1, 1, 0,
2177 doc: /* Make buffer BUFFER-OR-NAME current for editing operations. 2186 doc: /* Make buffer BUFFER-OR-NAME current for editing operations.
2178BUFFER-OR-NAME may be a buffer or the name of an existing buffer. See 2187BUFFER-OR-NAME may be a buffer or the name of an existing buffer. See
2179also `save-excursion' when you want to make a buffer current 2188also `with-current-buffer' when you want to make a buffer current
2180temporarily. This function does not display the buffer, so its effect 2189temporarily. This function does not display the buffer, so its effect
2181ends when the current command terminates. Use `switch-to-buffer' or 2190ends when the current command terminates. Use `switch-to-buffer' or
2182`pop-to-buffer' to switch buffers permanently. */) 2191`pop-to-buffer' to switch buffers permanently. */)
diff --git a/src/commands.h b/src/commands.h
index 36f600cee01..510fce0e182 100644
--- a/src/commands.h
+++ b/src/commands.h
@@ -36,9 +36,6 @@ extern Lisp_Object control_x_map;
36 events until a non-ASCII event is acceptable as input. */ 36 events until a non-ASCII event is acceptable as input. */
37extern Lisp_Object unread_switch_frame; 37extern Lisp_Object unread_switch_frame;
38 38
39/* Nonzero means ^G can quit instantly */
40extern int immediate_quit;
41
42/* Nonzero if input is coming from the keyboard */ 39/* Nonzero if input is coming from the keyboard */
43 40
44#define INTERACTIVE (NILP (Vexecuting_kbd_macro) && !noninteractive) 41#define INTERACTIVE (NILP (Vexecuting_kbd_macro) && !noninteractive)
diff --git a/src/dispnew.c b/src/dispnew.c
index 6f8fb10b41d..0956e3f2905 100644
--- a/src/dispnew.c
+++ b/src/dispnew.c
@@ -26,7 +26,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
26 26
27#include "lisp.h" 27#include "lisp.h"
28#include "termchar.h" 28#include "termchar.h"
29#include "termopts.h"
30/* cm.h must come after dispextern.h on Windows. */ 29/* cm.h must come after dispextern.h on Windows. */
31#include "dispextern.h" 30#include "dispextern.h"
32#include "cm.h" 31#include "cm.h"
@@ -5919,15 +5918,16 @@ additional wait period, in milliseconds; this is for backwards compatibility.
5919 TIMEOUT is number of seconds to wait (float or integer), 5918 TIMEOUT is number of seconds to wait (float or integer),
5920 or t to wait forever. 5919 or t to wait forever.
5921 READING is true if reading input. 5920 READING is true if reading input.
5922 If DO_DISPLAY is >0 display process output while waiting. 5921 If DISPLAY_OPTION is >0 display process output while waiting.
5923 If DO_DISPLAY is >1 perform an initial redisplay before waiting. 5922 If DISPLAY_OPTION is >1 perform an initial redisplay before waiting.
5924*/ 5923*/
5925 5924
5926Lisp_Object 5925Lisp_Object
5927sit_for (Lisp_Object timeout, bool reading, int do_display) 5926sit_for (Lisp_Object timeout, bool reading, int display_option)
5928{ 5927{
5929 intmax_t sec; 5928 intmax_t sec;
5930 int nsec; 5929 int nsec;
5930 bool do_display = display_option > 0;
5931 5931
5932 swallow_events (do_display); 5932 swallow_events (do_display);
5933 5933
@@ -5935,7 +5935,7 @@ sit_for (Lisp_Object timeout, bool reading, int do_display)
5935 || !NILP (Vexecuting_kbd_macro)) 5935 || !NILP (Vexecuting_kbd_macro))
5936 return Qnil; 5936 return Qnil;
5937 5937
5938 if (do_display >= 2) 5938 if (display_option > 1)
5939 redisplay_preserve_echo_area (2); 5939 redisplay_preserve_echo_area (2);
5940 5940
5941 if (INTEGERP (timeout)) 5941 if (INTEGERP (timeout))
diff --git a/src/editfns.c b/src/editfns.c
index fc6465a3d46..19fad7130a7 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -819,9 +819,13 @@ save_excursion_save (void)
819{ 819{
820 bool visible = (XBUFFER (XWINDOW (selected_window)->buffer) 820 bool visible = (XBUFFER (XWINDOW (selected_window)->buffer)
821 == current_buffer); 821 == current_buffer);
822 /* Do not copy the mark if it points to nowhere. */
823 Lisp_Object mark = (XMARKER (BVAR (current_buffer, mark))->buffer
824 ? Fcopy_marker (BVAR (current_buffer, mark), Qnil)
825 : Qnil);
822 826
823 return Fcons (Fpoint_marker (), 827 return Fcons (Fpoint_marker (),
824 Fcons (Fcopy_marker (BVAR (current_buffer, mark), Qnil), 828 Fcons (mark,
825 Fcons (visible ? Qt : Qnil, 829 Fcons (visible ? Qt : Qnil,
826 Fcons (BVAR (current_buffer, mark_active), 830 Fcons (BVAR (current_buffer, mark_active),
827 selected_window)))); 831 selected_window))));
@@ -856,9 +860,14 @@ save_excursion_restore (Lisp_Object info)
856 info = XCDR (info); 860 info = XCDR (info);
857 tem = XCAR (info); 861 tem = XCAR (info);
858 omark = Fmarker_position (BVAR (current_buffer, mark)); 862 omark = Fmarker_position (BVAR (current_buffer, mark));
859 Fset_marker (BVAR (current_buffer, mark), tem, Fcurrent_buffer ()); 863 if (NILP (tem))
860 nmark = Fmarker_position (tem); 864 unchain_marker (XMARKER (BVAR (current_buffer, mark)));
861 unchain_marker (XMARKER (tem)); 865 else
866 {
867 Fset_marker (BVAR (current_buffer, mark), tem, Fcurrent_buffer ());
868 nmark = Fmarker_position (tem);
869 unchain_marker (XMARKER (tem));
870 }
862 871
863 /* visible */ 872 /* visible */
864 info = XCDR (info); 873 info = XCDR (info);
diff --git a/src/eval.c b/src/eval.c
index 4d200fbc2bd..975204da017 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1876,9 +1876,11 @@ this does nothing and returns nil. */)
1876 CHECK_STRING (file); 1876 CHECK_STRING (file);
1877 1877
1878 /* If function is defined and not as an autoload, don't override. */ 1878 /* If function is defined and not as an autoload, don't override. */
1879 if (!EQ (XSYMBOL (function)->function, Qunbound) 1879 if ((CONSP (XSYMBOL (function)->function)
1880 && !(CONSP (XSYMBOL (function)->function) 1880 && EQ (XCAR (XSYMBOL (function)->function), Qautoload)))
1881 && EQ (XCAR (XSYMBOL (function)->function), Qautoload))) 1881 /* Remember that the function was already an autoload. */
1882 LOADHIST_ATTACH (Fcons (Qt, function));
1883 else if (!EQ (XSYMBOL (function)->function, Qunbound))
1882 return Qnil; 1884 return Qnil;
1883 1885
1884 if (NILP (Vpurify_flag)) 1886 if (NILP (Vpurify_flag))
diff --git a/src/indent.c b/src/indent.c
index b368a7aeb09..81a63455ecb 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -30,7 +30,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
30#include "frame.h" 30#include "frame.h"
31#include "window.h" 31#include "window.h"
32#include "termchar.h" 32#include "termchar.h"
33#include "termopts.h"
34#include "disptab.h" 33#include "disptab.h"
35#include "intervals.h" 34#include "intervals.h"
36#include "dispextern.h" 35#include "dispextern.h"
diff --git a/src/keyboard.c b/src/keyboard.c
index 2a37e510ba4..68656d527e8 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -86,8 +86,8 @@ KBOARD *initial_kboard;
86KBOARD *current_kboard; 86KBOARD *current_kboard;
87KBOARD *all_kboards; 87KBOARD *all_kboards;
88 88
89/* Nonzero in the single-kboard state, 0 in the any-kboard state. */ 89/* True in the single-kboard state, false in the any-kboard state. */
90static int single_kboard; 90static bool single_kboard;
91 91
92/* Non-nil disable property on a command means 92/* Non-nil disable property on a command means
93 do not execute it; call disabled-command-function's value instead. */ 93 do not execute it; call disabled-command-function's value instead. */
@@ -113,9 +113,9 @@ static Lisp_Object recent_keys;
113Lisp_Object this_command_keys; 113Lisp_Object this_command_keys;
114ptrdiff_t this_command_key_count; 114ptrdiff_t this_command_key_count;
115 115
116/* 1 after calling Freset_this_command_lengths. 116/* True after calling Freset_this_command_lengths.
117 Usually it is 0. */ 117 Usually it is false. */
118static int this_command_key_count_reset; 118static bool this_command_key_count_reset;
119 119
120/* This vector is used as a buffer to record the events that were actually read 120/* This vector is used as a buffer to record the events that were actually read
121 by read_key_sequence. */ 121 by read_key_sequence. */
@@ -140,11 +140,11 @@ static ptrdiff_t before_command_echo_length;
140static sys_jmp_buf getcjmp; 140static sys_jmp_buf getcjmp;
141 141
142/* True while doing kbd input. */ 142/* True while doing kbd input. */
143int waiting_for_input; 143bool waiting_for_input;
144 144
145/* True while displaying for echoing. Delays C-g throwing. */ 145/* True while displaying for echoing. Delays C-g throwing. */
146 146
147static int echoing; 147static bool echoing;
148 148
149/* Non-null means we can start echoing at the next input pause even 149/* Non-null means we can start echoing at the next input pause even
150 though there is something in the echo area. */ 150 though there is something in the echo area. */
@@ -163,8 +163,8 @@ struct kboard *echo_kboard;
163 163
164Lisp_Object echo_message_buffer; 164Lisp_Object echo_message_buffer;
165 165
166/* Nonzero means C-g should cause immediate error-signal. */ 166/* True means C-g should cause immediate error-signal. */
167int immediate_quit; 167bool immediate_quit;
168 168
169/* Character that causes a quit. Normally C-g. 169/* Character that causes a quit. Normally C-g.
170 170
@@ -270,7 +270,7 @@ static Lisp_Object Qhelp_form_show;
270static FILE *dribble; 270static FILE *dribble;
271 271
272/* Nonzero if input is available. */ 272/* Nonzero if input is available. */
273int input_pending; 273bool input_pending;
274 274
275/* Circular buffer for pre-read keyboard input. */ 275/* Circular buffer for pre-read keyboard input. */
276 276
@@ -375,18 +375,18 @@ static ptrdiff_t echo_length (void);
375static Lisp_Object Qpolling_period; 375static Lisp_Object Qpolling_period;
376 376
377/* Incremented whenever a timer is run. */ 377/* Incremented whenever a timer is run. */
378int timers_run; 378unsigned timers_run;
379 379
380/* Address (if not 0) of EMACS_TIME to zero out if a SIGIO interrupt 380/* Address (if not 0) of EMACS_TIME to zero out if a SIGIO interrupt
381 happens. */ 381 happens. */
382EMACS_TIME *input_available_clear_time; 382EMACS_TIME *input_available_clear_time;
383 383
384/* Nonzero means use SIGIO interrupts; zero means use CBREAK mode. 384/* True means use SIGIO interrupts; false means use CBREAK mode.
385 Default is 1 if INTERRUPT_INPUT is defined. */ 385 Default is true if INTERRUPT_INPUT is defined. */
386int interrupt_input; 386bool interrupt_input;
387 387
388/* Nonzero while interrupts are temporarily deferred during redisplay. */ 388/* Nonzero while interrupts are temporarily deferred during redisplay. */
389int interrupts_deferred; 389bool interrupts_deferred;
390 390
391/* If we support a window system, turn on the code to poll periodically 391/* If we support a window system, turn on the code to poll periodically
392 to detect C-g. It isn't actually used when doing interrupt input. */ 392 to detect C-g. It isn't actually used when doing interrupt input. */
@@ -414,10 +414,10 @@ static EMACS_TIME timer_last_idleness_start_time;
414/* Function for init_keyboard to call with no args (if nonzero). */ 414/* Function for init_keyboard to call with no args (if nonzero). */
415static void (*keyboard_init_hook) (void); 415static void (*keyboard_init_hook) (void);
416 416
417static void get_input_pending (int *, int); 417static bool get_input_pending (int);
418static int readable_events (int); 418static bool readable_events (int);
419static Lisp_Object read_char_x_menu_prompt (ptrdiff_t, Lisp_Object *, 419static Lisp_Object read_char_x_menu_prompt (ptrdiff_t, Lisp_Object *,
420 Lisp_Object, int *); 420 Lisp_Object, bool *);
421static Lisp_Object read_char_minibuf_menu_prompt (int, ptrdiff_t, 421static Lisp_Object read_char_minibuf_menu_prompt (int, ptrdiff_t,
422 Lisp_Object *); 422 Lisp_Object *);
423static Lisp_Object make_lispy_event (struct input_event *); 423static Lisp_Object make_lispy_event (struct input_event *);
@@ -431,7 +431,7 @@ static Lisp_Object modify_event_symbol (ptrdiff_t, int, Lisp_Object,
431 Lisp_Object, const char *const *, 431 Lisp_Object, const char *const *,
432 Lisp_Object *, ptrdiff_t); 432 Lisp_Object *, ptrdiff_t);
433static Lisp_Object make_lispy_switch_frame (Lisp_Object); 433static Lisp_Object make_lispy_switch_frame (Lisp_Object);
434static int help_char_p (Lisp_Object); 434static bool help_char_p (Lisp_Object);
435static void save_getcjmp (sys_jmp_buf); 435static void save_getcjmp (sys_jmp_buf);
436static void restore_getcjmp (sys_jmp_buf); 436static void restore_getcjmp (sys_jmp_buf);
437static Lisp_Object apply_modifiers (int, Lisp_Object); 437static Lisp_Object apply_modifiers (int, Lisp_Object);
@@ -441,7 +441,7 @@ static Lisp_Object restore_kboard_configuration (Lisp_Object);
441static void deliver_input_available_signal (int signo); 441static void deliver_input_available_signal (int signo);
442#endif 442#endif
443static void handle_interrupt (bool); 443static void handle_interrupt (bool);
444static _Noreturn void quit_throw_to_read_char (int); 444static _Noreturn void quit_throw_to_read_char (bool);
445static void process_special_events (void); 445static void process_special_events (void);
446static void timer_start_idle (void); 446static void timer_start_idle (void);
447static void timer_stop_idle (void); 447static void timer_stop_idle (void);
@@ -519,7 +519,7 @@ echo_char (Lisp_Object c)
519 519
520 if (INTEGERP (c)) 520 if (INTEGERP (c))
521 { 521 {
522 ptr = push_key_description (XINT (c), ptr, 1); 522 ptr = push_key_description (XINT (c), ptr);
523 } 523 }
524 else if (SYMBOLP (c)) 524 else if (SYMBOLP (c))
525 { 525 {
@@ -928,7 +928,7 @@ pop_kboard (void)
928{ 928{
929 struct terminal *t; 929 struct terminal *t;
930 struct kboard_stack *p = kboard_stack; 930 struct kboard_stack *p = kboard_stack;
931 int found = 0; 931 bool found = 0;
932 for (t = terminal_list; t; t = t->next_terminal) 932 for (t = terminal_list; t; t = t->next_terminal)
933 { 933 {
934 if (t->kboard == p->kboard) 934 if (t->kboard == p->kboard)
@@ -961,7 +961,7 @@ pop_kboard (void)
961void 961void
962temporarily_switch_to_single_kboard (struct frame *f) 962temporarily_switch_to_single_kboard (struct frame *f)
963{ 963{
964 int was_locked = single_kboard; 964 bool was_locked = single_kboard;
965 if (was_locked) 965 if (was_locked)
966 { 966 {
967 if (f != NULL && FRAME_KBOARD (f) != current_kboard) 967 if (f != NULL && FRAME_KBOARD (f) != current_kboard)
@@ -1060,12 +1060,7 @@ cmd_error (Lisp_Object data)
1060 Vprint_length = old_length; 1060 Vprint_length = old_length;
1061 1061
1062 Vquit_flag = Qnil; 1062 Vquit_flag = Qnil;
1063
1064 Vinhibit_quit = Qnil; 1063 Vinhibit_quit = Qnil;
1065#if 0 /* This shouldn't be necessary anymore. --lorentey */
1066 if (command_loop_level == 0 && minibuf_level == 0)
1067 any_kboard_state ();
1068#endif
1069 1064
1070 return make_number (0); 1065 return make_number (0);
1071} 1066}
@@ -1152,12 +1147,6 @@ command_loop (void)
1152 while (1) 1147 while (1)
1153 { 1148 {
1154 internal_catch (Qtop_level, top_level_1, Qnil); 1149 internal_catch (Qtop_level, top_level_1, Qnil);
1155#if 0 /* This shouldn't be necessary anymore. --lorentey */
1156 /* Reset single_kboard in case top-level set it while
1157 evaluating an -f option, or we are stuck there for some
1158 other reason. */
1159 any_kboard_state ();
1160#endif
1161 internal_catch (Qtop_level, command_loop_2, Qnil); 1150 internal_catch (Qtop_level, command_loop_2, Qnil);
1162 executing_kbd_macro = Qnil; 1151 executing_kbd_macro = Qnil;
1163 1152
@@ -1268,8 +1257,7 @@ tracking_off (Lisp_Object old_value)
1268 if (!readable_events (READABLE_EVENTS_DO_TIMERS_NOW)) 1257 if (!readable_events (READABLE_EVENTS_DO_TIMERS_NOW))
1269 { 1258 {
1270 redisplay_preserve_echo_area (6); 1259 redisplay_preserve_echo_area (6);
1271 get_input_pending (&input_pending, 1260 get_input_pending (READABLE_EVENTS_DO_TIMERS_NOW);
1272 READABLE_EVENTS_DO_TIMERS_NOW);
1273 } 1261 }
1274 } 1262 }
1275 return Qnil; 1263 return Qnil;
@@ -1304,7 +1292,7 @@ usage: (track-mouse BODY...) */)
1304#if !defined HAVE_WINDOW_SYSTEM || defined USE_GTK || defined HAVE_NS 1292#if !defined HAVE_WINDOW_SYSTEM || defined USE_GTK || defined HAVE_NS
1305static 1293static
1306#endif 1294#endif
1307int ignore_mouse_drag_p; 1295bool ignore_mouse_drag_p;
1308 1296
1309static FRAME_PTR 1297static FRAME_PTR
1310some_mouse_moved (void) 1298some_mouse_moved (void)
@@ -1332,9 +1320,9 @@ some_mouse_moved (void)
1332 sans error-handling encapsulation. */ 1320 sans error-handling encapsulation. */
1333 1321
1334static int read_key_sequence (Lisp_Object *, int, Lisp_Object, 1322static int read_key_sequence (Lisp_Object *, int, Lisp_Object,
1335 int, int, int); 1323 bool, bool, bool);
1336void safe_run_hooks (Lisp_Object); 1324void safe_run_hooks (Lisp_Object);
1337static void adjust_point_for_property (ptrdiff_t, int); 1325static void adjust_point_for_property (ptrdiff_t, bool);
1338 1326
1339/* Cancel hourglass from protect_unwind. 1327/* Cancel hourglass from protect_unwind.
1340 ARG is not used. */ 1328 ARG is not used. */
@@ -1362,10 +1350,7 @@ command_loop_1 (void)
1362 int i; 1350 int i;
1363 EMACS_INT prev_modiff = 0; 1351 EMACS_INT prev_modiff = 0;
1364 struct buffer *prev_buffer = NULL; 1352 struct buffer *prev_buffer = NULL;
1365#if 0 /* This shouldn't be necessary anymore. --lorentey */ 1353 bool already_adjusted = 0;
1366 int was_locked = single_kboard;
1367#endif
1368 int already_adjusted = 0;
1369 1354
1370 kset_prefix_arg (current_kboard, Qnil); 1355 kset_prefix_arg (current_kboard, Qnil);
1371 kset_last_prefix_arg (current_kboard, Qnil); 1356 kset_last_prefix_arg (current_kboard, Qnil);
@@ -1734,10 +1719,6 @@ command_loop_1 (void)
1734 if (!NILP (KVAR (current_kboard, defining_kbd_macro)) 1719 if (!NILP (KVAR (current_kboard, defining_kbd_macro))
1735 && NILP (KVAR (current_kboard, Vprefix_arg))) 1720 && NILP (KVAR (current_kboard, Vprefix_arg)))
1736 finalize_kbd_macro_chars (); 1721 finalize_kbd_macro_chars ();
1737#if 0 /* This shouldn't be necessary anymore. --lorentey */
1738 if (!was_locked)
1739 any_kboard_state ();
1740#endif
1741 } 1722 }
1742} 1723}
1743 1724
@@ -1747,7 +1728,7 @@ command_loop_1 (void)
1747 LAST_PT is the last position of point. */ 1728 LAST_PT is the last position of point. */
1748 1729
1749static void 1730static void
1750adjust_point_for_property (ptrdiff_t last_pt, int modified) 1731adjust_point_for_property (ptrdiff_t last_pt, bool modified)
1751{ 1732{
1752 ptrdiff_t beg, end; 1733 ptrdiff_t beg, end;
1753 Lisp_Object val, overlay, tmp; 1734 Lisp_Object val, overlay, tmp;
@@ -1755,7 +1736,7 @@ adjust_point_for_property (ptrdiff_t last_pt, int modified)
1755 suppress the point adjustment for automatic composition so that a 1736 suppress the point adjustment for automatic composition so that a
1756 user can keep inserting another character at point or keep 1737 user can keep inserting another character at point or keep
1757 deleting characters around point. */ 1738 deleting characters around point. */
1758 int check_composition = ! modified, check_display = 1, check_invisible = 1; 1739 bool check_composition = ! modified, check_display = 1, check_invisible = 1;
1759 ptrdiff_t orig_pt = PT; 1740 ptrdiff_t orig_pt = PT;
1760 1741
1761 /* FIXME: cycling is probably not necessary because these properties 1742 /* FIXME: cycling is probably not necessary because these properties
@@ -1794,7 +1775,8 @@ adjust_point_for_property (ptrdiff_t last_pt, int modified)
1794 check_display = 0; 1775 check_display = 0;
1795 if (check_invisible && PT > BEGV && PT < ZV) 1776 if (check_invisible && PT > BEGV && PT < ZV)
1796 { 1777 {
1797 int inv, ellipsis = 0; 1778 int inv;
1779 bool ellipsis = 0;
1798 beg = end = PT; 1780 beg = end = PT;
1799 1781
1800 /* Find boundaries `beg' and `end' of the invisible area, if any. */ 1782 /* Find boundaries `beg' and `end' of the invisible area, if any. */
@@ -1923,7 +1905,7 @@ safe_run_hooks_error (Lisp_Object error_data)
1923 if (SYMBOLP (hook)) 1905 if (SYMBOLP (hook))
1924 { 1906 {
1925 Lisp_Object val; 1907 Lisp_Object val;
1926 int found = 0; 1908 bool found = 0;
1927 Lisp_Object newval = Qnil; 1909 Lisp_Object newval = Qnil;
1928 for (val = find_symbol_value (hook); CONSP (val); val = XCDR (val)) 1910 for (val = find_symbol_value (hook); CONSP (val); val = XCDR (val))
1929 if (EQ (fun, XCAR (val))) 1911 if (EQ (fun, XCAR (val)))
@@ -2053,9 +2035,9 @@ start_polling (void)
2053#endif 2035#endif
2054} 2036}
2055 2037
2056/* Nonzero if we are using polling to handle input asynchronously. */ 2038/* True if we are using polling to handle input asynchronously. */
2057 2039
2058int 2040bool
2059input_polling_used (void) 2041input_polling_used (void)
2060{ 2042{
2061#ifdef POLL_FOR_INPUT 2043#ifdef POLL_FOR_INPUT
@@ -2231,7 +2213,7 @@ show_help_echo (Lisp_Object help, Lisp_Object window, Lisp_Object object,
2231 2213
2232/* Input of single characters from keyboard */ 2214/* Input of single characters from keyboard */
2233 2215
2234static Lisp_Object kbd_buffer_get_event (KBOARD **kbp, int *used_mouse_menu, 2216static Lisp_Object kbd_buffer_get_event (KBOARD **kbp, bool *used_mouse_menu,
2235 EMACS_TIME *end_time); 2217 EMACS_TIME *end_time);
2236static void record_char (Lisp_Object c); 2218static void record_char (Lisp_Object c);
2237 2219
@@ -2268,9 +2250,9 @@ do { if (polling_stopped_here) start_polling (); \
2268 not to run input methods, but in other respects to act as if 2250 not to run input methods, but in other respects to act as if
2269 not reading a key sequence. 2251 not reading a key sequence.
2270 2252
2271 If USED_MOUSE_MENU is non-null, then we set *USED_MOUSE_MENU to 1 2253 If USED_MOUSE_MENU is non-null, then set *USED_MOUSE_MENU to true
2272 if we used a mouse menu to read the input, or zero otherwise. If 2254 if we used a mouse menu to read the input, or false otherwise. If
2273 USED_MOUSE_MENU is null, we don't dereference it. 2255 USED_MOUSE_MENU is null, don't dereference it.
2274 2256
2275 Value is -2 when we find input on another keyboard. A second call 2257 Value is -2 when we find input on another keyboard. A second call
2276 to read_char will read it. 2258 to read_char will read it.
@@ -2284,7 +2266,7 @@ do { if (polling_stopped_here) start_polling (); \
2284Lisp_Object 2266Lisp_Object
2285read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps, 2267read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
2286 Lisp_Object prev_event, 2268 Lisp_Object prev_event,
2287 int *used_mouse_menu, EMACS_TIME *end_time) 2269 bool *used_mouse_menu, EMACS_TIME *end_time)
2288{ 2270{
2289 Lisp_Object c; 2271 Lisp_Object c;
2290 ptrdiff_t jmpcount; 2272 ptrdiff_t jmpcount;
@@ -2293,9 +2275,9 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
2293 Lisp_Object tem, save; 2275 Lisp_Object tem, save;
2294 volatile Lisp_Object previous_echo_area_message; 2276 volatile Lisp_Object previous_echo_area_message;
2295 volatile Lisp_Object also_record; 2277 volatile Lisp_Object also_record;
2296 volatile int reread; 2278 volatile bool reread;
2297 struct gcpro gcpro1, gcpro2; 2279 struct gcpro gcpro1, gcpro2;
2298 int volatile polling_stopped_here = 0; 2280 bool volatile polling_stopped_here = 0;
2299 struct kboard *orig_kboard = current_kboard; 2281 struct kboard *orig_kboard = current_kboard;
2300 2282
2301 also_record = Qnil; 2283 also_record = Qnil;
@@ -2331,7 +2313,7 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
2331 2313
2332 if (CONSP (Vunread_command_events)) 2314 if (CONSP (Vunread_command_events))
2333 { 2315 {
2334 int was_disabled = 0; 2316 bool was_disabled = 0;
2335 2317
2336 c = XCAR (Vunread_command_events); 2318 c = XCAR (Vunread_command_events);
2337 Vunread_command_events = XCDR (Vunread_command_events); 2319 Vunread_command_events = XCDR (Vunread_command_events);
@@ -2433,7 +2415,7 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
2433 /* if redisplay was requested */ 2415 /* if redisplay was requested */
2434 if (commandflag >= 0) 2416 if (commandflag >= 0)
2435 { 2417 {
2436 int echo_current = EQ (echo_message_buffer, echo_area_buffer[0]); 2418 bool echo_current = EQ (echo_message_buffer, echo_area_buffer[0]);
2437 2419
2438 /* If there is pending input, process any events which are not 2420 /* If there is pending input, process any events which are not
2439 user-visible, such as X selection_request events. */ 2421 user-visible, such as X selection_request events. */
@@ -2865,12 +2847,6 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
2865 if (!NILP (tem)) 2847 if (!NILP (tem))
2866 { 2848 {
2867 struct buffer *prev_buffer = current_buffer; 2849 struct buffer *prev_buffer = current_buffer;
2868#if 0 /* This shouldn't be necessary anymore. --lorentey */
2869 int was_locked = single_kboard;
2870 ptrdiff_t count = SPECPDL_INDEX ();
2871 record_single_kboard_state ();
2872#endif
2873
2874 last_input_event = c; 2850 last_input_event = c;
2875 Fcommand_execute (tem, Qnil, Fvector (1, &last_input_event), Qt); 2851 Fcommand_execute (tem, Qnil, Fvector (1, &last_input_event), Qt);
2876 2852
@@ -2881,13 +2857,6 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
2881 example banishing the mouse under mouse-avoidance-mode. */ 2857 example banishing the mouse under mouse-avoidance-mode. */
2882 timer_resume_idle (); 2858 timer_resume_idle ();
2883 2859
2884#if 0 /* This shouldn't be necessary anymore. --lorentey */
2885 /* Resume allowing input from any kboard, if that was true before. */
2886 if (!was_locked)
2887 any_kboard_state ();
2888 unbind_to (count, Qnil);
2889#endif
2890
2891 if (current_buffer != prev_buffer) 2860 if (current_buffer != prev_buffer)
2892 { 2861 {
2893 /* The command may have changed the keymaps. Pretend there 2862 /* The command may have changed the keymaps. Pretend there
@@ -2995,15 +2964,15 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps,
2995 { 2964 {
2996 Lisp_Object keys; 2965 Lisp_Object keys;
2997 ptrdiff_t key_count; 2966 ptrdiff_t key_count;
2998 int key_count_reset; 2967 bool key_count_reset;
2999 struct gcpro gcpro1; 2968 struct gcpro gcpro1;
3000 ptrdiff_t count = SPECPDL_INDEX (); 2969 ptrdiff_t count = SPECPDL_INDEX ();
3001 2970
3002 /* Save the echo status. */ 2971 /* Save the echo status. */
3003 int saved_immediate_echo = current_kboard->immediate_echo; 2972 bool saved_immediate_echo = current_kboard->immediate_echo;
3004 struct kboard *saved_ok_to_echo = ok_to_echo_at_next_pause; 2973 struct kboard *saved_ok_to_echo = ok_to_echo_at_next_pause;
3005 Lisp_Object saved_echo_string = KVAR (current_kboard, echo_string); 2974 Lisp_Object saved_echo_string = KVAR (current_kboard, echo_string);
3006 int saved_echo_after_prompt = current_kboard->echo_after_prompt; 2975 ptrdiff_t saved_echo_after_prompt = current_kboard->echo_after_prompt;
3007 2976
3008#if 0 2977#if 0
3009 if (before_command_restore_flag) 2978 if (before_command_restore_flag)
@@ -3204,9 +3173,9 @@ record_menu_key (Lisp_Object c)
3204 num_input_events++; 3173 num_input_events++;
3205} 3174}
3206 3175
3207/* Return 1 if should recognize C as "the help character". */ 3176/* Return true if should recognize C as "the help character". */
3208 3177
3209static int 3178static bool
3210help_char_p (Lisp_Object c) 3179help_char_p (Lisp_Object c)
3211{ 3180{
3212 Lisp_Object tail; 3181 Lisp_Object tail;
@@ -3378,7 +3347,7 @@ restore_getcjmp (sys_jmp_buf temp)
3378 3347
3379/* Return true if there are any events in the queue that read-char 3348/* Return true if there are any events in the queue that read-char
3380 would return. If this returns false, a read-char would block. */ 3349 would return. If this returns false, a read-char would block. */
3381static int 3350static bool
3382readable_events (int flags) 3351readable_events (int flags)
3383{ 3352{
3384 if (flags & READABLE_EVENTS_DO_TIMERS_NOW) 3353 if (flags & READABLE_EVENTS_DO_TIMERS_NOW)
@@ -3717,15 +3686,14 @@ discard_mouse_events (void)
3717} 3686}
3718 3687
3719 3688
3720/* Return non-zero if there are any real events waiting in the event 3689/* Return true if there are any real events waiting in the event
3721 buffer, not counting `NO_EVENT's. 3690 buffer, not counting `NO_EVENT's.
3722 3691
3723 If DISCARD is non-zero, discard NO_EVENT events at the front of 3692 Discard NO_EVENT events at the front of the input queue, possibly
3724 the input queue, possibly leaving the input queue empty if there 3693 leaving the input queue empty if there are no real input events. */
3725 are no real input events. */
3726 3694
3727int 3695bool
3728kbd_buffer_events_waiting (int discard) 3696kbd_buffer_events_waiting (void)
3729{ 3697{
3730 struct input_event *sp; 3698 struct input_event *sp;
3731 3699
@@ -3737,9 +3705,7 @@ kbd_buffer_events_waiting (int discard)
3737 sp = kbd_buffer; 3705 sp = kbd_buffer;
3738 } 3706 }
3739 3707
3740 if (discard) 3708 kbd_fetch_ptr = sp;
3741 kbd_fetch_ptr = sp;
3742
3743 return sp != kbd_store_ptr && sp->kind != NO_EVENT; 3709 return sp != kbd_store_ptr && sp->kind != NO_EVENT;
3744} 3710}
3745 3711
@@ -3761,7 +3727,7 @@ clear_event (struct input_event *event)
3761 3727
3762static Lisp_Object 3728static Lisp_Object
3763kbd_buffer_get_event (KBOARD **kbp, 3729kbd_buffer_get_event (KBOARD **kbp,
3764 int *used_mouse_menu, 3730 bool *used_mouse_menu,
3765 EMACS_TIME *end_time) 3731 EMACS_TIME *end_time)
3766{ 3732{
3767 Lisp_Object obj; 3733 Lisp_Object obj;
@@ -4216,14 +4182,14 @@ process_special_events (void)
4216 are ripe, and return, without reading any user-visible events. */ 4182 are ripe, and return, without reading any user-visible events. */
4217 4183
4218void 4184void
4219swallow_events (int do_display) 4185swallow_events (bool do_display)
4220{ 4186{
4221 int old_timers_run; 4187 unsigned old_timers_run;
4222 4188
4223 process_special_events (); 4189 process_special_events ();
4224 4190
4225 old_timers_run = timers_run; 4191 old_timers_run = timers_run;
4226 get_input_pending (&input_pending, READABLE_EVENTS_DO_TIMERS_NOW); 4192 get_input_pending (READABLE_EVENTS_DO_TIMERS_NOW);
4227 4193
4228 if (timers_run != old_timers_run && do_display) 4194 if (timers_run != old_timers_run && do_display)
4229 redisplay_preserve_echo_area (7); 4195 redisplay_preserve_echo_area (7);
@@ -4350,7 +4316,7 @@ timer_check_2 (Lisp_Object timers, Lisp_Object idle_timers)
4350 EMACS_TIME difference; 4316 EMACS_TIME difference;
4351 EMACS_TIME timer_difference = invalid_emacs_time (); 4317 EMACS_TIME timer_difference = invalid_emacs_time ();
4352 EMACS_TIME idle_timer_difference = invalid_emacs_time (); 4318 EMACS_TIME idle_timer_difference = invalid_emacs_time ();
4353 int ripe, timer_ripe = 0, idle_timer_ripe = 0; 4319 bool ripe, timer_ripe = 0, idle_timer_ripe = 0;
4354 4320
4355 /* Set TIMER and TIMER_DIFFERENCE 4321 /* Set TIMER and TIMER_DIFFERENCE
4356 based on the next ordinary timer. 4322 based on the next ordinary timer.
@@ -5454,7 +5420,7 @@ make_lispy_event (struct input_event *event)
5454#endif 5420#endif
5455 { 5421 {
5456 int button = event->code; 5422 int button = event->code;
5457 int is_double; 5423 bool is_double;
5458 Lisp_Object position; 5424 Lisp_Object position;
5459 Lisp_Object *start_pos_ptr; 5425 Lisp_Object *start_pos_ptr;
5460 Lisp_Object start_pos; 5426 Lisp_Object start_pos;
@@ -5735,7 +5701,7 @@ make_lispy_event (struct input_event *event)
5735 struct frame *fr; 5701 struct frame *fr;
5736 int fuzz; 5702 int fuzz;
5737 int symbol_num; 5703 int symbol_num;
5738 int is_double; 5704 bool is_double;
5739 5705
5740 if (WINDOWP (event->frame_or_window)) 5706 if (WINDOWP (event->frame_or_window))
5741 fr = XFRAME (XWINDOW (event->frame_or_window)->frame); 5707 fr = XFRAME (XWINDOW (event->frame_or_window)->frame);
@@ -6677,11 +6643,11 @@ parse_solitary_modifier (Lisp_Object symbol)
6677 return 0; 6643 return 0;
6678} 6644}
6679 6645
6680/* Return 1 if EVENT is a list whose elements are all integers or symbols. 6646/* Return true if EVENT is a list whose elements are all integers or symbols.
6681 Such a list is not valid as an event, 6647 Such a list is not valid as an event,
6682 but it can be a Lucid-style event type list. */ 6648 but it can be a Lucid-style event type list. */
6683 6649
6684int 6650bool
6685lucid_event_type_list_p (Lisp_Object object) 6651lucid_event_type_list_p (Lisp_Object object)
6686{ 6652{
6687 Lisp_Object tail; 6653 Lisp_Object tail;
@@ -6706,8 +6672,10 @@ lucid_event_type_list_p (Lisp_Object object)
6706 return NILP (tail); 6672 return NILP (tail);
6707} 6673}
6708 6674
6709/* Store into *addr a value nonzero if terminal input chars are available. 6675/* Return true if terminal input chars are available.
6710 Serves the purpose of ioctl (0, FIONREAD, addr) 6676 Also, store the return value into INPUT_PENDING.
6677
6678 Serves the purpose of ioctl (0, FIONREAD, ...)
6711 but works even if FIONREAD does not exist. 6679 but works even if FIONREAD does not exist.
6712 (In fact, this may actually read some input.) 6680 (In fact, this may actually read some input.)
6713 6681
@@ -6718,19 +6686,21 @@ lucid_event_type_list_p (Lisp_Object object)
6718 If READABLE_EVENTS_IGNORE_SQUEEZABLES is set in FLAGS, ignore mouse 6686 If READABLE_EVENTS_IGNORE_SQUEEZABLES is set in FLAGS, ignore mouse
6719 movements and toolkit scroll bar thumb drags. */ 6687 movements and toolkit scroll bar thumb drags. */
6720 6688
6721static void 6689static bool
6722get_input_pending (int *addr, int flags) 6690get_input_pending (int flags)
6723{ 6691{
6724 /* First of all, have we already counted some input? */ 6692 /* First of all, have we already counted some input? */
6725 *addr = (!NILP (Vquit_flag) || readable_events (flags)); 6693 input_pending = (!NILP (Vquit_flag) || readable_events (flags));
6726 6694
6727 /* If input is being read as it arrives, and we have none, there is none. */ 6695 /* If input is being read as it arrives, and we have none, there is none. */
6728 if (*addr > 0 || (interrupt_input && ! interrupts_deferred)) 6696 if (!input_pending && (!interrupt_input || interrupts_deferred))
6729 return; 6697 {
6698 /* Try to read some input and see how much we get. */
6699 gobble_input ();
6700 input_pending = (!NILP (Vquit_flag) || readable_events (flags));
6701 }
6730 6702
6731 /* Try to read some input and see how much we get. */ 6703 return input_pending;
6732 gobble_input ();
6733 *addr = (!NILP (Vquit_flag) || readable_events (flags));
6734} 6704}
6735 6705
6736/* Put a BUFFER_SWITCH_EVENT in the buffer 6706/* Put a BUFFER_SWITCH_EVENT in the buffer
@@ -6780,7 +6750,7 @@ int
6780gobble_input (void) 6750gobble_input (void)
6781{ 6751{
6782 int nread = 0; 6752 int nread = 0;
6783 int err = 0; 6753 bool err = 0;
6784 struct terminal *t; 6754 struct terminal *t;
6785 6755
6786 /* Store pending user signal events, if any. */ 6756 /* Store pending user signal events, if any. */
@@ -7350,9 +7320,9 @@ static const char* separator_names[] = {
7350 0, 7320 0,
7351}; 7321};
7352 7322
7353/* Return non-zero if LABEL specifies a separator. */ 7323/* Return true if LABEL specifies a separator. */
7354 7324
7355int 7325bool
7356menu_separator_name_p (const char *label) 7326menu_separator_name_p (const char *label)
7357{ 7327{
7358 if (!label) 7328 if (!label)
@@ -7527,6 +7497,7 @@ menu_bar_item (Lisp_Object key, Lisp_Object item, Lisp_Object dummy1, void *dumm
7527{ 7497{
7528 struct gcpro gcpro1; 7498 struct gcpro gcpro1;
7529 int i; 7499 int i;
7500 bool parsed;
7530 Lisp_Object tem; 7501 Lisp_Object tem;
7531 7502
7532 if (EQ (item, Qundefined)) 7503 if (EQ (item, Qundefined))
@@ -7558,9 +7529,9 @@ menu_bar_item (Lisp_Object key, Lisp_Object item, Lisp_Object dummy1, void *dumm
7558 parse_menu_item, so that if it turns out it wasn't a menu item, 7529 parse_menu_item, so that if it turns out it wasn't a menu item,
7559 it still correctly hides any further menu item. */ 7530 it still correctly hides any further menu item. */
7560 GCPRO1 (key); 7531 GCPRO1 (key);
7561 i = parse_menu_item (item, 1); 7532 parsed = parse_menu_item (item, 1);
7562 UNGCPRO; 7533 UNGCPRO;
7563 if (!i) 7534 if (!parsed)
7564 return; 7535 return;
7565 7536
7566 item = AREF (item_properties, ITEM_PROPERTY_DEF); 7537 item = AREF (item_properties, ITEM_PROPERTY_DEF);
@@ -7636,7 +7607,7 @@ menu_item_eval_property (Lisp_Object sexpr)
7636 parse_menu_item returns true if the item is a menu item and false 7607 parse_menu_item returns true if the item is a menu item and false
7637 otherwise. */ 7608 otherwise. */
7638 7609
7639int 7610bool
7640parse_menu_item (Lisp_Object item, int inmenubar) 7611parse_menu_item (Lisp_Object item, int inmenubar)
7641{ 7612{
7642 Lisp_Object def, tem, item_string, start; 7613 Lisp_Object def, tem, item_string, start;
@@ -7936,7 +7907,7 @@ static Lisp_Object QCrtl;
7936 7907
7937static void init_tool_bar_items (Lisp_Object); 7908static void init_tool_bar_items (Lisp_Object);
7938static void process_tool_bar_item (Lisp_Object, Lisp_Object, Lisp_Object, void*); 7909static void process_tool_bar_item (Lisp_Object, Lisp_Object, Lisp_Object, void*);
7939static int parse_tool_bar_item (Lisp_Object, Lisp_Object); 7910static bool parse_tool_bar_item (Lisp_Object, Lisp_Object);
7940static void append_tool_bar_item (void); 7911static void append_tool_bar_item (void);
7941 7912
7942 7913
@@ -8069,7 +8040,7 @@ set_prop (ptrdiff_t idx, Lisp_Object val)
8069 8040
8070 8041
8071/* Parse a tool bar item specification ITEM for key KEY and return the 8042/* Parse a tool bar item specification ITEM for key KEY and return the
8072 result in tool_bar_item_properties. Value is zero if ITEM is 8043 result in tool_bar_item_properties. Value is false if ITEM is
8073 invalid. 8044 invalid.
8074 8045
8075 ITEM is a list `(menu-item CAPTION BINDING PROPS...)'. 8046 ITEM is a list `(menu-item CAPTION BINDING PROPS...)'.
@@ -8114,12 +8085,13 @@ set_prop (ptrdiff_t idx, Lisp_Object val)
8114 8085
8115 A text label to show with the tool bar button if labels are enabled. */ 8086 A text label to show with the tool bar button if labels are enabled. */
8116 8087
8117static int 8088static bool
8118parse_tool_bar_item (Lisp_Object key, Lisp_Object item) 8089parse_tool_bar_item (Lisp_Object key, Lisp_Object item)
8119{ 8090{
8120 Lisp_Object filter = Qnil; 8091 Lisp_Object filter = Qnil;
8121 Lisp_Object caption; 8092 Lisp_Object caption;
8122 int i, have_label = 0; 8093 int i;
8094 bool have_label = 0;
8123 8095
8124 /* Definition looks like `(menu-item CAPTION BINDING PROPS...)'. 8096 /* Definition looks like `(menu-item CAPTION BINDING PROPS...)'.
8125 Rule out items that aren't lists, don't start with 8097 Rule out items that aren't lists, don't start with
@@ -8376,9 +8348,9 @@ append_tool_bar_item (void)
8376 PREV_EVENT is the previous input event, or nil if we are reading 8348 PREV_EVENT is the previous input event, or nil if we are reading
8377 the first event of a key sequence. 8349 the first event of a key sequence.
8378 8350
8379 If USED_MOUSE_MENU is non-null, then we set *USED_MOUSE_MENU to 1 8351 If USED_MOUSE_MENU is non-null, set *USED_MOUSE_MENU to true
8380 if we used a mouse menu to read the input, or zero otherwise. If 8352 if we used a mouse menu to read the input, or false otherwise. If
8381 USED_MOUSE_MENU is null, we don't dereference it. 8353 USED_MOUSE_MENU is null, don't dereference it.
8382 8354
8383 The prompting is done based on the prompt-string of the map 8355 The prompting is done based on the prompt-string of the map
8384 and the strings associated with various map elements. 8356 and the strings associated with various map elements.
@@ -8391,7 +8363,7 @@ append_tool_bar_item (void)
8391 8363
8392static Lisp_Object 8364static Lisp_Object
8393read_char_x_menu_prompt (ptrdiff_t nmaps, Lisp_Object *maps, 8365read_char_x_menu_prompt (ptrdiff_t nmaps, Lisp_Object *maps,
8394 Lisp_Object prev_event, int *used_mouse_menu) 8366 Lisp_Object prev_event, bool *used_mouse_menu)
8395{ 8367{
8396#ifdef HAVE_MENUS 8368#ifdef HAVE_MENUS
8397 ptrdiff_t mapno; 8369 ptrdiff_t mapno;
@@ -8485,7 +8457,7 @@ read_char_minibuf_menu_prompt (int commandflag,
8485 /* FIXME: Use the minibuffer's frame width. */ 8457 /* FIXME: Use the minibuffer's frame width. */
8486 ptrdiff_t width = FRAME_COLS (SELECTED_FRAME ()) - 4; 8458 ptrdiff_t width = FRAME_COLS (SELECTED_FRAME ()) - 4;
8487 ptrdiff_t idx = -1; 8459 ptrdiff_t idx = -1;
8488 int nobindings = 1; 8460 bool nobindings = 1;
8489 Lisp_Object rest, vector; 8461 Lisp_Object rest, vector;
8490 char *menu; 8462 char *menu;
8491 8463
@@ -8533,7 +8505,7 @@ read_char_minibuf_menu_prompt (int commandflag,
8533 /* Present the documented bindings, a line at a time. */ 8505 /* Present the documented bindings, a line at a time. */
8534 while (1) 8506 while (1)
8535 { 8507 {
8536 int notfirst = 0; 8508 bool notfirst = 0;
8537 ptrdiff_t i = nlength; 8509 ptrdiff_t i = nlength;
8538 Lisp_Object obj; 8510 Lisp_Object obj;
8539 Lisp_Object orig_defn_macro; 8511 Lisp_Object orig_defn_macro;
@@ -8589,8 +8561,8 @@ read_char_minibuf_menu_prompt (int commandflag,
8589 /* Ignore the element if it has no prompt string. */ 8561 /* Ignore the element if it has no prompt string. */
8590 if (INTEGERP (event) && parse_menu_item (elt, -1)) 8562 if (INTEGERP (event) && parse_menu_item (elt, -1))
8591 { 8563 {
8592 /* 1 if the char to type matches the string. */ 8564 /* True if the char to type matches the string. */
8593 int char_matches; 8565 bool char_matches;
8594 Lisp_Object upcased_event, downcased_event; 8566 Lisp_Object upcased_event, downcased_event;
8595 Lisp_Object desc = Qnil; 8567 Lisp_Object desc = Qnil;
8596 Lisp_Object s 8568 Lisp_Object s
@@ -8642,7 +8614,7 @@ read_char_minibuf_menu_prompt (int commandflag,
8642 i += 2; 8614 i += 2;
8643 } 8615 }
8644 notfirst = 1; 8616 notfirst = 1;
8645 nobindings = 0 ; 8617 nobindings = 0;
8646 8618
8647 /* If the char to type doesn't match the string's 8619 /* If the char to type doesn't match the string's
8648 first char, explicitly show what char to type. */ 8620 first char, explicitly show what char to type. */
@@ -8776,14 +8748,14 @@ typedef struct keyremap
8776 8748
8777/* Lookup KEY in MAP. 8749/* Lookup KEY in MAP.
8778 MAP is a keymap mapping keys to key vectors or functions. 8750 MAP is a keymap mapping keys to key vectors or functions.
8779 If the mapping is a function and DO_FUNCTION is non-zero, then 8751 If the mapping is a function and DO_FUNCALL is true,
8780 the function is called with PROMPT as parameter and its return 8752 the function is called with PROMPT as parameter and its return
8781 value is used as the return value of this function (after checking 8753 value is used as the return value of this function (after checking
8782 that it is indeed a vector). */ 8754 that it is indeed a vector). */
8783 8755
8784static Lisp_Object 8756static Lisp_Object
8785access_keymap_keyremap (Lisp_Object map, Lisp_Object key, Lisp_Object prompt, 8757access_keymap_keyremap (Lisp_Object map, Lisp_Object key, Lisp_Object prompt,
8786 int do_funcall) 8758 bool do_funcall)
8787{ 8759{
8788 Lisp_Object next; 8760 Lisp_Object next;
8789 8761
@@ -8822,15 +8794,15 @@ access_keymap_keyremap (Lisp_Object map, Lisp_Object key, Lisp_Object prompt,
8822 BUFSIZE is its maximum size. 8794 BUFSIZE is its maximum size.
8823 FKEY is a pointer to the keyremap structure to use. 8795 FKEY is a pointer to the keyremap structure to use.
8824 INPUT is the index of the last element in KEYBUF. 8796 INPUT is the index of the last element in KEYBUF.
8825 DOIT if non-zero says that the remapping can actually take place. 8797 DOIT if true says that the remapping can actually take place.
8826 DIFF is used to return the number of keys added/removed by the remapping. 8798 DIFF is used to return the number of keys added/removed by the remapping.
8827 PARENT is the root of the keymap. 8799 PARENT is the root of the keymap.
8828 PROMPT is the prompt to use if the remapping happens through a function. 8800 PROMPT is the prompt to use if the remapping happens through a function.
8829 The return value is non-zero if the remapping actually took place. */ 8801 Return true if the remapping actually took place. */
8830 8802
8831static int 8803static bool
8832keyremap_step (Lisp_Object *keybuf, int bufsize, volatile keyremap *fkey, 8804keyremap_step (Lisp_Object *keybuf, int bufsize, volatile keyremap *fkey,
8833 int input, int doit, int *diff, Lisp_Object prompt) 8805 int input, bool doit, int *diff, Lisp_Object prompt)
8834{ 8806{
8835 Lisp_Object next, key; 8807 Lisp_Object next, key;
8836 8808
@@ -8884,7 +8856,7 @@ keyremap_step (Lisp_Object *keybuf, int bufsize, volatile keyremap *fkey,
8884 return 0; 8856 return 0;
8885} 8857}
8886 8858
8887static int 8859static bool
8888test_undefined (Lisp_Object binding) 8860test_undefined (Lisp_Object binding)
8889{ 8861{
8890 return (EQ (binding, Qundefined) 8862 return (EQ (binding, Qundefined)
@@ -8926,13 +8898,13 @@ test_undefined (Lisp_Object binding)
8926 off the switch-frame event until later; the next call to 8898 off the switch-frame event until later; the next call to
8927 read_char will return it. 8899 read_char will return it.
8928 8900
8929 If FIX_CURRENT_BUFFER is nonzero, we restore current_buffer 8901 If FIX_CURRENT_BUFFER, we restore current_buffer
8930 from the selected window's buffer. */ 8902 from the selected window's buffer. */
8931 8903
8932static int 8904static int
8933read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, 8905read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
8934 int dont_downcase_last, int can_return_switch_frame, 8906 bool dont_downcase_last, bool can_return_switch_frame,
8935 int fix_current_buffer) 8907 bool fix_current_buffer)
8936{ 8908{
8937 Lisp_Object from_string; 8909 Lisp_Object from_string;
8938 ptrdiff_t count = SPECPDL_INDEX (); 8910 ptrdiff_t count = SPECPDL_INDEX ();
@@ -8965,7 +8937,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
8965 key sequence. */ 8937 key sequence. */
8966 Lisp_Object orig_keymap; 8938 Lisp_Object orig_keymap;
8967 8939
8968 /* 1 if we have already considered switching to the local-map property 8940 /* Positive if we have already considered switching to the local-map property
8969 of the place where a mouse click occurred. */ 8941 of the place where a mouse click occurred. */
8970 int localized_local_map = 0; 8942 int localized_local_map = 0;
8971 8943
@@ -9005,10 +8977,10 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9005 /* Likewise, for key_translation_map and input-decode-map. */ 8977 /* Likewise, for key_translation_map and input-decode-map. */
9006 keyremap keytran, indec; 8978 keyremap keytran, indec;
9007 8979
9008 /* Non-zero if we are trying to map a key by changing an upper-case 8980 /* True if we are trying to map a key by changing an upper-case
9009 letter to lower case, or a shifted function key to an unshifted 8981 letter to lower case, or a shifted function key to an unshifted
9010 one. */ 8982 one. */
9011 int shift_translated = 0; 8983 bool shift_translated = 0;
9012 8984
9013 /* If we receive a `switch-frame' or `select-window' event in the middle of 8985 /* If we receive a `switch-frame' or `select-window' event in the middle of
9014 a key sequence, we put it off for later. 8986 a key sequence, we put it off for later.
@@ -9024,7 +8996,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9024 int original_uppercase_position = -1; 8996 int original_uppercase_position = -1;
9025 8997
9026 /* Gets around Microsoft compiler limitations. */ 8998 /* Gets around Microsoft compiler limitations. */
9027 int dummyflag = 0; 8999 bool dummyflag = 0;
9028 9000
9029 struct buffer *starting_buffer; 9001 struct buffer *starting_buffer;
9030 9002
@@ -9186,7 +9158,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9186 : (/* indec.start < t || fkey.start < t || */ keytran.start < t)) 9158 : (/* indec.start < t || fkey.start < t || */ keytran.start < t))
9187 { 9159 {
9188 Lisp_Object key; 9160 Lisp_Object key;
9189 int used_mouse_menu = 0; 9161 bool used_mouse_menu = 0;
9190 9162
9191 /* Where the last real key started. If we need to throw away a 9163 /* Where the last real key started. If we need to throw away a
9192 key that has expanded into more than one element of keybuf 9164 key that has expanded into more than one element of keybuf
@@ -9280,7 +9252,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9280 return. Any better way to fix this? -- cyd */ 9252 return. Any better way to fix this? -- cyd */
9281 || (interrupted_kboard != current_kboard)) 9253 || (interrupted_kboard != current_kboard))
9282 { 9254 {
9283 int found = 0; 9255 bool found = 0;
9284 struct kboard *k; 9256 struct kboard *k;
9285 9257
9286 for (k = all_kboards; k; k = k->next_kboard) 9258 for (k = all_kboards; k; k = k->next_kboard)
@@ -9834,7 +9806,8 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9834 while (indec.end < t) 9806 while (indec.end < t)
9835 { 9807 {
9836 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; 9808 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
9837 int done, diff; 9809 bool done;
9810 int diff;
9838 9811
9839 GCPRO4 (indec.map, fkey.map, keytran.map, delayed_switch_frame); 9812 GCPRO4 (indec.map, fkey.map, keytran.map, delayed_switch_frame);
9840 done = keyremap_step (keybuf, bufsize, &indec, max (t, mock_input), 9813 done = keyremap_step (keybuf, bufsize, &indec, max (t, mock_input),
@@ -9868,7 +9841,8 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9868 while (fkey.end < indec.start) 9841 while (fkey.end < indec.start)
9869 { 9842 {
9870 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; 9843 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
9871 int done, diff; 9844 bool done;
9845 int diff;
9872 9846
9873 GCPRO4 (indec.map, fkey.map, keytran.map, delayed_switch_frame); 9847 GCPRO4 (indec.map, fkey.map, keytran.map, delayed_switch_frame);
9874 done = keyremap_step (keybuf, bufsize, &fkey, 9848 done = keyremap_step (keybuf, bufsize, &fkey,
@@ -9897,7 +9871,8 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9897 while (keytran.end < fkey.start) 9871 while (keytran.end < fkey.start)
9898 { 9872 {
9899 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; 9873 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
9900 int done, diff; 9874 bool done;
9875 int diff;
9901 9876
9902 GCPRO4 (indec.map, fkey.map, keytran.map, delayed_switch_frame); 9877 GCPRO4 (indec.map, fkey.map, keytran.map, delayed_switch_frame);
9903 done = keyremap_step (keybuf, bufsize, &keytran, max (t, mock_input), 9878 done = keyremap_step (keybuf, bufsize, &keytran, max (t, mock_input),
@@ -10283,38 +10258,32 @@ a special event, so ignore the prefix argument and don't clear it. */)
10283 10258
10284 10259
10285 10260
10286/* Return nonzero if input events are pending. */ 10261/* Return true if input events are pending. */
10287 10262
10288int 10263bool
10289detect_input_pending (void) 10264detect_input_pending (void)
10290{ 10265{
10291 if (!input_pending) 10266 return input_pending || get_input_pending (0);
10292 get_input_pending (&input_pending, 0);
10293
10294 return input_pending;
10295} 10267}
10296 10268
10297/* Return nonzero if input events other than mouse movements are 10269/* Return true if input events other than mouse movements are
10298 pending. */ 10270 pending. */
10299 10271
10300int 10272bool
10301detect_input_pending_ignore_squeezables (void) 10273detect_input_pending_ignore_squeezables (void)
10302{ 10274{
10303 if (!input_pending) 10275 return input_pending || get_input_pending (READABLE_EVENTS_IGNORE_SQUEEZABLES);
10304 get_input_pending (&input_pending, READABLE_EVENTS_IGNORE_SQUEEZABLES);
10305
10306 return input_pending;
10307} 10276}
10308 10277
10309/* Return nonzero if input events are pending, and run any pending timers. */ 10278/* Return true if input events are pending, and run any pending timers. */
10310 10279
10311int 10280bool
10312detect_input_pending_run_timers (int do_display) 10281detect_input_pending_run_timers (bool do_display)
10313{ 10282{
10314 int old_timers_run = timers_run; 10283 unsigned old_timers_run = timers_run;
10315 10284
10316 if (!input_pending) 10285 if (!input_pending)
10317 get_input_pending (&input_pending, READABLE_EVENTS_DO_TIMERS_NOW); 10286 get_input_pending (READABLE_EVENTS_DO_TIMERS_NOW);
10318 10287
10319 if (old_timers_run != timers_run && do_display) 10288 if (old_timers_run != timers_run && do_display)
10320 { 10289 {
@@ -10345,13 +10314,13 @@ clear_input_pending (void)
10345 input_pending = 0; 10314 input_pending = 0;
10346} 10315}
10347 10316
10348/* Return nonzero if there are pending requeued events. 10317/* Return true if there are pending requeued events.
10349 This isn't used yet. The hope is to make wait_reading_process_output 10318 This isn't used yet. The hope is to make wait_reading_process_output
10350 call it, and return if it runs Lisp code that unreads something. 10319 call it, and return if it runs Lisp code that unreads something.
10351 The problem is, kbd_buffer_get_event needs to be fixed to know what 10320 The problem is, kbd_buffer_get_event needs to be fixed to know what
10352 to do in that case. It isn't trivial. */ 10321 to do in that case. It isn't trivial. */
10353 10322
10354int 10323bool
10355requeued_events_pending_p (void) 10324requeued_events_pending_p (void)
10356{ 10325{
10357 return (!NILP (Vunread_command_events)); 10326 return (!NILP (Vunread_command_events));
@@ -10372,10 +10341,9 @@ if there is a doubt, the value is t. */)
10372 /* Process non-user-visible events (Bug#10195). */ 10341 /* Process non-user-visible events (Bug#10195). */
10373 process_special_events (); 10342 process_special_events ();
10374 10343
10375 get_input_pending (&input_pending, 10344 return (get_input_pending (READABLE_EVENTS_DO_TIMERS_NOW
10376 READABLE_EVENTS_DO_TIMERS_NOW 10345 | READABLE_EVENTS_FILTER_EVENTS)
10377 | READABLE_EVENTS_FILTER_EVENTS); 10346 ? Qt : Qnil);
10378 return input_pending > 0 ? Qt : Qnil;
10379} 10347}
10380 10348
10381DEFUN ("recent-keys", Frecent_keys, Srecent_keys, 0, 0, 0, 10349DEFUN ("recent-keys", Frecent_keys, Srecent_keys, 0, 0, 0,
@@ -10881,7 +10849,7 @@ handle_interrupt (bool in_signal_handler)
10881/* Handle a C-g by making read_char return C-g. */ 10849/* Handle a C-g by making read_char return C-g. */
10882 10850
10883static void 10851static void
10884quit_throw_to_read_char (int from_signal) 10852quit_throw_to_read_char (bool from_signal)
10885{ 10853{
10886 /* When not called from a signal handler it is safe to call 10854 /* When not called from a signal handler it is safe to call
10887 Lisp. */ 10855 Lisp. */
@@ -10911,7 +10879,7 @@ otherwise Emacs uses CBREAK mode.
10911See also `current-input-mode'. */) 10879See also `current-input-mode'. */)
10912 (Lisp_Object interrupt) 10880 (Lisp_Object interrupt)
10913{ 10881{
10914 int new_interrupt_input; 10882 bool new_interrupt_input;
10915#ifdef USABLE_SIGIO 10883#ifdef USABLE_SIGIO
10916#ifdef HAVE_X_WINDOWS 10884#ifdef HAVE_X_WINDOWS
10917 if (x_display_list != NULL) 10885 if (x_display_list != NULL)
diff --git a/src/keyboard.h b/src/keyboard.h
index d78c27fbf9b..e57c8cc7193 100644
--- a/src/keyboard.h
+++ b/src/keyboard.h
@@ -169,12 +169,12 @@ struct kboard
169 reading from this KBOARD again until more input arrives. */ 169 reading from this KBOARD again until more input arrives. */
170 char kbd_queue_has_data; 170 char kbd_queue_has_data;
171 171
172 /* Nonzero means echo each character as typed. */ 172 /* True means echo each character as typed. */
173 char immediate_echo; 173 unsigned immediate_echo : 1;
174 174
175 /* If we have echoed a prompt string specified by the user, 175 /* If we have echoed a prompt string specified by the user,
176 this is its length in characters. Otherwise this is -1. */ 176 this is its length in characters. Otherwise this is -1. */
177 char echo_after_prompt; 177 ptrdiff_t echo_after_prompt;
178 }; 178 };
179 179
180KEYBOARD_INLINE void 180KEYBOARD_INLINE void
@@ -463,14 +463,14 @@ extern Lisp_Object Qhelp_echo;
463extern Lisp_Object Qmode_line, Qvertical_line, Qheader_line; 463extern Lisp_Object Qmode_line, Qvertical_line, Qheader_line;
464 464
465/* True while doing kbd input. */ 465/* True while doing kbd input. */
466extern int waiting_for_input; 466extern bool waiting_for_input;
467 467
468/* Address (if not 0) of EMACS_TIME to zero out if a SIGIO interrupt 468/* Address (if not 0) of EMACS_TIME to zero out if a SIGIO interrupt
469 happens. */ 469 happens. */
470extern EMACS_TIME *input_available_clear_time; 470extern EMACS_TIME *input_available_clear_time;
471 471
472#if defined HAVE_WINDOW_SYSTEM && !defined USE_GTK && !defined HAVE_NS 472#if defined HAVE_WINDOW_SYSTEM && !defined USE_GTK && !defined HAVE_NS
473extern int ignore_mouse_drag_p; 473extern bool ignore_mouse_drag_p;
474#endif 474#endif
475 475
476/* The primary selection. */ 476/* The primary selection. */
@@ -482,7 +482,7 @@ struct input_event;
482extern Lisp_Object parse_modifiers (Lisp_Object); 482extern Lisp_Object parse_modifiers (Lisp_Object);
483extern Lisp_Object reorder_modifiers (Lisp_Object); 483extern Lisp_Object reorder_modifiers (Lisp_Object);
484extern Lisp_Object read_char (int, ptrdiff_t, Lisp_Object *, Lisp_Object, 484extern Lisp_Object read_char (int, ptrdiff_t, Lisp_Object *, Lisp_Object,
485 int *, EMACS_TIME *); 485 bool *, EMACS_TIME *);
486extern int parse_solitary_modifier (Lisp_Object symbol); 486extern int parse_solitary_modifier (Lisp_Object symbol);
487 487
488 488
@@ -506,10 +506,10 @@ extern Time last_event_timestamp;
506 506
507extern int quit_char; 507extern int quit_char;
508 508
509extern int timers_run; 509extern unsigned int timers_run;
510 510
511extern int menu_separator_name_p (const char *); 511extern bool menu_separator_name_p (const char *);
512extern int parse_menu_item (Lisp_Object, int); 512extern bool parse_menu_item (Lisp_Object, int);
513 513
514extern void init_kboard (KBOARD *); 514extern void init_kboard (KBOARD *);
515extern void delete_kboard (KBOARD *); 515extern void delete_kboard (KBOARD *);
@@ -524,15 +524,15 @@ extern void start_polling (void);
524extern void stop_polling (void); 524extern void stop_polling (void);
525extern void set_poll_suppress_count (int); 525extern void set_poll_suppress_count (int);
526extern int gobble_input (void); 526extern int gobble_input (void);
527extern int input_polling_used (void); 527extern bool input_polling_used (void);
528extern void clear_input_pending (void); 528extern void clear_input_pending (void);
529extern int requeued_events_pending_p (void); 529extern bool requeued_events_pending_p (void);
530extern void bind_polling_period (int); 530extern void bind_polling_period (int);
531extern int make_ctrl_char (int) ATTRIBUTE_CONST; 531extern int make_ctrl_char (int) ATTRIBUTE_CONST;
532extern void stuff_buffered_input (Lisp_Object); 532extern void stuff_buffered_input (Lisp_Object);
533extern void clear_waiting_for_input (void); 533extern void clear_waiting_for_input (void);
534extern void swallow_events (int); 534extern void swallow_events (bool);
535extern int lucid_event_type_list_p (Lisp_Object); 535extern bool lucid_event_type_list_p (Lisp_Object);
536extern void kbd_buffer_store_event (struct input_event *); 536extern void kbd_buffer_store_event (struct input_event *);
537extern void kbd_buffer_store_event_hold (struct input_event *, 537extern void kbd_buffer_store_event_hold (struct input_event *,
538 struct input_event *); 538 struct input_event *);
@@ -544,7 +544,7 @@ extern void gen_help_event (Lisp_Object, Lisp_Object, Lisp_Object,
544 Lisp_Object, ptrdiff_t); 544 Lisp_Object, ptrdiff_t);
545extern void kbd_buffer_store_help_event (Lisp_Object, Lisp_Object); 545extern void kbd_buffer_store_help_event (Lisp_Object, Lisp_Object);
546extern Lisp_Object menu_item_eval_property (Lisp_Object); 546extern Lisp_Object menu_item_eval_property (Lisp_Object);
547extern int kbd_buffer_events_waiting (int); 547extern bool kbd_buffer_events_waiting (void);
548extern void add_user_signal (int, const char *); 548extern void add_user_signal (int, const char *);
549 549
550extern int tty_read_avail_input (struct terminal *, struct input_event *); 550extern int tty_read_avail_input (struct terminal *, struct input_event *);
diff --git a/src/keymap.c b/src/keymap.c
index 6ea142651bf..fbdd31e0de3 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -99,12 +99,12 @@ static void describe_command (Lisp_Object, Lisp_Object);
99static void describe_translation (Lisp_Object, Lisp_Object); 99static void describe_translation (Lisp_Object, Lisp_Object);
100static void describe_map (Lisp_Object, Lisp_Object, 100static void describe_map (Lisp_Object, Lisp_Object,
101 void (*) (Lisp_Object, Lisp_Object), 101 void (*) (Lisp_Object, Lisp_Object),
102 int, Lisp_Object, Lisp_Object*, int, int); 102 bool, Lisp_Object, Lisp_Object*, bool, bool);
103static void describe_vector (Lisp_Object, Lisp_Object, Lisp_Object, 103static void describe_vector (Lisp_Object, Lisp_Object, Lisp_Object,
104 void (*) (Lisp_Object, Lisp_Object), int, 104 void (*) (Lisp_Object, Lisp_Object), bool,
105 Lisp_Object, Lisp_Object, int, int); 105 Lisp_Object, Lisp_Object, bool, bool);
106static void silly_event_symbol_error (Lisp_Object); 106static void silly_event_symbol_error (Lisp_Object);
107static Lisp_Object get_keyelt (Lisp_Object, int); 107static Lisp_Object get_keyelt (Lisp_Object, bool);
108 108
109/* Keymap object support - constructors and predicates. */ 109/* Keymap object support - constructors and predicates. */
110 110
@@ -207,15 +207,12 @@ when reading a key-sequence to be looked-up in this keymap. */)
207/* Check that OBJECT is a keymap (after dereferencing through any 207/* Check that OBJECT is a keymap (after dereferencing through any
208 symbols). If it is, return it. 208 symbols). If it is, return it.
209 209
210 If AUTOLOAD is non-zero and OBJECT is a symbol whose function value 210 If AUTOLOAD and if OBJECT is a symbol whose function value
211 is an autoload form, do the autoload and try again. 211 is an autoload form, do the autoload and try again.
212 If AUTOLOAD is nonzero, callers must assume GC is possible. 212 If AUTOLOAD, callers must assume GC is possible.
213
214 If the map needs to be autoloaded, but AUTOLOAD is zero (and ERROR
215 is zero as well), return Qt.
216 213
217 ERROR_IF_NOT_KEYMAP controls how we respond if OBJECT isn't a keymap. 214 ERROR_IF_NOT_KEYMAP controls how we respond if OBJECT isn't a keymap.
218 If ERROR_IF_NOT_KEYMAP is non-zero, signal an error; otherwise, 215 If ERROR_IF_NOT_KEYMAP, signal an error; otherwise,
219 just return Qnil. 216 just return Qnil.
220 217
221 Note that most of the time, we don't want to pursue autoloads. 218 Note that most of the time, we don't want to pursue autoloads.
@@ -224,11 +221,11 @@ when reading a key-sequence to be looked-up in this keymap. */)
224 but it seems to me that only read_key_sequence, Flookup_key, and 221 but it seems to me that only read_key_sequence, Flookup_key, and
225 Fdefine_key should cause keymaps to be autoloaded. 222 Fdefine_key should cause keymaps to be autoloaded.
226 223
227 This function can GC when AUTOLOAD is non-zero, because it calls 224 This function can GC when AUTOLOAD is true, because it calls
228 Fautoload_do_load which can GC. */ 225 Fautoload_do_load which can GC. */
229 226
230Lisp_Object 227Lisp_Object
231get_keymap (Lisp_Object object, int error_if_not_keymap, int autoload) 228get_keymap (Lisp_Object object, bool error_if_not_keymap, bool autoload)
232{ 229{
233 Lisp_Object tem; 230 Lisp_Object tem;
234 231
@@ -280,7 +277,7 @@ get_keymap (Lisp_Object object, int error_if_not_keymap, int autoload)
280 We assume that KEYMAP is a valid keymap. */ 277 We assume that KEYMAP is a valid keymap. */
281 278
282static Lisp_Object 279static Lisp_Object
283keymap_parent (Lisp_Object keymap, int autoload) 280keymap_parent (Lisp_Object keymap, bool autoload)
284{ 281{
285 Lisp_Object list; 282 Lisp_Object list;
286 283
@@ -307,7 +304,7 @@ If KEYMAP has no parent, return nil. */)
307} 304}
308 305
309/* Check whether MAP is one of MAPS parents. */ 306/* Check whether MAP is one of MAPS parents. */
310static int 307static bool
311keymap_memberp (Lisp_Object map, Lisp_Object maps) 308keymap_memberp (Lisp_Object map, Lisp_Object maps)
312{ 309{
313 if (NILP (map)) return 0; 310 if (NILP (map)) return 0;
@@ -365,19 +362,20 @@ Return PARENT. PARENT should be nil or another keymap. */)
365 362
366 MAP must be a keymap or a list of keymaps. 363 MAP must be a keymap or a list of keymaps.
367 364
368 If T_OK is non-zero, bindings for Qt are treated as default 365 If T_OK, bindings for Qt are treated as default
369 bindings; any key left unmentioned by other tables and bindings is 366 bindings; any key left unmentioned by other tables and bindings is
370 given the binding of Qt. 367 given the binding of Qt.
371 368
372 If T_OK is zero, bindings for Qt are not treated specially. 369 If not T_OK, bindings for Qt are not treated specially.
373 370
374 If NOINHERIT, don't accept a subkeymap found in an inherited keymap. 371 If NOINHERIT, don't accept a subkeymap found in an inherited keymap.
375 372
376 Returns Qunbound if no binding was found (and returns Qnil if a nil 373 Return Qunbound if no binding was found (and return Qnil if a nil
377 binding was found). */ 374 binding was found). */
378 375
379static Lisp_Object 376static Lisp_Object
380access_keymap_1 (Lisp_Object map, Lisp_Object idx, int t_ok, int noinherit, int autoload) 377access_keymap_1 (Lisp_Object map, Lisp_Object idx,
378 bool t_ok, bool noinherit, bool autoload)
381{ 379{
382 /* If idx is a list (some sort of mouse click, perhaps?), 380 /* If idx is a list (some sort of mouse click, perhaps?),
383 the index we want to use is the car of the list, which 381 the index we want to use is the car of the list, which
@@ -547,7 +545,7 @@ access_keymap_1 (Lisp_Object map, Lisp_Object idx, int t_ok, int noinherit, int
547 545
548Lisp_Object 546Lisp_Object
549access_keymap (Lisp_Object map, Lisp_Object idx, 547access_keymap (Lisp_Object map, Lisp_Object idx,
550 int t_ok, int noinherit, int autoload) 548 bool t_ok, bool noinherit, bool autoload)
551{ 549{
552 Lisp_Object val = access_keymap_1 (map, idx, t_ok, noinherit, autoload); 550 Lisp_Object val = access_keymap_1 (map, idx, t_ok, noinherit, autoload);
553 return EQ (val, Qunbound) ? Qnil : val; 551 return EQ (val, Qunbound) ? Qnil : val;
@@ -630,9 +628,10 @@ map_keymap_call (Lisp_Object key, Lisp_Object val, Lisp_Object fun, void *dummy)
630} 628}
631 629
632/* Same as map_keymap_internal, but traverses parent keymaps as well. 630/* Same as map_keymap_internal, but traverses parent keymaps as well.
633 A non-zero AUTOLOAD indicates that autoloaded keymaps should be loaded. */ 631 AUTOLOAD indicates that autoloaded keymaps should be loaded. */
634void 632void
635map_keymap (Lisp_Object map, map_keymap_function_t fun, Lisp_Object args, void *data, int autoload) 633map_keymap (Lisp_Object map, map_keymap_function_t fun, Lisp_Object args,
634 void *data, bool autoload)
636{ 635{
637 struct gcpro gcpro1; 636 struct gcpro gcpro1;
638 GCPRO1 (args); 637 GCPRO1 (args);
@@ -711,13 +710,13 @@ usage: (map-keymap FUNCTION KEYMAP) */)
711 Also if OBJECT has a menu string as the first element, 710 Also if OBJECT has a menu string as the first element,
712 remove that. Also remove a menu help string as second element. 711 remove that. Also remove a menu help string as second element.
713 712
714 If AUTOLOAD is nonzero, load autoloadable keymaps 713 If AUTOLOAD, load autoloadable keymaps
715 that are referred to with indirection. 714 that are referred to with indirection.
716 715
717 This can GC because menu_item_eval_property calls Feval. */ 716 This can GC because menu_item_eval_property calls Feval. */
718 717
719static Lisp_Object 718static Lisp_Object
720get_keyelt (Lisp_Object object, int autoload) 719get_keyelt (Lisp_Object object, bool autoload)
721{ 720{
722 while (1) 721 while (1)
723 { 722 {
@@ -1114,10 +1113,10 @@ binding is altered. If there is no binding for KEY, the new pair
1114binding KEY to DEF is added at the front of KEYMAP. */) 1113binding KEY to DEF is added at the front of KEYMAP. */)
1115 (Lisp_Object keymap, Lisp_Object key, Lisp_Object def) 1114 (Lisp_Object keymap, Lisp_Object key, Lisp_Object def)
1116{ 1115{
1117 register ptrdiff_t idx; 1116 ptrdiff_t idx;
1118 register Lisp_Object c; 1117 Lisp_Object c;
1119 register Lisp_Object cmd; 1118 Lisp_Object cmd;
1120 int metized = 0; 1119 bool metized = 0;
1121 int meta_bit; 1120 int meta_bit;
1122 ptrdiff_t length; 1121 ptrdiff_t length;
1123 struct gcpro gcpro1, gcpro2, gcpro3; 1122 struct gcpro gcpro1, gcpro2, gcpro3;
@@ -1271,11 +1270,11 @@ third optional argument ACCEPT-DEFAULT is non-nil, `lookup-key' will
1271recognize the default bindings, just as `read-key-sequence' does. */) 1270recognize the default bindings, just as `read-key-sequence' does. */)
1272 (Lisp_Object keymap, Lisp_Object key, Lisp_Object accept_default) 1271 (Lisp_Object keymap, Lisp_Object key, Lisp_Object accept_default)
1273{ 1272{
1274 register ptrdiff_t idx; 1273 ptrdiff_t idx;
1275 register Lisp_Object cmd; 1274 Lisp_Object cmd;
1276 register Lisp_Object c; 1275 Lisp_Object c;
1277 ptrdiff_t length; 1276 ptrdiff_t length;
1278 int t_ok = !NILP (accept_default); 1277 bool t_ok = !NILP (accept_default);
1279 struct gcpro gcpro1, gcpro2; 1278 struct gcpro gcpro1, gcpro2;
1280 1279
1281 GCPRO2 (keymap, key); 1280 GCPRO2 (keymap, key);
@@ -1887,7 +1886,7 @@ DEFUN ("current-minor-mode-maps", Fcurrent_minor_mode_maps, Scurrent_minor_mode_
1887struct accessible_keymaps_data { 1886struct accessible_keymaps_data {
1888 Lisp_Object maps, tail, thisseq; 1887 Lisp_Object maps, tail, thisseq;
1889 /* Does the current sequence end in the meta-prefix-char? */ 1888 /* Does the current sequence end in the meta-prefix-char? */
1890 int is_metized; 1889 bool is_metized;
1891}; 1890};
1892 1891
1893static void 1892static void
@@ -1898,7 +1897,7 @@ accessible_keymaps_1 (Lisp_Object key, Lisp_Object cmd, Lisp_Object args, void *
1898 Lisp_Object maps = d->maps; 1897 Lisp_Object maps = d->maps;
1899 Lisp_Object tail = d->tail; 1898 Lisp_Object tail = d->tail;
1900 Lisp_Object thisseq = d->thisseq; 1899 Lisp_Object thisseq = d->thisseq;
1901 int is_metized = d->is_metized && INTEGERP (key); 1900 bool is_metized = d->is_metized && INTEGERP (key);
1902 Lisp_Object tem; 1901 Lisp_Object tem;
1903 1902
1904 cmd = get_keymap (get_keyelt (cmd, 0), 0, 0); 1903 cmd = get_keymap (get_keyelt (cmd, 0), 0, 0);
@@ -2060,7 +2059,7 @@ The `kbd' macro is an approximate inverse of this. */)
2060 Lisp_Object sep = build_string (" "); 2059 Lisp_Object sep = build_string (" ");
2061 Lisp_Object key; 2060 Lisp_Object key;
2062 Lisp_Object result; 2061 Lisp_Object result;
2063 int add_meta = 0; 2062 bool add_meta = 0;
2064 USE_SAFE_ALLOCA; 2063 USE_SAFE_ALLOCA;
2065 2064
2066 if (!NILP (prefix)) 2065 if (!NILP (prefix))
@@ -2155,9 +2154,10 @@ The `kbd' macro is an approximate inverse of this. */)
2155 2154
2156 2155
2157char * 2156char *
2158push_key_description (EMACS_INT ch, char *p, int force_multibyte) 2157push_key_description (EMACS_INT ch, char *p)
2159{ 2158{
2160 int c, c2, tab_as_ci; 2159 int c, c2;
2160 bool tab_as_ci;
2161 2161
2162 /* Clear all the meaningless bits above the meta bit. */ 2162 /* Clear all the meaningless bits above the meta bit. */
2163 c = ch & (meta_modifier | ~ - meta_modifier); 2163 c = ch & (meta_modifier | ~ - meta_modifier);
@@ -2256,21 +2256,12 @@ push_key_description (EMACS_INT ch, char *p, int force_multibyte)
2256 *p++ = 'P'; 2256 *p++ = 'P';
2257 *p++ = 'C'; 2257 *p++ = 'C';
2258 } 2258 }
2259 else if (c < 128 2259 else if (c < 128)
2260 || (NILP (BVAR (current_buffer, enable_multibyte_characters)) 2260 *p++ = c;
2261 && SINGLE_BYTE_CHAR_P (c)
2262 && !force_multibyte))
2263 {
2264 *p++ = c;
2265 }
2266 else 2261 else
2267 { 2262 {
2268 /* Now we are sure that C is a valid character code. */ 2263 /* Now we are sure that C is a valid character code. */
2269 if (NILP (BVAR (current_buffer, enable_multibyte_characters)) 2264 p += CHAR_STRING (c, (unsigned char *) p);
2270 && ! force_multibyte)
2271 *p++ = multibyte_char_to_unibyte (c);
2272 else
2273 p += CHAR_STRING (c, (unsigned char *) p);
2274 } 2265 }
2275 2266
2276 return p; 2267 return p;
@@ -2299,9 +2290,8 @@ around function keys and event symbols. */)
2299 2290
2300 if (INTEGERP (key)) /* Normal character. */ 2291 if (INTEGERP (key)) /* Normal character. */
2301 { 2292 {
2302 char tem[KEY_DESCRIPTION_SIZE], *p; 2293 char tem[KEY_DESCRIPTION_SIZE];
2303 2294 char *p = push_key_description (XINT (key), tem);
2304 p = push_key_description (XINT (key), tem, 1);
2305 *p = 0; 2295 *p = 0;
2306 return make_specified_string (tem, -1, p - tem, 1); 2296 return make_specified_string (tem, -1, p - tem, 1);
2307 } 2297 }
@@ -2429,7 +2419,7 @@ static void where_is_internal_1 (Lisp_Object key, Lisp_Object binding,
2429 2419
2430static Lisp_Object 2420static Lisp_Object
2431shadow_lookup (Lisp_Object shadow, Lisp_Object key, Lisp_Object flag, 2421shadow_lookup (Lisp_Object shadow, Lisp_Object key, Lisp_Object flag,
2432 int remap) 2422 bool remap)
2433{ 2423{
2434 Lisp_Object tail, value; 2424 Lisp_Object tail, value;
2435 2425
@@ -2461,7 +2451,7 @@ static Lisp_Object Vmouse_events;
2461 2451
2462struct where_is_internal_data { 2452struct where_is_internal_data {
2463 Lisp_Object definition, this, last; 2453 Lisp_Object definition, this, last;
2464 int last_is_meta, noindirect; 2454 bool last_is_meta, noindirect;
2465 Lisp_Object sequences; 2455 Lisp_Object sequences;
2466}; 2456};
2467 2457
@@ -2474,7 +2464,7 @@ struct where_is_internal_data {
2474 2464
2475static Lisp_Object 2465static Lisp_Object
2476where_is_internal (Lisp_Object definition, Lisp_Object keymaps, 2466where_is_internal (Lisp_Object definition, Lisp_Object keymaps,
2477 int noindirect, int nomenus) 2467 bool noindirect, bool nomenus)
2478{ 2468{
2479 Lisp_Object maps = Qnil; 2469 Lisp_Object maps = Qnil;
2480 Lisp_Object found; 2470 Lisp_Object found;
@@ -2523,7 +2513,7 @@ where_is_internal (Lisp_Object definition, Lisp_Object keymaps,
2523 [M-CHAR] sequences, check if last character of the sequence 2513 [M-CHAR] sequences, check if last character of the sequence
2524 is the meta-prefix char. */ 2514 is the meta-prefix char. */
2525 Lisp_Object last; 2515 Lisp_Object last;
2526 int last_is_meta; 2516 bool last_is_meta;
2527 2517
2528 this = Fcar (XCAR (maps)); 2518 this = Fcar (XCAR (maps));
2529 map = Fcdr (XCAR (maps)); 2519 map = Fcdr (XCAR (maps));
@@ -2606,7 +2596,7 @@ The optional 5th arg NO-REMAP alters how command remapping is handled:
2606 /* Actually relevant bindings. */ 2596 /* Actually relevant bindings. */
2607 Lisp_Object found = Qnil; 2597 Lisp_Object found = Qnil;
2608 /* 1 means ignore all menu bindings entirely. */ 2598 /* 1 means ignore all menu bindings entirely. */
2609 int nomenus = !NILP (firstonly) && !EQ (firstonly, Qnon_ascii); 2599 bool nomenus = !NILP (firstonly) && !EQ (firstonly, Qnon_ascii);
2610 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6; 2600 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5, gcpro6;
2611 /* List of sequences found via remapping. Keep them in a separate 2601 /* List of sequences found via remapping. Keep them in a separate
2612 variable, so as to push them later, since we prefer 2602 variable, so as to push them later, since we prefer
@@ -2615,7 +2605,7 @@ The optional 5th arg NO-REMAP alters how command remapping is handled:
2615 /* Whether or not we're handling remapped sequences. This is needed 2605 /* Whether or not we're handling remapped sequences. This is needed
2616 because remapping is not done recursively by Fcommand_remapping: you 2606 because remapping is not done recursively by Fcommand_remapping: you
2617 can't remap a remapped command. */ 2607 can't remap a remapped command. */
2618 int remapped = 0; 2608 bool remapped = 0;
2619 Lisp_Object tem = Qnil; 2609 Lisp_Object tem = Qnil;
2620 2610
2621 /* Refresh the C version of the modifier preference. */ 2611 /* Refresh the C version of the modifier preference. */
@@ -2767,10 +2757,10 @@ where_is_internal_1 (Lisp_Object key, Lisp_Object binding, Lisp_Object args, voi
2767{ 2757{
2768 struct where_is_internal_data *d = data; /* Cast! */ 2758 struct where_is_internal_data *d = data; /* Cast! */
2769 Lisp_Object definition = d->definition; 2759 Lisp_Object definition = d->definition;
2770 int noindirect = d->noindirect; 2760 bool noindirect = d->noindirect;
2771 Lisp_Object this = d->this; 2761 Lisp_Object this = d->this;
2772 Lisp_Object last = d->last; 2762 Lisp_Object last = d->last;
2773 int last_is_meta = d->last_is_meta; 2763 bool last_is_meta = d->last_is_meta;
2774 Lisp_Object sequence; 2764 Lisp_Object sequence;
2775 2765
2776 /* Search through indirections unless that's not wanted. */ 2766 /* Search through indirections unless that's not wanted. */
@@ -2821,8 +2811,8 @@ The optional argument MENUS, if non-nil, says to mention menu bindings.
2821 (Lisp_Object buffer, Lisp_Object prefix, Lisp_Object menus) 2811 (Lisp_Object buffer, Lisp_Object prefix, Lisp_Object menus)
2822{ 2812{
2823 Lisp_Object outbuf, shadow; 2813 Lisp_Object outbuf, shadow;
2824 int nomenu = NILP (menus); 2814 bool nomenu = NILP (menus);
2825 register Lisp_Object start1; 2815 Lisp_Object start1;
2826 struct gcpro gcpro1; 2816 struct gcpro gcpro1;
2827 2817
2828 const char *alternate_heading 2818 const char *alternate_heading
@@ -2857,10 +2847,10 @@ You type Translation\n\
2857 alternate_heading = 0; 2847 alternate_heading = 0;
2858 } 2848 }
2859 2849
2860 bufend = push_key_description (translate[c], buf, 1); 2850 bufend = push_key_description (translate[c], buf);
2861 insert (buf, bufend - buf); 2851 insert (buf, bufend - buf);
2862 Findent_to (make_number (16), make_number (1)); 2852 Findent_to (make_number (16), make_number (1));
2863 bufend = push_key_description (c, buf, 1); 2853 bufend = push_key_description (c, buf);
2864 insert (buf, bufend - buf); 2854 insert (buf, bufend - buf);
2865 2855
2866 insert ("\n", 1); 2856 insert ("\n", 1);
@@ -2977,34 +2967,34 @@ You type Translation\n\
2977 2967
2978/* Insert a description of the key bindings in STARTMAP, 2968/* Insert a description of the key bindings in STARTMAP,
2979 followed by those of all maps reachable through STARTMAP. 2969 followed by those of all maps reachable through STARTMAP.
2980 If PARTIAL is nonzero, omit certain "uninteresting" commands 2970 If PARTIAL, omit certain "uninteresting" commands
2981 (such as `undefined'). 2971 (such as `undefined').
2982 If SHADOW is non-nil, it is a list of maps; 2972 If SHADOW is non-nil, it is a list of maps;
2983 don't mention keys which would be shadowed by any of them. 2973 don't mention keys which would be shadowed by any of them.
2984 PREFIX, if non-nil, says mention only keys that start with PREFIX. 2974 PREFIX, if non-nil, says mention only keys that start with PREFIX.
2985 TITLE, if not 0, is a string to insert at the beginning. 2975 TITLE, if not 0, is a string to insert at the beginning.
2986 TITLE should not end with a colon or a newline; we supply that. 2976 TITLE should not end with a colon or a newline; we supply that.
2987 If NOMENU is not 0, then omit menu-bar commands. 2977 If NOMENU, then omit menu-bar commands.
2988 2978
2989 If TRANSL is nonzero, the definitions are actually key translations 2979 If TRANSL, the definitions are actually key translations
2990 so print strings and vectors differently. 2980 so print strings and vectors differently.
2991 2981
2992 If ALWAYS_TITLE is nonzero, print the title even if there are no maps 2982 If ALWAYS_TITLE, print the title even if there are no maps
2993 to look through. 2983 to look through.
2994 2984
2995 If MENTION_SHADOW is nonzero, then when something is shadowed by SHADOW, 2985 If MENTION_SHADOW, then when something is shadowed by SHADOW,
2996 don't omit it; instead, mention it but say it is shadowed. 2986 don't omit it; instead, mention it but say it is shadowed.
2997 2987
2998 Any inserted text ends in two newlines (used by `help-make-xrefs'). */ 2988 Any inserted text ends in two newlines (used by `help-make-xrefs'). */
2999 2989
3000void 2990void
3001describe_map_tree (Lisp_Object startmap, int partial, Lisp_Object shadow, 2991describe_map_tree (Lisp_Object startmap, bool partial, Lisp_Object shadow,
3002 Lisp_Object prefix, const char *title, int nomenu, int transl, 2992 Lisp_Object prefix, const char *title, bool nomenu,
3003 int always_title, int mention_shadow) 2993 bool transl, bool always_title, bool mention_shadow)
3004{ 2994{
3005 Lisp_Object maps, orig_maps, seen, sub_shadows; 2995 Lisp_Object maps, orig_maps, seen, sub_shadows;
3006 struct gcpro gcpro1, gcpro2, gcpro3; 2996 struct gcpro gcpro1, gcpro2, gcpro3;
3007 int something = 0; 2997 bool something = 0;
3008 const char *key_heading 2998 const char *key_heading
3009 = "\ 2999 = "\
3010key binding\n\ 3000key binding\n\
@@ -3179,7 +3169,12 @@ describe_translation (Lisp_Object definition, Lisp_Object args)
3179 into an array of `struct describe_map_elt', 3169 into an array of `struct describe_map_elt',
3180 then sorts them by the events. */ 3170 then sorts them by the events. */
3181 3171
3182struct describe_map_elt { Lisp_Object event; Lisp_Object definition; int shadowed; }; 3172struct describe_map_elt
3173{
3174 Lisp_Object event;
3175 Lisp_Object definition;
3176 bool shadowed;
3177};
3183 3178
3184/* qsort comparison function for sorting `struct describe_map_elt' by 3179/* qsort comparison function for sorting `struct describe_map_elt' by
3185 the event field. */ 3180 the event field. */
@@ -3209,14 +3204,14 @@ describe_map_compare (const void *aa, const void *bb)
3209static void 3204static void
3210describe_map (Lisp_Object map, Lisp_Object prefix, 3205describe_map (Lisp_Object map, Lisp_Object prefix,
3211 void (*elt_describer) (Lisp_Object, Lisp_Object), 3206 void (*elt_describer) (Lisp_Object, Lisp_Object),
3212 int partial, Lisp_Object shadow, 3207 bool partial, Lisp_Object shadow,
3213 Lisp_Object *seen, int nomenu, int mention_shadow) 3208 Lisp_Object *seen, bool nomenu, bool mention_shadow)
3214{ 3209{
3215 Lisp_Object tail, definition, event; 3210 Lisp_Object tail, definition, event;
3216 Lisp_Object tem; 3211 Lisp_Object tem;
3217 Lisp_Object suppress; 3212 Lisp_Object suppress;
3218 Lisp_Object kludge; 3213 Lisp_Object kludge;
3219 int first = 1; 3214 bool first = 1;
3220 struct gcpro gcpro1, gcpro2, gcpro3; 3215 struct gcpro gcpro1, gcpro2, gcpro3;
3221 3216
3222 /* These accumulate the values from sparse keymap bindings, 3217 /* These accumulate the values from sparse keymap bindings,
@@ -3258,7 +3253,7 @@ describe_map (Lisp_Object map, Lisp_Object prefix,
3258 1, mention_shadow); 3253 1, mention_shadow);
3259 else if (CONSP (XCAR (tail))) 3254 else if (CONSP (XCAR (tail)))
3260 { 3255 {
3261 int this_shadowed = 0; 3256 bool this_shadowed = 0;
3262 3257
3263 event = XCAR (XCAR (tail)); 3258 event = XCAR (XCAR (tail));
3264 3259
@@ -3428,7 +3423,7 @@ DESCRIBER is the output function used; nil means use `princ'. */)
3428 of bytes that lead to the character set or portion of a character 3423 of bytes that lead to the character set or portion of a character
3429 set described by this chartable. 3424 set described by this chartable.
3430 3425
3431 If PARTIAL is nonzero, it means do not mention suppressed commands 3426 If PARTIAL, it means do not mention suppressed commands
3432 (that assumes the vector is in a keymap). 3427 (that assumes the vector is in a keymap).
3433 3428
3434 SHADOW is a list of keymaps that shadow this map. 3429 SHADOW is a list of keymaps that shadow this map.
@@ -3448,8 +3443,8 @@ DESCRIBER is the output function used; nil means use `princ'. */)
3448static void 3443static void
3449describe_vector (Lisp_Object vector, Lisp_Object prefix, Lisp_Object args, 3444describe_vector (Lisp_Object vector, Lisp_Object prefix, Lisp_Object args,
3450 void (*elt_describer) (Lisp_Object, Lisp_Object), 3445 void (*elt_describer) (Lisp_Object, Lisp_Object),
3451 int partial, Lisp_Object shadow, Lisp_Object entire_map, 3446 bool partial, Lisp_Object shadow, Lisp_Object entire_map,
3452 int keymap_p, int mention_shadow) 3447 bool keymap_p, bool mention_shadow)
3453{ 3448{
3454 Lisp_Object definition; 3449 Lisp_Object definition;
3455 Lisp_Object tem2; 3450 Lisp_Object tem2;
@@ -3457,7 +3452,7 @@ describe_vector (Lisp_Object vector, Lisp_Object prefix, Lisp_Object args,
3457 int i; 3452 int i;
3458 Lisp_Object suppress; 3453 Lisp_Object suppress;
3459 Lisp_Object kludge; 3454 Lisp_Object kludge;
3460 int first = 1; 3455 bool first = 1;
3461 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; 3456 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
3462 /* Range of elements to be handled. */ 3457 /* Range of elements to be handled. */
3463 int from, to, stop; 3458 int from, to, stop;
@@ -3497,7 +3492,7 @@ describe_vector (Lisp_Object vector, Lisp_Object prefix, Lisp_Object args,
3497 3492
3498 for (i = from; ; i++) 3493 for (i = from; ; i++)
3499 { 3494 {
3500 int this_shadowed = 0; 3495 bool this_shadowed = 0;
3501 int range_beg, range_end; 3496 int range_beg, range_end;
3502 Lisp_Object val; 3497 Lisp_Object val;
3503 3498
diff --git a/src/keymap.h b/src/keymap.h
index 5ed70c67b85..c704ee0b050 100644
--- a/src/keymap.h
+++ b/src/keymap.h
@@ -34,11 +34,11 @@ extern Lisp_Object Qkeymap, Qmenu_bar;
34extern Lisp_Object Qremap; 34extern Lisp_Object Qremap;
35extern Lisp_Object Qmenu_item; 35extern Lisp_Object Qmenu_item;
36extern Lisp_Object current_global_map; 36extern Lisp_Object current_global_map;
37extern char *push_key_description (EMACS_INT, char *, int); 37extern char *push_key_description (EMACS_INT, char *);
38extern Lisp_Object access_keymap (Lisp_Object, Lisp_Object, int, int, int); 38extern Lisp_Object access_keymap (Lisp_Object, Lisp_Object, bool, bool, bool);
39extern Lisp_Object get_keymap (Lisp_Object, int, int); 39extern Lisp_Object get_keymap (Lisp_Object, bool, bool);
40extern void describe_map_tree (Lisp_Object, int, Lisp_Object, Lisp_Object, 40extern void describe_map_tree (Lisp_Object, bool, Lisp_Object, Lisp_Object,
41 const char *, int, int, int, int); 41 const char *, bool, bool, bool, bool);
42extern ptrdiff_t current_minor_maps (Lisp_Object **, Lisp_Object **); 42extern ptrdiff_t current_minor_maps (Lisp_Object **, Lisp_Object **);
43extern void initial_define_key (Lisp_Object, int, const char *); 43extern void initial_define_key (Lisp_Object, int, const char *);
44extern void initial_define_lispy_key (Lisp_Object, const char *, const char *); 44extern void initial_define_lispy_key (Lisp_Object, const char *, const char *);
@@ -47,7 +47,8 @@ extern void keys_of_keymap (void);
47 47
48typedef void (*map_keymap_function_t) 48typedef void (*map_keymap_function_t)
49 (Lisp_Object key, Lisp_Object val, Lisp_Object args, void* data); 49 (Lisp_Object key, Lisp_Object val, Lisp_Object args, void* data);
50extern void map_keymap (Lisp_Object map, map_keymap_function_t fun, Lisp_Object largs, void* cargs, int autoload); 50extern void map_keymap (Lisp_Object, map_keymap_function_t, Lisp_Object,
51 void *, bool);
51extern void map_keymap_canonical (Lisp_Object map, 52extern void map_keymap_canonical (Lisp_Object map,
52 map_keymap_function_t fun, 53 map_keymap_function_t fun,
53 Lisp_Object args, void *data); 54 Lisp_Object args, void *data);
diff --git a/src/lisp.h b/src/lisp.h
index 7812e58782b..756d08fda33 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -345,15 +345,11 @@ static ptrdiff_t const PSEUDOVECTOR_FLAG
345 = PSEUDOVECTOR_FLAG; 345 = PSEUDOVECTOR_FLAG;
346 346
347/* In a pseudovector, the size field actually contains a word with one 347/* In a pseudovector, the size field actually contains a word with one
348 PSEUDOVECTOR_FLAG bit set, and exactly one of the following bits to 348 PSEUDOVECTOR_FLAG bit set, and one of the following values extracted
349 indicate the actual type. 349 with PVEC_TYPE_MASK to indicate the actual type. */
350 We use a bitset, even tho only one of the bits can be set at any
351 particular time just so as to be able to use micro-optimizations such as
352 testing membership of a particular subset of pseudovectors in Fequal.
353 It is not crucial, but there are plenty of bits here, so why not do it? */
354enum pvec_type 350enum pvec_type
355{ 351{
356 PVEC_NORMAL_VECTOR = 0, /* Unused! */ 352 PVEC_NORMAL_VECTOR,
357 PVEC_FREE, 353 PVEC_FREE,
358 PVEC_PROCESS, 354 PVEC_PROCESS,
359 PVEC_FRAME, 355 PVEC_FRAME,
@@ -3031,7 +3027,7 @@ extern Lisp_Object oblookup (Lisp_Object, const char *, ptrdiff_t, ptrdiff_t);
3031 } while (0) 3027 } while (0)
3032extern int openp (Lisp_Object, Lisp_Object, Lisp_Object, 3028extern int openp (Lisp_Object, Lisp_Object, Lisp_Object,
3033 Lisp_Object *, Lisp_Object); 3029 Lisp_Object *, Lisp_Object);
3034Lisp_Object string_to_number (char const *, int, int); 3030extern Lisp_Object string_to_number (char const *, int, bool);
3035extern void map_obarray (Lisp_Object, void (*) (Lisp_Object, Lisp_Object), 3031extern void map_obarray (Lisp_Object, void (*) (Lisp_Object, Lisp_Object),
3036 Lisp_Object); 3032 Lisp_Object);
3037extern void dir_warning (const char *, Lisp_Object); 3033extern void dir_warning (const char *, Lisp_Object);
@@ -3202,9 +3198,9 @@ extern ptrdiff_t fast_string_match_ignore_case (Lisp_Object, Lisp_Object);
3202extern ptrdiff_t fast_looking_at (Lisp_Object, ptrdiff_t, ptrdiff_t, 3198extern ptrdiff_t fast_looking_at (Lisp_Object, ptrdiff_t, ptrdiff_t,
3203 ptrdiff_t, ptrdiff_t, Lisp_Object); 3199 ptrdiff_t, ptrdiff_t, Lisp_Object);
3204extern ptrdiff_t scan_buffer (int, ptrdiff_t, ptrdiff_t, ptrdiff_t, 3200extern ptrdiff_t scan_buffer (int, ptrdiff_t, ptrdiff_t, ptrdiff_t,
3205 ptrdiff_t *, int); 3201 ptrdiff_t *, bool);
3206extern EMACS_INT scan_newline (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t, 3202extern EMACS_INT scan_newline (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t,
3207 EMACS_INT, int); 3203 EMACS_INT, bool);
3208extern ptrdiff_t find_next_newline (ptrdiff_t, int); 3204extern ptrdiff_t find_next_newline (ptrdiff_t, int);
3209extern ptrdiff_t find_next_newline_no_quit (ptrdiff_t, ptrdiff_t); 3205extern ptrdiff_t find_next_newline_no_quit (ptrdiff_t, ptrdiff_t);
3210extern ptrdiff_t find_before_next_newline (ptrdiff_t, ptrdiff_t, ptrdiff_t); 3206extern ptrdiff_t find_before_next_newline (ptrdiff_t, ptrdiff_t, ptrdiff_t);
@@ -3247,7 +3243,7 @@ extern Lisp_Object Qdisabled, QCfilter;
3247extern Lisp_Object Qup, Qdown, Qbottom; 3243extern Lisp_Object Qup, Qdown, Qbottom;
3248extern Lisp_Object Qtop; 3244extern Lisp_Object Qtop;
3249extern Lisp_Object last_undo_boundary; 3245extern Lisp_Object last_undo_boundary;
3250extern int input_pending; 3246extern bool input_pending;
3251extern Lisp_Object menu_bar_items (Lisp_Object); 3247extern Lisp_Object menu_bar_items (Lisp_Object);
3252extern Lisp_Object tool_bar_items (Lisp_Object, int *); 3248extern Lisp_Object tool_bar_items (Lisp_Object, int *);
3253extern void discard_mouse_events (void); 3249extern void discard_mouse_events (void);
@@ -3255,9 +3251,9 @@ extern void discard_mouse_events (void);
3255void handle_input_available_signal (int); 3251void handle_input_available_signal (int);
3256#endif 3252#endif
3257extern Lisp_Object pending_funcalls; 3253extern Lisp_Object pending_funcalls;
3258extern int detect_input_pending (void); 3254extern bool detect_input_pending (void);
3259extern int detect_input_pending_ignore_squeezables (void); 3255extern bool detect_input_pending_ignore_squeezables (void);
3260extern int detect_input_pending_run_timers (int); 3256extern bool detect_input_pending_run_timers (bool);
3261extern void safe_run_hooks (Lisp_Object); 3257extern void safe_run_hooks (Lisp_Object);
3262extern void cmd_error_internal (Lisp_Object, const char *); 3258extern void cmd_error_internal (Lisp_Object, const char *);
3263extern Lisp_Object command_loop_1 (void); 3259extern Lisp_Object command_loop_1 (void);
@@ -3336,7 +3332,7 @@ extern bool running_asynch_code;
3336extern Lisp_Object QCtype, Qlocal; 3332extern Lisp_Object QCtype, Qlocal;
3337extern Lisp_Object Qprocessp; 3333extern Lisp_Object Qprocessp;
3338extern void kill_buffer_processes (Lisp_Object); 3334extern void kill_buffer_processes (Lisp_Object);
3339extern int wait_reading_process_output (intmax_t, int, int, int, 3335extern int wait_reading_process_output (intmax_t, int, int, bool,
3340 Lisp_Object, 3336 Lisp_Object,
3341 struct Lisp_Process *, 3337 struct Lisp_Process *,
3342 int); 3338 int);
@@ -3568,7 +3564,8 @@ extern char *emacs_root_dir (void);
3568 Used during startup to detect startup of dumped Emacs. */ 3564 Used during startup to detect startup of dumped Emacs. */
3569extern bool initialized; 3565extern bool initialized;
3570 3566
3571extern int immediate_quit; /* Nonzero means ^G can quit instantly. */ 3567/* True means ^G can quit instantly. */
3568extern bool immediate_quit;
3572 3569
3573extern void *xmalloc (size_t); 3570extern void *xmalloc (size_t);
3574extern void *xzalloc (size_t); 3571extern void *xzalloc (size_t);
diff --git a/src/lread.c b/src/lread.c
index a2b6d1f26d9..dbbde694cf6 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -95,10 +95,10 @@ static Lisp_Object Qload_in_progress;
95 It must be set to nil before all top-level calls to read0. */ 95 It must be set to nil before all top-level calls to read0. */
96static Lisp_Object read_objects; 96static Lisp_Object read_objects;
97 97
98/* Nonzero means READCHAR should read bytes one by one (not character) 98/* True means READCHAR should read bytes one by one (not character)
99 when READCHARFUN is Qget_file_char or Qget_emacs_mule_file_char. 99 when READCHARFUN is Qget_file_char or Qget_emacs_mule_file_char.
100 This is set to 1 by read1 temporarily while handling #@NUMBER. */ 100 This is set by read1 temporarily while handling #@NUMBER. */
101static int load_each_byte; 101static bool load_each_byte;
102 102
103/* List of descriptors now open for Fload. */ 103/* List of descriptors now open for Fload. */
104static Lisp_Object load_descriptor_list; 104static Lisp_Object load_descriptor_list;
@@ -135,11 +135,11 @@ static ptrdiff_t prev_saved_doc_string_length;
135/* This is the file position that string came from. */ 135/* This is the file position that string came from. */
136static file_offset prev_saved_doc_string_position; 136static file_offset prev_saved_doc_string_position;
137 137
138/* Nonzero means inside a new-style backquote 138/* True means inside a new-style backquote
139 with no surrounding parentheses. 139 with no surrounding parentheses.
140 Fread initializes this to zero, so we need not specbind it 140 Fread initializes this to false, so we need not specbind it
141 or worry about what happens to it when there is an error. */ 141 or worry about what happens to it when there is an error. */
142static int new_backquote_flag; 142static bool new_backquote_flag;
143static Lisp_Object Qold_style_backquotes; 143static Lisp_Object Qold_style_backquotes;
144 144
145/* A list of file names for files being loaded in Fload. Used to 145/* A list of file names for files being loaded in Fload. Used to
@@ -150,7 +150,7 @@ static Lisp_Object Vloads_in_progress;
150static int read_emacs_mule_char (int, int (*) (int, Lisp_Object), 150static int read_emacs_mule_char (int, int (*) (int, Lisp_Object),
151 Lisp_Object); 151 Lisp_Object);
152 152
153static void readevalloop (Lisp_Object, FILE*, Lisp_Object, int, 153static void readevalloop (Lisp_Object, FILE *, Lisp_Object, bool,
154 Lisp_Object, Lisp_Object, 154 Lisp_Object, Lisp_Object,
155 Lisp_Object, Lisp_Object); 155 Lisp_Object, Lisp_Object);
156static Lisp_Object load_unwind (Lisp_Object); 156static Lisp_Object load_unwind (Lisp_Object);
@@ -192,7 +192,7 @@ readchar (Lisp_Object readcharfun, bool *multibyte)
192 int (*readbyte) (int, Lisp_Object); 192 int (*readbyte) (int, Lisp_Object);
193 unsigned char buf[MAX_MULTIBYTE_LENGTH]; 193 unsigned char buf[MAX_MULTIBYTE_LENGTH];
194 int i, len; 194 int i, len;
195 int emacs_mule_encoding = 0; 195 bool emacs_mule_encoding = 0;
196 196
197 if (multibyte) 197 if (multibyte)
198 *multibyte = 0; 198 *multibyte = 0;
@@ -546,10 +546,10 @@ read_emacs_mule_char (int c, int (*readbyte) (int, Lisp_Object), Lisp_Object rea
546static Lisp_Object read_internal_start (Lisp_Object, Lisp_Object, 546static Lisp_Object read_internal_start (Lisp_Object, Lisp_Object,
547 Lisp_Object); 547 Lisp_Object);
548static Lisp_Object read0 (Lisp_Object); 548static Lisp_Object read0 (Lisp_Object);
549static Lisp_Object read1 (Lisp_Object, int *, int); 549static Lisp_Object read1 (Lisp_Object, int *, bool);
550 550
551static Lisp_Object read_list (int, Lisp_Object); 551static Lisp_Object read_list (bool, Lisp_Object);
552static Lisp_Object read_vector (Lisp_Object, int); 552static Lisp_Object read_vector (Lisp_Object, bool);
553 553
554static Lisp_Object substitute_object_recurse (Lisp_Object, Lisp_Object, 554static Lisp_Object substitute_object_recurse (Lisp_Object, Lisp_Object,
555 Lisp_Object); 555 Lisp_Object);
@@ -562,28 +562,28 @@ static void substitute_in_interval (INTERVAL, Lisp_Object);
562 562
563/* Read input events until we get one that's acceptable for our purposes. 563/* Read input events until we get one that's acceptable for our purposes.
564 564
565 If NO_SWITCH_FRAME is non-zero, switch-frame events are stashed 565 If NO_SWITCH_FRAME, switch-frame events are stashed
566 until we get a character we like, and then stuffed into 566 until we get a character we like, and then stuffed into
567 unread_switch_frame. 567 unread_switch_frame.
568 568
569 If ASCII_REQUIRED is non-zero, we check function key events to see 569 If ASCII_REQUIRED, check function key events to see
570 if the unmodified version of the symbol has a Qascii_character 570 if the unmodified version of the symbol has a Qascii_character
571 property, and use that character, if present. 571 property, and use that character, if present.
572 572
573 If ERROR_NONASCII is non-zero, we signal an error if the input we 573 If ERROR_NONASCII, signal an error if the input we
574 get isn't an ASCII character with modifiers. If it's zero but 574 get isn't an ASCII character with modifiers. If it's false but
575 ASCII_REQUIRED is non-zero, we just re-read until we get an ASCII 575 ASCII_REQUIRED is true, just re-read until we get an ASCII
576 character. 576 character.
577 577
578 If INPUT_METHOD is nonzero, we invoke the current input method 578 If INPUT_METHOD, invoke the current input method
579 if the character warrants that. 579 if the character warrants that.
580 580
581 If SECONDS is a number, we wait that many seconds for input, and 581 If SECONDS is a number, wait that many seconds for input, and
582 return Qnil if no input arrives within that time. */ 582 return Qnil if no input arrives within that time. */
583 583
584static Lisp_Object 584static Lisp_Object
585read_filtered_event (int no_switch_frame, int ascii_required, 585read_filtered_event (bool no_switch_frame, bool ascii_required,
586 int error_nonascii, int input_method, Lisp_Object seconds) 586 bool error_nonascii, bool input_method, Lisp_Object seconds)
587{ 587{
588 Lisp_Object val, delayed_switch_frame; 588 Lisp_Object val, delayed_switch_frame;
589 EMACS_TIME end_time; 589 EMACS_TIME end_time;
@@ -767,7 +767,7 @@ DEFUN ("get-file-char", Fget_file_char, Sget_file_char, 0, 0, 0,
767 positioned following the first line, if it is a comment or #! line, 767 positioned following the first line, if it is a comment or #! line,
768 otherwise nothing is read. */ 768 otherwise nothing is read. */
769 769
770static int 770static bool
771lisp_file_lexically_bound_p (Lisp_Object readcharfun) 771lisp_file_lexically_bound_p (Lisp_Object readcharfun)
772{ 772{
773 int ch = READCHAR; 773 int ch = READCHAR;
@@ -797,11 +797,11 @@ lisp_file_lexically_bound_p (Lisp_Object readcharfun)
797 else 797 else
798 /* Look for an appropriate file-variable in the first line. */ 798 /* Look for an appropriate file-variable in the first line. */
799 { 799 {
800 int rv = 0; 800 bool rv = 0;
801 enum { 801 enum {
802 NOMINAL, AFTER_FIRST_DASH, AFTER_ASTERIX, 802 NOMINAL, AFTER_FIRST_DASH, AFTER_ASTERIX,
803 } beg_end_state = NOMINAL; 803 } beg_end_state = NOMINAL;
804 int in_file_vars = 0; 804 bool in_file_vars = 0;
805 805
806#define UPDATE_BEG_END_STATE(ch) \ 806#define UPDATE_BEG_END_STATE(ch) \
807 if (beg_end_state == NOMINAL) \ 807 if (beg_end_state == NOMINAL) \
@@ -897,20 +897,17 @@ lisp_file_lexically_bound_p (Lisp_Object readcharfun)
897 because of an incompatible change in the byte compiler. */ 897 because of an incompatible change in the byte compiler. */
898 898
899static int 899static int
900safe_to_load_p (int fd) 900safe_to_load_version (int fd)
901{ 901{
902 char buf[512]; 902 char buf[512];
903 int nbytes, i; 903 int nbytes, i;
904 int safe_p = 1;
905 int version = 1; 904 int version = 1;
906 905
907 /* Read the first few bytes from the file, and look for a line 906 /* Read the first few bytes from the file, and look for a line
908 specifying the byte compiler version used. */ 907 specifying the byte compiler version used. */
909 nbytes = emacs_read (fd, buf, sizeof buf - 1); 908 nbytes = emacs_read (fd, buf, sizeof buf);
910 if (nbytes > 0) 909 if (nbytes > 0)
911 { 910 {
912 buf[nbytes] = '\0';
913
914 /* Skip to the next newline, skipping over the initial `ELC' 911 /* Skip to the next newline, skipping over the initial `ELC'
915 with NUL bytes following it, but note the version. */ 912 with NUL bytes following it, but note the version. */
916 for (i = 0; i < nbytes && buf[i] != '\n'; ++i) 913 for (i = 0; i < nbytes && buf[i] != '\n'; ++i)
@@ -920,13 +917,11 @@ safe_to_load_p (int fd)
920 if (i >= nbytes 917 if (i >= nbytes
921 || fast_c_string_match_ignore_case (Vbytecomp_version_regexp, 918 || fast_c_string_match_ignore_case (Vbytecomp_version_regexp,
922 buf + i, nbytes - i) < 0) 919 buf + i, nbytes - i) < 0)
923 safe_p = 0; 920 version = 0;
924 } 921 }
925 if (safe_p)
926 safe_p = version;
927 922
928 lseek (fd, 0, SEEK_SET); 923 lseek (fd, 0, SEEK_SET);
929 return safe_p; 924 return version;
930} 925}
931 926
932 927
@@ -1030,12 +1025,12 @@ Return t if the file exists and loads successfully. */)
1030 ptrdiff_t count = SPECPDL_INDEX (); 1025 ptrdiff_t count = SPECPDL_INDEX ();
1031 struct gcpro gcpro1, gcpro2, gcpro3; 1026 struct gcpro gcpro1, gcpro2, gcpro3;
1032 Lisp_Object found, efound, hist_file_name; 1027 Lisp_Object found, efound, hist_file_name;
1033 /* 1 means we printed the ".el is newer" message. */ 1028 /* True means we printed the ".el is newer" message. */
1034 int newer = 0; 1029 bool newer = 0;
1035 /* 1 means we are loading a compiled file. */ 1030 /* True means we are loading a compiled file. */
1036 int compiled = 0; 1031 bool compiled = 0;
1037 Lisp_Object handler; 1032 Lisp_Object handler;
1038 int safe_p = 1; 1033 bool safe_p = 1;
1039 const char *fmode = "r"; 1034 const char *fmode = "r";
1040 Lisp_Object tmp[2]; 1035 Lisp_Object tmp[2];
1041 int version; 1036 int version;
@@ -1190,7 +1185,7 @@ Return t if the file exists and loads successfully. */)
1190 record_unwind_protect (load_warn_old_style_backquotes, file); 1185 record_unwind_protect (load_warn_old_style_backquotes, file);
1191 1186
1192 if (!memcmp (SDATA (found) + SBYTES (found) - 4, ".elc", 4) 1187 if (!memcmp (SDATA (found) + SBYTES (found) - 4, ".elc", 4)
1193 || (fd >= 0 && (version = safe_to_load_p (fd)) > 0)) 1188 || (fd >= 0 && (version = safe_to_load_version (fd)) > 0))
1194 /* Load .elc files directly, but not when they are 1189 /* Load .elc files directly, but not when they are
1195 remote and have no handler! */ 1190 remote and have no handler! */
1196 { 1191 {
@@ -1202,7 +1197,7 @@ Return t if the file exists and loads successfully. */)
1202 GCPRO3 (file, found, hist_file_name); 1197 GCPRO3 (file, found, hist_file_name);
1203 1198
1204 if (version < 0 1199 if (version < 0
1205 && ! (version = safe_to_load_p (fd))) 1200 && ! (version = safe_to_load_version (fd)))
1206 { 1201 {
1207 safe_p = 0; 1202 safe_p = 0;
1208 if (!load_dangerous_libraries) 1203 if (!load_dangerous_libraries)
@@ -1394,10 +1389,10 @@ close_load_descs (void)
1394#endif 1389#endif
1395} 1390}
1396 1391
1397static int 1392static bool
1398complete_filename_p (Lisp_Object pathname) 1393complete_filename_p (Lisp_Object pathname)
1399{ 1394{
1400 register const unsigned char *s = SDATA (pathname); 1395 const unsigned char *s = SDATA (pathname);
1401 return (IS_DIRECTORY_SEP (s[0]) 1396 return (IS_DIRECTORY_SEP (s[0])
1402 || (SCHARS (pathname) > 2 1397 || (SCHARS (pathname) > 2
1403 && IS_DEVICE_SEP (s[1]) && IS_DIRECTORY_SEP (s[2]))); 1398 && IS_DEVICE_SEP (s[1]) && IS_DIRECTORY_SEP (s[2])));
@@ -1447,11 +1442,11 @@ static Lisp_Object Qdir_ok;
1447int 1442int
1448openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, Lisp_Object *storeptr, Lisp_Object predicate) 1443openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, Lisp_Object *storeptr, Lisp_Object predicate)
1449{ 1444{
1450 register int fd; 1445 int fd;
1451 ptrdiff_t fn_size = 100; 1446 ptrdiff_t fn_size = 100;
1452 char buf[100]; 1447 char buf[100];
1453 register char *fn = buf; 1448 char *fn = buf;
1454 int absolute = 0; 1449 bool absolute = 0;
1455 ptrdiff_t want_length; 1450 ptrdiff_t want_length;
1456 Lisp_Object filename; 1451 Lisp_Object filename;
1457 struct stat st; 1452 struct stat st;
@@ -1503,7 +1498,7 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, Lisp_Object *sto
1503 { 1498 {
1504 ptrdiff_t fnlen, lsuffix = SBYTES (XCAR (tail)); 1499 ptrdiff_t fnlen, lsuffix = SBYTES (XCAR (tail));
1505 Lisp_Object handler; 1500 Lisp_Object handler;
1506 int exists; 1501 bool exists;
1507 1502
1508 /* Concatenate path element/specified name with the suffix. 1503 /* Concatenate path element/specified name with the suffix.
1509 If the directory starts with /:, remove that. */ 1504 If the directory starts with /:, remove that. */
@@ -1588,14 +1583,16 @@ openp (Lisp_Object path, Lisp_Object str, Lisp_Object suffixes, Lisp_Object *sto
1588 the source has an associated file name or not. 1583 the source has an associated file name or not.
1589 1584
1590 FILENAME is the file name that we are loading from. 1585 FILENAME is the file name that we are loading from.
1591 ENTIRE is 1 if loading that entire file, 0 if evaluating part of it. */ 1586
1587 ENTIRE is true if loading that entire file, false if evaluating
1588 part of it. */
1592 1589
1593static void 1590static void
1594build_load_history (Lisp_Object filename, int entire) 1591build_load_history (Lisp_Object filename, bool entire)
1595{ 1592{
1596 register Lisp_Object tail, prev, newelt; 1593 Lisp_Object tail, prev, newelt;
1597 register Lisp_Object tem, tem2; 1594 Lisp_Object tem, tem2;
1598 register int foundit = 0; 1595 bool foundit = 0;
1599 1596
1600 tail = Vload_history; 1597 tail = Vload_history;
1601 prev = Qnil; 1598 prev = Qnil;
@@ -1680,7 +1677,7 @@ static void
1680readevalloop (Lisp_Object readcharfun, 1677readevalloop (Lisp_Object readcharfun,
1681 FILE *stream, 1678 FILE *stream,
1682 Lisp_Object sourcename, 1679 Lisp_Object sourcename,
1683 int printflag, 1680 bool printflag,
1684 Lisp_Object unibyte, Lisp_Object readfun, 1681 Lisp_Object unibyte, Lisp_Object readfun,
1685 Lisp_Object start, Lisp_Object end) 1682 Lisp_Object start, Lisp_Object end)
1686{ 1683{
@@ -1689,12 +1686,12 @@ readevalloop (Lisp_Object readcharfun,
1689 ptrdiff_t count = SPECPDL_INDEX (); 1686 ptrdiff_t count = SPECPDL_INDEX ();
1690 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; 1687 struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
1691 struct buffer *b = 0; 1688 struct buffer *b = 0;
1692 int continue_reading_p; 1689 bool continue_reading_p;
1693 Lisp_Object lex_bound; 1690 Lisp_Object lex_bound;
1694 /* Nonzero if reading an entire buffer. */ 1691 /* True if reading an entire buffer. */
1695 int whole_buffer = 0; 1692 bool whole_buffer = 0;
1696 /* 1 on the first time around. */ 1693 /* True on the first time around. */
1697 int first_sexp = 1; 1694 bool first_sexp = 1;
1698 Lisp_Object macroexpand = intern ("internal-macroexpand-for-load"); 1695 Lisp_Object macroexpand = intern ("internal-macroexpand-for-load");
1699 1696
1700 if (NILP (Ffboundp (macroexpand)) 1697 if (NILP (Ffboundp (macroexpand))
@@ -2072,9 +2069,9 @@ static char *read_buffer;
2072 If the escape sequence forces unibyte, return eight-bit char. */ 2069 If the escape sequence forces unibyte, return eight-bit char. */
2073 2070
2074static int 2071static int
2075read_escape (Lisp_Object readcharfun, int stringp) 2072read_escape (Lisp_Object readcharfun, bool stringp)
2076{ 2073{
2077 register int c = READCHAR; 2074 int c = READCHAR;
2078 /* \u allows up to four hex digits, \U up to eight. Default to the 2075 /* \u allows up to four hex digits, \U up to eight. Default to the
2079 behavior for \u, and change this value in the case that \U is seen. */ 2076 behavior for \u, and change this value in the case that \U is seen. */
2080 int unicode_hex_count = 4; 2077 int unicode_hex_count = 4;
@@ -2375,10 +2372,10 @@ read_integer (Lisp_Object readcharfun, EMACS_INT radix)
2375 in *PCH and the return value is not interesting. Else, we store 2372 in *PCH and the return value is not interesting. Else, we store
2376 zero in *PCH and we read and return one lisp object. 2373 zero in *PCH and we read and return one lisp object.
2377 2374
2378 FIRST_IN_LIST is nonzero if this is the first element of a list. */ 2375 FIRST_IN_LIST is true if this is the first element of a list. */
2379 2376
2380static Lisp_Object 2377static Lisp_Object
2381read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) 2378read1 (Lisp_Object readcharfun, int *pch, bool first_in_list)
2382{ 2379{
2383 int c; 2380 int c;
2384 bool uninterned_symbol = 0; 2381 bool uninterned_symbol = 0;
@@ -2803,10 +2800,11 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2803 else 2800 else
2804 { 2801 {
2805 Lisp_Object value; 2802 Lisp_Object value;
2803 bool saved_new_backquote_flag = new_backquote_flag;
2806 2804
2807 new_backquote_flag++; 2805 new_backquote_flag = 1;
2808 value = read0 (readcharfun); 2806 value = read0 (readcharfun);
2809 new_backquote_flag--; 2807 new_backquote_flag = saved_new_backquote_flag;
2810 2808
2811 return Fcons (Qbackquote, Fcons (value, Qnil)); 2809 return Fcons (Qbackquote, Fcons (value, Qnil));
2812 } 2810 }
@@ -2858,7 +2856,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2858 { 2856 {
2859 int modifiers; 2857 int modifiers;
2860 int next_char; 2858 int next_char;
2861 int ok; 2859 bool ok;
2862 2860
2863 c = READCHAR; 2861 c = READCHAR;
2864 if (c < 0) 2862 if (c < 0)
@@ -2894,14 +2892,14 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
2894 { 2892 {
2895 char *p = read_buffer; 2893 char *p = read_buffer;
2896 char *end = read_buffer + read_buffer_size; 2894 char *end = read_buffer + read_buffer_size;
2897 register int ch; 2895 int ch;
2898 /* Nonzero if we saw an escape sequence specifying 2896 /* True if we saw an escape sequence specifying
2899 a multibyte character. */ 2897 a multibyte character. */
2900 int force_multibyte = 0; 2898 bool force_multibyte = 0;
2901 /* Nonzero if we saw an escape sequence specifying 2899 /* True if we saw an escape sequence specifying
2902 a single-byte character. */ 2900 a single-byte character. */
2903 int force_singlebyte = 0; 2901 bool force_singlebyte = 0;
2904 int cancel = 0; 2902 bool cancel = 0;
2905 ptrdiff_t nchars = 0; 2903 ptrdiff_t nchars = 0;
2906 2904
2907 while ((ch = READCHAR) >= 0 2905 while ((ch = READCHAR) >= 0
@@ -3033,7 +3031,7 @@ read1 (register Lisp_Object readcharfun, int *pch, int first_in_list)
3033 read_symbol: 3031 read_symbol:
3034 { 3032 {
3035 char *p = read_buffer; 3033 char *p = read_buffer;
3036 int quoted = 0; 3034 bool quoted = 0;
3037 EMACS_INT start_position = readchar_count - 1; 3035 EMACS_INT start_position = readchar_count - 1;
3038 3036
3039 { 3037 {
@@ -3250,17 +3248,17 @@ substitute_in_interval (INTERVAL interval, Lisp_Object arg)
3250/* Convert STRING to a number, assuming base BASE. Return a fixnum if CP has 3248/* Convert STRING to a number, assuming base BASE. Return a fixnum if CP has
3251 integer syntax and fits in a fixnum, else return the nearest float if CP has 3249 integer syntax and fits in a fixnum, else return the nearest float if CP has
3252 either floating point or integer syntax and BASE is 10, else return nil. If 3250 either floating point or integer syntax and BASE is 10, else return nil. If
3253 IGNORE_TRAILING is nonzero, consider just the longest prefix of CP that has 3251 IGNORE_TRAILING, consider just the longest prefix of CP that has
3254 valid floating point syntax. Signal an overflow if BASE is not 10 and the 3252 valid floating point syntax. Signal an overflow if BASE is not 10 and the
3255 number has integer syntax but does not fit. */ 3253 number has integer syntax but does not fit. */
3256 3254
3257Lisp_Object 3255Lisp_Object
3258string_to_number (char const *string, int base, int ignore_trailing) 3256string_to_number (char const *string, int base, bool ignore_trailing)
3259{ 3257{
3260 int state; 3258 int state;
3261 char const *cp = string; 3259 char const *cp = string;
3262 int leading_digit; 3260 int leading_digit;
3263 int float_syntax = 0; 3261 bool float_syntax = 0;
3264 double value = 0; 3262 double value = 0;
3265 3263
3266 /* Compute NaN and infinities using a variable, to cope with compilers that 3264 /* Compute NaN and infinities using a variable, to cope with compilers that
@@ -3270,9 +3268,9 @@ string_to_number (char const *string, int base, int ignore_trailing)
3270 /* Negate the value ourselves. This treats 0, NaNs, and infinity properly on 3268 /* Negate the value ourselves. This treats 0, NaNs, and infinity properly on
3271 IEEE floating point hosts, and works around a formerly-common bug where 3269 IEEE floating point hosts, and works around a formerly-common bug where
3272 atof ("-0.0") drops the sign. */ 3270 atof ("-0.0") drops the sign. */
3273 int negative = *cp == '-'; 3271 bool negative = *cp == '-';
3274 3272
3275 int signedp = negative || *cp == '+'; 3273 bool signedp = negative || *cp == '+';
3276 cp += signedp; 3274 cp += signedp;
3277 3275
3278 state = 0; 3276 state = 0;
@@ -3365,7 +3363,7 @@ string_to_number (char const *string, int base, int ignore_trailing)
3365 uintmax_t n; 3363 uintmax_t n;
3366 3364
3367 /* Fast special case for single-digit integers. This also avoids a 3365 /* Fast special case for single-digit integers. This also avoids a
3368 glitch when BASE is 16 and IGNORE_TRAILING is nonzero, because in that 3366 glitch when BASE is 16 and IGNORE_TRAILING, because in that
3369 case some versions of strtoumax accept numbers like "0x1" that Emacs 3367 case some versions of strtoumax accept numbers like "0x1" that Emacs
3370 does not allow. */ 3368 does not allow. */
3371 if (digit_to_number (string[signedp + 1], base) < 0) 3369 if (digit_to_number (string[signedp + 1], base) < 0)
@@ -3401,12 +3399,12 @@ string_to_number (char const *string, int base, int ignore_trailing)
3401 3399
3402 3400
3403static Lisp_Object 3401static Lisp_Object
3404read_vector (Lisp_Object readcharfun, int bytecodeflag) 3402read_vector (Lisp_Object readcharfun, bool bytecodeflag)
3405{ 3403{
3406 ptrdiff_t i, size; 3404 ptrdiff_t i, size;
3407 register Lisp_Object *ptr; 3405 Lisp_Object *ptr;
3408 register Lisp_Object tem, item, vector; 3406 Lisp_Object tem, item, vector;
3409 register struct Lisp_Cons *otem; 3407 struct Lisp_Cons *otem;
3410 Lisp_Object len; 3408 Lisp_Object len;
3411 3409
3412 tem = read_list (1, readcharfun); 3410 tem = read_list (1, readcharfun);
@@ -3478,13 +3476,13 @@ read_vector (Lisp_Object readcharfun, int bytecodeflag)
3478 return vector; 3476 return vector;
3479} 3477}
3480 3478
3481/* FLAG = 1 means check for ] to terminate rather than ) and . */ 3479/* FLAG means check for ] to terminate rather than ) and . */
3482 3480
3483static Lisp_Object 3481static Lisp_Object
3484read_list (int flag, register Lisp_Object readcharfun) 3482read_list (bool flag, Lisp_Object readcharfun)
3485{ 3483{
3486 Lisp_Object val, tail; 3484 Lisp_Object val, tail;
3487 register Lisp_Object elt, tem; 3485 Lisp_Object elt, tem;
3488 struct gcpro gcpro1, gcpro2; 3486 struct gcpro gcpro1, gcpro2;
3489 /* 0 is the normal case. 3487 /* 0 is the normal case.
3490 1 means this list is a doc reference; replace it with the number 0. 3488 1 means this list is a doc reference; replace it with the number 0.
@@ -3492,7 +3490,7 @@ read_list (int flag, register Lisp_Object readcharfun)
3492 int doc_reference = 0; 3490 int doc_reference = 0;
3493 3491
3494 /* Initialize this to 1 if we are reading a list. */ 3492 /* Initialize this to 1 if we are reading a list. */
3495 int first_in_list = flag <= 0; 3493 bool first_in_list = flag <= 0;
3496 3494
3497 val = Qnil; 3495 val = Qnil;
3498 tail = Qnil; 3496 tail = Qnil;
diff --git a/src/macros.c b/src/macros.c
index a507f12e343..632c851ee8c 100644
--- a/src/macros.c
+++ b/src/macros.c
@@ -84,7 +84,7 @@ macro before appending to it. */)
84 { 84 {
85 ptrdiff_t i; 85 ptrdiff_t i;
86 EMACS_INT len; 86 EMACS_INT len;
87 int cvt; 87 bool cvt;
88 88
89 /* Check the type of last-kbd-macro in case Lisp code changed it. */ 89 /* Check the type of last-kbd-macro in case Lisp code changed it. */
90 CHECK_VECTOR_OR_STRING (KVAR (current_kboard, Vlast_kbd_macro)); 90 CHECK_VECTOR_OR_STRING (KVAR (current_kboard, Vlast_kbd_macro));
diff --git a/src/makefile.w32-in b/src/makefile.w32-in
index f96f765a7fa..e4a77cc87a3 100644
--- a/src/makefile.w32-in
+++ b/src/makefile.w32-in
@@ -736,7 +736,6 @@ $(BLD)/dispnew.$(O) : \
736 $(SRC)/disptab.h \ 736 $(SRC)/disptab.h \
737 $(SRC)/indent.h \ 737 $(SRC)/indent.h \
738 $(SRC)/termchar.h \ 738 $(SRC)/termchar.h \
739 $(SRC)/termopts.h \
740 $(NT_INC)/unistd.h \ 739 $(NT_INC)/unistd.h \
741 $(BUFFER_H) \ 740 $(BUFFER_H) \
742 $(CHARACTER_H) \ 741 $(CHARACTER_H) \
@@ -1016,7 +1015,6 @@ $(BLD)/indent.$(O) : \
1016 $(SRC)/indent.h \ 1015 $(SRC)/indent.h \
1017 $(SRC)/region-cache.h \ 1016 $(SRC)/region-cache.h \
1018 $(SRC)/termchar.h \ 1017 $(SRC)/termchar.h \
1019 $(SRC)/termopts.h \
1020 $(BUFFER_H) \ 1018 $(BUFFER_H) \
1021 $(CHARACTER_H) \ 1019 $(CHARACTER_H) \
1022 $(CONFIG_H) \ 1020 $(CONFIG_H) \
@@ -1413,7 +1411,6 @@ $(BLD)/term.$(O) : \
1413 $(SRC)/disptab.h \ 1411 $(SRC)/disptab.h \
1414 $(SRC)/keymap.h \ 1412 $(SRC)/keymap.h \
1415 $(SRC)/termchar.h \ 1413 $(SRC)/termchar.h \
1416 $(SRC)/termopts.h \
1417 $(SRC)/tparam.h \ 1414 $(SRC)/tparam.h \
1418 $(NT_INC)/sys/file.h \ 1415 $(NT_INC)/sys/file.h \
1419 $(NT_INC)/sys/time.h \ 1416 $(NT_INC)/sys/time.h \
diff --git a/src/marker.c b/src/marker.c
index e01647bdb2a..69be4faec3a 100644
--- a/src/marker.c
+++ b/src/marker.c
@@ -29,7 +29,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
29static ptrdiff_t cached_charpos; 29static ptrdiff_t cached_charpos;
30static ptrdiff_t cached_bytepos; 30static ptrdiff_t cached_bytepos;
31static struct buffer *cached_buffer; 31static struct buffer *cached_buffer;
32static int cached_modiff; 32static EMACS_INT cached_modiff;
33 33
34/* Juanma Barranquero <lekktu@gmail.com> reported ~3x increased 34/* Juanma Barranquero <lekktu@gmail.com> reported ~3x increased
35 bootstrap time when byte_char_debug_check is enabled; so this 35 bootstrap time when byte_char_debug_check is enabled; so this
@@ -91,7 +91,7 @@ clear_charpos_cache (struct buffer *b)
91#define CONSIDER(CHARPOS, BYTEPOS) \ 91#define CONSIDER(CHARPOS, BYTEPOS) \
92{ \ 92{ \
93 ptrdiff_t this_charpos = (CHARPOS); \ 93 ptrdiff_t this_charpos = (CHARPOS); \
94 int changed = 0; \ 94 bool changed = 0; \
95 \ 95 \
96 if (this_charpos == charpos) \ 96 if (this_charpos == charpos) \
97 { \ 97 { \
@@ -190,7 +190,7 @@ buf_charpos_to_bytepos (struct buffer *b, ptrdiff_t charpos)
190 190
191 if (charpos - best_below < best_above - charpos) 191 if (charpos - best_below < best_above - charpos)
192 { 192 {
193 int record = charpos - best_below > 5000; 193 bool record = charpos - best_below > 5000;
194 194
195 while (best_below != charpos) 195 while (best_below != charpos)
196 { 196 {
@@ -215,7 +215,7 @@ buf_charpos_to_bytepos (struct buffer *b, ptrdiff_t charpos)
215 } 215 }
216 else 216 else
217 { 217 {
218 int record = best_above - charpos > 5000; 218 bool record = best_above - charpos > 5000;
219 219
220 while (best_above != charpos) 220 while (best_above != charpos)
221 { 221 {
@@ -335,7 +335,7 @@ buf_bytepos_to_charpos (struct buffer *b, ptrdiff_t bytepos)
335 335
336 if (bytepos - best_below_byte < best_above_byte - bytepos) 336 if (bytepos - best_below_byte < best_above_byte - bytepos)
337 { 337 {
338 int record = bytepos - best_below_byte > 5000; 338 bool record = bytepos - best_below_byte > 5000;
339 339
340 while (best_below_byte < bytepos) 340 while (best_below_byte < bytepos)
341 { 341 {
@@ -362,7 +362,7 @@ buf_bytepos_to_charpos (struct buffer *b, ptrdiff_t bytepos)
362 } 362 }
363 else 363 else
364 { 364 {
365 int record = best_above_byte - bytepos > 5000; 365 bool record = best_above_byte - bytepos > 5000;
366 366
367 while (best_above_byte > bytepos) 367 while (best_above_byte > bytepos)
368 { 368 {
@@ -479,10 +479,10 @@ live_buffer (Lisp_Object buffer)
479 479
480static Lisp_Object 480static Lisp_Object
481set_marker_internal (Lisp_Object marker, Lisp_Object position, 481set_marker_internal (Lisp_Object marker, Lisp_Object position,
482 Lisp_Object buffer, int restricted) 482 Lisp_Object buffer, bool restricted)
483{ 483{
484 register struct Lisp_Marker *m; 484 struct Lisp_Marker *m;
485 register struct buffer *b = live_buffer (buffer); 485 struct buffer *b = live_buffer (buffer);
486 486
487 CHECK_MARKER (marker); 487 CHECK_MARKER (marker);
488 m = XMARKER (marker); 488 m = XMARKER (marker);
diff --git a/src/menu.c b/src/menu.c
index 835267b2f0c..7cc110ce7e2 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -331,7 +331,7 @@ single_menu_item (Lisp_Object key, Lisp_Object item, Lisp_Object dummy, void *sk
331{ 331{
332 Lisp_Object map, item_string, enabled; 332 Lisp_Object map, item_string, enabled;
333 struct gcpro gcpro1, gcpro2; 333 struct gcpro gcpro1, gcpro2;
334 int res; 334 bool res;
335 struct skp *skp = skp_v; 335 struct skp *skp = skp_v;
336 336
337 /* Parse the menu item and leave the result in item_properties. */ 337 /* Parse the menu item and leave the result in item_properties. */
@@ -519,14 +519,15 @@ list_of_panes (Lisp_Object menu)
519/* Set up data in menu_items for a menu bar item 519/* Set up data in menu_items for a menu bar item
520 whose event type is ITEM_KEY (with string ITEM_NAME) 520 whose event type is ITEM_KEY (with string ITEM_NAME)
521 and whose contents come from the list of keymaps MAPS. */ 521 and whose contents come from the list of keymaps MAPS. */
522int 522bool
523parse_single_submenu (Lisp_Object item_key, Lisp_Object item_name, Lisp_Object maps) 523parse_single_submenu (Lisp_Object item_key, Lisp_Object item_name,
524 Lisp_Object maps)
524{ 525{
525 Lisp_Object length; 526 Lisp_Object length;
526 EMACS_INT len; 527 EMACS_INT len;
527 Lisp_Object *mapvec; 528 Lisp_Object *mapvec;
528 ptrdiff_t i; 529 ptrdiff_t i;
529 int top_level_items = 0; 530 bool top_level_items = 0;
530 USE_SAFE_ALLOCA; 531 USE_SAFE_ALLOCA;
531 532
532 length = Flength (maps); 533 length = Flength (maps);
@@ -616,13 +617,13 @@ free_menubar_widget_value_tree (widget_value *wv)
616 in menu_items starting at index START, up to index END. */ 617 in menu_items starting at index START, up to index END. */
617 618
618widget_value * 619widget_value *
619digest_single_submenu (int start, int end, int top_level_items) 620digest_single_submenu (int start, int end, bool top_level_items)
620{ 621{
621 widget_value *wv, *prev_wv, *save_wv, *first_wv; 622 widget_value *wv, *prev_wv, *save_wv, *first_wv;
622 int i; 623 int i;
623 int submenu_depth = 0; 624 int submenu_depth = 0;
624 widget_value **submenu_stack; 625 widget_value **submenu_stack;
625 int panes_seen = 0; 626 bool panes_seen = 0;
626 627
627 submenu_stack = alloca (menu_items_used * sizeof *submenu_stack); 628 submenu_stack = alloca (menu_items_used * sizeof *submenu_stack);
628 wv = xmalloc_widget_value (); 629 wv = xmalloc_widget_value ();
@@ -668,7 +669,7 @@ digest_single_submenu (int start, int end, int top_level_items)
668 Lisp_Object pane_name; 669 Lisp_Object pane_name;
669 const char *pane_string; 670 const char *pane_string;
670 671
671 panes_seen++; 672 panes_seen = 1;
672 673
673 pane_name = AREF (menu_items, i + MENU_ITEMS_PANE_NAME); 674 pane_name = AREF (menu_items, i + MENU_ITEMS_PANE_NAME);
674 675
@@ -735,7 +736,7 @@ digest_single_submenu (int start, int end, int top_level_items)
735 Lisp_Object help; 736 Lisp_Object help;
736 737
737 /* All items should be contained in panes. */ 738 /* All items should be contained in panes. */
738 if (panes_seen == 0) 739 if (! panes_seen)
739 emacs_abort (); 740 emacs_abort ();
740 741
741 item_name = AREF (menu_items, i + MENU_ITEMS_ITEM_NAME); 742 item_name = AREF (menu_items, i + MENU_ITEMS_ITEM_NAME);
@@ -957,9 +958,9 @@ find_and_call_menu_selection (FRAME_PTR f, int menu_bar_items_used, Lisp_Object
957 958
958#ifdef HAVE_NS 959#ifdef HAVE_NS
959/* As above, but return the menu selection instead of storing in kb buffer. 960/* As above, but return the menu selection instead of storing in kb buffer.
960 If keymaps==1, return full prefixes to selection. */ 961 If KEYMAPS, return full prefixes to selection. */
961Lisp_Object 962Lisp_Object
962find_and_return_menu_selection (FRAME_PTR f, int keymaps, void *client_data) 963find_and_return_menu_selection (FRAME_PTR f, bool keymaps, void *client_data)
963{ 964{
964 Lisp_Object prefix, entry; 965 Lisp_Object prefix, entry;
965 int i; 966 int i;
@@ -999,7 +1000,7 @@ find_and_return_menu_selection (FRAME_PTR f, int keymaps, void *client_data)
999 = AREF (menu_items, i + MENU_ITEMS_ITEM_VALUE); 1000 = AREF (menu_items, i + MENU_ITEMS_ITEM_VALUE);
1000 if (aref_addr (menu_items, i) == client_data) 1001 if (aref_addr (menu_items, i) == client_data)
1001 { 1002 {
1002 if (keymaps != 0) 1003 if (keymaps)
1003 { 1004 {
1004 int j; 1005 int j;
1005 1006
@@ -1071,8 +1072,8 @@ no quit occurs and `x-popup-menu' returns nil. */)
1071 Lisp_Object selection = Qnil; 1072 Lisp_Object selection = Qnil;
1072 FRAME_PTR f = NULL; 1073 FRAME_PTR f = NULL;
1073 Lisp_Object x, y, window; 1074 Lisp_Object x, y, window;
1074 int keymaps = 0; 1075 bool keymaps = 0;
1075 int for_click = 0; 1076 bool for_click = 0;
1076 ptrdiff_t specpdl_count = SPECPDL_INDEX (); 1077 ptrdiff_t specpdl_count = SPECPDL_INDEX ();
1077 struct gcpro gcpro1; 1078 struct gcpro gcpro1;
1078 1079
@@ -1083,7 +1084,7 @@ no quit occurs and `x-popup-menu' returns nil. */)
1083 1084
1084#ifdef HAVE_MENUS 1085#ifdef HAVE_MENUS
1085 { 1086 {
1086 int get_current_pos_p = 0; 1087 bool get_current_pos_p = 0;
1087 /* FIXME!! check_w32 (); or check_x (); or check_ns (); */ 1088 /* FIXME!! check_w32 (); or check_x (); or check_ns (); */
1088 1089
1089 /* Decode the first argument: find the window and the coordinates. */ 1090 /* Decode the first argument: find the window and the coordinates. */
diff --git a/src/menu.h b/src/menu.h
index 3406928a8d5..67934c42d76 100644
--- a/src/menu.h
+++ b/src/menu.h
@@ -29,7 +29,7 @@ extern void init_menu_items (void);
29extern void finish_menu_items (void) ATTRIBUTE_CONST; 29extern void finish_menu_items (void) ATTRIBUTE_CONST;
30extern void discard_menu_items (void); 30extern void discard_menu_items (void);
31extern void save_menu_items (void); 31extern void save_menu_items (void);
32extern int parse_single_submenu (Lisp_Object, Lisp_Object, Lisp_Object); 32extern bool parse_single_submenu (Lisp_Object, Lisp_Object, Lisp_Object);
33extern void list_of_panes (Lisp_Object); 33extern void list_of_panes (Lisp_Object);
34#if defined (USE_X_TOOLKIT) || defined (USE_GTK) || defined (HAVE_NTGUI) \ 34#if defined (USE_X_TOOLKIT) || defined (USE_GTK) || defined (HAVE_NTGUI) \
35 || defined (HAVE_NS) 35 || defined (HAVE_NS)
@@ -38,7 +38,7 @@ extern void update_submenu_strings (widget_value *);
38extern void find_and_call_menu_selection (FRAME_PTR, int, 38extern void find_and_call_menu_selection (FRAME_PTR, int,
39 Lisp_Object, void *); 39 Lisp_Object, void *);
40extern widget_value *xmalloc_widget_value (void); 40extern widget_value *xmalloc_widget_value (void);
41extern widget_value *digest_single_submenu (int, int, int); 41extern widget_value *digest_single_submenu (int, int, bool);
42#endif 42#endif
43 43
44#ifdef HAVE_X_WINDOWS 44#ifdef HAVE_X_WINDOWS
@@ -47,8 +47,8 @@ extern void mouse_position_for_popup (FRAME_PTR f, int *x, int *y);
47 47
48extern Lisp_Object w32_menu_show (FRAME_PTR, int, int, int, int, 48extern Lisp_Object w32_menu_show (FRAME_PTR, int, int, int, int,
49 Lisp_Object, const char **); 49 Lisp_Object, const char **);
50extern Lisp_Object ns_menu_show (FRAME_PTR, int, int, int, int, 50extern Lisp_Object ns_menu_show (FRAME_PTR, int, int, bool, bool,
51 Lisp_Object, const char **); 51 Lisp_Object, const char **);
52extern Lisp_Object xmenu_show (FRAME_PTR, int, int, int, int, 52extern Lisp_Object xmenu_show (FRAME_PTR, int, int, bool, bool,
53 Lisp_Object, const char **, Time); 53 Lisp_Object, const char **, Time);
54#endif /* MENU_H */ 54#endif /* MENU_H */
diff --git a/src/minibuf.c b/src/minibuf.c
index dd4ca34c3fb..2cc89e75680 100644
--- a/src/minibuf.c
+++ b/src/minibuf.c
@@ -173,17 +173,6 @@ without invoking the usual minibuffer commands. */)
173 173
174static Lisp_Object read_minibuf_unwind (Lisp_Object); 174static Lisp_Object read_minibuf_unwind (Lisp_Object);
175static Lisp_Object run_exit_minibuf_hook (Lisp_Object); 175static Lisp_Object run_exit_minibuf_hook (Lisp_Object);
176static Lisp_Object read_minibuf (Lisp_Object, Lisp_Object,
177 Lisp_Object,
178 int, Lisp_Object,
179 Lisp_Object, Lisp_Object,
180 int, int);
181static Lisp_Object read_minibuf_noninteractive (Lisp_Object, Lisp_Object,
182 Lisp_Object, Lisp_Object,
183 int, Lisp_Object,
184 Lisp_Object, Lisp_Object,
185 int, int);
186static Lisp_Object string_to_object (Lisp_Object, Lisp_Object);
187 176
188 177
189/* Read a Lisp object from VAL and return it. If VAL is an empty 178/* Read a Lisp object from VAL and return it. If VAL is an empty
@@ -233,10 +222,10 @@ string_to_object (Lisp_Object val, Lisp_Object defalt)
233static Lisp_Object 222static Lisp_Object
234read_minibuf_noninteractive (Lisp_Object map, Lisp_Object initial, 223read_minibuf_noninteractive (Lisp_Object map, Lisp_Object initial,
235 Lisp_Object prompt, Lisp_Object backup_n, 224 Lisp_Object prompt, Lisp_Object backup_n,
236 int expflag, 225 bool expflag,
237 Lisp_Object histvar, Lisp_Object histpos, 226 Lisp_Object histvar, Lisp_Object histpos,
238 Lisp_Object defalt, 227 Lisp_Object defalt,
239 int allow_props, int inherit_input_method) 228 bool allow_props, bool inherit_input_method)
240{ 229{
241 ptrdiff_t size, len; 230 ptrdiff_t size, len;
242 char *line; 231 char *line;
@@ -376,23 +365,23 @@ If the current buffer is not a minibuffer, return its entire contents. */)
376 beginning of INITIAL if N <= 0. 365 beginning of INITIAL if N <= 0.
377 366
378 Normally return the result as a string (the text that was read), 367 Normally return the result as a string (the text that was read),
379 but if EXPFLAG is nonzero, read it and return the object read. 368 but if EXPFLAG, read it and return the object read.
380 If HISTVAR is given, save the value read on that history only if it doesn't 369 If HISTVAR is given, save the value read on that history only if it doesn't
381 match the front of that history list exactly. The value is pushed onto 370 match the front of that history list exactly. The value is pushed onto
382 the list as the string that was read. 371 the list as the string that was read.
383 372
384 DEFALT specifies the default value for the sake of history commands. 373 DEFALT specifies the default value for the sake of history commands.
385 374
386 If ALLOW_PROPS is nonzero, we do not throw away text properties. 375 If ALLOW_PROPS, do not throw away text properties.
387 376
388 if INHERIT_INPUT_METHOD is nonzero, the minibuffer inherits the 377 if INHERIT_INPUT_METHOD, the minibuffer inherits the
389 current input method. */ 378 current input method. */
390 379
391static Lisp_Object 380static Lisp_Object
392read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt, 381read_minibuf (Lisp_Object map, Lisp_Object initial, Lisp_Object prompt,
393 int expflag, 382 bool expflag,
394 Lisp_Object histvar, Lisp_Object histpos, Lisp_Object defalt, 383 Lisp_Object histvar, Lisp_Object histpos, Lisp_Object defalt,
395 int allow_props, int inherit_input_method) 384 bool allow_props, bool inherit_input_method)
396{ 385{
397 Lisp_Object val; 386 Lisp_Object val;
398 ptrdiff_t count = SPECPDL_INDEX (); 387 ptrdiff_t count = SPECPDL_INDEX ();
@@ -1447,7 +1436,7 @@ is used to further constrain the set of candidates. */)
1447 if (bestmatchsize != SCHARS (eltstring) 1436 if (bestmatchsize != SCHARS (eltstring)
1448 || bestmatchsize != matchsize) 1437 || bestmatchsize != matchsize)
1449 /* Don't count the same string multiple times. */ 1438 /* Don't count the same string multiple times. */
1450 matchcount++; 1439 matchcount += matchcount <= 1;
1451 bestmatchsize = matchsize; 1440 bestmatchsize = matchsize;
1452 if (matchsize <= SCHARS (string) 1441 if (matchsize <= SCHARS (string)
1453 /* If completion-ignore-case is non-nil, don't 1442 /* If completion-ignore-case is non-nil, don't
diff --git a/src/nsfont.m b/src/nsfont.m
index 20a8f5d4028..a820b60ac58 100644
--- a/src/nsfont.m
+++ b/src/nsfont.m
@@ -53,8 +53,6 @@ extern float ns_antialias_threshold;
53extern int ns_tmp_flags; 53extern int ns_tmp_flags;
54extern struct nsfont_info *ns_tmp_font; 54extern struct nsfont_info *ns_tmp_font;
55 55
56static Lisp_Object Vfonts_in_cache;
57
58 56
59/* font glyph and metrics caching functions, implemented at end */ 57/* font glyph and metrics caching functions, implemented at end */
60static void ns_uni_to_glyphs (struct nsfont_info *font_info, 58static void ns_uni_to_glyphs (struct nsfont_info *font_info,
@@ -815,7 +813,6 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size)
815 numberWithUnsignedLongLong: 813 numberWithUnsignedLongLong:
816 (unsigned long long) XHASH (font_object)] 814 (unsigned long long) XHASH (font_object)]
817 forKey: nsfont]; 815 forKey: nsfont];
818 Vfonts_in_cache = Fcons (font_object, Vfonts_in_cache);
819 } 816 }
820 } 817 }
821 818
@@ -1535,7 +1532,4 @@ syms_of_nsfont (void)
1535 doc: /* Internal use: maps font registry to Unicode script. */); 1532 doc: /* Internal use: maps font registry to Unicode script. */);
1536 1533
1537 ascii_printable = NULL; 1534 ascii_printable = NULL;
1538
1539 Vfonts_in_cache = Qnil;
1540 staticpro (&Vfonts_in_cache);
1541} 1535}
diff --git a/src/nsmenu.m b/src/nsmenu.m
index 9af732c6c45..d0ea8f5a47a 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -128,8 +128,7 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu)
128 static EmacsMenu *last_submenu = nil; 128 static EmacsMenu *last_submenu = nil;
129 BOOL needsSet = NO; 129 BOOL needsSet = NO;
130 const char *submenuTitle = [[submenu title] UTF8String]; 130 const char *submenuTitle = [[submenu title] UTF8String];
131 extern int waiting_for_input; 131 bool owfi;
132 int owfi;
133 Lisp_Object items; 132 Lisp_Object items;
134 widget_value *wv, *first_wv, *prev_wv = 0; 133 widget_value *wv, *first_wv, *prev_wv = 0;
135 int i; 134 int i;
@@ -182,7 +181,8 @@ ns_update_menubar (struct frame *f, bool deep_p, EmacsMenu *submenu)
182 /* Fully parse one or more of the submenus. */ 181 /* Fully parse one or more of the submenus. */
183 int n = 0; 182 int n = 0;
184 int *submenu_start, *submenu_end; 183 int *submenu_start, *submenu_end;
185 int *submenu_top_level_items, *submenu_n_panes; 184 bool *submenu_top_level_items;
185 int *submenu_n_panes;
186 struct buffer *prev = current_buffer; 186 struct buffer *prev = current_buffer;
187 Lisp_Object buffer; 187 Lisp_Object buffer;
188 ptrdiff_t specpdl_count = SPECPDL_INDEX (); 188 ptrdiff_t specpdl_count = SPECPDL_INDEX ();
@@ -741,7 +741,7 @@ extern NSString *NSMenuDidBeginTrackingNotification;
741 741
742/* run a menu in popup mode */ 742/* run a menu in popup mode */
743- (Lisp_Object)runMenuAt: (NSPoint)p forFrame: (struct frame *)f 743- (Lisp_Object)runMenuAt: (NSPoint)p forFrame: (struct frame *)f
744 keymaps: (int)keymaps 744 keymaps: (bool)keymaps
745{ 745{
746 EmacsView *view = FRAME_NS_VIEW (f); 746 EmacsView *view = FRAME_NS_VIEW (f);
747 NSEvent *e, *event; 747 NSEvent *e, *event;
@@ -780,7 +780,7 @@ extern NSString *NSMenuDidBeginTrackingNotification;
780 ========================================================================== */ 780 ========================================================================== */
781 781
782Lisp_Object 782Lisp_Object
783ns_menu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, 783ns_menu_show (FRAME_PTR f, int x, int y, bool for_click, bool keymaps,
784 Lisp_Object title, const char **error) 784 Lisp_Object title, const char **error)
785{ 785{
786 EmacsMenu *pmenu; 786 EmacsMenu *pmenu;
@@ -802,7 +802,7 @@ ns_menu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
802 802
803#if 0 803#if 0
804 /* FIXME: a couple of one-line differences prevent reuse */ 804 /* FIXME: a couple of one-line differences prevent reuse */
805 wv = digest_single_submenu (0, menu_items_used, Qnil); 805 wv = digest_single_submenu (0, menu_items_used, 0);
806#else 806#else
807 { 807 {
808 widget_value *save_wv = 0, *prev_wv = 0; 808 widget_value *save_wv = 0, *prev_wv = 0;
diff --git a/src/nsterm.h b/src/nsterm.h
index 958d1ce7853..2e868b86caf 100644
--- a/src/nsterm.h
+++ b/src/nsterm.h
@@ -161,7 +161,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
161- (EmacsMenu *)addSubmenuWithTitle: (const char *)title forFrame: (struct frame *)f; 161- (EmacsMenu *)addSubmenuWithTitle: (const char *)title forFrame: (struct frame *)f;
162- (void) clear; 162- (void) clear;
163- (Lisp_Object)runMenuAt: (NSPoint)p forFrame: (struct frame *)f 163- (Lisp_Object)runMenuAt: (NSPoint)p forFrame: (struct frame *)f
164 keymaps: (int)keymaps; 164 keymaps: (bool)keymaps;
165@end 165@end
166 166
167 167
@@ -792,7 +792,7 @@ extern void free_frame_tool_bar (FRAME_PTR f);
792extern void find_and_call_menu_selection (FRAME_PTR f, 792extern void find_and_call_menu_selection (FRAME_PTR f,
793 int menu_bar_items_used, Lisp_Object vector, void *client_data); 793 int menu_bar_items_used, Lisp_Object vector, void *client_data);
794extern Lisp_Object find_and_return_menu_selection (FRAME_PTR f, 794extern Lisp_Object find_and_return_menu_selection (FRAME_PTR f,
795 int keymaps, 795 bool keymaps,
796 void *client_data); 796 void *client_data);
797extern Lisp_Object ns_popup_dialog (Lisp_Object position, Lisp_Object contents, 797extern Lisp_Object ns_popup_dialog (Lisp_Object position, Lisp_Object contents,
798 Lisp_Object header); 798 Lisp_Object header);
diff --git a/src/nsterm.m b/src/nsterm.m
index 6b739befeeb..1d935fc76de 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -55,7 +55,6 @@ GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu)
55#include "ccl.h" 55#include "ccl.h"
56 56
57#include "termhooks.h" 57#include "termhooks.h"
58#include "termopts.h"
59#include "termchar.h" 58#include "termchar.h"
60 59
61#include "window.h" 60#include "window.h"
@@ -1315,7 +1314,7 @@ static void
1315ns_fullscreen_hook (FRAME_PTR f) 1314ns_fullscreen_hook (FRAME_PTR f)
1316{ 1315{
1317 EmacsView *view = (EmacsView *)FRAME_NS_VIEW (f); 1316 EmacsView *view = (EmacsView *)FRAME_NS_VIEW (f);
1318 1317
1319 if (! f->async_visible) return; 1318 if (! f->async_visible) return;
1320#ifndef NEW_STYLE_FS 1319#ifndef NEW_STYLE_FS
1321 if (f->want_fullscreen == FULLSCREEN_BOTH) 1320 if (f->want_fullscreen == FULLSCREEN_BOTH)
@@ -5942,7 +5941,7 @@ not_in_argv (NSString *arg)
5942 [w setBackgroundColor: col]; 5941 [w setBackgroundColor: col];
5943 if ([col alphaComponent] != 1.0) 5942 if ([col alphaComponent] != 1.0)
5944 [w setOpaque: NO]; 5943 [w setOpaque: NO];
5945 5944
5946 f->border_width = bwidth; 5945 f->border_width = bwidth;
5947 FRAME_NS_TITLEBAR_HEIGHT (f) = tibar_height; 5946 FRAME_NS_TITLEBAR_HEIGHT (f) = tibar_height;
5948 FRAME_TOOLBAR_HEIGHT (f) = tobar_height; 5947 FRAME_TOOLBAR_HEIGHT (f) = tobar_height;
@@ -5995,7 +5994,7 @@ not_in_argv (NSString *arg)
5995 } 5994 }
5996 break; 5995 break;
5997 } 5996 }
5998 5997
5999 emacsframe->want_fullscreen = FULLSCREEN_NONE; 5998 emacsframe->want_fullscreen = FULLSCREEN_NONE;
6000 } 5999 }
6001 6000
diff --git a/src/process.c b/src/process.c
index c941a196539..2cbce9d28ea 100644
--- a/src/process.c
+++ b/src/process.c
@@ -4302,7 +4302,7 @@ wait_reading_process_output_1 (void)
4302 -1 meaning caller will actually read the input, so don't throw to 4302 -1 meaning caller will actually read the input, so don't throw to
4303 the quit handler, or 4303 the quit handler, or
4304 4304
4305 DO_DISPLAY != 0 means redisplay should be done to show subprocess 4305 DO_DISPLAY means redisplay should be done to show subprocess
4306 output that arrives. 4306 output that arrives.
4307 4307
4308 If WAIT_FOR_CELL is a cons cell, wait until its car is non-nil 4308 If WAIT_FOR_CELL is a cons cell, wait until its car is non-nil
@@ -4322,7 +4322,7 @@ wait_reading_process_output_1 (void)
4322 4322
4323int 4323int
4324wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, 4324wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4325 int do_display, 4325 bool do_display,
4326 Lisp_Object wait_for_cell, 4326 Lisp_Object wait_for_cell,
4327 struct Lisp_Process *wait_proc, int just_wait_proc) 4327 struct Lisp_Process *wait_proc, int just_wait_proc)
4328{ 4328{
@@ -4419,7 +4419,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4419 4419
4420 do 4420 do
4421 { 4421 {
4422 int old_timers_run = timers_run; 4422 unsigned old_timers_run = timers_run;
4423 struct buffer *old_buffer = current_buffer; 4423 struct buffer *old_buffer = current_buffer;
4424 Lisp_Object old_window = selected_window; 4424 Lisp_Object old_window = selected_window;
4425 4425
@@ -4753,7 +4753,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
4753 4753
4754 if (read_kbd != 0) 4754 if (read_kbd != 0)
4755 { 4755 {
4756 int old_timers_run = timers_run; 4756 unsigned old_timers_run = timers_run;
4757 struct buffer *old_buffer = current_buffer; 4757 struct buffer *old_buffer = current_buffer;
4758 Lisp_Object old_window = selected_window; 4758 Lisp_Object old_window = selected_window;
4759 int leave = 0; 4759 int leave = 0;
@@ -6821,14 +6821,14 @@ extern int sys_select (int, SELECT_TYPE *, SELECT_TYPE *, SELECT_TYPE *,
6821 see full version for other parameters. We know that wait_proc will 6821 see full version for other parameters. We know that wait_proc will
6822 always be NULL, since `subprocesses' isn't defined. 6822 always be NULL, since `subprocesses' isn't defined.
6823 6823
6824 DO_DISPLAY != 0 means redisplay should be done to show subprocess 6824 DO_DISPLAY means redisplay should be done to show subprocess
6825 output that arrives. 6825 output that arrives.
6826 6826
6827 Return true if we received input from any process. */ 6827 Return true if we received input from any process. */
6828 6828
6829int 6829int
6830wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, 6830wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
6831 int do_display, 6831 bool do_display,
6832 Lisp_Object wait_for_cell, 6832 Lisp_Object wait_for_cell,
6833 struct Lisp_Process *wait_proc, int just_wait_proc) 6833 struct Lisp_Process *wait_proc, int just_wait_proc)
6834{ 6834{
@@ -6904,7 +6904,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
6904 6904
6905 do 6905 do
6906 { 6906 {
6907 int old_timers_run = timers_run; 6907 unsigned old_timers_run = timers_run;
6908 timer_delay = timer_check (); 6908 timer_delay = timer_check ();
6909 if (timers_run != old_timers_run && do_display) 6909 if (timers_run != old_timers_run && do_display)
6910 /* We must retry, since a timer may have requeued itself 6910 /* We must retry, since a timer may have requeued itself
diff --git a/src/regex.c b/src/regex.c
index 17562043df1..7443eff3977 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -1834,7 +1834,6 @@ typedef struct
1834/* Explicit quit checking is needed for Emacs, which uses polling to 1834/* Explicit quit checking is needed for Emacs, which uses polling to
1835 process input events. */ 1835 process input events. */
1836#ifdef emacs 1836#ifdef emacs
1837extern int immediate_quit;
1838# define IMMEDIATE_QUIT_CHECK \ 1837# define IMMEDIATE_QUIT_CHECK \
1839 do { \ 1838 do { \
1840 if (immediate_quit) QUIT; \ 1839 if (immediate_quit) QUIT; \
diff --git a/src/search.c b/src/search.c
index 7c084c62e28..aacdbe33eef 100644
--- a/src/search.c
+++ b/src/search.c
@@ -636,12 +636,12 @@ newline_cache_on_off (struct buffer *buf)
636 If we don't find COUNT instances before reaching END, set *SHORTAGE 636 If we don't find COUNT instances before reaching END, set *SHORTAGE
637 to the number of TARGETs left unfound, and return END. 637 to the number of TARGETs left unfound, and return END.
638 638
639 If ALLOW_QUIT is non-zero, set immediate_quit. That's good to do 639 If ALLOW_QUIT, set immediate_quit. That's good to do
640 except when inside redisplay. */ 640 except when inside redisplay. */
641 641
642ptrdiff_t 642ptrdiff_t
643scan_buffer (register int target, ptrdiff_t start, ptrdiff_t end, 643scan_buffer (int target, ptrdiff_t start, ptrdiff_t end,
644 ptrdiff_t count, ptrdiff_t *shortage, int allow_quit) 644 ptrdiff_t count, ptrdiff_t *shortage, bool allow_quit)
645{ 645{
646 struct region_cache *newline_cache; 646 struct region_cache *newline_cache;
647 int direction; 647 int direction;
@@ -837,23 +837,23 @@ scan_buffer (register int target, ptrdiff_t start, ptrdiff_t end,
837 the number of line boundaries left unfound, and position at 837 the number of line boundaries left unfound, and position at
838 the limit we bumped up against. 838 the limit we bumped up against.
839 839
840 If ALLOW_QUIT is non-zero, set immediate_quit. That's good to do 840 If ALLOW_QUIT, set immediate_quit. That's good to do
841 except in special cases. */ 841 except in special cases. */
842 842
843EMACS_INT 843EMACS_INT
844scan_newline (ptrdiff_t start, ptrdiff_t start_byte, 844scan_newline (ptrdiff_t start, ptrdiff_t start_byte,
845 ptrdiff_t limit, ptrdiff_t limit_byte, 845 ptrdiff_t limit, ptrdiff_t limit_byte,
846 register EMACS_INT count, int allow_quit) 846 EMACS_INT count, bool allow_quit)
847{ 847{
848 int direction = ((count > 0) ? 1 : -1); 848 int direction = ((count > 0) ? 1 : -1);
849 849
850 register unsigned char *cursor; 850 unsigned char *cursor;
851 unsigned char *base; 851 unsigned char *base;
852 852
853 ptrdiff_t ceiling; 853 ptrdiff_t ceiling;
854 register unsigned char *ceiling_addr; 854 unsigned char *ceiling_addr;
855 855
856 int old_immediate_quit = immediate_quit; 856 bool old_immediate_quit = immediate_quit;
857 857
858 /* The code that follows is like scan_buffer 858 /* The code that follows is like scan_buffer
859 but checks for either newline or carriage return. */ 859 but checks for either newline or carriage return. */
diff --git a/src/term.c b/src/term.c
index 189fb783cbc..acce9c0548c 100644
--- a/src/term.c
+++ b/src/term.c
@@ -28,7 +28,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
28 28
29#include "lisp.h" 29#include "lisp.h"
30#include "termchar.h" 30#include "termchar.h"
31#include "termopts.h"
32#include "tparam.h" 31#include "tparam.h"
33#include "character.h" 32#include "character.h"
34#include "buffer.h" 33#include "buffer.h"
diff --git a/src/termopts.h b/src/termopts.h
index 7bf71aeefe7..05fa0a52eee 100644
--- a/src/termopts.h
+++ b/src/termopts.h
@@ -17,15 +17,8 @@ You should have received a copy of the GNU General Public License
17along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ 17along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
18 18
19 19
20/* Nonzero means use ^S/^Q as cretinous flow control. */
21extern int flow_control;
22
23/* Nonzero means use interrupt-driven input. */ 20/* Nonzero means use interrupt-driven input. */
24extern int interrupt_input; 21extern bool interrupt_input;
25 22
26/* Nonzero while interrupts are temporarily deferred during redisplay. */ 23/* Nonzero while interrupts are temporarily deferred during redisplay. */
27extern int interrupts_deferred; 24extern bool interrupts_deferred;
28
29/* Terminal has meta key */
30extern int meta_key;
31
diff --git a/src/w32select.c b/src/w32select.c
index ee0e6d16b11..1b10c74cfe9 100644
--- a/src/w32select.c
+++ b/src/w32select.c
@@ -76,6 +76,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
76#include "lisp.h" 76#include "lisp.h"
77#include "w32term.h" /* for all of the w32 includes */ 77#include "w32term.h" /* for all of the w32 includes */
78#include "w32common.h" /* os_subtype */ 78#include "w32common.h" /* os_subtype */
79#include "keyboard.h"
79#include "blockinput.h" 80#include "blockinput.h"
80#include "charset.h" 81#include "charset.h"
81#include "coding.h" 82#include "coding.h"
@@ -393,7 +394,6 @@ run_protected (Lisp_Object (*code) (Lisp_Object), Lisp_Object arg)
393 with global variables and calling strange looking functions. Is 394 with global variables and calling strange looking functions. Is
394 this really the right way to run Lisp callbacks? */ 395 this really the right way to run Lisp callbacks? */
395 396
396 extern int waiting_for_input; /* from keyboard.c */
397 int owfi; 397 int owfi;
398 398
399 block_input (); 399 block_input ();
diff --git a/src/xmenu.c b/src/xmenu.c
index 96a1ae87fdc..01d932cf8d8 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -111,7 +111,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
111static Lisp_Object Qdebug_on_next_call; 111static Lisp_Object Qdebug_on_next_call;
112 112
113#if defined (USE_X_TOOLKIT) || defined (USE_GTK) 113#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
114static Lisp_Object xdialog_show (FRAME_PTR, int, Lisp_Object, Lisp_Object, 114static Lisp_Object xdialog_show (FRAME_PTR, bool, Lisp_Object, Lisp_Object,
115 const char **); 115 const char **);
116#endif 116#endif
117 117
@@ -930,7 +930,8 @@ set_frame_menubar (FRAME_PTR f, bool first_time, bool deep_p)
930 widget_value *wv, *first_wv, *prev_wv = 0; 930 widget_value *wv, *first_wv, *prev_wv = 0;
931 int i; 931 int i;
932 int *submenu_start, *submenu_end; 932 int *submenu_start, *submenu_end;
933 int *submenu_top_level_items, *submenu_n_panes; 933 bool *submenu_top_level_items;
934 int *submenu_n_panes;
934 935
935 if (! FRAME_X_P (f)) 936 if (! FRAME_X_P (f))
936 emacs_abort (); 937 emacs_abort ();
@@ -1346,8 +1347,8 @@ free_frame_menubar (FRAME_PTR f)
1346/* F is the frame the menu is for. 1347/* F is the frame the menu is for.
1347 X and Y are the frame-relative specified position, 1348 X and Y are the frame-relative specified position,
1348 relative to the inside upper left corner of the frame F. 1349 relative to the inside upper left corner of the frame F.
1349 FOR_CLICK is nonzero if this menu was invoked for a mouse click. 1350 FOR_CLICK is true if this menu was invoked for a mouse click.
1350 KEYMAPS is 1 if this menu was specified with keymaps; 1351 KEYMAPS is true if this menu was specified with keymaps;
1351 in that case, we return a list containing the chosen item's value 1352 in that case, we return a list containing the chosen item's value
1352 and perhaps also the pane's prefix. 1353 and perhaps also the pane's prefix.
1353 TITLE is the specified menu title. 1354 TITLE is the specified menu title.
@@ -1427,14 +1428,14 @@ pop_down_menu (Lisp_Object arg)
1427 menu_item_selection will be set to the selection. */ 1428 menu_item_selection will be set to the selection. */
1428static void 1429static void
1429create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, int x, int y, 1430create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, int x, int y,
1430 int for_click, Time timestamp) 1431 bool for_click, Time timestamp)
1431{ 1432{
1432 int i; 1433 int i;
1433 GtkWidget *menu; 1434 GtkWidget *menu;
1434 GtkMenuPositionFunc pos_func = 0; /* Pop up at pointer. */ 1435 GtkMenuPositionFunc pos_func = 0; /* Pop up at pointer. */
1435 struct next_popup_x_y popup_x_y; 1436 struct next_popup_x_y popup_x_y;
1436 ptrdiff_t specpdl_count = SPECPDL_INDEX (); 1437 ptrdiff_t specpdl_count = SPECPDL_INDEX ();
1437 int use_pos_func = ! for_click; 1438 bool use_pos_func = ! for_click;
1438 1439
1439#ifdef HAVE_GTK3 1440#ifdef HAVE_GTK3
1440 /* Always use position function for Gtk3. Otherwise menus may become 1441 /* Always use position function for Gtk3. Otherwise menus may become
@@ -1539,7 +1540,7 @@ pop_down_menu (Lisp_Object arg)
1539 menu_item_selection will be set to the selection. */ 1540 menu_item_selection will be set to the selection. */
1540static void 1541static void
1541create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, 1542create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv,
1542 int x, int y, int for_click, Time timestamp) 1543 int x, int y, bool for_click, Time timestamp)
1543{ 1544{
1544 int i; 1545 int i;
1545 Arg av[2]; 1546 Arg av[2];
@@ -1623,7 +1624,7 @@ cleanup_widget_value_tree (Lisp_Object arg)
1623} 1624}
1624 1625
1625Lisp_Object 1626Lisp_Object
1626xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, 1627xmenu_show (FRAME_PTR f, int x, int y, bool for_click, bool keymaps,
1627 Lisp_Object title, const char **error_name, Time timestamp) 1628 Lisp_Object title, const char **error_name, Time timestamp)
1628{ 1629{
1629 int i; 1630 int i;
@@ -1878,7 +1879,7 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
1878 = AREF (menu_items, i + MENU_ITEMS_ITEM_VALUE); 1879 = AREF (menu_items, i + MENU_ITEMS_ITEM_VALUE);
1879 if (menu_item_selection == aref_addr (menu_items, i)) 1880 if (menu_item_selection == aref_addr (menu_items, i))
1880 { 1881 {
1881 if (keymaps != 0) 1882 if (keymaps)
1882 { 1883 {
1883 int j; 1884 int j;
1884 1885
@@ -2011,7 +2012,7 @@ static const char * button_names [] = {
2011 2012
2012static Lisp_Object 2013static Lisp_Object
2013xdialog_show (FRAME_PTR f, 2014xdialog_show (FRAME_PTR f,
2014 int keymaps, 2015 bool keymaps,
2015 Lisp_Object title, 2016 Lisp_Object title,
2016 Lisp_Object header, 2017 Lisp_Object header,
2017 const char **error_name) 2018 const char **error_name)
@@ -2277,7 +2278,7 @@ pop_down_menu (Lisp_Object arg)
2277 2278
2278 2279
2279Lisp_Object 2280Lisp_Object
2280xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, 2281xmenu_show (FRAME_PTR f, int x, int y, bool for_click, bool keymaps,
2281 Lisp_Object title, const char **error_name, Time timestamp) 2282 Lisp_Object title, const char **error_name, Time timestamp)
2282{ 2283{
2283 Window root; 2284 Window root;
@@ -2528,7 +2529,7 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps,
2528 { 2529 {
2529 entry 2530 entry
2530 = AREF (menu_items, i + MENU_ITEMS_ITEM_VALUE); 2531 = AREF (menu_items, i + MENU_ITEMS_ITEM_VALUE);
2531 if (keymaps != 0) 2532 if (keymaps)
2532 { 2533 {
2533 entry = Fcons (entry, Qnil); 2534 entry = Fcons (entry, Qnil);
2534 if (!NILP (pane_prefix)) 2535 if (!NILP (pane_prefix))
diff --git a/src/xsettings.c b/src/xsettings.c
index 7c68ff295cf..d23070791d8 100644
--- a/src/xsettings.c
+++ b/src/xsettings.c
@@ -29,7 +29,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
29#include "keyboard.h" 29#include "keyboard.h"
30#include "blockinput.h" 30#include "blockinput.h"
31#include "termhooks.h" 31#include "termhooks.h"
32#include "termopts.h"
33 32
34#include <X11/Xproto.h> 33#include <X11/Xproto.h>
35 34
diff --git a/src/xsmfns.c b/src/xsmfns.c
index 8067899f931..289aac8492b 100644
--- a/src/xsmfns.c
+++ b/src/xsmfns.c
@@ -35,7 +35,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
35#include "sysselect.h" 35#include "sysselect.h"
36#include "frame.h" 36#include "frame.h"
37#include "termhooks.h" 37#include "termhooks.h"
38#include "termopts.h"
39#include "xterm.h" 38#include "xterm.h"
40#include "process.h" 39#include "process.h"
41#include "keyboard.h" 40#include "keyboard.h"