diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/ChangeLog | 190 | ||||
| -rw-r--r-- | src/Makefile.in | 42 | ||||
| -rw-r--r-- | src/buffer.c | 4 | ||||
| -rw-r--r-- | src/callint.c | 36 | ||||
| -rw-r--r-- | src/ccl.c | 7 | ||||
| -rw-r--r-- | src/character.c | 26 | ||||
| -rw-r--r-- | src/character.h | 22 | ||||
| -rw-r--r-- | src/charset.c | 6 | ||||
| -rw-r--r-- | src/charset.h | 2 | ||||
| -rw-r--r-- | src/cmds.c | 4 | ||||
| -rw-r--r-- | src/coding.c | 51 | ||||
| -rw-r--r-- | src/commands.h | 4 | ||||
| -rw-r--r-- | src/composite.c | 66 | ||||
| -rw-r--r-- | src/dispextern.h | 3 | ||||
| -rw-r--r-- | src/editfns.c | 16 | ||||
| -rw-r--r-- | src/eval.c | 5 | ||||
| -rw-r--r-- | src/fileio.c | 25 | ||||
| -rw-r--r-- | src/fns.c | 98 | ||||
| -rw-r--r-- | src/font.c | 9 | ||||
| -rw-r--r-- | src/fontset.c | 39 | ||||
| -rw-r--r-- | src/frame.c | 3 | ||||
| -rw-r--r-- | src/frame.h | 2 | ||||
| -rw-r--r-- | src/ftfont.c | 2 | ||||
| -rw-r--r-- | src/image.c | 52 | ||||
| -rw-r--r-- | src/indent.c | 29 | ||||
| -rw-r--r-- | src/insdel.c | 2 | ||||
| -rw-r--r-- | src/intervals.h | 2 | ||||
| -rw-r--r-- | src/keyboard.c | 40 | ||||
| -rw-r--r-- | src/lisp.h | 87 | ||||
| -rw-r--r-- | src/lread.c | 8 | ||||
| -rw-r--r-- | src/macros.c | 2 | ||||
| -rw-r--r-- | src/menu.c | 2 | ||||
| -rw-r--r-- | src/menu.h | 3 | ||||
| -rw-r--r-- | src/print.c | 2 | ||||
| -rw-r--r-- | src/process.c | 10 | ||||
| -rw-r--r-- | src/search.c | 8 | ||||
| -rw-r--r-- | src/term.c | 2 | ||||
| -rw-r--r-- | src/w32fns.c | 2 | ||||
| -rw-r--r-- | src/w32heap.c | 42 | ||||
| -rw-r--r-- | src/window.c | 1 | ||||
| -rw-r--r-- | src/xdisp.c | 20 | ||||
| -rw-r--r-- | src/xfns.c | 38 | ||||
| -rw-r--r-- | src/xftfont.c | 10 | ||||
| -rw-r--r-- | src/xmenu.c | 47 | ||||
| -rw-r--r-- | src/xselect.c | 39 | ||||
| -rw-r--r-- | src/xterm.c | 54 | ||||
| -rw-r--r-- | src/xterm.h | 15 |
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 @@ +2014-06-27 Glenn Morris <rgm@gnu.org> + + * Makefile.in: Replace BOOTSTRAPEMACS sleight-of-hand + with an order-only dependence on bootstrap-emacs. (Bug#2151) + (.el.elc): Replace suffix rule with pattern rule. + (%.elc): New pattern rule, with order-only prerequisite. + ($(lisp)): No more need to depend on BOOTSTRAPEMACS. + ($(lispsource)/loaddefs.el): Use an order-only prerequisite + in place of BOOTSTRAPEMACS. + +2014-06-26 Dmitry Antipov <dmantipov@yandex.ru> + + * fns.c (Fcompare_strings): Use FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE. + +2014-06-25 Dmitry Antipov <dmantipov@yandex.ru> + + Consistently use validate_subarray to verify substring. + * fns.c (validate_substring): Not static any more. Adjust to + use ptrdiff_t, not EMACS_INT, because string and vector limits + can't exceed ptrdiff_t even if EMACS_INT is wider. + (Fcompare_strings, Fsubstring, Fsubstring_no_properties) + (secure_hash): Adjust user. + * lisp.h (validate_subarray): Add prototype. + * coding.c (Fundecodable_char_position): + * composite.c (Fcomposition_get_gstring, Fcompose_string_internal): + Use validate_subarray. Adjust comment to mention substring. + +2014-06-25 Dmitry Antipov <dmantipov@yandex.ru> + + Do not allow out-of-range character position in Fcompare_strings. + * fns.c (validate_subarray): Add prototype. + (Fcompare_substring): Use validate_subarray to check ranges. + Adjust comment to mention that the semantics was changed. Also see + http://lists.gnu.org/archive/html/emacs-devel/2014-06/msg00447.html. + +2014-06-24 Paul Eggert <eggert@cs.ucla.edu> + + Be more consistent about the 'Qfoo' naming convention. + * image.c (Fimagemagick_types): + * lisp.h (lisp_h_CHECK_TYPE, CHECK_TYPE, CHECK_ARRAY): + * process.c (Fmake_network_process): + Rename C local identifier 'Qfoo to avoid giving the false + impression that it stands for the symbol 'foo'. + +2014-06-23 Dmitry Antipov <dmantipov@yandex.ru> + + Simplify and cleanup character conversion stuff. + * lisp.h (multibyte_char_to_unibyte, multibyte_char_to_unibyte_safe): + Remove prototypes. + * character.c (multibyte_char_to_unibyte) + (multibyte_char_to_unibyte_safe): Remove; no longer used. + * character.h (make_char): Remove; unused. + (CHAR_TO_BYTE8, CHAR_TO_BYTE_SAFE): Simplify. + (ASCII_BYTE_P): Remove; ASCII_CHAR_P does the same thing. + * buffer.c, charset.c, charset.h, cmds.c, coding.c, editfns.c: + * fileio.c, indent.c, insdel.c, keyboard.c, lread.c, print.c: + * search.c, term.c, xdisp.c, xterm.c: Related users changed. + +2014-06-22 Mario Lang <mlang@delysid.org> + + * w32fns.c (Fw32_shell_execute): The the -> the. + +2014-06-22 Dmitry Antipov <dmantipov@yandex.ru> + + * xmenu.c (mouse_position_for_popup): + * xselect.c (mouse_position_for_drop): Do not duplicate ... + * xfns.c (x_relative_mouse_position): ... and prefer this function. + * menu.c (Fx_popup_menu): + * xselect.c (x_handle_dnd_message): Adjust users. + * menu.h (mouse_position_for_popup): Remove prototype. + * xterm.h (x_relative_mouse_position): Add prototype. + * xterm.c (x_find_topmost_parent): Break from the loop and do not + call XFree if XQueryTree returns zero. + +2014-06-21 Eli Zaretskii <eliz@gnu.org> + + * indent.c (Fvertical_motion): Doc fix. + Move to the goal column, if any, with a single call to + move_it_in_display_line, not in two calls. Doing this with two + calls causes move_it_in_display_line apply the line-prefix + handling twice instead of just once. (Bug#17823) + +2014-06-21 Paul Eggert <eggert@cs.ucla.edu> + + Port to OS X ACLs (Bug#17810). + * fileio.c (Ffile_acl): Port to OS X, where acl_get_file (..., + ACL_TYPE_ACCESS) doesn't work. + +2014-06-21 Stefan Monnier <monnier@iro.umontreal.ca> + + * keyboard.c (read_key_sequence): Don't invoke Vprefix_help_command + before checking key-translation-map (bug#17659). + +2014-06-21 Dmitry Antipov <dmantipov@yandex.ru> + + * font.c (font_make_object): Avoid dangling pointer which may + crash GC (Bug#17771). + +2014-06-21 Eli Zaretskii <eliz@gnu.org> + + * image.c [5 < GIFLIB_MAJOR + (1 <= GIFLIB_MINOR)]: Declare the + prototype of DGifCloseFile as appropriate for older and newer + versions of giflib. + (gif_close): New function, encapsulates the differences in the + calling sequence of DGifCloseFile before v5.1.0 and after it. + (gif_load): Call gif_close instead of DGifCloseFile. Divulge the + error string where appropriate. (Bug#17790) + + * xdisp.c (Fmove_point_visually): Instead of testing for keyboard + macro execution, make sure point didn't move since last complete + redisplay, as the condition for using the glyph matrix + information. (Bug#17777) + +2014-06-19 Dmitry Antipov <dmantipov@yandex.ru> + + Minor cleanup of fonset code. + * fontset.c (FONTSET_ID, set_fontset_id, FONTSET_NAME) + (set_fontset_name, FONTSET_ASCII, set_fontset_ascii) + (FONTSET_BASE, set_fontset_base, FONTSET_FRAME) + (set_fontset_frame, FONTSET_NOFONT_FACE, set_fontset_nofont_face) + (FONTSET_DEFAULT, set_fontset_default, FONTSET_FALLBACK) + (set_fontset_fallback): Reorder extra slots and avoid unused slots. + (free_realized_fontset): Remove because a no-op since 2008. + (free_face_fontset): Adjust user. + (syms_of_fontset): Shrink fontset by one extra slot. + +2014-06-17 Paul Eggert <eggert@cs.ucla.edu> + + Omit redundant extern decls. + Most of this patch is from Dmitry Antipov, in: + http://lists.gnu.org/archive/html/emacs-devel/2014-06/msg00263.html + * commands.h (update_mode_lines): + * frame.h (Qbackground_color, Qforeground_color) + (x_set_menu_bar_lines): + * ftfont.c (ftfont_font_format): + * intervals.h (Qkeymap, Qfont): + * keyboard.c (timer_check, safe_run_hooks, Qregion_extract_function): + * lisp.h (Ffboundp, Qnil, Qt, Qlambda, Qintegerp, Qwholenump) + (Qsymbolp, Qlisp, Qconsp, Qstringp, Qarrayp, Qbufferp, Qmarkerp) + (Qvectorp, Qbuffer_or_string_p, Qchar_table_p, Qvector_or_char_table_p) + (Qfloatp, Qnumberp, Qfont_spec, Qfont_entity, Qfont_object) + (Fbyteorder, wrong_type_argument, Fmax_char, syms_of_composite) + (Fidentity, extract_float, init_display, syms_of_display, Qdisplay): + (Qimage, Qbox, redisplay_preserve_echo_area, char_table_ref) + (char_table_set, char_table_translate, Qautoload, Qbottom, Qtop) + (Qvisible, Qfont, Qfront_sticky, Qrear_nonsticky, init_sigio) + (Qtool_bar, Qheader_line): + * macros.c (Fexecute_kbd_macro): + * xdisp.c (Ftool_bar_height, Ftool_bar_height): + * xterm.c (x_delete_terminal, XSetIMValues): + * xterm.h (x_set_window_size, x_query_color, x_get_focus_frame) + (x_implicitly_set_name, popup_activated) + (widget_store_internal_border): + Remove redundant decls. + * frame.c [USE_X_TOOLKIT]: Include widget.h. + * keyboard.c (Fexit_recursive_edit, Fabort_recursive_edit): + Remove _Noreturn, as make-docfile now does that for us. + * lisp.h (DEFUN): Don't declare fnname here; rely on make-docfile. + (Qregion_extract_function): New decl. + * window.c, xfns.c: Include menu.h. + +2014-06-17 Stefan Monnier <monnier@iro.umontreal.ca> + + * callint.c (Fcall_interactively): Fix up last change (bug#17701). + +2014-06-17 Dmitry Antipov <dmantipov@yandex.ru> + + * fileio.c (Fread_file_name): Do not pass redundant args and ... + * callint.c (read_file_name): ... convert to static here. + * lisp.h (Fread_file_name): Do not EXFUN it. + (STRING_COPYIN): Remove; unused. + * composite.c (CHAR_COMPOSABLE_P): Replace unsafe macro with ... + (char_composable_p): ... static function. All users changed. + * eval.c (toplevel): Remove redundant #include directives. + * xterm.c (x_initialize): Add static to match prototype. + * ccl.c (Fccl_execute_on_string): + * font.c (fon_intern_prop): Use make_specified_string. + +2014-06-16 Paul Eggert <eggert@cs.ucla.edu> + + * Makefile.in (ns-app): Fix typo that broke build on OS X. + Reported by David Caldwell in: + http://lists.gnu.org/archive/html/emacs-devel/2014-06/msg00251.html + +2014-06-16 Dmitry Antipov <dmantipov@yandex.ru> + + Do not ask for XRender extension each time XFT font is opened. + * xftfont.c (xftfont_open): Move call to XRenderQueryExtension ... + * xterm.c (x_term_init) [HAVE_XFT]: ... to here. Adjust comment. + 2014-06-15 Glenn Morris <rgm@gnu.org> * 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 @@ ### @configure_input@ -# Copyright (C) 1985, 1987-1988, 1993-1995, 1999-2014 Free Software -# Foundation, Inc. +# Copyright (C) 1985, 1987-1988, 1993-1995, 1999-2014 +# Free Software Foundation, Inc. # This file is part of GNU Emacs. @@ -519,7 +519,7 @@ emacs.res: $(ntsource)/emacs.rc \ -o $@ $(ntsource)/emacs.rc ns-app: emacs$(EXEEXT) - $(MAKE) -C ./nextstep all + $(MAKE) -C ../nextstep all .PHONY: mostlyclean clean bootstrap-clean distclean maintainer-clean .PHONY: versionclean extraclean @@ -594,40 +594,28 @@ tags: TAGS ../lisp/TAGS $(lwlibdir)/TAGS ## such as loaddefs.el or *.elc can typically be produced by any old ## Emacs executable, so we would like to avoid rebuilding them whenever ## we build a new Emacs executable. +## +## (In other words, changing a single file src/foo.c would force +## dumping a new bootstrap-emacs, then re-byte-compiling all preloaded +## elisp files, and only then dump the actual src/emacs, which is not +## wrong, but is overkill in 99.99% of the cases.) +## ## To solve the circularity, we use 2 different Emacs executables, ## "emacs" is the main target and "bootstrap-emacs" is the one used ## to build the *.elc and loaddefs.el files. -## To solve the freshness issue, we used to use a third file "witness-emacs" -## which was used to witness the fact that there is a bootstrap-emacs -## executable, and then have dependencies on witness-emacs rather than -## bootstrap-emacs, but that lead to problems in parallel builds (because -## witness-emacs needed to be free from dependencies (to avoid rebuilding -## it), so it was compiled in parallel, leading typically to having 2 -## processes dumping bootstrap-emacs at the same time). -## So instead, we replace the witness-emacs dependencies by conditional -## bootstrap-dependencies (via $(BOOTSTRAPEMACS)). Of course, since we do -## not want to rely on GNU Make features, we have to rely on an external -## script to do the conditional part of the dependency -## (i.e. see the $(SUBDIR) rule ../Makefile.in). - -.SUFFIXES: .elc .el - -## These suffix rules do not allow additional dependencies, sadly, so -## instead of adding a $(BOOTSTRAPEMACS) dependency here, we add it -## separately below. -## With GNU Make, we would just say "%.el : %.elc $(BOOTSTRAPEMACS)" -.el.elc: - @$(MAKE) -C ../lisp compile-onefile THEFILE=$< EMACS="$(bootstrap_exe)" +## To solve the freshness issue, in the past we tried various clever tricks, +## but now that we require GNU make, we can simply specify +## bootstrap-emacs$(EXEEXT) as an order-only prerequisite. -## Since the .el.elc rule cannot specify an extra dependency, we do it here. -$(lisp): $(BOOTSTRAPEMACS) +%.elc: %.el | bootstrap-emacs$(EXEEXT) + @$(MAKE) -C ../lisp compile-onefile THEFILE=$< EMACS="$(bootstrap_exe)" ## VCSWITNESS points to the file that holds info about the current checkout. ## We use it as a heuristic to decide when to rebuild loaddefs.el. ## If empty it is ignored; the parent makefile can set it to some other value. VCSWITNESS = -$(lispsource)/loaddefs.el: $(BOOTSTRAPEMACS) $(VCSWITNESS) +$(lispsource)/loaddefs.el: $(VCSWITNESS) | bootstrap-emacs$(EXEEXT) $(MAKE) -C ../lisp autoloads EMACS="$(bootstrap_exe)" ## 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. */) p = GAP_END_ADDR; stop = Z; } - if (ASCII_BYTE_P (*p)) + if (ASCII_CHAR_P (*p)) p++, pos++; else if (CHAR_BYTE8_HEAD_P (*p)) { @@ -2602,7 +2602,7 @@ current buffer is cleared. */) stop = Z; } - if (ASCII_BYTE_P (*p)) + if (ASCII_CHAR_P (*p)) p++, pos++; else if (EQ (flag, Qt) && ! 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) } } +/* Helper function to call `read-file-name' from C. */ + +static Lisp_Object +read_file_name (Lisp_Object default_filename, Lisp_Object mustmatch, + Lisp_Object initial, Lisp_Object predicate) +{ + struct gcpro gcpro1; + Lisp_Object args[7]; + + GCPRO1 (default_filename); + args[0] = intern ("read-file-name"); + args[1] = callint_message; + args[2] = Qnil; + args[3] = default_filename; + args[4] = mustmatch; + args[5] = initial; + args[6] = predicate; + RETURN_UNGCPRO (Ffuncall (7, args)); +} + /* BEWARE: Calling this directly from C would defeat the purpose! */ DEFUN ("funcall-interactively", Ffuncall_interactively, Sfuncall_interactively, 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 { visargs[1] = make_string (tem + 1, strcspn (tem + 1, "\n")); if (strchr (SSDATA (visargs[1]), '%')) - callint_message = Fformat (i, visargs); + callint_message = Fformat (i - 1, visargs + 1); else callint_message = visargs[1]; @@ -574,25 +594,21 @@ invoke it. If KEYS is omitted or nil, the return value of break; case 'D': /* Directory name. */ - args[i] = Fread_file_name (callint_message, Qnil, - BVAR (current_buffer, directory), Qlambda, Qnil, - Qfile_directory_p); + args[i] = read_file_name (BVAR (current_buffer, directory), Qlambda, Qnil, + Qfile_directory_p); break; case 'f': /* Existing file name. */ - args[i] = Fread_file_name (callint_message, - Qnil, Qnil, Qlambda, Qnil, Qnil); + args[i] = read_file_name (Qnil, Qlambda, Qnil, Qnil); break; case 'F': /* Possibly nonexistent file name. */ - args[i] = Fread_file_name (callint_message, - Qnil, Qnil, Qnil, Qnil, Qnil); + args[i] = read_file_name (Qnil, Qnil, Qnil, Qnil); break; case 'G': /* Possibly nonexistent file name, default to directory alone. */ - args[i] = Fread_file_name (callint_message, - Qnil, Qnil, Qnil, empty_unibyte_string, Qnil); + args[i] = read_file_name (Qnil, Qnil, empty_unibyte_string, Qnil); break; 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 ASET (status, i, make_number (ccl.reg[i])); ASET (status, 8, make_number (ccl.ic)); - if (NILP (unibyte_p)) - val = make_multibyte_string ((char *) outbuf, produced_chars, - outp - outbuf); - else - val = make_unibyte_string ((char *) outbuf, produced_chars); + val = make_specified_string ((const char *) outbuf, produced_chars, + outp - outbuf, NILP (unibyte_p)); xfree (outbuf); 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) return c; } -/* Convert ASCII or 8-bit character C to unibyte. If C is none of - them, return (C & 0xFF). */ - -int -multibyte_char_to_unibyte (int c) -{ - if (c < 0x80) - return c; - if (CHAR_BYTE8_P (c)) - return CHAR_TO_BYTE8 (c); - return (c & 0xFF); -} - -/* Like multibyte_char_to_unibyte, but return -1 if C is not supported - by charset_unibyte. */ - -int -multibyte_char_to_unibyte_safe (int c) -{ - if (c < 0x80) - return c; - if (CHAR_BYTE8_P (c)) - return CHAR_TO_BYTE8 (c); - return -1; -} - DEFUN ("characterp", Fcharacterp, Scharacterp, 1, 2, 0, doc: /* Return non-nil if OBJECT is a character. In 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 #define BYTE8_TO_CHAR(byte) ((byte) + 0x3FFF00) #define UNIBYTE_TO_CHAR(byte) \ - (ASCII_BYTE_P (byte) ? (byte) : BYTE8_TO_CHAR (byte)) + (ASCII_CHAR_P (byte) ? (byte) : BYTE8_TO_CHAR (byte)) /* Return the raw 8-bit byte for character C. */ -#define CHAR_TO_BYTE8(c) \ - (CHAR_BYTE8_P (c) \ - ? (c) - 0x3FFF00 \ - : multibyte_char_to_unibyte (c)) +#define CHAR_TO_BYTE8(c) (CHAR_BYTE8_P (c) ? (c) - 0x3FFF00 : (c & 0xFF)) /* Return the raw 8-bit byte for character C, or -1 if C doesn't correspond to a byte. */ -#define CHAR_TO_BYTE_SAFE(c) \ - (CHAR_BYTE8_P (c) \ - ? (c) - 0x3FFF00 \ - : multibyte_char_to_unibyte_safe (c)) +#define CHAR_TO_BYTE_SAFE(c) \ + (ASCII_CHAR_P (c) ? c : (CHAR_BYTE8_P (c) ? (c) - 0x3FFF00 : -1)) /* Nonzero iff BYTE is the 1st byte of a multibyte form of a character that corresponds to a raw 8-bit byte. */ @@ -101,13 +96,6 @@ INLINE_HEADER_BEGIN /* This is the maximum byte length of multibyte form. */ #define MAX_MULTIBYTE_LENGTH 5 -/* Return a Lisp character whose character code is C. Assumes C is - a valid character code. */ -#define make_char(c) make_number (c) - -/* Nonzero iff C is an ASCII byte. */ -#define ASCII_BYTE_P(c) UNSIGNED_CMP (c, <, 0x80) - /* Nonzero iff X is a character. */ #define CHARACTERP(x) (NATNUMP (x) && XFASTINT (x) <= MAX_CHAR) @@ -222,7 +210,7 @@ INLINE_HEADER_BEGIN /* Nonzero iff BYTE starts a character in a multibyte form. This is equivalent to: - (ASCII_BYTE_P (byte) || LEADING_CODE_P (byte)) */ + (ASCII_CHAR_P (byte) || LEADING_CODE_P (byte)) */ #define CHAR_HEAD_P(byte) (((byte) & 0xC0) != 0x80) /* 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, { if (ascii_compatible_p) { - if (! ASCII_BYTE_P (from_c)) + if (! ASCII_CHAR_P (from_c)) { if (from_c < nonascii_min_char) nonascii_min_char = from_c; } - else if (! ASCII_BYTE_P (to_c)) + else if (! ASCII_CHAR_P (to_c)) { nonascii_min_char = 0x80; } @@ -1522,7 +1522,7 @@ find_charsets_in_text (const unsigned char *ptr, ptrdiff_t nchars, if (!NILP (table)) c = translate_char (table, c); - if (ASCII_BYTE_P (c)) + if (ASCII_CHAR_P (c)) ASET (charsets, charset_ascii, Qt); else 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; Try some optimization before calling decode_char. */ #define DECODE_CHAR(charset, code) \ - ((ASCII_BYTE_P (code) && (charset)->ascii_compatible_p) \ + ((ASCII_CHAR_P (code) && (charset)->ascii_compatible_p) \ ? (code) \ : ((code) < (charset)->min_code || (code) > (charset)->max_code) \ ? -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) } else { - str[0] = (SINGLE_BYTE_CHAR_P (c) - ? c - : multibyte_char_to_unibyte (c)); + str[0] = SINGLE_BYTE_CHAR_P (c) ? c : CHAR_TO_BYTE8 (c); len = 1; } 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) src = src_base; consumed_chars = consumed_chars_base; ONE_MORE_BYTE (c); - *charbuf++ = ASCII_BYTE_P (c) ? c : BYTE8_TO_CHAR (c); + *charbuf++ = ASCII_CHAR_P (c) ? c : BYTE8_TO_CHAR (c); coding->errors++; } @@ -1725,7 +1725,7 @@ decode_coding_utf_16 (struct coding_system *coding) ONE_MORE_BYTE (c2); if (c2 < 0) { - *charbuf++ = ASCII_BYTE_P (c1) ? c1 : BYTE8_TO_CHAR (c1); + *charbuf++ = ASCII_CHAR_P (c1) ? c1 : BYTE8_TO_CHAR (c1); *charbuf++ = -c2; continue; } @@ -2108,7 +2108,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src, case 1: code = c; - charset_ID = ASCII_BYTE_P (code) ? charset_ascii : charset_eight_bit; + charset_ID = ASCII_CHAR_P (code) ? charset_ascii : charset_eight_bit; break; default: @@ -2596,7 +2596,7 @@ decode_coding_emacs_mule (struct coding_system *coding) src = src_base; consumed_chars = consumed_chars_base; ONE_MORE_BYTE (c); - *charbuf++ = ASCII_BYTE_P (c) ? c : BYTE8_TO_CHAR (c); + *charbuf++ = ASCII_CHAR_P (c) ? c : BYTE8_TO_CHAR (c); char_offset++; coding->errors++; } @@ -3573,7 +3573,7 @@ decode_coding_iso_2022 (struct coding_system *coding) if (CODING_ISO_EXTSEGMENT_LEN (coding) > 0) { - *charbuf++ = ASCII_BYTE_P (c1) ? c1 : BYTE8_TO_CHAR (c1); + *charbuf++ = ASCII_CHAR_P (c1) ? c1 : BYTE8_TO_CHAR (c1); char_offset++; CODING_ISO_EXTSEGMENT_LEN (coding)--; continue; @@ -3600,7 +3600,7 @@ decode_coding_iso_2022 (struct coding_system *coding) } else { - *charbuf++ = ASCII_BYTE_P (c1) ? c1 : BYTE8_TO_CHAR (c1); + *charbuf++ = ASCII_CHAR_P (c1) ? c1 : BYTE8_TO_CHAR (c1); char_offset++; } continue; @@ -3974,7 +3974,7 @@ decode_coding_iso_2022 (struct coding_system *coding) MAYBE_FINISH_COMPOSITION (); for (; src_base < src; src_base++, char_offset++) { - if (ASCII_BYTE_P (*src_base)) + if (ASCII_CHAR_P (*src_base)) *charbuf++ = *src_base; else *charbuf++ = BYTE8_TO_CHAR (*src_base); @@ -4004,7 +4004,7 @@ decode_coding_iso_2022 (struct coding_system *coding) src = src_base; consumed_chars = consumed_chars_base; ONE_MORE_BYTE (c); - *charbuf++ = c < 0 ? -c : ASCII_BYTE_P (c) ? c : BYTE8_TO_CHAR (c); + *charbuf++ = c < 0 ? -c : ASCII_CHAR_P (c) ? c : BYTE8_TO_CHAR (c); char_offset++; coding->errors++; /* Reset the invocation and designation status to the safest @@ -5640,7 +5640,7 @@ decode_coding_charset (struct coding_system *coding) src = src_base; consumed_chars = consumed_chars_base; ONE_MORE_BYTE (c); - *charbuf++ = c < 0 ? -c : ASCII_BYTE_P (c) ? c : BYTE8_TO_CHAR (c); + *charbuf++ = c < 0 ? -c : ASCII_CHAR_P (c) ? c : BYTE8_TO_CHAR (c); char_offset++; coding->errors++; } @@ -9031,13 +9031,13 @@ DEFUN ("find-coding-systems-region-internal", p = pbeg = BYTE_POS_ADDR (start_byte); pend = p + (end_byte - start_byte); - while (p < pend && ASCII_BYTE_P (*p)) p++; - while (p < pend && ASCII_BYTE_P (*(pend - 1))) pend--; + while (p < pend && ASCII_CHAR_P (*p)) p++; + while (p < pend && ASCII_CHAR_P (*(pend - 1))) pend--; work_table = Fmake_char_table (Qnil, Qnil); while (p < pend) { - if (ASCII_BYTE_P (*p)) + if (ASCII_CHAR_P (*p)) p++; else { @@ -9091,8 +9091,7 @@ DEFUN ("find-coding-systems-region-internal", DEFUN ("unencodable-char-position", Funencodable_char_position, Sunencodable_char_position, 3, 5, 0, - doc: /* -Return position of first un-encodable character in a region. + doc: /* Return position of first un-encodable character in a region. START and END specify the region and CODING-SYSTEM specifies the encoding to check. Return nil if CODING-SYSTEM does encode the region. @@ -9102,8 +9101,9 @@ list of positions. If optional 5th argument STRING is non-nil, it is a string to search for un-encodable characters. In that case, START and END are indexes -to the string. */) - (Lisp_Object start, Lisp_Object end, Lisp_Object coding_system, Lisp_Object count, Lisp_Object string) +to the string and treated as in `substring'. */) + (Lisp_Object start, Lisp_Object end, Lisp_Object coding_system, + Lisp_Object count, Lisp_Object string) { EMACS_INT n; struct coding_system coding; @@ -9140,12 +9140,7 @@ to the string. */) else { CHECK_STRING (string); - CHECK_NATNUM (start); - CHECK_NATNUM (end); - if (! (XINT (start) <= XINT (end) && XINT (end) <= SCHARS (string))) - args_out_of_range_3 (string, start, end); - from = XINT (start); - to = XINT (end); + validate_subarray (string, start, end, SCHARS (string), &from, &to); if (! STRING_MULTIBYTE (string)) return Qnil; p = SDATA (string) + string_char_to_byte (string, from); @@ -9169,7 +9164,7 @@ to the string. */) int c; if (ascii_compatible) - while (p < stop && ASCII_BYTE_P (*p)) + while (p < stop && ASCII_CHAR_P (*p)) p++, from++; if (p >= stop) { @@ -9285,12 +9280,12 @@ is nil. */) p = pbeg = BYTE_POS_ADDR (start_byte); pend = p + (end_byte - start_byte); - while (p < pend && ASCII_BYTE_P (*p)) p++, pos++; - while (p < pend && ASCII_BYTE_P (*(pend - 1))) pend--; + while (p < pend && ASCII_CHAR_P (*p)) p++, pos++; + while (p < pend && ASCII_CHAR_P (*(pend - 1))) pend--; while (p < pend) { - if (ASCII_BYTE_P (*p)) + if (ASCII_CHAR_P (*p)) p++; else { @@ -9598,7 +9593,7 @@ Return the corresponding character. */) CHECK_CODING_SYSTEM_GET_SPEC (Vsjis_coding_system, spec); attrs = AREF (spec, 0); - if (ASCII_BYTE_P (ch) + if (ASCII_CHAR_P (ch) && ! NILP (CODING_ATTR_ASCII_COMPAT (attrs))) return code; @@ -9679,7 +9674,7 @@ Return the corresponding character. */) CHECK_CODING_SYSTEM_GET_SPEC (Vbig5_coding_system, spec); attrs = AREF (spec, 0); - if (ASCII_BYTE_P (ch) + if (ASCII_CHAR_P (ch) && ! NILP (CODING_ATTR_ASCII_COMPAT (attrs))) return code; 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; /* Nonzero if input is coming from the keyboard. */ #define INTERACTIVE (NILP (Vexecuting_kbd_macro) && !noninteractive) - -/* Set this nonzero to force reconsideration of mode line. */ - -extern 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, return unbind_to (count, lgstring); } -static Lisp_Object _work_val; - /* 1 iff the character C is composable. Characters of general category Z? or C? are not composable except for ZWNJ and ZWJ. */ -#define CHAR_COMPOSABLE_P(C) \ - ((C) > ' ' \ - && ((C) == 0x200C || (C) == 0x200D \ - || (_work_val = CHAR_TABLE_REF (Vunicode_category_table, (C)), \ - (INTEGERP (_work_val) \ - && (XINT (_work_val) <= UNICODE_CATEGORY_So))))) +static bool +char_composable_p (int c) +{ + Lisp_Object val; + return (c > ' ' + && (c == 0x200C || c == 0x200D + || (val = CHAR_TABLE_REF (Vunicode_category_table, c), + (INTEGERP (val) && (XINT (val) <= UNICODE_CATEGORY_So))))); +} /* Update cmp_it->stop_pos to the next position after CHARPOS (and 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, p = SDATA (string) + bytepos; c = STRING_CHAR_AND_LENGTH (p, len); limit = bytepos + len; - while (CHAR_COMPOSABLE_P (c)) + while (char_composable_p (c)) { val = CHAR_TABLE_REF (Vcomposition_function_table, c); if (! NILP (val)) @@ -1144,7 +1145,7 @@ composition_compute_stop_pos (struct composition_it *cmp_it, ptrdiff_t charpos, /* Skip all uncomposable characters. */ if (NILP (string)) { - while (charpos - 1 > endpos && ! CHAR_COMPOSABLE_P (c)) + while (charpos - 1 > endpos && ! char_composable_p (c)) { DEC_BOTH (charpos, bytepos); c = FETCH_MULTIBYTE_CHAR (bytepos); @@ -1152,7 +1153,7 @@ composition_compute_stop_pos (struct composition_it *cmp_it, ptrdiff_t charpos, } else { - while (charpos - 1 > endpos && ! CHAR_COMPOSABLE_P (c)) + while (charpos - 1 > endpos && ! char_composable_p (c)) { p--; while (! CHAR_HEAD_P (*p)) @@ -1486,7 +1487,7 @@ find_automatic_composition (ptrdiff_t pos, ptrdiff_t limit, |-B-|-C-|--D--| Here, it is known that characters after positions 1 and 9 can - never be composed (i.e. ! CHAR_COMPOSABLE_P (CH)), and + never be composed (i.e. ! char_composable_p (CH)), and composition A is an invalid one because it's partially covered by the valid composition C. And to know whether a composition is 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, while (1) { c = STRING_CHAR (cur.p); - if (! CHAR_COMPOSABLE_P (c)) + if (! char_composable_p (c)) { if (limit <= pos) /* case (1) */ { @@ -1519,7 +1520,7 @@ find_automatic_composition (ptrdiff_t pos, ptrdiff_t limit, return 0; BACKWARD_CHAR (cur, stop); c = STRING_CHAR (cur.p); - } while (! CHAR_COMPOSABLE_P (c)); + } while (! char_composable_p (c)); fore_check_limit = cur.pos + 1; } else /* case (2) */ @@ -1535,7 +1536,7 @@ find_automatic_composition (ptrdiff_t pos, ptrdiff_t limit, prev = cur; BACKWARD_CHAR (cur, stop); c = STRING_CHAR (cur.p); - if (! CHAR_COMPOSABLE_P (c)) + if (! char_composable_p (c)) { cur = prev; break; @@ -1683,9 +1684,10 @@ Otherwise (for terminal display), FONT-OBJECT must be a terminal ID, a frame, or nil for the selected frame's terminal device. If the optional 4th argument STRING is not nil, it is a string -containing the target characters between indices FROM and TO. -Otherwise FROM and TO are character positions in current buffer; -they can be in either order, and can be integers or markers. +containing the target characters between indices FROM and TO, +which are treated as in `substring'. Otherwise FROM and TO are +character positions in current buffer; they can be in either order, +and can be integers or markers. A glyph-string is a vector containing information about how to display a specific character sequence. The format is: @@ -1741,15 +1743,10 @@ should be ignored. */) } else { - CHECK_NATNUM (from); - CHECK_NATNUM (to); CHECK_STRING (string); + validate_subarray (string, from, to, SCHARS (string), &frompos, &topos); if (! STRING_MULTIBYTE (string)) error ("Attempt to shape unibyte text"); - if (! (XINT (from) <= XINT (to) && XINT (to) <= SCHARS (string))) - args_out_of_range_3 (string, from, to); - frompos = XFASTINT (from); - topos = XFASTINT (to); frombyte = string_char_to_byte (string, frompos); } @@ -1794,21 +1791,18 @@ DEFUN ("compose-string-internal", Fcompose_string_internal, Scompose_string_internal, 3, 5, 0, doc: /* Internal use only. -Compose text between indices START and END of STRING. -Optional 4th and 5th arguments are COMPONENTS and MODIFICATION-FUNC +Compose text between indices START and END of STRING, where +START and END are treated as in `substring'. Optional 4th +and 5th arguments are COMPONENTS and MODIFICATION-FUNC for the composition. See `compose-string' for more details. */) - (Lisp_Object string, Lisp_Object start, Lisp_Object end, Lisp_Object components, Lisp_Object modification_func) + (Lisp_Object string, Lisp_Object start, Lisp_Object end, + Lisp_Object components, Lisp_Object modification_func) { - CHECK_STRING (string); - CHECK_NUMBER (start); - CHECK_NUMBER (end); + ptrdiff_t from, to; - if (XINT (start) < 0 || - XINT (start) > XINT (end) - || XINT (end) > SCHARS (string)) - args_out_of_range (start, end); - - compose_text (XINT (start), XINT (end), components, modification_func, string); + CHECK_STRING (string); + validate_subarray (string, start, end, SCHARS (string), &from, &to); + compose_text (from, to, components, modification_func, string); return string; } 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 int vpos; /* Horizontal matrix position reached in move_it_in_display_line. - Only set there, not in display_line. */ + Only set there, not in display_line, and only when the X + coordinate is past first_visible_x. */ int hpos; /* 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) len = CHAR_STRING (c, str); else { - str[0] = ASCII_CHAR_P (c) ? c : multibyte_char_to_unibyte (c); + str[0] = CHAR_TO_BYTE8 (c); len = 1; } (*insert_func) ((char *) str, len); @@ -2852,7 +2852,7 @@ Both characters must have the same length of multi-byte form. */) len = CHAR_STRING (fromc, fromstr); if (CHAR_STRING (toc, tostr) != len) error ("Characters in `subst-char-in-region' have different byte-lengths"); - if (!ASCII_BYTE_P (*tostr)) + if (!ASCII_CHAR_P (*tostr)) { /* If *TOSTR is in the range 0x80..0x9F and TOCHAR is not a complete multibyte character, it may be combined with the @@ -2945,7 +2945,7 @@ Both characters must have the same length of multi-byte form. */) : ((pos_byte_next < Z_BYTE && ! CHAR_HEAD_P (FETCH_BYTE (pos_byte_next))) || (pos_byte > BEG_BYTE - && ! ASCII_BYTE_P (FETCH_BYTE (pos_byte - 1)))))) + && ! ASCII_CHAR_P (FETCH_BYTE (pos_byte - 1)))))) { Lisp_Object tem, string; @@ -3126,7 +3126,7 @@ It returns the number of characters changed. */) else { nc = tt[oc]; - if (! ASCII_BYTE_P (nc) && multibyte) + if (! ASCII_CHAR_P (nc) && multibyte) { str_len = BYTE8_STRING (nc, buf); str = buf; @@ -3600,7 +3600,7 @@ specifier truncates the string to the given width. usage: (format STRING &rest OBJECTS) */) (ptrdiff_t nargs, Lisp_Object *args) { - ptrdiff_t n; /* The number of the next arg to substitute */ + ptrdiff_t n; /* The number of the next arg to substitute. */ char initial_buffer[4000]; char *buf = initial_buffer; ptrdiff_t bufsize = sizeof initial_buffer; @@ -3877,7 +3877,7 @@ usage: (format STRING &rest OBJECTS) */) if (p > buf && multibyte - && !ASCII_BYTE_P (*((unsigned char *) p - 1)) + && !ASCII_CHAR_P (*((unsigned char *) p - 1)) && STRING_MULTIBYTE (args[n]) && !CHAR_HEAD_P (SREF (args[n], 0))) maybe_combine_byte = 1; @@ -4167,7 +4167,7 @@ usage: (format STRING &rest OBJECTS) */) { /* Copy a whole multibyte character. */ if (p > buf - && !ASCII_BYTE_P (*((unsigned char *) p - 1)) + && !ASCII_CHAR_P (*((unsigned char *) p - 1)) && !CHAR_HEAD_P (*format)) maybe_combine_byte = 1; @@ -4181,7 +4181,7 @@ usage: (format STRING &rest OBJECTS) */) else { unsigned char uc = *format++; - if (! multibyte || ASCII_BYTE_P (uc)) + if (! multibyte || ASCII_CHAR_P (uc)) convbytes = 1; else { 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/>. */ #include "commands.h" #include "keyboard.h" #include "dispextern.h" -#include "frame.h" /* For XFRAME. */ - -#if HAVE_X_WINDOWS -#include "xterm.h" -#endif /* Chain of condition and catch handlers currently in effect. */ 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). */) { unsigned char *p = SDATA (name); - while (*p && ASCII_BYTE_P (*p)) + while (*p && ASCII_CHAR_P (*p)) p++; if (*p == '\0') { @@ -3013,6 +3013,9 @@ was unable to determine the ACL entries. */) acl_t acl; Lisp_Object acl_string; char *str; +# ifndef HAVE_ACL_TYPE_EXTENDED + acl_type_t ACL_TYPE_EXTENDED = ACL_TYPE_ACCESS; +# endif #endif absname = expand_and_dir_to_file (filename, @@ -3027,7 +3030,7 @@ was unable to determine the ACL entries. */) #ifdef HAVE_ACL_SET_FILE absname = ENCODE_FILE (absname); - acl = acl_get_file (SSDATA (absname), ACL_TYPE_ACCESS); + acl = acl_get_file (SSDATA (absname), ACL_TYPE_EXTENDED); if (acl == NULL) return Qnil; @@ -5762,24 +5765,6 @@ before any other event (mouse or keypress) is handled. */) return Qnil; } -Lisp_Object -Fread_file_name (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, Lisp_Object mustmatch, Lisp_Object initial, Lisp_Object predicate) -{ - struct gcpro gcpro1; - Lisp_Object args[7]; - - GCPRO1 (default_filename); - args[0] = intern ("read-file-name"); - args[1] = prompt; - args[2] = dir; - args[3] = default_filename; - args[4] = mustmatch; - args[5] = initial; - args[6] = predicate; - RETURN_UNGCPRO (Ffuncall (7, args)); -} - - void init_fileio (void) { 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; static Lisp_Object Qmd5, Qsha1, Qsha224, Qsha256, Qsha384, Qsha512; static bool internal_equal (Lisp_Object, Lisp_Object, int, bool, Lisp_Object); - + DEFUN ("identity", Fidentity, Sidentity, 1, 1, 0, doc: /* Return the argument unchanged. */) (Lisp_Object arg) @@ -232,6 +232,7 @@ string STR1, compare the part between START1 (inclusive) and END1 \(exclusive). If START1 is nil, it defaults to 0, the beginning of the string; if END1 is nil, it defaults to the length of the string. Likewise, in string STR2, compare the part between START2 and END2. +Like in `substring', negative values are counted from the end. The strings are compared by the numeric values of their characters. For 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; - 1 - N is the number of characters that match at the beginning. If string STR1 is greater, the value is a positive number N; N - 1 is the number of characters that match at the beginning. */) - (Lisp_Object str1, Lisp_Object start1, Lisp_Object end1, Lisp_Object str2, Lisp_Object start2, Lisp_Object end2, Lisp_Object ignore_case) + (Lisp_Object str1, Lisp_Object start1, Lisp_Object end1, Lisp_Object str2, + Lisp_Object start2, Lisp_Object end2, Lisp_Object ignore_case) { - register ptrdiff_t end1_char, end2_char; - register ptrdiff_t i1, i1_byte, i2, i2_byte; + ptrdiff_t from1, to1, from2, to2, i1, i1_byte, i2, i2_byte; CHECK_STRING (str1); CHECK_STRING (str2); - if (NILP (start1)) - start1 = make_number (0); - if (NILP (start2)) - start2 = make_number (0); - CHECK_NATNUM (start1); - CHECK_NATNUM (start2); - if (! NILP (end1)) - CHECK_NATNUM (end1); - if (! NILP (end2)) - CHECK_NATNUM (end2); - - end1_char = SCHARS (str1); - if (! NILP (end1) && end1_char > XINT (end1)) - end1_char = XINT (end1); - if (end1_char < XINT (start1)) - args_out_of_range (str1, start1); - - end2_char = SCHARS (str2); - if (! NILP (end2) && end2_char > XINT (end2)) - end2_char = XINT (end2); - if (end2_char < XINT (start2)) - args_out_of_range (str2, start2); - - i1 = XINT (start1); - i2 = XINT (start2); + + validate_subarray (str1, start1, end1, SCHARS (str1), &from1, &to1); + validate_subarray (str2, start2, end2, SCHARS (str2), &from2, &to2); + + i1 = from1; + i2 = from2; i1_byte = string_char_to_byte (str1, i1); i2_byte = string_char_to_byte (str2, i2); - while (i1 < end1_char && i2 < end2_char) + while (i1 < to1 && i2 < to2) { /* When we find a mismatch, we must compare the characters, not just the bytes. */ int c1, c2; - if (STRING_MULTIBYTE (str1)) - FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c1, str1, i1, i1_byte); - else - { - c1 = SREF (str1, i1++); - MAKE_CHAR_MULTIBYTE (c1); - } - - if (STRING_MULTIBYTE (str2)) - FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c2, str2, i2, i2_byte); - else - { - c2 = SREF (str2, i2++); - MAKE_CHAR_MULTIBYTE (c2); - } + FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE (c1, str1, i1, i1_byte); + FETCH_STRING_CHAR_AS_MULTIBYTE_ADVANCE (c2, str2, i2, i2_byte); if (c1 == c2) continue; if (! NILP (ignore_case)) { - Lisp_Object tem; - - tem = Fupcase (make_number (c1)); - c1 = XINT (tem); - tem = Fupcase (make_number (c2)); - c2 = XINT (tem); + c1 = XINT (Fupcase (make_number (c1))); + c2 = XINT (Fupcase (make_number (c2))); } if (c1 == c2) @@ -322,15 +287,15 @@ If string STR1 is greater, the value is a positive number N; past the character that we are comparing; hence we don't add or subtract 1 here. */ if (c1 < c2) - return make_number (- i1 + XINT (start1)); + return make_number (- i1 + from1); else - return make_number (i1 - XINT (start1)); + return make_number (i1 - from1); } - if (i1 < end1_char) - return make_number (i1 - XINT (start1) + 1); - if (i2 < end2_char) - return make_number (- i1 + XINT (start1) - 1); + if (i1 < to1) + return make_number (i1 - from1 + 1); + if (i2 < to2) + return make_number (- i1 + from1 - 1); return Qt; } @@ -1133,9 +1098,9 @@ Elements of ALIST that are not conses are also shared. */) Count negative values backwards from the end. Set *IFROM and *ITO to the two indexes used. */ -static void +void validate_subarray (Lisp_Object array, Lisp_Object from, Lisp_Object to, - ptrdiff_t size, EMACS_INT *ifrom, EMACS_INT *ito) + ptrdiff_t size, ptrdiff_t *ifrom, ptrdiff_t *ito) { EMACS_INT f, t; @@ -1184,8 +1149,7 @@ With one argument, just copy STRING (with properties, if any). */) (Lisp_Object string, Lisp_Object from, Lisp_Object to) { Lisp_Object res; - ptrdiff_t size; - EMACS_INT ifrom, ito; + ptrdiff_t size, ifrom, ito; if (STRINGP (string)) size = SCHARS (string); @@ -1225,9 +1189,7 @@ If FROM or TO is negative, it counts from the end. With one argument, just copy STRING without its properties. */) (Lisp_Object string, register Lisp_Object from, Lisp_Object to) { - ptrdiff_t size; - EMACS_INT from_char, to_char; - ptrdiff_t from_byte, to_byte; + ptrdiff_t from_char, to_char, from_byte, to_byte, size; CHECK_STRING (string); @@ -4656,12 +4618,12 @@ returns nil, then (funcall TEST x1 x2) also returns nil. */) /* ALGORITHM is a symbol: md5, sha1, sha224 and so on. */ static Lisp_Object -secure_hash (Lisp_Object algorithm, Lisp_Object object, Lisp_Object start, Lisp_Object end, Lisp_Object coding_system, Lisp_Object noerror, Lisp_Object binary) +secure_hash (Lisp_Object algorithm, Lisp_Object object, Lisp_Object start, + Lisp_Object end, Lisp_Object coding_system, Lisp_Object noerror, + Lisp_Object binary) { int i; - ptrdiff_t size; - EMACS_INT start_char = 0, end_char = 0; - ptrdiff_t start_byte, end_byte; + ptrdiff_t size, start_char = 0, start_byte, end_char = 0, end_byte; register EMACS_INT b, e; register struct buffer *bp; 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) = (struct font *) allocate_pseudovector (size, FONT_OBJECT_MAX, PVEC_FONT); int i; + /* GC can happen before the driver is set up, + so avoid dangling pointer here (Bug#17771). */ + font->driver = NULL; XSETFONT (font_object, font); if (! NILP (entity)) @@ -279,10 +282,8 @@ font_intern_prop (const char *str, ptrdiff_t len, bool force_symbol) if (SYMBOLP (tem)) return tem; - if (len == nchars || len != nbytes) - tem = make_unibyte_string (str, len); - else - tem = make_multibyte_string (str, nchars, len); + tem = make_specified_string (str, nchars, len, + len != nchars && len == nbytes); return Fintern (tem, obarray); } 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) set_char_table_extras (fontset, 1, name); } -#define FONTSET_ASCII(fontset) XCHAR_TABLE (fontset)->extras[4] +#define FONTSET_ASCII(fontset) XCHAR_TABLE (fontset)->extras[2] static void set_fontset_ascii (Lisp_Object fontset, Lisp_Object ascii) { - set_char_table_extras (fontset, 4, ascii); + set_char_table_extras (fontset, 2, ascii); } /* Access special values of (realized) FONTSET. */ -#define FONTSET_BASE(fontset) XCHAR_TABLE (fontset)->extras[2] +#define FONTSET_BASE(fontset) XCHAR_TABLE (fontset)->extras[3] static void set_fontset_base (Lisp_Object fontset, Lisp_Object base) { - set_char_table_extras (fontset, 2, base); + set_char_table_extras (fontset, 3, base); } -#define FONTSET_FRAME(fontset) XCHAR_TABLE (fontset)->extras[3] +#define FONTSET_FRAME(fontset) XCHAR_TABLE (fontset)->extras[4] static void set_fontset_frame (Lisp_Object fontset, Lisp_Object frame) { - set_char_table_extras (fontset, 3, frame); + set_char_table_extras (fontset, 4, frame); } #define FONTSET_NOFONT_FACE(fontset) XCHAR_TABLE (fontset)->extras[5] @@ -239,20 +239,20 @@ set_fontset_nofont_face (Lisp_Object fontset, Lisp_Object face) set_char_table_extras (fontset, 5, face); } -#define FONTSET_DEFAULT(fontset) XCHAR_TABLE (fontset)->extras[7] +#define FONTSET_DEFAULT(fontset) XCHAR_TABLE (fontset)->extras[6] static void set_fontset_default (Lisp_Object fontset, Lisp_Object def) { - set_char_table_extras (fontset, 7, def); + set_char_table_extras (fontset, 6, def); } /* For both base and realized fontset. */ -#define FONTSET_FALLBACK(fontset) XCHAR_TABLE (fontset)->extras[8] +#define FONTSET_FALLBACK(fontset) XCHAR_TABLE (fontset)->extras[7] static void set_fontset_fallback (Lisp_Object fontset, Lisp_Object fallback) { - set_char_table_extras (fontset, 8, fallback); + set_char_table_extras (fontset, 7, fallback); } #define BASE_FONTSET_P(fontset) (NILP (FONTSET_BASE (fontset))) @@ -852,21 +852,6 @@ fontset_ascii (int id) return elt; } -static void -free_realized_fontset (struct frame *f, Lisp_Object fontset) -{ -#if 0 - Lisp_Object tail; - - if (0) - for (tail = FONTSET_OBJLIST (fontset); CONSP (tail); tail = XCDR (tail)) - { - eassert (FONT_OBJECT_P (XCAR (tail))); - font_close_object (f, XCAR (tail)); - } -#endif -} - /* Free fontset of FACE defined on frame F. Called from free_realized_face. */ @@ -880,7 +865,6 @@ free_face_fontset (struct frame *f, struct face *face) return; eassert (! BASE_FONTSET_P (fontset)); eassert (f == XFRAME (FONTSET_FRAME (fontset))); - free_realized_fontset (f, fontset); ASET (Vfontset_table, face->fontset, Qnil); if (face->fontset < next_fontset_id) next_fontset_id = face->fontset; @@ -891,7 +875,6 @@ free_face_fontset (struct frame *f, struct face *face) fontset = AREF (Vfontset_table, id); eassert (!NILP (fontset) && ! BASE_FONTSET_P (fontset)); eassert (f == XFRAME (FONTSET_FRAME (fontset))); - free_realized_fontset (f, fontset); ASET (Vfontset_table, id, Qnil); if (id < next_fontset_id) next_fontset_id = face->fontset; @@ -2159,7 +2142,7 @@ void syms_of_fontset (void) { DEFSYM (Qfontset, "fontset"); - Fput (Qfontset, Qchar_table_extra_slots, make_number (9)); + Fput (Qfontset, Qchar_table_extra_slots, make_number (8)); DEFSYM (Qfontset_info, "fontset-info"); Fput (Qfontset_info, Qchar_table_extra_slots, make_number (1)); 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/>. */ #include "msdos.h" #include "dosfns.h" #endif +#ifdef USE_X_TOOLKIT +#include "widget.h" +#endif #ifdef HAVE_NS Lisp_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; extern Lisp_Object Qbuffer_predicate; extern Lisp_Object Qcursor_color, Qcursor_type; extern Lisp_Object Qfont; -extern Lisp_Object Qbackground_color, Qforeground_color; extern Lisp_Object Qicon, Qicon_name, Qicon_type, Qicon_left, Qicon_top; extern Lisp_Object Qinternal_border_width; extern Lisp_Object Qright_divider_width, Qbottom_divider_width; @@ -1325,7 +1324,6 @@ extern void x_make_frame_visible (struct frame *f); extern void x_make_frame_invisible (struct frame *f); extern void x_iconify_frame (struct frame *f); extern void x_set_frame_alpha (struct frame *f); -extern void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object); extern void x_set_tool_bar_lines (struct frame *, Lisp_Object, Lisp_Object); extern void x_activate_menubar (struct frame *); extern 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, static void ftfont_filter_properties (Lisp_Object font, Lisp_Object alist); -Lisp_Object ftfont_font_format (FcPattern *, Lisp_Object); - #define SYMBOL_FcChar8(SYM) (FcChar8 *) SDATA (SYMBOL_NAME (SYM)) static 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) #ifdef WINDOWSNT /* GIF library details. */ +#if 5 < GIFLIB_MAJOR + (1 <= GIFLIB_MINOR) +DEF_IMGLIB_FN (int, DGifCloseFile, (GifFileType *, int *)); +#else DEF_IMGLIB_FN (int, DGifCloseFile, (GifFileType *)); +#endif DEF_IMGLIB_FN (int, DGifSlurp, (GifFileType *)); #if GIFLIB_MAJOR < 5 DEF_IMGLIB_FN (GifFileType *, DGifOpen, (void *, InputFunc)); @@ -7320,6 +7324,22 @@ gif_read_from_memory (GifFileType *file, GifByteType *buf, int len) return len; } +static int +gif_close (GifFileType *gif, int *err) +{ + int retval; + +#if 5 < GIFLIB_MAJOR + (1 <= GIFLIB_MINOR) + retval = fn_DGifCloseFile (gif, err); +#else + retval = fn_DGifCloseFile (gif); +#if GIFLIB_MAJOR >= 5 + if (err) + *err = gif->Error; +#endif +#endif + return retval; +} /* Load GIF image IMG for use on frame F. Value is true if successful. */ @@ -7344,9 +7364,7 @@ gif_load (struct frame *f, struct image *img) Lisp_Object specified_data = image_spec_value (img->spec, QCdata, NULL); unsigned long bgcolor = 0; EMACS_INT idx; -#if GIFLIB_MAJOR >= 5 int gif_err; -#endif if (NILP (specified_data)) { @@ -7414,7 +7432,7 @@ gif_load (struct frame *f, struct image *img) if (!check_image_size (f, gif->SWidth, gif->SHeight)) { image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil); - fn_DGifCloseFile (gif); + gif_close (gif, NULL); return 0; } @@ -7423,7 +7441,7 @@ gif_load (struct frame *f, struct image *img) if (rc == GIF_ERROR || gif->ImageCount <= 0) { image_error ("Error reading `%s'", img->spec, Qnil); - fn_DGifCloseFile (gif); + gif_close (gif, NULL); return 0; } @@ -7435,7 +7453,7 @@ gif_load (struct frame *f, struct image *img) { image_error ("Invalid image number `%s' in image `%s'", image_number, img->spec); - fn_DGifCloseFile (gif); + gif_close (gif, NULL); return 0; } } @@ -7453,7 +7471,7 @@ gif_load (struct frame *f, struct image *img) if (!check_image_size (f, width, height)) { image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil); - fn_DGifCloseFile (gif); + gif_close (gif, NULL); return 0; } @@ -7471,7 +7489,7 @@ gif_load (struct frame *f, struct image *img) && 0 <= subimg_left && subimg_left <= width - subimg_width)) { image_error ("Subimage does not fit in image", Qnil, Qnil); - fn_DGifCloseFile (gif); + gif_close (gif, NULL); return 0; } } @@ -7479,7 +7497,7 @@ gif_load (struct frame *f, struct image *img) /* Create the X image and pixmap. */ if (!image_create_x_image_and_pixmap (f, img, width, height, 0, &ximg, 0)) { - fn_DGifCloseFile (gif); + gif_close (gif, NULL); return 0; } @@ -7650,7 +7668,18 @@ gif_load (struct frame *f, struct image *img) Fcons (make_number (gif->ImageCount), img->lisp_data)); - fn_DGifCloseFile (gif); + if (gif_close (gif, &gif_err) == GIF_ERROR) + { +#if 5 <= GIFLIB_MAJOR + char *error_text = fn_GifErrorString (gif_err); + + if (error_text) + image_error ("Error closing `%s': %s", + img->spec, build_string (error_text)); +#else + image_error ("Error closing `%s'", img->spec, Qnil); +#endif + } /* Maybe fill in the background field while we have ximg handy. */ if (NILP (image_spec_value (img->spec, QCbackground, NULL))) @@ -8520,7 +8549,6 @@ and `imagemagick-types-inhibit'. */) ExceptionInfo ex; char **imtypes; size_t i; - Lisp_Object Qimagemagicktype; GetExceptionInfo(&ex); imtypes = GetMagickList ("*", &numf, &ex); @@ -8528,8 +8556,8 @@ and `imagemagick-types-inhibit'. */) for (i = 0; i < numf; i++) { - Qimagemagicktype = intern (imtypes[i]); - typelist = Fcons (Qimagemagicktype, typelist); + Lisp_Object imagemagicktype = intern (imtypes[i]); + typelist = Fcons (imagemagicktype, typelist); imtypes[i] = MagickRelinquishMemory (imtypes[i]); } 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) column += tab_width - column % tab_width; break; default: - if (ASCII_BYTE_P (p[-1]) + if (ASCII_CHAR_P (p[-1]) || NILP (BVAR (current_buffer, enable_multibyte_characters))) return column; { @@ -1944,9 +1944,12 @@ The optional second argument WINDOW specifies the window to use for parameters such as width, horizontal scrolling, and so on. The default is to use the selected window's parameters. -LINES can optionally take the form (COLS . LINES), in which case -the motion will not stop at the start of a screen line but on -its column COLS (if such exists on that line, that is). +LINES can optionally take the form (COLS . LINES), in which case the +motion will not stop at the start of a screen line but COLS column +from the visual start of the line (if such exists on that line, that +is). If the line is scrolled horizontally, COLS is interpreted +visually, i.e., as addition to the columns of text beyond the left +edge of the window. `vertical-motion' always uses the current buffer, regardless of which buffer is displayed in WINDOW. @@ -2126,20 +2129,14 @@ whether or not it is currently displayed in some window. */) } } - /* Move to the goal column, if one was specified. */ + /* Move to the goal column, if one was specified. If the window + was originally hscrolled, the goal column is interpreted as + an addition to the hscroll amount. */ if (!NILP (lcols)) { - /* If the window was originally hscrolled, move forward by - the hscrolled amount first. */ - if (first_x > 0) - { - move_it_in_display_line (&it, ZV, first_x, MOVE_TO_X); - it.current_x = 0; - } - move_it_in_display_line - (&it, ZV, - (int)(cols * FRAME_COLUMN_WIDTH (XFRAME (w->frame)) + 0.5), - MOVE_TO_X); + int to_x = (int)(cols * FRAME_COLUMN_WIDTH (XFRAME (w->frame)) + 0.5); + + move_it_in_display_line (&it, ZV, first_x + to_x, MOVE_TO_X); } 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, (2) POS is the last of the current buffer. (3) A character at POS can't be a following byte of multibyte character. */ - if (length > 0 && ASCII_BYTE_P (string[length - 1])) /* case (1) */ + if (length > 0 && ASCII_CHAR_P (string[length - 1])) /* case (1) */ return 0; if (pos_byte == Z_BYTE) /* case (2) */ 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; extern Lisp_Object Qmodification_hooks; extern Lisp_Object Qcategory; extern Lisp_Object Qlocal_map; -extern Lisp_Object Qkeymap; /* Visual properties text (including strings) may have. */ -extern Lisp_Object Qfont; extern Lisp_Object Qinvisible, Qintangible; /* 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; static void recursive_edit_unwind (Lisp_Object buffer); static Lisp_Object command_loop (void); static Lisp_Object Qcommand_execute; -struct timespec timer_check (void); static void echo_now (void); static ptrdiff_t echo_length (void); @@ -1216,7 +1215,7 @@ user_error (const char *msg) xsignal1 (Quser_error, build_string (msg)); } -_Noreturn +/* _Noreturn will be added to prototype by make-docfile. */ DEFUN ("exit-recursive-edit", Fexit_recursive_edit, Sexit_recursive_edit, 0, 0, "", doc: /* Exit from the innermost recursive edit or minibuffer. */) (void) @@ -1227,7 +1226,7 @@ DEFUN ("exit-recursive-edit", Fexit_recursive_edit, Sexit_recursive_edit, 0, 0, user_error ("No recursive edit is in progress"); } -_Noreturn +/* _Noreturn will be added to prototype by make-docfile. */ DEFUN ("abort-recursive-edit", Fabort_recursive_edit, Sabort_recursive_edit, 0, 0, "", doc: /* Abort the command that requested this recursive edit or minibuffer input. */) (void) @@ -1314,14 +1313,11 @@ some_mouse_moved (void) static int read_key_sequence (Lisp_Object *, int, Lisp_Object, bool, bool, bool, bool); -void safe_run_hooks (Lisp_Object); static void adjust_point_for_property (ptrdiff_t, bool); /* The last boundary auto-added to buffer-undo-list. */ Lisp_Object last_undo_boundary; -extern Lisp_Object Qregion_extract_function; - /* FIXME: This is wrong rather than test window-system, we should call a new set-selection, which will then dispatch to x-set-selection, or tty-set-selection, or w32-set-selection, ... */ @@ -2088,7 +2084,7 @@ make_ctrl_char (int c) /* Save the upper bits here. */ int upper = c & ~0177; - if (! ASCII_BYTE_P (c)) + if (! ASCII_CHAR_P (c)) return c |= ctrl_modifier; c &= 0177; @@ -2185,7 +2181,7 @@ show_help_echo (Lisp_Object help, Lisp_Object window, Lisp_Object object, -/* Input of single characters from keyboard */ +/* Input of single characters from keyboard. */ static Lisp_Object kbd_buffer_get_event (KBOARD **kbp, bool *used_mouse_menu, struct timespec *end_time); @@ -3654,7 +3650,8 @@ kbd_buffer_store_event_hold (register struct input_event *event, *kbd_store_ptr = *event; ++kbd_store_ptr; #ifdef subprocesses - if (kbd_buffer_nr_stored () > KBD_BUFFER_SIZE/2 && ! kbd_on_hold_p ()) + if (kbd_buffer_nr_stored () > KBD_BUFFER_SIZE / 2 + && ! kbd_on_hold_p ()) { /* Don't read keyboard input until we have processed kbd_buffer. This happens when pasting text longer than KBD_BUFFER_SIZE/2. */ @@ -7481,8 +7478,8 @@ menu_bar_items (Lisp_Object old) { int i = menu_bar_items_index; if (i + 4 > ASIZE (menu_bar_items_vector)) - menu_bar_items_vector = - larger_vector (menu_bar_items_vector, 4, -1); + menu_bar_items_vector + = larger_vector (menu_bar_items_vector, 4, -1); /* Add this item. */ ASET (menu_bar_items_vector, i, Qnil); i++; ASET (menu_bar_items_vector, i, Qnil); i++; @@ -9385,16 +9382,6 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, first_unbound = min (t, first_unbound); head = EVENT_HEAD (key); - if (help_char_p (head) && t > 0) - { - read_key_sequence_cmd = Vprefix_help_command; - keybuf[t++] = key; - last_nonmenu_event = key; - /* The Microsoft C compiler can't handle the goto that - would go here. */ - dummyflag = 1; - break; - } if (SYMBOLP (head)) { @@ -9652,6 +9639,17 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt, goto replay_sequence; } + + if (NILP (current_binding) + && help_char_p (EVENT_HEAD (key)) && t > 1) + { + read_key_sequence_cmd = Vprefix_help_command; + /* The Microsoft C compiler can't handle the goto that + would go here. */ + dummyflag = 1; + break; + } + /* If KEY is not defined in any of the keymaps, and cannot be part of a function key or translation, 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 !; #define lisp_h_CHECK_LIST_CONS(x, y) CHECK_TYPE (CONSP (x), Qlistp, y) #define lisp_h_CHECK_NUMBER(x) CHECK_TYPE (INTEGERP (x), Qintegerp, x) #define lisp_h_CHECK_SYMBOL(x) CHECK_TYPE (SYMBOLP (x), Qsymbolp, x) -#define lisp_h_CHECK_TYPE(ok, Qxxxp, x) \ - ((ok) ? (void) 0 : (void) wrong_type_argument (Qxxxp, x)) +#define lisp_h_CHECK_TYPE(ok, predicate, x) \ + ((ok) ? (void) 0 : (void) wrong_type_argument (predicate, x)) #define lisp_h_CONSP(x) (XTYPE (x) == Lisp_Cons) #define lisp_h_EQ(x, y) (XLI (x) == XLI (y)) #define lisp_h_FLOATP(x) (XTYPE (x) == Lisp_Float) @@ -388,7 +388,7 @@ error !; # define CHECK_LIST_CONS(x, y) lisp_h_CHECK_LIST_CONS (x, y) # define CHECK_NUMBER(x) lisp_h_CHECK_NUMBER (x) # define CHECK_SYMBOL(x) lisp_h_CHECK_SYMBOL (x) -# define CHECK_TYPE(ok, Qxxxp, x) lisp_h_CHECK_TYPE (ok, Qxxxp, x) +# define CHECK_TYPE(ok, predicate, x) lisp_h_CHECK_TYPE (ok, predicate, x) # define CONSP(x) lisp_h_CONSP (x) # define EQ(x, y) lisp_h_EQ (x, y) # define FLOATP(x) lisp_h_FLOATP (x) @@ -832,12 +832,13 @@ extern Lisp_Object Qnumberp, Qstringp, Qsymbolp, Qt, Qvectorp; extern Lisp_Object Qbool_vector_p; extern Lisp_Object Qvector_or_char_table_p, Qwholenump; extern Lisp_Object Qwindow; -extern Lisp_Object Ffboundp (Lisp_Object); extern _Noreturn Lisp_Object wrong_type_argument (Lisp_Object, Lisp_Object); /* Defined in emacs.c. */ -extern bool initialized; extern bool might_dump; +/* True means Emacs has already been initialized. + Used during startup to detect startup of dumped Emacs. */ +extern bool initialized; /* Defined in eval.c. */ extern Lisp_Object Qautoload; @@ -1002,8 +1003,9 @@ make_lisp_proc (struct Lisp_Process *p) /* Type checking. */ -LISP_MACRO_DEFUN_VOID (CHECK_TYPE, (int ok, Lisp_Object Qxxxp, Lisp_Object x), - (ok, Qxxxp, x)) +LISP_MACRO_DEFUN_VOID (CHECK_TYPE, + (int ok, Lisp_Object predicate, Lisp_Object x), + (ok, predicate, x)) /* Deprecated and will be removed soon. */ @@ -1197,12 +1199,6 @@ STRING_SET_CHARS (Lisp_Object string, ptrdiff_t newsize) { XSTRING (string)->size = newsize; } -INLINE void -STRING_COPYIN (Lisp_Object string, ptrdiff_t index, char const *new, - ptrdiff_t count) -{ - memcpy (SDATA (string) + index, new, count); -} /* Header of vector-like objects. This documents the layout constraints on vectors and pseudovectors (objects of PVEC_xxx subtype). It also prevents @@ -2557,9 +2553,9 @@ CHECK_VECTOR_OR_STRING (Lisp_Object x) CHECK_TYPE (VECTORP (x) || STRINGP (x), Qarrayp, x); } INLINE void -CHECK_ARRAY (Lisp_Object x, Lisp_Object Qxxxp) +CHECK_ARRAY (Lisp_Object x, Lisp_Object predicate) { - CHECK_TYPE (ARRAYP (x), Qxxxp, x); + CHECK_TYPE (ARRAYP (x), predicate, x); } INLINE void CHECK_BUFFER (Lisp_Object x) @@ -2687,7 +2683,6 @@ CHECK_NUMBER_CDR (Lisp_Object x) Lisp_Object fnname #else /* not _MSC_VER */ #define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \ - Lisp_Object fnname DEFUN_ARGS_ ## maxargs ; \ static struct Lisp_Subr alignas (GCALIGNMENT) sname = \ { { PVEC_SUBR << PSEUDOVECTOR_AREA_BITS }, \ { .a ## maxargs = fnname }, \ @@ -3350,7 +3345,7 @@ set_sub_char_table_contents (Lisp_Object table, ptrdiff_t idx, Lisp_Object val) } /* Defined in data.c. */ -extern Lisp_Object Qnil, Qt, Qquote, Qlambda, Qunbound; +extern Lisp_Object Qquote, Qunbound; extern Lisp_Object Qerror_conditions, Qerror_message, Qtop_level; extern Lisp_Object Qerror, Qquit, Qargs_out_of_range; extern Lisp_Object Qvoid_variable, Qvoid_function; @@ -3361,26 +3356,18 @@ extern Lisp_Object Qbeginning_of_buffer, Qend_of_buffer, Qbuffer_read_only; extern Lisp_Object Qtext_read_only; extern Lisp_Object Qinteractive_form; extern Lisp_Object Qcircular_list; -extern Lisp_Object Qintegerp, Qwholenump, Qsymbolp, Qlistp, Qconsp; -extern Lisp_Object Qstringp, Qarrayp, Qsequencep, Qbufferp; -extern Lisp_Object Qchar_or_string_p, Qmarkerp, Qinteger_or_marker_p, Qvectorp; -extern Lisp_Object Qbuffer_or_string_p; +extern Lisp_Object Qsequencep; +extern Lisp_Object Qchar_or_string_p, Qinteger_or_marker_p; extern Lisp_Object Qfboundp; -extern Lisp_Object Qchar_table_p, Qvector_or_char_table_p; extern Lisp_Object Qcdr; extern Lisp_Object Qrange_error, Qoverflow_error; -extern Lisp_Object Qfloatp; -extern Lisp_Object Qnumberp, Qnumber_or_marker_p; +extern Lisp_Object Qnumber_or_marker_p; extern Lisp_Object Qbuffer, Qinteger, Qsymbol; -extern Lisp_Object Qfont_spec, Qfont_entity, Qfont_object; - -EXFUN (Fbyteorder, 0) ATTRIBUTE_CONST; - /* Defined in data.c. */ extern Lisp_Object indirect_function (Lisp_Object); extern Lisp_Object find_symbol_value (Lisp_Object); @@ -3427,7 +3414,6 @@ extern struct Lisp_Symbol *indirect_variable (struct Lisp_Symbol *); extern _Noreturn void args_out_of_range (Lisp_Object, Lisp_Object); extern _Noreturn void args_out_of_range_3 (Lisp_Object, Lisp_Object, Lisp_Object); -extern _Noreturn Lisp_Object wrong_type_argument (Lisp_Object, Lisp_Object); extern Lisp_Object do_symval_forwarding (union Lisp_Fwd *); extern void set_internal (Lisp_Object, Lisp_Object, Lisp_Object, bool); extern void syms_of_data (void); @@ -3446,11 +3432,8 @@ extern void init_coding_once (void); extern void syms_of_coding (void); /* Defined in character.c. */ -EXFUN (Fmax_char, 0) ATTRIBUTE_CONST; extern ptrdiff_t chars_in_text (const unsigned char *, ptrdiff_t); extern ptrdiff_t multibyte_chars_in_text (const unsigned char *, ptrdiff_t); -extern int multibyte_char_to_unibyte (int) ATTRIBUTE_CONST; -extern int multibyte_char_to_unibyte_safe (int) ATTRIBUTE_CONST; extern void syms_of_character (void); /* Defined in charset.c. */ @@ -3460,9 +3443,6 @@ extern void syms_of_charset (void); /* Structure forward declarations. */ struct charset; -/* Defined in composite.c. */ -extern void syms_of_composite (void); - /* Defined in syntax.c. */ extern void init_syntax_once (void); extern void syms_of_syntax (void); @@ -3470,7 +3450,6 @@ extern void syms_of_syntax (void); /* Defined in fns.c. */ extern Lisp_Object QCrehash_size, QCrehash_threshold; enum { NEXT_ALMOST_PRIME_LIMIT = 11 }; -EXFUN (Fidentity, 1) ATTRIBUTE_CONST; extern EMACS_INT next_almost_prime (EMACS_INT) ATTRIBUTE_CONST; extern Lisp_Object larger_vector (Lisp_Object, ptrdiff_t, ptrdiff_t); extern void sweep_weak_hash_tables (void); @@ -3485,7 +3464,8 @@ ptrdiff_t hash_lookup (struct Lisp_Hash_Table *, Lisp_Object, EMACS_UINT *); ptrdiff_t hash_put (struct Lisp_Hash_Table *, Lisp_Object, Lisp_Object, EMACS_UINT); extern struct hash_table_test hashtest_eql, hashtest_equal; - +extern void validate_subarray (Lisp_Object, Lisp_Object, Lisp_Object, + ptrdiff_t, ptrdiff_t *, ptrdiff_t *); extern Lisp_Object substring_both (Lisp_Object, ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t); extern Lisp_Object merge (Lisp_Object, Lisp_Object, Lisp_Object); @@ -3503,7 +3483,6 @@ extern Lisp_Object string_make_unibyte (Lisp_Object); extern void syms_of_fns (void); /* Defined in floatfns.c. */ -extern double extract_float (Lisp_Object); extern void syms_of_floatfns (void); extern Lisp_Object fmod_float (Lisp_Object x, Lisp_Object y); @@ -3524,6 +3503,7 @@ extern void syms_of_image (void); /* Defined in insdel.c. */ extern Lisp_Object Qinhibit_modification_hooks; +extern Lisp_Object Qregion_extract_function; extern void move_gap_both (ptrdiff_t, ptrdiff_t); extern _Noreturn void buffer_overflow (void); extern void make_gap (ptrdiff_t); @@ -3576,18 +3556,16 @@ _Noreturn void __executable_start (void); #endif extern Lisp_Object Vwindow_system; extern Lisp_Object sit_for (Lisp_Object, bool, int); -extern void init_display (void); -extern void syms_of_display (void); /* Defined in xdisp.c. */ extern Lisp_Object Qinhibit_point_motion_hooks; -extern Lisp_Object Qinhibit_redisplay, Qdisplay; +extern Lisp_Object Qinhibit_redisplay; extern Lisp_Object Qmenu_bar_update_hook; extern Lisp_Object Qwindow_scroll_functions; extern Lisp_Object Qoverriding_local_map, Qoverriding_terminal_local_map; -extern Lisp_Object Qimage, Qtext, Qboth, Qboth_horiz, Qtext_image_horiz; +extern Lisp_Object Qtext, Qboth, Qboth_horiz, Qtext_image_horiz; extern Lisp_Object Qspace, Qcenter, QCalign_to; -extern Lisp_Object Qbar, Qhbar, Qbox, Qhollow; +extern Lisp_Object Qbar, Qhbar, Qhollow; extern Lisp_Object Qleft_margin, Qright_margin; extern Lisp_Object QCdata, QCfile; extern Lisp_Object QCmap; @@ -3614,7 +3592,6 @@ extern void message_log_maybe_newline (void); extern void update_echo_area (void); extern void truncate_echo_area (ptrdiff_t); extern void redisplay (void); -extern void redisplay_preserve_echo_area (int); void set_frame_cursor_types (struct frame *, Lisp_Object); extern void syms_of_xdisp (void); @@ -3797,12 +3774,9 @@ extern void r_alloc_inhibit_buffer_relocation (int); /* Defined in chartab.c. */ extern Lisp_Object copy_char_table (Lisp_Object); -extern Lisp_Object char_table_ref (Lisp_Object, int); extern Lisp_Object char_table_ref_and_range (Lisp_Object, int, int *, int *); -extern void char_table_set (Lisp_Object, int, Lisp_Object); extern void char_table_set_range (Lisp_Object, int, int, Lisp_Object); -extern int char_table_translate (Lisp_Object, int); extern void map_char_table (void (*) (Lisp_Object, Lisp_Object, Lisp_Object), Lisp_Object, Lisp_Object, Lisp_Object); @@ -3880,7 +3854,7 @@ intern_c_string (const char *str) } /* Defined in eval.c. */ -extern Lisp_Object Qautoload, Qexit, Qinteractive, Qcommandp, Qmacro; +extern Lisp_Object Qexit, Qinteractive, Qcommandp, Qmacro; extern Lisp_Object Qinhibit_quit, Qinternal_interpreter_environment, Qclosure; extern Lisp_Object Qand_rest; extern Lisp_Object Vautoload_queue; @@ -4015,7 +3989,6 @@ extern Lisp_Object expand_and_dir_to_file (Lisp_Object, Lisp_Object); extern Lisp_Object write_region (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, int); -EXFUN (Fread_file_name, 6); /* Not a normal DEFUN. */ extern void close_file_unwind (int); extern void fclose_unwind (void *); extern void restore_point_unwind (Lisp_Object); @@ -4089,8 +4062,7 @@ extern Lisp_Object echo_message_buffer; extern struct kboard *echo_kboard; extern void cancel_echoing (void); extern Lisp_Object Qdisabled, QCfilter; -extern Lisp_Object Qup, Qdown, Qbottom; -extern Lisp_Object Qtop; +extern Lisp_Object Qup, Qdown; extern Lisp_Object last_undo_boundary; extern bool input_pending; extern Lisp_Object menu_bar_items (Lisp_Object); @@ -4122,7 +4094,6 @@ extern void syms_of_indent (void); /* Defined in frame.c. */ extern Lisp_Object Qonly, Qnone; -extern Lisp_Object Qvisible; extern void set_frame_param (struct frame *, Lisp_Object, Lisp_Object); extern void store_frame_param (struct frame *, Lisp_Object, Lisp_Object); extern void store_in_alist (Lisp_Object *, Lisp_Object, Lisp_Object); @@ -4242,9 +4213,8 @@ extern void record_property_change (ptrdiff_t, ptrdiff_t, Lisp_Object); extern void syms_of_undo (void); /* Defined in textprop.c. */ -extern Lisp_Object Qfont, Qmouse_face; +extern Lisp_Object Qmouse_face; extern Lisp_Object Qinsert_in_front_hooks, Qinsert_behind_hooks; -extern Lisp_Object Qfront_sticky, Qrear_nonsticky; extern Lisp_Object Qminibuffer_prompt; extern void report_interval_modification (Lisp_Object, Lisp_Object); @@ -4267,7 +4237,6 @@ extern char *get_current_dir_name (void); #endif extern void stuff_char (char c); extern void init_foreground_group (void); -extern void init_sigio (int); extern void sys_subshell (void); extern void sys_suspend (void); extern void discard_tty_input (void); @@ -4352,8 +4321,8 @@ extern void syms_of_w32notify (void); #endif /* Defined in xfaces.c. */ -extern Lisp_Object Qdefault, Qtool_bar, Qfringe; -extern Lisp_Object Qheader_line, Qscroll_bar, Qcursor; +extern Lisp_Object Qdefault, Qfringe; +extern Lisp_Object Qscroll_bar, Qcursor; extern Lisp_Object Qmode_line_inactive; extern Lisp_Object Qface; extern Lisp_Object Qnormal; @@ -4412,10 +4381,6 @@ extern void syms_of_profiler (void); /* Defined in msdos.c, w32.c. */ extern char *emacs_root_dir (void); #endif /* DOS_NT */ - -/* True means Emacs has already been initialized. - Used during startup to detect startup of dumped Emacs. */ -extern bool initialized; /* True means ^G can quit instantly. */ extern 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) else { c = BUF_FETCH_BYTE (inbuffer, pt_byte); - if (! ASCII_BYTE_P (c)) + if (! ASCII_CHAR_P (c)) c = BYTE8_TO_CHAR (c); pt_byte++; } @@ -242,7 +242,7 @@ readchar (Lisp_Object readcharfun, bool *multibyte) else { c = BUF_FETCH_BYTE (inbuffer, bytepos); - if (! ASCII_BYTE_P (c)) + if (! ASCII_CHAR_P (c)) c = BYTE8_TO_CHAR (c); bytepos++; } @@ -324,7 +324,7 @@ readchar (Lisp_Object readcharfun, bool *multibyte) return c; if (multibyte) *multibyte = 1; - if (ASCII_BYTE_P (c)) + if (ASCII_CHAR_P (c)) return c; if (emacs_mule_encoding) return read_emacs_mule_char (c, readbyte, readcharfun); @@ -3850,7 +3850,7 @@ it defaults to the value of `obarray'. */) SET_SYMBOL_VAL (XSYMBOL (sym), sym); } - ptr = aref_addr (obarray, XINT(tem)); + ptr = aref_addr (obarray, XINT (tem)); if (SYMBOLP (*ptr)) set_symbol_next (sym, XSYMBOL (*ptr)); 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; Lisp_Object executing_kbd_macro; -Lisp_Object Fexecute_kbd_macro (Lisp_Object macro, Lisp_Object count, Lisp_Object loopfunc); - DEFUN ("start-kbd-macro", Fstart_kbd_macro, Sstart_kbd_macro, 1, 2, "P", doc: /* Record subsequent keyboard input, defining a keyboard macro. The 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. */) { int cur_x, cur_y; - mouse_position_for_popup (new_f, &cur_x, &cur_y); + x_relative_mouse_position (new_f, &cur_x, &cur_y); /* cur_x/y may be negative, so use make_number. */ x = make_number (cur_x); 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) extern widget_value *digest_single_submenu (int, int, bool); #endif -#ifdef HAVE_X_WINDOWS -extern void mouse_position_for_popup (struct frame *f, int *x, int *y); -#endif #if defined (HAVE_X_WINDOWS) || defined (MSDOS) extern Lisp_Object x_menu_show (struct frame *, int, int, int, 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) strout (outbuf, len, len, printcharfun); } else if (! multibyte - && SINGLE_BYTE_CHAR_P (c) && ! ASCII_BYTE_P (c) + && SINGLE_BYTE_CHAR_P (c) && ! ASCII_CHAR_P (c) && print_escape_nonascii) { /* 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) */) struct gcpro gcpro1; ptrdiff_t count = SPECPDL_INDEX (); ptrdiff_t count1; - Lisp_Object QCaddress; /* one of QClocal or QCremote */ + Lisp_Object colon_address; /* Either QClocal or QCremote. */ Lisp_Object tem; Lisp_Object name, buffer, host, service, address; Lisp_Object filter, sentinel; @@ -2892,8 +2892,8 @@ usage: (make-network-process &rest ARGS) */) backlog = XINT (tem); } - /* Make QCaddress an alias for :local (server) or :remote (client). */ - QCaddress = is_server ? QClocal : QCremote; + /* Make colon_address an alias for :local (server) or :remote (client). */ + colon_address = is_server ? QClocal : QCremote; /* :nowait BOOL */ if (!is_server && socktype != SOCK_DGRAM @@ -2920,7 +2920,7 @@ usage: (make-network-process &rest ARGS) */) res = &ai; /* :local ADDRESS or :remote ADDRESS */ - address = Fplist_get (contact, QCaddress); + address = Fplist_get (contact, colon_address); if (!NILP (address)) { host = service = Qnil; @@ -3307,7 +3307,7 @@ usage: (make-network-process &rest ARGS) */) memcpy (datagram_address[s].sa, lres->ai_addr, lres->ai_addrlen); } #endif - contact = Fplist_put (contact, QCaddress, + contact = Fplist_put (contact, colon_address, conv_sockaddr_to_lisp (lres->ai_addr, lres->ai_addrlen)); #ifdef HAVE_GETSOCKNAME 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, while (boyer_moore_ok) { - if (ASCII_BYTE_P (inverse)) + if (ASCII_CHAR_P (inverse)) { if (this_char_base > 0) boyer_moore_ok = 0; @@ -1827,7 +1827,7 @@ boyer_moore (EMACS_INT n, unsigned char *base_pat, matching with CHAR_BASE are to be checked. */ int ch = -1; - if (ASCII_BYTE_P (*ptr) || ! multibyte) + if (ASCII_CHAR_P (*ptr) || ! multibyte) ch = *ptr; else if (char_base && ((pat_end - ptr) == 1 || CHAR_HEAD_P (ptr[1]))) @@ -2596,7 +2596,7 @@ since only regular expressions have distinguished subexpressions. */) { FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c, newtext, pos, pos_byte); if (!buf_multibyte) - c = multibyte_char_to_unibyte (c); + c = CHAR_TO_BYTE8 (c); } else { @@ -2619,7 +2619,7 @@ since only regular expressions have distinguished subexpressions. */) FETCH_STRING_CHAR_ADVANCE_NO_CHECK (c, newtext, pos, pos_byte); if (!buf_multibyte && !ASCII_CHAR_P (c)) - c = multibyte_char_to_unibyte (c); + c = CHAR_TO_BYTE8 (c); } else { 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) acronym = XCDR (acronym); buf[0] = '['; str = STRINGP (acronym) ? SSDATA (acronym) : ""; - for (len = 0; len < 6 && str[len] && ASCII_BYTE_P (str[len]); len++) + for (len = 0; len < 6 && str[len] && ASCII_CHAR_P (str[len]); len++) buf[1 + len] = str[len]; buf[1 + len] = ']'; 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: \"runas\" - run DOCUMENT, which must be an excutable file, with elevated privileges (a.k.a. \"as Administrator\"). \"properties\" - - open the the property sheet dialog for DOCUMENT. + - open the property sheet dialog for DOCUMENT. nil - invoke the default OPERATION, or \"open\" if default is not defined or unavailable. 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) as requests arrive. */ *CommitAddress = data_region_base + committed; committed += *CommitSize; + /* Check that the private heap area does not overlap the big chunks area. */ if (((unsigned char *)(*CommitAddress)) + *CommitSize >= bc_limit) { - /* Check that the private heap area does not overlap the big - chunks area. */ - fprintf(stderr, - "dumped_data_commit: memory exhausted.\nEnlarge dumped_data[]!\n"); + fprintf (stderr, + "dumped_data_commit: memory exhausted.\nEnlarge dumped_data[]!\n"); exit (-1); } return 0; @@ -243,18 +242,20 @@ init_heap (void) data_region_end = data_region_base; /* Create the private heap. */ - heap = HeapCreate(0, 0, 0); + heap = HeapCreate (0, 0, 0); #ifndef _W64 /* Set the low-fragmentation heap for OS before Vista. */ - HMODULE hm_kernel32dll = LoadLibrary("kernel32.dll"); - HeapSetInformation_Proc s_pfn_Heap_Set_Information = (HeapSetInformation_Proc) GetProcAddress(hm_kernel32dll, "HeapSetInformation"); + HMODULE hm_kernel32dll = LoadLibrary ("kernel32.dll"); + HeapSetInformation_Proc s_pfn_Heap_Set_Information = (HeapSetInformation_Proc) GetProcAddress (hm_kernel32dll, "HeapSetInformation"); if (s_pfn_Heap_Set_Information != NULL) - if (s_pfn_Heap_Set_Information ((PVOID) heap, - HeapCompatibilityInformation, - &enable_lfh, sizeof(enable_lfh)) == 0) - DebPrint (("Enabling Low Fragmentation Heap failed: error %ld\n", - GetLastError ())); + { + if (s_pfn_Heap_Set_Information ((PVOID) heap, + HeapCompatibilityInformation, + &enable_lfh, sizeof(enable_lfh)) == 0) + DebPrint (("Enabling Low Fragmentation Heap failed: error %ld\n", + GetLastError ())); + } #endif the_malloc_fn = malloc_after_dump; @@ -271,7 +272,7 @@ init_heap (void) = (RtlCreateHeap_Proc) GetProcAddress (hm_ntdll, "RtlCreateHeap"); /* Specific parameters for the private heap. */ RTL_HEAP_PARAMETERS params; - ZeroMemory(¶ms, sizeof(params)); + ZeroMemory (¶ms, sizeof(params)); params.Length = sizeof(RTL_HEAP_PARAMETERS); data_region_base = (unsigned char *)ROUND_UP (dumped_data, 0x1000); @@ -284,6 +285,11 @@ init_heap (void) params.CommitRoutine = &dumped_data_commit; /* Create the private heap. */ + if (s_pfn_Rtl_Create_Heap == NULL) + { + fprintf (stderr, "Cannot build Emacs without RtlCreateHeap being available; exiting.\n"); + exit (-1); + } heap = s_pfn_Rtl_Create_Heap (0, data_region_base, 0, 0, NULL, ¶ms); the_malloc_fn = malloc_before_dump; the_realloc_fn = realloc_before_dump; @@ -358,8 +364,8 @@ malloc_before_dump (size_t size) array. */ if (blocks_number >= MAX_BLOCKS) { - fprintf(stderr, - "malloc_before_dump: no more big chunks available.\nEnlarge MAX_BLOCKS!\n"); + fprintf (stderr, + "malloc_before_dump: no more big chunks available.\nEnlarge MAX_BLOCKS!\n"); exit (-1); } bc_limit -= size; @@ -369,11 +375,11 @@ malloc_before_dump (size_t size) blocks[blocks_number].size = size; blocks[blocks_number].occupied = TRUE; blocks_number++; + /* Check that areas do not overlap. */ if (bc_limit < dumped_data + committed) { - /* Check that areas do not overlap. */ - fprintf(stderr, - "malloc_before_dump: memory exhausted.\nEnlarge dumped_data[]!\n"); + fprintf (stderr, + "malloc_before_dump: memory exhausted.\nEnlarge dumped_data[]!\n"); exit (-1); } } 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/>. */ #include "buffer.h" #include "keyboard.h" #include "keymap.h" +#include "menu.h" #include "frame.h" #include "window.h" #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) /* Get the next character, maybe multibyte. */ p = BYTE_POS_ADDR (IT_BYTEPOS (*it)); - if (it->multibyte_p && !ASCII_BYTE_P (*p)) + if (it->multibyte_p && !ASCII_CHAR_P (*p)) it->c = STRING_CHAR_AND_LENGTH (p, it->len); else it->c = *p, it->len = 1; @@ -9932,9 +9932,7 @@ message_dolog (const char *m, ptrdiff_t nbytes, bool nlflag, bool multibyte) for (i = 0; i < nbytes; i += char_bytes) { c = string_char_and_length (msg + i, &char_bytes); - work[0] = (ASCII_CHAR_P (c) - ? c - : multibyte_char_to_unibyte (c)); + work[0] = CHAR_TO_BYTE8 (c); insert_1_both (work, 1, 1, 1, 0, 0); } } @@ -12279,11 +12277,6 @@ tool_bar_height (struct frame *f, int *n_rows, bool pixelwise) #endif /* !USE_GTK && !HAVE_NS */ -#if defined USE_GTK || defined HAVE_NS -EXFUN (Ftool_bar_height, 2) ATTRIBUTE_CONST; -EXFUN (Ftool_bar_lines_needed, 1) ATTRIBUTE_CONST; -#endif - DEFUN ("tool-bar-height", Ftool_bar_height, Stool_bar_height, 0, 2, 0, doc: /* Return the number of lines occupied by the tool bar of FRAME. @@ -15795,7 +15788,7 @@ set_vertical_scroll_bar (struct window *w) redisplay itself, when it decides that the previous window start point is fine and should be kept. Search for "goto force_start" below to see the details. Like the values of window-start - specified outside of redisply, these internally deduced values + specified outside of redisplay, these internally-deduced values are tested for feasibility, and ignored if found to be unfeasible. @@ -20746,12 +20739,15 @@ Value is the new character position of point. */) recorded in the glyphs, at least as long as the goal is on the screen. */ if (w->window_end_valid - && NILP (Vexecuting_kbd_macro) && !windows_or_buffers_changed && b && !b->clip_changed && !b->prevent_redisplay_optimizations_p && !window_outdated (w) + /* We rely below on the cursor coordinates to be up to date, but + we cannot trust them if some command moved point since the + last complete redisplay. */ + && w->last_point == BUF_PT (b) && w->cursor.vpos >= 0 && w->cursor.vpos < w->current_matrix->nrows && (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) sprintf (buf, "%0*X", it->c < 0x10000 ? 4 : 6, it->c); str = buf; } - for (len = 0; str[len] && ASCII_BYTE_P (str[len]) && len < 6; len++) + for (len = 0; str[len] && ASCII_CHAR_P (str[len]) && len < 6; len++) code[len] = font->driver->encode_char (font, str[len]); upper_len = (len + 1) / 2; 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/>. */ #include "lisp.h" #include "xterm.h" +#include "menu.h" #include "frame.h" #include "window.h" #include "character.h" @@ -329,8 +330,43 @@ x_real_positions (struct frame *f, int *xptr, int *yptr) *yptr = real_y; } - +/* Get the mouse position in frame relative coordinates. */ + +void +x_relative_mouse_position (struct frame *f, int *x, int *y) +{ + Window root, dummy_window; + int dummy; + + eassert (FRAME_X_P (f)); + + block_input (); + + XQueryPointer (FRAME_X_DISPLAY (f), + DefaultRootWindow (FRAME_X_DISPLAY (f)), + /* The root window which contains the pointer. */ + &root, + + /* Window pointer is on, not used */ + &dummy_window, + + /* The position on that root window. */ + x, y, + + /* x/y in dummy_window coordinates, not used. */ + &dummy, &dummy, + + /* Modifier keys and pointer buttons, about which + we don't care. */ + (unsigned int *) &dummy); + + unblock_input (); + + /* Translate root window coordinates to window coordinates. */ + *x -= f->left_pos + FRAME_OUTER_TO_INNER_DIFF_X (f); + *y -= f->top_pos + FRAME_OUTER_TO_INNER_DIFF_Y (f); +} /* Gamma-correct COLOR on frame F. */ 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) block_input (); - /* Make sure that the Xrender extension is added before the Xft one. - Otherwise, the close-display hook set by Xft is called after the - one for Xrender, and the former tries to re-add the latter. This - results in inconsistency of internal states and leads to X - protocol error when one reconnects to the same X server. - (Bug#1696) */ - { - int event_base, error_base; - XRenderQueryExtension (display, &event_base, &error_base); - } /* Substitute in values from X resources and XftDefaultSet. */ 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) } #endif - -#ifdef HAVE_X_WINDOWS -/* Return the mouse position in *X and *Y. The coordinates are window - relative for the edit window in frame F. - This is for Fx_popup_menu. The mouse_position_hook can not - be used for X, as it returns window relative coordinates - for the window where the mouse is in. This could be the menu bar, - the scroll bar or the edit window. Fx_popup_menu needs to be - sure it is the edit window. */ -void -mouse_position_for_popup (struct frame *f, int *x, int *y) -{ - Window root, dummy_window; - int dummy; - - eassert (FRAME_X_P (f)); - - block_input (); - - XQueryPointer (FRAME_X_DISPLAY (f), - DefaultRootWindow (FRAME_X_DISPLAY (f)), - - /* The root window which contains the pointer. */ - &root, - - /* Window pointer is on, not used */ - &dummy_window, - - /* The position on that root window. */ - x, y, - - /* x/y in dummy_window coordinates, not used. */ - &dummy, &dummy, - - /* Modifier keys and pointer buttons, about which - we don't care. */ - (unsigned int *) &dummy); - - unblock_input (); - - /* x_menu_show expects window coordinates, not root window - coordinates. Translate. */ - *x -= f->left_pos + FRAME_OUTER_TO_INNER_DIFF_X (f); - *y -= f->top_pos + FRAME_OUTER_TO_INNER_DIFF_Y (f); -} - -#endif /* HAVE_X_WINDOWS */ #ifndef MSDOS 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, data, size * format_bytes, type, format); } -/* Get the mouse position in frame relative coordinates. */ - -static void -mouse_position_for_drop (struct frame *f, int *x, int *y) -{ - Window root, dummy_window; - int dummy; - - block_input (); - - XQueryPointer (FRAME_X_DISPLAY (f), - DefaultRootWindow (FRAME_X_DISPLAY (f)), - - /* The root window which contains the pointer. */ - &root, - - /* Window pointer is on, not used */ - &dummy_window, - - /* The position on that root window. */ - x, y, - - /* x/y in dummy_window coordinates, not used. */ - &dummy, &dummy, - - /* Modifier keys and pointer buttons, about which - we don't care. */ - (unsigned int *) &dummy); - - - /* Absolute to relative. */ - *x -= f->left_pos + FRAME_OUTER_TO_INNER_DIFF_X (f); - *y -= f->top_pos + FRAME_OUTER_TO_INNER_DIFF_Y (f); - - unblock_input (); -} - DEFUN ("x-get-atom-name", Fx_get_atom_name, Sx_get_atom_name, 1, 2, 0, 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, event->format, size)); - mouse_position_for_drop (f, &x, &y); + x_relative_mouse_position (f, &x, &y); bufp->kind = DRAG_N_DROP_EVENT; bufp->frame_or_window = frame; 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/>. */ #include <X11/extensions/Xfixes.h> #endif +/* Using Xft implies that XRender is available. */ +#ifdef HAVE_XFT +#include <X11/extensions/Xrender.h> +#endif + /* Load sys/types.h if not already loaded. In some systems loading it twice is suicidal. */ #ifndef makedev @@ -221,7 +226,6 @@ static void x_lower_frame (struct frame *); static const XColor *x_color_cells (Display *, int *); static int x_io_error_quitter (Display *); static struct terminal *x_create_terminal (struct x_display_info *); -void x_delete_terminal (struct terminal *); static void x_update_end (struct frame *); static void XTframe_up_to_date (struct frame *); static void x_clear_frame (struct frame *); @@ -354,8 +358,10 @@ x_find_topmost_parent (struct frame *f) unsigned int nchildren; win = wi; - XQueryTree (dpy, win, &root, &wi, &children, &nchildren); - XFree (children); + if (XQueryTree (dpy, win, &root, &wi, &children, &nchildren)) + XFree (children); + else + break; } return win; @@ -6454,7 +6460,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, for (i = 0, nchars = 0; i < nbytes; i++) { - if (ASCII_BYTE_P (copy_bufptr[i])) + if (ASCII_CHAR_P (copy_bufptr[i])) nchars++; STORE_KEYSYM_FOR_DEBUG (copy_bufptr[i]); } @@ -7854,11 +7860,6 @@ xim_destroy_callback (XIM xim, XPointer client_data, XPointer call_data) #endif /* HAVE_X11R6 */ -#ifdef HAVE_X11R6 -/* This isn't prototyped in OSF 5.0 or 5.1a. */ -extern char *XSetIMValues (XIM, ...); -#endif - /* Open the connection to the XIM server on display DPYINFO. RESOURCE_NAME is the resource name Emacs uses. */ @@ -9774,7 +9775,7 @@ x_toggle_visible_pointer (struct frame *f, bool invisible) else XDefineCursor (FRAME_X_DISPLAY (f), FRAME_X_WINDOW (f), f->output_data.x->current_cursor); - f->pointer_invisible = invisible; + f->pointer_invisible = invisible; } /* Setup pointer blanking, prefer Xfixes if available. */ @@ -10086,14 +10087,27 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) #ifdef HAVE_XFT { - /* If we are using Xft, check dpi value in X resources. - It is better we use it as well, since Xft will use it, as will all - Gnome applications. If our real DPI is smaller or larger than the - one Xft uses, our font will look smaller or larger than other - for other applications, even if it is the same font name (monospace-10 - for example). */ - char *v = XGetDefault (dpyinfo->display, "Xft", "dpi"); + /* If we are using Xft, the following precautions should be made: + + 1. Make sure that the Xrender extension is added before the Xft one. + Otherwise, the close-display hook set by Xft is called after the one + for Xrender, and the former tries to re-add the latter. This results + in inconsistency of internal states and leads to X protocol error when + one reconnects to the same X server (Bug#1696). + + 2. Check dpi value in X resources. It is better we use it as well, + since Xft will use it, as will all Gnome applications. If our real DPI + is smaller or larger than the one Xft uses, our font will look smaller + or larger than other for other applications, even if it is the same + font name (monospace-10 for example). */ + + int event_base, error_base; + char *v; double d; + + XRenderQueryExtension (dpyinfo->display, &event_base, &error_base); + + v = XGetDefault (dpyinfo->display, "Xft", "dpi"); if (v != NULL && sscanf (v, "%lf", &d) == 1) dpyinfo->resy = dpyinfo->resx = d; } @@ -10222,7 +10236,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) 1, 0, 1); x_setup_pointer_blanking (dpyinfo); - + #ifdef HAVE_X_I18N xim_initialize (dpyinfo, resource_name); #endif @@ -10538,7 +10552,7 @@ x_create_terminal (struct x_display_info *dpyinfo) terminal->menu_show_hook = x_menu_show; #if defined (USE_X_TOOLKIT) || defined (USE_GTK) terminal->popup_dialog_hook = xw_popup_dialog; -#endif +#endif terminal->set_vertical_scroll_bar_hook = XTset_vertical_scroll_bar; terminal->condemn_scroll_bars_hook = XTcondemn_scroll_bars; terminal->redeem_scroll_bar_hook = XTredeem_scroll_bar; @@ -10550,7 +10564,7 @@ x_create_terminal (struct x_display_info *dpyinfo) return terminal; } -void +static void x_initialize (void) { 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 /* From xfns.c. */ extern void x_free_gcs (struct frame *); +extern void x_relative_mouse_position (struct frame *, int *, int *); /* From xrdb.c. */ @@ -929,7 +930,6 @@ extern void x_check_errors (Display *, const char *) extern bool x_had_errors_p (Display *); extern void x_uncatch_errors (void); extern void x_clear_errors (Display *); -extern void x_set_window_size (struct frame *, int, int, int, bool); extern void xembed_request_focus (struct frame *); extern void x_ewmh_activate_frame (struct frame *); extern void x_delete_terminal (struct terminal *terminal); @@ -944,7 +944,6 @@ extern bool x_alloc_lighter_color_for_widget (Widget, Display *, Colormap, double, int); #endif extern bool x_alloc_nearest_color (struct frame *, Colormap, XColor *); -extern void x_query_color (struct frame *f, XColor *); extern void x_clear_area (Display *, Window, int, int, int, int); #if !defined USE_X_TOOLKIT && !defined USE_GTK extern void x_mouse_leave (struct x_display_info *); @@ -991,16 +990,11 @@ extern Lisp_Object x_property_data_to_lisp (struct frame *, extern void x_clipboard_manager_save_frame (Lisp_Object); extern void x_clipboard_manager_save_all (void); -/* Defined in xfns.c */ - -extern Lisp_Object x_get_focus_frame (struct frame *); - #ifdef USE_GTK extern int xg_set_icon (struct frame *, Lisp_Object); extern int xg_set_icon_from_xpm_data (struct frame *, const char **); #endif /* USE_GTK */ -extern void x_implicitly_set_name (struct frame *, Lisp_Object, Lisp_Object); extern void xic_free_xfontset (struct frame *); extern void create_frame_xic (struct frame *); extern void destroy_frame_xic (struct frame *); @@ -1032,15 +1026,8 @@ extern Lisp_Object xw_popup_dialog (struct frame *, Lisp_Object, Lisp_Object); extern void x_menu_set_in_use (int); #endif extern void x_menu_wait_for_event (void *data); -extern int popup_activated (void); extern void initialize_frame_menubar (struct frame *); -/* Defined in widget.c */ - -#ifdef USE_X_TOOLKIT -extern void widget_store_internal_border (Widget); -#endif - /* Defined in xsmfns.c */ #ifdef HAVE_X_SM extern void x_session_initialize (struct x_display_info *dpyinfo); |
