From: tomo Date: Mon, 13 Aug 2001 11:49:05 +0000 (+0000) Subject: XEmacs 21.2.39 "Millennium". X-Git-Tag: r21-2-39~1 X-Git-Url: http://git.chise.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b50fd71ea3c920afc5ba60af567d73940993be3f;p=chise%2Fxemacs-chise.git XEmacs 21.2.39 "Millennium". --- diff --git a/man/xemacs/packages.texi b/man/xemacs/packages.texi index f263aac..e2202d8 100644 --- a/man/xemacs/packages.texi +++ b/man/xemacs/packages.texi @@ -19,6 +19,7 @@ local needs with safe removal of unnecessary code. * Package Terminology:: Understanding different kinds of packages. * Using Packages:: How to install and use packages. * Building Packages:: Building packages from sources. +* Creating Packages:: The basics. * Available Packages:: A brief, out-of-date, directory of packaged LISP. @end menu @@ -339,7 +340,7 @@ changed packages. @end enumerate -@node Building Packages, Available Packages, Using Packages, Packages +@node Building Packages, Creating Packages, Using Packages, Packages @comment node-name, next, previous, up Source packages are available from the @file{packages/source-packages} @@ -381,7 +382,7 @@ Bytecompile all files, build and bytecompile byproduct files like of TeXinfo documentation if present. @item srckit -Usually aliased to @code{make srckit-std}. This does a @code{make +Usually aliased to @code{srckit-std}. This does a @code{make distclean} and creates a package source tarball in the staging directory. This is generally only of use for package maintainers. @@ -402,7 +403,132 @@ primarily of use by XEmacs maintainers producing files for distribution. @end table -@node Available Packages, , Building Packages, Packages +@node Creating Packages, Available Packages, Building Packages, Packages +@comment node-name, next, previous, up + +Creating a package from an existing Lisp library is not very difficult. + +In addition to the Lisp libraries themselves, you need a +@file{package-info.in} file and a simple @file{Makefile}. The rest is +done by @file{XEmacs.rules}, part of the packaging system +infrastructure. + +@file{package-info.in} contains a single Lisp form like this: + +@example +(name ; your package's name + (standards-version 1.1 + version VERSION + author-version AUTHOR_VERSION + date DATE + build-date BUILD_DATE + maintainer MAINTAINER + distribution xemacs ; change to "mule" if MULE is needed + priority high + category CATEGORY + dump nil + description "description" ; a one-line description string + filename FILENAME + md5sum MD5SUM + size SIZE + provides (feature1 feature2) ; one for every `provides' form + requires (REQUIRES) + type regular +)) +@end example + +You must fill in the four commented lines. The value of @code{name} is +the name of your package as an unquoted symbol. Normally it is the name +of the main Lisp file or principal feature provided. The allowed values +for distribution are @code{xemacs} and @code{mule}. Write them as +unquoted symbols. The @code{description} is a quoted Lisp string; use +the usual conventions. The value for @code{provides} is a list of +feature symbols (written unquoted). All of the features provided by +libraries in your package should be elements of this list. Implementing +an automatic method for generating the @file{provides} line is +desirable, but as yet undone. + +The variables in upper-case are references to variables set in the +@file{Makefile} or automatically generated. Do not change them; they +are automatically filled in by the build process. + +The remaining lines refer to implementation constants +(@code{standards-version}), or features that are unimplemented or have +been removed (@code{priority} and @code{dump}). The @code{type} line is +not normally relevant to external maintainers; the alternate value is +@code{single-file}, which refers to packages consed up out of a number +of single-file libraries that are more or less thematically related. An +example is @code{prog-modes}. Single-file packages are basically for +administrative convenience, and new packages should generally be created +as regular packages. + +The @file{Makefile} is quite stylized. The idea is similar to an +@file{Imakefile} or an @code{automake} file: the complexity is hidden in +generic rules files, in this case the @file{XEmacs.rules} include file +in the top directory of the packages hierarchy. Although a number of +facilities are available for complex libraries, most simple packages' +@file{Makefile}s contain a copyright notice, a few variable definitions, +an include for @file{XEmacs.rules}, and a couple of standard targets. + +The first few @code{make} variables defined are @code{VERSION}, +@code{AUTHOR_VERSION}, @code{MAINTAINER}, @code{PACKAGE}, +@code{PKG_TYPE}, @code{REQUIRES}, and @code{CATEGORY}. All but one were +described in the description of @file{package-info.in}. The last is an +admistrative grouping. Current categories include @code{comm}, +@code{games}, @code{libs}, @code{mule}, @code{oa}, @code{os}, +@code{prog}, and @code{wp}. @ref{Available Packages}, for a list of +categories. + +Next, define the variable @code{ELCS}. This contains the list of the +byte-compiled Lisp files used by the package. These files and their +@file{.el} versions will be included in the binary package. If there +are other files (such as extra Lisp sources or an upstream +@file{Makefile}) that are normally placed in the installed Lisp +directory, but not byte-compiled, they can be listed as the value of +@code{EXTRA_SOURCES}. + +The include is simply +@example +include ../../XEmacs.rules +@end example + +The standard targets follow. These are + +@example +all:: $(ELCS) auto-autoloads.elc + +srckit: srckit-alias + +binkit: binkit-alias +@end example + +Other targets (such as Texinfo sources) may need to be added as +dependencies for the @code{all} target. Dependencies for @code{srckit} +and @code{binkit} (that is, values for @var{srckit-alias} and +@var{binkit-alias}) are defined in @file{XEmacs.rules}. The most useful +of these values are given in the following table. + +@table @var +@item srckit-alias +Usually set to @code{srckit-std}. + +@item binkit-alias +May be set to @code{binkit-sourceonly}, @code{binkit-sourceinfo}, +@code{binkit-sourcedata}, or +@code{binkit-sourcedatainfo}. @code{sourceonly} indicates there is +nothing to install in a data directory or info directory. +@code{sourceinfo} indicates that source and info files are to be +installed. @code{sourcedata} indicates that source and etc (data) files +are to be installed. @code{sourcedatainfo} indicates source, etc +(data), and info files are to be installed. +@end table + +Data files include things like pixmaps for a package-specific toolbar, +and are normally installed in @file{etc/@var{PACKAGE_NAME}}. A few +packages have needs beyond the basic templates. See @file{XEmacs.rules} +or a future revision of this manual for details. + +@node Available Packages, , Creating Packages, Packages @comment node-name, next, previous, up This section is surely out-of-date. If you're sure that XEmacs is diff --git a/nt/ChangeLog b/nt/ChangeLog index a4aee30..ac50ab0 100644 --- a/nt/ChangeLog +++ b/nt/ChangeLog @@ -1,3 +1,7 @@ +2000-12-31 Martin Buchholz + + * XEmacs 21.2.39 is released. + 2000-12-05 Martin Buchholz * XEmacs 21.2.38 is released. diff --git a/src/ChangeLog b/src/ChangeLog index 2864924..572dfe2 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,9 +1,156 @@ +2000-12-31 Martin Buchholz + + * XEmacs 21.2.39 is released. + +2000-12-29 Andy Piper + + * menubar.c (menubar_visible_p_changed): signal the frame changed. + + * glyphs-x.c (x_redisplay_widget): Re-calculate widget offsets if + the frame has changed so that we pick up geometry changes such as + menubar visibility. + +2000-12-28 Andy Piper + + * lastfile.c (my_ebss): make a char array so we can pad the + bss. Fixes cygwin unexec. + + * unexcw.c: invert BROKEN_GDB to NO_DEBUG. + +2000-12-26 Andy Piper + + * event-Xt.c (emacs_Xt_force_event_pending): add some verbose + comments and try and be more precise about a non-/SIGIO world. + (emacs_Xt_event_pending_p): use XtAppPending under cygwin and non + SIGIO. + + * redisplay-output.c (redisplay_normalize_glyph_area): make sure + we don't normalize to zero width or height. + +2000-12-24 Andy Piper + + * Makefile.in.in (ldflags): add -mwindows when appropriate. + +2000-08-18 Golubev I. N. + + * s/sco5.h: SCO 5 has pty support. + +2000-07-20 Kazuyuki IENAGA + + * input-method-xlib.c: supports both XIM_XLIB and USE_XFONTSET. + input-method-xlib.c contains whole contents of input-method-xfs.c, + so we can use input-method-xlib.c's code for USE_XFONTSET + using #ifdefs. + * input-method-xfs.c: removed. + +2000-12-20 Stephen Turnbull + + * file-coding.h (enum coding_category_type): reorder enumerators to + make autodetection safer. Make CODING_CATEGORY_LAST an enumerator + (now one greater than largest real coding_category_type enumerator). + * file-coding.c (coding_category_symbol, coding_category_by_priority, + coding_category_system, fcd_descriptihon_1, decode_coding_category, + Fcoding_category_list, Fset_coding_priority_list, + Fcoding_priority_list, coding_system_from_mask, Fdetect_coding_region, + vars_of_file_coding): adjust for change in CODING_CATEGORY_LAST. + +2000-12-18 Yoshiki Hayashi + + * redisplay-output.c (redisplay_clear_top_of_window): Remove static. + * redisplay-output.c (redisplay_output_window): Clear top of window + when face is changed. + * redisplay-x.c (x_redraw_exposed_window): Call + redisplay_clear_top_of_window. + * redisplay.h: Publish redisplay_clear_top_of_window. + +2000-12-18 Yoshiki Hayashi + + * buffer.c (Fkill_buffer): Map over all devices. + * window.c (window_loop): Remove UNSHOW_BUFFER code. + (list_windows): New function. + (list_all_windows): Ditto. + (Freplace_buffer_in_windows): Use them. + +2000-02-02 Daiki Ueno + + * database.c (berkdb_subtype): Recognize new subtype `queue'. + (Fopen_database): Use `db_create' instead of `db_open'. + (syms_of_database): Initialize Qqueue. + +2000-12-13 Yoshiki Hayashi + + * buffer.c (common_init_complex_vars_of_buffer): Initialize + buffer_local_face_property. + * buffer.h (struct buffer): New member buffer_local_face_property. + * window.c (Fset_window_buffer): Mark window's face as changed + when buffer has buffer local face. + * window.h (MARK_WINDOW_FACES_CHANGED): New macro. + * objects.c (color_after_change): Set buffer_local_face_property + when locale of face specifier is buffer. + * objects.c (font_after_change): Ditto. + * objects.c (face_boolean_after_change): Ditto. + * glyphs.c (image_after_change): Ditto. + +2000-12-09 Dan Holmsand + + * nt.c (mswindows_fstat): Report file permissions, volume serial + number, etc. Code adapted from FSF Emacs 20.7. + +2000-12-09 Dan Holmsand + + * sysfile.h (lstat): Make lstat an alias for xemacs_stat instead + of stat when we don't have symbolic links, to make sure + mswindows_stat is called on mswindows. + +2000-12-12 Yoshiki Hayashi + + * alloca.c: Define malloc to xmalloc only when built with XEmacs. + +2000-12-12 Martin Buchholz + + * doprnt.c (emacs_doprnt_1): More printing fixes. + Make printing of numbers compatible with libc and FSF Emacs. + BUG was: (format "%6.3f" 1.2) ==>"1.200000" + Use the system printf to do most of the hard work of formatting, + instead of doprnt_1(). + Calculate memory to allocate for format string. + Remove arbitrary limit on precision, e.g. (format "%.1000f" 3.14) + (doprnt_1): Cleaner code and documentation. + +2000-12-01 Jerry James + + * Makefile.in.in: Use the loop variable to install headers. + +2000-12-04 Yoshiki Hayashi + + * window.c (Fsplit_window): Don't invalidate face cache. + +2000-12-04 Yoshiki Hayashi + + * minibuf.c (Fall_completions): Undo the previous change + which removed checking elements start with space. + +2000-12-06 Stephen Turnbull + + * mule-canna.c: Didier suppression. + +2000-12-06 Stephen Turnbull + + * mule-canna.c: rename static unsigned char buf[] to key_buffer + (warning suppression). Add English comment translations. + +2000-12-05 Martin Buchholz + + * unexelfsgi.c (unexec): Better test for mmap failure. + 2000-12-05 Martin Buchholz * XEmacs 21.2.38 is released. 2000-12-05 Martin Buchholz + * redisplay.c (bar-cursor): Make a user variable. + * symsinit.h: Add init_postgresql_from_environment. 2000-12-04 Yoshiki Hayashi diff --git a/src/Makefile.in.in b/src/Makefile.in.in index f6e2be0..bfc4a46 100644 --- a/src/Makefile.in.in +++ b/src/Makefile.in.in @@ -147,7 +147,11 @@ win32_objs=win32.o xemacs_res.o cppflags = $(CPPFLAGS) -Demacs -I. $(c_switch_all) cflags = $(CFLAGS) $(cppflags) +#if defined (WIN32_NATIVE) || defined (CYGWIN) +ldflags = $(LDFLAGS) -mwindows $(ld_switch_all) $(ld_dynamic_link_flags) +#else ldflags = $(LDFLAGS) $(ld_switch_all) $(ld_dynamic_link_flags) +#endif #ifdef SOLARIS2 %.o : %.c @@ -741,7 +745,7 @@ install: ${PROGNAME} cd ${srcdir}; hdrdir2=`pwd`; cd $$hdir; \ test "$$hdrdir2" != "$$hdir" && hdir="$$hdir $$hdrdir2"; \ (for thisdir in $$hdir; do \ - cd $$hdir && \ + cd $$thisdir && \ (hdrtars=; \ for hdrfile in *.h; do \ hdrtars="$$hdrtars $$hdrfile"; \ diff --git a/src/alloca.c b/src/alloca.c index c1eecff..e3ba02e 100644 --- a/src/alloca.c +++ b/src/alloca.c @@ -100,7 +100,7 @@ void xfree (pointer); Callers below should use malloc. */ -#ifndef emacs +#ifdef emacs #define malloc xmalloc #endif #ifndef WIN32_NATIVE diff --git a/src/buffer.c b/src/buffer.c index 6fcbe8d..6c83a67 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -1259,7 +1259,9 @@ with `delete-process'. /* #### This is a problem if this buffer is in a dedicated window. Need to undedicate any windows of this buffer first (and delete them?) */ - Freplace_buffer_in_windows (buf, Qnil, Qnil); + GCPRO1 (buf); + Freplace_buffer_in_windows (buf, Qnil, Qall); + UNGCPRO; font_lock_buffer_was_killed (b); @@ -2429,6 +2431,7 @@ common_init_complex_vars_of_buffer (void) defs->auto_save_modified = 0; defs->auto_save_failure_time = -1; defs->invisibility_spec = Qt; + defs->buffer_local_face_property = 0; defs->indirect_children = Qnil; syms->indirect_children = Qnil; diff --git a/src/buffer.h b/src/buffer.h index 8cf5993..590219e 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -137,6 +137,9 @@ struct buffer int face_change; /* This is set when a change in how the text should be displayed (e.g., font, color) is made. */ + /* Whether buffer specific face is specified. */ + int buffer_local_face_property; + /* change data indicating what portion of the text has changed since the last time this was reset. Used by redisplay. Logically we should keep this with the text structure, but diff --git a/src/database.c b/src/database.c index 9cf085f..79dd595 100644 --- a/src/database.c +++ b/src/database.c @@ -59,6 +59,9 @@ typedef uint64_t u_int64_t; #endif /* DB_VERSION_MAJOR */ Lisp_Object Qberkeley_db; Lisp_Object Qhash, Qbtree, Qrecno, Qunknown; +#if DB_VERSION_MAJOR > 2 +Lisp_Object Qqueue; +#endif #endif /* HAVE_BERKELEY_DB */ #ifdef HAVE_DBM @@ -369,6 +372,9 @@ berkdb_subtype (Lisp_Database *db) case DB_BTREE: return Qbtree; case DB_HASH: return Qhash; case DB_RECNO: return Qrecno; +#if DB_VERSION_MAJOR > 2 + case DB_QUEUE: return Qqueue; +#endif default: return Qunknown; } } @@ -644,6 +650,10 @@ and defaults to 0755. real_subtype = DB_BTREE; else if (EQ (subtype, Qrecno)) real_subtype = DB_RECNO; +#if DB_VERSION_MAJOR > 2 + else if (EQ (subtype, Qqueue)) + real_subtype = DB_QUEUE; +#endif else signal_simple_error ("Unsupported subtype", subtype); @@ -669,10 +679,25 @@ and defaults to 0755. if (strchr (acc, 'r') && !strchr (acc, 'w')) accessmask |= DB_RDONLY; } +#if DB_VERSION_MAJOR == 2 status = db_open (filename, real_subtype, accessmask, modemask, NULL , NULL, &dbase); if (status) return Qnil; +#else + status = db_create (&dbase, NULL, 0); + if (status) + return Qnil; + status = dbase->open (dbase, filename, NULL, + real_subtype, accessmask, modemask); + if (status) + { + dbase->close (dbase, 0); + return Qnil; + } +#endif /* DB_VERSION_MAJOR > 2 */ + /* Normalize into system specific file modes. Only for printing */ + accessmask = accessmask & DB_RDONLY ? O_RDONLY : O_RDWR; #endif /* DB_VERSION_MAJOR */ db = allocate_database (); @@ -771,6 +796,9 @@ syms_of_database (void) defsymbol (&Qhash, "hash"); defsymbol (&Qbtree, "btree"); defsymbol (&Qrecno, "recno"); +#if DB_VERSION_MAJOR > 2 + defsymbol (&Qqueue, "queue"); +#endif defsymbol (&Qunknown, "unknown"); #endif diff --git a/src/depend b/src/depend index 73f018e..67586d4 100644 --- a/src/depend +++ b/src/depend @@ -134,11 +134,11 @@ imgproc.o: $(LISP_H) imgproc.h indent.o: $(LISP_H) buffer.h bufslots.h casetab.h chartab.h conslots.h console.h device.h extents.h faces.h frame.h frameslots.h glyphs.h gui.h insdel.h mule-charset.h redisplay.h scrollbar.h specifier.h toolbar.h window.h winslots.h inline.o: $(LISP_H) $(LWLIB_SRCDIR)/lwlib.h buffer.h bufslots.h bytecode.h casetab.h chartab.h conslots.h console-msw.h console.h database.h device.h eldap.h elhash.h events.h extents.h faces.h file-coding.h frame.h frameslots.h glyphs-x.h glyphs.h gui-x.h gui.h keymap.h lstream.h mule-charset.h objects.h opaque.h postgresql.h process.h rangetab.h redisplay.h scrollbar.h specifier.h syntax.h syscommctrl.h systime.h syswindows.h toolbar.h tooltalk.h window.h winslots.h xintrinsic.h input-method-motif.o: $(LISP_H) EmacsFrame.h conslots.h console-x.h console.h device.h frame.h frameslots.h glyphs.h gui.h redisplay.h scrollbar.h specifier.h toolbar.h window.h winslots.h xintrinsic.h -input-method-xfs.o: $(LISP_H) EmacsFrame.h buffer.h bufslots.h casetab.h chartab.h conslots.h console-x.h console.h device.h events.h frame.h frameslots.h glyphs.h gui.h mule-charset.h redisplay.h scrollbar.h specifier.h systime.h toolbar.h window.h winslots.h xintrinsic.h input-method-xlib.o: $(LISP_H) EmacsFrame.h buffer.h bufslots.h casetab.h chartab.h conslots.h console-x.h console.h device.h events.h frame.h frameslots.h glyphs.h gui.h mule-charset.h redisplay.h scrollbar.h specifier.h systime.h toolbar.h window.h winslots.h xintrinsic.h insdel.o: $(LISP_H) buffer.h bufslots.h casetab.h chartab.h conslots.h console.h device.h extents.h frame.h frameslots.h glyphs.h gui.h insdel.h line-number.h lstream.h mule-charset.h redisplay.h scrollbar.h specifier.h toolbar.h window.h winslots.h intl.o: $(LISP_H) bytecode.h conslots.h console.h device.h keymap.o: $(LISP_H) buffer.h bufslots.h bytecode.h casetab.h chartab.h conslots.h console.h device.h elhash.h events-mod.h events.h frame.h frameslots.h glyphs.h gui.h insdel.h keymap.h mule-charset.h redisplay.h scrollbar.h specifier.h systime.h toolbar.h window.h winslots.h +lastfile.o: config.h libsst.o: $(LISP_H) libsst.h line-number.o: $(LISP_H) buffer.h bufslots.h casetab.h chartab.h line-number.h mule-charset.h linuxplay.o: $(LISP_H) miscplay.h nativesound.h sysfile.h syssignal.h @@ -201,7 +201,7 @@ unexaix.o: $(LISP_H) getpagesize.h unexalpha.o: config.h unexapollo.o: config.h unexconvex.o: config.h getpagesize.h -unexcw.o: config.h sysfile.h +unexcw.o: $(LISP_H) sysfile.h unexec.o: $(LISP_H) getpagesize.h unexelf.o: config.h unexelfsgi.o: config.h diff --git a/src/doprnt.c b/src/doprnt.c index 74d4c27..d9dc8c4 100644 --- a/src/doprnt.c +++ b/src/doprnt.c @@ -87,11 +87,13 @@ typedef struct Dynarr_declare (union printf_arg); } printf_arg_dynarr; -/* Append STRING (of length LEN) to STREAM. MINLEN is the minimum field - width. If MINUS_FLAG is set, left-justify the string in its field; - otherwise, right-justify. If ZERO_FLAG is set, pad with 0's; otherwise - pad with spaces. If MAXLEN is non-negative, the string is first - truncated to that many character. +/* Append STRING (of length LEN bytes) to STREAM. + MINLEN is the minimum field width. + If MINUS_FLAG is set, left-justify the string in its field; + otherwise, right-justify. + If ZERO_FLAG is set, pad with 0's; otherwise pad with spaces. + If MAXLEN is non-negative, the string is first truncated on the + right to that many characters. Note that MINLEN and MAXLEN are Charcounts but LEN is a Bytecount. */ @@ -99,42 +101,23 @@ static void doprnt_1 (Lisp_Object stream, const Bufbyte *string, Bytecount len, Charcount minlen, Charcount maxlen, int minus_flag, int zero_flag) { - Charcount cclen; - Bufbyte pad; Lstream *lstr = XLSTREAM (stream); - - cclen = bytecount_to_charcount (string, len); - - if (zero_flag) - pad = '0'; - else - pad = ' '; + Charcount cclen = bytecount_to_charcount (string, len); + int to_add = minlen - cclen; /* Padding at beginning to right-justify ... */ - if (minlen > cclen && !minus_flag) - { - int to_add = minlen - cclen; - while (to_add > 0) - { - Lstream_putc (lstr, pad); - to_add--; - } - } + if (!minus_flag) + while (to_add-- > 0) + Lstream_putc (lstr, zero_flag ? '0' : ' '); - if (maxlen >= 0) - len = charcount_to_bytecount (string, min (maxlen, cclen)); + if (0 <= maxlen && maxlen < cclen) + len = charcount_to_bytecount (string, maxlen); Lstream_write (lstr, string, len); /* Padding at end to left-justify ... */ - if (minlen > cclen && minus_flag) - { - int to_add = minlen - cclen; - while (to_add > 0) - { - Lstream_putc (lstr, pad); - to_add--; - } - } + if (minus_flag) + while (to_add-- > 0) + Lstream_putc (lstr, zero_flag ? '0' : ' '); } static const Bufbyte * @@ -610,34 +593,34 @@ emacs_doprnt_1 (Lisp_Object stream, const Bufbyte *format_nonreloc, } else { - char text_to_print[500]; + /* ASCII Decimal representation uses 2.4 times as many + bits as machine binary. */ + char *text_to_print = + alloca_array (char, 32 + + max (spec->minwidth, + max (sizeof (double), sizeof (long)) * 3 + + max (spec->precision, 0))); char constructed_spec[100]; char *p = constructed_spec; - /* Partially reconstruct the spec and use sprintf() to + /* Mostly reconstruct the spec and use sprintf() to format the string. */ - /* Make sure nothing stupid happens */ - /* DO NOT REMOVE THE (int) CAST! Incorrect results will - follow! */ - spec->precision = min (spec->precision, - (int) (sizeof (text_to_print) - 50)); - *p++ = '%'; if (spec->plus_flag) *p++ = '+'; if (spec->space_flag) *p++ = ' '; if (spec->number_flag) *p++ = '#'; + if (spec->minus_flag) *p++ = '-'; + if (spec->zero_flag) *p++ = '0'; - if (spec->precision >= 0 && !spec->minwidth) + if (spec->minwidth >= 0) + p = long_to_string (p, spec->minwidth); + if (spec->precision >= 0) { *p++ = '.'; p = long_to_string (p, spec->precision); } - - /* sprintf the mofo */ - /* we have to use separate calls to sprintf(), rather than - a single big conditional, because of the different types - of the arguments */ + if (strchr (double_converters, ch)) { *p++ = ch; @@ -646,10 +629,9 @@ emacs_doprnt_1 (Lisp_Object stream, const Bufbyte *format_nonreloc, } else { - if (spec->zero_flag && spec->minwidth) - sprintf (p, "0%dl%c", spec->minwidth, ch); - else - sprintf (p, "l%c", ch); + *p++ = 'l'; /* Always use longs with sprintf() */ + *p++ = ch; + *p++ = '\0'; if (strchr (unsigned_int_converters, ch)) sprintf (text_to_print, constructed_spec, arg.ul); @@ -658,8 +640,7 @@ emacs_doprnt_1 (Lisp_Object stream, const Bufbyte *format_nonreloc, } doprnt_1 (stream, (Bufbyte *) text_to_print, - strlen (text_to_print), - spec->minwidth, -1, spec->minus_flag, spec->zero_flag); + strlen (text_to_print), 0, -1, 0, 0); } } } diff --git a/src/event-Xt.c b/src/event-Xt.c index 2eb2fca..b9ef392 100644 --- a/src/event-Xt.c +++ b/src/event-Xt.c @@ -1763,6 +1763,41 @@ handle_client_message (struct frame *f, XEvent *event) } } +/* #### I'm struggling to understand how the X event loop really works. + Here is the problem: + + When widgets get mapped / changed etc the actual display updates + are done asynchronously via X events being processed - this + normally happens when XtAppProcessEvent() gets called. However, if + we are executing lisp code or even doing redisplay we won't + necessarily process X events for a very long time. This has the + effect of widgets only getting updated when XEmacs only goes into + idle, or some other event causes processing of the X event queue. + + XtAppProcessEvent can get called from the following places: + + emacs_Xt_next_event () - this is normal event processing, almost + any non-X event will take precedence and this means that we + cannot rely on it to do the right thing at the right time for + widget display. + + drain_X_queue () - this happens when SIGIO gets tripped, + processing the event queue allows C-g to be checked for. It gets + called from emacs_Xt_event_pending_p (). + + In order to solve this I have tried introducing a list primitive - + dispatch-non-command-events - which forces processing of X events + related to display. Unfortunately this has a number of problems, + one is that it is possible for event_stream_event_pending_p to + block for ever if there isn't actually an event. I guess this can + happen if we drop the synthetic event for reason. It also relies on + SIGIO processing which makes things rather fragile. + + People have seen behaviour whereby XEmacs blocks until you move the + mouse. This seems to indicate that dispatch-non-command-events is + blocking. It may be that in a SIGIO world forcing SIGIO processing + does the wrong thing. +*/ static void emacs_Xt_force_event_pending (struct frame* f) { @@ -1778,8 +1813,8 @@ emacs_Xt_force_event_pending (struct frame* f) /* Send the drop message */ XSendEvent(dpy, XtWindow (FRAME_X_SHELL_WIDGET (f)), True, NoEventMask, &event); - /* Force event pending to check the X queue. */ - quit_check_signal_tick_count++; + /* We rely on SIGIO and friends to realise we have generated an + event. */ } static void @@ -2949,7 +2984,11 @@ emacs_Xt_event_pending_p (int user_p) /* quit_check_signal_tick_count is volatile so try to avoid race conditions by using a temporary variable */ tick_count_val = quit_check_signal_tick_count; - if (last_quit_check_signal_tick_count != tick_count_val) + if (last_quit_check_signal_tick_count != tick_count_val +#if !defined (SIGIO) || defined (CYGWIN) + || (XtIMXEvent & XtAppPending (Xt_app_con)) +#endif + ) { last_quit_check_signal_tick_count = tick_count_val; diff --git a/src/file-coding.c b/src/file-coding.c index aaca9ef..d44359b 100644 --- a/src/file-coding.c +++ b/src/file-coding.c @@ -46,17 +46,17 @@ Lisp_Object Vcoding_system_for_write; Lisp_Object Vfile_name_coding_system; /* Table of symbols identifying each coding category. */ -Lisp_Object coding_category_symbol[CODING_CATEGORY_LAST + 1]; +Lisp_Object coding_category_symbol[CODING_CATEGORY_LAST]; struct file_coding_dump { /* Coding system currently associated with each coding category. */ - Lisp_Object coding_category_system[CODING_CATEGORY_LAST + 1]; + Lisp_Object coding_category_system[CODING_CATEGORY_LAST]; /* Table of all coding categories in decreasing order of priority. This describes a permutation of the possible coding categories. */ - int coding_category_by_priority[CODING_CATEGORY_LAST + 1]; + int coding_category_by_priority[CODING_CATEGORY_LAST]; #ifdef MULE Lisp_Object ucs_to_mule_table[65536]; @@ -64,7 +64,7 @@ struct file_coding_dump { } *fcd; static const struct lrecord_description fcd_description_1[] = { - { XD_LISP_OBJECT_ARRAY, offsetof (struct file_coding_dump, coding_category_system), CODING_CATEGORY_LAST + 1 }, + { XD_LISP_OBJECT_ARRAY, offsetof (struct file_coding_dump, coding_category_system), CODING_CATEGORY_LAST }, #ifdef MULE { XD_LISP_OBJECT_ARRAY, offsetof (struct file_coding_dump, ucs_to_mule_table), countof (fcd->ucs_to_mule_table) }, #endif @@ -1433,7 +1433,7 @@ decode_coding_category (Lisp_Object symbol) int i; CHECK_SYMBOL (symbol); - for (i = 0; i <= CODING_CATEGORY_LAST; i++) + for (i = 0; i < CODING_CATEGORY_LAST; i++) if (EQ (coding_category_symbol[i], symbol)) return i; @@ -1449,7 +1449,7 @@ Return a list of all recognized coding categories. int i; Lisp_Object list = Qnil; - for (i = CODING_CATEGORY_LAST; i >= 0; i--) + for (i = CODING_CATEGORY_LAST - 1; i >= 0; i--) list = Fcons (coding_category_symbol[i], list); return list; } @@ -1463,13 +1463,13 @@ previously. */ (list)) { - int category_to_priority[CODING_CATEGORY_LAST + 1]; + int category_to_priority[CODING_CATEGORY_LAST]; int i, j; Lisp_Object rest; /* First generate a list that maps coding categories to priorities. */ - for (i = 0; i <= CODING_CATEGORY_LAST; i++) + for (i = 0; i < CODING_CATEGORY_LAST; i++) category_to_priority[i] = -1; /* Highest priority comes from the specified list. */ @@ -1486,7 +1486,7 @@ previously. /* Now go through the existing categories by priority to retrieve the categories not yet specified and preserve their priority order. */ - for (j = 0; j <= CODING_CATEGORY_LAST; j++) + for (j = 0; j < CODING_CATEGORY_LAST; j++) { int cat = fcd->coding_category_by_priority[j]; if (category_to_priority[cat] < 0) @@ -1496,7 +1496,7 @@ previously. /* Now we need to construct the inverse of the mapping we just constructed. */ - for (i = 0; i <= CODING_CATEGORY_LAST; i++) + for (i = 0; i < CODING_CATEGORY_LAST; i++) fcd->coding_category_by_priority[category_to_priority[i]] = i; /* Phew! That was confusing. */ @@ -1511,7 +1511,7 @@ Return a list of coding categories in descending order of priority. int i; Lisp_Object list = Qnil; - for (i = CODING_CATEGORY_LAST; i >= 0; i--) + for (i = CODING_CATEGORY_LAST - 1; i >= 0; i--) list = Fcons (coding_category_symbol[fcd->coding_category_by_priority[i]], list); return list; @@ -1761,7 +1761,7 @@ coding_system_from_mask (int mask) #endif /* Look through the coding categories by priority and find the first one that is allowed. */ - for (i = 0; i <= CODING_CATEGORY_LAST; i++) + for (i = 0; i < CODING_CATEGORY_LAST; i++) { cat = fcd->coding_category_by_priority[i]; if ((mask & (1 << cat)) && @@ -1959,7 +1959,7 @@ type. Optional arg BUFFER defaults to the current buffer. #ifdef MULE decst.mask = postprocess_iso2022_mask (decst.mask); #endif - for (i = CODING_CATEGORY_LAST; i >= 0; i--) + for (i = CODING_CATEGORY_LAST - 1; i >= 0; i--) { int sys = fcd->coding_category_by_priority[i]; if (decst.mask & (1 << sys)) @@ -4282,7 +4282,48 @@ fit_to_be_escape_quoted (unsigned char c) If CHECK_INVALID_CHARSETS is non-zero, check for designation or invocation of an invalid character set and treat that as - an unrecognized escape sequence. */ + an unrecognized escape sequence. + + ******************************************************************** + + #### Strategies for error annotation and coding orthogonalization + + We really want to separate out a number of things. Conceptually, + there is a nested syntax. + + At the top level is the ISO 2022 extension syntax, including charset + designation and invocation, and certain auxiliary controls such as the + ISO 6429 direction specification. These are octet-oriented, with the + single exception (AFAIK) of the "exit Unicode" sequence which uses the + UTF's natural width (1 byte for UTF-7 and UTF-8, 2 bytes for UCS-2 and + UTF-16, and 4 bytes for UCS-4 and UTF-32). This will be treated as a + (deprecated) special case in Unicode processing. + + The middle layer is ISO 2022 character interpretation. This will depend + on the current state of the ISO 2022 registers, and assembles octets + into the character's internal representation. + + The lowest level is translating system control conventions. At present + this is restricted to newline translation, but one could imagine doing + tab conversion or line wrapping here. "Escape from Unicode" processing + would be done at this level. + + At each level the parser will verify the syntax. In the case of a + syntax error or warning (such as a redundant escape sequence that affects + no characters), the parser will take some action, typically inserting the + erroneous octets directly into the output and creating an annotation + which can be used by higher level I/O to mark the affected region. + + This should make it possible to do something sensible about separating + newline convention processing from character construction, and about + preventing ISO 2022 escape sequences from being recognized + inappropriately. + + The basic strategy will be to have octet classification tables, and + switch processing according to the table entry. + + It's possible that, by doing the processing with tables of functions or + the like, the parser can be used for both detection and translation. */ static int parse_iso2022_esc (Lisp_Object codesys, struct iso2022_decoder *iso, @@ -5700,7 +5741,7 @@ vars_of_file_coding (void) dumpstruct (&fcd, &fcd_description); /* Initialize to something reasonable ... */ - for (i = 0; i <= CODING_CATEGORY_LAST; i++) + for (i = 0; i < CODING_CATEGORY_LAST; i++) { fcd->coding_category_system[i] = Qnil; fcd->coding_category_by_priority[i] = i; diff --git a/src/file-coding.h b/src/file-coding.h index 69345b3..322dbec 100644 --- a/src/file-coding.h +++ b/src/file-coding.h @@ -408,32 +408,50 @@ enum iso_esc_flag #define ISO_CODE_CSI 0x9B /* control-sequence-introduce */ #endif /* MULE */ -/* For detecting the encoding of text */ +/* Distinguishable categories of encodings. + + This list determines the initial priority of the categories. + + For better or worse, currently Mule files are encoded in 7-bit ISO 2022. + For this reason, under Mule ISO_7 gets highest priority. + + Putting NO_CONVERSION second prevents "binary corruption" in the + default case in all but the (presumably) extremely rare case of a + binary file which contains redundant escape sequences but no 8-bit + characters. + + The remaining priorities are based on perceived "internationalization + political correctness." An exception is UCS-4 at the bottom, since + basically everything is compatible with UCS-4, but it is likely to + be very rare as an external encoding. */ + enum coding_category_type { + /* must be a contiguous range of values 0 -- CODING_CATEGORY_LAST - 1 */ #ifdef MULE - CODING_CATEGORY_SHIFT_JIS, CODING_CATEGORY_ISO_7, /* ISO2022 system using only seven-bit bytes, no locking shift */ - CODING_CATEGORY_ISO_8_DESIGNATE, /* ISO2022 system using eight-bit bytes, - no locking shift, no single shift, - using designation to switch charsets */ + CODING_CATEGORY_NO_CONVERSION, + CODING_CATEGORY_UTF8, CODING_CATEGORY_ISO_8_1, /* ISO2022 system using eight-bit bytes, no locking shift, no designation sequences, one-dimension characters in the upper half. */ CODING_CATEGORY_ISO_8_2, /* ISO2022 system using eight-bit bytes, no locking shift, no designation sequences, two-dimension characters in the upper half. */ + CODING_CATEGORY_ISO_8_DESIGNATE, /* ISO2022 system using eight-bit bytes, + no locking shift, no single shift, + using designation to switch charsets */ CODING_CATEGORY_ISO_LOCK_SHIFT, /* ISO2022 system using locking shift */ + CODING_CATEGORY_SHIFT_JIS, CODING_CATEGORY_BIG5, CODING_CATEGORY_UCS4, - CODING_CATEGORY_UTF8, +#else /* not MULE */ + CODING_CATEGORY_NO_CONVERSION, #endif /* MULE */ - CODING_CATEGORY_NO_CONVERSION + CODING_CATEGORY_LAST /* not a real coding category */ }; -#define CODING_CATEGORY_LAST CODING_CATEGORY_NO_CONVERSION - #ifdef MULE #define CODING_CATEGORY_SHIFT_JIS_MASK \ (1 << CODING_CATEGORY_SHIFT_JIS) diff --git a/src/glyphs-x.c b/src/glyphs-x.c index 9a0e296..e0fa2d2 100644 --- a/src/glyphs-x.c +++ b/src/glyphs-x.c @@ -2140,6 +2140,7 @@ static void x_map_subwindow (Lisp_Image_Instance *p, int x, int y, struct display_glyph_area* dga) { + assert (dga->width > 0 && dga->height > 0); if (IMAGE_INSTANCE_TYPE (p) == IMAGE_SUBWINDOW) { Window subwindow = IMAGE_INSTANCE_X_SUBWINDOW_ID (p); @@ -2259,6 +2260,16 @@ x_redisplay_widget (Lisp_Image_Instance *p) (Dimension)IMAGE_INSTANCE_HEIGHT (p)); } + /* Adjust offsets within the frame. */ + if (XFRAME (IMAGE_INSTANCE_FRAME (p))->frame_changed) + { + Arg al[2]; + XtSetArg (al [0], XtNx, &IMAGE_INSTANCE_X_WIDGET_XOFFSET (p)); + XtSetArg (al [1], XtNy, &IMAGE_INSTANCE_X_WIDGET_YOFFSET (p)); + XtGetValues (FRAME_X_TEXT_WIDGET + (XFRAME (IMAGE_INSTANCE_FRAME (p))), al, 2); + } + /* now modify the widget */ lw_modify_all_widgets (IMAGE_INSTANCE_X_WIDGET_LWID (p), wv, True); diff --git a/src/glyphs.c b/src/glyphs.c index d69bb2d..6c5c03e 100644 --- a/src/glyphs.c +++ b/src/glyphs.c @@ -3346,7 +3346,11 @@ image_after_change (Lisp_Object specifier, Lisp_Object locale) Lisp_Object property = IMAGE_SPECIFIER_ATTACHEE_PROPERTY (XIMAGE_SPECIFIER (specifier)); if (FACEP (attachee)) - face_property_was_changed (attachee, property, locale); + { + face_property_was_changed (attachee, property, locale); + if (BUFFERP (locale)) + XBUFFER (locale)->buffer_local_face_property = 1; + } else if (GLYPHP (attachee)) glyph_property_was_changed (attachee, property, locale); } diff --git a/src/input-method-xlib.c b/src/input-method-xlib.c index db564bb..9e0acbd 100644 --- a/src/input-method-xlib.c +++ b/src/input-method-xlib.c @@ -80,8 +80,8 @@ Boston, MA 02111-1307, USA. */ #include "EmacsFrame.h" #include "events.h" -#ifndef XIM_XLIB -#error XIM_XLIB is not defined?? +#if !defined (XIM_XLIB) && !defined (USE_XFONTSET) +#error neither XIM_XLIB nor USE_XFONTSET is defined?? #endif Lisp_Object Qxim_xlib; @@ -89,6 +89,7 @@ Lisp_Object Qxim_xlib; #define xim_warn1(fmt, str) warn_when_safe (Qxim_xlib, Qwarning, fmt, str); #define xim_info(str) warn_when_safe (Qxim_xlib, Qinfo, str); +#ifdef XIM_XLIB /* XIM_XLIB specific */ /* Get/Set IC values for just one attribute */ #ifdef DEBUG_XEMACS #define XIC_Value(Get_Set, xic, name, attr, value) \ @@ -120,6 +121,7 @@ static char DefaultXIMStyles[] = "XIMPreeditNone|XIMStatusNone"; static XIMStyle best_style (XIMStyles *user, XIMStyles *xim); +#endif /* XIM_XLIB only */ /* This function is documented, but no prototype in the header files */ EXTERN_C char * XSetIMValues(XIM, ...); @@ -175,6 +177,8 @@ Initialize_Locale (void) } } +#ifdef XIM_XLIB /* starting XIM specific codes */ + /* Callbacks for IM are supported from X11R6 or later. */ #ifdef HAVE_XREGISTERIMINSTANTIATECALLBACK @@ -1113,6 +1117,7 @@ Unit_Test (struct frame *f, char * s) } } #endif +#endif /* XIM_XLIB only */ #if 0 /* Get a fontset for IM to use */ diff --git a/src/lastfile.c b/src/lastfile.c index 22b64ad..53143a7 100644 --- a/src/lastfile.c +++ b/src/lastfile.c @@ -38,6 +38,16 @@ Boston, MA 02111-1307, USA. */ coming from libraries. */ +#include + char my_edata[] = "End of Emacs initialized data"; -int my_ebss; +/* Ensure there is enough slack in the .bss to pad with. */ +#ifdef HEAP_IN_DATA +#define BSS_PADDING 0x1000 +#else +#define BSS_PADDING 1 +#endif + +char my_ebss [BSS_PADDING]; + diff --git a/src/menubar.c b/src/menubar.c index d0d60d7..7332455 100644 --- a/src/menubar.c +++ b/src/menubar.c @@ -115,6 +115,9 @@ menubar_visible_p_changed (Lisp_Object specifier, struct window *w, Lisp_Object oldval) { MARK_MENUBAR_CHANGED; + /* This is to force subwindow offsets to be recalculated - see + x_redisplay_widget (). */ + MARK_FRAME_CHANGED (WINDOW_XFRAME (w)); } static void diff --git a/src/minibuf.c b/src/minibuf.c index 8b59cff..37fe9ec 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -618,7 +618,12 @@ or the symbol from the obarray. if (STRINGP (eltstring) && (slength <= XSTRING_CHAR_LENGTH (eltstring)) - && (0 > scmp (XSTRING_DATA (eltstring), + /* Reject alternatives that start with space + unless the input starts with space. */ + && ((XSTRING_CHAR_LENGTH (string) > 0 && + string_char (XSTRING (string), 0) == ' ') + || string_char (XSTRING (eltstring), 0) != ' ') + && (0 > scmp (XSTRING_DATA (eltstring), XSTRING_DATA (string), slength))) { diff --git a/src/mule-canna.c b/src/mule-canna.c index 5b692ff..f9102bf 100644 --- a/src/mule-canna.c +++ b/src/mule-canna.c @@ -22,9 +22,11 @@ Boston, MA 02111-1307, USA. */ /* Synched up with: Mule 2.3. Not in FSF. */ -/* #### The comments in this file are mostly in EUC-formatted Japanese. - It would be ***soooo*** much nicer if someone could translate - them ... */ +/* Japanese comments were translated 2000-12-06 by Stephen Turnbull + . I haven't verified that the Japanese comments + were correct. YMMV, NO WARRANTY, not even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. (^^;;; as the + Japanese say. */ /* @@ -165,8 +167,9 @@ Boston, MA 02111-1307, USA. */ #endif /* !CANNA2 */ extern char *jrKanjiError; +/* #### is this global really necessary? */ #define KEYTOSTRSIZE 2048 -static unsigned char buf[KEYTOSTRSIZE]; +static unsigned char key_buffer[KEYTOSTRSIZE]; static char **warning; static int canna_empty_info, canna_through_info; @@ -214,8 +217,8 @@ variables. int len; CHECK_CHAR_COERCE_INT (ch); - len = jrKanjiString (0, XCHAR (ch), buf, KEYTOSTRSIZE, &ks); - return storeResults (buf, len, &ks); + len = jrKanjiString (0, XCHAR (ch), key_buffer, KEYTOSTRSIZE, &ks); + return storeResults (key_buffer, len, &ks); } static Lisp_Object @@ -229,10 +232,11 @@ storeResults (unsigned char *buf, int len, jrKanjiStatus *ks) } else { - /* ³ÎÄꤷ¤¿Ê¸»úÎó */ + /* ³ÎÄꤷ¤¿Ê¸»úÎó (the confirmed string) */ Vcanna_kakutei_string = make_string (buf, len); val = make_int (len); - /* ³ÎÄꤷ¤¿Ê¸»úÎó¤ÎÆɤߤξðÊó... */ + /* ³ÎÄꤷ¤¿Ê¸»úÎó¤ÎÆɤߤξðÊó... + (info about the reading of the confirmed string) */ Vcanna_kakutei_yomi = Vcanna_kakutei_romaji = Qnil; if (ks->info & KanjiYomiInfo) { @@ -243,18 +247,21 @@ storeResults (unsigned char *buf, int len, jrKanjiStatus *ks) { int yomilen2; - Vcanna_kakutei_yomi = make_string (p, yomilen); /* ÆÉ¤ß */ + Vcanna_kakutei_yomi = make_string (p, yomilen); /* ÆÉ¤ß + (reading) */ p += yomilen + 1; yomilen2 = strlen (p); if (len + yomilen + yomilen2 + 2 < KEYTOSTRSIZE) { - Vcanna_kakutei_romaji = make_string (p, yomilen2); /* ¥í¡¼¥Þ»ú */ + Vcanna_kakutei_romaji = make_string (p, yomilen2); + /* ¥í¡¼¥Þ»ú (romanization) */ } } } - /* ¸õÊäɽ¼¨¤Îʸ»úÎó¤Ç¤¹¡£*/ + /* ¸õÊäɽ¼¨¤Îʸ»úÎó¤Ç¤¹¡£ + (string for displaying candidate translations) */ Vcanna_henkan_string = Qnil; if (ks->length >= 0) { @@ -268,7 +275,8 @@ storeResults (unsigned char *buf, int len, jrKanjiStatus *ks) { canna_henkan_length = mule_strlen (ks->echoStr,ks->length); canna_henkan_revPos = mule_strlen (ks->echoStr,ks->revPos); - canna_henkan_revLen = mule_strlen (ks->echoStr+ks->revPos,ks->revLen); + canna_henkan_revLen = mule_strlen (ks->echoStr+ks->revPos, + ks->revLen); } else { @@ -279,30 +287,32 @@ storeResults (unsigned char *buf, int len, jrKanjiStatus *ks) #endif /* CANNA_MULE */ } - /* °ìÍ÷¤Î¾ðÊó */ + /* °ìÍ÷¤Î¾ðÊó (information about the echo area menu) */ Vcanna_ichiran_string = Qnil; if (ks->info & KanjiGLineInfo && ks->gline.length >= 0) { - Vcanna_ichiran_string = make_string (ks->gline.line, ks->gline.length); + Vcanna_ichiran_string = make_string (ks->gline.line, + ks->gline.length); #ifndef CANNA_MULE canna_ichiran_length = ks->gline.length; canna_ichiran_revPos = ks->gline.revPos; canna_ichiran_revLen = ks->gline.revLen; #else /* CANNA_MULE */ count_char (ks->gline.line, ks->gline.length, - ks->gline.revPos, ks->gline.revLen, &canna_ichiran_length, + ks->gline.revPos, ks->gline.revLen, + &canna_ichiran_length, &canna_ichiran_revPos, &canna_ichiran_revLen); #endif /* CANNA_MULE */ } - /* ¥â¡¼¥É¤Î¾ðÊó */ + /* ¥â¡¼¥É¤Î¾ðÊó (mode information) */ Vcanna_mode_string = Qnil; if (ks->info & KanjiModeInfo) { Vcanna_mode_string = make_string (ks->mode, strlen (ks->mode)); } - /* ¤½¤Î¾¤Î¾ðÊó */ + /* ¤½¤Î¾¤Î¾ðÊó (other information) */ canna_empty_info = (ks->info & KanjiEmptyInfo) ? 1 : 0; canna_through_info = (ks->info & KanjiThroughInfo) ? 1 : 0; } @@ -317,7 +327,7 @@ No separator will be used otherwise. */ (num)) { - int kugiri; /* ʸÀá¶èÀÚ¤ê¤ò¤¹¤ë¤«¡© */ + int kugiri; /* ʸÀá¶èÀÚ¤ê¤ò¤¹¤ë¤«¡© (display clause separator?) */ kugiri = NILP (num) ? 0 : 1; @@ -348,7 +358,7 @@ If nil is specified for each arg, the default value will be used. int res; unsigned char **p, **q; - int kugiri; /* ʸÀá¶èÀÚ¤ê¤ò¤¹¤ë¤«¡© */ + int kugiri; /* ʸÀá¶èÀÚ¤ê¤ò¤¹¤ë¤«¡© (display clause separator?) */ IRCP_context = -1; @@ -416,7 +426,7 @@ If nil is specified for each arg, the default value will be used. { val = Fcons (make_string ((unsigned char*) jrKanjiError, strlen (jrKanjiError)), val); - /* ¥¤¥Ë¥·¥ã¥é¥¤¥º¤Ç¼ºÇÔ¤·¤¿¾ì¹ç¡£ */ + /* ¥¤¥Ë¥·¥ã¥é¥¤¥º¤Ç¼ºÇÔ¤·¤¿¾ì¹ç¡£ (on initialization failure) */ return Fcons (Qnil, val); } else @@ -438,11 +448,14 @@ If nil is specified for each arg, the default value will be used. #ifndef CANNA_MULE jrKanjiControl (0, KC_INHIBITHANKAKUKANA, (char *) 1); #else - /* mule ¤À¤Ã¤¿¤éȾ³Ñ¥«¥¿¥«¥Ê¤â»È¤¨¤ë */ + /* mule ¤À¤Ã¤¿¤éȾ³Ñ¥«¥¿¥«¥Ê¤â»È¤¨¤ë + (Mule can use half-width katakana) */ if (canna_inhibit_hankakukana) jrKanjiControl (0, KC_INHIBITHANKAKUKANA, (char *) 1); #endif - jrKanjiControl (0, KC_YOMIINFO, (char *) 2); /* ¢¨£²: ¥í¡¼¥Þ»ú¤Þ¤ÇÊÖ¤¹ */ + jrKanjiControl (0, KC_YOMIINFO, (char *) 2); /* ¢¨£²: ¥í¡¼¥Þ»ú¤Þ¤ÇÊÖ¤¹ + (*2: return to + romanized form) */ val = Fcons (Qnil, val); return Fcons (CANNA_mode_keys (), val); } @@ -486,7 +499,7 @@ Register Kanji words into kana-to-kanji conversion dictionary. #endif CHECK_STRING (str); - ksv.buffer = (unsigned char *) buf; + ksv.buffer = (unsigned char *) key_buffer; ksv.bytes_buffer = KEYTOSTRSIZE; #ifndef CANNA_MULE ks.echoStr = XSTRING_DATA (str); @@ -498,7 +511,7 @@ Register Kanji words into kana-to-kanji conversion dictionary. #endif /* CANNA_MULE */ ksv.ks = &ks; len = jrKanjiControl (0, KC_DEFINEKANJI, (char *)&ksv); - val = storeResults (buf, ksv.val, ksv.ks); + val = storeResults (key_buffer, ksv.val, ksv.ks); return val; } @@ -525,12 +538,12 @@ Change Japanese pre-edit mode. CHECK_INT (num); - ksv.buffer = (unsigned char *) buf; + ksv.buffer = (unsigned char *) key_buffer; ksv.bytes_buffer = KEYTOSTRSIZE; ksv.ks = &ks; ksv.val = XINT (num); jrKanjiControl (0, KC_CHANGEMODE, (char *)&ksv); - val = storeResults (buf, ksv.val, ksv.ks); + val = storeResults (key_buffer, ksv.val, ksv.ks); return val; } @@ -563,12 +576,12 @@ Store yomi characters as a YOMI of kana-to-kanji conversion. CHECK_STRING (yomi); #ifndef CANNA_MULE - strncpy (buf, XSTRING_DATA (yomi), XSTRING_LENGTH (yomi)); + strncpy (key_buffer, XSTRING_DATA (yomi), XSTRING_LENGTH (yomi)); ks.length = XSTRING_LENGTH (yomi); - buf[ks.length] = '\0'; + key_buffer[ks.length] = '\0'; #else /* CANNA_MULE */ - m2c (XSTRING_DATA (yomi), XSTRING_LENGTH (yomi), buf); - ks.length = strlen (buf); + m2c (XSTRING_DATA (yomi), XSTRING_LENGTH (yomi), key_buffer); + ks.length = strlen (key_buffer); #endif /* CANNA_MULE */ if (NILP (roma)) @@ -580,24 +593,24 @@ Store yomi characters as a YOMI of kana-to-kanji conversion. CHECK_STRING (roma); #ifndef CANNA_MULE - strncpy (buf + XSTRING_LENGTH (yomi) + 1, XSTRING_DATA (roma), + strncpy (key_buffer + XSTRING_LENGTH (yomi) + 1, XSTRING_DATA (roma), XSTRING_LENGTH (roma)); - buf[XSTRING_LENGTH (yomi) + 1 + XSTRING_LENGTH (roma)] = '\0'; - ks.mode = (unsigned char *)(buf + XSTRING_LENGTH (yomi) + 1); + key_buffer[XSTRING_LENGTH (yomi) + 1 + XSTRING_LENGTH (roma)] = '\0'; + ks.mode = (unsigned char *)(key_buffer + XSTRING_LENGTH (yomi) + 1); #else /* CANNA_MULE */ - ks.mode = (unsigned char *)(buf + ks.length + 1); + ks.mode = (unsigned char *)(key_buffer + ks.length + 1); m2c (XSTRING_DATA (roma), XSTRING_LENGTH (roma), ks.mode); #endif /* CANNA_MULE */ } - ks.echoStr = (unsigned char *) buf; - ksv.buffer = (unsigned char *) buf; /* ÊÖÃÍÍÑ */ + ks.echoStr = (unsigned char *) key_buffer; + ksv.buffer = (unsigned char *) key_buffer; /* ÊÖÃÍÍÑ (return value) */ ksv.bytes_buffer = KEYTOSTRSIZE; ksv.ks = &ks; jrKanjiControl (0, KC_STOREYOMI, (char *)&ksv); - return storeResults (buf, ksv.val, ksv.ks); + return storeResults (key_buffer, ksv.val, ksv.ks); } DEFUN ("canna-do-function", Fcanna_do_function, 1, 2, 0, /* @@ -613,20 +626,20 @@ Do specified function at current mode. if (NILP (ch)) { - *buf = '@'; + *key_buffer = '@'; } else { CHECK_CHAR (ch); - *buf = XCHAR (ch); + *key_buffer = XCHAR (ch); } - ksv.buffer = (unsigned char *) buf; + ksv.buffer = (unsigned char *) key_buffer; ksv.bytes_buffer = KEYTOSTRSIZE; ksv.ks = &ks; ksv.val = XINT (num); jrKanjiControl (0, KC_DO, (char *) &ksv); - val = storeResults (buf, ksv.val, ksv.ks); + val = storeResults (key_buffer, ksv.val, ksv.ks); return val; } @@ -642,12 +655,12 @@ Parse customize string. CHECK_STRING (str); #ifndef CANNA_MULE - strncpy (buf, XSTRING_DATA (str), XSTRING_LENGTH (str)); - buf[XSTRING_LENGTH (str)] = '\0'; + strncpy (key_buffer, XSTRING_DATA (str), XSTRING_LENGTH (str)); + key_buffer[XSTRING_LENGTH (str)] = '\0'; #else /* CANNA_MULE */ - m2c (XSTRING_DATA (str), XSTRING_LENGTH (str), buf); + m2c (XSTRING_DATA (str), XSTRING_LENGTH (str), key_buffer); #endif /* CANNA_MULE */ - p = (unsigned char**) buf; + p = (unsigned char**) key_buffer; n = jrKanjiControl (0, KC_PARSE, (char *) &p); val = Qnil; while (n > 0) @@ -853,7 +866,9 @@ End conversion. { return Qnil; } - RkEndBun (IRCP_context, 1); /* ³Ø½¬¤Ï¤¤¤Ä¤Ç¤â¹Ô¤Ã¤ÆÎɤ¤¤â¤Î¤Ê¤Î¤«¡© */ + RkEndBun (IRCP_context, 1); /* ³Ø½¬¤Ï¤¤¤Ä¤Ç¤â¹Ô¤Ã¤ÆÎɤ¤¤â¤Î¤Ê¤Î¤«¡© + (is it OK to invoke learning function + at arbitrary times?) */ return Qt; } diff --git a/src/nt.c b/src/nt.c index 63f682e..27d3ae3 100644 --- a/src/nt.c +++ b/src/nt.c @@ -1378,37 +1378,92 @@ generate_inode_val (const char * name) a compatibility test. --kkm */ /* Since stat is encapsulated on Windows NT, we need to encapsulate - the equally broken fstat as well. */ + the equally broken fstat as well. FSFmacs also provides its own + utime. Is that necessary here too? */ int -mswindows_fstat (int handle, struct stat *buffer) +mswindows_fstat (int desc, struct stat * buf) { - int ret; - BY_HANDLE_FILE_INFORMATION lpFileInfo; - /* Initialize values */ - buffer->st_mode = 0; - buffer->st_size = 0; - buffer->st_dev = 0; - buffer->st_rdev = 0; - buffer->st_atime = 0; - buffer->st_ctime = 0; - buffer->st_mtime = 0; - buffer->st_nlink = 0; - ret = GetFileInformationByHandle((HANDLE) _get_osfhandle(handle), &lpFileInfo); - if (!ret) + HANDLE fh = (HANDLE) _get_osfhandle (desc); + BY_HANDLE_FILE_INFORMATION info; + DWORD fake_inode; + int permission; + + switch (GetFileType (fh) & ~FILE_TYPE_REMOTE) { - return -1; + case FILE_TYPE_DISK: + buf->st_mode = _S_IFREG; + if (!GetFileInformationByHandle (fh, &info)) + { + errno = EACCES; + return -1; + } + break; + case FILE_TYPE_PIPE: + buf->st_mode = _S_IFIFO; + goto non_disk; + case FILE_TYPE_CHAR: + case FILE_TYPE_UNKNOWN: + default: + buf->st_mode = _S_IFCHR; + non_disk: + memset (&info, 0, sizeof (info)); + info.dwFileAttributes = 0; + info.ftCreationTime = utc_base_ft; + info.ftLastAccessTime = utc_base_ft; + info.ftLastWriteTime = utc_base_ft; + } + + if (info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + { + buf->st_mode = _S_IFDIR; + buf->st_nlink = 2; /* doesn't really matter */ + fake_inode = 0; /* this doesn't either I think */ } else { - buffer->st_mtime = convert_time (lpFileInfo.ftLastWriteTime); - buffer->st_atime = convert_time (lpFileInfo.ftLastAccessTime); - if (buffer->st_atime == 0) buffer->st_atime = buffer->st_mtime; - buffer->st_ctime = convert_time (lpFileInfo.ftCreationTime); - if (buffer->st_ctime == 0) buffer->st_ctime = buffer->st_mtime; - buffer->st_size = lpFileInfo.nFileSizeLow; - buffer->st_nlink = (short) lpFileInfo.nNumberOfLinks; - return 0; + buf->st_nlink = info.nNumberOfLinks; + /* Might as well use file index to fake inode values, but this + is not guaranteed to be unique unless we keep a handle open + all the time (even then there are situations where it is + not unique). Reputedly, there are at most 48 bits of info + (on NTFS, presumably less on FAT). */ + fake_inode = info.nFileIndexLow ^ info.nFileIndexHigh; } + + /* MSVC defines _ino_t to be short; other libc's might not. */ + if (sizeof (buf->st_ino) == 2) + buf->st_ino = fake_inode ^ (fake_inode >> 16); + else + buf->st_ino = fake_inode; + + /* consider files to belong to current user */ + buf->st_uid = 0; + buf->st_gid = 0; + + buf->st_dev = info.dwVolumeSerialNumber; + buf->st_rdev = info.dwVolumeSerialNumber; + + buf->st_size = info.nFileSizeLow; + + /* Convert timestamps to Unix format. */ + buf->st_mtime = convert_time (info.ftLastWriteTime); + buf->st_atime = convert_time (info.ftLastAccessTime); + if (buf->st_atime == 0) buf->st_atime = buf->st_mtime; + buf->st_ctime = convert_time (info.ftCreationTime); + if (buf->st_ctime == 0) buf->st_ctime = buf->st_mtime; + + /* determine rwx permissions */ + if (info.dwFileAttributes & FILE_ATTRIBUTE_READONLY) + permission = _S_IREAD; + else + permission = _S_IREAD | _S_IWRITE; + + if (info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + permission |= _S_IEXEC; + + buf->st_mode |= permission | (permission >> 3) | (permission >> 6); + + return 0; } /* MSVC stat function can't cope with UNC names and has other bugs, so diff --git a/src/objects.c b/src/objects.c index 2597b61..d1ab10e 100644 --- a/src/objects.c +++ b/src/objects.c @@ -616,7 +616,11 @@ color_after_change (Lisp_Object specifier, Lisp_Object locale) Lisp_Object property = COLOR_SPECIFIER_FACE_PROPERTY (XCOLOR_SPECIFIER (specifier)); if (!NILP (face)) - face_property_was_changed (face, property, locale); + { + face_property_was_changed (face, property, locale); + if (BUFFERP (locale)) + XBUFFER (locale)->buffer_local_face_property = 1; + } } void @@ -814,7 +818,11 @@ font_after_change (Lisp_Object specifier, Lisp_Object locale) Lisp_Object property = FONT_SPECIFIER_FACE_PROPERTY (XFONT_SPECIFIER (specifier)); if (!NILP (face)) - face_property_was_changed (face, property, locale); + { + face_property_was_changed (face, property, locale); + if (BUFFERP (locale)) + XBUFFER (locale)->buffer_local_face_property = 1; + } } void @@ -949,7 +957,11 @@ face_boolean_after_change (Lisp_Object specifier, Lisp_Object locale) Lisp_Object property = FACE_BOOLEAN_SPECIFIER_FACE_PROPERTY (XFACE_BOOLEAN_SPECIFIER (specifier)); if (!NILP (face)) - face_property_was_changed (face, property, locale); + { + face_property_was_changed (face, property, locale); + if (BUFFERP (locale)) + XBUFFER (locale)->buffer_local_face_property = 1; + } } void diff --git a/src/redisplay-output.c b/src/redisplay-output.c index d64d1e7..4b8aa7a 100644 --- a/src/redisplay-output.c +++ b/src/redisplay-output.c @@ -182,7 +182,7 @@ sync_display_line_structs (struct window *w, int line, int do_blocks, /***************************************************************************** compare_runes - Compare to runes to see if each of their fields is equal. If so, + Compare two runes to see if each of their fields is equal. If so, return true otherwise return false. ****************************************************************************/ static int @@ -1162,8 +1162,9 @@ redisplay_output_display_block (struct window *w, struct display_line *dl, int b Remove subwindows from the area in the box defined by the given parameters. ****************************************************************************/ -static void redisplay_unmap_subwindows (struct frame* f, int x, int y, int width, int height, - Lisp_Object ignored_window) +static void +redisplay_unmap_subwindows (struct frame* f, int x, int y, int width, int height, + Lisp_Object ignored_window) { Lisp_Object rest; @@ -1757,7 +1758,17 @@ redisplay_normalize_glyph_area (struct display_box* dest, || -glyphsrc->xoffset >= glyphsrc->width || - -glyphsrc->yoffset >= glyphsrc->height) + -glyphsrc->yoffset >= glyphsrc->height + || + /* #### Not sure why this wasn't coped with before but normalizing + to zero width or height is definitely wrong. */ + (dest->xpos + glyphsrc->xoffset + glyphsrc->width > dest->xpos + dest->width + && + dest->width - glyphsrc->xoffset <= 0) + || + (dest->ypos + glyphsrc->yoffset + glyphsrc->height > dest->ypos + dest->height + && + dest->height - glyphsrc->yoffset <= 0)) { /* It's all clipped out */ return 0; @@ -1904,7 +1915,7 @@ redisplay_calculate_display_boxes (struct display_line *dl, int xpos, If window is topmost, clear the internal border above it. ****************************************************************************/ -static void +void redisplay_clear_top_of_window (struct window *w) { Lisp_Object window; @@ -2269,7 +2280,7 @@ redisplay_output_window (struct window *w) /* If the window's structure has changed clear the internal border above it if it is topmost (the function will check). */ - if (f->windows_structure_changed) + if (f->windows_structure_changed || f->faces_changed) redisplay_clear_top_of_window (w); /* Output each line. */ diff --git a/src/redisplay-x.c b/src/redisplay-x.c index 85d540a..999d3a5 100644 --- a/src/redisplay-x.c +++ b/src/redisplay-x.c @@ -1706,6 +1706,7 @@ x_redraw_exposed_window (struct window *w, int x, int y, int width, int height) f->windows_structure_changed = 1; } + redisplay_clear_top_of_window (w); if (window_needs_vertical_divider (w)) { x_output_vertical_divider (w, 0); diff --git a/src/redisplay.c b/src/redisplay.c index 733315f..6f71812 100644 --- a/src/redisplay.c +++ b/src/redisplay.c @@ -9366,7 +9366,7 @@ Non-nil means put cursor in minibuffer, at end of any message there. maybe a caret cursor, etc. */ DEFVAR_LISP ("bar-cursor", &Vbar_cursor /* -Use vertical bar cursor if non-nil. If t width is 1 pixel, otherwise 2. +*Use vertical bar cursor if non-nil. If t width is 1 pixel, otherwise 2. */ ); Vbar_cursor = Qnil; diff --git a/src/redisplay.h b/src/redisplay.h index 9bf58c4..12fbc1c 100644 --- a/src/redisplay.h +++ b/src/redisplay.h @@ -776,6 +776,7 @@ int redisplay_normalize_glyph_area (struct display_box* dest, void redisplay_clear_to_window_end (struct window *w, int ypos1, int ypos2); void redisplay_clear_region (Lisp_Object window, face_index findex, int x, int y, int width, int height); +void redisplay_clear_top_of_window (struct window *w); void redisplay_clear_bottom_of_window (struct window *w, display_line_dynarr *ddla, int min_start, int max_end); diff --git a/src/s/sco5.h b/src/s/sco5.h index f900f12..c6d7c45 100644 --- a/src/s/sco5.h +++ b/src/s/sco5.h @@ -37,6 +37,7 @@ Boston, MA 02111-1307, USA. */ #define SYSTEM_TYPE "SCO 3.2v5" /* SCO has ptys, but with weird names */ +#define HAVE_PTYS #define PTY_ITERATION \ for (i = 0; ; i++) #define PTY_NAME_SPRINTF \ diff --git a/src/sysfile.h b/src/sysfile.h index 2f6c90d..a8f5405 100644 --- a/src/sysfile.h +++ b/src/sysfile.h @@ -170,7 +170,7 @@ Boston, MA 02111-1307, USA. */ In that case, use ordinary stat instead. */ #ifndef S_IFLNK -#define lstat stat +#define lstat xemacs_stat #endif #if !S_IRUSR diff --git a/src/unexcw.c b/src/unexcw.c index 774c0fa..63190c5 100644 --- a/src/unexcw.c +++ b/src/unexcw.c @@ -23,11 +23,13 @@ Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA /* This is a complete rewrite, some code snarfed from unexnt.c and unexec.c, Andy Piper (andy@xemacs.org) 13-1-98 */ +#include +#include "lisp.h" + #include #include #include #include -#include #include #define DONT_ENCAPSULATE /* filenames are external in unex*.c */ @@ -53,7 +55,7 @@ unexec (char *, char *, void *, void *, void *) ((((unsigned long)addr) + ALLOC_UNIT) & ALLOC_MASK) /* Note that all sections must be aligned on a 0x1000 boundary so this is the minimum size that our dummy bss can be. */ -#ifdef BROKEN_GDB +#ifndef NO_DEBUG #define BSS_PAD_SIZE 0x1000 #else #define BSS_PAD_SIZE 0 @@ -92,12 +94,10 @@ if (lseek(a_out, 0, SEEK_CUR) != a) \ exit(-1); \ } -void -unexec (char *out_name, char *in_name, void *start_data, - void * d1, void * d2); /* Dump out .data and .bss sections into a new executable. */ -void unexec (char *out_name, char *in_name, void *start_data, - void * d1, void * d2) +int +unexec (char *out_name, char *in_name, uintptr_t start_data, + uintptr_t d1, uintptr_t d2) { /* ugly nt hack - should be in lisp */ int a_new, a_out = -1; @@ -137,12 +137,13 @@ void unexec (char *out_name, char *in_name, void *start_data, close(a_out); close(a_new); + return 0; } /* Flip through the executable and cache the info necessary for dumping. */ static void get_section_info (int a_out, char* a_name) { - extern int my_ebss; + extern char my_ebss[]; /* From lastfile.c */ extern char my_edata[]; @@ -291,6 +292,11 @@ copy_executable_and_dump_data_section (int a_out, int a_new) data_padding = (f_bss.s_vaddr - f_data.s_vaddr) - f_data.s_size; } + if ((new_bss_size - bss_size) < BSS_PAD_SIZE) + { + PERROR (".bss free space too small"); + } + file_sz_change=(new_bss_size + data_padding) - BSS_PAD_SIZE; new_data_size=f_ohdr.dsize + file_sz_change; @@ -310,7 +316,7 @@ copy_executable_and_dump_data_section (int a_out, int a_new) lseek (a_new, 0, SEEK_SET); /* write file header */ f_hdr.f_symptr += file_sz_change; -#ifndef BROKEN_GDB +#ifdef NO_DEBUG f_hdr.f_nscns--; #endif @@ -340,7 +346,7 @@ copy_executable_and_dump_data_section (int a_out, int a_new) { PERROR("failed to write text header"); } -#ifdef BROKEN_GDB +#ifndef NO_DEBUG /* Write small bss section. */ if (!sections_reversed) { @@ -360,7 +366,7 @@ copy_executable_and_dump_data_section (int a_out, int a_new) { PERROR("failed to write data header"); } -#ifdef BROKEN_GDB +#ifndef NO_DEBUG /* Write small bss section. */ if (sections_reversed) { @@ -399,7 +405,7 @@ copy_executable_and_dump_data_section (int a_out, int a_new) PERROR("failed to write data header"); } } -#ifndef BROKEN_GDB +#ifdef NO_DEBUG /* dump bss to maintain offsets */ memset(&f_bss, 0, sizeof(f_bss)); if (write(a_new, &f_bss, sizeof(f_bss)) != sizeof(f_bss)) diff --git a/src/unexelfsgi.c b/src/unexelfsgi.c index ee93167..95844f3 100644 --- a/src/unexelfsgi.c +++ b/src/unexelfsgi.c @@ -226,9 +226,10 @@ unexec (char *new_name, fatal ("Can't fstat (%s): errno %d\n", old_name, errno); /* map old file into the address space. */ - if ( (old_base = (caddr_t) mmap ((caddr_t) 0, stat_buf.st_size, - PROT_READ, MAP_SHARED, old_file, 0)) < 0 ) - fatal ("Can't mmap (%s): errno %d\n", old_name, errno); + old_base = (caddr_t) mmap ((caddr_t) 0, stat_buf.st_size, + PROT_READ, MAP_SHARED, old_file, 0); + if (old_base == (caddr_t) MAP_FAILED) + fatal ("Can't mmap (%s): errno %d\n", old_name, errno); old_file_h = (ElfW(Ehdr) *) old_base; old_program_h = (ElfW(Phdr) *) ((byte *) old_base + old_file_h->e_phoff); diff --git a/src/window.c b/src/window.c index 18ee8e4..ef0cf7f 100644 --- a/src/window.c +++ b/src/window.c @@ -2132,7 +2132,7 @@ minibuffer does not count, only windows from WINDOW's frame count. By default, only the windows in the selected frame are considered. The optional argument WHICH-FRAMES changes this behavior: WHICH-FRAMES = `visible' means search windows on all visible frames. -WHICH-FRAMES = 0 means search windows on all visible and iconified frames. +WHICH-FRAMES = 0 means search windows on all visible and iconified frames. WHICH-FRAMES = t means search windows on all frames including invisible frames. WHICH-FRAMES = a frame means search only windows on that frame. Anything else means restrict to the selected frame. @@ -2278,7 +2278,7 @@ the minibuffer does not count, only windows from WINDOW's frame count. By default, only the windows in the selected frame are considered. The optional argument WHICH-FRAMES changes this behavior: WHICH-FRAMES = `visible' means search windows on all visible frames. -WHICH-FRAMES = 0 means search windows on all visible and iconified frames. +WHICH-FRAMES = 0 means search windows on all visible and iconified frames. WHICH-FRAMES = t means search windows on all frames including invisible frames. WHICH-FRAMES = a frame means search only windows on that frame. Anything else means restrict to the selected frame. @@ -2481,7 +2481,7 @@ A negative COUNT moves in the opposite order. By default, only the windows in the selected frame are considered. The optional argument WHICH-FRAMES changes this behavior: WHICH-FRAMES = `visible' means search windows on all visible frames. -WHICH-FRAMES = 0 means search windows on all visible and iconified frames. +WHICH-FRAMES = 0 means search windows on all visible and iconified frames. WHICH-FRAMES = t means search windows on all frames including invisible frames. WHICH-FRAMES = a frame means search only windows on that frame. Anything else means restrict to the selected frame. @@ -2536,7 +2536,6 @@ enum window_loop DELETE_OTHER_WINDOWS, /* Arg is window not to delete */ DELETE_BUFFER_WINDOWS, /* Arg is buffer */ GET_LARGEST_WINDOW, - UNSHOW_BUFFER, /* Arg is buffer */ GET_BUFFER_WINDOW_COUNT, /* Arg is buffer */ GET_BUFFER_MRU_WINDOW /* Arg is buffer */ }; @@ -2549,7 +2548,7 @@ window_loop (enum window_loop type, int dedicated_too, Lisp_Object which_devices) { - /* This function can GC if type == DELETE_BUFFER_WINDOWS or UNSHOW_BUFFER */ + /* This function can GC if type == DELETE_BUFFER_WINDOWS */ Lisp_Object w; Lisp_Object best_window = Qnil; Lisp_Object next_window; @@ -2621,7 +2620,6 @@ window_loop (enum window_loop type, for (;;) { struct window *p = XWINDOW (w); - struct frame *w_frame = XFRAME (WINDOW_FRAME (p)); /* Pick the next window now, since some operations will delete the current window. */ @@ -2771,57 +2769,6 @@ window_loop (enum window_loop type, break; } - case UNSHOW_BUFFER: - { - if (EQ (p->buffer, obj)) - { - /* Find another buffer to show in this window. */ - Lisp_Object another_buffer = - Fother_buffer (obj, Qnil, Qnil); - if (NILP (another_buffer)) - another_buffer - = Fget_buffer_create (QSscratch); - /* If this window is dedicated, and in a frame - of its own, kill the frame. */ - if (EQ (w, FRAME_ROOT_WINDOW (w_frame)) - && !NILP (p->dedicated) - && other_visible_frames (w_frame)) - { - /* Skip the other windows on this frame. - There might be one, the minibuffer! */ - if (! EQ (w, last_window)) - while (w_frame == XFRAME (WINDOW_FRAME - (XWINDOW (next_window)))) - { - /* As we go, check for the end of the - loop. We mustn't start going - around a second time. */ - if (EQ (next_window, last_window)) - { - last_window = w; - break; - } - next_window = Fnext_window (next_window, - mini ? Qt : Qnil, - frame_arg, Qt); - } - /* Now we can safely delete the frame. */ - delete_frame_internal (XFRAME (WINDOW_FRAME (p)), - 0, 0, 0); - } - else - { - /* Otherwise show a different buffer in the - window. */ - p->dedicated = Qnil; - Fset_window_buffer (w, another_buffer, Qnil); - if (EQ (w, Fselected_window (Qnil))) - Fset_buffer (p->buffer); - } - } - break; - } - default: abort (); } @@ -3099,6 +3046,63 @@ Any other non-nil value means search all devices. return Qnil; } +static Lisp_Object +list_windows (struct window *w, Lisp_Object value) +{ + for (;;) + { + if (!NILP (w->hchild)) + value = list_windows (XWINDOW (w->hchild), value); + else if (!NILP (w->vchild)) + value = list_windows (XWINDOW (w->vchild), value); + else + { + Lisp_Object window; + XSETWINDOW (window, w); + value = Fcons (window, value); + } + if (NILP (w->next)) + break; + w = XWINDOW (w->next); + } + return value; +} + +static Lisp_Object +list_all_windows (Lisp_Object frame_spec, Lisp_Object device_spec) +{ + Lisp_Object devcons, concons; + Lisp_Object retval = Qnil; + + DEVICE_LOOP_NO_BREAK (devcons, concons) + { + Lisp_Object frame_list, the_window; + Lisp_Object device, tail; + + device = XCAR (devcons); + frame_list = DEVICE_FRAME_LIST (XDEVICE (device)); + + LIST_LOOP (tail, frame_list) + { + if ((NILP (frame_spec) + && !EQ (XCAR (tail), DEVICE_SELECTED_FRAME (XDEVICE (device)))) + || (EQ (frame_spec, Qvisible) + && !FRAME_VISIBLE_P (XFRAME (XCAR (tail)))) + || (FRAMEP (frame_spec) + && !EQ (frame_spec, XCAR (tail))) + || (!NILP (frame_spec) + && !device_matches_device_spec (device, + NILP (device_spec) ? + Vselected_console : + device_spec))) + continue; + the_window = FRAME_ROOT_WINDOW (XFRAME (XCAR (tail))); + retval = list_windows (XWINDOW (the_window), retval); + } + } + return Fnreverse (retval); +} + DEFUN ("replace-buffer-in-windows", Freplace_buffer_in_windows, 1, 3, "bReplace buffer in windows: ", /* Replace BUFFER with some other buffer in all windows showing it. @@ -3124,18 +3128,46 @@ Any other non-nil value means search all devices. (buffer, which_frames, which_devices)) { /* This function can GC */ - buffer = Fget_buffer (buffer); - CHECK_BUFFER (buffer); + Lisp_Object window_list; + Lisp_Object tail; + struct gcpro gcpro1, gcpro2; - /* WHICH-FRAMES values t and nil mean the opposite of what - window_loop expects. */ if (EQ (which_frames, Qnil)) which_frames = Qt; else if (EQ (which_frames, Qt)) which_frames = Qnil; + window_list = list_all_windows (which_frames, which_devices); - /* Ignore dedicated windows. */ - window_loop (UNSHOW_BUFFER, buffer, 0, which_frames, 0, which_devices); + buffer = Fget_buffer (buffer); + CHECK_BUFFER (buffer); + + GCPRO2 (window_list, buffer); + LIST_LOOP (tail, window_list) + { + Lisp_Object window = XCAR (tail); + if (!MINI_WINDOW_P (XWINDOW (window)) + && EQ (XWINDOW (window)->buffer, buffer)) + { + Lisp_Object another_buffer = Fother_buffer (buffer, Qnil, Qnil); + Lisp_Object frame = WINDOW_FRAME (XWINDOW (window)); + if (NILP (another_buffer)) + another_buffer = Fget_buffer_create (QSscratch); + if (!NILP (XWINDOW (window)->dedicated) + && EQ (window, + FRAME_ROOT_WINDOW (XFRAME (frame))) + && other_visible_frames (XFRAME (frame))) + { + delete_frame_internal (XFRAME (frame), 0, 0, 0); /* GC */ + } + else + { + Fset_window_buffer (window, another_buffer, Qnil); + if (EQ (window, Fselected_window (Qnil))) + Fset_buffer (XWINDOW (window)->buffer); + } + } + } + UNGCPRO; return Qnil; } @@ -3352,6 +3384,7 @@ global or per-frame buffer ordering. { Lisp_Object tem; struct window *w = decode_window (window); + int old_buffer_local_face_property = 0; buffer = Fget_buffer (buffer); CHECK_BUFFER (buffer); @@ -3383,6 +3416,8 @@ global or per-frame buffer ordering. error ("Window is dedicated to buffer %s", XSTRING_DATA (XBUFFER (tem)->name)); + old_buffer_local_face_property = + XBUFFER (w->buffer)->buffer_local_face_property; unshow_buffer (w); } @@ -3404,6 +3439,14 @@ global or per-frame buffer ordering. SET_LAST_MODIFIED (w, 1); SET_LAST_FACECHANGE (w); MARK_WINDOWS_CHANGED (w); + { + int new_buffer_local_face_property = + XBUFFER (w->buffer)->buffer_local_face_property; + + if (new_buffer_local_face_property + || new_buffer_local_face_property != old_buffer_local_face_property) + MARK_WINDOW_FACES_CHANGED (w); + } recompute_all_cached_specifiers_in_window (w); if (EQ (window, Fselected_window (Qnil))) { @@ -3649,7 +3692,12 @@ and put SIZE columns in the first of the pair. || NILP (XWINDOW (o->parent)->vchild)) { make_dummy_parent (window); +#if 0 + /* #### I can't understand why you have to reset face + cachels here. This can cause crash so let's disable it + and see the difference. See redisplay-tests.el --yh */ reset_face_cachels (XWINDOW (window)); +#endif new = o->parent; XWINDOW (new)->vchild = window; XFRAME (o->frame)->mirror_dirty = 1; @@ -3666,7 +3714,10 @@ and put SIZE columns in the first of the pair. || NILP (XWINDOW (o->parent)->hchild)) { make_dummy_parent (window); +#if 0 + /* #### See above. */ reset_face_cachels (XWINDOW (window)); +#endif new = o->parent; XWINDOW (new)->hchild = window; XFRAME (o->frame)->mirror_dirty = 1; diff --git a/src/window.h b/src/window.h index b72ec92..69cd2a7 100644 --- a/src/window.h +++ b/src/window.h @@ -300,6 +300,13 @@ DECLARE_LRECORD (window, struct window); windows_changed = 1; \ } while (0) +/* #### This should be fixed not to call MARK_FRAME_CHANGED because + faces are cached per window. Also, other code which changes window's + face should use this macro. +*/ +#define MARK_WINDOW_FACES_CHANGED(w) \ + MARK_FRAME_FACES_CHANGED (XFRAME ((w)->frame)) + #define WINDOW_TTY_P(w) FRAME_TTY_P (XFRAME ((w)->frame)) #define WINDOW_X_P(w) FRAME_X_P (XFRAME ((w)->frame)) #define WINDOW_NS_P(w) FRAME_NS_P (XFRAME ((w)->frame)) diff --git a/tests/ChangeLog b/tests/ChangeLog index ee7e52d..863abf1 100644 --- a/tests/ChangeLog +++ b/tests/ChangeLog @@ -1,3 +1,30 @@ +2000-12-31 Martin Buchholz + + * XEmacs 21.2.39 is released. + +2000-12-28 Martin Buchholz + + * automated/lisp-tests.el: + Avoid triggering Solaris printf buffer overflow from (format). + +2000-12-04 Yoshiki Hayashi + + * redisplay-tests.el: New file. + +2000-12-12 Martin Buchholz + + * automated/lisp-tests.el: Add/Change (format) tests. + +2000-12-04 Yoshiki Hayashi + + * automated/lisp-test.el: Test if all-completions ignore + elements start with space. + +2000-12-04 Yoshiki Hayashi + + * automated/regexp-tests.el: Test unmatched search doesn't + alter match-string. + 2000-12-05 Martin Buchholz * XEmacs 21.2.38 is released. diff --git a/tests/automated/lisp-tests.el b/tests/automated/lisp-tests.el index 7d6f321..8f4bbfb 100644 --- a/tests/automated/lisp-tests.el +++ b/tests/automated/lisp-tests.el @@ -998,6 +998,10 @@ (Assert (string= (format "%e" 100) "1.000000e+02")) (Assert (string= (format "%E" 100) "1.000000E+02")) (Assert (string= (format "%f" 100) "100.000000")) +(Assert (string= (format "%7.3f" 12.12345) " 12.123")) +(Assert (string= (format "%07.3f" 12.12345) "012.123")) +(Assert (string= (format "%-7.3f" 12.12345) "12.123 ")) +(Assert (string= (format "%-07.3f" 12.12345) "12.123 ")) (Assert (string= (format "%g" 100.0) "100")) (Assert (string= (format "%g" 0.000001) "1e-06")) (Assert (string= (format "%g" 0.0001) "0.0001")) @@ -1039,7 +1043,7 @@ (Assert (string= (format "%.1d" 10) "10")) (Assert (string= (format "%.4d" 10) "0010")) ;; Combination of `-', `+', ` ', `0', `#', `.', `*' -(Assert (string= (format "%-04d" 10) "0010")) +(Assert (string= (format "%-04d" 10) "10 ")) (Assert (string= (format "%-*d" 4 10) "10 ")) ;; #### Correctness of this behavior is questionable. ;; It might be better to signal error. @@ -1052,11 +1056,16 @@ ;; (format "%-.1d" 10) (Assert (string= (format "%01.1d" 10) "10")) -(Assert (string= (format "%03.1d" 10) "010")) -(Assert (string= (format "%01.3d" 10) "10")) -(Assert (string= (format "%1.3d" 10) "10")) +(Assert (string= (format "%03.1d" 10) " 10")) +(Assert (string= (format "%01.3d" 10) "010")) +(Assert (string= (format "%1.3d" 10) "010")) (Assert (string= (format "%3.1d" 10) " 10")) +;;; The following two tests used to use 1000 instead of 100, +;;; but that merely found buffer overflow bugs in Solaris sprintf(). +(Assert (= 102 (length (format "%.100f" 3.14)))) +(Assert (= 100 (length (format "%100f" 3.14)))) + ;;; Check for 64-bit cleanness on LP64 platforms. (Assert (= (read (format "%d" most-positive-fixnum)) most-positive-fixnum)) (Assert (= (read (format "%ld" most-positive-fixnum)) most-positive-fixnum)) @@ -1071,3 +1080,7 @@ ;;; The printed value might be useful to a human, if not to Emacs Lisp. (Check-Error invalid-read-syntax (read (format "%u" most-negative-fixnum))) (Check-Error invalid-read-syntax (read (format "%u" -1))) + +;; Check all-completions ignore element start with space. +(Assert (not (all-completions "" '((" hidden" . "object"))))) +(Assert (all-completions " " '((" hidden" . "object")))) diff --git a/tests/automated/regexp-tests.el b/tests/automated/regexp-tests.el index 2df3156..292abeb 100644 --- a/tests/automated/regexp-tests.el +++ b/tests/automated/regexp-tests.el @@ -204,3 +204,12 @@ (setq i (1+ i)))))) ;; (test-regex-charset-mule-paranoid) + +;; Test replace-match +(with-temp-buffer + (insert "This is a test buffer.") + (goto-char (point-min)) + (search-forward "this is a test ") + (looking-at "Unmatchable text") + (replace-match "") + (Assert (looking-at "^buffer.$")))