aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorKenichi Handa2014-06-28 10:35:48 +0900
committerKenichi Handa2014-06-28 10:35:48 +0900
commitf036e167feaf875873636972b28a4adc12c32254 (patch)
tree440e45ae8951f7030393b130b184f2b1882070ee /src
parent1fc00e5c9e87c88b4b253692d6ade822f6d74d3e (diff)
parent2c4e2e6fd3096eb615504e3cfc89c588ec620f78 (diff)
downloademacs-f036e167feaf875873636972b28a4adc12c32254.tar.gz
emacs-f036e167feaf875873636972b28a4adc12c32254.zip
merge trunk
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog190
-rw-r--r--src/Makefile.in42
-rw-r--r--src/buffer.c4
-rw-r--r--src/callint.c36
-rw-r--r--src/ccl.c7
-rw-r--r--src/character.c26
-rw-r--r--src/character.h22
-rw-r--r--src/charset.c6
-rw-r--r--src/charset.h2
-rw-r--r--src/cmds.c4
-rw-r--r--src/coding.c51
-rw-r--r--src/commands.h4
-rw-r--r--src/composite.c66
-rw-r--r--src/dispextern.h3
-rw-r--r--src/editfns.c16
-rw-r--r--src/eval.c5
-rw-r--r--src/fileio.c25
-rw-r--r--src/fns.c98
-rw-r--r--src/font.c9
-rw-r--r--src/fontset.c39
-rw-r--r--src/frame.c3
-rw-r--r--src/frame.h2
-rw-r--r--src/ftfont.c2
-rw-r--r--src/image.c52
-rw-r--r--src/indent.c29
-rw-r--r--src/insdel.c2
-rw-r--r--src/intervals.h2
-rw-r--r--src/keyboard.c40
-rw-r--r--src/lisp.h87
-rw-r--r--src/lread.c8
-rw-r--r--src/macros.c2
-rw-r--r--src/menu.c2
-rw-r--r--src/menu.h3
-rw-r--r--src/print.c2
-rw-r--r--src/process.c10
-rw-r--r--src/search.c8
-rw-r--r--src/term.c2
-rw-r--r--src/w32fns.c2
-rw-r--r--src/w32heap.c42
-rw-r--r--src/window.c1
-rw-r--r--src/xdisp.c20
-rw-r--r--src/xfns.c38
-rw-r--r--src/xftfont.c10
-rw-r--r--src/xmenu.c47
-rw-r--r--src/xselect.c39
-rw-r--r--src/xterm.c54
-rw-r--r--src/xterm.h15
47 files changed, 584 insertions, 595 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 66ccae26c5c..b25e2d487d7 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,193 @@
12014-06-27 Glenn Morris <rgm@gnu.org>
2
3 * Makefile.in: Replace BOOTSTRAPEMACS sleight-of-hand
4 with an order-only dependence on bootstrap-emacs. (Bug#2151)
5 (.el.elc): Replace suffix rule with pattern rule.
6 (%.elc): New pattern rule, with order-only prerequisite.
7 ($(lisp)): No more need to depend on BOOTSTRAPEMACS.
8 ($(lispsource)/loaddefs.el): Use an order-only prerequisite
9 in place of BOOTSTRAPEMACS.
10
112014-06-26 Dmitry Antipov <dmantipov@yandex.ru>
12
13 * fns.c (Fcompare_strings): Use FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE.
14
152014-06-25 Dmitry Antipov <dmantipov@yandex.ru>
16
17 Consistently use validate_subarray to verify substring.
18 * fns.c (validate_substring): Not static any more. Adjust to
19 use ptrdiff_t, not EMACS_INT, because string and vector limits
20 can't exceed ptrdiff_t even if EMACS_INT is wider.
21 (Fcompare_strings, Fsubstring, Fsubstring_no_properties)
22 (secure_hash): Adjust user.
23 * lisp.h (validate_subarray): Add prototype.
24 * coding.c (Fundecodable_char_position):
25 * composite.c (Fcomposition_get_gstring, Fcompose_string_internal):
26 Use validate_subarray. Adjust comment to mention substring.
27
282014-06-25 Dmitry Antipov <dmantipov@yandex.ru>
29
30 Do not allow out-of-range character position in Fcompare_strings.
31 * fns.c (validate_subarray): Add prototype.
32 (Fcompare_substring): Use validate_subarray to check ranges.
33 Adjust comment to mention that the semantics was changed. Also see
34 http://lists.gnu.org/archive/html/emacs-devel/2014-06/msg00447.html.
35
362014-06-24 Paul Eggert <eggert@cs.ucla.edu>
37
38 Be more consistent about the 'Qfoo' naming convention.
39 * image.c (Fimagemagick_types):
40 * lisp.h (lisp_h_CHECK_TYPE, CHECK_TYPE, CHECK_ARRAY):
41 * process.c (Fmake_network_process):
42 Rename C local identifier 'Qfoo to avoid giving the false
43 impression that it stands for the symbol 'foo'.
44
452014-06-23 Dmitry Antipov <dmantipov@yandex.ru>
46
47 Simplify and cleanup character conversion stuff.
48 * lisp.h (multibyte_char_to_unibyte, multibyte_char_to_unibyte_safe):
49 Remove prototypes.
50 * character.c (multibyte_char_to_unibyte)
51 (multibyte_char_to_unibyte_safe): Remove; no longer used.
52 * character.h (make_char): Remove; unused.
53 (CHAR_TO_BYTE8, CHAR_TO_BYTE_SAFE): Simplify.
54 (ASCII_BYTE_P): Remove; ASCII_CHAR_P does the same thing.
55 * buffer.c, charset.c, charset.h, cmds.c, coding.c, editfns.c:
56 * fileio.c, indent.c, insdel.c, keyboard.c, lread.c, print.c:
57 * search.c, term.c, xdisp.c, xterm.c: Related users changed.
58
592014-06-22 Mario Lang <mlang@delysid.org>
60
61 * w32fns.c (Fw32_shell_execute): The the -> the.
62
632014-06-22 Dmitry Antipov <dmantipov@yandex.ru>
64
65 * xmenu.c (mouse_position_for_popup):
66 * xselect.c (mouse_position_for_drop): Do not duplicate ...
67 * xfns.c (x_relative_mouse_position): ... and prefer this function.
68 * menu.c (Fx_popup_menu):
69 * xselect.c (x_handle_dnd_message): Adjust users.
70 * menu.h (mouse_position_for_popup): Remove prototype.
71 * xterm.h (x_relative_mouse_position): Add prototype.
72 * xterm.c (x_find_topmost_parent): Break from the loop and do not
73 call XFree if XQueryTree returns zero.
74
752014-06-21 Eli Zaretskii <eliz@gnu.org>
76
77 * indent.c (Fvertical_motion): Doc fix.
78 Move to the goal column, if any, with a single call to
79 move_it_in_display_line, not in two calls. Doing this with two
80 calls causes move_it_in_display_line apply the line-prefix
81 handling twice instead of just once. (Bug#17823)
82
832014-06-21 Paul Eggert <eggert@cs.ucla.edu>
84
85 Port to OS X ACLs (Bug#17810).
86 * fileio.c (Ffile_acl): Port to OS X, where acl_get_file (...,
87 ACL_TYPE_ACCESS) doesn't work.
88
892014-06-21 Stefan Monnier <monnier@iro.umontreal.ca>
90
91 * keyboard.c (read_key_sequence): Don't invoke Vprefix_help_command
92 before checking key-translation-map (bug#17659).
93
942014-06-21 Dmitry Antipov <dmantipov@yandex.ru>
95
96 * font.c (font_make_object): Avoid dangling pointer which may
97 crash GC (Bug#17771).
98
992014-06-21 Eli Zaretskii <eliz@gnu.org>
100
101 * image.c [5 < GIFLIB_MAJOR + (1 <= GIFLIB_MINOR)]: Declare the
102 prototype of DGifCloseFile as appropriate for older and newer
103 versions of giflib.
104 (gif_close): New function, encapsulates the differences in the
105 calling sequence of DGifCloseFile before v5.1.0 and after it.
106 (gif_load): Call gif_close instead of DGifCloseFile. Divulge the
107 error string where appropriate. (Bug#17790)
108
109 * xdisp.c (Fmove_point_visually): Instead of testing for keyboard
110 macro execution, make sure point didn't move since last complete
111 redisplay, as the condition for using the glyph matrix
112 information. (Bug#17777)
113
1142014-06-19 Dmitry Antipov <dmantipov@yandex.ru>
115
116 Minor cleanup of fonset code.
117 * fontset.c (FONTSET_ID, set_fontset_id, FONTSET_NAME)
118 (set_fontset_name, FONTSET_ASCII, set_fontset_ascii)
119 (FONTSET_BASE, set_fontset_base, FONTSET_FRAME)
120 (set_fontset_frame, FONTSET_NOFONT_FACE, set_fontset_nofont_face)
121 (FONTSET_DEFAULT, set_fontset_default, FONTSET_FALLBACK)
122 (set_fontset_fallback): Reorder extra slots and avoid unused slots.
123 (free_realized_fontset): Remove because a no-op since 2008.
124 (free_face_fontset): Adjust user.
125 (syms_of_fontset): Shrink fontset by one extra slot.
126
1272014-06-17 Paul Eggert <eggert@cs.ucla.edu>
128
129 Omit redundant extern decls.
130 Most of this patch is from Dmitry Antipov, in:
131 http://lists.gnu.org/archive/html/emacs-devel/2014-06/msg00263.html
132 * commands.h (update_mode_lines):
133 * frame.h (Qbackground_color, Qforeground_color)
134 (x_set_menu_bar_lines):
135 * ftfont.c (ftfont_font_format):
136 * intervals.h (Qkeymap, Qfont):
137 * keyboard.c (timer_check, safe_run_hooks, Qregion_extract_function):
138 * lisp.h (Ffboundp, Qnil, Qt, Qlambda, Qintegerp, Qwholenump)
139 (Qsymbolp, Qlisp, Qconsp, Qstringp, Qarrayp, Qbufferp, Qmarkerp)
140 (Qvectorp, Qbuffer_or_string_p, Qchar_table_p, Qvector_or_char_table_p)
141 (Qfloatp, Qnumberp, Qfont_spec, Qfont_entity, Qfont_object)
142 (Fbyteorder, wrong_type_argument, Fmax_char, syms_of_composite)
143 (Fidentity, extract_float, init_display, syms_of_display, Qdisplay):
144 (Qimage, Qbox, redisplay_preserve_echo_area, char_table_ref)
145 (char_table_set, char_table_translate, Qautoload, Qbottom, Qtop)
146 (Qvisible, Qfont, Qfront_sticky, Qrear_nonsticky, init_sigio)
147 (Qtool_bar, Qheader_line):
148 * macros.c (Fexecute_kbd_macro):
149 * xdisp.c (Ftool_bar_height, Ftool_bar_height):
150 * xterm.c (x_delete_terminal, XSetIMValues):
151 * xterm.h (x_set_window_size, x_query_color, x_get_focus_frame)
152 (x_implicitly_set_name, popup_activated)
153 (widget_store_internal_border):
154 Remove redundant decls.
155 * frame.c [USE_X_TOOLKIT]: Include widget.h.
156 * keyboard.c (Fexit_recursive_edit, Fabort_recursive_edit):
157 Remove _Noreturn, as make-docfile now does that for us.
158 * lisp.h (DEFUN): Don't declare fnname here; rely on make-docfile.
159 (Qregion_extract_function): New decl.
160 * window.c, xfns.c: Include menu.h.
161
1622014-06-17 Stefan Monnier <monnier@iro.umontreal.ca>
163
164 * callint.c (Fcall_interactively): Fix up last change (bug#17701).
165
1662014-06-17 Dmitry Antipov <dmantipov@yandex.ru>
167
168 * fileio.c (Fread_file_name): Do not pass redundant args and ...
169 * callint.c (read_file_name): ... convert to static here.
170 * lisp.h (Fread_file_name): Do not EXFUN it.
171 (STRING_COPYIN): Remove; unused.
172 * composite.c (CHAR_COMPOSABLE_P): Replace unsafe macro with ...
173 (char_composable_p): ... static function. All users changed.
174 * eval.c (toplevel): Remove redundant #include directives.
175 * xterm.c (x_initialize): Add static to match prototype.
176 * ccl.c (Fccl_execute_on_string):
177 * font.c (fon_intern_prop): Use make_specified_string.
178
1792014-06-16 Paul Eggert <eggert@cs.ucla.edu>
180
181 * Makefile.in (ns-app): Fix typo that broke build on OS X.
182 Reported by David Caldwell in:
183 http://lists.gnu.org/archive/html/emacs-devel/2014-06/msg00251.html
184
1852014-06-16 Dmitry Antipov <dmantipov@yandex.ru>
186
187 Do not ask for XRender extension each time XFT font is opened.
188 * xftfont.c (xftfont_open): Move call to XRenderQueryExtension ...
189 * xterm.c (x_term_init) [HAVE_XFT]: ... to here. Adjust comment.
190
12014-06-15 Glenn Morris <rgm@gnu.org> 1912014-06-15 Glenn Morris <rgm@gnu.org>
2 192
3 * Makefile.in: Use `make -C' rather than `cd && make' throughout. 193 * Makefile.in: Use `make -C' rather than `cd && make' throughout.
diff --git a/src/Makefile.in b/src/Makefile.in
index 64c6b72479b..748f38e55bd 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -1,7 +1,7 @@
1### @configure_input@ 1### @configure_input@
2 2
3# Copyright (C) 1985, 1987-1988, 1993-1995, 1999-2014 Free Software 3# Copyright (C) 1985, 1987-1988, 1993-1995, 1999-2014
4# Foundation, Inc. 4# Free Software Foundation, Inc.
5 5
6# This file is part of GNU Emacs. 6# This file is part of GNU Emacs.
7 7
@@ -519,7 +519,7 @@ emacs.res: $(ntsource)/emacs.rc \
519 -o $@ $(ntsource)/emacs.rc 519 -o $@ $(ntsource)/emacs.rc
520 520
521ns-app: emacs$(EXEEXT) 521ns-app: emacs$(EXEEXT)
522 $(MAKE) -C ./nextstep all 522 $(MAKE) -C ../nextstep all
523 523
524.PHONY: mostlyclean clean bootstrap-clean distclean maintainer-clean 524.PHONY: mostlyclean clean bootstrap-clean distclean maintainer-clean
525.PHONY: versionclean extraclean 525.PHONY: versionclean extraclean
@@ -594,40 +594,28 @@ tags: TAGS ../lisp/TAGS $(lwlibdir)/TAGS
594## such as loaddefs.el or *.elc can typically be produced by any old 594## such as loaddefs.el or *.elc can typically be produced by any old
595## Emacs executable, so we would like to avoid rebuilding them whenever 595## Emacs executable, so we would like to avoid rebuilding them whenever
596## we build a new Emacs executable. 596## we build a new Emacs executable.
597##
598## (In other words, changing a single file src/foo.c would force
599## dumping a new bootstrap-emacs, then re-byte-compiling all preloaded
600## elisp files, and only then dump the actual src/emacs, which is not
601## wrong, but is overkill in 99.99% of the cases.)
602##
597## To solve the circularity, we use 2 different Emacs executables, 603## To solve the circularity, we use 2 different Emacs executables,
598## "emacs" is the main target and "bootstrap-emacs" is the one used 604## "emacs" is the main target and "bootstrap-emacs" is the one used
599## to build the *.elc and loaddefs.el files. 605## to build the *.elc and loaddefs.el files.
600## To solve the freshness issue, we used to use a third file "witness-emacs" 606## To solve the freshness issue, in the past we tried various clever tricks,
601## which was used to witness the fact that there is a bootstrap-emacs 607## but now that we require GNU make, we can simply specify
602## executable, and then have dependencies on witness-emacs rather than 608## bootstrap-emacs$(EXEEXT) as an order-only prerequisite.
603## bootstrap-emacs, but that lead to problems in parallel builds (because
604## witness-emacs needed to be free from dependencies (to avoid rebuilding
605## it), so it was compiled in parallel, leading typically to having 2
606## processes dumping bootstrap-emacs at the same time).
607## So instead, we replace the witness-emacs dependencies by conditional
608## bootstrap-dependencies (via $(BOOTSTRAPEMACS)). Of course, since we do
609## not want to rely on GNU Make features, we have to rely on an external
610## script to do the conditional part of the dependency
611## (i.e. see the $(SUBDIR) rule ../Makefile.in).
612
613.SUFFIXES: .elc .el
614
615## These suffix rules do not allow additional dependencies, sadly, so
616## instead of adding a $(BOOTSTRAPEMACS) dependency here, we add it
617## separately below.
618## With GNU Make, we would just say "%.el : %.elc $(BOOTSTRAPEMACS)"
619.el.elc:
620 @$(MAKE) -C ../lisp compile-onefile THEFILE=$< EMACS="$(bootstrap_exe)"
621 609
622## Since the .el.elc rule cannot specify an extra dependency, we do it here. 610%.elc: %.el | bootstrap-emacs$(EXEEXT)
623$(lisp): $(BOOTSTRAPEMACS) 611 @$(MAKE) -C ../lisp compile-onefile THEFILE=$< EMACS="$(bootstrap_exe)"
624 612
625## VCSWITNESS points to the file that holds info about the current checkout. 613## VCSWITNESS points to the file that holds info about the current checkout.
626## We use it as a heuristic to decide when to rebuild loaddefs.el. 614## We use it as a heuristic to decide when to rebuild loaddefs.el.
627## If empty it is ignored; the parent makefile can set it to some other value. 615## If empty it is ignored; the parent makefile can set it to some other value.
628VCSWITNESS = 616VCSWITNESS =
629 617
630$(lispsource)/loaddefs.el: $(BOOTSTRAPEMACS) $(VCSWITNESS) 618$(lispsource)/loaddefs.el: $(VCSWITNESS) | bootstrap-emacs$(EXEEXT)
631 $(MAKE) -C ../lisp autoloads EMACS="$(bootstrap_exe)" 619 $(MAKE) -C ../lisp autoloads EMACS="$(bootstrap_exe)"
632 620
633## Dump an Emacs executable named bootstrap-emacs containing the 621## Dump an Emacs executable named bootstrap-emacs containing the
diff --git a/src/buffer.c b/src/buffer.c
index 909b3779b06..d6f6b2c7703 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -2530,7 +2530,7 @@ current buffer is cleared. */)
2530 p = GAP_END_ADDR; 2530 p = GAP_END_ADDR;
2531 stop = Z; 2531 stop = Z;
2532 } 2532 }
2533 if (ASCII_BYTE_P (*p)) 2533 if (ASCII_CHAR_P (*p))
2534 p++, pos++; 2534 p++, pos++;
2535 else if (CHAR_BYTE8_HEAD_P (*p)) 2535 else if (CHAR_BYTE8_HEAD_P (*p))
2536 { 2536 {
@@ -2602,7 +2602,7 @@ current buffer is cleared. */)
2602 stop = Z; 2602 stop = Z;
2603 } 2603 }
2604 2604
2605 if (ASCII_BYTE_P (*p)) 2605 if (ASCII_CHAR_P (*p))
2606 p++, pos++; 2606 p++, pos++;
2607 else if (EQ (flag, Qt) 2607 else if (EQ (flag, Qt)
2608 && ! CHAR_BYTE8_HEAD_P (*p) 2608 && ! CHAR_BYTE8_HEAD_P (*p)
diff --git a/src/callint.c b/src/callint.c
index 9e40cc01a62..817f84d897b 100644
--- a/src/callint.c
+++ b/src/callint.c
@@ -233,6 +233,26 @@ fix_command (Lisp_Object input, Lisp_Object values)
233 } 233 }
234} 234}
235 235
236/* Helper function to call `read-file-name' from C. */
237
238static Lisp_Object
239read_file_name (Lisp_Object default_filename, Lisp_Object mustmatch,
240 Lisp_Object initial, Lisp_Object predicate)
241{
242 struct gcpro gcpro1;
243 Lisp_Object args[7];
244
245 GCPRO1 (default_filename);
246 args[0] = intern ("read-file-name");
247 args[1] = callint_message;
248 args[2] = Qnil;
249 args[3] = default_filename;
250 args[4] = mustmatch;
251 args[5] = initial;
252 args[6] = predicate;
253 RETURN_UNGCPRO (Ffuncall (7, args));
254}
255
236/* BEWARE: Calling this directly from C would defeat the purpose! */ 256/* BEWARE: Calling this directly from C would defeat the purpose! */
237DEFUN ("funcall-interactively", Ffuncall_interactively, Sfuncall_interactively, 257DEFUN ("funcall-interactively", Ffuncall_interactively, Sfuncall_interactively,
238 1, MANY, 0, doc: /* Like `funcall' but marks the call as interactive. 258 1, MANY, 0, doc: /* Like `funcall' but marks the call as interactive.
@@ -515,7 +535,7 @@ invoke it. If KEYS is omitted or nil, the return value of
515 { 535 {
516 visargs[1] = make_string (tem + 1, strcspn (tem + 1, "\n")); 536 visargs[1] = make_string (tem + 1, strcspn (tem + 1, "\n"));
517 if (strchr (SSDATA (visargs[1]), '%')) 537 if (strchr (SSDATA (visargs[1]), '%'))
518 callint_message = Fformat (i, visargs); 538 callint_message = Fformat (i - 1, visargs + 1);
519 else 539 else
520 callint_message = visargs[1]; 540 callint_message = visargs[1];
521 541
@@ -574,25 +594,21 @@ invoke it. If KEYS is omitted or nil, the return value of
574 break; 594 break;
575 595
576 case 'D': /* Directory name. */ 596 case 'D': /* Directory name. */
577 args[i] = Fread_file_name (callint_message, Qnil, 597 args[i] = read_file_name (BVAR (current_buffer, directory), Qlambda, Qnil,
578 BVAR (current_buffer, directory), Qlambda, Qnil, 598 Qfile_directory_p);
579 Qfile_directory_p);
580 break; 599 break;
581 600
582 case 'f': /* Existing file name. */ 601 case 'f': /* Existing file name. */
583 args[i] = Fread_file_name (callint_message, 602 args[i] = read_file_name (Qnil, Qlambda, Qnil, Qnil);
584 Qnil, Qnil, Qlambda, Qnil, Qnil);
585 break; 603 break;
586 604
587 case 'F': /* Possibly nonexistent file name. */ 605 case 'F': /* Possibly nonexistent file name. */
588 args[i] = Fread_file_name (callint_message, 606 args[i] = read_file_name (Qnil, Qnil, Qnil, Qnil);
589 Qnil, Qnil, Qnil, Qnil, Qnil);
590 break; 607 break;
591 608
592 case 'G': /* Possibly nonexistent file name, 609 case 'G': /* Possibly nonexistent file name,
593 default to directory alone. */ 610 default to directory alone. */
594 args[i] = Fread_file_name (callint_message, 611 args[i] = read_file_name (Qnil, Qnil, empty_unibyte_string, Qnil);
595 Qnil, Qnil, Qnil, empty_unibyte_string, Qnil);
596 break; 612 break;
597 613
598 case 'i': /* Ignore an argument -- Does not do I/O. */ 614 case 'i': /* Ignore an argument -- Does not do I/O. */
diff --git a/src/ccl.c b/src/ccl.c
index 187f6027018..54093bf5677 100644
--- a/src/ccl.c
+++ b/src/ccl.c
@@ -2160,11 +2160,8 @@ usage: (ccl-execute-on-string CCL-PROGRAM STATUS STRING &optional CONTINUE UNIBY
2160 ASET (status, i, make_number (ccl.reg[i])); 2160 ASET (status, i, make_number (ccl.reg[i]));
2161 ASET (status, 8, make_number (ccl.ic)); 2161 ASET (status, 8, make_number (ccl.ic));
2162 2162
2163 if (NILP (unibyte_p)) 2163 val = make_specified_string ((const char *) outbuf, produced_chars,
2164 val = make_multibyte_string ((char *) outbuf, produced_chars, 2164 outp - outbuf, NILP (unibyte_p));
2165 outp - outbuf);
2166 else
2167 val = make_unibyte_string ((char *) outbuf, produced_chars);
2168 xfree (outbuf); 2165 xfree (outbuf);
2169 2166
2170 return val; 2167 return val;
diff --git a/src/character.c b/src/character.c
index 12a95203527..a8e48dfd774 100644
--- a/src/character.c
+++ b/src/character.c
@@ -233,32 +233,6 @@ translate_char (Lisp_Object table, int c)
233 return c; 233 return c;
234} 234}
235 235
236/* Convert ASCII or 8-bit character C to unibyte. If C is none of
237 them, return (C & 0xFF). */
238
239int
240multibyte_char_to_unibyte (int c)
241{
242 if (c < 0x80)
243 return c;
244 if (CHAR_BYTE8_P (c))
245 return CHAR_TO_BYTE8 (c);
246 return (c & 0xFF);
247}
248
249/* Like multibyte_char_to_unibyte, but return -1 if C is not supported
250 by charset_unibyte. */
251
252int
253multibyte_char_to_unibyte_safe (int c)
254{
255 if (c < 0x80)
256 return c;
257 if (CHAR_BYTE8_P (c))
258 return CHAR_TO_BYTE8 (c);
259 return -1;
260}
261
262DEFUN ("characterp", Fcharacterp, Scharacterp, 1, 2, 0, 236DEFUN ("characterp", Fcharacterp, Scharacterp, 1, 2, 0,
263 doc: /* Return non-nil if OBJECT is a character. 237 doc: /* Return non-nil if OBJECT is a character.
264In Emacs Lisp, characters are represented by character codes, which 238In Emacs Lisp, characters are represented by character codes, which
diff --git a/src/character.h b/src/character.h
index 6f243a1392d..18aad5b8f41 100644
--- a/src/character.h
+++ b/src/character.h
@@ -67,20 +67,15 @@ INLINE_HEADER_BEGIN
67#define BYTE8_TO_CHAR(byte) ((byte) + 0x3FFF00) 67#define BYTE8_TO_CHAR(byte) ((byte) + 0x3FFF00)
68 68
69#define UNIBYTE_TO_CHAR(byte) \ 69#define UNIBYTE_TO_CHAR(byte) \
70 (ASCII_BYTE_P (byte) ? (byte) : BYTE8_TO_CHAR (byte)) 70 (ASCII_CHAR_P (byte) ? (byte) : BYTE8_TO_CHAR (byte))
71 71
72/* Return the raw 8-bit byte for character C. */ 72/* Return the raw 8-bit byte for character C. */
73#define CHAR_TO_BYTE8(c) \ 73#define CHAR_TO_BYTE8(c) (CHAR_BYTE8_P (c) ? (c) - 0x3FFF00 : (c & 0xFF))
74 (CHAR_BYTE8_P (c) \
75 ? (c) - 0x3FFF00 \
76 : multibyte_char_to_unibyte (c))
77 74
78/* Return the raw 8-bit byte for character C, 75/* Return the raw 8-bit byte for character C,
79 or -1 if C doesn't correspond to a byte. */ 76 or -1 if C doesn't correspond to a byte. */
80#define CHAR_TO_BYTE_SAFE(c) \ 77#define CHAR_TO_BYTE_SAFE(c) \
81 (CHAR_BYTE8_P (c) \ 78 (ASCII_CHAR_P (c) ? c : (CHAR_BYTE8_P (c) ? (c) - 0x3FFF00 : -1))
82 ? (c) - 0x3FFF00 \
83 : multibyte_char_to_unibyte_safe (c))
84 79
85/* Nonzero iff BYTE is the 1st byte of a multibyte form of a character 80/* Nonzero iff BYTE is the 1st byte of a multibyte form of a character
86 that corresponds to a raw 8-bit byte. */ 81 that corresponds to a raw 8-bit byte. */
@@ -101,13 +96,6 @@ INLINE_HEADER_BEGIN
101/* This is the maximum byte length of multibyte form. */ 96/* This is the maximum byte length of multibyte form. */
102#define MAX_MULTIBYTE_LENGTH 5 97#define MAX_MULTIBYTE_LENGTH 5
103 98
104/* Return a Lisp character whose character code is C. Assumes C is
105 a valid character code. */
106#define make_char(c) make_number (c)
107
108/* Nonzero iff C is an ASCII byte. */
109#define ASCII_BYTE_P(c) UNSIGNED_CMP (c, <, 0x80)
110
111/* Nonzero iff X is a character. */ 99/* Nonzero iff X is a character. */
112#define CHARACTERP(x) (NATNUMP (x) && XFASTINT (x) <= MAX_CHAR) 100#define CHARACTERP(x) (NATNUMP (x) && XFASTINT (x) <= MAX_CHAR)
113 101
@@ -222,7 +210,7 @@ INLINE_HEADER_BEGIN
222 210
223/* Nonzero iff BYTE starts a character in a multibyte form. 211/* Nonzero iff BYTE starts a character in a multibyte form.
224 This is equivalent to: 212 This is equivalent to:
225 (ASCII_BYTE_P (byte) || LEADING_CODE_P (byte)) */ 213 (ASCII_CHAR_P (byte) || LEADING_CODE_P (byte)) */
226#define CHAR_HEAD_P(byte) (((byte) & 0xC0) != 0x80) 214#define CHAR_HEAD_P(byte) (((byte) & 0xC0) != 0x80)
227 215
228/* How many bytes a character that starts with BYTE occupies in a 216/* How many bytes a character that starts with BYTE occupies in a
diff --git a/src/charset.c b/src/charset.c
index baa692232c7..341ac356aff 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -389,12 +389,12 @@ load_charset_map (struct charset *charset, struct charset_map_entries *entries,
389 { 389 {
390 if (ascii_compatible_p) 390 if (ascii_compatible_p)
391 { 391 {
392 if (! ASCII_BYTE_P (from_c)) 392 if (! ASCII_CHAR_P (from_c))
393 { 393 {
394 if (from_c < nonascii_min_char) 394 if (from_c < nonascii_min_char)
395 nonascii_min_char = from_c; 395 nonascii_min_char = from_c;
396 } 396 }
397 else if (! ASCII_BYTE_P (to_c)) 397 else if (! ASCII_CHAR_P (to_c))
398 { 398 {
399 nonascii_min_char = 0x80; 399 nonascii_min_char = 0x80;
400 } 400 }
@@ -1522,7 +1522,7 @@ find_charsets_in_text (const unsigned char *ptr, ptrdiff_t nchars,
1522 1522
1523 if (!NILP (table)) 1523 if (!NILP (table))
1524 c = translate_char (table, c); 1524 c = translate_char (table, c);
1525 if (ASCII_BYTE_P (c)) 1525 if (ASCII_CHAR_P (c))
1526 ASET (charsets, charset_ascii, Qt); 1526 ASET (charsets, charset_ascii, Qt);
1527 else 1527 else
1528 ASET (charsets, charset_eight_bit, Qt); 1528 ASET (charsets, charset_eight_bit, Qt);
diff --git a/src/charset.h b/src/charset.h
index 32c624beff8..4176ce5ecc6 100644
--- a/src/charset.h
+++ b/src/charset.h
@@ -403,7 +403,7 @@ extern Lisp_Object Vchar_charset_set;
403 Try some optimization before calling decode_char. */ 403 Try some optimization before calling decode_char. */
404 404
405#define DECODE_CHAR(charset, code) \ 405#define DECODE_CHAR(charset, code) \
406 ((ASCII_BYTE_P (code) && (charset)->ascii_compatible_p) \ 406 ((ASCII_CHAR_P (code) && (charset)->ascii_compatible_p) \
407 ? (code) \ 407 ? (code) \
408 : ((code) < (charset)->min_code || (code) > (charset)->max_code) \ 408 : ((code) < (charset)->min_code || (code) > (charset)->max_code) \
409 ? -1 \ 409 ? -1 \
diff --git a/src/cmds.c b/src/cmds.c
index 828fea3d753..20234638778 100644
--- a/src/cmds.c
+++ b/src/cmds.c
@@ -359,9 +359,7 @@ internal_self_insert (int c, EMACS_INT n)
359 } 359 }
360 else 360 else
361 { 361 {
362 str[0] = (SINGLE_BYTE_CHAR_P (c) 362 str[0] = SINGLE_BYTE_CHAR_P (c) ? c : CHAR_TO_BYTE8 (c);
363 ? c
364 : multibyte_char_to_unibyte (c));
365 len = 1; 363 len = 1;
366 } 364 }
367 if (!NILP (overwrite) 365 if (!NILP (overwrite)
diff --git a/src/coding.c b/src/coding.c
index fbe14f1695f..79f116fc618 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -1485,7 +1485,7 @@ decode_coding_utf_8 (struct coding_system *coding)
1485 src = src_base; 1485 src = src_base;
1486 consumed_chars = consumed_chars_base; 1486 consumed_chars = consumed_chars_base;
1487 ONE_MORE_BYTE (c); 1487 ONE_MORE_BYTE (c);
1488 *charbuf++ = ASCII_BYTE_P (c) ? c : BYTE8_TO_CHAR (c); 1488 *charbuf++ = ASCII_CHAR_P (c) ? c : BYTE8_TO_CHAR (c);
1489 coding->errors++; 1489 coding->errors++;
1490 } 1490 }
1491 1491
@@ -1725,7 +1725,7 @@ decode_coding_utf_16 (struct coding_system *coding)
1725 ONE_MORE_BYTE (c2); 1725 ONE_MORE_BYTE (c2);
1726 if (c2 < 0) 1726 if (c2 < 0)
1727 { 1727 {
1728 *charbuf++ = ASCII_BYTE_P (c1) ? c1 : BYTE8_TO_CHAR (c1); 1728 *charbuf++ = ASCII_CHAR_P (c1) ? c1 : BYTE8_TO_CHAR (c1);
1729 *charbuf++ = -c2; 1729 *charbuf++ = -c2;
1730 continue; 1730 continue;
1731 } 1731 }
@@ -2108,7 +2108,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src,
2108 2108
2109 case 1: 2109 case 1:
2110 code = c; 2110 code = c;
2111 charset_ID = ASCII_BYTE_P (code) ? charset_ascii : charset_eight_bit; 2111 charset_ID = ASCII_CHAR_P (code) ? charset_ascii : charset_eight_bit;
2112 break; 2112 break;
2113 2113
2114 default: 2114 default:
@@ -2596,7 +2596,7 @@ decode_coding_emacs_mule (struct coding_system *coding)
2596 src = src_base; 2596 src = src_base;
2597 consumed_chars = consumed_chars_base; 2597 consumed_chars = consumed_chars_base;
2598 ONE_MORE_BYTE (c); 2598 ONE_MORE_BYTE (c);
2599 *charbuf++ = ASCII_BYTE_P (c) ? c : BYTE8_TO_CHAR (c); 2599 *charbuf++ = ASCII_CHAR_P (c) ? c : BYTE8_TO_CHAR (c);
2600 char_offset++; 2600 char_offset++;
2601 coding->errors++; 2601 coding->errors++;
2602 } 2602 }
@@ -3573,7 +3573,7 @@ decode_coding_iso_2022 (struct coding_system *coding)
3573 3573
3574 if (CODING_ISO_EXTSEGMENT_LEN (coding) > 0) 3574 if (CODING_ISO_EXTSEGMENT_LEN (coding) > 0)
3575 { 3575 {
3576 *charbuf++ = ASCII_BYTE_P (c1) ? c1 : BYTE8_TO_CHAR (c1); 3576 *charbuf++ = ASCII_CHAR_P (c1) ? c1 : BYTE8_TO_CHAR (c1);
3577 char_offset++; 3577 char_offset++;
3578 CODING_ISO_EXTSEGMENT_LEN (coding)--; 3578 CODING_ISO_EXTSEGMENT_LEN (coding)--;
3579 continue; 3579 continue;
@@ -3600,7 +3600,7 @@ decode_coding_iso_2022 (struct coding_system *coding)
3600 } 3600 }
3601 else 3601 else
3602 { 3602 {
3603 *charbuf++ = ASCII_BYTE_P (c1) ? c1 : BYTE8_TO_CHAR (c1); 3603 *charbuf++ = ASCII_CHAR_P (c1) ? c1 : BYTE8_TO_CHAR (c1);
3604 char_offset++; 3604 char_offset++;
3605 } 3605 }
3606 continue; 3606 continue;
@@ -3974,7 +3974,7 @@ decode_coding_iso_2022 (struct coding_system *coding)
3974 MAYBE_FINISH_COMPOSITION (); 3974 MAYBE_FINISH_COMPOSITION ();
3975 for (; src_base < src; src_base++, char_offset++) 3975 for (; src_base < src; src_base++, char_offset++)
3976 { 3976 {
3977 if (ASCII_BYTE_P (*src_base)) 3977 if (ASCII_CHAR_P (*src_base))
3978 *charbuf++ = *src_base; 3978 *charbuf++ = *src_base;
3979 else 3979 else
3980 *charbuf++ = BYTE8_TO_CHAR (*src_base); 3980 *charbuf++ = BYTE8_TO_CHAR (*src_base);
@@ -4004,7 +4004,7 @@ decode_coding_iso_2022 (struct coding_system *coding)
4004 src = src_base; 4004 src = src_base;
4005 consumed_chars = consumed_chars_base; 4005 consumed_chars = consumed_chars_base;
4006 ONE_MORE_BYTE (c); 4006 ONE_MORE_BYTE (c);
4007 *charbuf++ = c < 0 ? -c : ASCII_BYTE_P (c) ? c : BYTE8_TO_CHAR (c); 4007 *charbuf++ = c < 0 ? -c : ASCII_CHAR_P (c) ? c : BYTE8_TO_CHAR (c);
4008 char_offset++; 4008 char_offset++;
4009 coding->errors++; 4009 coding->errors++;
4010 /* Reset the invocation and designation status to the safest 4010 /* Reset the invocation and designation status to the safest
@@ -5640,7 +5640,7 @@ decode_coding_charset (struct coding_system *coding)
5640 src = src_base; 5640 src = src_base;
5641 consumed_chars = consumed_chars_base; 5641 consumed_chars = consumed_chars_base;
5642 ONE_MORE_BYTE (c); 5642 ONE_MORE_BYTE (c);
5643 *charbuf++ = c < 0 ? -c : ASCII_BYTE_P (c) ? c : BYTE8_TO_CHAR (c); 5643 *charbuf++ = c < 0 ? -c : ASCII_CHAR_P (c) ? c : BYTE8_TO_CHAR (c);
5644 char_offset++; 5644 char_offset++;
5645 coding->errors++; 5645 coding->errors++;
5646 } 5646 }
@@ -9031,13 +9031,13 @@ DEFUN ("find-coding-systems-region-internal",
9031 p = pbeg = BYTE_POS_ADDR (start_byte); 9031 p = pbeg = BYTE_POS_ADDR (start_byte);
9032 pend = p + (end_byte - start_byte); 9032 pend = p + (end_byte - start_byte);
9033 9033
9034 while (p < pend && ASCII_BYTE_P (*p)) p++; 9034 while (p < pend && ASCII_CHAR_P (*p)) p++;
9035 while (p < pend && ASCII_BYTE_P (*(pend - 1))) pend--; 9035 while (p < pend && ASCII_CHAR_P (*(pend - 1))) pend--;
9036 9036
9037 work_table = Fmake_char_table (Qnil, Qnil); 9037 work_table = Fmake_char_table (Qnil, Qnil);
9038 while (p < pend) 9038 while (p < pend)
9039 { 9039 {
9040 if (ASCII_BYTE_P (*p)) 9040 if (ASCII_CHAR_P (*p))
9041 p++; 9041 p++;
9042 else 9042 else
9043 { 9043 {
@@ -9091,8 +9091,7 @@ DEFUN ("find-coding-systems-region-internal",
9091 9091
9092DEFUN ("unencodable-char-position", Funencodable_char_position, 9092DEFUN ("unencodable-char-position", Funencodable_char_position,
9093 Sunencodable_char_position, 3, 5, 0, 9093 Sunencodable_char_position, 3, 5, 0,
9094 doc: /* 9094 doc: /* Return position of first un-encodable character in a region.
9095Return position of first un-encodable character in a region.
9096START and END specify the region and CODING-SYSTEM specifies the 9095START and END specify the region and CODING-SYSTEM specifies the
9097encoding to check. Return nil if CODING-SYSTEM does encode the region. 9096encoding to check. Return nil if CODING-SYSTEM does encode the region.
9098 9097
@@ -9102,8 +9101,9 @@ list of positions.
9102 9101
9103If optional 5th argument STRING is non-nil, it is a string to search 9102If optional 5th argument STRING is non-nil, it is a string to search
9104for un-encodable characters. In that case, START and END are indexes 9103for un-encodable characters. In that case, START and END are indexes
9105to the string. */) 9104to the string and treated as in `substring'. */)
9106 (Lisp_Object start, Lisp_Object end, Lisp_Object coding_system, Lisp_Object count, Lisp_Object string) 9105 (Lisp_Object start, Lisp_Object end, Lisp_Object coding_system,
9106 Lisp_Object count, Lisp_Object string)
9107{ 9107{
9108 EMACS_INT n; 9108 EMACS_INT n;
9109 struct coding_system coding; 9109 struct coding_system coding;
@@ -9140,12 +9140,7 @@ to the string. */)
9140 else 9140 else
9141 { 9141 {
9142 CHECK_STRING (string); 9142 CHECK_STRING (string);
9143 CHECK_NATNUM (start); 9143 validate_subarray (string, start, end, SCHARS (string), &from, &to);
9144 CHECK_NATNUM (end);
9145 if (! (XINT (start) <= XINT (end) && XINT (end) <= SCHARS (string)))
9146 args_out_of_range_3 (string, start, end);
9147 from = XINT (start);
9148 to = XINT (end);
9149 if (! STRING_MULTIBYTE (string)) 9144 if (! STRING_MULTIBYTE (string))
9150 return Qnil; 9145 return Qnil;
9151 p = SDATA (string) + string_char_to_byte (string, from); 9146 p = SDATA (string) + string_char_to_byte (string, from);
@@ -9169,7 +9164,7 @@ to the string. */)
9169 int c; 9164 int c;
9170 9165
9171 if (ascii_compatible) 9166 if (ascii_compatible)
9172 while (p < stop && ASCII_BYTE_P (*p)) 9167 while (p < stop && ASCII_CHAR_P (*p))
9173 p++, from++; 9168 p++, from++;
9174 if (p >= stop) 9169 if (p >= stop)
9175 { 9170 {
@@ -9285,12 +9280,12 @@ is nil. */)
9285 p = pbeg = BYTE_POS_ADDR (start_byte); 9280 p = pbeg = BYTE_POS_ADDR (start_byte);
9286 pend = p + (end_byte - start_byte); 9281 pend = p + (end_byte - start_byte);
9287 9282
9288 while (p < pend && ASCII_BYTE_P (*p)) p++, pos++; 9283 while (p < pend && ASCII_CHAR_P (*p)) p++, pos++;
9289 while (p < pend && ASCII_BYTE_P (*(pend - 1))) pend--; 9284 while (p < pend && ASCII_CHAR_P (*(pend - 1))) pend--;
9290 9285
9291 while (p < pend) 9286 while (p < pend)
9292 { 9287 {
9293 if (ASCII_BYTE_P (*p)) 9288 if (ASCII_CHAR_P (*p))
9294 p++; 9289 p++;
9295 else 9290 else
9296 { 9291 {
@@ -9598,7 +9593,7 @@ Return the corresponding character. */)
9598 CHECK_CODING_SYSTEM_GET_SPEC (Vsjis_coding_system, spec); 9593 CHECK_CODING_SYSTEM_GET_SPEC (Vsjis_coding_system, spec);
9599 attrs = AREF (spec, 0); 9594 attrs = AREF (spec, 0);
9600 9595
9601 if (ASCII_BYTE_P (ch) 9596 if (ASCII_CHAR_P (ch)
9602 && ! NILP (CODING_ATTR_ASCII_COMPAT (attrs))) 9597 && ! NILP (CODING_ATTR_ASCII_COMPAT (attrs)))
9603 return code; 9598 return code;
9604 9599
@@ -9679,7 +9674,7 @@ Return the corresponding character. */)
9679 CHECK_CODING_SYSTEM_GET_SPEC (Vbig5_coding_system, spec); 9674 CHECK_CODING_SYSTEM_GET_SPEC (Vbig5_coding_system, spec);
9680 attrs = AREF (spec, 0); 9675 attrs = AREF (spec, 0);
9681 9676
9682 if (ASCII_BYTE_P (ch) 9677 if (ASCII_CHAR_P (ch)
9683 && ! NILP (CODING_ATTR_ASCII_COMPAT (attrs))) 9678 && ! NILP (CODING_ATTR_ASCII_COMPAT (attrs)))
9684 return code; 9679 return code;
9685 9680
diff --git a/src/commands.h b/src/commands.h
index 36e3518b5ea..1a09f683563 100644
--- a/src/commands.h
+++ b/src/commands.h
@@ -39,7 +39,3 @@ extern Lisp_Object unread_switch_frame;
39/* Nonzero if input is coming from the keyboard. */ 39/* Nonzero if input is coming from the keyboard. */
40 40
41#define INTERACTIVE (NILP (Vexecuting_kbd_macro) && !noninteractive) 41#define INTERACTIVE (NILP (Vexecuting_kbd_macro) && !noninteractive)
42
43/* Set this nonzero to force reconsideration of mode line. */
44
45extern int update_mode_lines;
diff --git a/src/composite.c b/src/composite.c
index fa882141908..66a20759ec6 100644
--- a/src/composite.c
+++ b/src/composite.c
@@ -921,17 +921,18 @@ autocmp_chars (Lisp_Object rule, ptrdiff_t charpos, ptrdiff_t bytepos,
921 return unbind_to (count, lgstring); 921 return unbind_to (count, lgstring);
922} 922}
923 923
924static Lisp_Object _work_val;
925
926/* 1 iff the character C is composable. Characters of general 924/* 1 iff the character C is composable. Characters of general
927 category Z? or C? are not composable except for ZWNJ and ZWJ. */ 925 category Z? or C? are not composable except for ZWNJ and ZWJ. */
928 926
929#define CHAR_COMPOSABLE_P(C) \ 927static bool
930 ((C) > ' ' \ 928char_composable_p (int c)
931 && ((C) == 0x200C || (C) == 0x200D \ 929{
932 || (_work_val = CHAR_TABLE_REF (Vunicode_category_table, (C)), \ 930 Lisp_Object val;
933 (INTEGERP (_work_val) \ 931 return (c > ' '
934 && (XINT (_work_val) <= UNICODE_CATEGORY_So))))) 932 && (c == 0x200C || c == 0x200D
933 || (val = CHAR_TABLE_REF (Vunicode_category_table, c),
934 (INTEGERP (val) && (XINT (val) <= UNICODE_CATEGORY_So)))));
935}
935 936
936/* Update cmp_it->stop_pos to the next position after CHARPOS (and 937/* Update cmp_it->stop_pos to the next position after CHARPOS (and
937 BYTEPOS) where character composition may happen. If BYTEPOS is 938 BYTEPOS) where character composition may happen. If BYTEPOS is
@@ -1067,7 +1068,7 @@ composition_compute_stop_pos (struct composition_it *cmp_it, ptrdiff_t charpos,
1067 p = SDATA (string) + bytepos; 1068 p = SDATA (string) + bytepos;
1068 c = STRING_CHAR_AND_LENGTH (p, len); 1069 c = STRING_CHAR_AND_LENGTH (p, len);
1069 limit = bytepos + len; 1070 limit = bytepos + len;
1070 while (CHAR_COMPOSABLE_P (c)) 1071 while (char_composable_p (c))
1071 { 1072 {
1072 val = CHAR_TABLE_REF (Vcomposition_function_table, c); 1073 val = CHAR_TABLE_REF (Vcomposition_function_table, c);
1073 if (! NILP (val)) 1074 if (! NILP (val))
@@ -1144,7 +1145,7 @@ composition_compute_stop_pos (struct composition_it *cmp_it, ptrdiff_t charpos,
1144 /* Skip all uncomposable characters. */ 1145 /* Skip all uncomposable characters. */
1145 if (NILP (string)) 1146 if (NILP (string))
1146 { 1147 {
1147 while (charpos - 1 > endpos && ! CHAR_COMPOSABLE_P (c)) 1148 while (charpos - 1 > endpos && ! char_composable_p (c))
1148 { 1149 {
1149 DEC_BOTH (charpos, bytepos); 1150 DEC_BOTH (charpos, bytepos);
1150 c = FETCH_MULTIBYTE_CHAR (bytepos); 1151 c = FETCH_MULTIBYTE_CHAR (bytepos);
@@ -1152,7 +1153,7 @@ composition_compute_stop_pos (struct composition_it *cmp_it, ptrdiff_t charpos,
1152 } 1153 }
1153 else 1154 else
1154 { 1155 {
1155 while (charpos - 1 > endpos && ! CHAR_COMPOSABLE_P (c)) 1156 while (charpos - 1 > endpos && ! char_composable_p (c))
1156 { 1157 {
1157 p--; 1158 p--;
1158 while (! CHAR_HEAD_P (*p)) 1159 while (! CHAR_HEAD_P (*p))
@@ -1486,7 +1487,7 @@ find_automatic_composition (ptrdiff_t pos, ptrdiff_t limit,
1486 |-B-|-C-|--D--| 1487 |-B-|-C-|--D--|
1487 1488
1488 Here, it is known that characters after positions 1 and 9 can 1489 Here, it is known that characters after positions 1 and 9 can
1489 never be composed (i.e. ! CHAR_COMPOSABLE_P (CH)), and 1490 never be composed (i.e. ! char_composable_p (CH)), and
1490 composition A is an invalid one because it's partially covered by 1491 composition A is an invalid one because it's partially covered by
1491 the valid composition C. And to know whether a composition is 1492 the valid composition C. And to know whether a composition is
1492 valid or not, the only way is to start searching forward from a 1493 valid or not, the only way is to start searching forward from a
@@ -1510,7 +1511,7 @@ find_automatic_composition (ptrdiff_t pos, ptrdiff_t limit,
1510 while (1) 1511 while (1)
1511 { 1512 {
1512 c = STRING_CHAR (cur.p); 1513 c = STRING_CHAR (cur.p);
1513 if (! CHAR_COMPOSABLE_P (c)) 1514 if (! char_composable_p (c))
1514 { 1515 {
1515 if (limit <= pos) /* case (1) */ 1516 if (limit <= pos) /* case (1) */
1516 { 1517 {
@@ -1519,7 +1520,7 @@ find_automatic_composition (ptrdiff_t pos, ptrdiff_t limit,
1519 return 0; 1520 return 0;
1520 BACKWARD_CHAR (cur, stop); 1521 BACKWARD_CHAR (cur, stop);
1521 c = STRING_CHAR (cur.p); 1522 c = STRING_CHAR (cur.p);
1522 } while (! CHAR_COMPOSABLE_P (c)); 1523 } while (! char_composable_p (c));
1523 fore_check_limit = cur.pos + 1; 1524 fore_check_limit = cur.pos + 1;
1524 } 1525 }
1525 else /* case (2) */ 1526 else /* case (2) */
@@ -1535,7 +1536,7 @@ find_automatic_composition (ptrdiff_t pos, ptrdiff_t limit,
1535 prev = cur; 1536 prev = cur;
1536 BACKWARD_CHAR (cur, stop); 1537 BACKWARD_CHAR (cur, stop);
1537 c = STRING_CHAR (cur.p); 1538 c = STRING_CHAR (cur.p);
1538 if (! CHAR_COMPOSABLE_P (c)) 1539 if (! char_composable_p (c))
1539 { 1540 {
1540 cur = prev; 1541 cur = prev;
1541 break; 1542 break;
@@ -1683,9 +1684,10 @@ Otherwise (for terminal display), FONT-OBJECT must be a terminal ID, a
1683frame, or nil for the selected frame's terminal device. 1684frame, or nil for the selected frame's terminal device.
1684 1685
1685If the optional 4th argument STRING is not nil, it is a string 1686If the optional 4th argument STRING is not nil, it is a string
1686containing the target characters between indices FROM and TO. 1687containing the target characters between indices FROM and TO,
1687Otherwise FROM and TO are character positions in current buffer; 1688which are treated as in `substring'. Otherwise FROM and TO are
1688they can be in either order, and can be integers or markers. 1689character positions in current buffer; they can be in either order,
1690and can be integers or markers.
1689 1691
1690A glyph-string is a vector containing information about how to display 1692A glyph-string is a vector containing information about how to display
1691a specific character sequence. The format is: 1693a specific character sequence. The format is:
@@ -1741,15 +1743,10 @@ should be ignored. */)
1741 } 1743 }
1742 else 1744 else
1743 { 1745 {
1744 CHECK_NATNUM (from);
1745 CHECK_NATNUM (to);
1746 CHECK_STRING (string); 1746 CHECK_STRING (string);
1747 validate_subarray (string, from, to, SCHARS (string), &frompos, &topos);
1747 if (! STRING_MULTIBYTE (string)) 1748 if (! STRING_MULTIBYTE (string))
1748 error ("Attempt to shape unibyte text"); 1749 error ("Attempt to shape unibyte text");
1749 if (! (XINT (from) <= XINT (to) && XINT (to) <= SCHARS (string)))
1750 args_out_of_range_3 (string, from, to);
1751 frompos = XFASTINT (from);
1752 topos = XFASTINT (to);
1753 frombyte = string_char_to_byte (string, frompos); 1750 frombyte = string_char_to_byte (string, frompos);
1754 } 1751 }
1755 1752
@@ -1794,21 +1791,18 @@ DEFUN ("compose-string-internal", Fcompose_string_internal,
1794 Scompose_string_internal, 3, 5, 0, 1791 Scompose_string_internal, 3, 5, 0,
1795 doc: /* Internal use only. 1792 doc: /* Internal use only.
1796 1793
1797Compose text between indices START and END of STRING. 1794Compose text between indices START and END of STRING, where
1798Optional 4th and 5th arguments are COMPONENTS and MODIFICATION-FUNC 1795START and END are treated as in `substring'. Optional 4th
1796and 5th arguments are COMPONENTS and MODIFICATION-FUNC
1799for the composition. See `compose-string' for more details. */) 1797for the composition. See `compose-string' for more details. */)
1800 (Lisp_Object string, Lisp_Object start, Lisp_Object end, Lisp_Object components, Lisp_Object modification_func) 1798 (Lisp_Object string, Lisp_Object start, Lisp_Object end,
1799 Lisp_Object components, Lisp_Object modification_func)
1801{ 1800{
1802 CHECK_STRING (string); 1801 ptrdiff_t from, to;
1803 CHECK_NUMBER (start);
1804 CHECK_NUMBER (end);
1805 1802
1806 if (XINT (start) < 0 || 1803 CHECK_STRING (string);
1807 XINT (start) > XINT (end) 1804 validate_subarray (string, start, end, SCHARS (string), &from, &to);
1808 || XINT (end) > SCHARS (string)) 1805 compose_text (from, to, components, modification_func, string);
1809 args_out_of_range (start, end);
1810
1811 compose_text (XINT (start), XINT (end), components, modification_func, string);
1812 return string; 1806 return string;
1813} 1807}
1814 1808
diff --git a/src/dispextern.h b/src/dispextern.h
index e710f8e35d7..5396aeb6c8e 100644
--- a/src/dispextern.h
+++ b/src/dispextern.h
@@ -2591,7 +2591,8 @@ struct it
2591 int vpos; 2591 int vpos;
2592 2592
2593 /* Horizontal matrix position reached in move_it_in_display_line. 2593 /* Horizontal matrix position reached in move_it_in_display_line.
2594 Only set there, not in display_line. */ 2594 Only set there, not in display_line, and only when the X
2595 coordinate is past first_visible_x. */
2595 int hpos; 2596 int hpos;
2596 2597
2597 /* Left fringe bitmap number (enum fringe_bitmap_type). */ 2598 /* Left fringe bitmap number (enum fringe_bitmap_type). */
diff --git a/src/editfns.c b/src/editfns.c
index 9c1fcb0b790..e8d4478f2f6 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -2238,7 +2238,7 @@ general_insert_function (void (*insert_func)
2238 len = CHAR_STRING (c, str); 2238 len = CHAR_STRING (c, str);
2239 else 2239 else
2240 { 2240 {
2241 str[0] = ASCII_CHAR_P (c) ? c : multibyte_char_to_unibyte (c); 2241 str[0] = CHAR_TO_BYTE8 (c);
2242 len = 1; 2242 len = 1;
2243 } 2243 }
2244 (*insert_func) ((char *) str, len); 2244 (*insert_func) ((char *) str, len);
@@ -2852,7 +2852,7 @@ Both characters must have the same length of multi-byte form. */)
2852 len = CHAR_STRING (fromc, fromstr); 2852 len = CHAR_STRING (fromc, fromstr);
2853 if (CHAR_STRING (toc, tostr) != len) 2853 if (CHAR_STRING (toc, tostr) != len)
2854 error ("Characters in `subst-char-in-region' have different byte-lengths"); 2854 error ("Characters in `subst-char-in-region' have different byte-lengths");
2855 if (!ASCII_BYTE_P (*tostr)) 2855 if (!ASCII_CHAR_P (*tostr))
2856 { 2856 {
2857 /* If *TOSTR is in the range 0x80..0x9F and TOCHAR is not a 2857 /* If *TOSTR is in the range 0x80..0x9F and TOCHAR is not a
2858 complete multibyte character, it may be combined with the 2858 complete multibyte character, it may be combined with the
@@ -2945,7 +2945,7 @@ Both characters must have the same length of multi-byte form. */)
2945 : ((pos_byte_next < Z_BYTE 2945 : ((pos_byte_next < Z_BYTE
2946 && ! CHAR_HEAD_P (FETCH_BYTE (pos_byte_next))) 2946 && ! CHAR_HEAD_P (FETCH_BYTE (pos_byte_next)))
2947 || (pos_byte > BEG_BYTE 2947 || (pos_byte > BEG_BYTE
2948 && ! ASCII_BYTE_P (FETCH_BYTE (pos_byte - 1)))))) 2948 && ! ASCII_CHAR_P (FETCH_BYTE (pos_byte - 1))))))
2949 { 2949 {
2950 Lisp_Object tem, string; 2950 Lisp_Object tem, string;
2951 2951
@@ -3126,7 +3126,7 @@ It returns the number of characters changed. */)
3126 else 3126 else
3127 { 3127 {
3128 nc = tt[oc]; 3128 nc = tt[oc];
3129 if (! ASCII_BYTE_P (nc) && multibyte) 3129 if (! ASCII_CHAR_P (nc) && multibyte)
3130 { 3130 {
3131 str_len = BYTE8_STRING (nc, buf); 3131 str_len = BYTE8_STRING (nc, buf);
3132 str = buf; 3132 str = buf;
@@ -3600,7 +3600,7 @@ specifier truncates the string to the given width.
3600usage: (format STRING &rest OBJECTS) */) 3600usage: (format STRING &rest OBJECTS) */)
3601 (ptrdiff_t nargs, Lisp_Object *args) 3601 (ptrdiff_t nargs, Lisp_Object *args)
3602{ 3602{
3603 ptrdiff_t n; /* The number of the next arg to substitute */ 3603 ptrdiff_t n; /* The number of the next arg to substitute. */
3604 char initial_buffer[4000]; 3604 char initial_buffer[4000];
3605 char *buf = initial_buffer; 3605 char *buf = initial_buffer;
3606 ptrdiff_t bufsize = sizeof initial_buffer; 3606 ptrdiff_t bufsize = sizeof initial_buffer;
@@ -3877,7 +3877,7 @@ usage: (format STRING &rest OBJECTS) */)
3877 3877
3878 if (p > buf 3878 if (p > buf
3879 && multibyte 3879 && multibyte
3880 && !ASCII_BYTE_P (*((unsigned char *) p - 1)) 3880 && !ASCII_CHAR_P (*((unsigned char *) p - 1))
3881 && STRING_MULTIBYTE (args[n]) 3881 && STRING_MULTIBYTE (args[n])
3882 && !CHAR_HEAD_P (SREF (args[n], 0))) 3882 && !CHAR_HEAD_P (SREF (args[n], 0)))
3883 maybe_combine_byte = 1; 3883 maybe_combine_byte = 1;
@@ -4167,7 +4167,7 @@ usage: (format STRING &rest OBJECTS) */)
4167 { 4167 {
4168 /* Copy a whole multibyte character. */ 4168 /* Copy a whole multibyte character. */
4169 if (p > buf 4169 if (p > buf
4170 && !ASCII_BYTE_P (*((unsigned char *) p - 1)) 4170 && !ASCII_CHAR_P (*((unsigned char *) p - 1))
4171 && !CHAR_HEAD_P (*format)) 4171 && !CHAR_HEAD_P (*format))
4172 maybe_combine_byte = 1; 4172 maybe_combine_byte = 1;
4173 4173
@@ -4181,7 +4181,7 @@ usage: (format STRING &rest OBJECTS) */)
4181 else 4181 else
4182 { 4182 {
4183 unsigned char uc = *format++; 4183 unsigned char uc = *format++;
4184 if (! multibyte || ASCII_BYTE_P (uc)) 4184 if (! multibyte || ASCII_CHAR_P (uc))
4185 convbytes = 1; 4185 convbytes = 1;
4186 else 4186 else
4187 { 4187 {
diff --git a/src/eval.c b/src/eval.c
index a96d413d09f..7d54ddb18f5 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -27,11 +27,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
27#include "commands.h" 27#include "commands.h"
28#include "keyboard.h" 28#include "keyboard.h"
29#include "dispextern.h" 29#include "dispextern.h"
30#include "frame.h" /* For XFRAME. */
31
32#if HAVE_X_WINDOWS
33#include "xterm.h"
34#endif
35 30
36/* Chain of condition and catch handlers currently in effect. */ 31/* Chain of condition and catch handlers currently in effect. */
37 32
diff --git a/src/fileio.c b/src/fileio.c
index dc3ed431d40..f0bd75b170e 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -990,7 +990,7 @@ filesystem tree, not (expand-file-name ".." dirname). */)
990 { 990 {
991 unsigned char *p = SDATA (name); 991 unsigned char *p = SDATA (name);
992 992
993 while (*p && ASCII_BYTE_P (*p)) 993 while (*p && ASCII_CHAR_P (*p))
994 p++; 994 p++;
995 if (*p == '\0') 995 if (*p == '\0')
996 { 996 {
@@ -3013,6 +3013,9 @@ was unable to determine the ACL entries. */)
3013 acl_t acl; 3013 acl_t acl;
3014 Lisp_Object acl_string; 3014 Lisp_Object acl_string;
3015 char *str; 3015 char *str;
3016# ifndef HAVE_ACL_TYPE_EXTENDED
3017 acl_type_t ACL_TYPE_EXTENDED = ACL_TYPE_ACCESS;
3018# endif
3016#endif 3019#endif
3017 3020
3018 absname = expand_and_dir_to_file (filename, 3021 absname = expand_and_dir_to_file (filename,
@@ -3027,7 +3030,7 @@ was unable to determine the ACL entries. */)
3027#ifdef HAVE_ACL_SET_FILE 3030#ifdef HAVE_ACL_SET_FILE
3028 absname = ENCODE_FILE (absname); 3031 absname = ENCODE_FILE (absname);
3029 3032
3030 acl = acl_get_file (SSDATA (absname), ACL_TYPE_ACCESS); 3033 acl = acl_get_file (SSDATA (absname), ACL_TYPE_EXTENDED);
3031 if (acl == NULL) 3034 if (acl == NULL)
3032 return Qnil; 3035 return Qnil;
3033 3036
@@ -5762,24 +5765,6 @@ before any other event (mouse or keypress) is handled. */)
5762 return Qnil; 5765 return Qnil;
5763} 5766}
5764 5767
5765Lisp_Object
5766Fread_file_name (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object initial, Lisp_Object predicate)
5767{
5768 struct gcpro gcpro1;
5769 Lisp_Object args[7];
5770
5771 GCPRO1 (default_filename);
5772 args[0] = intern ("read-file-name");
5773 args[1] = prompt;
5774 args[2] = dir;
5775 args[3] = default_filename;
5776 args[4] = mustmatch;
5777 args[5] = initial;
5778 args[6] = predicate;
5779 RETURN_UNGCPRO (Ffuncall (7, args));
5780}
5781
5782
5783void 5768void
5784init_fileio (void) 5769init_fileio (void)
5785{ 5770{
diff --git a/src/fns.c b/src/fns.c
index 5074ae3b41b..887a856f224 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -50,7 +50,7 @@ static Lisp_Object Qcodeset, Qdays, Qmonths, Qpaper;
50static Lisp_Object Qmd5, Qsha1, Qsha224, Qsha256, Qsha384, Qsha512; 50static Lisp_Object Qmd5, Qsha1, Qsha224, Qsha256, Qsha384, Qsha512;
51 51
52static bool internal_equal (Lisp_Object, Lisp_Object, int, bool, Lisp_Object); 52static bool internal_equal (Lisp_Object, Lisp_Object, int, bool, Lisp_Object);
53 53
54DEFUN ("identity", Fidentity, Sidentity, 1, 1, 0, 54DEFUN ("identity", Fidentity, Sidentity, 1, 1, 0,
55 doc: /* Return the argument unchanged. */) 55 doc: /* Return the argument unchanged. */)
56 (Lisp_Object arg) 56 (Lisp_Object arg)
@@ -232,6 +232,7 @@ string STR1, compare the part between START1 (inclusive) and END1
232\(exclusive). If START1 is nil, it defaults to 0, the beginning of 232\(exclusive). If START1 is nil, it defaults to 0, the beginning of
233the string; if END1 is nil, it defaults to the length of the string. 233the string; if END1 is nil, it defaults to the length of the string.
234Likewise, in string STR2, compare the part between START2 and END2. 234Likewise, in string STR2, compare the part between START2 and END2.
235Like in `substring', negative values are counted from the end.
235 236
236The strings are compared by the numeric values of their characters. 237The strings are compared by the numeric values of their characters.
237For instance, STR1 is "less than" STR2 if its first differing 238For instance, STR1 is "less than" STR2 if its first differing
@@ -244,75 +245,39 @@ If string STR1 is less, the value is a negative number N;
244 - 1 - N is the number of characters that match at the beginning. 245 - 1 - N is the number of characters that match at the beginning.
245If string STR1 is greater, the value is a positive number N; 246If string STR1 is greater, the value is a positive number N;
246 N - 1 is the number of characters that match at the beginning. */) 247 N - 1 is the number of characters that match at the beginning. */)
247 (Lisp_Object str1, Lisp_Object start1, Lisp_Object end1, Lisp_Object str2, Lisp_Object start2, Lisp_Object end2, Lisp_Object ignore_case) 248 (Lisp_Object str1, Lisp_Object start1, Lisp_Object end1, Lisp_Object str2,
249 Lisp_Object start2, Lisp_Object end2, Lisp_Object ignore_case)
248{ 250{
249 register ptrdiff_t end1_char, end2_char; 251 ptrdiff_t from1, to1, from2, to2, i1, i1_byte, i2, i2_byte;
250 register ptrdiff_t i1, i1_byte, i2, i2_byte;
251 252
252 CHECK_STRING (str1); 253 CHECK_STRING (str1);
253 CHECK_STRING (str2); 254 CHECK_STRING (str2);
254 if (NILP (start1)) 255
255 start1 = make_number (0); 256 validate_subarray (str1, start1, end1, SCHARS (str1), &from1, &to1);
256 if (NILP (start2)) 257 validate_subarray (str2, start2, end2, SCHARS (str2), &from2, &to2);
257 start2 = make_number (0); 258
258 CHECK_NATNUM (start1); 259 i1 = from1;
259 CHECK_NATNUM (start2); 260 i2 = from2;
260 if (! NILP (end1))
261 CHECK_NATNUM (end1);
262 if (! NILP (end2))
263 CHECK_NATNUM (end2);
264
265 end1_char = SCHARS (str1);
266 if (! NILP (end1) && end1_char > XINT (end1))
267 end1_char = XINT (end1);
268 if (end1_char < XINT (start1))
269 args_out_of_range (str1, start1);
270
271 end2_char = SCHARS (str2);
272 if (! NILP (end2) && end2_char > XINT (end2))
273 end2_char = XINT (end2);
274 if (end2_char < XINT (start2))
275 args_out_of_range (str2, start2);
276
277 i1 = XINT (start1);
278 i2 = XINT (start2);
279 261
280 i1_byte = string_char_to_byte (str1, i1); 262 i1_byte = string_char_to_byte (str1, i1);
281 i2_byte = string_char_to_byte (str2, i2); 263 i2_byte = string_char_to_byte (str2, i2);
282 264
283 while (i1 < end1_char && i2 < end2_char) 265 while (i1 < to1 && i2 < to2)
284 { 266 {
285 /* When we find a mismatch, we must compare the 267 /* When we find a mismatch, we must compare the
286 characters, not just the bytes. */ 268 characters, not just the bytes. */
287 int c1, c2; 269 int c1, c2;
288 270
289 if (STRING_MULTIBYTE (str1)) 271 FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE (c1, str1, i1, i1_byte);
290 FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c1, str1, i1, i1_byte); 272 FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE (c2, str2, i2, i2_byte);
291 else
292 {
293 c1 = SREF (str1, i1++);
294 MAKE_CHAR_MULTIBYTE (c1);
295 }
296
297 if (STRING_MULTIBYTE (str2))
298 FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c2, str2, i2, i2_byte);
299 else
300 {
301 c2 = SREF (str2, i2++);
302 MAKE_CHAR_MULTIBYTE (c2);
303 }
304 273
305 if (c1 == c2) 274 if (c1 == c2)
306 continue; 275 continue;
307 276
308 if (! NILP (ignore_case)) 277 if (! NILP (ignore_case))
309 { 278 {
310 Lisp_Object tem; 279 c1 = XINT (Fupcase (make_number (c1)));
311 280 c2 = XINT (Fupcase (make_number (c2)));
312 tem = Fupcase (make_number (c1));
313 c1 = XINT (tem);
314 tem = Fupcase (make_number (c2));
315 c2 = XINT (tem);
316 } 281 }
317 282
318 if (c1 == c2) 283 if (c1 == c2)
@@ -322,15 +287,15 @@ If string STR1 is greater, the value is a positive number N;
322 past the character that we are comparing; 287 past the character that we are comparing;
323 hence we don't add or subtract 1 here. */ 288 hence we don't add or subtract 1 here. */
324 if (c1 < c2) 289 if (c1 < c2)
325 return make_number (- i1 + XINT (start1)); 290 return make_number (- i1 + from1);
326 else 291 else
327 return make_number (i1 - XINT (start1)); 292 return make_number (i1 - from1);
328 } 293 }
329 294
330 if (i1 < end1_char) 295 if (i1 < to1)
331 return make_number (i1 - XINT (start1) + 1); 296 return make_number (i1 - from1 + 1);
332 if (i2 < end2_char) 297 if (i2 < to2)
333 return make_number (- i1 + XINT (start1) - 1); 298 return make_number (- i1 + from1 - 1);
334 299
335 return Qt; 300 return Qt;
336} 301}
@@ -1133,9 +1098,9 @@ Elements of ALIST that are not conses are also shared. */)
1133 Count negative values backwards from the end. 1098 Count negative values backwards from the end.
1134 Set *IFROM and *ITO to the two indexes used. */ 1099 Set *IFROM and *ITO to the two indexes used. */
1135 1100
1136static void 1101void
1137validate_subarray (Lisp_Object array, Lisp_Object from, Lisp_Object to, 1102validate_subarray (Lisp_Object array, Lisp_Object from, Lisp_Object to,
1138 ptrdiff_t size, EMACS_INT *ifrom, EMACS_INT *ito) 1103 ptrdiff_t size, ptrdiff_t *ifrom, ptrdiff_t *ito)
1139{ 1104{
1140 EMACS_INT f, t; 1105 EMACS_INT f, t;
1141 1106
@@ -1184,8 +1149,7 @@ With one argument, just copy STRING (with properties, if any). */)
1184 (Lisp_Object string, Lisp_Object from, Lisp_Object to) 1149 (Lisp_Object string, Lisp_Object from, Lisp_Object to)
1185{ 1150{
1186 Lisp_Object res; 1151 Lisp_Object res;
1187 ptrdiff_t size; 1152 ptrdiff_t size, ifrom, ito;
1188 EMACS_INT ifrom, ito;
1189 1153
1190 if (STRINGP (string)) 1154 if (STRINGP (string))
1191 size = SCHARS (string); 1155 size = SCHARS (string);
@@ -1225,9 +1189,7 @@ If FROM or TO is negative, it counts from the end.
1225With one argument, just copy STRING without its properties. */) 1189With one argument, just copy STRING without its properties. */)
1226 (Lisp_Object string, register Lisp_Object from, Lisp_Object to) 1190 (Lisp_Object string, register Lisp_Object from, Lisp_Object to)
1227{ 1191{
1228 ptrdiff_t size; 1192 ptrdiff_t from_char, to_char, from_byte, to_byte, size;
1229 EMACS_INT from_char, to_char;
1230 ptrdiff_t from_byte, to_byte;
1231 1193
1232 CHECK_STRING (string); 1194 CHECK_STRING (string);
1233 1195
@@ -4656,12 +4618,12 @@ returns nil, then (funcall TEST x1 x2) also returns nil. */)
4656/* ALGORITHM is a symbol: md5, sha1, sha224 and so on. */ 4618/* ALGORITHM is a symbol: md5, sha1, sha224 and so on. */
4657 4619
4658static Lisp_Object 4620static Lisp_Object
4659secure_hash (Lisp_Object algorithm, Lisp_Object object, Lisp_Object start, Lisp_Object end, Lisp_Object coding_system, Lisp_Object noerror, Lisp_Object binary) 4621secure_hash (Lisp_Object algorithm, Lisp_Object object, Lisp_Object start,
4622 Lisp_Object end, Lisp_Object coding_system, Lisp_Object noerror,
4623 Lisp_Object binary)
4660{ 4624{
4661 int i; 4625 int i;
4662 ptrdiff_t size; 4626 ptrdiff_t size, start_char = 0, start_byte, end_char = 0, end_byte;
4663 EMACS_INT start_char = 0, end_char = 0;
4664 ptrdiff_t start_byte, end_byte;
4665 register EMACS_INT b, e; 4627 register EMACS_INT b, e;
4666 register struct buffer *bp; 4628 register struct buffer *bp;
4667 EMACS_INT temp; 4629 EMACS_INT temp;
diff --git a/src/font.c b/src/font.c
index 6113e1c3e71..251d43ba8b2 100644
--- a/src/font.c
+++ b/src/font.c
@@ -207,6 +207,9 @@ font_make_object (int size, Lisp_Object entity, int pixelsize)
207 = (struct font *) allocate_pseudovector (size, FONT_OBJECT_MAX, PVEC_FONT); 207 = (struct font *) allocate_pseudovector (size, FONT_OBJECT_MAX, PVEC_FONT);
208 int i; 208 int i;
209 209
210 /* GC can happen before the driver is set up,
211 so avoid dangling pointer here (Bug#17771). */
212 font->driver = NULL;
210 XSETFONT (font_object, font); 213 XSETFONT (font_object, font);
211 214
212 if (! NILP (entity)) 215 if (! NILP (entity))
@@ -279,10 +282,8 @@ font_intern_prop (const char *str, ptrdiff_t len, bool force_symbol)
279 282
280 if (SYMBOLP (tem)) 283 if (SYMBOLP (tem))
281 return tem; 284 return tem;
282 if (len == nchars || len != nbytes) 285 tem = make_specified_string (str, nchars, len,
283 tem = make_unibyte_string (str, len); 286 len != nchars && len == nbytes);
284 else
285 tem = make_multibyte_string (str, nchars, len);
286 return Fintern (tem, obarray); 287 return Fintern (tem, obarray);
287} 288}
288 289
diff --git a/src/fontset.c b/src/fontset.c
index 13f5357be64..e34719e5cdf 100644
--- a/src/fontset.c
+++ b/src/fontset.c
@@ -209,27 +209,27 @@ set_fontset_name (Lisp_Object fontset, Lisp_Object name)
209 set_char_table_extras (fontset, 1, name); 209 set_char_table_extras (fontset, 1, name);
210} 210}
211 211
212#define FONTSET_ASCII(fontset) XCHAR_TABLE (fontset)->extras[4] 212#define FONTSET_ASCII(fontset) XCHAR_TABLE (fontset)->extras[2]
213static void 213static void
214set_fontset_ascii (Lisp_Object fontset, Lisp_Object ascii) 214set_fontset_ascii (Lisp_Object fontset, Lisp_Object ascii)
215{ 215{
216 set_char_table_extras (fontset, 4, ascii); 216 set_char_table_extras (fontset, 2, ascii);
217} 217}
218 218
219/* Access special values of (realized) FONTSET. */ 219/* Access special values of (realized) FONTSET. */
220 220
221#define FONTSET_BASE(fontset) XCHAR_TABLE (fontset)->extras[2] 221#define FONTSET_BASE(fontset) XCHAR_TABLE (fontset)->extras[3]
222static void 222static void
223set_fontset_base (Lisp_Object fontset, Lisp_Object base) 223set_fontset_base (Lisp_Object fontset, Lisp_Object base)
224{ 224{
225 set_char_table_extras (fontset, 2, base); 225 set_char_table_extras (fontset, 3, base);
226} 226}
227 227
228#define FONTSET_FRAME(fontset) XCHAR_TABLE (fontset)->extras[3] 228#define FONTSET_FRAME(fontset) XCHAR_TABLE (fontset)->extras[4]
229static void 229static void
230set_fontset_frame (Lisp_Object fontset, Lisp_Object frame) 230set_fontset_frame (Lisp_Object fontset, Lisp_Object frame)
231{ 231{
232 set_char_table_extras (fontset, 3, frame); 232 set_char_table_extras (fontset, 4, frame);
233} 233}
234 234
235#define FONTSET_NOFONT_FACE(fontset) XCHAR_TABLE (fontset)->extras[5] 235#define FONTSET_NOFONT_FACE(fontset) XCHAR_TABLE (fontset)->extras[5]
@@ -239,20 +239,20 @@ set_fontset_nofont_face (Lisp_Object fontset, Lisp_Object face)
239 set_char_table_extras (fontset, 5, face); 239 set_char_table_extras (fontset, 5, face);
240} 240}
241 241
242#define FONTSET_DEFAULT(fontset) XCHAR_TABLE (fontset)->extras[7] 242#define FONTSET_DEFAULT(fontset) XCHAR_TABLE (fontset)->extras[6]
243static void 243static void
244set_fontset_default (Lisp_Object fontset, Lisp_Object def) 244set_fontset_default (Lisp_Object fontset, Lisp_Object def)
245{ 245{
246 set_char_table_extras (fontset, 7, def); 246 set_char_table_extras (fontset, 6, def);
247} 247}
248 248
249/* For both base and realized fontset. */ 249/* For both base and realized fontset. */
250 250
251#define FONTSET_FALLBACK(fontset) XCHAR_TABLE (fontset)->extras[8] 251#define FONTSET_FALLBACK(fontset) XCHAR_TABLE (fontset)->extras[7]
252static void 252static void
253set_fontset_fallback (Lisp_Object fontset, Lisp_Object fallback) 253set_fontset_fallback (Lisp_Object fontset, Lisp_Object fallback)
254{ 254{
255 set_char_table_extras (fontset, 8, fallback); 255 set_char_table_extras (fontset, 7, fallback);
256} 256}
257 257
258#define BASE_FONTSET_P(fontset) (NILP (FONTSET_BASE (fontset))) 258#define BASE_FONTSET_P(fontset) (NILP (FONTSET_BASE (fontset)))
@@ -852,21 +852,6 @@ fontset_ascii (int id)
852 return elt; 852 return elt;
853} 853}
854 854
855static void
856free_realized_fontset (struct frame *f, Lisp_Object fontset)
857{
858#if 0
859 Lisp_Object tail;
860
861 if (0)
862 for (tail = FONTSET_OBJLIST (fontset); CONSP (tail); tail = XCDR (tail))
863 {
864 eassert (FONT_OBJECT_P (XCAR (tail)));
865 font_close_object (f, XCAR (tail));
866 }
867#endif
868}
869
870/* Free fontset of FACE defined on frame F. Called from 855/* Free fontset of FACE defined on frame F. Called from
871 free_realized_face. */ 856 free_realized_face. */
872 857
@@ -880,7 +865,6 @@ free_face_fontset (struct frame *f, struct face *face)
880 return; 865 return;
881 eassert (! BASE_FONTSET_P (fontset)); 866 eassert (! BASE_FONTSET_P (fontset));
882 eassert (f == XFRAME (FONTSET_FRAME (fontset))); 867 eassert (f == XFRAME (FONTSET_FRAME (fontset)));
883 free_realized_fontset (f, fontset);
884 ASET (Vfontset_table, face->fontset, Qnil); 868 ASET (Vfontset_table, face->fontset, Qnil);
885 if (face->fontset < next_fontset_id) 869 if (face->fontset < next_fontset_id)
886 next_fontset_id = face->fontset; 870 next_fontset_id = face->fontset;
@@ -891,7 +875,6 @@ free_face_fontset (struct frame *f, struct face *face)
891 fontset = AREF (Vfontset_table, id); 875 fontset = AREF (Vfontset_table, id);
892 eassert (!NILP (fontset) && ! BASE_FONTSET_P (fontset)); 876 eassert (!NILP (fontset) && ! BASE_FONTSET_P (fontset));
893 eassert (f == XFRAME (FONTSET_FRAME (fontset))); 877 eassert (f == XFRAME (FONTSET_FRAME (fontset)));
894 free_realized_fontset (f, fontset);
895 ASET (Vfontset_table, id, Qnil); 878 ASET (Vfontset_table, id, Qnil);
896 if (id < next_fontset_id) 879 if (id < next_fontset_id)
897 next_fontset_id = face->fontset; 880 next_fontset_id = face->fontset;
@@ -2159,7 +2142,7 @@ void
2159syms_of_fontset (void) 2142syms_of_fontset (void)
2160{ 2143{
2161 DEFSYM (Qfontset, "fontset"); 2144 DEFSYM (Qfontset, "fontset");
2162 Fput (Qfontset, Qchar_table_extra_slots, make_number (9)); 2145 Fput (Qfontset, Qchar_table_extra_slots, make_number (8));
2163 DEFSYM (Qfontset_info, "fontset-info"); 2146 DEFSYM (Qfontset_info, "fontset-info");
2164 Fput (Qfontset_info, Qchar_table_extra_slots, make_number (1)); 2147 Fput (Qfontset_info, Qchar_table_extra_slots, make_number (1));
2165 2148
diff --git a/src/frame.c b/src/frame.c
index af2d3c39164..c67a233f099 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -50,6 +50,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
50#include "msdos.h" 50#include "msdos.h"
51#include "dosfns.h" 51#include "dosfns.h"
52#endif 52#endif
53#ifdef USE_X_TOOLKIT
54#include "widget.h"
55#endif
53 56
54#ifdef HAVE_NS 57#ifdef HAVE_NS
55Lisp_Object Qns_parse_geometry; 58Lisp_Object Qns_parse_geometry;
diff --git a/src/frame.h b/src/frame.h
index 44b113e3416..2da9fff2d4a 100644
--- a/src/frame.h
+++ b/src/frame.h
@@ -1224,7 +1224,6 @@ extern Lisp_Object Qborder_color, Qborder_width;
1224extern Lisp_Object Qbuffer_predicate; 1224extern Lisp_Object Qbuffer_predicate;
1225extern Lisp_Object Qcursor_color, Qcursor_type; 1225extern Lisp_Object Qcursor_color, Qcursor_type;
1226extern Lisp_Object Qfont; 1226extern Lisp_Object Qfont;
1227extern Lisp_Object Qbackground_color, Qforeground_color;
1228extern Lisp_Object Qicon, Qicon_name, Qicon_type, Qicon_left, Qicon_top; 1227extern Lisp_Object Qicon, Qicon_name, Qicon_type, Qicon_left, Qicon_top;
1229extern Lisp_Object Qinternal_border_width; 1228extern Lisp_Object Qinternal_border_width;
1230extern Lisp_Object Qright_divider_width, Qbottom_divider_width; 1229extern Lisp_Object Qright_divider_width, Qbottom_divider_width;
@@ -1325,7 +1324,6 @@ extern void x_make_frame_visible (struct frame *f);
1325extern void x_make_frame_invisible (struct frame *f); 1324extern void x_make_frame_invisible (struct frame *f);
1326extern void x_iconify_frame (struct frame *f); 1325extern void x_iconify_frame (struct frame *f);
1327extern void x_set_frame_alpha (struct frame *f); 1326extern void x_set_frame_alpha (struct frame *f);
1328extern void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
1329extern void x_set_tool_bar_lines (struct frame *, Lisp_Object, Lisp_Object); 1327extern void x_set_tool_bar_lines (struct frame *, Lisp_Object, Lisp_Object);
1330extern void x_activate_menubar (struct frame *); 1328extern void x_activate_menubar (struct frame *);
1331extern void x_real_positions (struct frame *, int *, int *); 1329extern void x_real_positions (struct frame *, int *, int *);
diff --git a/src/ftfont.c b/src/ftfont.c
index 112adad8a10..0f23b086cf5 100644
--- a/src/ftfont.c
+++ b/src/ftfont.c
@@ -87,8 +87,6 @@ static Lisp_Object ftfont_lookup_cache (Lisp_Object,
87 87
88static void ftfont_filter_properties (Lisp_Object font, Lisp_Object alist); 88static void ftfont_filter_properties (Lisp_Object font, Lisp_Object alist);
89 89
90Lisp_Object ftfont_font_format (FcPattern *, Lisp_Object);
91
92#define SYMBOL_FcChar8(SYM) (FcChar8 *) SDATA (SYMBOL_NAME (SYM)) 90#define SYMBOL_FcChar8(SYM) (FcChar8 *) SDATA (SYMBOL_NAME (SYM))
93 91
94static struct 92static struct
diff --git a/src/image.c b/src/image.c
index 3220a45a282..b6d1f81ca06 100644
--- a/src/image.c
+++ b/src/image.c
@@ -7250,7 +7250,11 @@ gif_image_p (Lisp_Object object)
7250#ifdef WINDOWSNT 7250#ifdef WINDOWSNT
7251 7251
7252/* GIF library details. */ 7252/* GIF library details. */
7253#if 5 < GIFLIB_MAJOR + (1 <= GIFLIB_MINOR)
7254DEF_IMGLIB_FN (int, DGifCloseFile, (GifFileType *, int *));
7255#else
7253DEF_IMGLIB_FN (int, DGifCloseFile, (GifFileType *)); 7256DEF_IMGLIB_FN (int, DGifCloseFile, (GifFileType *));
7257#endif
7254DEF_IMGLIB_FN (int, DGifSlurp, (GifFileType *)); 7258DEF_IMGLIB_FN (int, DGifSlurp, (GifFileType *));
7255#if GIFLIB_MAJOR < 5 7259#if GIFLIB_MAJOR < 5
7256DEF_IMGLIB_FN (GifFileType *, DGifOpen, (void *, InputFunc)); 7260DEF_IMGLIB_FN (GifFileType *, DGifOpen, (void *, InputFunc));
@@ -7320,6 +7324,22 @@ gif_read_from_memory (GifFileType *file, GifByteType *buf, int len)
7320 return len; 7324 return len;
7321} 7325}
7322 7326
7327static int
7328gif_close (GifFileType *gif, int *err)
7329{
7330 int retval;
7331
7332#if 5 < GIFLIB_MAJOR + (1 <= GIFLIB_MINOR)
7333 retval = fn_DGifCloseFile (gif, err);
7334#else
7335 retval = fn_DGifCloseFile (gif);
7336#if GIFLIB_MAJOR >= 5
7337 if (err)
7338 *err = gif->Error;
7339#endif
7340#endif
7341 return retval;
7342}
7323 7343
7324/* Load GIF image IMG for use on frame F. Value is true if 7344/* Load GIF image IMG for use on frame F. Value is true if
7325 successful. */ 7345 successful. */
@@ -7344,9 +7364,7 @@ gif_load (struct frame *f, struct image *img)
7344 Lisp_Object specified_data = image_spec_value (img->spec, QCdata, NULL); 7364 Lisp_Object specified_data = image_spec_value (img->spec, QCdata, NULL);
7345 unsigned long bgcolor = 0; 7365 unsigned long bgcolor = 0;
7346 EMACS_INT idx; 7366 EMACS_INT idx;
7347#if GIFLIB_MAJOR >= 5
7348 int gif_err; 7367 int gif_err;
7349#endif
7350 7368
7351 if (NILP (specified_data)) 7369 if (NILP (specified_data))
7352 { 7370 {
@@ -7414,7 +7432,7 @@ gif_load (struct frame *f, struct image *img)
7414 if (!check_image_size (f, gif->SWidth, gif->SHeight)) 7432 if (!check_image_size (f, gif->SWidth, gif->SHeight))
7415 { 7433 {
7416 image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil); 7434 image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil);
7417 fn_DGifCloseFile (gif); 7435 gif_close (gif, NULL);
7418 return 0; 7436 return 0;
7419 } 7437 }
7420 7438
@@ -7423,7 +7441,7 @@ gif_load (struct frame *f, struct image *img)
7423 if (rc == GIF_ERROR || gif->ImageCount <= 0) 7441 if (rc == GIF_ERROR || gif->ImageCount <= 0)
7424 { 7442 {
7425 image_error ("Error reading `%s'", img->spec, Qnil); 7443 image_error ("Error reading `%s'", img->spec, Qnil);
7426 fn_DGifCloseFile (gif); 7444 gif_close (gif, NULL);
7427 return 0; 7445 return 0;
7428 } 7446 }
7429 7447
@@ -7435,7 +7453,7 @@ gif_load (struct frame *f, struct image *img)
7435 { 7453 {
7436 image_error ("Invalid image number `%s' in image `%s'", 7454 image_error ("Invalid image number `%s' in image `%s'",
7437 image_number, img->spec); 7455 image_number, img->spec);
7438 fn_DGifCloseFile (gif); 7456 gif_close (gif, NULL);
7439 return 0; 7457 return 0;
7440 } 7458 }
7441 } 7459 }
@@ -7453,7 +7471,7 @@ gif_load (struct frame *f, struct image *img)
7453 if (!check_image_size (f, width, height)) 7471 if (!check_image_size (f, width, height))
7454 { 7472 {
7455 image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil); 7473 image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil);
7456 fn_DGifCloseFile (gif); 7474 gif_close (gif, NULL);
7457 return 0; 7475 return 0;
7458 } 7476 }
7459 7477
@@ -7471,7 +7489,7 @@ gif_load (struct frame *f, struct image *img)
7471 && 0 <= subimg_left && subimg_left <= width - subimg_width)) 7489 && 0 <= subimg_left && subimg_left <= width - subimg_width))
7472 { 7490 {
7473 image_error ("Subimage does not fit in image", Qnil, Qnil); 7491 image_error ("Subimage does not fit in image", Qnil, Qnil);
7474 fn_DGifCloseFile (gif); 7492 gif_close (gif, NULL);
7475 return 0; 7493 return 0;
7476 } 7494 }
7477 } 7495 }
@@ -7479,7 +7497,7 @@ gif_load (struct frame *f, struct image *img)
7479 /* Create the X image and pixmap. */ 7497 /* Create the X image and pixmap. */
7480 if (!image_create_x_image_and_pixmap (f, img, width, height, 0, &ximg, 0)) 7498 if (!image_create_x_image_and_pixmap (f, img, width, height, 0, &ximg, 0))
7481 { 7499 {
7482 fn_DGifCloseFile (gif); 7500 gif_close (gif, NULL);
7483 return 0; 7501 return 0;
7484 } 7502 }
7485 7503
@@ -7650,7 +7668,18 @@ gif_load (struct frame *f, struct image *img)
7650 Fcons (make_number (gif->ImageCount), 7668 Fcons (make_number (gif->ImageCount),
7651 img->lisp_data)); 7669 img->lisp_data));
7652 7670
7653 fn_DGifCloseFile (gif); 7671 if (gif_close (gif, &gif_err) == GIF_ERROR)
7672 {
7673#if 5 <= GIFLIB_MAJOR
7674 char *error_text = fn_GifErrorString (gif_err);
7675
7676 if (error_text)
7677 image_error ("Error closing `%s': %s",
7678 img->spec, build_string (error_text));
7679#else
7680 image_error ("Error closing `%s'", img->spec, Qnil);
7681#endif
7682 }
7654 7683
7655 /* Maybe fill in the background field while we have ximg handy. */ 7684 /* Maybe fill in the background field while we have ximg handy. */
7656 if (NILP (image_spec_value (img->spec, QCbackground, NULL))) 7685 if (NILP (image_spec_value (img->spec, QCbackground, NULL)))
@@ -8520,7 +8549,6 @@ and `imagemagick-types-inhibit'. */)
8520 ExceptionInfo ex; 8549 ExceptionInfo ex;
8521 char **imtypes; 8550 char **imtypes;
8522 size_t i; 8551 size_t i;
8523 Lisp_Object Qimagemagicktype;
8524 8552
8525 GetExceptionInfo(&ex); 8553 GetExceptionInfo(&ex);
8526 imtypes = GetMagickList ("*", &numf, &ex); 8554 imtypes = GetMagickList ("*", &numf, &ex);
@@ -8528,8 +8556,8 @@ and `imagemagick-types-inhibit'. */)
8528 8556
8529 for (i = 0; i < numf; i++) 8557 for (i = 0; i < numf; i++)
8530 { 8558 {
8531 Qimagemagicktype = intern (imtypes[i]); 8559 Lisp_Object imagemagicktype = intern (imtypes[i]);
8532 typelist = Fcons (Qimagemagicktype, typelist); 8560 typelist = Fcons (imagemagicktype, typelist);
8533 imtypes[i] = MagickRelinquishMemory (imtypes[i]); 8561 imtypes[i] = MagickRelinquishMemory (imtypes[i]);
8534 } 8562 }
8535 8563
diff --git a/src/indent.c b/src/indent.c
index dc862518924..79af42c5f7e 100644
--- a/src/indent.c
+++ b/src/indent.c
@@ -920,7 +920,7 @@ position_indentation (ptrdiff_t pos_byte)
920 column += tab_width - column % tab_width; 920 column += tab_width - column % tab_width;
921 break; 921 break;
922 default: 922 default:
923 if (ASCII_BYTE_P (p[-1]) 923 if (ASCII_CHAR_P (p[-1])
924 || NILP (BVAR (current_buffer, enable_multibyte_characters))) 924 || NILP (BVAR (current_buffer, enable_multibyte_characters)))
925 return column; 925 return column;
926 { 926 {
@@ -1944,9 +1944,12 @@ The optional second argument WINDOW specifies the window to use for
1944parameters such as width, horizontal scrolling, and so on. 1944parameters such as width, horizontal scrolling, and so on.
1945The default is to use the selected window's parameters. 1945The default is to use the selected window's parameters.
1946 1946
1947LINES can optionally take the form (COLS . LINES), in which case 1947LINES can optionally take the form (COLS . LINES), in which case the
1948the motion will not stop at the start of a screen line but on 1948motion will not stop at the start of a screen line but COLS column
1949its column COLS (if such exists on that line, that is). 1949from the visual start of the line (if such exists on that line, that
1950is). If the line is scrolled horizontally, COLS is interpreted
1951visually, i.e., as addition to the columns of text beyond the left
1952edge of the window.
1950 1953
1951`vertical-motion' always uses the current buffer, 1954`vertical-motion' always uses the current buffer,
1952regardless of which buffer is displayed in WINDOW. 1955regardless of which buffer is displayed in WINDOW.
@@ -2126,20 +2129,14 @@ whether or not it is currently displayed in some window. */)
2126 } 2129 }
2127 } 2130 }
2128 2131
2129 /* Move to the goal column, if one was specified. */ 2132 /* Move to the goal column, if one was specified. If the window
2133 was originally hscrolled, the goal column is interpreted as
2134 an addition to the hscroll amount. */
2130 if (!NILP (lcols)) 2135 if (!NILP (lcols))
2131 { 2136 {
2132 /* If the window was originally hscrolled, move forward by 2137 int to_x = (int)(cols * FRAME_COLUMN_WIDTH (XFRAME (w->frame)) + 0.5);
2133 the hscrolled amount first. */ 2138
2134 if (first_x > 0) 2139 move_it_in_display_line (&it, ZV, first_x + to_x, MOVE_TO_X);
2135 {
2136 move_it_in_display_line (&it, ZV, first_x, MOVE_TO_X);
2137 it.current_x = 0;
2138 }
2139 move_it_in_display_line
2140 (&it, ZV,
2141 (int)(cols * FRAME_COLUMN_WIDTH (XFRAME (w->frame)) + 0.5),
2142 MOVE_TO_X);
2143 } 2140 }
2144 2141
2145 SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it)); 2142 SET_PT_BOTH (IT_CHARPOS (it), IT_BYTEPOS (it));
diff --git a/src/insdel.c b/src/insdel.c
index 2894af75348..876e2869978 100644
--- a/src/insdel.c
+++ b/src/insdel.c
@@ -701,7 +701,7 @@ count_combining_after (const unsigned char *string,
701 (2) POS is the last of the current buffer. 701 (2) POS is the last of the current buffer.
702 (3) A character at POS can't be a following byte of multibyte 702 (3) A character at POS can't be a following byte of multibyte
703 character. */ 703 character. */
704 if (length > 0 && ASCII_BYTE_P (string[length - 1])) /* case (1) */ 704 if (length > 0 && ASCII_CHAR_P (string[length - 1])) /* case (1) */
705 return 0; 705 return 0;
706 if (pos_byte == Z_BYTE) /* case (2) */ 706 if (pos_byte == Z_BYTE) /* case (2) */
707 return 0; 707 return 0;
diff --git a/src/intervals.h b/src/intervals.h
index e901f99747d..4e7a177140e 100644
--- a/src/intervals.h
+++ b/src/intervals.h
@@ -278,10 +278,8 @@ extern Lisp_Object Qpoint_entered;
278extern Lisp_Object Qmodification_hooks; 278extern Lisp_Object Qmodification_hooks;
279extern Lisp_Object Qcategory; 279extern Lisp_Object Qcategory;
280extern Lisp_Object Qlocal_map; 280extern Lisp_Object Qlocal_map;
281extern Lisp_Object Qkeymap;
282 281
283/* Visual properties text (including strings) may have. */ 282/* Visual properties text (including strings) may have. */
284extern Lisp_Object Qfont;
285extern Lisp_Object Qinvisible, Qintangible; 283extern Lisp_Object Qinvisible, Qintangible;
286 284
287/* Sticky properties. */ 285/* Sticky properties. */
diff --git a/src/keyboard.c b/src/keyboard.c
index dcf89137a5c..936d6687908 100644
--- a/src/keyboard.c
+++ b/src/keyboard.c
@@ -356,7 +356,6 @@ static Lisp_Object Qecho_keystrokes;
356static void recursive_edit_unwind (Lisp_Object buffer); 356static void recursive_edit_unwind (Lisp_Object buffer);
357static Lisp_Object command_loop (void); 357static Lisp_Object command_loop (void);
358static Lisp_Object Qcommand_execute; 358static Lisp_Object Qcommand_execute;
359struct timespec timer_check (void);
360 359
361static void echo_now (void); 360static void echo_now (void);
362static ptrdiff_t echo_length (void); 361static ptrdiff_t echo_length (void);
@@ -1216,7 +1215,7 @@ user_error (const char *msg)
1216 xsignal1 (Quser_error, build_string (msg)); 1215 xsignal1 (Quser_error, build_string (msg));
1217} 1216}
1218 1217
1219_Noreturn 1218/* _Noreturn will be added to prototype by make-docfile. */
1220DEFUN ("exit-recursive-edit", Fexit_recursive_edit, Sexit_recursive_edit, 0, 0, "", 1219DEFUN ("exit-recursive-edit", Fexit_recursive_edit, Sexit_recursive_edit, 0, 0, "",
1221 doc: /* Exit from the innermost recursive edit or minibuffer. */) 1220 doc: /* Exit from the innermost recursive edit or minibuffer. */)
1222 (void) 1221 (void)
@@ -1227,7 +1226,7 @@ DEFUN ("exit-recursive-edit", Fexit_recursive_edit, Sexit_recursive_edit, 0, 0,
1227 user_error ("No recursive edit is in progress"); 1226 user_error ("No recursive edit is in progress");
1228} 1227}
1229 1228
1230_Noreturn 1229/* _Noreturn will be added to prototype by make-docfile. */
1231DEFUN ("abort-recursive-edit", Fabort_recursive_edit, Sabort_recursive_edit, 0, 0, "", 1230DEFUN ("abort-recursive-edit", Fabort_recursive_edit, Sabort_recursive_edit, 0, 0, "",
1232 doc: /* Abort the command that requested this recursive edit or minibuffer input. */) 1231 doc: /* Abort the command that requested this recursive edit or minibuffer input. */)
1233 (void) 1232 (void)
@@ -1314,14 +1313,11 @@ some_mouse_moved (void)
1314 1313
1315static int read_key_sequence (Lisp_Object *, int, Lisp_Object, 1314static int read_key_sequence (Lisp_Object *, int, Lisp_Object,
1316 bool, bool, bool, bool); 1315 bool, bool, bool, bool);
1317void safe_run_hooks (Lisp_Object);
1318static void adjust_point_for_property (ptrdiff_t, bool); 1316static void adjust_point_for_property (ptrdiff_t, bool);
1319 1317
1320/* The last boundary auto-added to buffer-undo-list. */ 1318/* The last boundary auto-added to buffer-undo-list. */
1321Lisp_Object last_undo_boundary; 1319Lisp_Object last_undo_boundary;
1322 1320
1323extern Lisp_Object Qregion_extract_function;
1324
1325/* FIXME: This is wrong rather than test window-system, we should call 1321/* FIXME: This is wrong rather than test window-system, we should call
1326 a new set-selection, which will then dispatch to x-set-selection, or 1322 a new set-selection, which will then dispatch to x-set-selection, or
1327 tty-set-selection, or w32-set-selection, ... */ 1323 tty-set-selection, or w32-set-selection, ... */
@@ -2088,7 +2084,7 @@ make_ctrl_char (int c)
2088 /* Save the upper bits here. */ 2084 /* Save the upper bits here. */
2089 int upper = c & ~0177; 2085 int upper = c & ~0177;
2090 2086
2091 if (! ASCII_BYTE_P (c)) 2087 if (! ASCII_CHAR_P (c))
2092 return c |= ctrl_modifier; 2088 return c |= ctrl_modifier;
2093 2089
2094 c &= 0177; 2090 c &= 0177;
@@ -2185,7 +2181,7 @@ show_help_echo (Lisp_Object help, Lisp_Object window, Lisp_Object object,
2185 2181
2186 2182
2187 2183
2188/* Input of single characters from keyboard */ 2184/* Input of single characters from keyboard. */
2189 2185
2190static Lisp_Object kbd_buffer_get_event (KBOARD **kbp, bool *used_mouse_menu, 2186static Lisp_Object kbd_buffer_get_event (KBOARD **kbp, bool *used_mouse_menu,
2191 struct timespec *end_time); 2187 struct timespec *end_time);
@@ -3654,7 +3650,8 @@ kbd_buffer_store_event_hold (register struct input_event *event,
3654 *kbd_store_ptr = *event; 3650 *kbd_store_ptr = *event;
3655 ++kbd_store_ptr; 3651 ++kbd_store_ptr;
3656#ifdef subprocesses 3652#ifdef subprocesses
3657 if (kbd_buffer_nr_stored () > KBD_BUFFER_SIZE/2 && ! kbd_on_hold_p ()) 3653 if (kbd_buffer_nr_stored () > KBD_BUFFER_SIZE / 2
3654 && ! kbd_on_hold_p ())
3658 { 3655 {
3659 /* Don't read keyboard input until we have processed kbd_buffer. 3656 /* Don't read keyboard input until we have processed kbd_buffer.
3660 This happens when pasting text longer than KBD_BUFFER_SIZE/2. */ 3657 This happens when pasting text longer than KBD_BUFFER_SIZE/2. */
@@ -7481,8 +7478,8 @@ menu_bar_items (Lisp_Object old)
7481 { 7478 {
7482 int i = menu_bar_items_index; 7479 int i = menu_bar_items_index;
7483 if (i + 4 > ASIZE (menu_bar_items_vector)) 7480 if (i + 4 > ASIZE (menu_bar_items_vector))
7484 menu_bar_items_vector = 7481 menu_bar_items_vector
7485 larger_vector (menu_bar_items_vector, 4, -1); 7482 = larger_vector (menu_bar_items_vector, 4, -1);
7486 /* Add this item. */ 7483 /* Add this item. */
7487 ASET (menu_bar_items_vector, i, Qnil); i++; 7484 ASET (menu_bar_items_vector, i, Qnil); i++;
7488 ASET (menu_bar_items_vector, i, Qnil); i++; 7485 ASET (menu_bar_items_vector, i, Qnil); i++;
@@ -9385,16 +9382,6 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9385 first_unbound = min (t, first_unbound); 9382 first_unbound = min (t, first_unbound);
9386 9383
9387 head = EVENT_HEAD (key); 9384 head = EVENT_HEAD (key);
9388 if (help_char_p (head) && t > 0)
9389 {
9390 read_key_sequence_cmd = Vprefix_help_command;
9391 keybuf[t++] = key;
9392 last_nonmenu_event = key;
9393 /* The Microsoft C compiler can't handle the goto that
9394 would go here. */
9395 dummyflag = 1;
9396 break;
9397 }
9398 9385
9399 if (SYMBOLP (head)) 9386 if (SYMBOLP (head))
9400 { 9387 {
@@ -9652,6 +9639,17 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
9652 9639
9653 goto replay_sequence; 9640 goto replay_sequence;
9654 } 9641 }
9642
9643 if (NILP (current_binding)
9644 && help_char_p (EVENT_HEAD (key)) && t > 1)
9645 {
9646 read_key_sequence_cmd = Vprefix_help_command;
9647 /* The Microsoft C compiler can't handle the goto that
9648 would go here. */
9649 dummyflag = 1;
9650 break;
9651 }
9652
9655 /* If KEY is not defined in any of the keymaps, 9653 /* If KEY is not defined in any of the keymaps,
9656 and cannot be part of a function key or translation, 9654 and cannot be part of a function key or translation,
9657 and is a shifted function key, 9655 and is a shifted function key,
diff --git a/src/lisp.h b/src/lisp.h
index 280886d063a..fb832b80940 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -341,8 +341,8 @@ error !;
341#define lisp_h_CHECK_LIST_CONS(x, y) CHECK_TYPE (CONSP (x), Qlistp, y) 341#define lisp_h_CHECK_LIST_CONS(x, y) CHECK_TYPE (CONSP (x), Qlistp, y)
342#define lisp_h_CHECK_NUMBER(x) CHECK_TYPE (INTEGERP (x), Qintegerp, x) 342#define lisp_h_CHECK_NUMBER(x) CHECK_TYPE (INTEGERP (x), Qintegerp, x)
343#define lisp_h_CHECK_SYMBOL(x) CHECK_TYPE (SYMBOLP (x), Qsymbolp, x) 343#define lisp_h_CHECK_SYMBOL(x) CHECK_TYPE (SYMBOLP (x), Qsymbolp, x)
344#define lisp_h_CHECK_TYPE(ok, Qxxxp, x) \ 344#define lisp_h_CHECK_TYPE(ok, predicate, x) \
345 ((ok) ? (void) 0 : (void) wrong_type_argument (Qxxxp, x)) 345 ((ok) ? (void) 0 : (void) wrong_type_argument (predicate, x))
346#define lisp_h_CONSP(x) (XTYPE (x) == Lisp_Cons) 346#define lisp_h_CONSP(x) (XTYPE (x) == Lisp_Cons)
347#define lisp_h_EQ(x, y) (XLI (x) == XLI (y)) 347#define lisp_h_EQ(x, y) (XLI (x) == XLI (y))
348#define lisp_h_FLOATP(x) (XTYPE (x) == Lisp_Float) 348#define lisp_h_FLOATP(x) (XTYPE (x) == Lisp_Float)
@@ -388,7 +388,7 @@ error !;
388# define CHECK_LIST_CONS(x, y) lisp_h_CHECK_LIST_CONS (x, y) 388# define CHECK_LIST_CONS(x, y) lisp_h_CHECK_LIST_CONS (x, y)
389# define CHECK_NUMBER(x) lisp_h_CHECK_NUMBER (x) 389# define CHECK_NUMBER(x) lisp_h_CHECK_NUMBER (x)
390# define CHECK_SYMBOL(x) lisp_h_CHECK_SYMBOL (x) 390# define CHECK_SYMBOL(x) lisp_h_CHECK_SYMBOL (x)
391# define CHECK_TYPE(ok, Qxxxp, x) lisp_h_CHECK_TYPE (ok, Qxxxp, x) 391# define CHECK_TYPE(ok, predicate, x) lisp_h_CHECK_TYPE (ok, predicate, x)
392# define CONSP(x) lisp_h_CONSP (x) 392# define CONSP(x) lisp_h_CONSP (x)
393# define EQ(x, y) lisp_h_EQ (x, y) 393# define EQ(x, y) lisp_h_EQ (x, y)
394# define FLOATP(x) lisp_h_FLOATP (x) 394# define FLOATP(x) lisp_h_FLOATP (x)
@@ -832,12 +832,13 @@ extern Lisp_Object Qnumberp, Qstringp, Qsymbolp, Qt, Qvectorp;
832extern Lisp_Object Qbool_vector_p; 832extern Lisp_Object Qbool_vector_p;
833extern Lisp_Object Qvector_or_char_table_p, Qwholenump; 833extern Lisp_Object Qvector_or_char_table_p, Qwholenump;
834extern Lisp_Object Qwindow; 834extern Lisp_Object Qwindow;
835extern Lisp_Object Ffboundp (Lisp_Object);
836extern _Noreturn Lisp_Object wrong_type_argument (Lisp_Object, Lisp_Object); 835extern _Noreturn Lisp_Object wrong_type_argument (Lisp_Object, Lisp_Object);
837 836
838/* Defined in emacs.c. */ 837/* Defined in emacs.c. */
839extern bool initialized;
840extern bool might_dump; 838extern bool might_dump;
839/* True means Emacs has already been initialized.
840 Used during startup to detect startup of dumped Emacs. */
841extern bool initialized;
841 842
842/* Defined in eval.c. */ 843/* Defined in eval.c. */
843extern Lisp_Object Qautoload; 844extern Lisp_Object Qautoload;
@@ -1002,8 +1003,9 @@ make_lisp_proc (struct Lisp_Process *p)
1002 1003
1003/* Type checking. */ 1004/* Type checking. */
1004 1005
1005LISP_MACRO_DEFUN_VOID (CHECK_TYPE, (int ok, Lisp_Object Qxxxp, Lisp_Object x), 1006LISP_MACRO_DEFUN_VOID (CHECK_TYPE,
1006 (ok, Qxxxp, x)) 1007 (int ok, Lisp_Object predicate, Lisp_Object x),
1008 (ok, predicate, x))
1007 1009
1008/* Deprecated and will be removed soon. */ 1010/* Deprecated and will be removed soon. */
1009 1011
@@ -1197,12 +1199,6 @@ STRING_SET_CHARS (Lisp_Object string, ptrdiff_t newsize)
1197{ 1199{
1198 XSTRING (string)->size = newsize; 1200 XSTRING (string)->size = newsize;
1199} 1201}
1200INLINE void
1201STRING_COPYIN (Lisp_Object string, ptrdiff_t index, char const *new,
1202 ptrdiff_t count)
1203{
1204 memcpy (SDATA (string) + index, new, count);
1205}
1206 1202
1207/* Header of vector-like objects. This documents the layout constraints on 1203/* Header of vector-like objects. This documents the layout constraints on
1208 vectors and pseudovectors (objects of PVEC_xxx subtype). It also prevents 1204 vectors and pseudovectors (objects of PVEC_xxx subtype). It also prevents
@@ -2557,9 +2553,9 @@ CHECK_VECTOR_OR_STRING (Lisp_Object x)
2557 CHECK_TYPE (VECTORP (x) || STRINGP (x), Qarrayp, x); 2553 CHECK_TYPE (VECTORP (x) || STRINGP (x), Qarrayp, x);
2558} 2554}
2559INLINE void 2555INLINE void
2560CHECK_ARRAY (Lisp_Object x, Lisp_Object Qxxxp) 2556CHECK_ARRAY (Lisp_Object x, Lisp_Object predicate)
2561{ 2557{
2562 CHECK_TYPE (ARRAYP (x), Qxxxp, x); 2558 CHECK_TYPE (ARRAYP (x), predicate, x);
2563} 2559}
2564INLINE void 2560INLINE void
2565CHECK_BUFFER (Lisp_Object x) 2561CHECK_BUFFER (Lisp_Object x)
@@ -2687,7 +2683,6 @@ CHECK_NUMBER_CDR (Lisp_Object x)
2687 Lisp_Object fnname 2683 Lisp_Object fnname
2688#else /* not _MSC_VER */ 2684#else /* not _MSC_VER */
2689#define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \ 2685#define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \
2690 Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \
2691 static struct Lisp_Subr alignas (GCALIGNMENT) sname = \ 2686 static struct Lisp_Subr alignas (GCALIGNMENT) sname = \
2692 { { PVEC_SUBR << PSEUDOVECTOR_AREA_BITS }, \ 2687 { { PVEC_SUBR << PSEUDOVECTOR_AREA_BITS }, \
2693 { .a ## maxargs = fnname }, \ 2688 { .a ## maxargs = fnname }, \
@@ -3350,7 +3345,7 @@ set_sub_char_table_contents (Lisp_Object table, ptrdiff_t idx, Lisp_Object val)
3350} 3345}
3351 3346
3352/* Defined in data.c. */ 3347/* Defined in data.c. */
3353extern Lisp_Object Qnil, Qt, Qquote, Qlambda, Qunbound; 3348extern Lisp_Object Qquote, Qunbound;
3354extern Lisp_Object Qerror_conditions, Qerror_message, Qtop_level; 3349extern Lisp_Object Qerror_conditions, Qerror_message, Qtop_level;
3355extern Lisp_Object Qerror, Qquit, Qargs_out_of_range; 3350extern Lisp_Object Qerror, Qquit, Qargs_out_of_range;
3356extern Lisp_Object Qvoid_variable, Qvoid_function; 3351extern Lisp_Object Qvoid_variable, Qvoid_function;
@@ -3361,26 +3356,18 @@ extern Lisp_Object Qbeginning_of_buffer, Qend_of_buffer, Qbuffer_read_only;
3361extern Lisp_Object Qtext_read_only; 3356extern Lisp_Object Qtext_read_only;
3362extern Lisp_Object Qinteractive_form; 3357extern Lisp_Object Qinteractive_form;
3363extern Lisp_Object Qcircular_list; 3358extern Lisp_Object Qcircular_list;
3364extern Lisp_Object Qintegerp, Qwholenump, Qsymbolp, Qlistp, Qconsp; 3359extern Lisp_Object Qsequencep;
3365extern Lisp_Object Qstringp, Qarrayp, Qsequencep, Qbufferp; 3360extern Lisp_Object Qchar_or_string_p, Qinteger_or_marker_p;
3366extern Lisp_Object Qchar_or_string_p, Qmarkerp, Qinteger_or_marker_p, Qvectorp;
3367extern Lisp_Object Qbuffer_or_string_p;
3368extern Lisp_Object Qfboundp; 3361extern Lisp_Object Qfboundp;
3369extern Lisp_Object Qchar_table_p, Qvector_or_char_table_p;
3370 3362
3371extern Lisp_Object Qcdr; 3363extern Lisp_Object Qcdr;
3372 3364
3373extern Lisp_Object Qrange_error, Qoverflow_error; 3365extern Lisp_Object Qrange_error, Qoverflow_error;
3374 3366
3375extern Lisp_Object Qfloatp; 3367extern Lisp_Object Qnumber_or_marker_p;
3376extern Lisp_Object Qnumberp, Qnumber_or_marker_p;
3377 3368
3378extern Lisp_Object Qbuffer, Qinteger, Qsymbol; 3369extern Lisp_Object Qbuffer, Qinteger, Qsymbol;
3379 3370
3380extern Lisp_Object Qfont_spec, Qfont_entity, Qfont_object;
3381
3382EXFUN (Fbyteorder, 0) ATTRIBUTE_CONST;
3383
3384/* Defined in data.c. */ 3371/* Defined in data.c. */
3385extern Lisp_Object indirect_function (Lisp_Object); 3372extern Lisp_Object indirect_function (Lisp_Object);
3386extern Lisp_Object find_symbol_value (Lisp_Object); 3373extern Lisp_Object find_symbol_value (Lisp_Object);
@@ -3427,7 +3414,6 @@ extern struct Lisp_Symbol *indirect_variable (struct Lisp_Symbol *);
3427extern _Noreturn void args_out_of_range (Lisp_Object, Lisp_Object); 3414extern _Noreturn void args_out_of_range (Lisp_Object, Lisp_Object);
3428extern _Noreturn void args_out_of_range_3 (Lisp_Object, Lisp_Object, 3415extern _Noreturn void args_out_of_range_3 (Lisp_Object, Lisp_Object,
3429 Lisp_Object); 3416 Lisp_Object);
3430extern _Noreturn Lisp_Object wrong_type_argument (Lisp_Object, Lisp_Object);
3431extern Lisp_Object do_symval_forwarding (union Lisp_Fwd *); 3417extern Lisp_Object do_symval_forwarding (union Lisp_Fwd *);
3432extern void set_internal (Lisp_Object, Lisp_Object, Lisp_Object, bool); 3418extern void set_internal (Lisp_Object, Lisp_Object, Lisp_Object, bool);
3433extern void syms_of_data (void); 3419extern void syms_of_data (void);
@@ -3446,11 +3432,8 @@ extern void init_coding_once (void);
3446extern void syms_of_coding (void); 3432extern void syms_of_coding (void);
3447 3433
3448/* Defined in character.c. */ 3434/* Defined in character.c. */
3449EXFUN (Fmax_char, 0) ATTRIBUTE_CONST;
3450extern ptrdiff_t chars_in_text (const unsigned char *, ptrdiff_t); 3435extern ptrdiff_t chars_in_text (const unsigned char *, ptrdiff_t);
3451extern ptrdiff_t multibyte_chars_in_text (const unsigned char *, ptrdiff_t); 3436extern ptrdiff_t multibyte_chars_in_text (const unsigned char *, ptrdiff_t);
3452extern int multibyte_char_to_unibyte (int) ATTRIBUTE_CONST;
3453extern int multibyte_char_to_unibyte_safe (int) ATTRIBUTE_CONST;
3454extern void syms_of_character (void); 3437extern void syms_of_character (void);
3455 3438
3456/* Defined in charset.c. */ 3439/* Defined in charset.c. */
@@ -3460,9 +3443,6 @@ extern void syms_of_charset (void);
3460/* Structure forward declarations. */ 3443/* Structure forward declarations. */
3461struct charset; 3444struct charset;
3462 3445
3463/* Defined in composite.c. */
3464extern void syms_of_composite (void);
3465
3466/* Defined in syntax.c. */ 3446/* Defined in syntax.c. */
3467extern void init_syntax_once (void); 3447extern void init_syntax_once (void);
3468extern void syms_of_syntax (void); 3448extern void syms_of_syntax (void);
@@ -3470,7 +3450,6 @@ extern void syms_of_syntax (void);
3470/* Defined in fns.c. */ 3450/* Defined in fns.c. */
3471extern Lisp_Object QCrehash_size, QCrehash_threshold; 3451extern Lisp_Object QCrehash_size, QCrehash_threshold;
3472enum { NEXT_ALMOST_PRIME_LIMIT = 11 }; 3452enum { NEXT_ALMOST_PRIME_LIMIT = 11 };
3473EXFUN (Fidentity, 1) ATTRIBUTE_CONST;
3474extern EMACS_INT next_almost_prime (EMACS_INT) ATTRIBUTE_CONST; 3453extern EMACS_INT next_almost_prime (EMACS_INT) ATTRIBUTE_CONST;
3475extern Lisp_Object larger_vector (Lisp_Object, ptrdiff_t, ptrdiff_t); 3454extern Lisp_Object larger_vector (Lisp_Object, ptrdiff_t, ptrdiff_t);
3476extern void sweep_weak_hash_tables (void); 3455extern void sweep_weak_hash_tables (void);
@@ -3485,7 +3464,8 @@ ptrdiff_t hash_lookup (struct Lisp_Hash_Table *, Lisp_Object, EMACS_UINT *);
3485ptrdiff_t hash_put (struct Lisp_Hash_Table *, Lisp_Object, Lisp_Object, 3464ptrdiff_t hash_put (struct Lisp_Hash_Table *, Lisp_Object, Lisp_Object,
3486 EMACS_UINT); 3465 EMACS_UINT);
3487extern struct hash_table_test hashtest_eql, hashtest_equal; 3466extern struct hash_table_test hashtest_eql, hashtest_equal;
3488 3467extern void validate_subarray (Lisp_Object, Lisp_Object, Lisp_Object,
3468 ptrdiff_t, ptrdiff_t *, ptrdiff_t *);
3489extern Lisp_Object substring_both (Lisp_Object, ptrdiff_t, ptrdiff_t, 3469extern Lisp_Object substring_both (Lisp_Object, ptrdiff_t, ptrdiff_t,
3490 ptrdiff_t, ptrdiff_t); 3470 ptrdiff_t, ptrdiff_t);
3491extern Lisp_Object merge (Lisp_Object, Lisp_Object, Lisp_Object); 3471extern Lisp_Object merge (Lisp_Object, Lisp_Object, Lisp_Object);
@@ -3503,7 +3483,6 @@ extern Lisp_Object string_make_unibyte (Lisp_Object);
3503extern void syms_of_fns (void); 3483extern void syms_of_fns (void);
3504 3484
3505/* Defined in floatfns.c. */ 3485/* Defined in floatfns.c. */
3506extern double extract_float (Lisp_Object);
3507extern void syms_of_floatfns (void); 3486extern void syms_of_floatfns (void);
3508extern Lisp_Object fmod_float (Lisp_Object x, Lisp_Object y); 3487extern Lisp_Object fmod_float (Lisp_Object x, Lisp_Object y);
3509 3488
@@ -3524,6 +3503,7 @@ extern void syms_of_image (void);
3524 3503
3525/* Defined in insdel.c. */ 3504/* Defined in insdel.c. */
3526extern Lisp_Object Qinhibit_modification_hooks; 3505extern Lisp_Object Qinhibit_modification_hooks;
3506extern Lisp_Object Qregion_extract_function;
3527extern void move_gap_both (ptrdiff_t, ptrdiff_t); 3507extern void move_gap_both (ptrdiff_t, ptrdiff_t);
3528extern _Noreturn void buffer_overflow (void); 3508extern _Noreturn void buffer_overflow (void);
3529extern void make_gap (ptrdiff_t); 3509extern void make_gap (ptrdiff_t);
@@ -3576,18 +3556,16 @@ _Noreturn void __executable_start (void);
3576#endif 3556#endif
3577extern Lisp_Object Vwindow_system; 3557extern Lisp_Object Vwindow_system;
3578extern Lisp_Object sit_for (Lisp_Object, bool, int); 3558extern Lisp_Object sit_for (Lisp_Object, bool, int);
3579extern void init_display (void);
3580extern void syms_of_display (void);
3581 3559
3582/* Defined in xdisp.c. */ 3560/* Defined in xdisp.c. */
3583extern Lisp_Object Qinhibit_point_motion_hooks; 3561extern Lisp_Object Qinhibit_point_motion_hooks;
3584extern Lisp_Object Qinhibit_redisplay, Qdisplay; 3562extern Lisp_Object Qinhibit_redisplay;
3585extern Lisp_Object Qmenu_bar_update_hook; 3563extern Lisp_Object Qmenu_bar_update_hook;
3586extern Lisp_Object Qwindow_scroll_functions; 3564extern Lisp_Object Qwindow_scroll_functions;
3587extern Lisp_Object Qoverriding_local_map, Qoverriding_terminal_local_map; 3565extern Lisp_Object Qoverriding_local_map, Qoverriding_terminal_local_map;
3588extern Lisp_Object Qimage, Qtext, Qboth, Qboth_horiz, Qtext_image_horiz; 3566extern Lisp_Object Qtext, Qboth, Qboth_horiz, Qtext_image_horiz;
3589extern Lisp_Object Qspace, Qcenter, QCalign_to; 3567extern Lisp_Object Qspace, Qcenter, QCalign_to;
3590extern Lisp_Object Qbar, Qhbar, Qbox, Qhollow; 3568extern Lisp_Object Qbar, Qhbar, Qhollow;
3591extern Lisp_Object Qleft_margin, Qright_margin; 3569extern Lisp_Object Qleft_margin, Qright_margin;
3592extern Lisp_Object QCdata, QCfile; 3570extern Lisp_Object QCdata, QCfile;
3593extern Lisp_Object QCmap; 3571extern Lisp_Object QCmap;
@@ -3614,7 +3592,6 @@ extern void message_log_maybe_newline (void);
3614extern void update_echo_area (void); 3592extern void update_echo_area (void);
3615extern void truncate_echo_area (ptrdiff_t); 3593extern void truncate_echo_area (ptrdiff_t);
3616extern void redisplay (void); 3594extern void redisplay (void);
3617extern void redisplay_preserve_echo_area (int);
3618 3595
3619void set_frame_cursor_types (struct frame *, Lisp_Object); 3596void set_frame_cursor_types (struct frame *, Lisp_Object);
3620extern void syms_of_xdisp (void); 3597extern void syms_of_xdisp (void);
@@ -3797,12 +3774,9 @@ extern void r_alloc_inhibit_buffer_relocation (int);
3797 3774
3798/* Defined in chartab.c. */ 3775/* Defined in chartab.c. */
3799extern Lisp_Object copy_char_table (Lisp_Object); 3776extern Lisp_Object copy_char_table (Lisp_Object);
3800extern Lisp_Object char_table_ref (Lisp_Object, int);
3801extern Lisp_Object char_table_ref_and_range (Lisp_Object, int, 3777extern Lisp_Object char_table_ref_and_range (Lisp_Object, int,
3802 int *, int *); 3778 int *, int *);
3803extern void char_table_set (Lisp_Object, int, Lisp_Object);
3804extern void char_table_set_range (Lisp_Object, int, int, Lisp_Object); 3779extern void char_table_set_range (Lisp_Object, int, int, Lisp_Object);
3805extern int char_table_translate (Lisp_Object, int);
3806extern void map_char_table (void (*) (Lisp_Object, Lisp_Object, 3780extern void map_char_table (void (*) (Lisp_Object, Lisp_Object,
3807 Lisp_Object), 3781 Lisp_Object),
3808 Lisp_Object, Lisp_Object, Lisp_Object); 3782 Lisp_Object, Lisp_Object, Lisp_Object);
@@ -3880,7 +3854,7 @@ intern_c_string (const char *str)
3880} 3854}
3881 3855
3882/* Defined in eval.c. */ 3856/* Defined in eval.c. */
3883extern Lisp_Object Qautoload, Qexit, Qinteractive, Qcommandp, Qmacro; 3857extern Lisp_Object Qexit, Qinteractive, Qcommandp, Qmacro;
3884extern Lisp_Object Qinhibit_quit, Qinternal_interpreter_environment, Qclosure; 3858extern Lisp_Object Qinhibit_quit, Qinternal_interpreter_environment, Qclosure;
3885extern Lisp_Object Qand_rest; 3859extern Lisp_Object Qand_rest;
3886extern Lisp_Object Vautoload_queue; 3860extern Lisp_Object Vautoload_queue;
@@ -4015,7 +3989,6 @@ extern Lisp_Object expand_and_dir_to_file (Lisp_Object, Lisp_Object);
4015extern Lisp_Object write_region (Lisp_Object, Lisp_Object, Lisp_Object, 3989extern Lisp_Object write_region (Lisp_Object, Lisp_Object, Lisp_Object,
4016 Lisp_Object, Lisp_Object, Lisp_Object, 3990 Lisp_Object, Lisp_Object, Lisp_Object,
4017 Lisp_Object, int); 3991 Lisp_Object, int);
4018EXFUN (Fread_file_name, 6); /* Not a normal DEFUN. */
4019extern void close_file_unwind (int); 3992extern void close_file_unwind (int);
4020extern void fclose_unwind (void *); 3993extern void fclose_unwind (void *);
4021extern void restore_point_unwind (Lisp_Object); 3994extern void restore_point_unwind (Lisp_Object);
@@ -4089,8 +4062,7 @@ extern Lisp_Object echo_message_buffer;
4089extern struct kboard *echo_kboard; 4062extern struct kboard *echo_kboard;
4090extern void cancel_echoing (void); 4063extern void cancel_echoing (void);
4091extern Lisp_Object Qdisabled, QCfilter; 4064extern Lisp_Object Qdisabled, QCfilter;
4092extern Lisp_Object Qup, Qdown, Qbottom; 4065extern Lisp_Object Qup, Qdown;
4093extern Lisp_Object Qtop;
4094extern Lisp_Object last_undo_boundary; 4066extern Lisp_Object last_undo_boundary;
4095extern bool input_pending; 4067extern bool input_pending;
4096extern Lisp_Object menu_bar_items (Lisp_Object); 4068extern Lisp_Object menu_bar_items (Lisp_Object);
@@ -4122,7 +4094,6 @@ extern void syms_of_indent (void);
4122 4094
4123/* Defined in frame.c. */ 4095/* Defined in frame.c. */
4124extern Lisp_Object Qonly, Qnone; 4096extern Lisp_Object Qonly, Qnone;
4125extern Lisp_Object Qvisible;
4126extern void set_frame_param (struct frame *, Lisp_Object, Lisp_Object); 4097extern void set_frame_param (struct frame *, Lisp_Object, Lisp_Object);
4127extern void store_frame_param (struct frame *, Lisp_Object, Lisp_Object); 4098extern void store_frame_param (struct frame *, Lisp_Object, Lisp_Object);
4128extern void store_in_alist (Lisp_Object *, Lisp_Object, Lisp_Object); 4099extern void store_in_alist (Lisp_Object *, Lisp_Object, Lisp_Object);
@@ -4242,9 +4213,8 @@ extern void record_property_change (ptrdiff_t, ptrdiff_t,
4242 Lisp_Object); 4213 Lisp_Object);
4243extern void syms_of_undo (void); 4214extern void syms_of_undo (void);
4244/* Defined in textprop.c. */ 4215/* Defined in textprop.c. */
4245extern Lisp_Object Qfont, Qmouse_face; 4216extern Lisp_Object Qmouse_face;
4246extern Lisp_Object Qinsert_in_front_hooks, Qinsert_behind_hooks; 4217extern Lisp_Object Qinsert_in_front_hooks, Qinsert_behind_hooks;
4247extern Lisp_Object Qfront_sticky, Qrear_nonsticky;
4248extern Lisp_Object Qminibuffer_prompt; 4218extern Lisp_Object Qminibuffer_prompt;
4249 4219
4250extern void report_interval_modification (Lisp_Object, Lisp_Object); 4220extern void report_interval_modification (Lisp_Object, Lisp_Object);
@@ -4267,7 +4237,6 @@ extern char *get_current_dir_name (void);
4267#endif 4237#endif
4268extern void stuff_char (char c); 4238extern void stuff_char (char c);
4269extern void init_foreground_group (void); 4239extern void init_foreground_group (void);
4270extern void init_sigio (int);
4271extern void sys_subshell (void); 4240extern void sys_subshell (void);
4272extern void sys_suspend (void); 4241extern void sys_suspend (void);
4273extern void discard_tty_input (void); 4242extern void discard_tty_input (void);
@@ -4352,8 +4321,8 @@ extern void syms_of_w32notify (void);
4352#endif 4321#endif
4353 4322
4354/* Defined in xfaces.c. */ 4323/* Defined in xfaces.c. */
4355extern Lisp_Object Qdefault, Qtool_bar, Qfringe; 4324extern Lisp_Object Qdefault, Qfringe;
4356extern Lisp_Object Qheader_line, Qscroll_bar, Qcursor; 4325extern Lisp_Object Qscroll_bar, Qcursor;
4357extern Lisp_Object Qmode_line_inactive; 4326extern Lisp_Object Qmode_line_inactive;
4358extern Lisp_Object Qface; 4327extern Lisp_Object Qface;
4359extern Lisp_Object Qnormal; 4328extern Lisp_Object Qnormal;
@@ -4412,10 +4381,6 @@ extern void syms_of_profiler (void);
4412/* Defined in msdos.c, w32.c. */ 4381/* Defined in msdos.c, w32.c. */
4413extern char *emacs_root_dir (void); 4382extern char *emacs_root_dir (void);
4414#endif /* DOS_NT */ 4383#endif /* DOS_NT */
4415
4416/* True means Emacs has already been initialized.
4417 Used during startup to detect startup of dumped Emacs. */
4418extern bool initialized;
4419 4384
4420/* True means ^G can quit instantly. */ 4385/* True means ^G can quit instantly. */
4421extern bool immediate_quit; 4386extern bool immediate_quit;
diff --git a/src/lread.c b/src/lread.c
index 4edd1177fb4..f252993207d 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -213,7 +213,7 @@ readchar (Lisp_Object readcharfun, bool *multibyte)
213 else 213 else
214 { 214 {
215 c = BUF_FETCH_BYTE (inbuffer, pt_byte); 215 c = BUF_FETCH_BYTE (inbuffer, pt_byte);
216 if (! ASCII_BYTE_P (c)) 216 if (! ASCII_CHAR_P (c))
217 c = BYTE8_TO_CHAR (c); 217 c = BYTE8_TO_CHAR (c);
218 pt_byte++; 218 pt_byte++;
219 } 219 }
@@ -242,7 +242,7 @@ readchar (Lisp_Object readcharfun, bool *multibyte)
242 else 242 else
243 { 243 {
244 c = BUF_FETCH_BYTE (inbuffer, bytepos); 244 c = BUF_FETCH_BYTE (inbuffer, bytepos);
245 if (! ASCII_BYTE_P (c)) 245 if (! ASCII_CHAR_P (c))
246 c = BYTE8_TO_CHAR (c); 246 c = BYTE8_TO_CHAR (c);
247 bytepos++; 247 bytepos++;
248 } 248 }
@@ -324,7 +324,7 @@ readchar (Lisp_Object readcharfun, bool *multibyte)
324 return c; 324 return c;
325 if (multibyte) 325 if (multibyte)
326 *multibyte = 1; 326 *multibyte = 1;
327 if (ASCII_BYTE_P (c)) 327 if (ASCII_CHAR_P (c))
328 return c; 328 return c;
329 if (emacs_mule_encoding) 329 if (emacs_mule_encoding)
330 return read_emacs_mule_char (c, readbyte, readcharfun); 330 return read_emacs_mule_char (c, readbyte, readcharfun);
@@ -3850,7 +3850,7 @@ it defaults to the value of `obarray'. */)
3850 SET_SYMBOL_VAL (XSYMBOL (sym), sym); 3850 SET_SYMBOL_VAL (XSYMBOL (sym), sym);
3851 } 3851 }
3852 3852
3853 ptr = aref_addr (obarray, XINT(tem)); 3853 ptr = aref_addr (obarray, XINT (tem));
3854 if (SYMBOLP (*ptr)) 3854 if (SYMBOLP (*ptr))
3855 set_symbol_next (sym, XSYMBOL (*ptr)); 3855 set_symbol_next (sym, XSYMBOL (*ptr));
3856 else 3856 else
diff --git a/src/macros.c b/src/macros.c
index d0cf3c2c58d..acba125edc5 100644
--- a/src/macros.c
+++ b/src/macros.c
@@ -45,8 +45,6 @@ EMACS_INT executing_kbd_macro_iterations;
45 45
46Lisp_Object executing_kbd_macro; 46Lisp_Object executing_kbd_macro;
47 47
48Lisp_Object Fexecute_kbd_macro (Lisp_Object macro, Lisp_Object count, Lisp_Object loopfunc);
49
50DEFUN ("start-kbd-macro", Fstart_kbd_macro, Sstart_kbd_macro, 1, 2, "P", 48DEFUN ("start-kbd-macro", Fstart_kbd_macro, Sstart_kbd_macro, 1, 2, "P",
51 doc: /* Record subsequent keyboard input, defining a keyboard macro. 49 doc: /* Record subsequent keyboard input, defining a keyboard macro.
52The commands are recorded even as they are executed. 50The commands are recorded even as they are executed.
diff --git a/src/menu.c b/src/menu.c
index 460dc7967b5..a523cfc6010 100644
--- a/src/menu.c
+++ b/src/menu.c
@@ -1233,7 +1233,7 @@ no quit occurs and `x-popup-menu' returns nil. */)
1233 { 1233 {
1234 int cur_x, cur_y; 1234 int cur_x, cur_y;
1235 1235
1236 mouse_position_for_popup (new_f, &cur_x, &cur_y); 1236 x_relative_mouse_position (new_f, &cur_x, &cur_y);
1237 /* cur_x/y may be negative, so use make_number. */ 1237 /* cur_x/y may be negative, so use make_number. */
1238 x = make_number (cur_x); 1238 x = make_number (cur_x);
1239 y = make_number (cur_y); 1239 y = make_number (cur_y);
diff --git a/src/menu.h b/src/menu.h
index 643ff40fef8..30a89bead26 100644
--- a/src/menu.h
+++ b/src/menu.h
@@ -54,9 +54,6 @@ extern widget_value *make_widget_value (const char *, char *, bool, Lisp_Object)
54extern widget_value *digest_single_submenu (int, int, bool); 54extern widget_value *digest_single_submenu (int, int, bool);
55#endif 55#endif
56 56
57#ifdef HAVE_X_WINDOWS
58extern void mouse_position_for_popup (struct frame *f, int *x, int *y);
59#endif
60#if defined (HAVE_X_WINDOWS) || defined (MSDOS) 57#if defined (HAVE_X_WINDOWS) || defined (MSDOS)
61extern Lisp_Object x_menu_show (struct frame *, int, int, int, 58extern Lisp_Object x_menu_show (struct frame *, int, int, int,
62 Lisp_Object, const char **); 59 Lisp_Object, const char **);
diff --git a/src/print.c b/src/print.c
index 475be9ec285..9050a0cb773 100644
--- a/src/print.c
+++ b/src/print.c
@@ -1472,7 +1472,7 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag)
1472 strout (outbuf, len, len, printcharfun); 1472 strout (outbuf, len, len, printcharfun);
1473 } 1473 }
1474 else if (! multibyte 1474 else if (! multibyte
1475 && SINGLE_BYTE_CHAR_P (c) && ! ASCII_BYTE_P (c) 1475 && SINGLE_BYTE_CHAR_P (c) && ! ASCII_CHAR_P (c)
1476 && print_escape_nonascii) 1476 && print_escape_nonascii)
1477 { 1477 {
1478 /* When printing in a multibyte buffer 1478 /* When printing in a multibyte buffer
diff --git a/src/process.c b/src/process.c
index 592c43acc2d..3242222a94a 100644
--- a/src/process.c
+++ b/src/process.c
@@ -2844,7 +2844,7 @@ usage: (make-network-process &rest ARGS) */)
2844 struct gcpro gcpro1; 2844 struct gcpro gcpro1;
2845 ptrdiff_t count = SPECPDL_INDEX (); 2845 ptrdiff_t count = SPECPDL_INDEX ();
2846 ptrdiff_t count1; 2846 ptrdiff_t count1;
2847 Lisp_Object QCaddress; /* one of QClocal or QCremote */ 2847 Lisp_Object colon_address; /* Either QClocal or QCremote. */
2848 Lisp_Object tem; 2848 Lisp_Object tem;
2849 Lisp_Object name, buffer, host, service, address; 2849 Lisp_Object name, buffer, host, service, address;
2850 Lisp_Object filter, sentinel; 2850 Lisp_Object filter, sentinel;
@@ -2892,8 +2892,8 @@ usage: (make-network-process &rest ARGS) */)
2892 backlog = XINT (tem); 2892 backlog = XINT (tem);
2893 } 2893 }
2894 2894
2895 /* Make QCaddress an alias for :local (server) or :remote (client). */ 2895 /* Make colon_address an alias for :local (server) or :remote (client). */
2896 QCaddress = is_server ? QClocal : QCremote; 2896 colon_address = is_server ? QClocal : QCremote;
2897 2897
2898 /* :nowait BOOL */ 2898 /* :nowait BOOL */
2899 if (!is_server && socktype != SOCK_DGRAM 2899 if (!is_server && socktype != SOCK_DGRAM
@@ -2920,7 +2920,7 @@ usage: (make-network-process &rest ARGS) */)
2920 res = &ai; 2920 res = &ai;
2921 2921
2922 /* :local ADDRESS or :remote ADDRESS */ 2922 /* :local ADDRESS or :remote ADDRESS */
2923 address = Fplist_get (contact, QCaddress); 2923 address = Fplist_get (contact, colon_address);
2924 if (!NILP (address)) 2924 if (!NILP (address))
2925 { 2925 {
2926 host = service = Qnil; 2926 host = service = Qnil;
@@ -3307,7 +3307,7 @@ usage: (make-network-process &rest ARGS) */)
3307 memcpy (datagram_address[s].sa, lres->ai_addr, lres->ai_addrlen); 3307 memcpy (datagram_address[s].sa, lres->ai_addr, lres->ai_addrlen);
3308 } 3308 }
3309#endif 3309#endif
3310 contact = Fplist_put (contact, QCaddress, 3310 contact = Fplist_put (contact, colon_address,
3311 conv_sockaddr_to_lisp (lres->ai_addr, lres->ai_addrlen)); 3311 conv_sockaddr_to_lisp (lres->ai_addr, lres->ai_addrlen));
3312#ifdef HAVE_GETSOCKNAME 3312#ifdef HAVE_GETSOCKNAME
3313 if (!is_server) 3313 if (!is_server)
diff --git a/src/search.c b/src/search.c
index dc4820d8588..ecfb2352144 100644
--- a/src/search.c
+++ b/src/search.c
@@ -1416,7 +1416,7 @@ search_buffer (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte,
1416 1416
1417 while (boyer_moore_ok) 1417 while (boyer_moore_ok)
1418 { 1418 {
1419 if (ASCII_BYTE_P (inverse)) 1419 if (ASCII_CHAR_P (inverse))
1420 { 1420 {
1421 if (this_char_base > 0) 1421 if (this_char_base > 0)
1422 boyer_moore_ok = 0; 1422 boyer_moore_ok = 0;
@@ -1827,7 +1827,7 @@ boyer_moore (EMACS_INT n, unsigned char *base_pat,
1827 matching with CHAR_BASE are to be checked. */ 1827 matching with CHAR_BASE are to be checked. */
1828 int ch = -1; 1828 int ch = -1;
1829 1829
1830 if (ASCII_BYTE_P (*ptr) || ! multibyte) 1830 if (ASCII_CHAR_P (*ptr) || ! multibyte)
1831 ch = *ptr; 1831 ch = *ptr;
1832 else if (char_base 1832 else if (char_base
1833 && ((pat_end - ptr) == 1 || CHAR_HEAD_P (ptr[1]))) 1833 && ((pat_end - ptr) == 1 || CHAR_HEAD_P (ptr[1])))
@@ -2596,7 +2596,7 @@ since only regular expressions have distinguished subexpressions. */)
2596 { 2596 {
2597 FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c, newtext, pos, pos_byte); 2597 FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c, newtext, pos, pos_byte);
2598 if (!buf_multibyte) 2598 if (!buf_multibyte)
2599 c = multibyte_char_to_unibyte (c); 2599 c = CHAR_TO_BYTE8 (c);
2600 } 2600 }
2601 else 2601 else
2602 { 2602 {
@@ -2619,7 +2619,7 @@ since only regular expressions have distinguished subexpressions. */)
2619 FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c, newtext, 2619 FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c, newtext,
2620 pos, pos_byte); 2620 pos, pos_byte);
2621 if (!buf_multibyte && !ASCII_CHAR_P (c)) 2621 if (!buf_multibyte && !ASCII_CHAR_P (c))
2622 c = multibyte_char_to_unibyte (c); 2622 c = CHAR_TO_BYTE8 (c);
2623 } 2623 }
2624 else 2624 else
2625 { 2625 {
diff --git a/src/term.c b/src/term.c
index 642907979aa..d4bb7e1bd32 100644
--- a/src/term.c
+++ b/src/term.c
@@ -1861,7 +1861,7 @@ produce_glyphless_glyph (struct it *it, Lisp_Object acronym)
1861 acronym = XCDR (acronym); 1861 acronym = XCDR (acronym);
1862 buf[0] = '['; 1862 buf[0] = '[';
1863 str = STRINGP (acronym) ? SSDATA (acronym) : ""; 1863 str = STRINGP (acronym) ? SSDATA (acronym) : "";
1864 for (len = 0; len < 6 && str[len] && ASCII_BYTE_P (str[len]); len++) 1864 for (len = 0; len < 6 && str[len] && ASCII_CHAR_P (str[len]); len++)
1865 buf[1 + len] = str[len]; 1865 buf[1 + len] = str[len];
1866 buf[1 + len] = ']'; 1866 buf[1 + len] = ']';
1867 len += 2; 1867 len += 2;
diff --git a/src/w32fns.c b/src/w32fns.c
index c9a83c98234..057bc95ee94 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -6894,7 +6894,7 @@ operations:
6894 \"runas\" - run DOCUMENT, which must be an excutable file, with 6894 \"runas\" - run DOCUMENT, which must be an excutable file, with
6895 elevated privileges (a.k.a. \"as Administrator\"). 6895 elevated privileges (a.k.a. \"as Administrator\").
6896 \"properties\" 6896 \"properties\"
6897 - open the the property sheet dialog for DOCUMENT. 6897 - open the property sheet dialog for DOCUMENT.
6898 nil - invoke the default OPERATION, or \"open\" if default is 6898 nil - invoke the default OPERATION, or \"open\" if default is
6899 not defined or unavailable. 6899 not defined or unavailable.
6900 6900
diff --git a/src/w32heap.c b/src/w32heap.c
index 94ba3428794..c431b87e0c2 100644
--- a/src/w32heap.c
+++ b/src/w32heap.c
@@ -200,12 +200,11 @@ dumped_data_commit (PVOID Base, PVOID *CommitAddress, PSIZE_T CommitSize)
200 as requests arrive. */ 200 as requests arrive. */
201 *CommitAddress = data_region_base + committed; 201 *CommitAddress = data_region_base + committed;
202 committed += *CommitSize; 202 committed += *CommitSize;
203 /* Check that the private heap area does not overlap the big chunks area. */
203 if (((unsigned char *)(*CommitAddress)) + *CommitSize >= bc_limit) 204 if (((unsigned char *)(*CommitAddress)) + *CommitSize >= bc_limit)
204 { 205 {
205 /* Check that the private heap area does not overlap the big 206 fprintf (stderr,
206 chunks area. */ 207 "dumped_data_commit: memory exhausted.\nEnlarge dumped_data[]!\n");
207 fprintf(stderr,
208 "dumped_data_commit: memory exhausted.\nEnlarge dumped_data[]!\n");
209 exit (-1); 208 exit (-1);
210 } 209 }
211 return 0; 210 return 0;
@@ -243,18 +242,20 @@ init_heap (void)
243 data_region_end = data_region_base; 242 data_region_end = data_region_base;
244 243
245 /* Create the private heap. */ 244 /* Create the private heap. */
246 heap = HeapCreate(0, 0, 0); 245 heap = HeapCreate (0, 0, 0);
247 246
248#ifndef _W64 247#ifndef _W64
249 /* Set the low-fragmentation heap for OS before Vista. */ 248 /* Set the low-fragmentation heap for OS before Vista. */
250 HMODULE hm_kernel32dll = LoadLibrary("kernel32.dll"); 249 HMODULE hm_kernel32dll = LoadLibrary ("kernel32.dll");
251 HeapSetInformation_Proc s_pfn_Heap_Set_Information = (HeapSetInformation_Proc) GetProcAddress(hm_kernel32dll, "HeapSetInformation"); 250 HeapSetInformation_Proc s_pfn_Heap_Set_Information = (HeapSetInformation_Proc) GetProcAddress (hm_kernel32dll, "HeapSetInformation");
252 if (s_pfn_Heap_Set_Information != NULL) 251 if (s_pfn_Heap_Set_Information != NULL)
253 if (s_pfn_Heap_Set_Information ((PVOID) heap, 252 {
254 HeapCompatibilityInformation, 253 if (s_pfn_Heap_Set_Information ((PVOID) heap,
255 &enable_lfh, sizeof(enable_lfh)) == 0) 254 HeapCompatibilityInformation,
256 DebPrint (("Enabling Low Fragmentation Heap failed: error %ld\n", 255 &enable_lfh, sizeof(enable_lfh)) == 0)
257 GetLastError ())); 256 DebPrint (("Enabling Low Fragmentation Heap failed: error %ld\n",
257 GetLastError ()));
258 }
258#endif 259#endif
259 260
260 the_malloc_fn = malloc_after_dump; 261 the_malloc_fn = malloc_after_dump;
@@ -271,7 +272,7 @@ init_heap (void)
271 = (RtlCreateHeap_Proc) GetProcAddress (hm_ntdll, "RtlCreateHeap"); 272 = (RtlCreateHeap_Proc) GetProcAddress (hm_ntdll, "RtlCreateHeap");
272 /* Specific parameters for the private heap. */ 273 /* Specific parameters for the private heap. */
273 RTL_HEAP_PARAMETERS params; 274 RTL_HEAP_PARAMETERS params;
274 ZeroMemory(&params, sizeof(params)); 275 ZeroMemory (&params, sizeof(params));
275 params.Length = sizeof(RTL_HEAP_PARAMETERS); 276 params.Length = sizeof(RTL_HEAP_PARAMETERS);
276 277
277 data_region_base = (unsigned char *)ROUND_UP (dumped_data, 0x1000); 278 data_region_base = (unsigned char *)ROUND_UP (dumped_data, 0x1000);
@@ -284,6 +285,11 @@ init_heap (void)
284 params.CommitRoutine = &dumped_data_commit; 285 params.CommitRoutine = &dumped_data_commit;
285 286
286 /* Create the private heap. */ 287 /* Create the private heap. */
288 if (s_pfn_Rtl_Create_Heap == NULL)
289 {
290 fprintf (stderr, "Cannot build Emacs without RtlCreateHeap being available; exiting.\n");
291 exit (-1);
292 }
287 heap = s_pfn_Rtl_Create_Heap (0, data_region_base, 0, 0, NULL, &params); 293 heap = s_pfn_Rtl_Create_Heap (0, data_region_base, 0, 0, NULL, &params);
288 the_malloc_fn = malloc_before_dump; 294 the_malloc_fn = malloc_before_dump;
289 the_realloc_fn = realloc_before_dump; 295 the_realloc_fn = realloc_before_dump;
@@ -358,8 +364,8 @@ malloc_before_dump (size_t size)
358 array. */ 364 array. */
359 if (blocks_number >= MAX_BLOCKS) 365 if (blocks_number >= MAX_BLOCKS)
360 { 366 {
361 fprintf(stderr, 367 fprintf (stderr,
362 "malloc_before_dump: no more big chunks available.\nEnlarge MAX_BLOCKS!\n"); 368 "malloc_before_dump: no more big chunks available.\nEnlarge MAX_BLOCKS!\n");
363 exit (-1); 369 exit (-1);
364 } 370 }
365 bc_limit -= size; 371 bc_limit -= size;
@@ -369,11 +375,11 @@ malloc_before_dump (size_t size)
369 blocks[blocks_number].size = size; 375 blocks[blocks_number].size = size;
370 blocks[blocks_number].occupied = TRUE; 376 blocks[blocks_number].occupied = TRUE;
371 blocks_number++; 377 blocks_number++;
378 /* Check that areas do not overlap. */
372 if (bc_limit < dumped_data + committed) 379 if (bc_limit < dumped_data + committed)
373 { 380 {
374 /* Check that areas do not overlap. */ 381 fprintf (stderr,
375 fprintf(stderr, 382 "malloc_before_dump: memory exhausted.\nEnlarge dumped_data[]!\n");
376 "malloc_before_dump: memory exhausted.\nEnlarge dumped_data[]!\n");
377 exit (-1); 383 exit (-1);
378 } 384 }
379 } 385 }
diff --git a/src/window.c b/src/window.c
index 46024614179..8a608433ed7 100644
--- a/src/window.c
+++ b/src/window.c
@@ -27,6 +27,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
27#include "buffer.h" 27#include "buffer.h"
28#include "keyboard.h" 28#include "keyboard.h"
29#include "keymap.h" 29#include "keymap.h"
30#include "menu.h"
30#include "frame.h" 31#include "frame.h"
31#include "window.h" 32#include "window.h"
32#include "commands.h" 33#include "commands.h"
diff --git a/src/xdisp.c b/src/xdisp.c
index d7368c7c0c4..31d293143f3 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -8269,7 +8269,7 @@ next_element_from_buffer (struct it *it)
8269 8269
8270 /* Get the next character, maybe multibyte. */ 8270 /* Get the next character, maybe multibyte. */
8271 p = BYTE_POS_ADDR (IT_BYTEPOS (*it)); 8271 p = BYTE_POS_ADDR (IT_BYTEPOS (*it));
8272 if (it->multibyte_p && !ASCII_BYTE_P (*p)) 8272 if (it->multibyte_p && !ASCII_CHAR_P (*p))
8273 it->c = STRING_CHAR_AND_LENGTH (p, it->len); 8273 it->c = STRING_CHAR_AND_LENGTH (p, it->len);
8274 else 8274 else
8275 it->c = *p, it->len = 1; 8275 it->c = *p, it->len = 1;
@@ -9932,9 +9932,7 @@ message_dolog (const char *m, ptrdiff_t nbytes, bool nlflag, bool multibyte)
9932 for (i = 0; i < nbytes; i += char_bytes) 9932 for (i = 0; i < nbytes; i += char_bytes)
9933 { 9933 {
9934 c = string_char_and_length (msg + i, &char_bytes); 9934 c = string_char_and_length (msg + i, &char_bytes);
9935 work[0] = (ASCII_CHAR_P (c) 9935 work[0] = CHAR_TO_BYTE8 (c);
9936 ? c
9937 : multibyte_char_to_unibyte (c));
9938 insert_1_both (work, 1, 1, 1, 0, 0); 9936 insert_1_both (work, 1, 1, 1, 0, 0);
9939 } 9937 }
9940 } 9938 }
@@ -12279,11 +12277,6 @@ tool_bar_height (struct frame *f, int *n_rows, bool pixelwise)
12279 12277
12280#endif /* !USE_GTK && !HAVE_NS */ 12278#endif /* !USE_GTK && !HAVE_NS */
12281 12279
12282#if defined USE_GTK || defined HAVE_NS
12283EXFUN (Ftool_bar_height, 2) ATTRIBUTE_CONST;
12284EXFUN (Ftool_bar_lines_needed, 1) ATTRIBUTE_CONST;
12285#endif
12286
12287DEFUN ("tool-bar-height", Ftool_bar_height, Stool_bar_height, 12280DEFUN ("tool-bar-height", Ftool_bar_height, Stool_bar_height,
12288 0, 2, 0, 12281 0, 2, 0,
12289 doc: /* Return the number of lines occupied by the tool bar of FRAME. 12282 doc: /* Return the number of lines occupied by the tool bar of FRAME.
@@ -15795,7 +15788,7 @@ set_vertical_scroll_bar (struct window *w)
15795 redisplay itself, when it decides that the previous window start 15788 redisplay itself, when it decides that the previous window start
15796 point is fine and should be kept. Search for "goto force_start" 15789 point is fine and should be kept. Search for "goto force_start"
15797 below to see the details. Like the values of window-start 15790 below to see the details. Like the values of window-start
15798 specified outside of redisply, these internally deduced values 15791 specified outside of redisplay, these internally-deduced values
15799 are tested for feasibility, and ignored if found to be 15792 are tested for feasibility, and ignored if found to be
15800 unfeasible. 15793 unfeasible.
15801 15794
@@ -20746,12 +20739,15 @@ Value is the new character position of point. */)
20746 recorded in the glyphs, at least as long as the goal is on the 20739 recorded in the glyphs, at least as long as the goal is on the
20747 screen. */ 20740 screen. */
20748 if (w->window_end_valid 20741 if (w->window_end_valid
20749 && NILP (Vexecuting_kbd_macro)
20750 && !windows_or_buffers_changed 20742 && !windows_or_buffers_changed
20751 && b 20743 && b
20752 && !b->clip_changed 20744 && !b->clip_changed
20753 && !b->prevent_redisplay_optimizations_p 20745 && !b->prevent_redisplay_optimizations_p
20754 && !window_outdated (w) 20746 && !window_outdated (w)
20747 /* We rely below on the cursor coordinates to be up to date, but
20748 we cannot trust them if some command moved point since the
20749 last complete redisplay. */
20750 && w->last_point == BUF_PT (b)
20755 && w->cursor.vpos >= 0 20751 && w->cursor.vpos >= 0
20756 && w->cursor.vpos < w->current_matrix->nrows 20752 && w->cursor.vpos < w->current_matrix->nrows
20757 && (row = MATRIX_ROW (w->current_matrix, w->cursor.vpos))->enabled_p) 20753 && (row = MATRIX_ROW (w->current_matrix, w->cursor.vpos))->enabled_p)
@@ -25783,7 +25779,7 @@ produce_glyphless_glyph (struct it *it, int for_no_font, Lisp_Object acronym)
25783 sprintf (buf, "%0*X", it->c < 0x10000 ? 4 : 6, it->c); 25779 sprintf (buf, "%0*X", it->c < 0x10000 ? 4 : 6, it->c);
25784 str = buf; 25780 str = buf;
25785 } 25781 }
25786 for (len = 0; str[len] && ASCII_BYTE_P (str[len]) && len < 6; len++) 25782 for (len = 0; str[len] && ASCII_CHAR_P (str[len]) && len < 6; len++)
25787 code[len] = font->driver->encode_char (font, str[len]); 25783 code[len] = font->driver->encode_char (font, str[len]);
25788 upper_len = (len + 1) / 2; 25784 upper_len = (len + 1) / 2;
25789 font->driver->text_extents (font, code, upper_len, 25785 font->driver->text_extents (font, code, upper_len,
diff --git a/src/xfns.c b/src/xfns.c
index dc3211e4d6b..c3d9900207f 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -24,6 +24,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
24 24
25#include "lisp.h" 25#include "lisp.h"
26#include "xterm.h" 26#include "xterm.h"
27#include "menu.h"
27#include "frame.h" 28#include "frame.h"
28#include "window.h" 29#include "window.h"
29#include "character.h" 30#include "character.h"
@@ -329,8 +330,43 @@ x_real_positions (struct frame *f, int *xptr, int *yptr)
329 *yptr = real_y; 330 *yptr = real_y;
330} 331}
331 332
332 333/* Get the mouse position in frame relative coordinates. */
334
335void
336x_relative_mouse_position (struct frame *f, int *x, int *y)
337{
338 Window root, dummy_window;
339 int dummy;
340
341 eassert (FRAME_X_P (f));
342
343 block_input ();
344
345 XQueryPointer (FRAME_X_DISPLAY (f),
346 DefaultRootWindow (FRAME_X_DISPLAY (f)),
333 347
348 /* The root window which contains the pointer. */
349 &root,
350
351 /* Window pointer is on, not used */
352 &dummy_window,
353
354 /* The position on that root window. */
355 x, y,
356
357 /* x/y in dummy_window coordinates, not used. */
358 &dummy, &dummy,
359
360 /* Modifier keys and pointer buttons, about which
361 we don't care. */
362 (unsigned int *) &dummy);
363
364 unblock_input ();
365
366 /* Translate root window coordinates to window coordinates. */
367 *x -= f->left_pos + FRAME_OUTER_TO_INNER_DIFF_X (f);
368 *y -= f->top_pos + FRAME_OUTER_TO_INNER_DIFF_Y (f);
369}
334 370
335/* Gamma-correct COLOR on frame F. */ 371/* Gamma-correct COLOR on frame F. */
336 372
diff --git a/src/xftfont.c b/src/xftfont.c
index 421eb713a15..2b4ec065734 100644
--- a/src/xftfont.c
+++ b/src/xftfont.c
@@ -322,16 +322,6 @@ xftfont_open (struct frame *f, Lisp_Object entity, int pixel_size)
322 322
323 323
324 block_input (); 324 block_input ();
325 /* Make sure that the Xrender extension is added before the Xft one.
326 Otherwise, the close-display hook set by Xft is called after the
327 one for Xrender, and the former tries to re-add the latter. This
328 results in inconsistency of internal states and leads to X
329 protocol error when one reconnects to the same X server.
330 (Bug#1696) */
331 {
332 int event_base, error_base;
333 XRenderQueryExtension (display, &event_base, &error_base);
334 }
335 325
336 /* Substitute in values from X resources and XftDefaultSet. */ 326 /* Substitute in values from X resources and XftDefaultSet. */
337 XftDefaultSubstitute (display, FRAME_X_SCREEN_NUMBER (f), pat); 327 XftDefaultSubstitute (display, FRAME_X_SCREEN_NUMBER (f), pat);
diff --git a/src/xmenu.c b/src/xmenu.c
index 2d41350e737..e04a801ef71 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -139,53 +139,6 @@ menubar_id_to_frame (LWLIB_ID id)
139} 139}
140 140
141#endif 141#endif
142
143#ifdef HAVE_X_WINDOWS
144/* Return the mouse position in *X and *Y. The coordinates are window
145 relative for the edit window in frame F.
146 This is for Fx_popup_menu. The mouse_position_hook can not
147 be used for X, as it returns window relative coordinates
148 for the window where the mouse is in. This could be the menu bar,
149 the scroll bar or the edit window. Fx_popup_menu needs to be
150 sure it is the edit window. */
151void
152mouse_position_for_popup (struct frame *f, int *x, int *y)
153{
154 Window root, dummy_window;
155 int dummy;
156
157 eassert (FRAME_X_P (f));
158
159 block_input ();
160
161 XQueryPointer (FRAME_X_DISPLAY (f),
162 DefaultRootWindow (FRAME_X_DISPLAY (f)),
163
164 /* The root window which contains the pointer. */
165 &root,
166
167 /* Window pointer is on, not used */
168 &dummy_window,
169
170 /* The position on that root window. */
171 x, y,
172
173 /* x/y in dummy_window coordinates, not used. */
174 &dummy, &dummy,
175
176 /* Modifier keys and pointer buttons, about which
177 we don't care. */
178 (unsigned int *) &dummy);
179
180 unblock_input ();
181
182 /* x_menu_show expects window coordinates, not root window
183 coordinates. Translate. */
184 *x -= f->left_pos + FRAME_OUTER_TO_INNER_DIFF_X (f);
185 *y -= f->top_pos + FRAME_OUTER_TO_INNER_DIFF_Y (f);
186}
187
188#endif /* HAVE_X_WINDOWS */
189 142
190#ifndef MSDOS 143#ifndef MSDOS
191 144
diff --git a/src/xselect.c b/src/xselect.c
index 28f2d770a77..89ec1da30b2 100644
--- a/src/xselect.c
+++ b/src/xselect.c
@@ -2373,43 +2373,6 @@ x_property_data_to_lisp (struct frame *f, const unsigned char *data,
2373 data, size * format_bytes, type, format); 2373 data, size * format_bytes, type, format);
2374} 2374}
2375 2375
2376/* Get the mouse position in frame relative coordinates. */
2377
2378static void
2379mouse_position_for_drop (struct frame *f, int *x, int *y)
2380{
2381 Window root, dummy_window;
2382 int dummy;
2383
2384 block_input ();
2385
2386 XQueryPointer (FRAME_X_DISPLAY (f),
2387 DefaultRootWindow (FRAME_X_DISPLAY (f)),
2388
2389 /* The root window which contains the pointer. */
2390 &root,
2391
2392 /* Window pointer is on, not used */
2393 &dummy_window,
2394
2395 /* The position on that root window. */
2396 x, y,
2397
2398 /* x/y in dummy_window coordinates, not used. */
2399 &dummy, &dummy,
2400
2401 /* Modifier keys and pointer buttons, about which
2402 we don't care. */
2403 (unsigned int *) &dummy);
2404
2405
2406 /* Absolute to relative. */
2407 *x -= f->left_pos + FRAME_OUTER_TO_INNER_DIFF_X (f);
2408 *y -= f->top_pos + FRAME_OUTER_TO_INNER_DIFF_Y (f);
2409
2410 unblock_input ();
2411}
2412
2413DEFUN ("x-get-atom-name", Fx_get_atom_name, 2376DEFUN ("x-get-atom-name", Fx_get_atom_name,
2414 Sx_get_atom_name, 1, 2, 0, 2377 Sx_get_atom_name, 1, 2, 0,
2415 doc: /* Return the X atom name for VALUE as a string. 2378 doc: /* Return the X atom name for VALUE as a string.
@@ -2529,7 +2492,7 @@ x_handle_dnd_message (struct frame *f, const XClientMessageEvent *event,
2529 event->format, 2492 event->format,
2530 size)); 2493 size));
2531 2494
2532 mouse_position_for_drop (f, &x, &y); 2495 x_relative_mouse_position (f, &x, &y);
2533 bufp->kind = DRAG_N_DROP_EVENT; 2496 bufp->kind = DRAG_N_DROP_EVENT;
2534 bufp->frame_or_window = frame; 2497 bufp->frame_or_window = frame;
2535 bufp->timestamp = CurrentTime; 2498 bufp->timestamp = CurrentTime;
diff --git a/src/xterm.c b/src/xterm.c
index b6728880f5d..45bb7b2a918 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -37,6 +37,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
37#include <X11/extensions/Xfixes.h> 37#include <X11/extensions/Xfixes.h>
38#endif 38#endif
39 39
40/* Using Xft implies that XRender is available. */
41#ifdef HAVE_XFT
42#include <X11/extensions/Xrender.h>
43#endif
44
40/* Load sys/types.h if not already loaded. 45/* Load sys/types.h if not already loaded.
41 In some systems loading it twice is suicidal. */ 46 In some systems loading it twice is suicidal. */
42#ifndef makedev 47#ifndef makedev
@@ -221,7 +226,6 @@ static void x_lower_frame (struct frame *);
221static const XColor *x_color_cells (Display *, int *); 226static const XColor *x_color_cells (Display *, int *);
222static int x_io_error_quitter (Display *); 227static int x_io_error_quitter (Display *);
223static struct terminal *x_create_terminal (struct x_display_info *); 228static struct terminal *x_create_terminal (struct x_display_info *);
224void x_delete_terminal (struct terminal *);
225static void x_update_end (struct frame *); 229static void x_update_end (struct frame *);
226static void XTframe_up_to_date (struct frame *); 230static void XTframe_up_to_date (struct frame *);
227static void x_clear_frame (struct frame *); 231static void x_clear_frame (struct frame *);
@@ -354,8 +358,10 @@ x_find_topmost_parent (struct frame *f)
354 unsigned int nchildren; 358 unsigned int nchildren;
355 359
356 win = wi; 360 win = wi;
357 XQueryTree (dpy, win, &root, &wi, &children, &nchildren); 361 if (XQueryTree (dpy, win, &root, &wi, &children, &nchildren))
358 XFree (children); 362 XFree (children);
363 else
364 break;
359 } 365 }
360 366
361 return win; 367 return win;
@@ -6454,7 +6460,7 @@ handle_one_xevent (struct x_display_info *dpyinfo,
6454 6460
6455 for (i = 0, nchars = 0; i < nbytes; i++) 6461 for (i = 0, nchars = 0; i < nbytes; i++)
6456 { 6462 {
6457 if (ASCII_BYTE_P (copy_bufptr[i])) 6463 if (ASCII_CHAR_P (copy_bufptr[i]))
6458 nchars++; 6464 nchars++;
6459 STORE_KEYSYM_FOR_DEBUG (copy_bufptr[i]); 6465 STORE_KEYSYM_FOR_DEBUG (copy_bufptr[i]);
6460 } 6466 }
@@ -7854,11 +7860,6 @@ xim_destroy_callback (XIM xim, XPointer client_data, XPointer call_data)
7854 7860
7855#endif /* HAVE_X11R6 */ 7861#endif /* HAVE_X11R6 */
7856 7862
7857#ifdef HAVE_X11R6
7858/* This isn't prototyped in OSF 5.0 or 5.1a. */
7859extern char *XSetIMValues (XIM, ...);
7860#endif
7861
7862/* Open the connection to the XIM server on display DPYINFO. 7863/* Open the connection to the XIM server on display DPYINFO.
7863 RESOURCE_NAME is the resource name Emacs uses. */ 7864 RESOURCE_NAME is the resource name Emacs uses. */
7864 7865
@@ -9774,7 +9775,7 @@ x_toggle_visible_pointer (struct frame *f, bool invisible)
9774 else 9775 else
9775 XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), 9776 XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f),
9776 f->output_data.x->current_cursor); 9777 f->output_data.x->current_cursor);
9777 f->pointer_invisible = invisible; 9778 f->pointer_invisible = invisible;
9778} 9779}
9779 9780
9780/* Setup pointer blanking, prefer Xfixes if available. */ 9781/* Setup pointer blanking, prefer Xfixes if available. */
@@ -10086,14 +10087,27 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
10086 10087
10087#ifdef HAVE_XFT 10088#ifdef HAVE_XFT
10088 { 10089 {
10089 /* If we are using Xft, check dpi value in X resources. 10090 /* If we are using Xft, the following precautions should be made:
10090 It is better we use it as well, since Xft will use it, as will all 10091
10091 Gnome applications. If our real DPI is smaller or larger than the 10092 1. Make sure that the Xrender extension is added before the Xft one.
10092 one Xft uses, our font will look smaller or larger than other 10093 Otherwise, the close-display hook set by Xft is called after the one
10093 for other applications, even if it is the same font name (monospace-10 10094 for Xrender, and the former tries to re-add the latter. This results
10094 for example). */ 10095 in inconsistency of internal states and leads to X protocol error when
10095 char *v = XGetDefault (dpyinfo->display, "Xft", "dpi"); 10096 one reconnects to the same X server (Bug#1696).
10097
10098 2. Check dpi value in X resources. It is better we use it as well,
10099 since Xft will use it, as will all Gnome applications. If our real DPI
10100 is smaller or larger than the one Xft uses, our font will look smaller
10101 or larger than other for other applications, even if it is the same
10102 font name (monospace-10 for example). */
10103
10104 int event_base, error_base;
10105 char *v;
10096 double d; 10106 double d;
10107
10108 XRenderQueryExtension (dpyinfo->display, &event_base, &error_base);
10109
10110 v = XGetDefault (dpyinfo->display, "Xft", "dpi");
10097 if (v != NULL && sscanf (v, "%lf", &d) == 1) 10111 if (v != NULL && sscanf (v, "%lf", &d) == 1)
10098 dpyinfo->resy = dpyinfo->resx = d; 10112 dpyinfo->resy = dpyinfo->resx = d;
10099 } 10113 }
@@ -10222,7 +10236,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name)
10222 1, 0, 1); 10236 1, 0, 1);
10223 10237
10224 x_setup_pointer_blanking (dpyinfo); 10238 x_setup_pointer_blanking (dpyinfo);
10225 10239
10226#ifdef HAVE_X_I18N 10240#ifdef HAVE_X_I18N
10227 xim_initialize (dpyinfo, resource_name); 10241 xim_initialize (dpyinfo, resource_name);
10228#endif 10242#endif
@@ -10538,7 +10552,7 @@ x_create_terminal (struct x_display_info *dpyinfo)
10538 terminal->menu_show_hook = x_menu_show; 10552 terminal->menu_show_hook = x_menu_show;
10539#if defined (USE_X_TOOLKIT) || defined (USE_GTK) 10553#if defined (USE_X_TOOLKIT) || defined (USE_GTK)
10540 terminal->popup_dialog_hook = xw_popup_dialog; 10554 terminal->popup_dialog_hook = xw_popup_dialog;
10541#endif 10555#endif
10542 terminal->set_vertical_scroll_bar_hook = XTset_vertical_scroll_bar; 10556 terminal->set_vertical_scroll_bar_hook = XTset_vertical_scroll_bar;
10543 terminal->condemn_scroll_bars_hook = XTcondemn_scroll_bars; 10557 terminal->condemn_scroll_bars_hook = XTcondemn_scroll_bars;
10544 terminal->redeem_scroll_bar_hook = XTredeem_scroll_bar; 10558 terminal->redeem_scroll_bar_hook = XTredeem_scroll_bar;
@@ -10550,7 +10564,7 @@ x_create_terminal (struct x_display_info *dpyinfo)
10550 return terminal; 10564 return terminal;
10551} 10565}
10552 10566
10553void 10567static void
10554x_initialize (void) 10568x_initialize (void)
10555{ 10569{
10556 baud_rate = 19200; 10570 baud_rate = 19200;
diff --git a/src/xterm.h b/src/xterm.h
index 9daa478c964..6d80d1253ae 100644
--- a/src/xterm.h
+++ b/src/xterm.h
@@ -914,6 +914,7 @@ struct selection_input_event
914/* From xfns.c. */ 914/* From xfns.c. */
915 915
916extern void x_free_gcs (struct frame *); 916extern void x_free_gcs (struct frame *);
917extern void x_relative_mouse_position (struct frame *, int *, int *);
917 918
918/* From xrdb.c. */ 919/* From xrdb.c. */
919 920
@@ -929,7 +930,6 @@ extern void x_check_errors (Display *, const char *)
929extern bool x_had_errors_p (Display *); 930extern bool x_had_errors_p (Display *);
930extern void x_uncatch_errors (void); 931extern void x_uncatch_errors (void);
931extern void x_clear_errors (Display *); 932extern void x_clear_errors (Display *);
932extern void x_set_window_size (struct frame *, int, int, int, bool);
933extern void xembed_request_focus (struct frame *); 933extern void xembed_request_focus (struct frame *);
934extern void x_ewmh_activate_frame (struct frame *); 934extern void x_ewmh_activate_frame (struct frame *);
935extern void x_delete_terminal (struct terminal *terminal); 935extern void x_delete_terminal (struct terminal *terminal);
@@ -944,7 +944,6 @@ extern bool x_alloc_lighter_color_for_widget (Widget, Display *, Colormap,
944 double, int); 944 double, int);
945#endif 945#endif
946extern bool x_alloc_nearest_color (struct frame *, Colormap, XColor *); 946extern bool x_alloc_nearest_color (struct frame *, Colormap, XColor *);
947extern void x_query_color (struct frame *f, XColor *);
948extern void x_clear_area (Display *, Window, int, int, int, int); 947extern void x_clear_area (Display *, Window, int, int, int, int);
949#if !defined USE_X_TOOLKIT && !defined USE_GTK 948#if !defined USE_X_TOOLKIT && !defined USE_GTK
950extern void x_mouse_leave (struct x_display_info *); 949extern void x_mouse_leave (struct x_display_info *);
@@ -991,16 +990,11 @@ extern Lisp_Object x_property_data_to_lisp (struct frame *,
991extern void x_clipboard_manager_save_frame (Lisp_Object); 990extern void x_clipboard_manager_save_frame (Lisp_Object);
992extern void x_clipboard_manager_save_all (void); 991extern void x_clipboard_manager_save_all (void);
993 992
994/* Defined in xfns.c */
995
996extern Lisp_Object x_get_focus_frame (struct frame *);
997
998#ifdef USE_GTK 993#ifdef USE_GTK
999extern int xg_set_icon (struct frame *, Lisp_Object); 994extern int xg_set_icon (struct frame *, Lisp_Object);
1000extern int xg_set_icon_from_xpm_data (struct frame *, const char **); 995extern int xg_set_icon_from_xpm_data (struct frame *, const char **);
1001#endif /* USE_GTK */ 996#endif /* USE_GTK */
1002 997
1003extern void x_implicitly_set_name (struct frame *, Lisp_Object, Lisp_Object);
1004extern void xic_free_xfontset (struct frame *); 998extern void xic_free_xfontset (struct frame *);
1005extern void create_frame_xic (struct frame *); 999extern void create_frame_xic (struct frame *);
1006extern void destroy_frame_xic (struct frame *); 1000extern void destroy_frame_xic (struct frame *);
@@ -1032,15 +1026,8 @@ extern Lisp_Object xw_popup_dialog (struct frame *, Lisp_Object, Lisp_Object);
1032extern void x_menu_set_in_use (int); 1026extern void x_menu_set_in_use (int);
1033#endif 1027#endif
1034extern void x_menu_wait_for_event (void *data); 1028extern void x_menu_wait_for_event (void *data);
1035extern int popup_activated (void);
1036extern void initialize_frame_menubar (struct frame *); 1029extern void initialize_frame_menubar (struct frame *);
1037 1030
1038/* Defined in widget.c */
1039
1040#ifdef USE_X_TOOLKIT
1041extern void widget_store_internal_border (Widget);
1042#endif
1043
1044/* Defined in xsmfns.c */ 1031/* Defined in xsmfns.c */
1045#ifdef HAVE_X_SM 1032#ifdef HAVE_X_SM
1046extern void x_session_initialize (struct x_display_info *dpyinfo); 1033extern void x_session_initialize (struct x_display_info *dpyinfo);