diff --git a/ChangeLog b/ChangeLog index 8af393d4393..7d1c19a535e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,55 @@ +2012-09-10 Paul Eggert + + Improve robustness of 'make bootstrap' (Bug#12376). + Run autogen.sh after bootstrap-clean, to avoid bzr pull issues. + * INSTALL, README: Document autogen.sh. + * Makefile.in (Makefile): Mark it as precious, since it's updated + atomically. + (MAKE_CONFIG_STATUS): New macro. + (config.status, bootstrap): Use it. This causes 'make bootstrap' + to run config.status with the --recheck option, which is more + appropriate for a bootstrap. + (bootstrap): Run autogen.sh right after cleaning. Don't worry + about failures due to missing tools. + * autogen.sh: Exit with status 101 when failing due to missing tools. + * make-dist: Distribute autogen.sh. + +2012-09-09 Paul Eggert + + Assume C89 or later for math functions (Bug#12381). + * configure.ac (frexp, fmod): Remove checks for these functions, + as we now assume them. + (FLOAT_CHECK_DOMAIN, HAVE_INVERSE_HYPERBOLIC, NO_MATHERR) + (HAVE_EXCEPTION): + Remove; no longer needed. + +2012-09-07 Paul Eggert + + More signal-handler cleanup (Bug#12327). + * configure.ac (FLOAT_CHECK_DOMAIN): Comment fix (Bug#12327). + +2012-09-06 Paul Eggert + + Signal-handler cleanup (Bug#12327). + * configure.ac (PTY_OPEN, PTY_TTY_NAME_SPRINTF): + Adjust to syssignal.h changes. + (SIGNAL_H_AB): Remove; no longer needed. + +2012-09-04 Paul Eggert + + Simplify redefinition of 'abort' (Bug#12316). + * configure.ac (NO_ABRT): Remove. + + * configure.ac (_setjmp, _longjmp): Check by compiling + instead of by guessing. The guesses were wrong for + recent versions of Solaris, such as Solaris 11. + 2012-09-03 Paul Eggert + * configure.ac (WARN_CFLAGS): Omit -Wjump-misses-init. + It generates false alarms in doc.c, regex.c, xdisp.c. See + . + Merge from gnulib, incorporating: 2012-08-29 stdbool: be more compatible with mixed C/C++ compiles 2011-11-30 manywarnings: update the list of "all" warnings diff --git a/INSTALL b/INSTALL index f0cf5d68db0..4716bbecf99 100644 --- a/INSTALL +++ b/INSTALL @@ -695,9 +695,9 @@ running the `configure' program, you have to perform the following steps. corresponding `Makefile.in' files. This isn't so hard, just a matter of editing in appropriate substitutions for the @...@ constructs. -The `configure' script is built from `configure.ac' by the `autoconf' -program. You need at least the version of autoconf specified in the -AC_PREREQ(...) command to rebuild `configure' from `configure.ac'. +The `configure' script is built from `configure.ac' by the +`autogen.sh' script, which checks that `autoconf' and other build +tools are sufficiently up to date and then runs the build tools. BUILDING GNU EMACS BY HAND diff --git a/Makefile.in b/Makefile.in index 122a35d4416..800f11669d6 100644 --- a/Makefile.in +++ b/Makefile.in @@ -360,15 +360,17 @@ $(MAKEFILE_NAME): config.status $(srcdir)/src/config.in \ $(srcdir)/Makefile.in $(SUBDIR_MAKEFILES_IN) ./config.status -# Don't erase config.status if make is interrupted while refreshing it. -.PRECIOUS: config.status +# Don't erase these files if make is interrupted while refreshing them. +.PRECIOUS: Makefile config.status -config.status: ${srcdir}/configure ${srcdir}/lisp/version.el +MAKE_CONFIG_STATUS = \ if [ -x ./config.status ]; then \ ./config.status --recheck; \ else \ ./configure $(CONFIGURE_FLAGS); \ fi +config.status: ${srcdir}/configure ${srcdir}/lisp/version.el + $(MAKE_CONFIG_STATUS) AUTOCONF_INPUTS = $(srcdir)/configure.ac $(srcdir)/aclocal.m4 @@ -383,6 +385,10 @@ AUTOMAKE_INPUTS = $(srcdir)/aclocal.m4 $(srcdir)/lib/Makefile.am \ $(srcdir)/lib/gnulib.mk $(srcdir)/lib/Makefile.in: $(AUTOMAKE_INPUTS) cd $(srcdir) && automake --gnu -a -c lib/Makefile + +# Regenerate files that this makefile would have made, if this makefile +# had been built by Automake. The name 'am--refresh' is for +# compatibility with subsidiary Automake-generated makefiles. am--refresh: $(srcdir)/aclocal.m4 $(srcdir)/configure $(srcdir)/src/config.in .PHONY: am--refresh @@ -776,8 +782,6 @@ bootstrap-clean: FRC (cd lisp; $(MAKE) $(MFLAGS) bootstrap-clean) [ ! -f config.log ] || mv -f config.log config.log~ ${top_bootclean} -## configure; make bootstrap replaces the real config.log from configure -## with the truncated one from config.status. The former is more useful. ### `maintainer-clean' ### Delete everything from the current directory that can be @@ -883,14 +887,14 @@ dvi: .PHONY: bootstrap -## configure; make bootstrap replaces the real config.log from configure -## with the truncated one from config.status. The former is more useful. +# Bootstrapping does the following: +# * Remove files to start from a clean slate. +# * Run autogen.sh, but don't worry about exit status 101 (missing tools). +# * Build Makefile, to build the build procedure itself. +# * Do the actual build. bootstrap: bootstrap-clean FRC - if [ -x ./config.status ]; then \ - ./config.status; \ - else \ - ./configure $(CONFIGURE_FLAGS); \ - fi + cd $(srcdir) && { ./autogen.sh || test $$? -eq 101; } + $(MAKE_CONFIG_STATUS) $(MAKE) $(MFLAGS) info all .PHONY: check-declare diff --git a/README b/README index a11935ee3e8..2c50c5bbb91 100644 --- a/README +++ b/README @@ -41,9 +41,14 @@ The file `configure.ac' is the input used by the autoconf program to construct the `configure' script. Since Emacs has some configuration requirements that autoconf can't meet directly, and for historical reasons, `configure.ac' uses an unholy marriage of custom-baked -configuration code and autoconf macros. If you want to rebuild -`configure' from `configure.ac', you will need to install a recent -version of autoconf and GNU m4. +configuration code and autoconf macros. + +The shell script `autogen.sh' generates 'configure' and other files by +running the GNU build tools autoconf and automake, which in turn use +GNU m4 and Perl. If you want to use it, you will need to install +recent versions of these build tools. This should be needed only if +you edit files like `configure.ac' that specify Emacs's autobuild +procedure. The file `Makefile.in' is a template used by `configure' to create `Makefile'. diff --git a/admin/CPP-DEFINES b/admin/CPP-DEFINES index be73d1a9bf5..b40ba78e20d 100644 --- a/admin/CPP-DEFINES +++ b/admin/CPP-DEFINES @@ -107,7 +107,6 @@ EMACS_CONFIGURATION EMACS_CONFIG_OPTIONS EMACS_INT EMACS_UINT -FLOAT_CHECK_DOMAIN GC_MARK_SECONDARY_STACK GC_MARK_STACK GC_SETJMP_WORKS @@ -158,12 +157,10 @@ HAVE_ENDPWENT HAVE_ENVIRON_DECL HAVE_EUIDACCESS HAVE_FCNTL_H -HAVE_FMOD HAVE_FORK HAVE_FPATHCONF HAVE_FREEIFADDRS HAVE_FREETYPE -HAVE_FREXP HAVE_FSEEKO HAVE_FSYNC HAVE_FUTIMENS @@ -217,7 +214,6 @@ HAVE_IFADDRS_H HAVE_IMAGEMAGICK HAVE_INET_SOCKETS HAVE_INTTYPES_H -HAVE_INVERSE_HYPERBOLIC HAVE_JPEG HAVE_KERBEROSIV_DES_H HAVE_KERBEROSIV_KRB_H @@ -428,9 +424,7 @@ MAIL_USE_POP MAIL_USE_SYSTEM_LOCK MAXPATHLEN NLIST_STRUCT -NO_ABORT NO_EDITRES -NO_MATHERR NO_TERMIO NSIG NSIG_MINIMUM diff --git a/admin/ChangeLog b/admin/ChangeLog index 145028ec815..2c61f437981 100644 --- a/admin/ChangeLog +++ b/admin/ChangeLog @@ -1,3 +1,14 @@ +2012-09-09 Paul Eggert + + Assume C89 or later for math functions (Bug#12381). + * CPP-DEFINES (HAVE_FMOD, HAVE_FREXP, FLOAT_CHECK_DOMAIN) + (HAVE_INVERSE_HYPERBOLIC, NO_MATHERR): Remove. + +2012-09-04 Paul Eggert + + Simplify redefinition of 'abort' (Bug#12316). + * CPP-DEFINES (NO_ABORT): Remove. + 2012-08-28 Glenn Morris * bzrmerge.el (bzrmerge-merges): Allow unversioned files in the tree. diff --git a/autogen.sh b/autogen.sh index 9cfaa40eee5..dc8d53eec97 100755 --- a/autogen.sh +++ b/autogen.sh @@ -201,7 +201,7 @@ This is not recommended - see the comments in \`copy_autogen'. Please report any problems with this script to bug-gnu-emacs@gnu.org . EOF - exit 1 + exit 101 # Exit status 101 means tools were missing. fi echo "Your system has the required tools, running autoreconf..." diff --git a/autogen/config.in b/autogen/config.in index c39453938be..10969fd99c2 100644 --- a/autogen/config.in +++ b/autogen/config.in @@ -157,10 +157,6 @@ along with GNU Emacs. If not, see . */ */ #undef FIRST_PTY_LETTER -/* Define if the float library doesn't handle errors by either setting errno, - or signaling SIGFPE/SIGILL. */ -#undef FLOAT_CHECK_DOMAIN - /* Enable compile-time and run-time bounds-checking, and some warnings, without upsetting glibc 2.15+. */ #if defined __OPTIMIZE__ && __OPTIMIZE__ @@ -371,9 +367,6 @@ along with GNU Emacs. If not, see . */ /* Define to 1 if you have the header file. */ #undef HAVE_FCNTL_H -/* Define to 1 if you have the `fmod' function. */ -#undef HAVE_FMOD - /* Define to 1 if you have the `fork' function. */ #undef HAVE_FORK @@ -386,9 +379,6 @@ along with GNU Emacs. If not, see . */ /* Define to 1 if using the freetype and fontconfig libraries. */ #undef HAVE_FREETYPE -/* Define to 1 if you have the `frexp' function. */ -#undef HAVE_FREXP - /* Define to 1 if fseeko (and presumably ftello) exists and is declared. */ #undef HAVE_FSEEKO @@ -540,9 +530,6 @@ along with GNU Emacs. If not, see . */ /* Define to 1 if you have the header file. */ #undef HAVE_INTTYPES_H -/* Define if you have the functions acosh, asinh, and atanh. */ -#undef HAVE_INVERSE_HYPERBOLIC - /* Define to 1 if you have the jpeg library (-ljpeg). */ #undef HAVE_JPEG @@ -1179,15 +1166,9 @@ along with GNU Emacs. If not, see . */ `NO'. */ #undef NARROWPROTO -/* Do not define abort in emacs.c. */ -#undef NO_ABORT - /* Define if XEditRes should not be used. */ #undef NO_EDITRES -/* Define to 1 if you don't have struct exception in math.h. */ -#undef NO_MATHERR - /* Define to 1 if your C compiler doesn't accept -c and -o together. */ #undef NO_MINUS_C_MINUS_O @@ -1303,9 +1284,6 @@ along with GNU Emacs. If not, see . */ /* Make process_send_signal work by "typing" a signal character on the pty. */ #undef SIGNALS_VIA_CHARACTERS -/* Define if AH_BOTTOM should include signal.h. */ -#undef SIGNAL_H_AHB - /* Define to l, ll, u, ul, ull, etc., as suitable for constants of type 'sig_atomic_t'. */ #undef SIG_ATOMIC_T_SUFFIX @@ -1542,10 +1520,12 @@ along with GNU Emacs. If not, see . */ declarations. Define as empty for no equivalent. */ #undef __restrict_arr -/* Some platforms redefine this. */ +/* Define to longjmp if _setjmp and _longjmp do not work. Because longjmp may + alter signal masks, callers of _longjmp should not assume that it leaves + signal masks alone. */ #undef _longjmp -/* Some platforms redefine this. */ +/* Define to setjmp if _setjmp and _longjmp do not work. See _longjmp. */ #undef _setjmp /* Some platforms that do not use configure define this to include extra diff --git a/autogen/configure b/autogen/configure index c4ea39bf333..3621eee77c6 100755 --- a/autogen/configure +++ b/autogen/configure @@ -608,55 +608,6 @@ WINDOW_SYSTEM_OBJ LIB_GCC LD_FIRSTFLAG LD_SWITCH_SYSTEM_TEMACS -POST_ALLOC_OBJ -PRE_ALLOC_OBJ -CYGWIN_OBJ -RALLOC_OBJ -OLDXMENU_DEPS -LIBX_OTHER -LIBXMENU -OLDXMENU -OLDXMENU_TARGET -LIBXT_OTHER -TOOLKIT_LIBW -WIDGET_OBJ -XOBJ -XMENU_OBJ -FONT_OBJ -OTHER_FILES -GNU_OBJC_CFLAGS -ns_appsrc -ns_appresdir -ns_appbindir -ns_appdir -S_FILE -M_FILE -X_TOOLKIT_TYPE -C_SWITCH_X_SYSTEM -C_SWITCH_X_SITE -LD_SWITCH_X_SITE -gameuser -gamedir -bitmapdir -archlibdir -etcdir -x_default_search_path -lisppath -locallisppath -lispdir -srcdir -canonical -configuration -version -KRB4LIB -DESLIB -KRB5LIB -CRYPTOLIB -COM_ERRLIB -LIBRESOLV -LIBHESIOD -TERMCAP_OBJ -LIBS_TERMCAP LIBGNU_LTLIBDEPS LIBGNU_LIBDEPS gltests_WITNESS @@ -664,14 +615,19 @@ gl_GNULIB_ENABLED_verify_FALSE gl_GNULIB_ENABLED_verify_TRUE gl_GNULIB_ENABLED_strtoull_FALSE gl_GNULIB_ENABLED_strtoull_TRUE +gl_GNULIB_ENABLED_strtoll_FALSE +gl_GNULIB_ENABLED_strtoll_TRUE gl_GNULIB_ENABLED_stat_FALSE gl_GNULIB_ENABLED_stat_TRUE +gl_GNULIB_ENABLED_pathmax_FALSE +gl_GNULIB_ENABLED_pathmax_TRUE gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36_FALSE gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36_TRUE gl_GNULIB_ENABLED_dosname_FALSE gl_GNULIB_ENABLED_dosname_TRUE LTLIBINTL LIBINTL +WINDOWS_64_BIT_OFF_T HAVE_UNISTD_H NEXT_AS_FIRST_DIRECTIVE_UNISTD_H NEXT_UNISTD_H @@ -680,9 +636,6 @@ SYS_TIME_H_DEFINES_STRUCT_TIMESPEC TIME_H_DEFINES_STRUCT_TIMESPEC NEXT_AS_FIRST_DIRECTIVE_TIME_H NEXT_TIME_H -WINDOWS_64_BIT_OFF_T -NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H -NEXT_SYS_TYPES_H WINDOWS_64_BIT_ST_SIZE NEXT_AS_FIRST_DIRECTIVE_SYS_STAT_H NEXT_SYS_STAT_H @@ -719,11 +672,14 @@ REPLACE_FPURGE REPLACE_FPRINTF REPLACE_FOPEN REPLACE_FFLUSH +REPLACE_FDOPEN REPLACE_FCLOSE REPLACE_DPRINTF HAVE_VDPRINTF HAVE_VASPRINTF HAVE_RENAMEAT +HAVE_POPEN +HAVE_PCLOSE HAVE_FTELLO HAVE_FSEEKO HAVE_DPRINTF @@ -761,6 +717,7 @@ GNULIB_PRINTF_POSIX GNULIB_PRINTF GNULIB_POPEN GNULIB_PERROR +GNULIB_PCLOSE GNULIB_OBSTACK_PRINTF_POSIX GNULIB_OBSTACK_PRINTF GNULIB_GETLINE @@ -784,6 +741,7 @@ GNULIB_FOPEN GNULIB_FGETS GNULIB_FGETC GNULIB_FFLUSH +GNULIB_FDOPEN GNULIB_FCLOSE GNULIB_DPRINTF NEXT_AS_FIRST_DIRECTIVE_STDDEF_H @@ -824,6 +782,14 @@ GNULIB_SIGPROCMASK GNULIB_SIGNAL_H_SIGPIPE GNULIB_RAISE GNULIB_PTHREAD_SIGMASK +HAVE_SYS_SELECT_H +NEXT_AS_FIRST_DIRECTIVE_SYS_SELECT_H +NEXT_SYS_SELECT_H +REPLACE_SELECT +REPLACE_PSELECT +HAVE_PSELECT +GNULIB_SELECT +GNULIB_PSELECT REPLACE_TIMEGM REPLACE_NANOSLEEP REPLACE_MKTIME @@ -868,6 +834,7 @@ GNULIB_LSTAT GNULIB_LCHMOD GNULIB_FUTIMENS GNULIB_FSTATAT +GNULIB_FSTAT GNULIB_FCHMODAT NEXT_AS_FIRST_DIRECTIVE_INTTYPES_H NEXT_INTTYPES_H @@ -913,6 +880,15 @@ HAVE_INTTYPES_H HAVE_WCHAR_H HAVE_UNSIGNED_LONG_LONG_INT HAVE_LONG_LONG_INT +HAVE_WINSOCK2_H +NEXT_AS_FIRST_DIRECTIVE_SYS_TIME_H +NEXT_SYS_TIME_H +REPLACE_STRUCT_TIMEVAL +REPLACE_GETTIMEOFDAY +HAVE_SYS_TIME_H +HAVE_STRUCT_TIMEVAL +HAVE_GETTIMEOFDAY +GNULIB_GETTIMEOFDAY GNULIB_GL_UNISTD_H_GETOPT GETOPT_H HAVE_GETOPT_H @@ -1038,6 +1014,7 @@ HAVE_DECL_GETUSERSHELL HAVE_DECL_GETPAGESIZE HAVE_DECL_GETLOGIN_R HAVE_DECL_GETDOMAINNAME +HAVE_DECL_FDATASYNC HAVE_DECL_FCHDIR HAVE_DECL_ENVIRON HAVE_USLEEP @@ -1063,6 +1040,7 @@ HAVE_GETGROUPS HAVE_GETDTABLESIZE HAVE_FTRUNCATE HAVE_FSYNC +HAVE_FDATASYNC HAVE_FCHOWNAT HAVE_FCHDIR HAVE_FACCESSAT @@ -1106,6 +1084,7 @@ GNULIB_GETDOMAINNAME GNULIB_GETCWD GNULIB_FTRUNCATE GNULIB_FSYNC +GNULIB_FDATASYNC GNULIB_FCHOWNAT GNULIB_FCHDIR GNULIB_FACCESSAT @@ -1113,16 +1092,17 @@ GNULIB_EUIDACCESS GNULIB_ENVIRON GNULIB_DUP3 GNULIB_DUP2 +GNULIB_DUP GNULIB_CLOSE GNULIB_CHOWN +GNULIB_CHDIR +LIB_CLOCK_GETTIME GL_GENERATE_ALLOCA_H_FALSE GL_GENERATE_ALLOCA_H_TRUE ALLOCA_H ALLOCA GL_COND_LIBTOOL_FALSE GL_COND_LIBTOOL_TRUE -<<<<<<< TREE -======= POST_ALLOC_OBJ PRE_ALLOC_OBJ CYGWIN_OBJ @@ -1156,6 +1136,7 @@ etcdir x_default_search_path lisppath locallisppath +standardlisppath leimdir lispdir srcdir @@ -1171,7 +1152,6 @@ LIBRESOLV LIBHESIOD TERMCAP_OBJ LIBS_TERMCAP ->>>>>>> MERGE-SOURCE BLESSMAIL_TARGET LIBS_MAIL liblockfile @@ -1199,15 +1179,14 @@ LIBXTR6 LIBGNUTLS_LIBS LIBGNUTLS_CFLAGS LIBSELINUX_LIBS -<<<<<<< TREE -======= SETTINGS_LIBS SETTINGS_CFLAGS GOBJECT_LIBS GOBJECT_CFLAGS ->>>>>>> MERGE-SOURCE GCONF_LIBS GCONF_CFLAGS +GSETTINGS_LIBS +GSETTINGS_CFLAGS DBUS_OBJ DBUS_LIBS DBUS_CFLAGS @@ -1237,14 +1216,9 @@ ALSA_LIBS ALSA_CFLAGS LIBSOUND PKG_CONFIG -<<<<<<< TREE -LIBSOUND -======= CRT_DIR ->>>>>>> MERGE-SOURCE START_FILES LIB_MATH -CRT_DIR LIBS_SYSTEM C_SWITCH_SYSTEM UNEXEC_OBJ @@ -1293,6 +1267,7 @@ build_cpu build PROFILING_CFLAGS GZIP_INFO +cache_file am__untar am__tar AMTAR @@ -1389,6 +1364,7 @@ with_ns with_gpm with_dbus with_gconf +with_gsettings with_selinux with_gnutls with_makeinfo @@ -1398,7 +1374,6 @@ with_crt_dir with_gameuser with_gnustep_conf enable_ns_self_contained -enable_asserts enable_locallisppath enable_checking enable_check_lisp_object_type @@ -1407,6 +1382,7 @@ enable_autodepend enable_dependency_tracking enable_largefile enable_gcc_warnings +enable_link_time_optimization with_x ' ac_precious_vars='build_alias @@ -2044,13 +2020,6 @@ Optional Features: --enable-FEATURE[=ARG] include FEATURE [ARG=yes] --disable-ns-self-contained disable self contained build under NeXTstep - --enable-asserts compile code with asserts enabled -<<<<<<< TREE - --enable-maintainer-mode - enable make rules and dependencies not useful (and - sometimes confusing) to the casual installer -======= ->>>>>>> MERGE-SOURCE --enable-locallisppath=PATH directories Emacs should search for lisp files specific to this site @@ -2058,7 +2027,7 @@ Optional Features: enable expensive run-time checks. With LIST, enable only specific categories of checks. Categories are: all,yes,no. Flags are: stringbytes, stringoverrun, - stringfreelist, xmallocoverrun, conslist + stringfreelist, xmallocoverrun, conslist, glyphs --enable-check-lisp-object-type enable compile time checks for the Lisp_Object data type. This is useful for development for catching @@ -2071,7 +2040,12 @@ Optional Features: --disable-dependency-tracking speeds up one-time build --enable-dependency-tracking do not reject slow dependency extractors --disable-largefile omit support for large files - --enable-gcc-warnings turn on lots of GCC warnings (for developers) + --enable-gcc-warnings turn on lots of GCC warnings. This is intended for + developers, and may generate false alarms when used + with older or non-GNU development tools. + --enable-link-time-optimization + build emacs with link-time optimization. This is + supported only for GCC since 4.5.0. Optional Packages: --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] @@ -2111,6 +2085,7 @@ Optional Packages: console --without-dbus don't compile with D-Bus support --without-gconf don't compile with GConf support + --without-gsettings don't compile with GSettings support --without-selinux don't compile with SELinux support --without-gnutls don't use -lgnutls for SSL/TLS support --without-makeinfo don't require makeinfo for building manuals @@ -2689,68 +2664,6 @@ $as_echo "$ac_res" >&6; } } # ac_fn_c_check_func -<<<<<<< TREE -<<<<<<< TREE -======= -# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES -# ---------------------------------------------------- -# Tries to find if the field MEMBER exists in type AGGR, after including -# INCLUDES, setting cache variable VAR accordingly. -ac_fn_c_check_member () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5 -$as_echo_n "checking for $2.$3... " >&6; } -if { as_var=$4; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$5 -int -main () -{ -static $2 ac_aggr; -if (ac_aggr.$3) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$4=yes" -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$5 -int -main () -{ -static $2 ac_aggr; -if (sizeof ac_aggr.$3) -return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - eval "$4=yes" -else - eval "$4=no" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$4 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - -} # ac_fn_c_check_member - -======= ->>>>>>> MERGE-SOURCE # ac_fn_c_check_type LINENO TYPE VAR INCLUDES # ------------------------------------------- # Tests whether TYPE exists after having included INCLUDES, setting cache @@ -2805,7 +2718,6 @@ $as_echo "$ac_res" >&6; } } # ac_fn_c_check_type ->>>>>>> MERGE-SOURCE # ac_fn_c_compute_int LINENO EXPR VAR INCLUDES # -------------------------------------------- # Tries to find the compile-time value of EXPR in a program that includes @@ -2983,60 +2895,6 @@ rm -f conftest.val as_fn_set_status $ac_retval } # ac_fn_c_compute_int - -# ac_fn_c_check_type LINENO TYPE VAR INCLUDES -# ------------------------------------------- -# Tests whether TYPE exists after having included INCLUDES, setting cache -# variable VAR accordingly. -ac_fn_c_check_type () -{ - as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 -$as_echo_n "checking for $2... " >&6; } -if { as_var=$3; eval "test \"\${$as_var+set}\" = set"; }; then : - $as_echo_n "(cached) " >&6 -else - eval "$3=no" - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -if (sizeof ($2)) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$4 -int -main () -{ -if (sizeof (($2))) - return 0; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - -else - eval "$3=yes" -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -eval ac_res=\$$3 - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 -$as_echo "$ac_res" >&6; } - eval $as_lineno_stack; test "x$as_lineno_stack" = x && { as_lineno=; unset as_lineno;} - -} # ac_fn_c_check_type cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. @@ -3320,9 +3178,6 @@ $as_echo "$as_me: creating cache $cache_file" >&6;} >$cache_file fi -as_fn_append ac_header_list " sys/select.h" -as_fn_append ac_header_list " sys/time.h" -as_fn_append ac_header_list " utime.h" as_fn_append ac_header_list " linux/version.h" as_fn_append ac_header_list " sys/systeminfo.h" as_fn_append ac_header_list " stdio_ext.h" @@ -3343,81 +3198,35 @@ as_fn_append ac_header_list " sys/param.h" as_fn_append ac_header_list " pthread.h" as_fn_append ac_header_list " malloc/malloc.h" as_fn_append ac_header_list " maillock.h" -as_fn_append ac_func_list " gethostname" -as_fn_append ac_func_list " rename" -as_fn_append ac_func_list " closedir" -as_fn_append ac_func_list " mkdir" -as_fn_append ac_func_list " rmdir" -as_fn_append ac_func_list " getrusage" -as_fn_append ac_func_list " get_current_dir_name" -as_fn_append ac_func_list " random" -as_fn_append ac_func_list " lrand48" -as_fn_append ac_func_list " logb" -as_fn_append ac_func_list " frexp" -as_fn_append ac_func_list " fmod" -as_fn_append ac_func_list " rint" -as_fn_append ac_func_list " cbrt" -as_fn_append ac_func_list " setsid" -as_fn_append ac_func_list " strerror" -as_fn_append ac_func_list " fpathconf" -as_fn_append ac_func_list " select" -as_fn_append ac_func_list " euidaccess" -as_fn_append ac_func_list " getpagesize" -as_fn_append ac_func_list " setlocale" -as_fn_append ac_func_list " utimes" -as_fn_append ac_func_list " getrlimit" -as_fn_append ac_func_list " setrlimit" -as_fn_append ac_func_list " setpgid" -as_fn_append ac_func_list " getcwd" -as_fn_append ac_func_list " getwd" -as_fn_append ac_func_list " shutdown" -as_fn_append ac_func_list " getaddrinfo" -as_fn_append ac_func_list " __fpending" -as_fn_append ac_func_list " strsignal" -as_fn_append ac_func_list " setitimer" -as_fn_append ac_func_list " sendto" -as_fn_append ac_func_list " recvfrom" -as_fn_append ac_func_list " getsockname" -as_fn_append ac_func_list " getpeername" -as_fn_append ac_func_list " getifaddrs" -as_fn_append ac_func_list " freeifaddrs" -as_fn_append ac_func_list " gai_strerror" -as_fn_append ac_func_list " mkstemp" -as_fn_append ac_func_list " getline" -as_fn_append ac_func_list " getdelim" -as_fn_append ac_func_list " fsync" -as_fn_append ac_func_list " sync" -as_fn_append ac_func_list " difftime" -as_fn_append ac_func_list " posix_memalign" -as_fn_append ac_func_list " getpwent" -as_fn_append ac_func_list " endpwent" -as_fn_append ac_func_list " getgrent" -as_fn_append ac_func_list " endgrent" -as_fn_append ac_func_list " touchlock" -as_fn_append ac_func_list " cfmakeraw" -as_fn_append ac_func_list " cfsetspeed" -as_fn_append ac_func_list " copysign" -as_fn_append ac_func_list " __executable_start" as_fn_append ac_header_list " sys/un.h" -as_fn_append ac_func_list " grantpt" -as_fn_append ac_func_list " getpt" as_fn_append ac_func_list " tzset" -as_fn_append ac_func_list " snprintf" as_fn_append ac_func_list " readlinkat" as_fn_append ac_header_list " execinfo.h" gl_getopt_required=GNU as_fn_append ac_header_list " getopt.h" +as_fn_append ac_func_list " gettimeofday" +as_fn_append ac_func_list " nanotime" +as_fn_append ac_header_list " sys/time.h" as_fn_append ac_header_list " wchar.h" as_fn_append ac_header_list " stdint.h" as_fn_append ac_header_list " inttypes.h" as_fn_append ac_func_list " lstat" as_fn_append ac_func_list " alarm" +as_fn_append ac_header_list " sys/select.h" +as_fn_append ac_func_list " pselect" +as_fn_append ac_func_list " pthread_sigmask" as_fn_append ac_func_list " readlink" as_fn_append ac_func_list " strtoimax" as_fn_append ac_func_list " strtoumax" as_fn_append ac_func_list " symlink" as_fn_append ac_header_list " sys/stat.h" as_fn_append ac_func_list " localtime_r" +as_fn_append ac_header_list " utime.h" +as_fn_append ac_func_list " futimes" +as_fn_append ac_func_list " futimesat" +as_fn_append ac_func_list " futimens" +as_fn_append ac_func_list " utimensat" +as_fn_append ac_func_list " lutimes" # Check that the precious variables saved in the cache have kept the same # value. ac_cache_corrupted=false @@ -3996,9 +3805,10 @@ am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' lispdir='${datadir}/emacs/${version}/lisp' leimdir='${datadir}/emacs/${version}/leim' +standardlisppath='${lispdir}:${leimdir}' locallisppath='${datadir}/emacs/${version}/site-lisp:'\ '${datadir}/emacs/site-lisp' -lisppath='${locallisppath}:${lispdir}:${datadir}/emacs/${version}/leim' +lisppath='${locallisppath}:${standardlisppath}' etcdir='${datadir}/emacs/${version}/etc' archlibdir='${libexecdir}/emacs/${version}/${configuration}' docdir='${datadir}/emacs/${version}/etc' @@ -4320,8 +4130,6 @@ else fi -<<<<<<< TREE -======= # Check whether --with-gsettings was given. if test "${with_gsettings+set}" = set; then : withval=$with_gsettings; @@ -4330,7 +4138,6 @@ else fi ->>>>>>> MERGE-SOURCE # Check whether --with-selinux was given. if test "${with_selinux+set}" = set; then : withval=$with_selinux; @@ -4358,6 +4165,9 @@ else fi +## Makefile.in needs the cache file name. + + ## This is an option because I do not know if all info/man support ## compressed files, nor how to test if they do so. @@ -4425,14 +4235,6 @@ else fi -# Check whether --enable-asserts was given. -if test "${enable_asserts+set}" = set; then : - enableval=$enable_asserts; USE_XASSERTS=$enableval -else - USE_XASSERTS=no -fi - - # Check whether --enable-locallisppath was given. if test "${enable_locallisppath+set}" = set; then : enableval=$enable_locallisppath; if test "${enableval}" = "no"; then @@ -4459,19 +4261,22 @@ do ac_gc_check_string_overrun= ; ac_gc_check_string_free_list= ; ac_xmalloc_overrun= ; - ac_gc_check_cons_list= ;; + ac_gc_check_cons_list= ; + ac_glyphs_debug= ;; all) ac_enable_checking=1 ; ac_gc_check_stringbytes=1 ; ac_gc_check_string_overrun=1 ; ac_gc_check_string_free_list=1 ; ac_xmalloc_overrun=1 ; - ac_gc_check_cons_list=1 ;; + ac_gc_check_cons_list=1 ; + ac_glyphs_debug=1 ;; # these enable particular checks stringbytes) ac_gc_check_stringbytes=1 ;; stringoverrun) ac_gc_check_string_overrun=1 ;; stringfreelist) ac_gc_check_string_free_list=1 ;; xmallocoverrun) ac_xmalloc_overrun=1 ;; conslist) ac_gc_check_cons_list=1 ;; + glyphs) ac_glyphs_debug=1 ;; *) as_fn_error "unknown check category $check" "$LINENO" 5 ;; esac done @@ -4506,6 +4311,11 @@ if test x$ac_gc_check_cons_list != x ; then $as_echo "#define GC_CHECK_CONS_LIST 1" >>confdefs.h +fi +if test x$ac_glyphs_debug != x ; then + +$as_echo "#define GLYPH_DEBUG 1" >>confdefs.h + fi # Check whether --enable-check-lisp-object-type was given. @@ -4728,7 +4538,7 @@ case "${canonical}" in ## Silicon Graphics machines ## Iris 4D mips-sgi-irix6.5 ) - machine=iris4d opsys=irix6-5 + opsys=irix6-5 # Without defining _LANGUAGE_C, things get masked out in the headers # so that, for instance, grepping for `free' in stdlib.h fails and # AC_HEADER_STD_C fails. (MIPSPro 7.2.1.2m compilers, Irix 6.5.3m). @@ -7141,13 +6951,17 @@ esac # Code from module alloca-opt: # Code from module allocator: + # Code from module c-ctype: + # Code from module c-strcase: # Code from module careadlinkat: + # Code from module clock-time: # Code from module crypto/md5: # Code from module crypto/sha1: # Code from module crypto/sha256: # Code from module crypto/sha512: # Code from module dosname: # Code from module dtoastr: + # Code from module dtotimespec: # Code from module dup2: # Code from module environ: # Code from module execinfo: @@ -7159,6 +6973,8 @@ esac # Code from module getopt-gnu: # Code from module getopt-posix: # Code from module gettext-h: + # Code from module gettime: + # Code from module gettimeofday: # Code from module ignore-value: # Code from module include_next: # Code from module intprops: @@ -7169,25 +6985,20 @@ esac # Code from module manywarnings: # Code from module mktime: # Code from module multiarch: -<<<<<<< TREE -======= # Code from module nocrash: # Code from module pathmax: + # Code from module pselect: # Code from module pthread_sigmask: ->>>>>>> MERGE-SOURCE # Code from module readlink: -<<<<<<< TREE -======= - # Code from module signal: - # Code from module sigprocmask: + # Code from module signal-h: # Code from module snippet/_Noreturn: # Code from module snippet/arg-nonnull: # Code from module snippet/c++defs: # Code from module snippet/warn-on-use: ->>>>>>> MERGE-SOURCE # Code from module socklen: # Code from module ssize_t: # Code from module stat: + # Code from module stat-time: # Code from module stdalign: # Code from module stdarg: @@ -7199,15 +7010,22 @@ esac # Code from module stdio: # Code from module stdlib: # Code from module strftime: + # Code from module strtoimax: + # Code from module strtoll: # Code from module strtoull: # Code from module strtoumax: # Code from module symlink: + # Code from module sys_select: # Code from module sys_stat: - # Code from module sys_types: + # Code from module sys_time: # Code from module time: # Code from module time_r: + # Code from module timespec: + # Code from module timespec-add: + # Code from module timespec-sub: # Code from module u64: # Code from module unistd: + # Code from module utimens: # Code from module verify: # Code from module warnings: @@ -7274,6 +7092,49 @@ else fi +# Check whether --enable-link-time-optimization was given. +if test "${enable_link_time_optimization+set}" = set; then : + enableval=$enable_link_time_optimization; if test "${enableval}" != "no"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether link-time optimization is supported" >&5 +$as_echo_n "checking whether link-time optimization is supported... " >&6; } + ac_lto_supported=no + if test x$GCC = xyes; then + CPUS=`getconf _NPROCESSORS_ONLN 2>/dev/null` + if test x$CPUS != x; then + LTO="-flto=$CPUS" + else + LTO="-flto" + fi + old_CFLAGS=$CFLAGS + CFLAGS="$CFLAGS $LTO" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_lto_supported=yes +else + ac_lto_supported=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS="$old_CFLAGS" + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_lto_supported" >&5 +$as_echo "$ac_lto_supported" >&6; } + if test "$ac_lto_supported" = "yes"; then + CFLAGS="$CFLAGS $LTO" + fi +fi +fi + + # gl_GCC_VERSION_IFELSE([major], [minor], [run-if-found], [run-if-not-found]) # ------------------------------------------------ # If $CPP is gcc-MAJOR.MINOR or newer, then run RUN-IF-FOUND. @@ -7346,16 +7207,20 @@ fi nw="$nw -Wsign-conversion" # Too many warnings for now nw="$nw -Woverlength-strings" # Not a problem these days nw="$nw -Wtraditional-conversion" # Too many warnings for now + nw="$nw -Wunreachable-code" # so buggy that it's now silently ignored nw="$nw -Wpadded" # Our structs are not padded - nw="$nw -Wredundant-decls" # We regularly (re)declare getenv etc. + nw="$nw -Wredundant-decls" # we regularly (re)declare functions nw="$nw -Wlogical-op" # any use of fwrite provokes this - nw="$nw -Wformat-nonliteral" # Emacs does this a lot + nw="$nw -Wformat-nonliteral" # we do this a lot nw="$nw -Wvla" # warnings in gettext.h nw="$nw -Wnested-externs" # use of XARGMATCH/verify_function__ nw="$nw -Wswitch-enum" # Too many warnings for now nw="$nw -Wswitch-default" # Too many warnings for now - nw="$nw -Wfloat-equal" # e.g., ftoastr.c - nw="$nw -Winline" # e.g., dispnew.c's inlining of row_equal_p + nw="$nw -Wfloat-equal" # warns about high-quality code + nw="$nw -Winline" # OK to ignore 'inline' + nw="$nw -Wjump-misses-init" # We sometimes safely jump over init. + nw="$nw -Wsync-nand" # irrelevant here, and provokes ObjC warning + nw="$nw -Wunsafe-loop-optimizations" # OK to suppress unsafe optimizations # Emacs doesn't care about shadowing; see # . @@ -7364,7 +7229,6 @@ fi # The following lines should be removable at some point. nw="$nw -Wstack-protector" nw="$nw -Wstrict-overflow" - nw="$nw -Wsuggest-attribute=const" nw="$nw -Wsuggest-attribute=pure" @@ -8068,7 +7932,9 @@ $as_echo "no" >&6; } fi -# Extract the first word of "paxctl", so it can be a program name with args. + +if test $opsys = gnu-linux; then + # Extract the first word of "paxctl", so it can be a program name with args. set dummy paxctl; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 $as_echo_n "checking for $ac_word... " >&6; } @@ -8108,9 +7974,6 @@ $as_echo "no" >&6; } fi -<<<<<<< TREE - -======= if test "X$PAXCTL" != X; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether binaries have a PT_PAX_FLAGS header" >&5 $as_echo_n "checking whether binaries have a PT_PAX_FLAGS header... " >&6; } @@ -8135,7 +7998,6 @@ rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext fi fi ->>>>>>> MERGE-SOURCE ## Need makeinfo >= 4.7 (?) to build the manuals. # Extract the first word of "makeinfo", so it can be a program name with args. @@ -8414,75 +8276,7 @@ fi # Suppress obsolescent Autoconf test for size_t; Emacs assumes C89 or better. - - -## If user specified a crt-dir, use that unconditionally. -if test "X$CRT_DIR" = "X"; then - - case "$canonical" in - x86_64-*-linux-gnu* | s390x-*-linux-gnu*) - ## On x86-64 and s390x GNU/Linux distributions, the standard library - ## can be in a variety of places. We only try /usr/lib64 and /usr/lib. - ## For anything else (eg /usr/lib32), it is up the user to specify - ## the location (bug#5655). - ## Test for crtn.o, not just the directory, because sometimes the - ## directory exists but does not have the relevant files (bug#1287). - ## FIXME better to test for binary compatibility somehow. - test -e /usr/lib64/crtn.o && CRT_DIR=/usr/lib64 - ;; - - powerpc64-*-linux-gnu* | sparc64-*-linux-gnu*) CRT_DIR=/usr/lib64 ;; - esac - - case "$opsys" in - hpux10-20) CRT_DIR=/lib ;; - esac - - ## Default is /usr/lib. - test "X$CRT_DIR" = "X" && CRT_DIR=/usr/lib - - ## If we're using gcc, try to determine it automatically by asking - ## gcc. [If this doesn't work, CRT_DIR will remain at the - ## system-dependent default from above.] - if test "x${GCC}" = xyes; then - crt_file=`$CC --print-file-name=crt1.o 2>/dev/null` - case "$crt_file" in - */*) - CRT_DIR=`$as_dirname -- "$crt_file" || -$as_expr X"$crt_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ - X"$crt_file" : 'X\(//\)[^/]' \| \ - X"$crt_file" : 'X\(//\)$' \| \ - X"$crt_file" : 'X\(/\)' \| . 2>/dev/null || -$as_echo X"$crt_file" | - sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ - s//\1/ - q - } - /^X\(\/\/\)[^/].*/{ - s//\1/ - q - } - /^X\(\/\/\)$/{ - s//\1/ - q - } - /^X\(\/\).*/{ - s//\1/ - q - } - s/.*/./; q'` - ;; - esac - fi - -else - - ## Some platforms don't use any of these files, so it is not - ## appropriate to put this test outside the if block. - test -e $CRT_DIR/crtn.o || test -e $CRT_DIR/crt0.o || \ - as_fn_error "crt*.o not found in specified location." "$LINENO" 5 - -fi +# Likewise for obsolescent test for uid_t, gid_t; Emacs assumes them. @@ -8529,16 +8323,11 @@ esac -<<<<<<< TREE -<<<<<<< TREE -======= -======= cat >>confdefs.h <<_ACEOF #define SYSTEM_TYPE "$SYSTEM_TYPE" _ACEOF ->>>>>>> MERGE-SOURCE crt_files= for file in x $LIB_STANDARD $START_FILES; do @@ -8645,9 +8434,9 @@ case $opsys in esac -<<<<<<< TREE ->>>>>>> MERGE-SOURCE -======= +pre_PKG_CONFIG_CFLAGS=$CFLAGS +pre_PKG_CONFIG_LIBS=$LIBS + # Extract the first word of "pkg-config", so it can be a program name with args. set dummy pkg-config; ac_word=$2 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 @@ -8690,7 +8479,6 @@ fi ->>>>>>> MERGE-SOURCE @@ -8809,9 +8597,9 @@ $as_echo "no" >&6; } if test $HAVE_ALSA = yes; then SAVE_CFLAGS="$CFLAGS" - SAVE_LDFLAGS="$LDFLAGS" + SAVE_LIBS="$LIBS" CFLAGS="$ALSA_CFLAGS $CFLAGS" - LDFLAGS="$ALSA_LIBS $LDFLAGS" + LIBS="$ALSA_LIBS $LIBS" cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -8854,7 +8642,7 @@ rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext fi CFLAGS="$SAVE_CFLAGS" - LDFLAGS="$SAVE_LDFLAGS" + LIBS="$SAVE_LIBS" LIBSOUND="$LIBSOUND $ALSA_LIBS" CFLAGS_SOUND="$CFLAGS_SOUND $ALSA_CFLAGS" @@ -8914,12 +8702,6 @@ done - - - - - - @@ -9074,49 +8856,6 @@ $as_echo "#define HAVE_SYS_WAIT_H 1" >>confdefs.h fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct utimbuf" >&5 -$as_echo_n "checking for struct utimbuf... " >&6; } -if test "${emacs_cv_struct_utimbuf+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef TIME_WITH_SYS_TIME -#include -#include -#else -#ifdef HAVE_SYS_TIME_H -#include -#else -#include -#endif -#endif -#ifdef HAVE_UTIME_H -#include -#endif -int -main () -{ -static struct utimbuf x; x.actime = x.modtime; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - emacs_cv_struct_utimbuf=yes -else - emacs_cv_struct_utimbuf=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_struct_utimbuf" >&5 -$as_echo "$emacs_cv_struct_utimbuf" >&6; } -if test $emacs_cv_struct_utimbuf = yes; then - -$as_echo "#define HAVE_STRUCT_UTIMBUF 1" >>confdefs.h - -fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for speed_t" >&5 $as_echo_n "checking for speed_t... " >&6; } if test "${emacs_cv_speed_t+set}" = set; then : @@ -9148,99 +8887,9 @@ $as_echo "#define HAVE_SPEED_T 1" >>confdefs.h fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct timeval" >&5 -$as_echo_n "checking for struct timeval... " >&6; } -if test "${emacs_cv_struct_timeval+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#ifdef TIME_WITH_SYS_TIME -#include -#include -#else -#ifdef HAVE_SYS_TIME_H -#include -#else -#include -#endif -#endif -int -main () -{ -static struct timeval x; x.tv_sec = x.tv_usec; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - emacs_cv_struct_timeval=yes -else - emacs_cv_struct_timeval=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_struct_timeval" >&5 -$as_echo "$emacs_cv_struct_timeval" >&6; } -HAVE_TIMEVAL=$emacs_cv_struct_timeval -if test $emacs_cv_struct_timeval = yes; then - -$as_echo "#define HAVE_TIMEVAL 1" >>confdefs.h - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct exception" >&5 -$as_echo_n "checking for struct exception... " >&6; } -if test "${emacs_cv_struct_exception+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -static struct exception x; x.arg1 = x.arg2 = x.retval; x.name = ""; x.type = 1; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - emacs_cv_struct_exception=yes -else - emacs_cv_struct_exception=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_struct_exception" >&5 -$as_echo "$emacs_cv_struct_exception" >&6; } -HAVE_EXCEPTION=$emacs_cv_struct_exception -if test $emacs_cv_struct_exception != yes; then - -$as_echo "#define NO_MATHERR 1" >>confdefs.h - -fi - -<<<<<<< TREE -<<<<<<< TREE -======= -for ac_header in sys/socket.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "sys/socket.h" "ac_cv_header_sys_socket_h" "$ac_includes_default" -if test "x$ac_cv_header_sys_socket_h" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_SYS_SOCKET_H 1 -_ACEOF - -fi - -done -======= ->>>>>>> MERGE-SOURCE ->>>>>>> MERGE-SOURCE for ac_header in net/if.h do : ac_fn_c_check_header_compile "$LINENO" "net/if.h" "ac_cv_header_net_if_h" "$ac_includes_default @@ -9257,8 +8906,6 @@ fi done -<<<<<<< TREE -======= for ac_header in ifaddrs.h do : ac_fn_c_check_header_compile "$LINENO" "ifaddrs.h" "ac_cv_header_ifaddrs_h" "$ac_includes_default @@ -9291,23 +8938,6 @@ fi done -<<<<<<< TREE -for ac_func in getifaddrs freeifaddrs -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -eval as_val=\$$as_ac_var - if test "x$as_val" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - ->>>>>>> MERGE-SOURCE -======= ->>>>>>> MERGE-SOURCE ac_fn_c_check_member "$LINENO" "struct ifreq" "ifr_flags" "ac_cv_member_struct_ifreq_ifr_flags" "$ac_includes_default #if HAVE_SYS_SOCKET_H @@ -9389,8 +9019,6 @@ _ACEOF fi -<<<<<<< TREE -======= ac_fn_c_check_member "$LINENO" "struct ifreq" "ifr_addr.sa_len" "ac_cv_member_struct_ifreq_ifr_addr_sa_len" "$ac_includes_default #if HAVE_SYS_SOCKET_H #include @@ -9407,7 +9035,6 @@ _ACEOF fi ->>>>>>> MERGE-SOURCE @@ -10084,7 +9711,7 @@ $as_echo "#define DOUG_LEA_MALLOC 1" >>confdefs.h ## Use mmap directly for allocating larger buffers. ## FIXME this comes from src/s/{gnu,gnu-linux}.h: ## #ifdef DOUG_LEA_MALLOC; #undef REL_ALLOC; #endif - ## Does the AC_FUNC_MMAP test below make this check unecessary? + ## Does the AC_FUNC_MMAP test below make this check unnecessary? case "$opsys" in gnu*) REL_ALLOC=no ;; esac @@ -10378,9 +10005,15 @@ LIB_PTHREAD= if test "$ac_cv_header_pthread_h"; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for pthread_self in -lpthread" >&5 -$as_echo_n "checking for pthread_self in -lpthread... " >&6; } -if test "${ac_cv_lib_pthread_pthread_self+set}" = set; then : + if test "$GMALLOC_OBJ" = gmalloc.o; then + emacs_pthread_function=pthread_atfork + else + emacs_pthread_function=pthread_self + fi + as_ac_Lib=`$as_echo "ac_cv_lib_pthread_$emacs_pthread_function" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $emacs_pthread_function in -lpthread" >&5 +$as_echo_n "checking for $emacs_pthread_function in -lpthread... " >&6; } +if { as_var=$as_ac_Lib; eval "test \"\${$as_var+set}\" = set"; }; then : $as_echo_n "(cached) " >&6 else ac_check_lib_save_LIBS=$LIBS @@ -10394,27 +10027,29 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext #ifdef __cplusplus extern "C" #endif -char pthread_self (); +char $emacs_pthread_function (); int main () { -return pthread_self (); +return $emacs_pthread_function (); ; return 0; } _ACEOF if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_pthread_pthread_self=yes + eval "$as_ac_Lib=yes" else - ac_cv_lib_pthread_pthread_self=no + eval "$as_ac_Lib=no" fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext LIBS=$ac_check_lib_save_LIBS fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_pthread_pthread_self" >&5 -$as_echo "$ac_cv_lib_pthread_pthread_self" >&6; } -if test "x$ac_cv_lib_pthread_pthread_self" = x""yes; then : +eval ac_res=\$$as_ac_Lib + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +eval as_val=\$$as_ac_Lib + if test "x$as_val" = x""yes; then : HAVE_PTHREAD=yes fi @@ -11186,8 +10821,6 @@ done fi -<<<<<<< TREE -======= HAVE_GSETTINGS=no if test "${HAVE_X11}" = "yes" && test "${with_gsettings}" = "yes"; then @@ -11249,7 +10882,6 @@ $as_echo "#define HAVE_GSETTINGS 1" >>confdefs.h fi fi ->>>>>>> MERGE-SOURCE HAVE_GCONF=no if test "${HAVE_X11}" = "yes" && test "${with_gconf}" = "yes"; then @@ -11306,9 +10938,6 @@ $as_echo "no" >&6; } $as_echo "#define HAVE_GCONF 1" >>confdefs.h -<<<<<<< TREE - for ac_func in g_type_init -======= SETTINGS_CFLAGS="$SETTINGS_CFLAGS $GCONF_CFLAGS" SETTINGS_LIBS="$SETTINGS_LIBS $GCONF_LIBS" fi @@ -11374,7 +11003,6 @@ $as_echo "no" >&6; } CFLAGS="$SETTINGS_CFLAGS $CFLAGS" LIBS="$SETTINGS_LIBS $LIBS" for ac_func in g_type_init ->>>>>>> MERGE-SOURCE do : ac_fn_c_check_func "$LINENO" "g_type_init" "ac_cv_func_g_type_init" if test "x$ac_cv_func_g_type_init" = x""yes; then : @@ -11385,9 +11013,13 @@ _ACEOF fi done - fi + CFLAGS="$SAVE_CFLAGS" + LIBS="$SAVE_LIBS" fi + + + HAVE_LIBSELINUX=no LIBSELINUX_LIBS= if test "${with_selinux}" = "yes"; then @@ -11757,7 +11389,7 @@ _ACEOF fi test $ac_cv_lib_Xmu_XmuConvertStandardSelection = no && LIBS="$OLDLIBS" -fi + fi LIBXMU=-lXmu @@ -12724,7 +12356,7 @@ eval as_val=\$$as_ac_Header cat >>confdefs.h <<_ACEOF #define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 _ACEOF - + break fi done @@ -12778,6 +12410,22 @@ fi $as_echo "#define HAVE_PNG 1" >>confdefs.h LIBPNG="-lpng -lz -lm" + + ac_fn_c_check_decl "$LINENO" "png_longjmp" "ac_cv_have_decl_png_longjmp" "#ifdef HAVE_LIBPNG_PNG_H + # include + #else + # include + #endif + +" +if test "x$ac_cv_have_decl_png_longjmp" = x""yes; then : + +else + +$as_echo "#define PNG_DEPSTRUCT /**/" >>confdefs.h + +fi + fi fi @@ -13135,6 +12783,7 @@ fi ### Use libxml (-lxml2) if available +HAVE_LIBXML2=no if test "${with_xml2}" != "no"; then ### I'm not sure what the version number should be, so I just guessed. @@ -13526,138 +13175,9 @@ esac -<<<<<<< TREE - - - - for ac_func in $ac_func_list -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -eval as_val=\$$as_ac_var - if test "x$as_val" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -======= for ac_func in gethostname \ closedir getrusage get_current_dir_name \ -lrand48 logb frexp fmod cbrt setsid \ +lrand48 logb cbrt setsid \ fpathconf select euidaccess getpagesize setlocale \ utimes getrlimit setrlimit setpgid getcwd shutdown getaddrinfo \ __fpending strsignal setitimer \ @@ -13720,7 +13240,6 @@ fi done ;; esac ->>>>>>> MERGE-SOURCE { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __builtin_unwind_init" >&5 $as_echo_n "checking for __builtin_unwind_init... " >&6; } @@ -13861,19 +13380,20 @@ $as_echo "#define GETPGRP_VOID 1" >>confdefs.h fi -<<<<<<< TREE -# Configure gnulib. -======= # UNIX98 PTYs. +for ac_func in grantpt +do : + ac_fn_c_check_func "$LINENO" "grantpt" "ac_cv_func_grantpt" +if test "x$ac_cv_func_grantpt" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_GRANTPT 1 +_ACEOF - +fi +done # PTY-related GNU extensions. -<<<<<<< TREE - - -======= for ac_func in getpt posix_openpt do : as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` @@ -13886,7 +13406,6 @@ _ACEOF fi done ->>>>>>> MERGE-SOURCE # Check this now, so that we will NOT find the above functions in ncurses. @@ -14059,32 +13578,12 @@ fi # Do we have res_init, for detecting changes in /etc/resolv.conf? +# On Darwin, res_init appears not to be useful: see bug#562 and +# http://lists.gnu.org/archive/html/emacs-devel/2007-11/msg01467.html resolv=no -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -int -main () -{ -return res_init(); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - have_res_init=yes -else - have_res_init=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test "$have_res_init" = no; then - OLIBS="$LIBS" - LIBS="$LIBS -lresolv" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for res_init with -lresolv" >&5 -$as_echo_n "checking for res_init with -lresolv... " >&6; } + +if test $opsys != darwin; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ #include @@ -14105,20 +13604,45 @@ else fi rm -f core conftest.err conftest.$ac_objext \ conftest$ac_exeext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_res_init" >&5 -$as_echo "$have_res_init" >&6; } - if test "$have_res_init" = yes ; then - resolv=yes - fi - LIBS="$OLIBS" + if test "$have_res_init" = no; then + OLIBS="$LIBS" + LIBS="$LIBS -lresolv" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for res_init with -lresolv" >&5 +$as_echo_n "checking for res_init with -lresolv... " >&6; } + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +int +main () +{ +return res_init(); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + have_res_init=yes +else + have_res_init=no fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_res_init" >&5 +$as_echo "$have_res_init" >&6; } + if test "$have_res_init" = yes ; then + resolv=yes + fi + LIBS="$OLIBS" + fi -if test "$have_res_init" = yes; then + if test "$have_res_init" = yes; then $as_echo "#define HAVE_RES_INIT 1" >>confdefs.h + fi fi - # Do we need the Hesiod library to provide the support routines? LIBHESIOD= if test "$with_hesiod" != no ; then @@ -14280,7 +13804,7 @@ fi # Do we need libresolv (due to res_init or Hesiod)? -if test "$resolv" = yes ; then +if test "$resolv" = yes && test $opsys != darwin; then $as_echo "#define HAVE_LIBRESOLV 1" >>confdefs.h @@ -14829,6 +14353,22 @@ fi + for ac_func in $ac_func_list +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +eval as_val=\$$as_ac_var + if test "x$as_val" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether localtime caches TZ" >&5 $as_echo_n "checking whether localtime caches TZ... " >&6; } if test "${emacs_cv_localtime_cache+set}" = set; then : @@ -14886,63 +14426,6 @@ $as_echo "#define LOCALTIME_CACHE 1" >>confdefs.h fi -if test "x$HAVE_TIMEVAL" = xyes; then - for ac_func in gettimeofday -do : - ac_fn_c_check_func "$LINENO" "gettimeofday" "ac_cv_func_gettimeofday" -if test "x$ac_cv_func_gettimeofday" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_GETTIMEOFDAY 1 -_ACEOF - -fi -done - - if test $ac_cv_func_gettimeofday = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gettimeofday can accept two arguments" >&5 -$as_echo_n "checking whether gettimeofday can accept two arguments... " >&6; } -if test "${emacs_cv_gettimeofday_two_arguments+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#ifdef TIME_WITH_SYS_TIME -#include -#include -#else -#ifdef HAVE_SYS_TIME_H -#include -#else -#include -#endif -#endif -int -main () -{ -struct timeval time; - gettimeofday (&time, 0); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - emacs_cv_gettimeofday_two_arguments=yes -else - emacs_cv_gettimeofday_two_arguments=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_gettimeofday_two_arguments" >&5 -$as_echo "$emacs_cv_gettimeofday_two_arguments" >&6; } - if test $emacs_cv_gettimeofday_two_arguments = no; then - -$as_echo "#define GETTIMEOFDAY_ONE_ARGUMENT 1" >>confdefs.h - - fi - fi -fi - ok_so_far=yes ac_fn_c_check_func "$LINENO" "socket" "ac_cv_func_socket" if test "x$ac_cv_func_socket" = x""yes; then : @@ -15222,8 +14705,16 @@ $as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h fi +for ac_func in snprintf +do : + ac_fn_c_check_func "$LINENO" "snprintf" "ac_cv_func_snprintf" +if test "x$ac_cv_func_snprintf" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SNPRINTF 1 +_ACEOF - +fi +done { $as_echo "$as_me:${as_lineno-$LINENO}: checking for nl_langinfo and CODESET" >&5 @@ -15327,8 +14818,6 @@ $as_echo "#define __restrict_arr __restrict" >>confdefs.h fi -<<<<<<< TREE -======= $as_echo "#define AMPERSAND_FULL_NAME 1" >>confdefs.h @@ -15337,10 +14826,6 @@ $as_echo "#define AMPERSAND_FULL_NAME 1" >>confdefs.h $as_echo "#define CLASH_DETECTION 1" >>confdefs.h - - - - ## Note: PTYs are broken on darwin <6. Use at your own risk. $as_echo "#define HAVE_PTYS 1" >>confdefs.h @@ -15405,21 +14890,52 @@ case $opsys in esac ->>>>>>> MERGE-SOURCE case $opsys in darwin | gnu | hpux* | *bsd ) $as_echo "#define NO_TERMIO 1" >>confdefs.h - ;; + ;; + + irix6-5 | sol2* | unixware ) + +$as_echo "#define NSIG_MINIMUM 32" >>confdefs.h + + ;; esac + case $opsys in - hpux* | irix6-5 | openbsd | sol2* | unixware ) + hpux* | irix6-5 | openbsd | sol2* | unixware ) $as_echo "#define BROKEN_SIGIO 1" >>confdefs.h - ;; + ;; + + aix4-2) + +$as_echo "#define BROKEN_FIONREAD 1" >>confdefs.h + + +$as_echo "#define BROKEN_SIGAIO 1" >>confdefs.h + + +$as_echo "#define BROKEN_SIGPOLL 1" >>confdefs.h + + +$as_echo "#define BROKEN_SIGPTY 1" >>confdefs.h + + + +$as_echo "#define BROKEN_GET_CURRENT_DIR_NAME 1" >>confdefs.h + + ;; + + freebsd) + +$as_echo "#define BROKEN_PTY_READ_AFTER_EAGAIN 1" >>confdefs.h + + ;; esac case $opsys in @@ -15431,11 +14947,6 @@ $as_echo "#define HAVE_PROCFS 1" >>confdefs.h esac case $opsys in -<<<<<<< TREE - gnu-kfreebsd) opsysfile="s/gnu-linux.h" ;; - - hpux11) -======= darwin | freebsd | netbsd | openbsd ) $as_echo "#define DONT_REOPEN_PTY 1" >>confdefs.h @@ -15492,7 +15003,7 @@ case $opsys in cygwin ) $as_echo "#define PTY_ITERATION int i; for (i = 0; i < 1; i++)" >>confdefs.h - $as_echo "#define PTY_OPEN do { int dummy; SIGMASKTYPE mask; mask = sigblock (sigmask (SIGCHLD)); if (-1 == openpty (&fd, &dummy, pty_name, 0, 0)) fd = -1; sigsetmask (mask); if (fd >= 0) emacs_close (dummy); } while (0)" >>confdefs.h + $as_echo "#define PTY_OPEN do { int dummy; sigset_t blocked, procmask; sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); pthread_sigmask (SIG_BLOCK, &blocked, &procmask); if (-1 == openpty (&fd, &dummy, pty_name, 0, 0)) fd = -1; pthread_sigmask (SIG_SETMASK, &procmask, 0); if (fd >= 0) emacs_close (dummy); } while (0)" >>confdefs.h $as_echo "#define PTY_NAME_SPRINTF /**/" >>confdefs.h @@ -15525,7 +15036,7 @@ $as_echo "#define UNIX98_PTYS 1" >>confdefs.h $as_echo "#define PTY_ITERATION int i; for (i = 0; i < 1; i++)" >>confdefs.h - $as_echo "#define PTY_TTY_NAME_SPRINTF { char *ptyname; sigblock (sigmask (SIGCHLD)); if (grantpt (fd) == -1 || unlockpt (fd) == -1 || !(ptyname = ptsname(fd))) { sigunblock (sigmask (SIGCHLD)); close (fd); return -1; } snprintf (pty_name, sizeof pty_name, \"%s\", ptyname); sigunblock (sigmask (SIGCHLD)); }" >>confdefs.h + $as_echo "#define PTY_TTY_NAME_SPRINTF { char *ptyname = 0; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); if (grantpt (fd) != -1 && unlockpt (fd) != -1) ptyname = ptsname(fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); if (!ptyname) { close (fd); return -1; } snprintf (pty_name, sizeof pty_name, \"%s\", ptyname); }" >>confdefs.h if test "x$ac_cv_func_posix_openpt" = xyes; then $as_echo "#define PTY_OPEN fd = posix_openpt (O_RDWR | O_NOCTTY)" >>confdefs.h @@ -15570,12 +15081,12 @@ $as_echo "#define UNIX98_PTYS 1" >>confdefs.h ;; sol2* ) - $as_echo "#define PTY_TTY_NAME_SPRINTF { char *ptsname (int), *ptyname; sigblock (sigmask (SIGCLD)); if (grantpt (fd) == -1) { emacs_close (fd); return -1; } sigunblock (sigmask (SIGCLD)); if (unlockpt (fd) == -1) { emacs_close (fd); return -1; } if (!(ptyname = ptsname (fd))) { emacs_close (fd); return -1; } snprintf (pty_name, sizeof pty_name, \"%s\", ptyname); }" >>confdefs.h + $as_echo "#define PTY_TTY_NAME_SPRINTF { char *ptsname (int), *ptyname; int grantpt_result; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); grantpt_result = grantpt (fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); if (grantpt_result == -1 || unlockpt (fd) == -1 || !(ptyname = ptsname (fd))) { emacs_close (fd); return -1; } snprintf (pty_name, sizeof pty_name, \"%s\", ptyname); }" >>confdefs.h ;; unixware ) - $as_echo "#define PTY_TTY_NAME_SPRINTF { char *ptsname (int), *ptyname; sigblock(sigmask(SIGCLD)); if (grantpt(fd) == -1) fatal(\"could not grant slave pty\"); sigunblock(sigmask(SIGCLD)); if (unlockpt(fd) == -1) fatal(\"could not unlock slave pty\"); if (!(ptyname = ptsname(fd))) fatal (\"could not enable slave pty\"); snprintf (pty_name, sizeof pty_name, \"%s\", ptyname); }" >>confdefs.h + $as_echo "#define PTY_TTY_NAME_SPRINTF { char *ptsname (int), *ptyname; int grantpt_result; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); grantpt_result = grantpt (fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); if (grantpt_result == -1) fatal(\"could not grant slave pty\"); if (unlockpt(fd) == -1) fatal(\"could not unlock slave pty\"); if (!(ptyname = ptsname(fd))) fatal (\"could not enable slave pty\"); snprintf (pty_name, sizeof pty_name, \"%s\", ptyname); }" >>confdefs.h ;; esac @@ -15928,15 +15439,46 @@ else ;; esac fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _setjmp" >&5 +$as_echo_n "checking for _setjmp... " >&6; } +if test "${emacs_cv_func__setjmp+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include -case $opsys in - sol2* | unixware ) +int +main () +{ +jmp_buf j; + if (! _setjmp (j)) + _longjmp (j, 1); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + emacs_cv_func__setjmp=yes +else + emacs_cv_func__setjmp=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_func__setjmp" >&5 +$as_echo "$emacs_cv_func__setjmp" >&6; } +if test $emacs_cv_func__setjmp = no; then $as_echo "#define _setjmp setjmp" >>confdefs.h $as_echo "#define _longjmp longjmp" >>confdefs.h +fi + +case $opsys in + sol2* | unixware ) $as_echo "#define TIOCSIGSEND TIOCSIGNAL" >>confdefs.h @@ -15950,12 +15492,6 @@ case $opsys in $as_echo "#define XOS_NEEDS_TIME_H 1" >>confdefs.h ;; - - netbsd | openbsd ) - -$as_echo "#define SIGNAL_H_AHB 1" >>confdefs.h - - ;; esac @@ -16110,22 +15646,12 @@ $as_echo "#define G_SLICE_ALWAYS_MALLOC 1" >>confdefs.h ;; hpux11) ->>>>>>> MERGE-SOURCE $as_echo "#define BROKEN_SA_RESTART 1" >>confdefs.h $as_echo "#define USG_SUBTTY_WORKS 1" >>confdefs.h -<<<<<<< TREE - - opsysfile="s/hpux10-20.h" - ;; - - openbsd) opsysfile="s/netbsd.h" ;; - - sol2-10) -======= ;; irix6-5) @@ -16138,16 +15664,10 @@ $as_echo "#define SETPGRP_RELEASES_CTTY 1" >>confdefs.h ;; sol2-10) ->>>>>>> MERGE-SOURCE $as_echo "#define _STRUCTURED_PROC 1" >>confdefs.h -<<<<<<< TREE - opsysfile="s/sol2-6.h" - ;; -======= ;; ->>>>>>> MERGE-SOURCE esac # Set up the CFLAGS for real compilation, so we can substitute it. @@ -16188,6 +15708,7 @@ version=$PACKAGE_VERSION + ## FIXME? Nothing uses @LD_SWITCH_X_SITE@. @@ -16381,8 +15902,18 @@ fi -# Configure gnulib here, now that we know LIBS. ->>>>>>> MERGE-SOURCE +# Configure gnulib. Although this does not affect CFLAGS or LIBS permanently. +# it temporarily reverts them to their pre-pkg-config values, +# because gnulib needs to work with both src (which uses the +# pkg-config stuff) and lib-src (which does not). For example, gnulib +# may need to determine whether LIB_CLOCK_GETTIME should contain -lrt, +# and it therefore needs to run in an environment where LIBS does not +# already contain -lrt merely because 'pkg-config --libs' printed '-lrt' +# for some package unrelated to lib-src. +SAVE_CFLAGS=$CFLAGS +SAVE_LIBS=$LIBS +CFLAGS=$pre_PKG_CONFIG_CFLAGS +LIBS="$LIB_PTHREAD $pre_PKG_CONFIG_LIBS" @@ -16903,8 +16434,10 @@ $as_echo "#define HAVE_C99_STRTOLD 1" >>confdefs.h fi + GNULIB_CHDIR=0; GNULIB_CHOWN=0; GNULIB_CLOSE=0; + GNULIB_DUP=0; GNULIB_DUP2=0; GNULIB_DUP3=0; GNULIB_ENVIRON=0; @@ -16912,6 +16445,7 @@ $as_echo "#define HAVE_C99_STRTOLD 1" >>confdefs.h GNULIB_FACCESSAT=0; GNULIB_FCHDIR=0; GNULIB_FCHOWNAT=0; + GNULIB_FDATASYNC=0; GNULIB_FSYNC=0; GNULIB_FTRUNCATE=0; GNULIB_GETCWD=0; @@ -16955,6 +16489,7 @@ $as_echo "#define HAVE_C99_STRTOLD 1" >>confdefs.h HAVE_FACCESSAT=1; HAVE_FCHDIR=1; HAVE_FCHOWNAT=1; + HAVE_FDATASYNC=1; HAVE_FSYNC=1; HAVE_FTRUNCATE=1; HAVE_GETDTABLESIZE=1; @@ -16980,6 +16515,7 @@ $as_echo "#define HAVE_C99_STRTOLD 1" >>confdefs.h HAVE_USLEEP=1; HAVE_DECL_ENVIRON=1; HAVE_DECL_FCHDIR=1; + HAVE_DECL_FDATASYNC=1; HAVE_DECL_GETDOMAINNAME=1; HAVE_DECL_GETLOGIN_R=1; HAVE_DECL_GETPAGESIZE=1; @@ -17359,17 +16895,11 @@ _ACEOF esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' -<<<<<<< TREE - gl_absolute_header_sed='\#'"${gl_dirsep_regex}"'getopt.h#{ - s#.*"\(.*'"${gl_dirsep_regex}"'getopt.h\)".*#\1# - s#^/[^/]#//&# -======= gl_header_literal_regex=`echo 'getopt.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| ->>>>>>> MERGE-SOURCE p q }' @@ -17440,56 +16970,19 @@ done fi - if test -z "$gl_replace_getopt"; then + if test -z "$gl_replace_getopt"; then { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether getopt is POSIX compatible" >&5 $as_echo_n "checking whether getopt is POSIX compatible... " >&6; } if test "${gl_cv_func_getopt_posix+set}" = set; then : $as_echo_n "(cached) " >&6 else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -int *p = &optreset; return optreset; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_optind_min=1 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -return !getopt_clip; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - gl_optind_min=1 -else - gl_optind_min=0 -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - - gl_save_CPPFLAGS=$CPPFLAGS - CPPFLAGS="$CPPFLAGS -DOPTIND_MIN=$gl_optind_min" - if test "$cross_compiling" = yes; then : - case "$host_os" in - mingw*) gl_cv_func_getopt_posix="guessing no";; - darwin* | aix*) gl_cv_func_getopt_posix="guessing no";; - *) gl_cv_func_getopt_posix="guessing yes";; - esac - + if test $cross_compiling = no; then + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error "cannot run test program while cross compiling +See \`config.log' for more details." "$LINENO" 5; } else cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -17501,80 +16994,122 @@ else int main () { - { - int argc = 0; - char *argv[10]; - int c; + static char program[] = "program"; + static char a[] = "-a"; + static char foo[] = "foo"; + static char bar[] = "bar"; + char *argv[] = { program, a, foo, bar, NULL }; + int c; - argv[argc++] = "program"; - argv[argc++] = "-a"; - argv[argc++] = "foo"; - argv[argc++] = "bar"; - argv[argc] = NULL; - optind = OPTIND_MIN; - opterr = 0; + c = getopt (4, argv, "ab"); + if (!(c == 'a')) + return 1; + c = getopt (4, argv, "ab"); + if (!(c == -1)) + return 2; + if (!(optind == 2)) + return 3; + return 0; +} - c = getopt (argc, argv, "ab"); - if (!(c == 'a')) - return 1; - c = getopt (argc, argv, "ab"); - if (!(c == -1)) - return 2; - if (!(optind == 2)) - return 3; - } - /* Some internal state exists at this point. */ - { - int argc = 0; - char *argv[10]; - int c; +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + gl_cv_func_getopt_posix=maybe +else + gl_cv_func_getopt_posix=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi - argv[argc++] = "program"; - argv[argc++] = "donald"; - argv[argc++] = "-p"; - argv[argc++] = "billy"; - argv[argc++] = "duck"; - argv[argc++] = "-a"; - argv[argc++] = "bar"; - argv[argc] = NULL; - optind = OPTIND_MIN; - opterr = 0; + if test $gl_cv_func_getopt_posix = maybe; then + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error "cannot run test program while cross compiling +See \`config.log' for more details." "$LINENO" 5; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ - c = getopt (argc, argv, "+abp:q:"); - if (!(c == -1)) - return 4; - if (!(strcmp (argv[0], "program") == 0)) - return 5; - if (!(strcmp (argv[1], "donald") == 0)) - return 6; - if (!(strcmp (argv[2], "-p") == 0)) - return 7; - if (!(strcmp (argv[3], "billy") == 0)) - return 8; - if (!(strcmp (argv[4], "duck") == 0)) - return 9; - if (!(strcmp (argv[5], "-a") == 0)) - return 10; - if (!(strcmp (argv[6], "bar") == 0)) - return 11; - if (!(optind == 1)) - return 12; - } - /* Detect MacOS 10.5, AIX 7.1 bug. */ - { - char *argv[3] = { "program", "-ab", NULL }; - optind = OPTIND_MIN; - opterr = 0; - if (getopt (2, argv, "ab:") != 'a') - return 13; - if (getopt (2, argv, "ab:") != '?') - return 14; - if (optopt != 'b') - return 15; - if (optind != 2) - return 16; - } +#include +#include +#include +int +main () +{ + static char program[] = "program"; + static char donald[] = "donald"; + static char p[] = "-p"; + static char billy[] = "billy"; + static char duck[] = "duck"; + static char a[] = "-a"; + static char bar[] = "bar"; + char *argv[] = { program, donald, p, billy, duck, a, bar, NULL }; + int c; + + c = getopt (7, argv, "+abp:q:"); + if (!(c == -1)) + return 4; + if (!(strcmp (argv[0], "program") == 0)) + return 5; + if (!(strcmp (argv[1], "donald") == 0)) + return 6; + if (!(strcmp (argv[2], "-p") == 0)) + return 7; + if (!(strcmp (argv[3], "billy") == 0)) + return 8; + if (!(strcmp (argv[4], "duck") == 0)) + return 9; + if (!(strcmp (argv[5], "-a") == 0)) + return 10; + if (!(strcmp (argv[6], "bar") == 0)) + return 11; + if (!(optind == 1)) + return 12; + return 0; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + gl_cv_func_getopt_posix=maybe +else + gl_cv_func_getopt_posix=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi + if test $gl_cv_func_getopt_posix = maybe; then + if test "$cross_compiling" = yes; then : + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error "cannot run test program while cross compiling +See \`config.log' for more details." "$LINENO" 5; } +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +#include + +int +main () +{ + static char program[] = "program"; + static char ab[] = "-ab"; + char *argv[3] = { program, ab, NULL }; + if (getopt (2, argv, "ab:") != 'a') + return 13; + if (getopt (2, argv, "ab:") != '?') + return 14; + if (optopt != 'b') + return 15; + if (optind != 2) + return 16; return 0; } @@ -17588,7 +17123,13 @@ rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ conftest.$ac_objext conftest.beam conftest.$ac_ext fi - CPPFLAGS=$gl_save_CPPFLAGS + fi + else + case "$host_os" in + darwin* | aix* | mingw*) gl_cv_func_getopt_posix="guessing no";; + *) gl_cv_func_getopt_posix="guessing yes";; + esac + fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_getopt_posix" >&5 @@ -17619,11 +17160,7 @@ else POSIXLY_CORRECT=1 export POSIXLY_CORRECT if test "$cross_compiling" = yes; then : - case $host_os:$ac_cv_have_decl_optreset in - *-gnu*:* | mingw*:*) gl_cv_func_getopt_gnu=no;; - *:yes) gl_cv_func_getopt_gnu=no;; - *) gl_cv_func_getopt_gnu=yes;; - esac + gl_cv_func_getopt_gnu="guessing no" else cat confdefs.h - <<_ACEOF >conftest.$ac_ext @@ -17634,7 +17171,7 @@ else #include #if defined __MACH__ && defined __APPLE__ -/* Avoid a crash on MacOS X. */ +/* Avoid a crash on Mac OS X. */ #include #include #include @@ -17754,22 +17291,25 @@ main () nocrash_init(); /* This code succeeds on glibc 2.8, OpenBSD 4.0, Cygwin, mingw, - and fails on MacOS X 10.5, AIX 5.2, HP-UX 11, IRIX 6.5, + and fails on Mac OS X 10.5, AIX 5.2, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10. */ { - char *myargv[3]; - myargv[0] = "conftest"; - myargv[1] = "-+"; - myargv[2] = 0; + static char conftest[] = "conftest"; + static char plus[] = "-+"; + char *argv[3] = { conftest, plus, NULL }; opterr = 0; - if (getopt (2, myargv, "+a") != '?') + if (getopt (2, argv, "+a") != '?') result |= 1; } /* This code succeeds on glibc 2.8, mingw, - and fails on MacOS X 10.5, OpenBSD 4.0, AIX 5.2, HP-UX 11, + and fails on Mac OS X 10.5, OpenBSD 4.0, AIX 5.2, HP-UX 11, IRIX 6.5, OSF/1 5.1, Solaris 10, Cygwin 1.5.x. */ { - char *argv[] = { "program", "-p", "foo", "bar", NULL }; + static char program[] = "program"; + static char p[] = "-p"; + static char foo[] = "foo"; + static char bar[] = "bar"; + char *argv[] = { program, p, foo, bar, NULL }; optind = 1; if (getopt (4, argv, "p::") != 'p') @@ -17783,20 +17323,36 @@ main () } /* This code succeeds on glibc 2.8 and fails on Cygwin 1.7.0. */ { - char *argv[] = { "program", "foo", "-p", NULL }; + static char program[] = "program"; + static char foo[] = "foo"; + static char p[] = "-p"; + char *argv[] = { program, foo, p, NULL }; optind = 0; if (getopt (3, argv, "-p") != 1) result |= 16; else if (getopt (3, argv, "-p") != 'p') - result |= 32; + result |= 16; } /* This code fails on glibc 2.11. */ { - char *argv[] = { "program", "-b", "-a", NULL }; + static char program[] = "program"; + static char b[] = "-b"; + static char a[] = "-a"; + char *argv[] = { program, b, a, NULL }; optind = opterr = 0; if (getopt (3, argv, "+:a:b") != 'b') - result |= 64; + result |= 32; else if (getopt (3, argv, "+:a:b") != ':') + result |= 32; + } + /* This code dumps core on glibc 2.14. */ + { + static char program[] = "program"; + static char w[] = "-W"; + static char dummy[] = "dummy"; + char *argv[] = { program, w, dummy, NULL }; + optind = opterr = 1; + if (getopt (3, argv, "W;") != 'W') result |= 64; } return result; @@ -17823,8 +17379,71 @@ fi fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_getopt_gnu" >&5 $as_echo "$gl_cv_func_getopt_gnu" >&6; } - if test "$gl_cv_func_getopt_gnu" = "no"; then + if test "$gl_cv_func_getopt_gnu" != yes; then gl_replace_getopt=yes + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working GNU getopt_long function" >&5 +$as_echo_n "checking for working GNU getopt_long function... " >&6; } +if test "${gl_cv_func_getopt_long_gnu+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + case "$host_os" in + openbsd*) gl_cv_func_getopt_long_gnu="guessing no";; + *) gl_cv_func_getopt_long_gnu="guessing yes";; + esac + +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + #include + +int +main () +{ +static const struct option long_options[] = + { + { "xtremely-",no_argument, NULL, 1003 }, + { "xtra", no_argument, NULL, 1001 }, + { "xtreme", no_argument, NULL, 1002 }, + { "xtremely", no_argument, NULL, 1003 }, + { NULL, 0, NULL, 0 } + }; + /* This code fails on OpenBSD 5.0. */ + { + static char program[] = "program"; + static char xtremel[] = "--xtremel"; + char *argv[] = { program, xtremel, NULL }; + int option_index; + optind = 1; opterr = 0; + if (getopt_long (2, argv, "", long_options, &option_index) != 1003) + return 1; + } + return 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + gl_cv_func_getopt_long_gnu=yes +else + gl_cv_func_getopt_long_gnu=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_getopt_long_gnu" >&5 +$as_echo "$gl_cv_func_getopt_long_gnu" >&6; } + case "$gl_cv_func_getopt_long_gnu" in + *yes) ;; + *) gl_replace_getopt=yes ;; + esac fi fi @@ -17832,15 +17451,11 @@ $as_echo "$gl_cv_func_getopt_gnu" >&6; } + REPLACE_GETOPT=0 - - - if test -n "$gl_replace_getopt"; then : - + if test -n "$gl_replace_getopt"; then REPLACE_GETOPT=1 - -fi - + fi if test $REPLACE_GETOPT = 1; then @@ -17863,8 +17478,6 @@ cat >>confdefs.h <<_ACEOF #define HAVE_DECL_GETENV $ac_have_decl _ACEOF -<<<<<<< TREE -======= : @@ -18119,7 +17732,6 @@ $as_echo "$gl_cv_sys_struct_timeval_tv_sec" >&6; } ->>>>>>> MERGE-SOURCE { $as_echo "$as_me:${as_lineno-$LINENO}: checking for unsigned long long int" >&5 $as_echo_n "checking for unsigned long long int... " >&6; } @@ -18363,17 +17975,11 @@ _ACEOF esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' -<<<<<<< TREE - gl_absolute_header_sed='\#'"${gl_dirsep_regex}"'stdint.h#{ - s#.*"\(.*'"${gl_dirsep_regex}"'stdint.h\)".*#\1# - s#^/[^/]#//&# -======= gl_header_literal_regex=`echo 'stdint.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| ->>>>>>> MERGE-SOURCE p q }' @@ -18999,6 +18605,10 @@ _ACEOF + if test $BITSIZEOF_WINT_T -lt 32; then + BITSIZEOF_WINT_T=32 + fi + STDINT_H=stdint.h fi @@ -19076,17 +18686,11 @@ _ACEOF esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' -<<<<<<< TREE - gl_absolute_header_sed='\#'"${gl_dirsep_regex}"'inttypes.h#{ - s#.*"\(.*'"${gl_dirsep_regex}"'inttypes.h\)".*#\1# - s#^/[^/]#//&# -======= gl_header_literal_regex=`echo 'inttypes.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| ->>>>>>> MERGE-SOURCE p q }' @@ -19167,6 +18771,7 @@ $as_echo "$gl_cv_type_off_t_64" >&6; } GNULIB_FCHMODAT=0; + GNULIB_FSTAT=0; GNULIB_FSTATAT=0; GNULIB_FUTIMENS=0; GNULIB_LCHMOD=0; @@ -19282,19 +18887,219 @@ _ACEOF -<<<<<<< TREE + GNULIB_PSELECT=0; + GNULIB_SELECT=0; + HAVE_PSELECT=1; + REPLACE_PSELECT=0; + REPLACE_SELECT=0; + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether is self-contained" >&5 +$as_echo_n "checking whether is self-contained... " >&6; } +if test "${gl_cv_header_sys_select_h_selfcontained+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +struct timeval b; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + gl_cv_header_sys_select_h_selfcontained=yes +else + gl_cv_header_sys_select_h_selfcontained=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test $gl_cv_header_sys_select_h_selfcontained = yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +int memset; int bzero; + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ + + #undef memset + #define memset nonexistent_memset + extern + #ifdef __cplusplus + "C" + #endif + void *memset (void *, int, unsigned long); + #undef bzero + #define bzero nonexistent_bzero + extern + #ifdef __cplusplus + "C" + #endif + void bzero (void *, unsigned long); + fd_set fds; + FD_ZERO (&fds); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + +else + gl_cv_header_sys_select_h_selfcontained=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_sys_select_h_selfcontained" >&5 +$as_echo "$gl_cv_header_sys_select_h_selfcontained" >&6; } + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_sys_select_h='<'sys/select.h'>' + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +$as_echo_n "checking absolute name of ... " >&6; } +if test "${gl_cv_next_sys_select_h+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + if test $ac_cv_header_sys_select_h = yes; then + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + + gl_header_literal_regex=`echo 'sys/select.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' + gl_cv_next_sys_select_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"`'"' + else + gl_cv_next_sys_select_h='<'sys/select.h'>' + fi + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sys_select_h" >&5 +$as_echo "$gl_cv_next_sys_select_h" >&6; } + fi + NEXT_SYS_SELECT_H=$gl_cv_next_sys_select_h + + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'sys/select.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_sys_select_h + fi + NEXT_AS_FIRST_DIRECTIVE_SYS_SELECT_H=$gl_next_as_first_directive + + + + + if test $ac_cv_header_sys_select_h = yes; then + HAVE_SYS_SELECT_H=1 + else + HAVE_SYS_SELECT_H=0 + fi + + + + + + if test $ac_cv_header_sys_socket_h != yes; then + for ac_header in winsock2.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "winsock2.h" "ac_cv_header_winsock2_h" "$ac_includes_default" +if test "x$ac_cv_header_winsock2_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_WINSOCK2_H 1 +_ACEOF + +fi + +done + + fi + if test "$ac_cv_header_winsock2_h" = yes; then + HAVE_WINSOCK2_H=1 + UNISTD_H_HAVE_WINSOCK2_H=1 + SYS_IOCTL_H_HAVE_WINSOCK2_H=1 + else + HAVE_WINSOCK2_H=0 + fi + + + + + + -<<<<<<< TREE -======= -======= ->>>>>>> MERGE-SOURCE GNULIB_PTHREAD_SIGMASK=0; + GNULIB_RAISE=0; GNULIB_SIGNAL_H_SIGPIPE=0; GNULIB_SIGPROCMASK=0; GNULIB_SIGACTION=0; HAVE_POSIX_SIGNALBLOCKING=1; HAVE_PTHREAD_SIGMASK=1; + HAVE_RAISE=1; HAVE_SIGSET_T=1; HAVE_SIGINFO_T=1; HAVE_SIGACTION=1; @@ -19304,6 +19109,7 @@ _ACEOF HAVE_SIGHANDLER_T=1; REPLACE_PTHREAD_SIGMASK=0; + REPLACE_RAISE=0; @@ -19333,12 +19139,6 @@ fi -<<<<<<< TREE ->>>>>>> MERGE-SOURCE - - -======= ->>>>>>> MERGE-SOURCE if test $ac_cv_header_sys_socket_h = no; then for ac_header in ws2tcpip.h do : @@ -19481,6 +19281,7 @@ $as_echo "#define HAVE_WCHAR_T 1" >>confdefs.h GNULIB_DPRINTF=0; GNULIB_FCLOSE=0; + GNULIB_FDOPEN=0; GNULIB_FFLUSH=0; GNULIB_FGETC=0; GNULIB_FGETS=0; @@ -19504,6 +19305,7 @@ $as_echo "#define HAVE_WCHAR_T 1" >>confdefs.h GNULIB_GETLINE=0; GNULIB_OBSTACK_PRINTF=0; GNULIB_OBSTACK_PRINTF_POSIX=0; + GNULIB_PCLOSE=0; GNULIB_PERROR=0; GNULIB_POPEN=0; GNULIB_PRINTF=0; @@ -19541,11 +19343,14 @@ $as_echo "#define HAVE_WCHAR_T 1" >>confdefs.h HAVE_DPRINTF=1; HAVE_FSEEKO=1; HAVE_FTELLO=1; + HAVE_PCLOSE=1; + HAVE_POPEN=1; HAVE_RENAMEAT=1; HAVE_VASPRINTF=1; HAVE_VDPRINTF=1; REPLACE_DPRINTF=0; REPLACE_FCLOSE=0; + REPLACE_FDOPEN=0; REPLACE_FFLUSH=0; REPLACE_FOPEN=0; REPLACE_FPRINTF=0; @@ -19690,13 +19495,6 @@ fi -<<<<<<< TREE -<<<<<<< TREE -======= - - -======= ->>>>>>> MERGE-SOURCE ac_fn_c_check_decl "$LINENO" "strtoimax" "ac_cv_have_decl_strtoimax" "$ac_includes_default" if test "x$ac_cv_have_decl_strtoimax" = x""yes; then : ac_have_decl=1 @@ -19710,7 +19508,6 @@ _ACEOF ->>>>>>> MERGE-SOURCE ac_fn_c_check_decl "$LINENO" "strtoumax" "ac_cv_have_decl_strtoumax" "$ac_includes_default" if test "x$ac_cv_have_decl_strtoumax" = x""yes; then : ac_have_decl=1 @@ -19768,8 +19565,6 @@ fi -<<<<<<< TREE -======= ac_fn_c_check_type "$LINENO" "mode_t" "ac_cv_type_mode_t" "$ac_includes_default" if test "x$ac_cv_type_mode_t" = x""yes; then : @@ -19783,61 +19578,6 @@ fi - - - - - - ->>>>>>> MERGE-SOURCE -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C/C++ restrict keyword" >&5 -$as_echo_n "checking for C/C++ restrict keyword... " >&6; } -if test "${ac_cv_c_restrict+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_cv_c_restrict=no - # The order here caters to the fact that C++ does not require restrict. - for ac_kw in __restrict __restrict__ _Restrict restrict; do - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -typedef int * int_ptr; - int foo (int_ptr $ac_kw ip) { - return ip[0]; - } -int -main () -{ -int s[1]; - int * $ac_kw t = s; - t[0] = 0; - return foo(t) - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_c_restrict=$ac_kw -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext - test "$ac_cv_c_restrict" != no && break - done - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_restrict" >&5 -$as_echo "$ac_cv_c_restrict" >&6; } - - case $ac_cv_c_restrict in - restrict) ;; - no) $as_echo "#define restrict /**/" >>confdefs.h - ;; - *) cat >>confdefs.h <<_ACEOF -#define restrict $ac_cv_c_restrict -_ACEOF - ;; - esac - - - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct timespec in " >&5 $as_echo_n "checking for struct timespec in ... " >&6; } if test "${gl_cv_sys_struct_timespec_in_time_h+set}" = set; then : @@ -19975,17 +19715,11 @@ _ACEOF esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' -<<<<<<< TREE - gl_absolute_header_sed='\#'"${gl_dirsep_regex}"'time.h#{ - s#.*"\(.*'"${gl_dirsep_regex}"'time.h\)".*#\1# - s#^/[^/]#//&# -======= gl_header_literal_regex=`echo 'time.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| ->>>>>>> MERGE-SOURCE p q }' @@ -20015,16 +19749,197 @@ $as_echo "$gl_cv_next_time_h" >&6; } -ac_fn_c_check_decl "$LINENO" "localtime_r" "ac_cv_have_decl_localtime_r" "$ac_includes_default" -if test "x$ac_cv_have_decl_localtime_r" = x""yes; then : - ac_have_decl=1 + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the utimes function works" >&5 +$as_echo_n "checking whether the utimes function works... " >&6; } +if test "${gl_cv_func_working_utimes+set}" = set; then : + $as_echo_n "(cached) " >&6 else - ac_have_decl=0 + + if test "$cross_compiling" = yes; then : + gl_cv_func_working_utimes=no +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static int +inorder (time_t a, time_t b, time_t c) +{ + return a <= b && b <= c; +} + +int +main () +{ + int result = 0; + char const *file = "conftest.utimes"; + static struct timeval timeval[2] = {{9, 10}, {999999, 999999}}; + + /* Test whether utimes() essentially works. */ + { + struct stat sbuf; + FILE *f = fopen (file, "w"); + if (f == NULL) + result |= 1; + else if (fclose (f) != 0) + result |= 1; + else if (utimes (file, timeval) != 0) + result |= 2; + else if (lstat (file, &sbuf) != 0) + result |= 1; + else if (!(sbuf.st_atime == timeval[0].tv_sec + && sbuf.st_mtime == timeval[1].tv_sec)) + result |= 4; + if (unlink (file) != 0) + result |= 1; + } + + /* Test whether utimes() with a NULL argument sets the file's timestamp + to the current time. Use 'fstat' as well as 'time' to + determine the "current" time, to accommodate NFS file systems + if there is a time skew between the host and the NFS server. */ + { + int fd = open (file, O_WRONLY|O_CREAT, 0644); + if (fd < 0) + result |= 1; + else + { + time_t t0, t2; + struct stat st0, st1, st2; + if (time (&t0) == (time_t) -1) + result |= 1; + else if (fstat (fd, &st0) != 0) + result |= 1; + else if (utimes (file, timeval) != 0) + result |= 2; + else if (utimes (file, NULL) != 0) + result |= 8; + else if (fstat (fd, &st1) != 0) + result |= 1; + else if (write (fd, "\n", 1) != 1) + result |= 1; + else if (fstat (fd, &st2) != 0) + result |= 1; + else if (time (&t2) == (time_t) -1) + result |= 1; + else + { + int m_ok_POSIX = inorder (t0, st1.st_mtime, t2); + int m_ok_NFS = inorder (st0.st_mtime, st1.st_mtime, st2.st_mtime); + if (! (st1.st_atime == st1.st_mtime)) + result |= 16; + if (! (m_ok_POSIX || m_ok_NFS)) + result |= 32; + } + if (close (fd) != 0) + result |= 1; + } + if (unlink (file) != 0) + result |= 1; + } + + /* Test whether utimes() with a NULL argument works on read-only files. */ + { + int fd = open (file, O_WRONLY|O_CREAT, 0444); + if (fd < 0) + result |= 1; + else if (close (fd) != 0) + result |= 1; + else if (utimes (file, NULL) != 0) + result |= 64; + if (unlink (file) != 0) + result |= 1; + } + + return result; +} + +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + gl_cv_func_working_utimes=yes +else + gl_cv_func_working_utimes=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext fi -cat >>confdefs.h <<_ACEOF -#define HAVE_DECL_LOCALTIME_R $ac_have_decl +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_working_utimes" >&5 +$as_echo "$gl_cv_func_working_utimes" >&6; } + + if test $gl_cv_func_working_utimes = yes; then + +$as_echo "#define HAVE_WORKING_UTIMES 1" >>confdefs.h + + fi + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for struct utimbuf" >&5 +$as_echo_n "checking for struct utimbuf... " >&6; } +if test "${gl_cv_sys_struct_utimbuf+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if HAVE_SYS_TIME_H + #include + #endif + #include + #ifdef HAVE_UTIME_H + #include + #endif + +int +main () +{ +static struct utimbuf x; x.actime = x.modtime; + ; + return 0; +} _ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + gl_cv_sys_struct_utimbuf=yes +else + gl_cv_sys_struct_utimbuf=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_sys_struct_utimbuf" >&5 +$as_echo "$gl_cv_sys_struct_utimbuf" >&6; } + + if test $gl_cv_sys_struct_utimbuf = yes; then + +$as_echo "#define HAVE_STRUCT_UTIMBUF 1" >>confdefs.h + + fi + + + + + + + + @@ -20110,6 +20025,90 @@ fi + # Solaris 2.5.1 needs -lposix4 to get the clock_gettime function. + # Solaris 7 prefers the library name -lrt to the obsolescent name -lposix4. + + # Save and restore LIBS so e.g., -lrt, isn't added to it. Otherwise, *all* + # programs in the package would end up linked with that potentially-shared + # library, inducing unnecessary run-time overhead. + LIB_CLOCK_GETTIME= + + gl_saved_libs=$LIBS + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5 +$as_echo_n "checking for library containing clock_gettime... " >&6; } +if test "${ac_cv_search_clock_gettime+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + ac_func_search_save_LIBS=$LIBS +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char clock_gettime (); +int +main () +{ +return clock_gettime (); + ; + return 0; +} +_ACEOF +for ac_lib in '' rt posix4; do + if test -z "$ac_lib"; then + ac_res="none required" + else + ac_res=-l$ac_lib + LIBS="-l$ac_lib $ac_func_search_save_LIBS" + fi + if ac_fn_c_try_link "$LINENO"; then : + ac_cv_search_clock_gettime=$ac_res +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext + if test "${ac_cv_search_clock_gettime+set}" = set; then : + break +fi +done +if test "${ac_cv_search_clock_gettime+set}" = set; then : + +else + ac_cv_search_clock_gettime=no +fi +rm conftest.$ac_ext +LIBS=$ac_func_search_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_clock_gettime" >&5 +$as_echo "$ac_cv_search_clock_gettime" >&6; } +ac_res=$ac_cv_search_clock_gettime +if test "$ac_res" != no; then : + test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" + test "$ac_cv_search_clock_gettime" = "none required" || + LIB_CLOCK_GETTIME=$ac_cv_search_clock_gettime +fi + + for ac_func in clock_gettime clock_settime +do : + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +eval as_val=\$$as_ac_var + if test "x$as_val" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 +_ACEOF + +fi +done + + LIBS=$gl_saved_libs + + + + : @@ -20222,12 +20221,8 @@ $as_echo "$gl_cv_func_dup2_works" >&6; } gl_LIBOBJS="$gl_LIBOBJS dup2.$ac_objext" -<<<<<<< TREE -fi -======= fi ->>>>>>> MERGE-SOURCE @@ -20356,7 +20351,7 @@ fi gl_save_LIBS=$LIBS -# getloadvg is present in libc on glibc >= 2.2, MacOS X, FreeBSD >= 2.0, +# getloadvg is present in libc on glibc >= 2.2, Mac OS X, FreeBSD >= 2.0, # NetBSD >= 0.9, OpenBSD >= 2.0, Solaris >= 7. HAVE_GETLOADAVG=1 ac_fn_c_check_func "$LINENO" "getloadavg" "ac_cv_func_getloadavg" @@ -20733,9 +20728,9 @@ else HAVE_SYS_LOADAVG_H=0 fi ac_fn_c_check_decl "$LINENO" "getloadavg" "ac_cv_have_decl_getloadavg" "#if HAVE_SYS_LOADAVG_H - # include - #endif - #include + # include + #endif + #include " if test "x$ac_cv_have_decl_getloadavg" = x""yes; then : @@ -20758,6 +20753,8 @@ fi # Figure out what our getloadavg.c needs. + + # On HPUX9, an unprivileged user can get load averages this way. if test $gl_func_getloadavg_done = no; then for ac_func in pstat_getdynamic @@ -20919,15 +20916,11 @@ done + REPLACE_GETOPT=0 - - - if test -n "$gl_replace_getopt"; then : - + if test -n "$gl_replace_getopt"; then REPLACE_GETOPT=1 - -fi - + fi if test $REPLACE_GETOPT = 1; then @@ -20972,8 +20965,6 @@ $as_echo "#define __GETOPT_PREFIX rpl_" >>confdefs.h -<<<<<<< TREE -======= @@ -21179,7 +21170,6 @@ done ->>>>>>> MERGE-SOURCE if test $ac_cv_func_lstat = yes; then case "$gl_cv_func_lstat_dereferences_slashed_symlink" in @@ -21225,7 +21215,7 @@ done if test $APPLE_UNIVERSAL_BUILD = 1; then - # A universal build on Apple MacOS X platforms. + # A universal build on Apple Mac OS X platforms. # The test result would be 'yes' in 32-bit mode and 'no' in 64-bit mode. # But we need a configuration result that is valid in both modes. gl_cv_func_working_mktime=no @@ -21407,20 +21397,23 @@ main () if (tz_strings[i]) putenv (tz_strings[i]); - for (t = 0; t <= time_t_max - delta; t += delta) + for (t = 0; t <= time_t_max - delta && (result & 1) == 0; t += delta) if (! mktime_test (t)) result |= 1; - if (! (mktime_test ((time_t) 1) - && mktime_test ((time_t) (60 * 60)) - && mktime_test ((time_t) (60 * 60 * 24)))) + if ((result & 2) == 0 + && ! (mktime_test ((time_t) 1) + && mktime_test ((time_t) (60 * 60)) + && mktime_test ((time_t) (60 * 60 * 24)))) result |= 2; - for (j = 1; ; j <<= 1) - if (! bigtime_test (j)) - result |= 4; - else if (INT_MAX / 2 < j) - break; - if (! bigtime_test (INT_MAX)) + for (j = 1; (result & 4) == 0; j <<= 1) + { + if (! bigtime_test (j)) + result |= 4; + if (INT_MAX / 2 < j) + break; + } + if ((result & 8) == 0 && ! bigtime_test (INT_MAX)) result |= 8; } if (! irix_6_4_bug ()) @@ -21479,15 +21472,6 @@ $as_echo "$gl_cv_func_working_mktime" >&6; } -<<<<<<< TREE -<<<<<<< TREE -<<<<<<< TREE -======= -======= - - ->>>>>>> MERGE-SOURCE -======= @@ -21555,7 +21539,6 @@ $as_echo "$gl_cv_sig_pselect" >&6; } ->>>>>>> MERGE-SOURCE LIB_PTHREAD_SIGMASK= @@ -21790,7 +21773,6 @@ $as_echo "#define HAVE_PTHREAD_SIGMASK 1" >>confdefs.h ->>>>>>> MERGE-SOURCE if test $ac_cv_func_readlink = no; then HAVE_READLINK=0 @@ -21906,8 +21888,6 @@ $as_echo "#define READLINK_TRAILING_SLASH_BUG 1" >>confdefs.h -<<<<<<< TREE -======= @@ -21948,17 +21928,11 @@ _ACEOF esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' -<<<<<<< TREE - gl_absolute_header_sed='\#'"${gl_dirsep_regex}"'signal.h#{ - s#.*"\(.*'"${gl_dirsep_regex}"'signal.h\)".*#\1# - s#^/[^/]#//&# -======= gl_header_literal_regex=`echo 'signal.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| ->>>>>>> MERGE-SOURCE p q }' @@ -22016,12 +21990,7 @@ fi -<<<<<<< TREE ->>>>>>> MERGE-SOURCE - ac_fn_c_check_type "$LINENO" "socklen_t" "ac_cv_type_socklen_t" " -======= ac_fn_c_check_type "$LINENO" "socklen_t" "ac_cv_type_socklen_t" " ->>>>>>> MERGE-SOURCE /* is not needed according to POSIX, but the in i386-unknown-freebsd4.10 and powerpc-apple-darwin5.5 required it. */ @@ -22118,8 +22087,6 @@ $as_echo "#define ssize_t int" >>confdefs.h fi -<<<<<<< TREE -======= @@ -22258,7 +22225,6 @@ fi ->>>>>>> MERGE-SOURCE { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working stdalign.h" >&5 $as_echo_n "checking for working stdalign.h... " >&6; } if test "${gl_cv_header_working_stdalign_h+set}" = set; then : @@ -22413,17 +22379,11 @@ _ACEOF esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' -<<<<<<< TREE - gl_absolute_header_sed='\#'"${gl_dirsep_regex}"'stdarg.h#{ - s#.*"\(.*'"${gl_dirsep_regex}"'stdarg.h\)".*#\1# - s#^/[^/]#//&# -======= gl_header_literal_regex=`echo 'stdarg.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| ->>>>>>> MERGE-SOURCE p q }' @@ -22622,17 +22582,11 @@ _ACEOF esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' -<<<<<<< TREE - gl_absolute_header_sed='\#'"${gl_dirsep_regex}"'stddef.h#{ - s#.*"\(.*'"${gl_dirsep_regex}"'stddef.h\)".*#\1# - s#^/[^/]#//&# -======= gl_header_literal_regex=`echo 'stddef.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| ->>>>>>> MERGE-SOURCE p q }' @@ -22701,17 +22655,11 @@ _ACEOF esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' -<<<<<<< TREE - gl_absolute_header_sed='\#'"${gl_dirsep_regex}"'stdio.h#{ - s#.*"\(.*'"${gl_dirsep_regex}"'stdio.h\)".*#\1# - s#^/[^/]#//&# -======= gl_header_literal_regex=`echo 'stdio.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| ->>>>>>> MERGE-SOURCE p q }' @@ -22739,7 +22687,21 @@ $as_echo "$gl_cv_next_stdio_h" >&6; } GNULIB_FSCANF=1 + + +cat >>confdefs.h <<_ACEOF +#define GNULIB_FSCANF 1 +_ACEOF + + GNULIB_SCANF=1 + + +cat >>confdefs.h <<_ACEOF +#define GNULIB_SCANF 1 +_ACEOF + + GNULIB_FGETC=1 GNULIB_GETC=1 GNULIB_GETCHAR=1 @@ -22801,17 +22763,11 @@ _ACEOF esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' -<<<<<<< TREE - gl_absolute_header_sed='\#'"${gl_dirsep_regex}"'stdlib.h#{ - s#.*"\(.*'"${gl_dirsep_regex}"'stdlib.h\)".*#\1# - s#^/[^/]#//&# -======= gl_header_literal_regex=`echo 'stdlib.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| ->>>>>>> MERGE-SOURCE p q }' @@ -22858,8 +22814,6 @@ $as_echo "#define my_strftime nstrftime" >>confdefs.h -<<<<<<< TREE -======= if test "$ac_cv_have_decl_strtoimax" != yes; then HAVE_DECL_STRTOIMAX=0 @@ -22982,7 +22936,6 @@ _ACEOF ->>>>>>> MERGE-SOURCE if test "$ac_cv_have_decl_strtoumax" != yes; then HAVE_DECL_STRTOUMAX=0 fi @@ -23110,6 +23063,201 @@ $as_echo "$gl_cv_func_symlink_works" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether is self-contained" >&5 +$as_echo_n "checking whether is self-contained... " >&6; } +if test "${gl_cv_header_sys_select_h_selfcontained+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +struct timeval b; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + gl_cv_header_sys_select_h_selfcontained=yes +else + gl_cv_header_sys_select_h_selfcontained=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test $gl_cv_header_sys_select_h_selfcontained = yes; then + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +int memset; int bzero; + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ + + #undef memset + #define memset nonexistent_memset + extern + #ifdef __cplusplus + "C" + #endif + void *memset (void *, int, unsigned long); + #undef bzero + #define bzero nonexistent_bzero + extern + #ifdef __cplusplus + "C" + #endif + void bzero (void *, unsigned long); + fd_set fds; + FD_ZERO (&fds); + + ; + return 0; +} + +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + +else + gl_cv_header_sys_select_h_selfcontained=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_header_sys_select_h_selfcontained" >&5 +$as_echo "$gl_cv_header_sys_select_h_selfcontained" >&6; } + + + + + + + + + + if test $gl_cv_have_include_next = yes; then + gl_cv_next_sys_select_h='<'sys/select.h'>' + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 +$as_echo_n "checking absolute name of ... " >&6; } +if test "${gl_cv_next_sys_select_h+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + + if test $ac_cv_header_sys_select_h = yes; then + + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF + case "$host_os" in + aix*) gl_absname_cpp="$ac_cpp -C" ;; + *) gl_absname_cpp="$ac_cpp" ;; + esac + + case "$host_os" in + mingw*) + gl_dirsep_regex='[/\\]' + ;; + *) + gl_dirsep_regex='\/' + ;; + esac + gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' + + gl_header_literal_regex=`echo 'sys/select.h' \ + | sed -e "$gl_make_literal_regex_sed"` + gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ + s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ + s|^/[^/]|//&| + p + q + }' + gl_cv_next_sys_select_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | + sed -n "$gl_absolute_header_sed"`'"' + else + gl_cv_next_sys_select_h='<'sys/select.h'>' + fi + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sys_select_h" >&5 +$as_echo "$gl_cv_next_sys_select_h" >&6; } + fi + NEXT_SYS_SELECT_H=$gl_cv_next_sys_select_h + + if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' + gl_next_as_first_directive='<'sys/select.h'>' + else + # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' + gl_next_as_first_directive=$gl_cv_next_sys_select_h + fi + NEXT_AS_FIRST_DIRECTIVE_SYS_SELECT_H=$gl_next_as_first_directive + + + + + if test $ac_cv_header_sys_select_h = yes; then + HAVE_SYS_SELECT_H=1 + else + HAVE_SYS_SELECT_H=0 + fi + + + + + + if test $ac_cv_header_sys_socket_h != yes; then + for ac_header in winsock2.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "winsock2.h" "ac_cv_header_winsock2_h" "$ac_includes_default" +if test "x$ac_cv_header_winsock2_h" = x""yes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_WINSOCK2_H 1 +_ACEOF + +fi + +done + + fi + if test "$ac_cv_header_winsock2_h" = yes; then + HAVE_WINSOCK2_H=1 + UNISTD_H_HAVE_WINSOCK2_H=1 + SYS_IOCTL_H_HAVE_WINSOCK2_H=1 + else + HAVE_WINSOCK2_H=0 + fi + + + + + + + + + @@ -23155,17 +23303,11 @@ _ACEOF esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' -<<<<<<< TREE - gl_absolute_header_sed='\#'"${gl_dirsep_regex}"'sys/stat.h#{ - s#.*"\(.*'"${gl_dirsep_regex}"'sys/stat.h\)".*#\1# - s#^/[^/]#//&# -======= gl_header_literal_regex=`echo 'sys/stat.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| ->>>>>>> MERGE-SOURCE p q }' @@ -23195,8 +23337,6 @@ $as_echo "$gl_cv_next_sys_stat_h" >&6; } -<<<<<<< TREE -======= @@ -23209,7 +23349,6 @@ $as_echo "#define _GL_WINDOWS_64_BIT_ST_SIZE 1" >>confdefs.h fi ->>>>>>> MERGE-SOURCE ac_fn_c_check_type "$LINENO" "nlink_t" "ac_cv_type_nlink_t" "#include #include " @@ -23235,82 +23374,20 @@ fi - if test $gl_cv_have_include_next = yes; then - gl_cv_next_sys_types_h='<'sys/types.h'>' - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking absolute name of " >&5 -$as_echo_n "checking absolute name of ... " >&6; } -if test "${gl_cv_next_sys_types_h+set}" = set; then : - $as_echo_n "(cached) " >&6 + + + + ac_fn_c_check_decl "$LINENO" "localtime_r" "ac_cv_have_decl_localtime_r" "#include +" +if test "x$ac_cv_have_decl_localtime_r" = x""yes; then : + ac_have_decl=1 else - - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include - -_ACEOF - case "$host_os" in - aix*) gl_absname_cpp="$ac_cpp -C" ;; - *) gl_absname_cpp="$ac_cpp" ;; - esac - - case "$host_os" in - mingw*) - gl_dirsep_regex='[/\\]' - ;; - *) - gl_dirsep_regex='\/' - ;; - esac - gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' - - gl_header_literal_regex=`echo 'sys/types.h' \ - | sed -e "$gl_make_literal_regex_sed"` - gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ - s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ - s|^/[^/]|//&| - p - q - }' - gl_cv_next_sys_types_h='"'`(eval "$gl_absname_cpp conftest.$ac_ext") 2>&5 | - sed -n "$gl_absolute_header_sed"`'"' - - + ac_have_decl=0 fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_next_sys_types_h" >&5 -$as_echo "$gl_cv_next_sys_types_h" >&6; } - fi - NEXT_SYS_TYPES_H=$gl_cv_next_sys_types_h - - if test $gl_cv_have_include_next = yes || test $gl_cv_have_include_next = buggy; then - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include_next' - gl_next_as_first_directive='<'sys/types.h'>' - else - # INCLUDE_NEXT_AS_FIRST_DIRECTIVE='include' - gl_next_as_first_directive=$gl_cv_next_sys_types_h - fi - NEXT_AS_FIRST_DIRECTIVE_SYS_TYPES_H=$gl_next_as_first_directive - - - - - - - - - - - - - - - - - - - - +cat >>confdefs.h <<_ACEOF +#define HAVE_DECL_LOCALTIME_R $ac_have_decl +_ACEOF if test $ac_cv_have_decl_localtime_r = no; then HAVE_DECL_LOCALTIME_R=0 @@ -23400,11 +23477,8 @@ $as_echo "$gl_cv_time_r_posix" >&6; } -<<<<<<< TREE -======= ->>>>>>> MERGE-SOURCE if test $gl_cv_have_include_next = yes; then gl_cv_next_unistd_h='<'unistd.h'>' else @@ -23437,17 +23511,11 @@ _ACEOF esac gl_make_literal_regex_sed='s,[]$^\\.*/[],\\&,g' -<<<<<<< TREE - gl_absolute_header_sed='\#'"${gl_dirsep_regex}"'unistd.h#{ - s#.*"\(.*'"${gl_dirsep_regex}"'unistd.h\)".*#\1# - s#^/[^/]#//&# -======= gl_header_literal_regex=`echo 'unistd.h' \ | sed -e "$gl_make_literal_regex_sed"` gl_absolute_header_sed="/${gl_dirsep_regex}${gl_header_literal_regex}/"'{ s/.*"\(.*'"${gl_dirsep_regex}${gl_header_literal_regex}"'\)".*/\1/ s|^/[^/]|//&| ->>>>>>> MERGE-SOURCE p q }' @@ -23489,14 +23557,74 @@ $as_echo "$gl_cv_next_unistd_h" >&6; } + + + + + + + if test $ac_cv_func_futimens = no && test $ac_cv_func_futimesat = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether futimesat handles NULL file" >&5 +$as_echo_n "checking whether futimesat handles NULL file... " >&6; } +if test "${gl_cv_func_futimesat_works+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + touch conftest.file + if test "$cross_compiling" = yes; then : + case "$host_os" in + # Guess yes on glibc systems. + *-gnu*) gl_cv_func_futimesat_works="guessing yes" ;; + # If we don't know, assume the worst. + *) gl_cv_func_futimesat_works="guessing no" ;; + esac + +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +#include +#include +#include + +int +main () +{ + int fd = open ("conftest.file", O_RDWR); + if (fd < 0) return 1; + if (futimesat (fd, NULL, NULL)) return 2; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + gl_cv_func_futimesat_works=yes +else + gl_cv_func_futimesat_works=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + rm -f conftest.file +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gl_cv_func_futimesat_works" >&5 +$as_echo "$gl_cv_func_futimesat_works" >&6; } + case "$gl_cv_func_futimesat_works" in + *yes) ;; + *) + +$as_echo "#define FUTIMESAT_NULL_BUG 1" >>confdefs.h + + ;; + esac + fi + gl_gnulib_enabled_dosname=false gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36=false -<<<<<<< TREE -======= gl_gnulib_enabled_pathmax=false - gl_gnulib_enabled_sigprocmask=false ->>>>>>> MERGE-SOURCE gl_gnulib_enabled_stat=false + gl_gnulib_enabled_strtoll=false gl_gnulib_enabled_strtoull=false gl_gnulib_enabled_verify=false func_gl_gnulib_m4code_dosname () @@ -23513,10 +23641,6 @@ $as_echo "$gl_cv_next_unistd_h" >&6; } gl_gnulib_enabled_be453cec5eecf5731a274f2de7f2db36=true fi } -<<<<<<< TREE -<<<<<<< TREE -======= -======= func_gl_gnulib_m4code_pathmax () { if ! $gl_gnulib_enabled_pathmax; then @@ -23526,52 +23650,6 @@ $as_echo "$gl_cv_next_unistd_h" >&6; } gl_gnulib_enabled_pathmax=true fi } ->>>>>>> MERGE-SOURCE - func_gl_gnulib_m4code_sigprocmask () - { - if ! $gl_gnulib_enabled_sigprocmask; then - - - - if test $gl_cv_type_sigset_t = yes; then - ac_fn_c_check_func "$LINENO" "sigprocmask" "ac_cv_func_sigprocmask" -if test "x$ac_cv_func_sigprocmask" = x""yes; then : - gl_cv_func_sigprocmask=1 -fi - - fi - if test -z "$gl_cv_func_sigprocmask"; then - HAVE_POSIX_SIGNALBLOCKING=0 - fi - -if test $HAVE_POSIX_SIGNALBLOCKING = 0; then - - - - - - - - - gl_LIBOBJS="$gl_LIBOBJS sigprocmask.$ac_objext" - - : -fi - - - - - - GNULIB_SIGPROCMASK=1 - - - - - - gl_gnulib_enabled_sigprocmask=true - fi - } ->>>>>>> MERGE-SOURCE func_gl_gnulib_m4code_stat () { if ! $gl_gnulib_enabled_stat; then @@ -23710,23 +23788,14 @@ $as_echo "#define REPLACE_FUNC_STAT_FILE 1" >>confdefs.h if test $REPLACE_STAT = 1; then func_gl_gnulib_m4code_dosname fi -<<<<<<< TREE - if $condition; then -======= if test $REPLACE_STAT = 1; then -<<<<<<< TREE ->>>>>>> MERGE-SOURCE -======= func_gl_gnulib_m4code_pathmax fi if test $REPLACE_STAT = 1; then ->>>>>>> MERGE-SOURCE func_gl_gnulib_m4code_verify fi fi } -<<<<<<< TREE -======= func_gl_gnulib_m4code_strtoll () { if ! $gl_gnulib_enabled_strtoll; then @@ -23779,7 +23848,6 @@ done gl_gnulib_enabled_strtoll=true fi } ->>>>>>> MERGE-SOURCE func_gl_gnulib_m4code_strtoull () { if ! $gl_gnulib_enabled_strtoull; then @@ -23850,25 +23918,10 @@ done if test $HAVE_READLINK = 0 || test $REPLACE_READLINK = 1; then func_gl_gnulib_m4code_stat fi -<<<<<<< TREE -<<<<<<< TREE - if test "$ac_cv_have_decl_strtoumax" != yes && test $ac_cv_func_strtoumax = no; then -======= - if test $ac_cv_func_strtoimax = no; then - func_gl_gnulib_m4code_verify - fi - if test $ac_cv_func_strtoimax = no && test $ac_cv_type_long_long_int = yes; then -======= if { test $HAVE_STRTOIMAX = 0 || test $REPLACE_STRTOIMAX = 1; } && test $ac_cv_type_long_long_int = yes; then ->>>>>>> MERGE-SOURCE func_gl_gnulib_m4code_strtoll fi -<<<<<<< TREE - if test $ac_cv_func_strtoumax = no; then ->>>>>>> MERGE-SOURCE -======= if test $HAVE_STRTOIMAX = 0 || test $REPLACE_STRTOIMAX = 1; then ->>>>>>> MERGE-SOURCE func_gl_gnulib_m4code_verify fi if test $ac_cv_func_strtoumax = no && test $ac_cv_type_unsigned_long_long_int = yes; then @@ -23894,8 +23947,6 @@ else gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36_FALSE= fi -<<<<<<< TREE -======= if $gl_gnulib_enabled_pathmax; then gl_GNULIB_ENABLED_pathmax_TRUE= gl_GNULIB_ENABLED_pathmax_FALSE='#' @@ -23904,15 +23955,6 @@ else gl_GNULIB_ENABLED_pathmax_FALSE= fi - if $gl_gnulib_enabled_sigprocmask; then - gl_GNULIB_ENABLED_sigprocmask_TRUE= - gl_GNULIB_ENABLED_sigprocmask_FALSE='#' -else - gl_GNULIB_ENABLED_sigprocmask_TRUE='#' - gl_GNULIB_ENABLED_sigprocmask_FALSE= -fi - ->>>>>>> MERGE-SOURCE if $gl_gnulib_enabled_stat; then gl_GNULIB_ENABLED_stat_TRUE= gl_GNULIB_ENABLED_stat_FALSE='#' @@ -23921,6 +23963,14 @@ else gl_GNULIB_ENABLED_stat_FALSE= fi + if $gl_gnulib_enabled_strtoll; then + gl_GNULIB_ENABLED_strtoll_TRUE= + gl_GNULIB_ENABLED_strtoll_FALSE='#' +else + gl_GNULIB_ENABLED_strtoll_TRUE='#' + gl_GNULIB_ENABLED_strtoll_FALSE= +fi + if $gl_gnulib_enabled_strtoull; then gl_GNULIB_ENABLED_strtoull_TRUE= gl_GNULIB_ENABLED_strtoull_FALSE='#' @@ -23977,1766 +24027,8 @@ fi LIBGNU_LTLIBDEPS="$gl_ltlibdeps" - -# UNIX98 PTYs. -for ac_func in grantpt -do : - ac_fn_c_check_func "$LINENO" "grantpt" "ac_cv_func_grantpt" -if test "x$ac_cv_func_grantpt" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_GRANTPT 1 -_ACEOF - -fi -done - - -# PTY-related GNU extensions. -for ac_func in getpt -do : - ac_fn_c_check_func "$LINENO" "getpt" "ac_cv_func_getpt" -if test "x$ac_cv_func_getpt" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_GETPT 1 -_ACEOF - -fi -done - - -# Check this now, so that we will NOT find the above functions in ncurses. -# That is because we have not set up to link ncurses in lib-src. -# It's better to believe a function is not available -# than to expect to find it in ncurses. -# Also we need tputs and friends to be able to build at all. -have_tputs_et_al=true -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing tputs" >&5 -$as_echo_n "checking for library containing tputs... " >&6; } -if test "${ac_cv_search_tputs+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_func_search_save_LIBS=$LIBS -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char tputs (); -int -main () -{ -return tputs (); - ; - return 0; -} -_ACEOF -for ac_lib in '' ncurses terminfo termcap; do - if test -z "$ac_lib"; then - ac_res="none required" - else - ac_res=-l$ac_lib - LIBS="-l$ac_lib $ac_func_search_save_LIBS" - fi - if ac_fn_c_try_link "$LINENO"; then : - ac_cv_search_tputs=$ac_res -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext - if test "${ac_cv_search_tputs+set}" = set; then : - break -fi -done -if test "${ac_cv_search_tputs+set}" = set; then : - -else - ac_cv_search_tputs=no -fi -rm conftest.$ac_ext -LIBS=$ac_func_search_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_tputs" >&5 -$as_echo "$ac_cv_search_tputs" >&6; } -ac_res=$ac_cv_search_tputs -if test "$ac_res" != no; then : - test "$ac_res" = "none required" || LIBS="$ac_res $LIBS" - -else - have_tputs_et_al=false -fi - -if test "$have_tputs_et_al" != true; then - as_fn_error "I couldn't find termcap functions (tputs and friends). -Maybe some development libraries/packages are missing? Try installing -libncurses-dev(el), libterminfo-dev(el) or similar." "$LINENO" 5 -fi -# Must define this when any termcap library is found. - -$as_echo "#define HAVE_LIBNCURSES 1" >>confdefs.h - -## FIXME This was the cpp logic, but I am not sure it is right. -## The above test has not necessarily found libncurses. -HAVE_LIBNCURSES=yes - -## Use terminfo instead of termcap? -## Note only system files NOT using terminfo are: -## freebsd < 40000, ms-w32, msdos, netbsd < 599002500, and -## darwin|gnu without ncurses. -TERMINFO=no -LIBS_TERMCAP= -case "$opsys" in - ## cygwin: Fewer environment variables to go wrong, more terminal types. - ## hpux10-20: Use the system provided termcap(3) library. - ## openbsd: David Mazieres says this - ## is necessary. Otherwise Emacs dumps core when run -nw. - aix4-2|cygwin|hpux*|irix6-5|openbsd|sol2*|unixware) TERMINFO=yes ;; - - ## darwin: Prevents crashes when running Emacs in Terminal.app under 10.2. - ## The ncurses library has been moved out of the System framework in - ## Mac OS X 10.2. So if configure detects it, set the command-line - ## option to use it. - darwin|gnu*) - ## (HAVE_LIBNCURSES was not always true, but is since 2010-03-18.) - if test "x$HAVE_LIBNCURSES" = "xyes"; then - TERMINFO=yes - LIBS_TERMCAP="-lncurses" - fi - ;; - - freebsd) - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether FreeBSD is new enough to use terminfo" >&5 -$as_echo_n "checking whether FreeBSD is new enough to use terminfo... " >&6; } - if test "${emacs_cv_freebsd_terminfo+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -#if __FreeBSD_version < 400000 -fail; -#endif - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - emacs_cv_freebsd_terminfo=yes -else - emacs_cv_freebsd_terminfo=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -fi - - - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_freebsd_terminfo" >&5 -$as_echo "$emacs_cv_freebsd_terminfo" >&6; } - - if test $emacs_cv_freebsd_terminfo = yes; then - TERMINFO=yes - LIBS_TERMCAP="-lncurses" - else - LIBS_TERMCAP="-ltermcap" - fi - ;; - - netbsd) - if test $ac_cv_search_tputs = -lterminfo; then - TERMINFO=yes - LIBS_TERMCAP="-lterminfo" - else - LIBS_TERMCAP="-ltermcap" - fi - ;; - -esac - -case "$opsys" in - ## hpux: Make sure we get select from libc rather than from libcurses - ## because libcurses on HPUX 10.10 has a broken version of select. - ## We used to use -lc -lcurses, but this may be cleaner. - hpux*) LIBS_TERMCAP="-ltermcap" ;; - - openbsd) LIBS_TERMCAP="-lncurses" ;; - - ## Must use system termcap, if we use any termcap. It does special things. - sol2*) test "$TERMINFO" != yes && LIBS_TERMCAP="-ltermcap" ;; -esac - -TERMCAP_OBJ=tparam.o -if test $TERMINFO = yes; then - -$as_echo "#define TERMINFO 1" >>confdefs.h - - - ## Default used to be -ltermcap. Add a case above if need something else. - test "x$LIBS_TERMCAP" = "x" && LIBS_TERMCAP="-lcurses" - - TERMCAP_OBJ=terminfo.o -fi - - - - -# Do we have res_init, for detecting changes in /etc/resolv.conf? -resolv=no -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -int -main () -{ -return res_init(); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - have_res_init=yes -else - have_res_init=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -if test "$have_res_init" = no; then - OLIBS="$LIBS" - LIBS="$LIBS -lresolv" - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for res_init with -lresolv" >&5 -$as_echo_n "checking for res_init with -lresolv... " >&6; } - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -#include -#include -int -main () -{ -return res_init(); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - have_res_init=yes -else - have_res_init=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - { $as_echo "$as_me:${as_lineno-$LINENO}: result: $have_res_init" >&5 -$as_echo "$have_res_init" >&6; } - if test "$have_res_init" = yes ; then - resolv=yes - fi - LIBS="$OLIBS" -fi - -if test "$have_res_init" = yes; then - -$as_echo "#define HAVE_RES_INIT 1" >>confdefs.h - -fi - -# Do we need the Hesiod library to provide the support routines? -LIBHESIOD= -if test "$with_hesiod" != no ; then - # Don't set $LIBS here -- see comments above. FIXME which comments? - ac_fn_c_check_func "$LINENO" "res_send" "ac_cv_func_res_send" -if test "x$ac_cv_func_res_send" = x""yes; then : - -else - ac_fn_c_check_func "$LINENO" "__res_send" "ac_cv_func___res_send" -if test "x$ac_cv_func___res_send" = x""yes; then : - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for res_send in -lresolv" >&5 -$as_echo_n "checking for res_send in -lresolv... " >&6; } -if test "${ac_cv_lib_resolv_res_send+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lresolv $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char res_send (); -int -main () -{ -return res_send (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_resolv_res_send=yes -else - ac_cv_lib_resolv_res_send=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_resolv_res_send" >&5 -$as_echo "$ac_cv_lib_resolv_res_send" >&6; } -if test "x$ac_cv_lib_resolv_res_send" = x""yes; then : - resolv=yes -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __res_send in -lresolv" >&5 -$as_echo_n "checking for __res_send in -lresolv... " >&6; } -if test "${ac_cv_lib_resolv___res_send+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lresolv $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char __res_send (); -int -main () -{ -return __res_send (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_resolv___res_send=yes -else - ac_cv_lib_resolv___res_send=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_resolv___res_send" >&5 -$as_echo "$ac_cv_lib_resolv___res_send" >&6; } -if test "x$ac_cv_lib_resolv___res_send" = x""yes; then : - resolv=yes -fi - -fi - -fi - -fi - - if test "$resolv" = yes ; then - RESOLVLIB=-lresolv - else - RESOLVLIB= - fi - ac_fn_c_check_func "$LINENO" "hes_getmailhost" "ac_cv_func_hes_getmailhost" -if test "x$ac_cv_func_hes_getmailhost" = x""yes; then : - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for hes_getmailhost in -lhesiod" >&5 -$as_echo_n "checking for hes_getmailhost in -lhesiod... " >&6; } -if test "${ac_cv_lib_hesiod_hes_getmailhost+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lhesiod $RESOLVLIB $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char hes_getmailhost (); -int -main () -{ -return hes_getmailhost (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_hesiod_hes_getmailhost=yes -else - ac_cv_lib_hesiod_hes_getmailhost=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_hesiod_hes_getmailhost" >&5 -$as_echo "$ac_cv_lib_hesiod_hes_getmailhost" >&6; } -if test "x$ac_cv_lib_hesiod_hes_getmailhost" = x""yes; then : - hesiod=yes -else - : -fi - -fi - - - if test x"$hesiod" = xyes; then - -$as_echo "#define HAVE_LIBHESIOD 1" >>confdefs.h - - LIBHESIOD=-lhesiod - fi -fi - - -# Do we need libresolv (due to res_init or Hesiod)? -if test "$resolv" = yes ; then - -$as_echo "#define HAVE_LIBRESOLV 1" >>confdefs.h - - LIBRESOLV=-lresolv -else - LIBRESOLV= -fi - - -# These tell us which Kerberos-related libraries to use. -COM_ERRLIB= -CRYPTOLIB= -KRB5LIB= -DESLIB= -KRB4LIB= - -if test "${with_kerberos}" != no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for com_err in -lcom_err" >&5 -$as_echo_n "checking for com_err in -lcom_err... " >&6; } -if test "${ac_cv_lib_com_err_com_err+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lcom_err $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char com_err (); -int -main () -{ -return com_err (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_com_err_com_err=yes -else - ac_cv_lib_com_err_com_err=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_com_err_com_err" >&5 -$as_echo "$ac_cv_lib_com_err_com_err" >&6; } -if test "x$ac_cv_lib_com_err_com_err" = x""yes; then : - have_com_err=yes -else - have_com_err=no -fi - - if test $have_com_err = yes; then - COM_ERRLIB=-lcom_err - LIBS="$COM_ERRLIB $LIBS" - -$as_echo "#define HAVE_LIBCOM_ERR 1" >>confdefs.h - - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mit_des_cbc_encrypt in -lcrypto" >&5 -$as_echo_n "checking for mit_des_cbc_encrypt in -lcrypto... " >&6; } -if test "${ac_cv_lib_crypto_mit_des_cbc_encrypt+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lcrypto $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char mit_des_cbc_encrypt (); -int -main () -{ -return mit_des_cbc_encrypt (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_crypto_mit_des_cbc_encrypt=yes -else - ac_cv_lib_crypto_mit_des_cbc_encrypt=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_crypto_mit_des_cbc_encrypt" >&5 -$as_echo "$ac_cv_lib_crypto_mit_des_cbc_encrypt" >&6; } -if test "x$ac_cv_lib_crypto_mit_des_cbc_encrypt" = x""yes; then : - have_crypto=yes -else - have_crypto=no -fi - - if test $have_crypto = yes; then - CRYPTOLIB=-lcrypto - LIBS="$CRYPTOLIB $LIBS" - -$as_echo "#define HAVE_LIBCRYPTO 1" >>confdefs.h - - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for mit_des_cbc_encrypt in -lk5crypto" >&5 -$as_echo_n "checking for mit_des_cbc_encrypt in -lk5crypto... " >&6; } -if test "${ac_cv_lib_k5crypto_mit_des_cbc_encrypt+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lk5crypto $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char mit_des_cbc_encrypt (); -int -main () -{ -return mit_des_cbc_encrypt (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_k5crypto_mit_des_cbc_encrypt=yes -else - ac_cv_lib_k5crypto_mit_des_cbc_encrypt=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_k5crypto_mit_des_cbc_encrypt" >&5 -$as_echo "$ac_cv_lib_k5crypto_mit_des_cbc_encrypt" >&6; } -if test "x$ac_cv_lib_k5crypto_mit_des_cbc_encrypt" = x""yes; then : - have_k5crypto=yes -else - have_k5crypto=no -fi - - if test $have_k5crypto = yes; then - CRYPTOLIB=-lk5crypto - LIBS="$CRYPTOLIB $LIBS" - -$as_echo "#define HAVE_LIBK5CRYPTO 1" >>confdefs.h - - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for krb5_init_context in -lkrb5" >&5 -$as_echo_n "checking for krb5_init_context in -lkrb5... " >&6; } -if test "${ac_cv_lib_krb5_krb5_init_context+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lkrb5 $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char krb5_init_context (); -int -main () -{ -return krb5_init_context (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_krb5_krb5_init_context=yes -else - ac_cv_lib_krb5_krb5_init_context=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_krb5_krb5_init_context" >&5 -$as_echo "$ac_cv_lib_krb5_krb5_init_context" >&6; } -if test "x$ac_cv_lib_krb5_krb5_init_context" = x""yes; then : - have_krb5=yes -else - have_krb5=no -fi - - if test $have_krb5=yes; then - KRB5LIB=-lkrb5 - LIBS="$KRB5LIB $LIBS" - -$as_echo "#define HAVE_LIBKRB5 1" >>confdefs.h - - fi - if test "${with_kerberos5}" = no; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for des_cbc_encrypt in -ldes425" >&5 -$as_echo_n "checking for des_cbc_encrypt in -ldes425... " >&6; } -if test "${ac_cv_lib_des425_des_cbc_encrypt+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldes425 $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char des_cbc_encrypt (); -int -main () -{ -return des_cbc_encrypt (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_des425_des_cbc_encrypt=yes -else - ac_cv_lib_des425_des_cbc_encrypt=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_des425_des_cbc_encrypt" >&5 -$as_echo "$ac_cv_lib_des425_des_cbc_encrypt" >&6; } -if test "x$ac_cv_lib_des425_des_cbc_encrypt" = x""yes; then : - have_des425=yes -else - have_des425=no -fi - - if test $have_des425 = yes; then - DESLIB=-ldes425 - LIBS="$DESLIB $LIBS" - -$as_echo "#define HAVE_LIBDES425 1" >>confdefs.h - - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for des_cbc_encrypt in -ldes" >&5 -$as_echo_n "checking for des_cbc_encrypt in -ldes... " >&6; } -if test "${ac_cv_lib_des_des_cbc_encrypt+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-ldes $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char des_cbc_encrypt (); -int -main () -{ -return des_cbc_encrypt (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_des_des_cbc_encrypt=yes -else - ac_cv_lib_des_des_cbc_encrypt=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_des_des_cbc_encrypt" >&5 -$as_echo "$ac_cv_lib_des_des_cbc_encrypt" >&6; } -if test "x$ac_cv_lib_des_des_cbc_encrypt" = x""yes; then : - have_des=yes -else - have_des=no -fi - - if test $have_des = yes; then - DESLIB=-ldes - LIBS="$DESLIB $LIBS" - -$as_echo "#define HAVE_LIBDES 1" >>confdefs.h - - fi - fi - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for krb_get_cred in -lkrb4" >&5 -$as_echo_n "checking for krb_get_cred in -lkrb4... " >&6; } -if test "${ac_cv_lib_krb4_krb_get_cred+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lkrb4 $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char krb_get_cred (); -int -main () -{ -return krb_get_cred (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_krb4_krb_get_cred=yes -else - ac_cv_lib_krb4_krb_get_cred=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_krb4_krb_get_cred" >&5 -$as_echo "$ac_cv_lib_krb4_krb_get_cred" >&6; } -if test "x$ac_cv_lib_krb4_krb_get_cred" = x""yes; then : - have_krb4=yes -else - have_krb4=no -fi - - if test $have_krb4 = yes; then - KRB4LIB=-lkrb4 - LIBS="$KRB4LIB $LIBS" - -$as_echo "#define HAVE_LIBKRB4 1" >>confdefs.h - - else - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for krb_get_cred in -lkrb" >&5 -$as_echo_n "checking for krb_get_cred in -lkrb... " >&6; } -if test "${ac_cv_lib_krb_krb_get_cred+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lkrb $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char krb_get_cred (); -int -main () -{ -return krb_get_cred (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_krb_krb_get_cred=yes -else - ac_cv_lib_krb_krb_get_cred=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_krb_krb_get_cred" >&5 -$as_echo "$ac_cv_lib_krb_krb_get_cred" >&6; } -if test "x$ac_cv_lib_krb_krb_get_cred" = x""yes; then : - have_krb=yes -else - have_krb=no -fi - - if test $have_krb = yes; then - KRB4LIB=-lkrb - LIBS="$KRB4LIB $LIBS" - -$as_echo "#define HAVE_LIBKRB 1" >>confdefs.h - - fi - fi - fi - - if test "${with_kerberos5}" != no; then - for ac_header in krb5.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "krb5.h" "ac_cv_header_krb5_h" "$ac_includes_default" -if test "x$ac_cv_header_krb5_h" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_KRB5_H 1 -_ACEOF - ac_fn_c_check_member "$LINENO" "krb5_error" "text" "ac_cv_member_krb5_error_text" "#include -" -if test "x$ac_cv_member_krb5_error_text" = x""yes; then : - -cat >>confdefs.h <<_ACEOF -#define HAVE_KRB5_ERROR_TEXT 1 -_ACEOF - - -fi -ac_fn_c_check_member "$LINENO" "krb5_error" "e_text" "ac_cv_member_krb5_error_e_text" "#include -" -if test "x$ac_cv_member_krb5_error_e_text" = x""yes; then : - -cat >>confdefs.h <<_ACEOF -#define HAVE_KRB5_ERROR_E_TEXT 1 -_ACEOF - - -fi - -fi - -done - - else - for ac_header in des.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "des.h" "ac_cv_header_des_h" "$ac_includes_default" -if test "x$ac_cv_header_des_h" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_DES_H 1 -_ACEOF - -else - for ac_header in kerberosIV/des.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "kerberosIV/des.h" "ac_cv_header_kerberosIV_des_h" "$ac_includes_default" -if test "x$ac_cv_header_kerberosIV_des_h" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_KERBEROSIV_DES_H 1 -_ACEOF - -else - for ac_header in kerberos/des.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "kerberos/des.h" "ac_cv_header_kerberos_des_h" "$ac_includes_default" -if test "x$ac_cv_header_kerberos_des_h" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_KERBEROS_DES_H 1 -_ACEOF - -fi - -done - -fi - -done - -fi - -done - - for ac_header in krb.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "krb.h" "ac_cv_header_krb_h" "$ac_includes_default" -if test "x$ac_cv_header_krb_h" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_KRB_H 1 -_ACEOF - -else - for ac_header in kerberosIV/krb.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "kerberosIV/krb.h" "ac_cv_header_kerberosIV_krb_h" "$ac_includes_default" -if test "x$ac_cv_header_kerberosIV_krb_h" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_KERBEROSIV_KRB_H 1 -_ACEOF - -else - for ac_header in kerberos/krb.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "kerberos/krb.h" "ac_cv_header_kerberos_krb_h" "$ac_includes_default" -if test "x$ac_cv_header_kerberos_krb_h" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_KERBEROS_KRB_H 1 -_ACEOF - -fi - -done - -fi - -done - -fi - -done - - fi - for ac_header in com_err.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "com_err.h" "ac_cv_header_com_err_h" "$ac_includes_default" -if test "x$ac_cv_header_com_err_h" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_COM_ERR_H 1 -_ACEOF - -fi - -done - -fi - - - - - - - -# Solaris requires -lintl if you want strerror (which calls dgettext) -# to return localized messages. -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for dgettext in -lintl" >&5 -$as_echo_n "checking for dgettext in -lintl... " >&6; } -if test "${ac_cv_lib_intl_dgettext+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - ac_check_lib_save_LIBS=$LIBS -LIBS="-lintl $LIBS" -cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -/* Override any GCC internal prototype to avoid an error. - Use char because int might match the return type of a GCC - builtin and then its argument prototype would still apply. */ -#ifdef __cplusplus -extern "C" -#endif -char dgettext (); -int -main () -{ -return dgettext (); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - ac_cv_lib_intl_dgettext=yes -else - ac_cv_lib_intl_dgettext=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext -LIBS=$ac_check_lib_save_LIBS -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_intl_dgettext" >&5 -$as_echo "$ac_cv_lib_intl_dgettext" >&6; } -if test "x$ac_cv_lib_intl_dgettext" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_LIBINTL 1 -_ACEOF - - LIBS="-lintl $LIBS" - -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether localtime caches TZ" >&5 -$as_echo_n "checking whether localtime caches TZ... " >&6; } -if test "${emacs_cv_localtime_cache+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test x$ac_cv_func_tzset = xyes; then -if test "$cross_compiling" = yes; then : - # If we have tzset, assume the worst when cross-compiling. -emacs_cv_localtime_cache=yes -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -char TZ_GMT0[] = "TZ=GMT0"; -char TZ_PST8[] = "TZ=PST8"; -main() -{ - time_t now = time ((time_t *) 0); - int hour_GMT0, hour_unset; - if (putenv (TZ_GMT0) != 0) - exit (1); - hour_GMT0 = localtime (&now)->tm_hour; - unsetenv("TZ"); - hour_unset = localtime (&now)->tm_hour; - if (putenv (TZ_PST8) != 0) - exit (1); - if (localtime (&now)->tm_hour == hour_GMT0) - exit (1); - unsetenv("TZ"); - if (localtime (&now)->tm_hour != hour_unset) - exit (1); - exit (0); -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - emacs_cv_localtime_cache=no -else - emacs_cv_localtime_cache=yes -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -else - # If we lack tzset, report that localtime does not cache TZ, - # since we can't invalidate the cache if we don't have tzset. - emacs_cv_localtime_cache=no -fi -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_localtime_cache" >&5 -$as_echo "$emacs_cv_localtime_cache" >&6; } -if test $emacs_cv_localtime_cache = yes; then - -$as_echo "#define LOCALTIME_CACHE 1" >>confdefs.h - -fi - -if test "x$HAVE_TIMEVAL" = xyes; then - for ac_func in gettimeofday -do : - ac_fn_c_check_func "$LINENO" "gettimeofday" "ac_cv_func_gettimeofday" -if test "x$ac_cv_func_gettimeofday" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_GETTIMEOFDAY 1 -_ACEOF - -fi -done - - if test $ac_cv_func_gettimeofday = yes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gettimeofday can accept two arguments" >&5 -$as_echo_n "checking whether gettimeofday can accept two arguments... " >&6; } -if test "${emacs_cv_gettimeofday_two_arguments+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ - -#ifdef TIME_WITH_SYS_TIME -#include -#include -#else -#ifdef HAVE_SYS_TIME_H -#include -#else -#include -#endif -#endif -int -main () -{ -struct timeval time; - gettimeofday (&time, 0); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - emacs_cv_gettimeofday_two_arguments=yes -else - emacs_cv_gettimeofday_two_arguments=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_gettimeofday_two_arguments" >&5 -$as_echo "$emacs_cv_gettimeofday_two_arguments" >&6; } - if test $emacs_cv_gettimeofday_two_arguments = no; then - -$as_echo "#define GETTIMEOFDAY_ONE_ARGUMENT 1" >>confdefs.h - - fi - fi -fi - -ok_so_far=yes -ac_fn_c_check_func "$LINENO" "socket" "ac_cv_func_socket" -if test "x$ac_cv_func_socket" = x""yes; then : - -else - ok_so_far=no -fi - -if test $ok_so_far = yes; then - ac_fn_c_check_header_mongrel "$LINENO" "netinet/in.h" "ac_cv_header_netinet_in_h" "$ac_includes_default" -if test "x$ac_cv_header_netinet_in_h" = x""yes; then : - -else - ok_so_far=no -fi - - -fi -if test $ok_so_far = yes; then - ac_fn_c_check_header_mongrel "$LINENO" "arpa/inet.h" "ac_cv_header_arpa_inet_h" "$ac_includes_default" -if test "x$ac_cv_header_arpa_inet_h" = x""yes; then : - -else - ok_so_far=no -fi - - -fi -if test $ok_so_far = yes; then - -$as_echo "#define HAVE_INET_SOCKETS 1" >>confdefs.h - -fi - -if test -f /usr/lpp/X11/bin/smt.exp; then - -$as_echo "#define HAVE_AIX_SMT_EXP 1" >>confdefs.h - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether system supports dynamic ptys" >&5 -$as_echo_n "checking whether system supports dynamic ptys... " >&6; } -if test -d /dev/pts && ls -d /dev/ptmx > /dev/null 2>&1 ; then - { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 -$as_echo "yes" >&6; } - -$as_echo "#define HAVE_DEV_PTMX 1" >>confdefs.h - -else - { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 -$as_echo "no" >&6; } -fi - -ac_fn_c_check_type "$LINENO" "pid_t" "ac_cv_type_pid_t" "$ac_includes_default" -if test "x$ac_cv_type_pid_t" = x""yes; then : - -else - -cat >>confdefs.h <<_ACEOF -#define pid_t int -_ACEOF - -fi - -for ac_header in vfork.h -do : - ac_fn_c_check_header_mongrel "$LINENO" "vfork.h" "ac_cv_header_vfork_h" "$ac_includes_default" -if test "x$ac_cv_header_vfork_h" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define HAVE_VFORK_H 1 -_ACEOF - -fi - -done - -for ac_func in fork vfork -do : - as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` -ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" -eval as_val=\$$as_ac_var - if test "x$as_val" = x""yes; then : - cat >>confdefs.h <<_ACEOF -#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1 -_ACEOF - -fi -done - -if test "x$ac_cv_func_fork" = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working fork" >&5 -$as_echo_n "checking for working fork... " >&6; } -if test "${ac_cv_func_fork_works+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - ac_cv_func_fork_works=cross -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -int -main () -{ - - /* By Ruediger Kuhlmann. */ - return fork () < 0; - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_func_fork_works=yes -else - ac_cv_func_fork_works=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_fork_works" >&5 -$as_echo "$ac_cv_func_fork_works" >&6; } - -else - ac_cv_func_fork_works=$ac_cv_func_fork -fi -if test "x$ac_cv_func_fork_works" = xcross; then - case $host in - *-*-amigaos* | *-*-msdosdjgpp*) - # Override, as these systems have only a dummy fork() stub - ac_cv_func_fork_works=no - ;; - *) - ac_cv_func_fork_works=yes - ;; - esac - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&5 -$as_echo "$as_me: WARNING: result $ac_cv_func_fork_works guessed because of cross compilation" >&2;} -fi -ac_cv_func_vfork_works=$ac_cv_func_vfork -if test "x$ac_cv_func_vfork" = xyes; then - { $as_echo "$as_me:${as_lineno-$LINENO}: checking for working vfork" >&5 -$as_echo_n "checking for working vfork... " >&6; } -if test "${ac_cv_func_vfork_works+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - if test "$cross_compiling" = yes; then : - ac_cv_func_vfork_works=cross -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -/* Thanks to Paul Eggert for this test. */ -$ac_includes_default -#include -#ifdef HAVE_VFORK_H -# include -#endif -/* On some sparc systems, changes by the child to local and incoming - argument registers are propagated back to the parent. The compiler - is told about this with #include , but some compilers - (e.g. gcc -O) don't grok . Test for this by using a - static variable whose address is put into a register that is - clobbered by the vfork. */ -static void -#ifdef __cplusplus -sparc_address_test (int arg) -# else -sparc_address_test (arg) int arg; -#endif -{ - static pid_t child; - if (!child) { - child = vfork (); - if (child < 0) { - perror ("vfork"); - _exit(2); - } - if (!child) { - arg = getpid(); - write(-1, "", 0); - _exit (arg); - } - } -} - -int -main () -{ - pid_t parent = getpid (); - pid_t child; - - sparc_address_test (0); - - child = vfork (); - - if (child == 0) { - /* Here is another test for sparc vfork register problems. This - test uses lots of local variables, at least as many local - variables as main has allocated so far including compiler - temporaries. 4 locals are enough for gcc 1.40.3 on a Solaris - 4.1.3 sparc, but we use 8 to be safe. A buggy compiler should - reuse the register of parent for one of the local variables, - since it will think that parent can't possibly be used any more - in this routine. Assigning to the local variable will thus - munge parent in the parent process. */ - pid_t - p = getpid(), p1 = getpid(), p2 = getpid(), p3 = getpid(), - p4 = getpid(), p5 = getpid(), p6 = getpid(), p7 = getpid(); - /* Convince the compiler that p..p7 are live; otherwise, it might - use the same hardware register for all 8 local variables. */ - if (p != p1 || p != p2 || p != p3 || p != p4 - || p != p5 || p != p6 || p != p7) - _exit(1); - - /* On some systems (e.g. IRIX 3.3), vfork doesn't separate parent - from child file descriptors. If the child closes a descriptor - before it execs or exits, this munges the parent's descriptor - as well. Test for this by closing stdout in the child. */ - _exit(close(fileno(stdout)) != 0); - } else { - int status; - struct stat st; - - while (wait(&status) != child) - ; - return ( - /* Was there some problem with vforking? */ - child < 0 - - /* Did the child fail? (This shouldn't happen.) */ - || status - - /* Did the vfork/compiler bug occur? */ - || parent != getpid() - - /* Did the file descriptor bug occur? */ - || fstat(fileno(stdout), &st) != 0 - ); - } -} -_ACEOF -if ac_fn_c_try_run "$LINENO"; then : - ac_cv_func_vfork_works=yes -else - ac_cv_func_vfork_works=no -fi -rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ - conftest.$ac_objext conftest.beam conftest.$ac_ext -fi - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_vfork_works" >&5 -$as_echo "$ac_cv_func_vfork_works" >&6; } - -fi; -if test "x$ac_cv_func_fork_works" = xcross; then - ac_cv_func_vfork_works=$ac_cv_func_vfork - { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&5 -$as_echo "$as_me: WARNING: result $ac_cv_func_vfork_works guessed because of cross compilation" >&2;} -fi - -if test "x$ac_cv_func_vfork_works" = xyes; then - -$as_echo "#define HAVE_WORKING_VFORK 1" >>confdefs.h - -else - -$as_echo "#define vfork fork" >>confdefs.h - -fi -if test "x$ac_cv_func_fork_works" = xyes; then - -$as_echo "#define HAVE_WORKING_FORK 1" >>confdefs.h - -fi - - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for nl_langinfo and CODESET" >&5 -$as_echo_n "checking for nl_langinfo and CODESET... " >&6; } -if test "${emacs_cv_langinfo_codeset+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -#include -int -main () -{ -char* cs = nl_langinfo(CODESET); - ; - return 0; -} -_ACEOF -if ac_fn_c_try_link "$LINENO"; then : - emacs_cv_langinfo_codeset=yes -else - emacs_cv_langinfo_codeset=no -fi -rm -f core conftest.err conftest.$ac_objext \ - conftest$ac_exeext conftest.$ac_ext - -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_langinfo_codeset" >&5 -$as_echo "$emacs_cv_langinfo_codeset" >&6; } -if test $emacs_cv_langinfo_codeset = yes; then - -$as_echo "#define HAVE_LANGINFO_CODESET 1" >>confdefs.h - -fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for mbstate_t" >&5 -$as_echo_n "checking for mbstate_t... " >&6; } -if test "${ac_cv_type_mbstate_t+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -$ac_includes_default -# include -int -main () -{ -mbstate_t x; return sizeof x; - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - ac_cv_type_mbstate_t=yes -else - ac_cv_type_mbstate_t=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_mbstate_t" >&5 -$as_echo "$ac_cv_type_mbstate_t" >&6; } - if test $ac_cv_type_mbstate_t = yes; then - -$as_echo "#define HAVE_MBSTATE_T 1" >>confdefs.h - - else - -$as_echo "#define mbstate_t int" >>confdefs.h - - fi - -{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C restricted array declarations" >&5 -$as_echo_n "checking for C restricted array declarations... " >&6; } -if test "${emacs_cv_c_restrict_arr+set}" = set; then : - $as_echo_n "(cached) " >&6 -else - cat confdefs.h - <<_ACEOF >conftest.$ac_ext -/* end confdefs.h. */ -void fred (int x[__restrict]); -int -main () -{ - - ; - return 0; -} -_ACEOF -if ac_fn_c_try_compile "$LINENO"; then : - emacs_cv_c_restrict_arr=yes -else - emacs_cv_c_restrict_arr=no -fi -rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext -fi -{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_c_restrict_arr" >&5 -$as_echo "$emacs_cv_c_restrict_arr" >&6; } -if test "$emacs_cv_c_restrict_arr" = yes; then - -$as_echo "#define __restrict_arr __restrict" >>confdefs.h - -fi - - - -# Set up the CFLAGS for real compilation, so we can substitute it. -CFLAGS="$REAL_CFLAGS" -CPPFLAGS="$REAL_CPPFLAGS" - -## Hack to detect a buggy GCC version. -if test "x$GCC" = xyes \ - && test x"`$CC --version 2> /dev/null | grep 'gcc.* 4.5.0'`" != x \ - && test x"`echo $CFLAGS | grep '\-O[23]'`" != x \ - && test x"`echo $CFLAGS | grep '\-fno-optimize-sibling-calls'`" = x; then - as_fn_error "GCC 4.5.0 has problems compiling Emacs; see etc/PROBLEMS'." "$LINENO" 5 -fi - -version=$PACKAGE_VERSION - -### Specify what sort of things we'll be editing into Makefile and config.h. -### Use configuration here uncanonicalized to avoid exceeding size limits. - - -## Unused? - - - - - - - - - - - - - - - - - - - - -## FIXME? Nothing uses @LD_SWITCH_X_SITE@. -## src/Makefile.in did add LD_SWITCH_X_SITE (as a cpp define) to the -## end of LIBX_BASE, but nothing ever set it. - - - - -## Used in lwlib/Makefile.in. - -if test -n "${machfile}"; then - M_FILE="\$(srcdir)/${machfile}" -else - M_FILE= -fi -S_FILE="\$(srcdir)/${opsysfile}" - - - - - - - - - - -cat >>confdefs.h <<_ACEOF -#define EMACS_CONFIGURATION "${canonical}" -_ACEOF - - -cat >>confdefs.h <<_ACEOF -#define EMACS_CONFIG_OPTIONS "${ac_configure_args}" -_ACEOF - -if test -n "$machfile"; then - -cat >>confdefs.h <<_ACEOF -#define config_machfile "${machfile}" -_ACEOF - -fi - -cat >>confdefs.h <<_ACEOF -#define config_opsysfile "${opsysfile}" -_ACEOF - - -XMENU_OBJ= -XOBJ= -FONT_OBJ= -if test "${HAVE_X_WINDOWS}" = "yes" ; then - -$as_echo "#define HAVE_X_WINDOWS 1" >>confdefs.h - - XMENU_OBJ=xmenu.o - XOBJ="xterm.o xfns.o xselect.o xrdb.o fontset.o xsmfns.o fringe.o image.o xsettings.o xgselect.o" - FONT_OBJ=xfont.o - if test "$HAVE_XFT" = "yes"; then - FONT_OBJ="$FONT_OBJ ftfont.o xftfont.o ftxfont.o" - elif test "$HAVE_FREETYPE" = "yes"; then - FONT_OBJ="$FONT_OBJ ftfont.o ftxfont.o" - fi - -fi - - - - -WIDGET_OBJ= -MOTIF_LIBW= -if test "${USE_X_TOOLKIT}" != "none" ; then - WIDGET_OBJ=widget.o - -$as_echo "#define USE_X_TOOLKIT 1" >>confdefs.h - - if test "${USE_X_TOOLKIT}" = "LUCID"; then - -$as_echo "#define USE_LUCID 1" >>confdefs.h - - elif test "${USE_X_TOOLKIT}" = "MOTIF"; then - -$as_echo "#define USE_MOTIF 1" >>confdefs.h - - MOTIF_LIBW=-lXm - case "$opsys" in - gnu-linux) - ## Paul Abrahams says this is needed. - MOTIF_LIBW="$MOTIF_LIBW -lXpm" - ;; - - unixware) - ## Richard Anthony Ryan - ## says -lXimp is needed in UNIX_SV ... 4.2 1.1.2. - MOTIF_LIBW="MOTIF_LIBW -lXimp" - ;; - - aix4-2) - ## olson@mcs.anl.gov says -li18n is needed by -lXm. - MOTIF_LIBW="$MOTIF_LIBW -li18n" - ;; - esac - MOTIF_LIBW="$MOTIF_LIBW $LIBXP" - fi -fi - - -TOOLKIT_LIBW= -case "$USE_X_TOOLKIT" in - MOTIF) TOOLKIT_LIBW="$MOTIF_LIBW" ;; - LUCID) TOOLKIT_LIBW="$LUCID_LIBW" ;; - none) test "x$HAVE_GTK" = "xyes" && TOOLKIT_LIBW="$GTK_LIBS -lXcomposite" ;; -esac - - -if test "$USE_X_TOOLKIT" = "none"; then - LIBXT_OTHER="\$(LIBXSM)" - OLDXMENU_TARGET="really-oldXMenu" -else - LIBXT_OTHER="\$(LIBXMU) -lXt \$(LIBXTR6) -lXext" - OLDXMENU_TARGET="really-lwlib" -fi - - -## The X Menu stuff is present in the X10 distribution, but missing -## from X11. If we have X10, just use the installed library; -## otherwise, use our own copy. -if test "${HAVE_X11}" = "yes" ; then - -$as_echo "#define HAVE_X11 1" >>confdefs.h - - - if test "$USE_X_TOOLKIT" = "none"; then - OLDXMENU="\${oldXMenudir}/libXMenu11.a" - else - OLDXMENU="\${lwlibdir}/liblw.a" - fi - LIBXMENU="\$(OLDXMENU)" - LIBX_OTHER="\$(LIBXT) \$(LIBX_EXTRA)" - OLDXMENU_DEPS="\${OLDXMENU} ../src/\${OLDXMENU}" -else - ## For a syntactically valid Makefile; not actually used for anything. - ## See comments in src/Makefile.in. - OLDXMENU=nothing - ## FIXME This case (!HAVE_X11 && HAVE_X_WINDOWS) is no longer possible(?). - if test "${HAVE_X_WINDOWS}" = "yes"; then - LIBXMENU="-lXMenu" - else - LIBXMENU= - fi - LIBX_OTHER= - OLDXMENU_DEPS= -fi - -if test "$HAVE_GTK" = "yes" || test "$HAVE_MENUS" != "yes"; then - OLDXMENU_TARGET= - OLDXMENU=nothing - LIBXMENU= - OLDXMENU_DEPS= -fi - - - - - - - -if test "${HAVE_MENUS}" = "yes" ; then - -$as_echo "#define HAVE_MENUS 1" >>confdefs.h - -fi - -if test "${GNU_MALLOC}" = "yes" ; then - -$as_echo "#define GNU_MALLOC 1" >>confdefs.h - -fi - -RALLOC_OBJ= -if test "${REL_ALLOC}" = "yes" ; then - -$as_echo "#define REL_ALLOC 1" >>confdefs.h - - - test "$system_malloc" != "yes" && RALLOC_OBJ=ralloc.o -fi - - -if test "$opsys" = "cygwin"; then - CYGWIN_OBJ="sheap.o" - ## Cygwin differs because of its unexec(). - PRE_ALLOC_OBJ= - POST_ALLOC_OBJ=lastfile.o -else - CYGWIN_OBJ= - PRE_ALLOC_OBJ=lastfile.o - POST_ALLOC_OBJ= -fi - - - - +CFLAGS=$SAVE_CFLAGS +LIBS=$SAVE_LIBS case "$opsys" in aix4-2) LD_SWITCH_SYSTEM_TEMACS="-Wl,-bnodelcsect" ;; @@ -25753,7 +24045,7 @@ case "$opsys" in libs_nsgui= headerpad_extra=690 fi - LD_SWITCH_SYSTEM_TEMACS="-prebind $libs_nsgui -Xlinker -headerpad -Xlinker $headerpad_extra" + LD_SWITCH_SYSTEM_TEMACS="-fno-pie -prebind $libs_nsgui -Xlinker -headerpad -Xlinker $headerpad_extra" ## This is here because src/Makefile.in did some extra fiddling around ## with LD_SWITCH_SYSTEM. The cpp logic was: @@ -25890,7 +24182,11 @@ fi #### It makes printing result more understandable as using GTK sets #### toolkit_scroll_bars to yes by default. if test "${HAVE_GTK}" = "yes"; then - USE_X_TOOLKIT=GTK + if test "${with_gtk3}" = "yes"; then + USE_X_TOOLKIT=GTK3 + else + USE_X_TOOLKIT=GTK + fi fi echo " @@ -25927,6 +24223,7 @@ echo " Does Emacs use imagemagick? ${HAVE_IMAGEMAGI echo " Does Emacs use -lgpm? ${HAVE_GPM}" echo " Does Emacs use -ldbus? ${HAVE_DBUS}" echo " Does Emacs use -lgconf? ${HAVE_GCONF}" +echo " Does Emacs use GSettings? ${HAVE_GSETTINGS}" echo " Does Emacs use -lselinux? ${HAVE_LIBSELINUX}" echo " Does Emacs use -lgnutls? ${HAVE_GNUTLS}" echo " Does Emacs use -lxml2? ${HAVE_LIBXML2}" @@ -25946,11 +24243,6 @@ if test -n "${EMACSDOC}"; then echo " Environment variable EMACSDOC set to: $EMACSDOC" fi -if test $USE_XASSERTS = yes; then - echo " Compiling with asserts turned on." - CPPFLAGS="$CPPFLAGS -DXASSERTS=1" -fi - echo if test "$HAVE_NS" = "yes"; then @@ -26173,31 +24465,18 @@ if test -z "${gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36_TRUE}" && test as_fn_error "conditional \"gl_GNULIB_ENABLED_be453cec5eecf5731a274f2de7f2db36\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -<<<<<<< TREE -<<<<<<< TREE -======= -======= if test -z "${gl_GNULIB_ENABLED_pathmax_TRUE}" && test -z "${gl_GNULIB_ENABLED_pathmax_FALSE}"; then as_fn_error "conditional \"gl_GNULIB_ENABLED_pathmax\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi ->>>>>>> MERGE-SOURCE -if test -z "${gl_GNULIB_ENABLED_sigprocmask_TRUE}" && test -z "${gl_GNULIB_ENABLED_sigprocmask_FALSE}"; then - as_fn_error "conditional \"gl_GNULIB_ENABLED_sigprocmask\" was never defined. -Usually this means the macro was only invoked conditionally." "$LINENO" 5 -fi ->>>>>>> MERGE-SOURCE if test -z "${gl_GNULIB_ENABLED_stat_TRUE}" && test -z "${gl_GNULIB_ENABLED_stat_FALSE}"; then as_fn_error "conditional \"gl_GNULIB_ENABLED_stat\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi -<<<<<<< TREE -======= if test -z "${gl_GNULIB_ENABLED_strtoll_TRUE}" && test -z "${gl_GNULIB_ENABLED_strtoll_FALSE}"; then as_fn_error "conditional \"gl_GNULIB_ENABLED_strtoll\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 fi ->>>>>>> MERGE-SOURCE if test -z "${gl_GNULIB_ENABLED_strtoull_TRUE}" && test -z "${gl_GNULIB_ENABLED_strtoull_FALSE}"; then as_fn_error "conditional \"gl_GNULIB_ENABLED_strtoull\" was never defined. Usually this means the macro was only invoked conditionally." "$LINENO" 5 @@ -27626,4 +25905,3 @@ if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} fi - diff --git a/configure.ac b/configure.ac index 605f73c5da3..ad47a381133 100644 --- a/configure.ac +++ b/configure.ac @@ -707,6 +707,7 @@ else nw="$nw -Wswitch-default" # Too many warnings for now nw="$nw -Wfloat-equal" # warns about high-quality code nw="$nw -Winline" # OK to ignore 'inline' + nw="$nw -Wjump-misses-init" # We sometimes safely jump over init. nw="$nw -Wsync-nand" # irrelevant here, and provokes ObjC warning nw="$nw -Wunsafe-loop-optimizations" # OK to suppress unsafe optimizations @@ -1303,17 +1304,6 @@ if test $emacs_cv_speed_t = yes; then [Define to 1 if `speed_t' is declared by .]) fi -AC_CACHE_CHECK(for struct exception, emacs_cv_struct_exception, -AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include ]], -[[static struct exception x; x.arg1 = x.arg2 = x.retval; x.name = ""; x.type = 1;]])], - emacs_cv_struct_exception=yes, emacs_cv_struct_exception=no)) -HAVE_EXCEPTION=$emacs_cv_struct_exception -dnl Define on Darwin so emacs symbols will not conflict with those -dnl in the System framework. Otherwise -prebind will not work. -if test $emacs_cv_struct_exception != yes || test $opsys = darwin; then - AC_DEFINE(NO_MATHERR, 1, [Define to 1 if you don't have struct exception in math.h.]) -fi - AC_CHECK_HEADERS_ONCE(sys/socket.h) AC_CHECK_HEADERS(net/if.h, , , [AC_INCLUDES_DEFAULT #if HAVE_SYS_SOCKET_H @@ -2841,7 +2831,7 @@ AC_SUBST(BLESSMAIL_TARGET) AC_CHECK_FUNCS(gethostname \ closedir getrusage get_current_dir_name \ -lrand48 logb frexp fmod cbrt setsid \ +lrand48 logb cbrt setsid \ fpathconf select euidaccess getpagesize setlocale \ utimes getrlimit setrlimit setpgid getcwd shutdown getaddrinfo \ __fpending strsignal setitimer \ @@ -3271,12 +3261,6 @@ AC_DEFINE(CLASH_DETECTION, 1, [Define if you want lock files to be written, so that Emacs can tell instantly when you try to modify a file that someone else has modified in his/her Emacs.]) -AH_TEMPLATE(FLOAT_CHECK_DOMAIN, [Define if the float library doesn't - handle errors by either setting errno, or signaling SIGFPE/SIGILL.]) - -AH_TEMPLATE(HAVE_INVERSE_HYPERBOLIC, [Define if you have the functions - acosh, asinh, and atanh.]) - dnl Everybody supports this, except MS. dnl Seems like the kind of thing we should be testing for, though. ## Note: PTYs are broken on darwin <6. Use at your own risk. @@ -3411,12 +3395,6 @@ case $opsys in AC_DEFINE(BROKEN_PTY_READ_AFTER_EAGAIN, 1, [Define on FreeBSD to work around an issue when reading from a PTY.]) ;; - - dnl Define the following so emacs symbols will not conflict with those - dnl in the System framework. Otherwise -prebind will not work. - darwin) - AC_DEFINE(NO_ABORT, 1, [Do not define abort in emacs.c.]) - ;; esac case $opsys in @@ -3511,7 +3489,7 @@ case $opsys in cygwin ) AC_DEFINE(PTY_ITERATION, [int i; for (i = 0; i < 1; i++)]) dnl multi-line AC_DEFINEs are hard. :( - AC_DEFINE(PTY_OPEN, [ do { int dummy; SIGMASKTYPE mask; mask = sigblock (sigmask (SIGCHLD)); if (-1 == openpty (&fd, &dummy, pty_name, 0, 0)) fd = -1; sigsetmask (mask); if (fd >= 0) emacs_close (dummy); } while (0)]) + AC_DEFINE(PTY_OPEN, [ do { int dummy; sigset_t blocked, procmask; sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); pthread_sigmask (SIG_BLOCK, &blocked, &procmask); if (-1 == openpty (&fd, &dummy, pty_name, 0, 0)) fd = -1; pthread_sigmask (SIG_SETMASK, &procmask, 0); if (fd >= 0) emacs_close (dummy); } while (0)]) AC_DEFINE(PTY_NAME_SPRINTF, []) AC_DEFINE(PTY_TTY_NAME_SPRINTF, []) ;; @@ -3540,7 +3518,7 @@ case $opsys in AC_DEFINE(PTY_ITERATION, [int i; for (i = 0; i < 1; i++)]) dnl Note that grantpt and unlockpt may fork. We must block SIGCHLD dnl to prevent sigchld_handler from intercepting the child's death. - AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptyname; sigblock (sigmask (SIGCHLD)); if (grantpt (fd) == -1 || unlockpt (fd) == -1 || !(ptyname = ptsname(fd))) { sigunblock (sigmask (SIGCHLD)); close (fd); return -1; } snprintf (pty_name, sizeof pty_name, "%s", ptyname); sigunblock (sigmask (SIGCHLD)); }]) + AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptyname = 0; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCHLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); if (grantpt (fd) != -1 && unlockpt (fd) != -1) ptyname = ptsname(fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); if (!ptyname) { close (fd); return -1; } snprintf (pty_name, sizeof pty_name, "%s", ptyname); }]) dnl if HAVE_POSIX_OPENPT if test "x$ac_cv_func_posix_openpt" = xyes; then AC_DEFINE(PTY_OPEN, [fd = posix_openpt (O_RDWR | O_NOCTTY)]) @@ -3585,18 +3563,15 @@ case $opsys in ;; sol2* ) - dnl Uses sigblock/sigunblock rather than sighold/sigrelse, - dnl which appear to be BSD4.1 specific. It may also be appropriate - dnl for SVR4.x (x<2) but I'm not sure. fnf@cygnus.com dnl On SysVr4, grantpt(3) forks a subprocess, so keep sigchld_handler() dnl from intercepting that death. If any child but grantpt's should die dnl within, it should be caught after sigrelse(2). - AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptsname (int), *ptyname; sigblock (sigmask (SIGCLD)); if (grantpt (fd) == -1) { emacs_close (fd); return -1; } sigunblock (sigmask (SIGCLD)); if (unlockpt (fd) == -1) { emacs_close (fd); return -1; } if (!(ptyname = ptsname (fd))) { emacs_close (fd); return -1; } snprintf (pty_name, sizeof pty_name, "%s", ptyname); }]) + AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptsname (int), *ptyname; int grantpt_result; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); grantpt_result = grantpt (fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); if (grantpt_result == -1 || unlockpt (fd) == -1 || !(ptyname = ptsname (fd))) { emacs_close (fd); return -1; } snprintf (pty_name, sizeof pty_name, "%s", ptyname); }]) ;; unixware ) dnl Comments are as per sol2*. - AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptsname (int), *ptyname; sigblock(sigmask(SIGCLD)); if (grantpt(fd) == -1) fatal("could not grant slave pty"); sigunblock(sigmask(SIGCLD)); if (unlockpt(fd) == -1) fatal("could not unlock slave pty"); if (!(ptyname = ptsname(fd))) fatal ("could not enable slave pty"); snprintf (pty_name, sizeof pty_name, "%s", ptyname); }]) + AC_DEFINE(PTY_TTY_NAME_SPRINTF, [{ char *ptsname (int), *ptyname; int grantpt_result; sigset_t blocked; sigemptyset (&blocked); sigaddset (&blocked, SIGCLD); pthread_sigmask (SIG_BLOCK, &blocked, 0); grantpt_result = grantpt (fd); pthread_sigmask (SIG_UNBLOCK, &blocked, 0); if (grantpt_result == -1) fatal("could not grant slave pty"); if (unlockpt(fd) == -1) fatal("could not unlock slave pty"); if (!(ptyname = ptsname(fd))) fatal ("could not enable slave pty"); snprintf (pty_name, sizeof pty_name, "%s", ptyname); }]) ;; esac @@ -3851,13 +3826,27 @@ else esac fi dnl GCC? +AC_CACHE_CHECK([for _setjmp], [emacs_cv_func__setjmp], + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include + ]], + [[jmp_buf j; + if (! _setjmp (j)) + _longjmp (j, 1);]])], + [emacs_cv_func__setjmp=yes], + [emacs_cv_func__setjmp=no])]) +if test $emacs_cv_func__setjmp = no; then + AC_DEFINE([_setjmp], [setjmp], + [Define to setjmp if _setjmp and _longjmp do not work. See _longjmp.]) + AC_DEFINE([_longjmp], [longjmp], + [Define to longjmp if _setjmp and _longjmp do not work. + Because longjmp may alter signal masks, callers of _longjmp + should not assume that it leaves signal masks alone.]) +fi case $opsys in sol2* | unixware ) - dnl setjmp and longjmp can safely replace _setjmp and _longjmp, - dnl but they will run more slowly. - AC_DEFINE(_setjmp, setjmp, [Some platforms redefine this.]) - AC_DEFINE(_longjmp, longjmp, [Some platforms redefine this.]) dnl TIOCGPGRP is broken in SysVr4, so we can't send signals to PTY dnl subprocesses the usual way. But TIOCSIGNAL does work for PTYs, dnl and this is all we need. @@ -3872,13 +3861,6 @@ case $opsys in AC_DEFINE(XOS_NEEDS_TIME_H, 1, [Compensate for a bug in Xos.h on some systems, where it requires time.h.]) ;; - - netbsd | openbsd ) - dnl Greg A. Woods says we must include signal.h - dnl before syssignal.h is included, to work around interface conflicts - dnl that are handled with CPP __RENAME() macro in signal.h. - AC_DEFINE(SIGNAL_H_AHB, 1, [Define if AH_BOTTOM should include signal.h.]) - ;; esac diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index a4f9985ad85..508dbbf8021 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog @@ -1,8 +1,24 @@ +2012-09-08 Jambunathan K + + * regs.texi (Text Registers): `C-x r +' can now be used instead of + M-x append-to-register. New option `register-separator'. + (Number Registers): Mention that `C-x r +' is polymorphic. + +2012-09-07 Chong Yidong + + * windows.texi (Window Choice): Don't mention obsolete + display-buffer-reuse-frames. + +2012-09-04 Paul Eggert + + Give more-useful info on a fatal error (Bug#12328). + * trouble.texi (Crashing): New section, documenting this. + 2012-08-24 Michael Albinus - * cmdargs.texi (General Variables): Setting - $DBUS_SESSION_BUS_ADDRESS to a dummy value suppresses connections - to the D-Bus session bus. (Bug#12112) + * cmdargs.texi (General Variables): + Setting $DBUS_SESSION_BUS_ADDRESS to a dummy value suppresses + connections to the D-Bus session bus. (Bug#12112) 2012-08-14 Eli Zaretskii diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi index 6357aebc6ff..192a9a2bb28 100644 --- a/doc/emacs/emacs.texi +++ b/doc/emacs/emacs.texi @@ -1136,6 +1136,7 @@ Dealing with Emacs Trouble * Screen Garbled:: Garbage on the screen. * Text Garbled:: Garbage in the text. * Memory Full:: How to cope when you run out of memory. +* Crashing:: What Emacs does when it crashes. * After a Crash:: Recovering editing in an Emacs session that crashed. * Emergency Escape:: What to do if Emacs stops responding. @@ -1320,7 +1321,7 @@ when you get it, not just free for the manufacturer. If you find GNU Emacs useful, please @strong{send a donation} to the Free Software Foundation to support our work. Donations to the Free Software Foundation are tax deductible in the US. If you use GNU Emacs -at your workplace, please suggest that the company make a donation. +at your workplace, please suggest that the company make a donation. For more information on how you can help, see @url{http://www.gnu.org/help/help.html}. diff --git a/doc/emacs/regs.texi b/doc/emacs/regs.texi index 72fd6458dde..0a83c0bdddd 100644 --- a/doc/emacs/regs.texi +++ b/doc/emacs/regs.texi @@ -92,6 +92,13 @@ Copy region into register @var{r} (@code{copy-to-register}). Insert text from register @var{r} (@code{insert-register}). @item M-x append-to-register @key{RET} @var{r} Append region to text in register @var{r}. + +@kindex C-x r + +When register @var{r} contains text, you can use @kbd{C-x r +} +(@code{increment-register}) to append to that register. Note that +command @kbd{C-x r +} behaves differently if @var{r} contains a +number. @xref{Number Registers}. + @item M-x prepend-to-register @key{RET} @var{r} Prepend region to text in register @var{r}. @end table @@ -116,6 +123,19 @@ region after appending it to the register. The command the region text to the text in the register instead of @emph{appending} it. +@vindex register-separator + When you are collecting text using @code{append-to-register} and +@code{prepend-to-register}, you may want to separate individual +collected pieces using a separator. In that case, configure a +@code{register-separator} and store the separator text in to that +register. For example, to get double newlines as text separator +during the collection process, you can use the following setting. + +@example +(setq register-separator ?+) +(set-register register-separator "\n\n") +@end example + @kindex C-x r i @findex insert-register @kbd{C-x r i @var{r}} inserts in the buffer the text from register @@ -191,8 +211,10 @@ Store @var{number} into register @var{r} (@code{number-to-register}). @item C-u @var{number} C-x r + @var{r} @kindex C-x r + @findex increment-register -Increment the number in register @var{r} by @var{number} -(@code{increment-register}). +If @var{r} contains a number, increment the number in that register by +@var{number}. Note that command @kbd{C-x r +} +(@code{increment-register}) behaves differently if @var{r} contains +text. @xref{Text Registers}. @item C-x r i @var{r} Insert the number from register @var{r} into the buffer. @end table diff --git a/doc/emacs/trouble.texi b/doc/emacs/trouble.texi index 025185c583f..1806339e45d 100644 --- a/doc/emacs/trouble.texi +++ b/doc/emacs/trouble.texi @@ -149,6 +149,7 @@ Emacs. * Screen Garbled:: Garbage on the screen. * Text Garbled:: Garbage in the text. * Memory Full:: How to cope when you run out of memory. +* Crashing:: What Emacs does when it crashes. * After a Crash:: Recovering editing in an Emacs session that crashed. * Emergency Escape:: What to do if Emacs stops responding. @end menu @@ -277,6 +278,44 @@ editing in the same Emacs session. out of memory, because the buffer menu needs a fair amount of memory itself, and the reserve supply may not be enough. +@node Crashing +@subsection When Emacs Crashes + + Emacs is not supposed to crash, but if it does, before it exits it +reports some information about the crash to the standard error stream +@code{stderr}. This report may be useful to someone who later debugs +the same version of Emacs on the same platform. The format of this +report depends on the platform, and some platforms support backtraces. +Here is an example, generated on x86-64 GNU/Linux with version 2.15 of +the GNU C Library: + +@example +Fatal error 11: Segmentation fault +Backtrace: +emacs[0x5094e4] +emacs[0x4ed3e6] +emacs[0x4ed504] +/lib64/libpthread.so.0[0x375220efe0] +/lib64/libpthread.so.0(read+0xe)[0x375220e08e] +emacs[0x509af6] +emacs[0x5acc26] +emacs[0x5adbfb] +emacs[0x56566b] +emacs[0x59bac3] +emacs[0x565151] +... +@end example + +@noindent +The number @samp{11} is the system signal number that corresponds to +the problem, a segmentation fault here. The hexadecimal program +addresses can be useful in debugging sessions. For example, the GDB +command @samp{list *0x509af6} prints the source-code lines +corresponding to the @samp{emacs[0x509af6]} entry in the backtrace. + +The three dots at the end indicate that Emacs suppressed further +backtrace entries, in the interest of brevity. + @node After a Crash @subsection Recovery After a Crash diff --git a/doc/emacs/windows.texi b/doc/emacs/windows.texi index 2496a505063..04d1353006f 100644 --- a/doc/emacs/windows.texi +++ b/doc/emacs/windows.texi @@ -378,12 +378,10 @@ adding the desired buffer's name to the list expression to the list @code{same-window-regexps}. By default, these variables are @code{nil}, so this step is skipped. -@vindex display-buffer-reuse-frames @item Otherwise, if the buffer is already displayed in an existing window, ``reuse'' that window. Normally, only windows on the selected frame are considered, but windows on other frames are also reusable if you -change @code{display-buffer-reuse-frames} to @code{t}, or if you change @code{pop-up-frames} (see below) to @code{t}. @item diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index b0156e5ac7e..ceb199dae88 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -1,3 +1,43 @@ +2012-09-09 Chong Yidong + + * lists.texi (Sets And Lists): Explain that the return value for + delete should be used, like for delq. + + * minibuf.texi (Yes-or-No Queries): Document recentering and + scrolling in y-or-n-p. Remove gratuitous example. + + * searching.texi (Search and Replace): Document window scrolling + entries in query-replace-map. + +2012-09-08 Chong Yidong + + * syntax.texi (Syntax Table Internals): Define "raw syntax + descriptor" terminology (Bug#12383). + (Syntax Descriptors): Mention raw syntax descriptors. + +2012-09-07 Chong Yidong + + * variables.texi (Creating Buffer-Local): Fix description of + local-variable-if-set-p (Bug#10713). + + * eval.texi (Intro Eval): Add index entry for sexp (Bug#12233). + + * windows.texi (Display Action Functions) + (Choosing Window Options): Remove obsolete variable + display-buffer-reuse-frames. + (Switching Buffers): Minor doc tweak for switch-to-buffer. + + * positions.texi (Narrowing): Document buffer-narrowed-p. + + * markers.texi (Moving Markers): Add xref to Point (Bug#7151). + + * syntax.texi (Low-Level Parsing): Add xref to Parser State + (Bug#12269). + +2012-09-04 Lars Ingebrigtsen + + * debugging.texi (Explicit Debug): Document `debug-on-message'. + 2012-09-02 Chong Yidong * windows.texi (Window Configurations): Recommend against using diff --git a/doc/lispref/debugging.texi b/doc/lispref/debugging.texi index 00e8d84e9b3..5aeff576d09 100644 --- a/doc/lispref/debugging.texi +++ b/doc/lispref/debugging.texi @@ -298,6 +298,11 @@ of @code{(debug)} isn't ignored, it will alter the execution of the program!) The most common suitable places are inside a @code{progn} or an implicit @code{progn} (@pxref{Sequencing}). + If you don't know exactly where in the source code you want to put +the debug statement, but you want to display a backtrace when a +certain message is displayed, you can set @code{debug-on-message} to a +regular expression matching the desired message. + @node Using Debugger @subsection Using the Debugger diff --git a/doc/lispref/eval.texi b/doc/lispref/eval.texi index 6dc6287b803..b373ecfbe62 100644 --- a/doc/lispref/eval.texi +++ b/doc/lispref/eval.texi @@ -40,6 +40,7 @@ interpreter. @cindex form @cindex expression @cindex S-expression +@cindex sexp A Lisp object that is intended for evaluation is called a @dfn{form} or @dfn{expression}@footnote{It is sometimes also referred to as an @dfn{S-expression} or @dfn{sexp}, but we generally do not use this diff --git a/doc/lispref/lists.texi b/doc/lispref/lists.texi index 023f8ba18dd..d685ce0aa74 100644 --- a/doc/lispref/lists.texi +++ b/doc/lispref/lists.texi @@ -1293,14 +1293,19 @@ compare @var{object} against the elements of the list. For example: @defun delq object list @cindex deleting list elements This function destructively removes all elements @code{eq} to -@var{object} from @var{list}. The letter @samp{q} in @code{delq} says -that it uses @code{eq} to compare @var{object} against the elements of -the list, like @code{memq} and @code{remq}. +@var{object} from @var{list}, and returns the resulting list. The +letter @samp{q} in @code{delq} says that it uses @code{eq} to compare +@var{object} against the elements of the list, like @code{memq} and +@code{remq}. + +Typically, when you invoke @code{delq}, you should use the return +value by assigning it to the variable which held the original list. +The reason for this is explained below. @end defun -When @code{delq} deletes elements from the front of the list, it does so -simply by advancing down the list and returning a sublist that starts -after those elements: +The @code{delq} function deletes elements from the front of the list +by simply advancing down the list, and returning a sublist that starts +after those elements. For example: @example @group @@ -1308,6 +1313,7 @@ after those elements: @end group @end example +@noindent When an element to be deleted appears in the middle of the list, removing it involves changing the @sc{cdr}s (@pxref{Setcdr}). @@ -1432,12 +1438,15 @@ Compare this with @code{memq}: @end defun @defun delete object sequence -If @code{sequence} is a list, this function destructively removes all -elements @code{equal} to @var{object} from @var{sequence}. For lists, -@code{delete} is to @code{delq} as @code{member} is to @code{memq}: it -uses @code{equal} to compare elements with @var{object}, like -@code{member}; when it finds an element that matches, it cuts the -element out just as @code{delq} would. +This function removes all elements @code{equal} to @var{object} from +@var{sequence}, and returns the resulting sequence. + +If @var{sequence} is a list, @code{delete} is to @code{delq} as +@code{member} is to @code{memq}: it uses @code{equal} to compare +elements with @var{object}, like @code{member}; when it finds an +element that matches, it cuts the element out just as @code{delq} +would. As with @code{delq}, you should typically use the return value +by assigning it to the variable which held the original list. If @code{sequence} is a vector or string, @code{delete} returns a copy of @code{sequence} with all elements @code{equal} to @code{object} diff --git a/doc/lispref/markers.texi b/doc/lispref/markers.texi index 22e806defec..80136f2e6f4 100644 --- a/doc/lispref/markers.texi +++ b/doc/lispref/markers.texi @@ -355,9 +355,9 @@ the current buffer. If @var{position} is less than 1, @code{set-marker} moves @var{marker} to the beginning of the buffer. If @var{position} is greater than the -size of the buffer, @code{set-marker} moves marker to the end of the -buffer. If @var{position} is @code{nil} or a marker that points -nowhere, then @var{marker} is set to point nowhere. +size of the buffer (@pxref{Point}), @code{set-marker} moves marker to +the end of the buffer. If @var{position} is @code{nil} or a marker +that points nowhere, then @var{marker} is set to point nowhere. The value returned is @var{marker}. diff --git a/doc/lispref/minibuf.texi b/doc/lispref/minibuf.texi index 4cf096b8663..3d6e80bf3f0 100644 --- a/doc/lispref/minibuf.texi +++ b/doc/lispref/minibuf.texi @@ -1888,47 +1888,14 @@ Echo Area}), which uses the same screen space as the minibuffer. The cursor moves to the echo area while the question is being asked. The answers and their meanings, even @samp{y} and @samp{n}, are not -hardwired. The keymap @code{query-replace-map} specifies them. -@xref{Search and Replace}. - -In the following example, the user first types @kbd{q}, which is -invalid. At the next prompt the user types @kbd{y}. - -@c Need an interactive example, because otherwise the return value -@c obscures the display of the valid answer. -@smallexample -@group -(defun ask () - (interactive) - (y-or-n-p "Do you need a lift? ")) - -;; @r{After evaluation of the preceding definition, @kbd{M-x ask}} -;; @r{causes the following prompt to appear in the echo area:} -@end group - -@group ----------- Echo area ---------- -Do you need a lift? (y or n) ----------- Echo area ---------- -@end group - -;; @r{If the user then types @kbd{q}, the following appears:} - -@group ----------- Echo area ---------- -Please answer y or n. Do you need a lift? (y or n) ----------- Echo area ---------- -@end group - -;; @r{When the user types a valid answer,} -;; @r{it is displayed after the question:} - -@group ----------- Echo area ---------- -Do you need a lift? (y or n) y ----------- Echo area ---------- -@end group -@end smallexample +hardwired, and are specified by the keymap @code{query-replace-map} +(@pxref{Search and Replace}). In particular, if the user enters the +special responses @code{recenter}, @code{scroll-up}, +@code{scroll-down}, @code{scroll-other-window}, or +@code{scroll-other-window-down} (respectively bound to @kbd{C-l}, +@kbd{C-v}, @kbd{M-v}, @kbd{C-M-v} and @kbd{C-M-S-v} in +@code{query-replace-map}), this function performs the specified window +recentering or scrolling operation, and poses the question again. @noindent We show successive lines of echo area messages, but only one actually diff --git a/doc/lispref/positions.texi b/doc/lispref/positions.texi index a0c65319850..c4576e6456d 100644 --- a/doc/lispref/positions.texi +++ b/doc/lispref/positions.texi @@ -874,18 +874,18 @@ commands to a limited range of characters in a buffer. The text that remains addressable is called the @dfn{accessible portion} of the buffer. - Narrowing is specified with two buffer positions which become the -beginning and end of the accessible portion. For most editing commands -and most Emacs primitives, these positions replace the values of the -beginning and end of the buffer. While narrowing is in effect, no text -outside the accessible portion is displayed, and point cannot move -outside the accessible portion. + Narrowing is specified with two buffer positions, which become the +beginning and end of the accessible portion. For most editing +commands and primitives, these positions replace the values of the +beginning and end of the buffer. While narrowing is in effect, no +text outside the accessible portion is displayed, and point cannot +move outside the accessible portion. Note that narrowing does not +alter actual buffer positions (@pxref{Point}); it only determines +which positions are considered the accessible portion of the buffer. +Most functions refuse to operate on text that is outside the +accessible portion. - Values such as positions or line numbers, which usually count from the -beginning of the buffer, do so despite narrowing, but the functions -which use them refuse to operate on text that is inaccessible. - - The commands for saving buffers are unaffected by narrowing; they save + Commands for saving buffers are unaffected by narrowing; they save the entire buffer regardless of any narrowing. If you need to display in a single buffer several very different @@ -924,6 +924,11 @@ It is equivalent to the following expression: @end example @end deffn +@defun buffer-narrowed-p +This function returns non-@code{nil} if the buffer is narrowed, and +@code{nil} otherwise. +@end defun + @defspec save-restriction body@dots{} This special form saves the current bounds of the accessible portion, evaluates the @var{body} forms, and finally restores the saved bounds, diff --git a/doc/lispref/searching.texi b/doc/lispref/searching.texi index 0fa681ecb51..edd1d30e28d 100644 --- a/doc/lispref/searching.texi +++ b/doc/lispref/searching.texi @@ -1796,7 +1796,13 @@ Delete the text being considered, then enter a recursive edit to replace it. @item recenter -Redisplay and center the window, then ask the same question again. +@itemx scroll-up +@itemx scroll-down +@itemx scroll-other-window +@itemx scroll-other-window-down +Perform the specified window scroll operation, then ask the same +question again. Only @code{y-or-n-p} and related functions use this +answer. @item quit Perform a quit right away. Only @code{y-or-n-p} and related functions diff --git a/doc/lispref/syntax.texi b/doc/lispref/syntax.texi index ab685290901..624b5a92d6e 100644 --- a/doc/lispref/syntax.texi +++ b/doc/lispref/syntax.texi @@ -130,6 +130,10 @@ comment-ender), and the entry for @samp{/} is @samp{@w{. 14}} (i.e., punctuation, matching character slot unused, first character of a comment-starter, second character of a comment-ender). + Emacs also defines @dfn{raw syntax descriptors}, which are used to +describe syntax classes at a lower level. @xref{Syntax Table +Internals}. + @menu * Syntax Class Table:: Table of syntax classes. * Syntax Flags:: Additional flags each character can have. @@ -531,8 +535,9 @@ the current buffer's syntax table to determine the syntax for the underlying text character. @item @code{(@var{syntax-code} . @var{matching-char})} -A cons cell of this format specifies the syntax for the underlying -text character. (@pxref{Syntax Table Internals}) +A cons cell of this format is a raw syntax descriptor (@pxref{Syntax +Table Internals}), which directly specifies a syntax class for the +underlying text character. @item @code{nil} If the property is @code{nil}, the character's syntax is determined from @@ -878,6 +883,9 @@ This function parses a sexp in the current buffer starting at @var{start}, not scanning past @var{limit}. It stops at position @var{limit} or when certain criteria described below are met, and sets point to the location where parsing stops. It returns a parser state +@ifinfo +(@pxref{Parser State}) +@end ifinfo describing the status of the parse at the point where it stops. @cindex parenthesis depth @@ -937,16 +945,20 @@ documented in this section. This internal format can also be assigned as syntax properties (@pxref{Syntax Properties}). @cindex syntax code - Each entry in a syntax table is a cons cell of the form -@code{(@var{syntax-code} . @var{matching-char})}. @var{syntax-code} -is an integer that encodes the syntax class and syntax flags, -according to the table below. @var{matching-char}, if non-@code{nil}, -specifies a matching character (similar to the second character in a -syntax descriptor). +@cindex raw syntax descriptor + Each entry in a syntax table is a @dfn{raw syntax descriptor}: a +cons cell of the form @code{(@var{syntax-code} +. @var{matching-char})}. @var{syntax-code} is an integer which +encodes the syntax class and syntax flags, according to the table +below. @var{matching-char}, if non-@code{nil}, specifies a matching +character (similar to the second character in a syntax descriptor). + + Here are the syntax codes corresponding to the various syntax +classes: @multitable @columnfractions .2 .3 .2 .3 @item -@i{Syntax code} @tab @i{Class} @tab @i{Syntax code} @tab @i{Class} +@i{Code} @tab @i{Class} @tab @i{Code} @tab @i{Class} @item 0 @tab whitespace @tab 8 @tab paired delimiter @item @@ -967,7 +979,7 @@ syntax descriptor). @noindent For example, in the standard syntax table, the entry for @samp{(} is -@code{(4 . 41)}. (41 is the character code for @samp{)}.) +@code{(4 . 41)}. 41 is the character code for @samp{)}. Syntax flags are encoded in higher order bits, starting 16 bits from the least significant bit. This table gives the power of two which @@ -987,33 +999,35 @@ corresponds to each syntax flag. @end multitable @defun string-to-syntax @var{desc} -Given a syntax descriptor @var{desc}, this function returns the -corresponding internal form, a cons cell @code{(@var{syntax-code} -. @var{matching-char})}. +Given a syntax descriptor @var{desc} (a string), this function returns +the corresponding raw syntax descriptor. @end defun @defun syntax-after pos -This function returns the syntax code of the character in the buffer -after position @var{pos}, taking account of syntax properties as well -as the syntax table. If @var{pos} is outside the buffer's accessible -portion (@pxref{Narrowing, accessible portion}), this function returns -@code{nil}. +This function returns the raw syntax descriptor for the character in +the buffer after position @var{pos}, taking account of syntax +properties as well as the syntax table. If @var{pos} is outside the +buffer's accessible portion (@pxref{Narrowing, accessible portion}), +the return value is @code{nil}. @end defun @defun syntax-class syntax -This function returns the syntax class of the syntax code -@var{syntax}. (It masks off the high 16 bits that hold the flags -encoded in the syntax descriptor.) If @var{syntax} is @code{nil}, it -returns @code{nil}; this is so evaluating the expression +This function returns the syntax code for the raw syntax descriptor +@var{syntax}. More precisely, it takes the raw syntax descriptor's +@var{syntax-code} component, masks off the high 16 bits which record +the syntax flags, and returns the resulting integer. + +If @var{syntax} is @code{nil}, the return value is returns @code{nil}. +This is so that the expression @example (syntax-class (syntax-after pos)) @end example @noindent -where @code{pos} is outside the buffer's accessible portion, will -yield @code{nil} without throwing errors or producing wrong syntax -class codes. +evaluates to @code{nil} if @code{pos} is outside the buffer's +accessible portion, without throwing errors or returning an incorrect +code. @end defun @node Categories diff --git a/doc/lispref/variables.texi b/doc/lispref/variables.texi index 3b078e7e19f..c5b66757ace 100644 --- a/doc/lispref/variables.texi +++ b/doc/lispref/variables.texi @@ -1302,9 +1302,10 @@ This returns @code{t} if @var{variable} is buffer-local in buffer @end defun @defun local-variable-if-set-p variable &optional buffer -This returns @code{t} if @var{variable} will become buffer-local in -buffer @var{buffer} (which defaults to the current buffer) if it is -set there. +This returns @code{t} if @var{variable} either has a buffer-local +value in buffer @var{buffer}, or is automatically buffer-local. +Otherwise, it returns @code{nil}. If omitted or @code{nil}, +@var{buffer} defaults to the current buffer. @end defun @defun buffer-local-value variable buffer diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi index 5fe007ba02d..ea48a46359c 100644 --- a/doc/lispref/windows.texi +++ b/doc/lispref/windows.texi @@ -1492,12 +1492,10 @@ to make a buffer current to modify it in Lisp, use @code{set-buffer}. @xref{Current Buffer}. @deffn Command switch-to-buffer buffer-or-name &optional norecord force-same-window -This function displays @var{buffer-or-name} in the selected window, -and makes it the current buffer. (In contrast, @code{set-buffer} -makes the buffer current but does not display it; @pxref{Current -Buffer}). It is often used interactively (as the binding of @kbd{C-x -b}), as well as in Lisp programs. The return value is the buffer -switched to. +This command attempts to display @var{buffer-or-name} in the selected +window, and makes it the current buffer. It is often used +interactively (as the binding of @kbd{C-x b}), as well as in Lisp +programs. The return value is the buffer switched to. If @var{buffer-or-name} is @code{nil}, it defaults to the buffer returned by @code{other-buffer} (@pxref{The Buffer List}). If @@ -1506,17 +1504,18 @@ buffer, this function creates a new buffer with that name; the new buffer's major mode is determined by the variable @code{major-mode} (@pxref{Major Modes}). -Normally the specified buffer is put at the front of the buffer +Normally, the specified buffer is put at the front of the buffer list---both the global buffer list and the selected frame's buffer list (@pxref{The Buffer List}). However, this is not done if the optional argument @var{norecord} is non-@code{nil}. -If this function is unable to display the buffer in the selected -window---usually because the selected window is a minibuffer window or -is strongly dedicated to its buffer (@pxref{Dedicated Windows})---then -it normally tries to display the buffer in some other window, in the -manner of @code{pop-to-buffer} (see below). However, if the optional -argument @var{force-same-window} is non-@code{nil}, it signals an error +Sometimes, @code{switch-to-buffer} may be unable to display the buffer +in the selected window. This happens if the selected window is a +minibuffer window, or if the selected window is strongly dedicated to +its buffer (@pxref{Dedicated Windows}). In that case, the command +normally tries to display the buffer in some other window, by invoking +@code{pop-to-buffer} (see below). However, if the optional argument +@var{force-same-window} is non-@code{nil}, it signals an error instead. @end deffn @@ -1728,8 +1727,7 @@ A frame means consider windows on that frame only. @end itemize If @var{alist} contains no @code{reusable-frames} entry, this function -normally searches just the selected frame; however, if either the -variable @code{display-buffer-reuse-frames} or the variable +normally searches just the selected frame; however, if the variable @code{pop-up-frames} is non-@code{nil}, it searches all frames on the current terminal. @xref{Choosing Window Options}. @@ -1769,14 +1767,6 @@ The behavior of the standard display actions of @code{display-buffer} (@pxref{Choosing Window}) can be modified by a variety of user options. -@defopt display-buffer-reuse-frames -If the value of this variable is non-@code{nil}, @code{display-buffer} -may search all frames on the current terminal when looking for a -window already displaying the specified buffer. The default is -@code{nil}. This variable is consulted by the action function -@code{display-buffer-reuse-window} (@pxref{Display Action Functions}). -@end defopt - @defopt pop-up-windows If the value of this variable is non-@code{nil}, @code{display-buffer} is allowed to split an existing window to make a new window for diff --git a/etc/ChangeLog b/etc/ChangeLog index f3f244c7e39..aa788275256 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,8 @@ +2012-09-04 Paul Eggert + + Give more-useful info on a fatal error (Bug#12328). + * NEWS: Document the change. + 2012-09-01 Paul Eggert Better seeds for (random). diff --git a/etc/NEWS b/etc/NEWS index a2d0ffe232c..49860eab98a 100644 --- a/etc/NEWS +++ b/etc/NEWS @@ -78,6 +78,10 @@ been adding them there, put them somewhere else, eg site-lisp. * Changes in Emacs 24.3 +** You can now scroll the selected window in most y-or-n prompts. +Typing C-v or M-v at a prompt scrolls forward or backward +respectively, without leaving the y-or-n prompt. + ** Help changes *** `C-h f' (describe-function) can now perform autoloading. @@ -97,6 +101,11 @@ machines. Other functions that use this format, such as file-attributes and format-time-string, have been changed accordingly. Old-format time stamps are still accepted. +** Emacs now generates backtraces on fatal errors. +On encountering a fatal error, Emacs now outputs a textual description +of the fatal signal, and a short backtrace on platforms like glibc +that support backtraces. + ** New functions `system-users', `system-groups' return lists of the user name, group names known to the system (where possible). @@ -177,6 +186,14 @@ just removing them, as done by `yank-excluded-properties'. delete-trailing-whitespace command should delete trailing lines at the end of the buffer. It defaults to t. ++++ +** `C-x r +' is now overloaded to invoke `append-to-register. + ++++ +** New option `register-separator' specifies the register containing +the text to put between collected texts for use with M-x +append-to-register and M-x prepend-to-register. + ** Search changes *** Global `M-s _' starts a symbol (identifier) incremental search, @@ -192,6 +209,13 @@ of one or more whitespace characters defined by the variable `isearch-lax-whitespace'. In regexp incremental search, it toggles the value of the variable `isearch-regexp-lax-whitespace'. +** query-replace changes + +*** When new option `replace-lax-whitespace' is non-nil, +and you enter a space or spaces in the strings or regexps +to be replaced, `query-replace' will match any sequence matched +by the regexp `search-whitespace-regexp'. + ** M-x move-to-column, if called interactively with no prefix arg, now prompts for a column number. @@ -411,6 +435,13 @@ channel keys found, if any. if the command ends in `;' (when operating on multiple files). Otherwise, it executes the command on each file in parallel. +*** The minibuffer default for `=' (`dired-diff) has changed. +It is now the backup file for the file at point, if one exists, rather +than the file at the mark. + +*** `M-=' is no longer bound to `dired-backup-diff' in Dired buffers. +The global binding for `M-=', `count-words-region' is in effect. + ** Shell *** New option `async-shell-command-buffer' specifies what buffer to use @@ -601,6 +632,13 @@ are deprecated and will be removed eventually. * Lisp changes in Emacs 24.3 +** Interpreted files get eagerly macro-expanded during load. +This can significantly speed up execution of non-byte-compiled code, but can +also bump into harmless and previously unnoticed cyclic dependencies. +These should not be fatal: they will simply cause the macro-calls to be left +for later expansion (as before), but will also result in a warning describing +the cycle. + ** New minor mode `read-only-mode' to replace toggle-read-only (now obsolete). ** New functions `autoloadp' and `autoload-do-load'. @@ -626,25 +664,40 @@ The interpretation of the DECLS is determined by `defun-declarations-alist'. ** New error type and new function `user-error'. Doesn't trigger the debugger. +** New option `debugger-bury-or-kill'. + ++++ +** New utility function `buffer-narrowed-p'. + ** Window changes *** The functions get-lru-window, get-mru-window and get-largest-window now accept a third argument to avoid choosing the selected window. -*** New macro with-temp-buffer-window. +*** New macro `with-temp-buffer-window'. -*** New display action function display-buffer-below-selected. +*** New option `temp-buffer-resize-frames'. -*** New display action alist `inhibit-switch-frame', if non-nil, tells -display action functions to avoid changing which frame is selected. +*** New function `fit-frame-to-buffer' and new option + `fit-frame-to-buffer-bottom-margin'. -*** New display action alist `pop-up-frame-parameters', if non-nil, -specifies frame parameters to give any newly-created frame. +*** New display action functions `display-buffer-below-selected' and +`display-buffer-in-previous-window'. + +*** New display action alist entry `inhibit-switch-frame', if non-nil, +tells display action functions to avoid changing which frame is +selected. + +*** New display action alist entry `pop-up-frame-parameters', if +non-nil, specifies frame parameters to give any newly-created frame. + +*** New display action alist entry `previous-window', if non-nil, +specifies window to reuse in `display-buffer-in-previous-window'. *** The following variables are obsolete, as they can be replaced by appropriate entries in the `display-buffer-alist' function introduced in Emacs 24.1: - ++++ **** `display-buffer-reuse-frames' **** `special-display-regexps' **** `special-display-frame-alist' @@ -671,6 +724,7 @@ by the underlying C implementation. ** `automount-dir-prefix' is obsolete. ** `buffer-has-markers-at' is obsolete. +** `window-system-version' is obsolete. * Changes in Emacs 24.3 on non-free operating systems @@ -1403,6 +1457,10 @@ If you had that set, you need to put in your ~/.authinfo file instead. +*** SMTPmail defaults to using the address in the From: header as the +SMTP MAIL FROM envelope. To override this, set `mail-envelope-from' +to the address you wish to use instead. + ** SQL mode *** New options `sql-port', `sql-connection-alist', `sql-send-terminator', @@ -1900,6 +1958,10 @@ instead of jumping all the way to the top-level. *** Set `debug-on-event' to enter the debugger on events like SIGUSR1. This can be useful when `inhibit-quit' is set. +*** Set `debug-on-message' to enter the debugger when a certain +message is displayed in the echo area. This can be useful when trying +to work out which code is doing something. + ** The new function `server-eval-at' allows evaluation of Lisp forms on named Emacs server instances. diff --git a/leim/ChangeLog b/leim/ChangeLog index 5c29052d98b..6a67c99b5c0 100644 --- a/leim/ChangeLog +++ b/leim/ChangeLog @@ -1,3 +1,7 @@ +2012-09-05 Eli Zaretskii + + * quail/hebrew.el ("yiddish-royal"): Fix several bogus entries. + 2012-08-17 Daniel Bergey (tiny change) * quail/indian.el (quail-define-inscript-package): diff --git a/leim/quail/hebrew.el b/leim/quail/hebrew.el index aed9910000a..307f7fa0c28 100644 --- a/leim/quail/hebrew.el +++ b/leim/quail/hebrew.el @@ -773,9 +773,9 @@ Better for yiddish than Hebrew methods. ("@" ?,Y%(B) ; Double Low-9 Quotation Mark ("(" ?\)) ; mirroring (")" ?\() ; mirroring - ("Q" ?,A=(B) ; Right Double Quotation Mark - ("W" ?,A<(B) - ("E" ?,A>(B) ; Yiddish Double Yod (x2) + ("Q" ?,Y4(B) ; Left Double Quotation Mark + ("W" ?,Y!(B) ; Right Double Quotation Mark + ("E" ?$,1-2(B) ; Yiddish Double Yod (x2) ("R" [ ",H`$,1,W(B" ]) ; Patah Alef (Pasekh Alef) ; ("T" "") ("Y" ?$,1-1(B) ; Ligature Yiddish Vav Yod (vov yud) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 87904b8313b..8de59875674 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,13 +1,311 @@ +2012-09-10 Stefan Monnier + + * emacs-lisp/lisp-mode.el (emacs-list-byte-code-comment-re): New var. + (emacs-lisp-byte-code-comment) + (emacs-lisp-byte-code-syntax-propertize, emacs-lisp-byte-code-mode): + New functions. + (eval-sexp-add-defvars): Don't skip defvars in column >0. + (eval-defun-2): Remove bogus interactive spec. + (lisp-indent-line): Remove redundant whole-exp code, now done in + indent-according-to-mode. + (save-match-data): Remove redundant indent data. + + * emacs-lisp/benchmark.el (benchmark-run, benchmark-run-compiled): + Use `declare'. + +2012-09-09 Juri Linkov + + * replace.el (replace-regexp-lax-whitespace): New defcustom. + (replace-lax-whitespace, query-replace-regexp) + (query-replace-regexp-eval, replace-regexp): Doc fix. + (perform-replace, replace-highlight): Let-bind + isearch-lax-whitespace to replace-lax-whitespace and + isearch-regexp-lax-whitespace to replace-regexp-lax-whitespace. + + * isearch.el (isearch-query-replace): Let-bind + replace-lax-whitespace to isearch-lax-whitespace and + replace-regexp-lax-whitespace to + isearch-regexp-lax-whitespace. (Bug#10885) + +2012-09-09 Stefan Monnier + + * eshell/em-unix.el (eshell/sudo): Explicitly drop return value. + +2012-09-09 Alan Mackenzie + + * progmodes/cc-engine.el (c-state-cache-init): + Initialise c-state-semi-nonlit-pos-cache\(-limit\)? properly. + (c-record-parse-state-state): + Record c-state-semi-nonlit-pos-cache\(-limit\)?. + +2012-09-09 Andreas Schwab + + * register.el (register-separator): Rename from + separator-register. All uses changed. Doc fix. + (register): Fix version. + +2012-09-09 Chong Yidong + + * replace.el (query-replace-map): Bind four new symbols for + requesting window scrolling. + + * subr.el (y-or-n-p): Handle the window-scrolling bindings in + query-replace-map (Bug#8948). + + * custom.el (custom-theme-load-confirm): Use y-or-n-p. + + * emacs-lisp/map-ynp.el (map-y-or-n-p): Don't bind scrolling keys + since they are now in query-replace-map. + + * window.el (scroll-other-window-down): Make the arg optional. + +2012-09-09 Chong Yidong + + * files.el (hack-local-variables-confirm): Use quit-window to kill + the *Local Variables* buffer. + +2012-09-08 Dmitry Gutov + + * progmodes/ruby-mode.el (ruby-toggle-block): Guess the current block, + not just expect to be at its beginning. Adjust callees. + Succeed when do-end block has no space before the pipe character. + (ruby-brace-to-do-end): When the original block is one-liner, + convert to multiline. Reindent the result. + +2012-09-08 Jambunathan K + + * register.el (register): New group. + (register-separator): New user option. + (increment-register): Route it to `append-to-register', if + register contains text. Implication is that `C-x r +' can now be + used for appending to a text register (bug#12217). + (append-to-register, prepend-to-register): Add separator based on + `register-separator. + +2012-09-08 Alan Mackenzie + + AWK Mode: make auto-newline work when there's "==" in the pattern. + * progmodes/cc-cmds.el (c-point-syntax): Handle virtual semicolons + correctly. + * progmodes/cc-engine.el (c-guess-basic-syntax CASE 5A.3): + Test more rigorously for "=" token. + +2012-09-08 Dmitry Gutov + + * progmodes/ruby-mode.el (ruby-match-expression-expansion): + Only fail when reached LIMIT. + +2012-09-08 Chong Yidong + + * dired.el (dired-mode-map): Don't bind M-=. + + * dired-aux.el (dired-diff): Use backup file as default. + +2012-09-08 Drew Adams + + * subr.el (add-to-history): Fix delete usage (Bug#12314). + +2012-09-08 Chong Yidong + + * subr.el (syntax-after, syntax-class): Doc fix. + +2012-09-08 Martin Rudalics + + * window.el (display-buffer-in-previous-window): New buffer + display action function. + + * emacs-lisp/debug.el (debugger-bury-or-kill): New option. + (debugger-previous-window): New variable. + (debug): Rewrite using display-buffer-in-previous-window, + quit-restore-window and debugger-bury-or-kill. (Bug#8789) + +2012-09-07 Stefan Monnier + + * emacs-lisp/byte-run.el (defun): Tweak message. Simplify code. + +2012-09-07 Matt McClure (tiny change) + + * progmodes/python.el (python-shell-send-string): + When default-directory is remote, create temp file on remote + filesystem. + (python-shell-send-file): When file is remote, pass local view of + file paths to remote Python interpreter. (Bug#12340) + +2012-09-07 Chong Yidong + + * window.el (switch-to-buffer): Doc fix (Bug#12181). + + * files.el (after-find-file): Don't fail on a read-only buffer if + require-final-newline is `visit' or `visit-save' (Bug#11156). + + * subr.el (read-char-choice): Allow quitting via ESC ESC. + + * userlock.el (ask-user-about-supersession-threat): + Use read-char-choice (Bug#12093). + +2012-09-07 Chong Yidong + + * subr.el (buffer-narrowed-p): New function. + + * ses.el (ses-widen): + * simple.el (count-words--buffer-message): + * net/browse-url.el (browse-url-of-buffer): Use it + + * simple.el (count-words-region): Don't signal an error if there + is a non-nil prefix arg and the mark is not set. + + * help.el (describe-key-briefly): Allow the message to be seen + when invoked from the minibuffer (Bug#7014). + +2012-09-07 Dmitry Gutov + + * progmodes/ruby-mode.el (ruby-end-of-defun) + (ruby-beginning-of-defun): Simplify, allow indentation before + block beginning and end keywords. + (ruby-beginning-of-defun): Only consider 3 keywords defun beginners. + (ruby-end-of-defun): Expect that the point is at the beginning of + the defun. + +2012-09-06 Stefan Monnier + + * emacs-lisp/cl-macs.el (cl--do-arglist): Understand _ on &key args + (bug#12367). + (cl--make-usage-args): Strip _ from argument names. + +2012-09-06 Rüdiger Sonderfeld + + * progmodes/vhdl-mode.el (vhdl-speedbar-initialize): Don't use + obsolete alias speedbar-key-map. + (vhdl-doc-variable, vhdl-doc-mode): Use called-interactively-p. + (vhdl-index-menu-init): Don't use obsolete variable + font-lock-maximum-size. + +2012-09-06 Chong Yidong + + * frame.el (window-system-version): Mark as obsolete. + + * speedbar.el (speedbar-update-flag, speedbar-mode): Remove uses + of obsolete variable speedbar-key-map. + +2012-09-06 Juri Linkov + + * replace.el (replace-lax-whitespace): New defcustom. + (query-replace, query-replace-regexp, query-replace-regexp-eval) + (replace-string, replace-regexp): Mention it in docstrings. + (perform-replace, replace-highlight): Let-bind + isearch-lax-whitespace and isearch-regexp-lax-whitespace according + to the values of replace-lax-whitespace and regexp-flag. + Don't let-bind search-whitespace-regexp. (Bug#10885) + + * isearch.el (isearch-query-replace): Let-bind + replace-lax-whitespace instead of let-binding + replace-search-function and replace-re-search-function. + (isearch-lazy-highlight-search): Let-bind isearch-lax-whitespace + and isearch-regexp-lax-whitespace to lazy-highlight variables. + (isearch-toggle-symbol): Set isearch-regexp to nil + in isearch-word mode (like in isearch-toggle-word). + +2012-09-06 Juri Linkov + + * replace.el (replace-search-function) + (replace-re-search-function): Set default values to nil. + (perform-replace): Let-bind isearch-related variables based on + replace-related values, call `isearch-search-fun' and let-bind + the result to `search-function'. Remove code that sets + `search-function' and `search-string' separately for + `delimited-flag'. + (replace-highlight): Add new argument `delimited-flag' and + rename other arguments to the names used in `perform-replace'. + Let-bind `isearch-word' to the argument `delimited-flag'. + (Bug#10885, bug#10887) + +2012-09-07 Dmitry Gutov + + * progmodes/ruby-mode.el (ruby-indent-beg-re): Add pieces from + ruby-beginning-of-indent, simplify, allow all keywords to have + indentation before them. + (ruby-beginning-of-indent): Adjust for above. Search until the + found point is not inside a string or comment. + (ruby-font-lock-keywords): Allow symbols to start with "@" + character, give them higher priority than variables. + (ruby-syntax-propertize-function) + (ruby-font-lock-syntactic-keywords): Remove the "not comments" + matchers. Expression expansions are not comments when inside a + string, and there comment syntax status is irrelevant. + (ruby-match-expression-expansion): New function. Check that + expression expansion is inside a string, and it's not escaped. + (ruby-font-lock-keywords): Use it. + +2012-09-05 Martin Rudalics + + * help.el (temp-buffer-max-height): New default value. + (temp-buffer-resize-frames): New option. + (resize-temp-buffer-window): Optionally resize frame. + + * window.el (fit-frame-to-buffer-bottom-margin): New option. + (fit-frame-to-buffer): New function. + +2012-09-05 Glenn Morris + + * emulation/cua-rect.el (cua--init-rectangles): + * textmodes/picture.el (picture-mode-map): + * play/blackbox.el (blackbox-mode-map): Remap right-char and left-char + like forward-char and backward-char. (Bug#12317) + +2012-09-05 Leo Liu + + * progmodes/flymake.el (flymake-warning-re): New variable. + (flymake-parse-line): Use it. + +2012-09-05 Glenn Morris + + * calendar/holidays.el (holiday-christian-holidays): + Rename an entry. (Bug#12289) + +2012-09-05 Stefan Monnier + + * progmodes/sh-script.el (sh-font-lock-paren): Don't burp at BOB + (bug#12222). + +2012-09-04 Stefan Monnier + + * loadup.el: Load macroexp. Remove hack. + * emacs-lisp/macroexp.el (macroexp--eval-if-compile): New function. + (macroexp--expand-all): Use it to get better warnings. + (macroexp--backtrace, macroexp--trim-backtrace-frame) + (internal-macroexpand-for-load): New functions. + (macroexp--pending-eager-loads): New var. + (emacs-startup-hook): New hack to replace one in loadup.el. + * emacs-lisp/cl-macs.el (cl--compiler-macro-list*) + (cl--compiler-macro-cXXr): Move to top, before they can be used. + (cl-psetf): Simplify. + (cl-defstruct): Add indent rule. + +2012-09-04 Lars Ingebrigtsen + + * mail/smtpmail.el (smtpmail-send-it): Prefer the From: header + over `user-mail-address' for the SMTP MAIL FROM envelope. + (smtpmail-via-smtp): Ditto. + +2012-09-04 Dmitry Gutov + + * progmodes/ruby-mode.el: Clean up keybindings. + (ruby-mode-map): Don't bind ruby-electric-brace, + ruby-beginning-of-defun, ruby-end-of-defun, ruby-mark-defun, + backward-kill-word, reindent-then-newline-and-indent. + (ruby-mark-defun): Remove. + (ruby-electric-brace): Remove. Obsoleted by electric-indent-chars. + (ruby-mode): Set local beginning-of-defun-function and + end-of-defun-function values. + 2012-09-03 Martin Rudalics * window.el (temp-buffer-window-setup-hook) (temp-buffer-window-show-hook): New hooks. (temp-buffer-window-setup, temp-buffer-window-show) (with-temp-buffer-window): New functions. - (fit-window-to-buffer): Remove unused optional argument - OVERRIDE. - (special-display-popup-frame): Make sure the window used shows - BUFFER. + (fit-window-to-buffer): Remove unused optional argument OVERRIDE. + (special-display-popup-frame): Make sure the window used shows BUFFER. * help.el (temp-buffer-resize-mode): Fix doc-string. (resize-temp-buffer-window): New optional argument WINDOW. @@ -149,8 +447,8 @@ 2012-08-29 Michael Albinus * eshell/esh-ext.el (eshell-external-command): Do not examine - remote shell scripts. See - . + remote shell scripts. + See . * net/tramp-sh.el (tramp-remote-path): Add "/sbin" and "/usr/local/sbin". diff --git a/lisp/calendar/holidays.el b/lisp/calendar/holidays.el index 043d402f612..9643a1e2905 100644 --- a/lisp/calendar/holidays.el +++ b/lisp/calendar/holidays.el @@ -250,7 +250,7 @@ See the documentation for `calendar-holidays' for details." (if calendar-christian-all-holidays-flag (append (holiday-fixed 1 6 "Epiphany") - (holiday-julian 12 25 "Eastern Orthodox Christmas") + (holiday-julian 12 25 "Christmas (Julian calendar)") (holiday-greek-orthodox-easter) (holiday-fixed 8 15 "Assumption") (holiday-advent 0 "Advent"))))) diff --git a/lisp/custom.el b/lisp/custom.el index fb166dd35f7..3eb2895888d 100644 --- a/lisp/custom.el +++ b/lisp/custom.el @@ -1223,38 +1223,19 @@ Return t if THEME was successfully loaded, nil otherwise." "Query the user about loading a Custom theme that may not be safe. The theme should be in the current buffer. If the user agrees, query also about adding HASH to `custom-safe-themes'." - (if noninteractive - nil - (let ((exit-chars '(?y ?n ?\s)) - window prompt char) - (save-window-excursion - (rename-buffer "*Custom Theme*" t) - (emacs-lisp-mode) - (setq window (display-buffer (current-buffer))) - (setq prompt - (format "Loading a theme can run Lisp code. Really load?%s" - (if (and window - (< (line-number-at-pos (point-max)) - (window-body-height))) - " (y or n) " - (push ?\C-v exit-chars) - "\nType y or n, or C-v to scroll: "))) - (goto-char (point-min)) - (while (null char) - (setq char (read-char-choice prompt exit-chars)) - (when (eq char ?\C-v) - (if window - (with-selected-window window - (condition-case nil - (scroll-up) - (error (goto-char (point-min)))))) - (setq char nil))) - (when (memq char '(?\s ?y)) - ;; Offer to save to `custom-safe-themes'. - (and (or custom-file user-init-file) - (y-or-n-p "Treat this theme as safe in future sessions? ") - (customize-push-and-save 'custom-safe-themes (list hash))) - t))))) + (unless noninteractive + (save-window-excursion + (rename-buffer "*Custom Theme*" t) + (emacs-lisp-mode) + (setq window (pop-to-buffer (current-buffer))) + (goto-char (point-min)) + (prog1 (when (y-or-n-p "Loading a theme can run Lisp code. Really load? ") + ;; Offer to save to `custom-safe-themes'. + (and (or custom-file user-init-file) + (y-or-n-p "Treat this theme as safe in future sessions? ") + (customize-push-and-save 'custom-safe-themes (list hash))) + t) + (quit-window))))) (defun custom-theme-name-valid-p (name) "Return t if NAME is a valid name for a Custom theme, nil otherwise. diff --git a/lisp/dired-aux.el b/lisp/dired-aux.el index 6186f762e0a..1f8e8068de3 100644 --- a/lisp/dired-aux.el +++ b/lisp/dired-aux.el @@ -54,43 +54,30 @@ into this list; they also should call `dired-log' to log the errors.") ;;;###autoload (defun dired-diff (file &optional switches) "Compare file at point with file FILE using `diff'. -FILE defaults to the file at the mark. (That's the mark set by -\\[set-mark-command], not by Dired's \\[dired-mark] command.) -The prompted-for FILE is the first file given to `diff'. +If called interactively, prompt for FILE; if the file at point +has a backup file, use that as the default. + +FILE is the first file given to `diff'. With prefix arg, prompt for second argument SWITCHES, which is the string of command switches for `diff'." (interactive (let* ((current (dired-get-filename t)) - ;; Get the file at the mark. - (file-at-mark (if (mark t) - (save-excursion (goto-char (mark t)) - (dired-get-filename t t)))) - ;; Use it as default if it's not the same as the current file, - ;; and the target dir is the current dir or the mark is active. - (default (if (and (not (equal file-at-mark current)) - (or (equal (dired-dwim-target-directory) - (dired-current-directory)) - mark-active)) - file-at-mark)) - (target-dir (if default - (dired-current-directory) - (dired-dwim-target-directory))) - (defaults (dired-dwim-target-defaults (list current) target-dir))) - (require 'diff) - (list - (minibuffer-with-setup-hook - (lambda () - (set (make-local-variable 'minibuffer-default-add-function) nil) - (setq minibuffer-default defaults)) - (read-file-name - (format "Diff %s with%s: " current - (if default (format " (default %s)" default) "")) - target-dir default t)) - (if current-prefix-arg - (read-string "Options for diff: " - (if (stringp diff-switches) - diff-switches - (mapconcat 'identity diff-switches " "))))))) + (oldf (file-newest-backup current)) + (dir (if oldf (file-name-directory oldf)))) + (list (read-file-name + (format "Diff %s with%s: " + (file-name-nondirectory current) + (if oldf + (concat " (default " + (file-name-nondirectory oldf) + ")") + "")) + dir oldf t) + (if current-prefix-arg + (read-string "Options for diff: " + (if (stringp diff-switches) + diff-switches + (mapconcat 'identity diff-switches " "))))))) (let ((current (dired-get-filename t))) (when (or (equal (expand-file-name file) (expand-file-name current)) diff --git a/lisp/dired.el b/lisp/dired.el index cd27b6b6404..f4ae027181a 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -1410,7 +1410,6 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST." (define-key map "&" 'dired-do-async-shell-command) ;; Comparison commands (define-key map "=" 'dired-diff) - (define-key map "\M-=" 'dired-backup-diff) ;; Tree Dired commands (define-key map "\M-\C-?" 'dired-unmark-all-files) (define-key map "\M-\C-d" 'dired-tree-down) @@ -3745,14 +3744,15 @@ Ask means pop up a menu for the user to select one of copy, move or link." ;;;;;; dired-run-shell-command dired-do-shell-command dired-do-async-shell-command ;;;;;; dired-clean-directory dired-do-print dired-do-touch dired-do-chown ;;;;;; dired-do-chgrp dired-do-chmod dired-compare-directories dired-backup-diff -;;;;;; dired-diff) "dired-aux" "dired-aux.el" "9499f79f5853da0aa93d26465c7bf3a1") +;;;;;; dired-diff) "dired-aux" "dired-aux.el" "4b260eda371d319a6c8e8e5ec917e287") ;;; Generated autoloads from dired-aux.el (autoload 'dired-diff "dired-aux" "\ Compare file at point with file FILE using `diff'. -FILE defaults to the file at the mark. (That's the mark set by -\\[set-mark-command], not by Dired's \\[dired-mark] command.) -The prompted-for FILE is the first file given to `diff'. +If called interactively, prompt for FILE; if the file at point +has a backup file, use that as the default. + +FILE is the first file given to `diff'. With prefix arg, prompt for second argument SWITCHES, which is the string of command switches for `diff'. diff --git a/lisp/emacs-lisp/benchmark.el b/lisp/emacs-lisp/benchmark.el index 646be3e1b71..9029c81f279 100644 --- a/lisp/emacs-lisp/benchmark.el +++ b/lisp/emacs-lisp/benchmark.el @@ -53,6 +53,7 @@ FORMS once. Return a list of the total elapsed time for execution, the number of garbage collections that ran, and the time taken by garbage collection. See also `benchmark-run-compiled'." + (declare (indent 1) (debug t)) (unless (natnump repetitions) (setq forms (cons repetitions forms) repetitions 1)) @@ -69,8 +70,6 @@ See also `benchmark-run-compiled'." `(benchmark-elapse ,@forms)) (- gcs-done ,gcs) (- gc-elapsed ,gc))))) -(put 'benchmark-run 'edebug-form-spec t) -(put 'benchmark-run 'lisp-indent-function 2) ;;;###autoload (defmacro benchmark-run-compiled (&optional repetitions &rest forms) @@ -78,6 +77,7 @@ See also `benchmark-run-compiled'." This is like `benchmark-run', but what is timed is a funcall of the byte code obtained by wrapping FORMS in a `lambda' and compiling the result. The overhead of the `lambda's is accounted for." + (declare (indent 1) (debug t)) (unless (natnump repetitions) (setq forms (cons repetitions forms) repetitions 1)) @@ -96,8 +96,6 @@ result. The overhead of the `lambda's is accounted for." (funcall ,lambda-code)))) `(benchmark-elapse (funcall ,code))) (- gcs-done ,gcs) (- gc-elapsed ,gc))))) -(put 'benchmark-run-compiled 'edebug-form-spec t) -(put 'benchmark-run-compiled 'lisp-indent-function 2) ;;;###autoload (defun benchmark (repetitions form) diff --git a/lisp/emacs-lisp/byte-run.el b/lisp/emacs-lisp/byte-run.el index 9b66c8ffd60..d1382f42b19 100644 --- a/lisp/emacs-lisp/byte-run.el +++ b/lisp/emacs-lisp/byte-run.el @@ -185,11 +185,10 @@ The return value is undefined. ((and (featurep 'cl) (memq (car x) ;C.f. cl-do-proclaim. '(special inline notinline optimize warn))) - (if (null (stringp docstring)) - (push (list 'declare x) body) - (setcdr body (cons (list 'declare x) (cdr body)))) + (push (list 'declare x) + (if (stringp docstring) (cdr body) body)) nil) - (t (message "Warning: Unknown defun property %S in %S" + (t (message "Warning: Unknown defun property `%S' in %S" (car x) name))))) decls)) (def (list 'defalias diff --git a/lisp/emacs-lisp/cl-loaddefs.el b/lisp/emacs-lisp/cl-loaddefs.el index d4da1f59a85..f2bc7cc9d3c 100644 --- a/lisp/emacs-lisp/cl-loaddefs.el +++ b/lisp/emacs-lisp/cl-loaddefs.el @@ -249,8 +249,7 @@ Remove from SYMBOL's plist the property PROPNAME and its value. ;;;*** -;;;### (autoloads (cl--compiler-macro-cXXr cl--compiler-macro-list* -;;;;;; cl--compiler-macro-adjoin cl-defsubst cl-compiler-macroexpand +;;;### (autoloads (cl--compiler-macro-adjoin cl-defsubst cl-compiler-macroexpand ;;;;;; cl-define-compiler-macro cl-assert cl-check-type cl-typep ;;;;;; cl-deftype cl-defstruct cl-callf2 cl-callf cl-letf* cl-letf ;;;;;; cl-rotatef cl-shiftf cl-remf cl-psetf cl-declare cl-the cl-locally @@ -260,9 +259,20 @@ Remove from SYMBOL's plist the property PROPNAME and its value. ;;;;;; cl-do cl-loop cl-return-from cl-return cl-block cl-etypecase ;;;;;; cl-typecase cl-ecase cl-case cl-load-time-value cl-eval-when ;;;;;; cl-destructuring-bind cl-function cl-defmacro cl-defun cl-gentemp -;;;;;; cl-gensym) "cl-macs" "cl-macs.el" "a1ca04b3f2acc7c9b06f45ef5486d443") +;;;;;; cl-gensym cl--compiler-macro-cXXr cl--compiler-macro-list*) +;;;;;; "cl-macs" "cl-macs.el" "00526d56a1062b9c308cf37b59374f2b") ;;; Generated autoloads from cl-macs.el +(autoload 'cl--compiler-macro-list* "cl-macs" "\ + + +\(fn FORM ARG &rest OTHERS)" nil nil) + +(autoload 'cl--compiler-macro-cXXr "cl-macs" "\ + + +\(fn FORM X)" nil nil) + (autoload 'cl-gensym "cl-macs" "\ Generate a new uninterned symbol. The name is made by appending a number to PREFIX, default \"G\". @@ -659,6 +669,8 @@ value, that slot cannot be set via `setf'. (put 'cl-defstruct 'doc-string-elt '2) +(put 'cl-defstruct 'lisp-indent-function '1) + (autoload 'cl-deftype "cl-macs" "\ Define NAME as a new data type. The type name can then be used in `cl-typecase', `cl-check-type', etc. @@ -722,16 +734,6 @@ surrounded by (cl-block NAME ...). \(fn FORM A LIST &rest KEYS)" nil nil) -(autoload 'cl--compiler-macro-list* "cl-macs" "\ - - -\(fn FORM ARG &rest OTHERS)" nil nil) - -(autoload 'cl--compiler-macro-cXXr "cl-macs" "\ - - -\(fn FORM X)" nil nil) - ;;;*** ;;;### (autoloads (cl-tree-equal cl-nsublis cl-sublis cl-nsubst-if-not diff --git a/lisp/emacs-lisp/cl-macs.el b/lisp/emacs-lisp/cl-macs.el index 81a451dbbb4..e385a80c1f3 100644 --- a/lisp/emacs-lisp/cl-macs.el +++ b/lisp/emacs-lisp/cl-macs.el @@ -58,6 +58,33 @@ ;;; Initialization. +;; Place compiler macros at the beginning, otherwise uses of the corresponding +;; functions can lead to recursive-loads that prevent the calls from +;; being optimized. + +;;;###autoload +(defun cl--compiler-macro-list* (_form arg &rest others) + (let* ((args (reverse (cons arg others))) + (form (car args))) + (while (setq args (cdr args)) + (setq form `(cons ,(car args) ,form))) + form)) + +;;;###autoload +(defun cl--compiler-macro-cXXr (form x) + (let* ((head (car form)) + (n (symbol-name (car form))) + (i (- (length n) 2))) + (if (not (string-match "c[ad]+r\\'" n)) + (if (and (fboundp head) (symbolp (symbol-function head))) + (cl--compiler-macro-cXXr (cons (symbol-function head) (cdr form)) + x) + (error "Compiler macro for cXXr applied to non-cXXr form")) + (while (> i (match-beginning 0)) + (setq x (list (if (eq (aref n i) ?a) 'car 'cdr) x)) + (setq i (1- i))) + x))) + ;;; Some predicates for analyzing Lisp forms. ;; These are used by various ;; macro expanders to optimize the results in certain common cases. @@ -366,9 +393,14 @@ its argument list allows full Common Lisp conventions." (mapcar (lambda (x) (cond ((symbolp x) - (if (eq ?\& (aref (symbol-name x) 0)) - (setq state x) - (make-symbol (upcase (symbol-name x))))) + (let ((first (aref (symbol-name x) 0))) + (if (eq ?\& first) + (setq state x) + ;; Strip a leading underscore, since it only + ;; means that this argument is unused. + (make-symbol (upcase (if (eq ?_ first) + (substring (symbol-name x) 1) + (symbol-name x))))))) ((not (consp x)) x) ((memq state '(nil &rest)) (cl--make-usage-args x)) (t ;(VAR INITFORM SVAR) or ((KEYWORD VAR) INITFORM SVAR). @@ -452,7 +484,13 @@ its argument list allows full Common Lisp conventions." (let ((arg (pop args))) (or (consp arg) (setq arg (list arg))) (let* ((karg (if (consp (car arg)) (caar arg) - (intern (format ":%s" (car arg))))) + (let ((name (symbol-name (car arg)))) + ;; Strip a leading underscore, since it only + ;; means that this argument is unused, but + ;; shouldn't affect the key's name (bug#12367). + (if (eq ?_ (aref name 0)) + (setq name (substring name 1))) + (intern (format ":%s" name))))) (varg (if (consp (car arg)) (cl-cadar arg) (car arg))) (def (if (cdr arg) (cadr arg) (or (car cl--bind-defs) (cadr (assq varg cl--bind-defs))))) @@ -1425,8 +1463,15 @@ Valid clauses are: cl--loop-accum-var)))) (defun cl--loop-build-ands (clauses) + "Return various representations of (and . CLAUSES). +CLAUSES is a list of Elisp expressions, where clauses of the form +\(progn E1 E2 E3 .. t) are the focus of particular optimizations. +The return value has shape (COND BODY COMBO) +such that COMBO is equivalent to (and . CLAUSES)." (let ((ands nil) (body nil)) + ;; Look through `clauses', trying to optimize (progn ,@A t) (progn ,@B) ,@C + ;; into (progn ,@A ,@B) ,@C. (while clauses (if (and (eq (car-safe (car clauses)) 'progn) (eq (car (last (car clauses))) t)) @@ -1437,6 +1482,7 @@ Valid clauses are: (cl-cdadr clauses) (list (cadr clauses)))) (cddr clauses))) + ;; A final (progn ,@A t) is moved outside of the `and'. (setq body (cdr (butlast (pop clauses))))) (push (pop clauses) ands))) (setq ands (or (nreverse ands) (list t))) @@ -1905,8 +1951,6 @@ See Info node `(cl)Declarations' for details." (cl-do-proclaim (pop specs) nil))) nil) - - ;;; The standard modify macros. ;; `setf' is now part of core Elisp, defined in gv.el. @@ -1929,7 +1973,7 @@ before assigning any PLACEs to the corresponding values. (or p (error "Odd number of arguments to cl-psetf")) (pop p)) (if simple - `(progn (setf ,@args) nil) + `(progn (setq ,@args) nil) (setq args (reverse args)) (let ((expr `(setf ,(cadr args) ,(car args)))) (while (setq args (cddr args)) @@ -2119,7 +2163,7 @@ one keyword is supported, `:read-only'. If this has a non-nil value, that slot cannot be set via `setf'. \(fn NAME SLOTS...)" - (declare (doc-string 2) + (declare (doc-string 2) (indent 1) (debug (&define ;Makes top-level form not be wrapped. [&or symbolp @@ -2597,14 +2641,6 @@ surrounded by (cl-block NAME ...). `(if (cl-member ,a ,list ,@keys) ,list (cons ,a ,list)) form)) -;;;###autoload -(defun cl--compiler-macro-list* (_form arg &rest others) - (let* ((args (reverse (cons arg others))) - (form (car args))) - (while (setq args (cdr args)) - (setq form `(cons ,(car args) ,form))) - form)) - (defun cl--compiler-macro-get (_form sym prop &optional def) (if def `(cl-getf (symbol-plist ,sym) ,prop ,def) @@ -2616,21 +2652,6 @@ surrounded by (cl-block NAME ...). (cl--make-type-test temp (cl--const-expr-val type))) form)) -;;;###autoload -(defun cl--compiler-macro-cXXr (form x) - (let* ((head (car form)) - (n (symbol-name (car form))) - (i (- (length n) 2))) - (if (not (string-match "c[ad]+r\\'" n)) - (if (and (fboundp head) (symbolp (symbol-function head))) - (cl--compiler-macro-cXXr (cons (symbol-function head) (cdr form)) - x) - (error "Compiler macro for cXXr applied to non-cXXr form")) - (while (> i (match-beginning 0)) - (setq x (list (if (eq (aref n i) ?a) 'car 'cdr) x)) - (setq i (1- i))) - x))) - (dolist (y '(cl-first cl-second cl-third cl-fourth cl-fifth cl-sixth cl-seventh cl-eighth cl-ninth cl-tenth diff --git a/lisp/emacs-lisp/debug.el b/lisp/emacs-lisp/debug.el index 7bc93a19d1a..188c0800eb8 100644 --- a/lisp/emacs-lisp/debug.el +++ b/lisp/emacs-lisp/debug.el @@ -48,6 +48,39 @@ the middle is discarded, and just the beginning and end are displayed." :group 'debugger :version "21.1") +(defcustom debugger-bury-or-kill 'bury + "How to proceed with the debugger buffer when exiting `debug'. +The value used here affects the behavior of operations on any +window previously showing the debugger buffer. + +`nil' means that if its window is not deleted when exiting the + debugger, invoking `switch-to-prev-buffer' will usually show + the debugger buffer again. + +`append' means that if the window is not deleted, the debugger + buffer moves to the end of the window's previous buffers so + it's less likely that a future invocation of + `switch-to-prev-buffer' will switch to it. Also, it moves the + buffer to the end of the frame's buffer list. + +`bury' means that if the window is not deleted, its buffer is + removed from the window's list of previous buffers. Also, it + moves the buffer to the end of the frame's buffer list. This + value provides the most reliable remedy to not have + `switch-to-prev-buffer' switch to the debugger buffer again + without killing the buffer. + +`kill' means to kill the debugger buffer. + +The value used here is passed to `quit-restore-window'." + :type '(choice + (const :tag "Keep alive" nil) + (const :tag "Append" 'append) + (const :tag "Bury" 'bury) + (const :tag "Kill" 'kill)) + :group 'debugger + :version "24.2") + (defvar debug-function-list nil "List of functions currently set for debug on entry.") @@ -60,6 +93,9 @@ the middle is discarded, and just the beginning and end are displayed." (defvar debugger-old-buffer nil "This is the buffer that was current when the debugger was entered.") +(defvar debugger-previous-window nil + "This is the window last showing the debugger buffer.") + (defvar debugger-previous-backtrace nil "The contents of the previous backtrace (including text properties). This is to optimize `debugger-make-xrefs'.") @@ -133,7 +169,7 @@ first will be printed into the backtrace buffer." (with-current-buffer (get-buffer "*Backtrace*") (list major-mode (buffer-string))))) (debugger-buffer (get-buffer-create "*Backtrace*")) - (debugger-old-buffer (current-buffer)) + (debugger-window nil) (debugger-step-after-exit nil) (debugger-will-be-back nil) ;; Don't keep reading from an executing kbd macro! @@ -184,78 +220,63 @@ first will be printed into the backtrace buffer." (cursor-in-echo-area nil)) (unwind-protect (save-excursion - (save-window-excursion - (with-no-warnings - (setq unread-command-char -1)) - (when (eq (car debugger-args) 'debug) - ;; Skip the frames for backtrace-debug, byte-code, - ;; and implement-debug-on-entry. - (backtrace-debug 4 t) - ;; Place an extra debug-on-exit for macro's. - (when (eq 'lambda (car-safe (cadr (backtrace-frame 4)))) - (backtrace-debug 5 t))) - (pop-to-buffer debugger-buffer) - (debugger-mode) - (debugger-setup-buffer debugger-args) - (when noninteractive - ;; If the backtrace is long, save the beginning - ;; and the end, but discard the middle. - (when (> (count-lines (point-min) (point-max)) - debugger-batch-max-lines) - (goto-char (point-min)) - (forward-line (/ 2 debugger-batch-max-lines)) - (let ((middlestart (point))) - (goto-char (point-max)) - (forward-line (- (/ 2 debugger-batch-max-lines) - debugger-batch-max-lines)) - (delete-region middlestart (point))) - (insert "...\n")) + (with-no-warnings + (setq unread-command-char -1)) + (when (eq (car debugger-args) 'debug) + ;; Skip the frames for backtrace-debug, byte-code, + ;; and implement-debug-on-entry. + (backtrace-debug 4 t) + ;; Place an extra debug-on-exit for macro's. + (when (eq 'lambda (car-safe (cadr (backtrace-frame 4)))) + (backtrace-debug 5 t))) + (pop-to-buffer + debugger-buffer + `((display-buffer-reuse-window + display-buffer-in-previous-window) + . (,(when debugger-previous-window + `(previous-window . ,debugger-previous-window))))) + (setq debugger-window (selected-window)) + (setq debugger-previous-window debugger-window) + (debugger-mode) + (debugger-setup-buffer debugger-args) + (when noninteractive + ;; If the backtrace is long, save the beginning + ;; and the end, but discard the middle. + (when (> (count-lines (point-min) (point-max)) + debugger-batch-max-lines) (goto-char (point-min)) - (message "%s" (buffer-string)) - (kill-emacs -1)) + (forward-line (/ 2 debugger-batch-max-lines)) + (let ((middlestart (point))) + (goto-char (point-max)) + (forward-line (- (/ 2 debugger-batch-max-lines) + debugger-batch-max-lines)) + (delete-region middlestart (point))) + (insert "...\n")) + (goto-char (point-min)) + (message "%s" (buffer-string)) + (kill-emacs -1)) + (message "") + (let ((standard-output nil) + (buffer-read-only t)) (message "") - (let ((standard-output nil) - (buffer-read-only t)) - (message "") - ;; Make sure we unbind buffer-read-only in the right buffer. - (save-excursion - (recursive-edit))))) - ;; Kill or at least neuter the backtrace buffer, so that users - ;; don't try to execute debugger commands in an invalid context. - (if (get-buffer-window debugger-buffer 0) - ;; Still visible despite the save-window-excursion? Maybe it - ;; it's in a pop-up frame. It would be annoying to delete and - ;; recreate it every time the debugger stops, so instead we'll - ;; erase it (and maybe hide it) but keep it alive. - (with-current-buffer debugger-buffer - (with-selected-window (get-buffer-window debugger-buffer 0) - (when (and (window-dedicated-p (selected-window)) - (not debugger-will-be-back)) - ;; If the window is not dedicated, burying the buffer - ;; will mean that the frame created for it is left - ;; around showing some random buffer, and next time we - ;; pop to the debugger buffer we'll create yet - ;; another frame. - ;; If debugger-will-be-back is non-nil, the frame - ;; would need to be de-iconified anyway immediately - ;; after when we re-enter the debugger, so iconifying it - ;; here would cause flashing. - ;; Drew Adams is not happy with this: he wants to frame - ;; to be left at the top-level, still working on how - ;; best to do that. - (bury-buffer)))) - (unless debugger-previous-state - (kill-buffer debugger-buffer))) - ;; Restore the previous state of the debugger-buffer, in case we were - ;; in a recursive invocation of the debugger. - (when (buffer-live-p debugger-buffer) - (with-current-buffer debugger-buffer - (let ((inhibit-read-only t)) - (erase-buffer) - (if (null debugger-previous-state) - (fundamental-mode) - (insert (nth 1 debugger-previous-state)) - (funcall (nth 0 debugger-previous-state)))))) + ;; Make sure we unbind buffer-read-only in the right buffer. + (save-excursion + (recursive-edit)))) + (when (and (window-live-p debugger-window) + (eq (window-buffer debugger-window) debugger-buffer)) + ;; Unshow debugger-buffer. + (quit-restore-window debugger-window debugger-bury-or-kill)) + ;; Restore previous state of debugger-buffer in case we were + ;; in a recursive invocation of the debugger, otherwise just + ;; erase the buffer and put it into fundamental mode. + (when (buffer-live-p debugger-buffer) + (with-current-buffer debugger-buffer + (let ((inhibit-read-only t)) + (erase-buffer) + (if (null debugger-previous-state) + (fundamental-mode) + (insert (nth 1 debugger-previous-state)) + (funcall (nth 0 debugger-previous-state)))))) (with-timeout-unsuspend debugger-with-timeout-suspend) (set-match-data debugger-outer-match-data))) ;; Put into effect the modified values of these variables diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el index 666e31f690f..64aac4b81db 100644 --- a/lisp/emacs-lisp/lisp-mode.el +++ b/lisp/emacs-lisp/lisp-mode.el @@ -431,6 +431,61 @@ if that value is non-nil." (add-hook 'completion-at-point-functions 'lisp-completion-at-point nil 'local)) +;;; Emacs Lisp Byte-Code mode + +(eval-and-compile + (defconst emacs-list-byte-code-comment-re + (concat "\\(#\\)@\\([0-9]+\\) " + ;; Make sure it's a docstring and not a lazy-loaded byte-code. + "\\(?:[^(]\\|([^\"]\\)"))) + +(defun emacs-lisp-byte-code-comment (end &optional _point) + "Try to syntactically mark the #@NNN ....^_ docstrings in byte-code files." + (let ((ppss (syntax-ppss))) + (when (and (nth 4 ppss) + (eq (char-after (nth 8 ppss)) ?#)) + (let* ((n (save-excursion + (goto-char (nth 8 ppss)) + (when (looking-at emacs-list-byte-code-comment-re) + (string-to-number (match-string 2))))) + ;; `maxdiff' tries to make sure the loop below terminates. + (maxdiff n)) + (when n + (let* ((bchar (match-end 2)) + (b (position-bytes bchar))) + (goto-char (+ b n)) + (while (let ((diff (- (position-bytes (point)) b n))) + (unless (zerop diff) + (when (> diff maxdiff) (setq diff maxdiff)) + (forward-char (- diff)) + (setq maxdiff (if (> diff 0) diff + (max (1- maxdiff) 1))) + t)))) + (if (<= (point) end) + (put-text-property (1- (point)) (point) + 'syntax-table + (string-to-syntax "> b")) + (goto-char end))))))) + +(defun emacs-lisp-byte-code-syntax-propertize (start end) + (emacs-lisp-byte-code-comment end (point)) + (funcall + (syntax-propertize-rules + (emacs-list-byte-code-comment-re + (1 (prog1 "< b" (emacs-lisp-byte-code-comment end (point)))))) + start end)) + +(add-to-list 'auto-mode-alist '("\\.elc\\'" . emacs-lisp-byte-code-mode)) +(define-derived-mode emacs-lisp-byte-code-mode emacs-lisp-mode + "Elisp-Byte-Code" + "Major mode for *.elc files." + ;; TODO: Add way to disassemble byte-code under point. + (setq-local open-paren-in-column-0-is-defun-start nil) + (setq-local syntax-propertize-function + #'emacs-lisp-byte-code-syntax-propertize)) + +;;; Generic Lisp mode. + (defvar lisp-mode-map (let ((map (make-sparse-keymap)) (menu-map (make-sparse-keymap "Lisp"))) @@ -730,10 +785,12 @@ POS specifies the starting position where EXP was found and defaults to point." (let ((vars ())) (goto-char (point-min)) (while (re-search-forward - "^(def\\(?:var\\|const\\|custom\\)[ \t\n]+\\([^; '()\n\t]+\\)" + "(def\\(?:var\\|const\\|custom\\)[ \t\n]+\\([^; '()\n\t]+\\)" pos t) (let ((var (intern (match-string 1)))) - (unless (special-variable-p var) + (and (not (special-variable-p var)) + (save-excursion + (zerop (car (syntax-ppss (match-beginning 0))))) (push var vars)))) `(progn ,@(mapcar (lambda (v) `(defvar ,v)) vars) ,exp))))) @@ -820,7 +877,6 @@ if it already has a value.\) With argument, insert value in current buffer after the defun. Return the result of evaluation." - (interactive "P") ;; FIXME: the print-length/level bindings should only be applied while ;; printing, not while evaluating. (let ((debug-on-error eval-expression-debug-on-error) @@ -925,6 +981,7 @@ rigidly along with this one." (if (or (null indent) (looking-at "\\s<\\s<\\s<")) ;; Don't alter indentation of a ;;; comment line ;; or a line that starts in a string. + ;; FIXME: inconsistency: comment-indent moves ;;; to column 0. (goto-char (- (point-max) pos)) (if (and (looking-at "\\s<") (not (looking-at "\\s<\\s<"))) ;; Single-semicolon comment lines should be indented @@ -939,18 +996,7 @@ rigidly along with this one." ;; If initial point was within line's indentation, ;; position after the indentation. Else stay at same point in text. (if (> (- (point-max) pos) (point)) - (goto-char (- (point-max) pos))) - ;; If desired, shift remaining lines of expression the same amount. - (and whole-exp (not (zerop shift-amt)) - (save-excursion - (goto-char beg) - (forward-sexp 1) - (setq end (point)) - (goto-char beg) - (forward-line 1) - (setq beg (point)) - (> end beg)) - (indent-code-rigidly beg end shift-amt))))) + (goto-char (- (point-max) pos)))))) (defvar calculate-lisp-indent-last-sexp) @@ -1230,7 +1276,6 @@ Lisp function does not specify a special indentation." (put 'prog2 'lisp-indent-function 2) (put 'save-excursion 'lisp-indent-function 0) (put 'save-restriction 'lisp-indent-function 0) -(put 'save-match-data 'lisp-indent-function 0) (put 'save-current-buffer 'lisp-indent-function 0) (put 'let 'lisp-indent-function 1) (put 'let* 'lisp-indent-function 1) diff --git a/lisp/emacs-lisp/macroexp.el b/lisp/emacs-lisp/macroexp.el index 70eab149837..394225d697e 100644 --- a/lisp/emacs-lisp/macroexp.el +++ b/lisp/emacs-lisp/macroexp.el @@ -100,6 +100,17 @@ each clause." (error (message "Compiler-macro error for %S: %S" (car form) err) form))) +(defun macroexp--eval-if-compile (&rest _forms) + "Pseudo function used internally by macroexp to delay warnings. +The purpose is to delay warnings to bytecomp.el, so they can use things +like `byte-compile-log-warning' to get better file-and-line-number data +and also to avoid outputting the warning during normal execution." + nil) +(put 'macroexp--eval-if-compile 'byte-compile + (lambda (form) + (mapc (lambda (x) (funcall (eval x))) (cdr form)) + (byte-compile-constant nil))) + (defun macroexp--expand-all (form) "Expand all macros in FORM. This is an internal version of `macroexpand-all'. @@ -112,14 +123,17 @@ Assumes the caller has bound `macroexpand-all-environment'." (macroexpand (macroexp--all-forms form 1) macroexpand-all-environment) ;; Normal form; get its expansion, and then expand arguments. - (let ((new-form (macroexpand form macroexpand-all-environment))) - (when (and (not (eq form new-form)) ;It was a macro call. - (car-safe form) - (symbolp (car form)) - (get (car form) 'byte-obsolete-info) - (fboundp 'byte-compile-warn-obsolete)) - (byte-compile-warn-obsolete (car form))) - (setq form new-form)) + (let ((new-form + (macroexpand form macroexpand-all-environment))) + (setq form + (if (and (not (eq form new-form)) ;It was a macro call. + (car-safe form) + (symbolp (car form)) + (get (car form) 'byte-obsolete-info)) + `(progn (macroexp--eval-if-compile + (lambda () (byte-compile-warn-obsolete ',(car form)))) + ,new-form) + new-form))) (pcase form (`(cond . ,clauses) (macroexp--cons 'cond (macroexp--all-clauses clauses) form)) @@ -323,6 +337,86 @@ symbol itself." "Return non-nil if EXP can be copied without extra cost." (or (symbolp exp) (macroexp-const-p exp))) +;;; Load-time macro-expansion. + +;; Because macro-expansion used to be more lazy, eager macro-expansion +;; tends to bump into previously harmless/unnoticeable cyclic-dependencies. +;; So, we have to delay macro-expansion like we used to when we detect +;; such a cycle, and we also want to help coders resolve those cycles (since +;; they can be non-obvious) by providing a usefully trimmed backtrace +;; (hopefully) highlighting the problem. + +(defun macroexp--backtrace () + "Return the Elisp backtrace, more recent frames first." + (let ((bt ()) + (i 0)) + (while + (let ((frame (backtrace-frame i))) + (when frame + (push frame bt) + (setq i (1+ i))))) + (nreverse bt))) + +(defun macroexp--trim-backtrace-frame (frame) + (pcase frame + (`(,_ macroexpand (,head . ,_) . ,_) `(macroexpand (,head …))) + (`(,_ internal-macroexpand-for-load (,head ,second . ,_) . ,_) + (if (or (symbolp second) + (and (eq 'quote (car-safe second)) + (symbolp (cadr second)))) + `(macroexpand-all (,head ,second …)) + '(macroexpand-all …))) + (`(,_ load-with-code-conversion ,name . ,_) + `(load ,(file-name-nondirectory name))))) + +(defvar macroexp--pending-eager-loads nil + "Stack of files currently undergoing eager macro-expansion.") + +(defun internal-macroexpand-for-load (form) + ;; Called from the eager-macroexpansion in readevalloop. + (cond + ;; Don't repeat the same warning for every top-level element. + ((eq 'skip (car macroexp--pending-eager-loads)) form) + ;; If we detect a cycle, skip macro-expansion for now, and output a warning + ;; with a trimmed backtrace. + ((and load-file-name (member load-file-name macroexp--pending-eager-loads)) + (let* ((bt (delq nil + (mapcar #'macroexp--trim-backtrace-frame + (macroexp--backtrace)))) + (elem `(load ,(file-name-nondirectory load-file-name))) + (tail (member elem (cdr (member elem bt))))) + (if tail (setcdr tail (list '…))) + (if (eq (car-safe (car bt)) 'macroexpand-all) (setq bt (cdr bt))) + (message "Warning: Eager macro-expansion skipped due to cycle:\n %s" + (mapconcat #'prin1-to-string (nreverse bt) " => ")) + (push 'skip macroexp--pending-eager-loads) + form)) + (t + (condition-case err + (let ((macroexp--pending-eager-loads + (cons load-file-name macroexp--pending-eager-loads))) + (macroexpand-all form)) + (error + ;; Hopefully this shouldn't happen thanks to the cycle detection, + ;; but in case it does happen, let's catch the error and give the + ;; code a chance to macro-expand later. + (message "Eager macro-expansion failure: %S" err) + form))))) + +;; ¡¡¡ Big Ugly Hack !!! +;; src/bootstrap-emacs is mostly used to compile .el files, so it needs +;; macroexp, bytecomp, cconv, and byte-opt to be fast. Generally this is done +;; by compiling those files first, but this only makes a difference if those +;; files are not preloaded. But macroexp.el is preloaded so we reload it if +;; the current version is interpreted and there's a compiled version available. +(eval-when-compile + (add-hook 'emacs-startup-hook + (lambda () + (and (not (byte-code-function-p + (symbol-function 'macroexpand-all))) + (locate-library "macroexp.elc") + (load "macroexp.elc"))))) + (provide 'macroexp) ;;; macroexp.el ends here diff --git a/lisp/emacs-lisp/map-ynp.el b/lisp/emacs-lisp/map-ynp.el index e7806440bf3..289751f4944 100644 --- a/lisp/emacs-lisp/map-ynp.el +++ b/lisp/emacs-lisp/map-ynp.el @@ -123,16 +123,6 @@ Returns the number of actions taken." map (let ((map (make-sparse-keymap))) (set-keymap-parent map query-replace-map) - (define-key map [?\C-\M-v] 'scroll-other-window) - (define-key map [M-next] 'scroll-other-window) - (define-key map [?\C-\M-\S-v] 'scroll-other-window-down) - (define-key map [M-prior] 'scroll-other-window-down) - ;; The above are rather inconvenient, so maybe we should - ;; provide the non-other keys for the other-scroll as well. - ;; (define-key map [?\C-v] 'scroll-other-window) - ;; (define-key map [next] 'scroll-other-window) - ;; (define-key map [?\M-v] 'scroll-other-window-down) - ;; (define-key map [prior] 'scroll-other-window-down) (dolist (elt action-alist) (define-key map (vector (car elt)) (vector (nth 1 elt)))) map))) diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el index 4aeed7e4d0e..09e47b69b91 100644 --- a/lisp/emacs-lisp/pcase.el +++ b/lisp/emacs-lisp/pcase.el @@ -60,6 +60,8 @@ ;; is in a loop, the repeated macro-expansion becomes terribly costly, so we ;; memoize previous macro expansions to try and avoid recomputing them ;; over and over again. +;; FIXME: Now that macroexpansion is also performed when loading an interpreted +;; file, this is not a real problem any more. (defconst pcase--memoize (make-hash-table :weakness 'key :test 'eq)) ;; (defconst pcase--memoize-1 (make-hash-table :test 'eq)) ;; (defconst pcase--memoize-2 (make-hash-table :weakness 'key :test 'equal)) diff --git a/lisp/emulation/cua-rect.el b/lisp/emulation/cua-rect.el index 39ce5901524..f63d79adf47 100644 --- a/lisp/emulation/cua-rect.el +++ b/lisp/emulation/cua-rect.el @@ -1423,7 +1423,9 @@ With prefix arg, indent to that column." (define-key cua--rectangle-keymap [remap set-mark-command] 'cua-toggle-rectangle-mark) (define-key cua--rectangle-keymap [remap forward-char] 'cua-resize-rectangle-right) + (define-key cua--rectangle-keymap [remap right-char] 'cua-resize-rectangle-right) (define-key cua--rectangle-keymap [remap backward-char] 'cua-resize-rectangle-left) + (define-key cua--rectangle-keymap [remap left-char] 'cua-resize-rectangle-left) (define-key cua--rectangle-keymap [remap next-line] 'cua-resize-rectangle-down) (define-key cua--rectangle-keymap [remap previous-line] 'cua-resize-rectangle-up) (define-key cua--rectangle-keymap [remap end-of-line] 'cua-resize-rectangle-eol) diff --git a/lisp/eshell/em-unix.el b/lisp/eshell/em-unix.el index 58402e37508..d3ddab8af1b 100644 --- a/lisp/eshell/em-unix.el +++ b/lisp/eshell/em-unix.el @@ -1111,7 +1111,7 @@ Execute a COMMAND as the superuser or another USER.") (substring prefix 0 -1) user host dir) (format "/sudo:%s@%s:%s" user host dir)))) ;; Ensure, that Tramp has connected to that construct already. - (file-exists-p default-directory) + (ignore (file-exists-p default-directory)) (eshell-named-command (car orig-args) (cdr orig-args)))))))) (put 'eshell/sudo 'eshell-no-numeric-conversions t) diff --git a/lisp/files.el b/lisp/files.el index 6528632c841..4acdb542089 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -2145,7 +2145,7 @@ unless NOMODES is non-nil." (not buffer-read-only) (save-excursion (goto-char (point-max)) - (insert "\n"))) + (ignore-errors (insert "\n")))) (when (and buffer-read-only view-read-only (not (eq (get major-mode 'mode-class) 'special))) @@ -2951,20 +2951,16 @@ UNSAFE-VARS is the list of those that aren't marked as safe or risky. RISKY-VARS is the list of those that are marked as risky. If these settings come from directory-local variables, then DIR-NAME is the name of the associated directory. Otherwise it is nil." - (if noninteractive - nil - (save-window-excursion - (let* ((name (or dir-name - (if buffer-file-name - (file-name-nondirectory buffer-file-name) - (concat "buffer " (buffer-name))))) - (offer-save (and (eq enable-local-variables t) - unsafe-vars)) - (exit-chars - (if offer-save '(?! ?y ?n ?\s ?\C-g) '(?y ?n ?\s ?\C-g))) - (buf (pop-to-buffer "*Local Variables*")) - prompt char) - (set (make-local-variable 'cursor-type) nil) + (unless noninteractive + (let ((name (cond (dir-name) + (buffer-file-name + (file-name-nondirectory buffer-file-name)) + ((concat "buffer " (buffer-name))))) + (offer-save (and (eq enable-local-variables t) + unsafe-vars)) + (buf (get-buffer-create "*Local Variables*"))) + ;; Set up the contents of the *Local Variables* buffer. + (with-current-buffer buf (erase-buffer) (cond (unsafe-vars @@ -2999,25 +2995,35 @@ n -- to ignore the local variables list.") (let ((print-escape-newlines t)) (prin1 (cdr elt) buf)) (insert "\n")) - (setq prompt - (format "Please type %s%s: " - (if offer-save "y, n, or !" "y or n") - (if (< (line-number-at-pos) (window-body-height)) - "" - (push ?\C-v exit-chars) - ", or C-v to scroll"))) - (goto-char (point-min)) - (while (null char) - (setq char (read-char-choice prompt exit-chars t)) - (when (eq char ?\C-v) - (condition-case nil - (scroll-up) - (error (goto-char (point-min)))) - (setq char nil))) - (kill-buffer buf) - (when (and offer-save (= char ?!) unsafe-vars) - (customize-push-and-save 'safe-local-variable-values unsafe-vars)) - (memq char '(?! ?\s ?y)))))) + (set (make-local-variable 'cursor-type) nil) + (set-buffer-modified-p nil) + (goto-char (point-min))) + + ;; Display the buffer and read a choice. + (save-window-excursion + (pop-to-buffer buf) + (let* ((exit-chars '(?y ?n ?\s ?\C-g ?\C-v)) + (prompt (format "Please type %s%s: " + (if offer-save "y, n, or !" "y or n") + (if (< (line-number-at-pos (point-max)) + (window-body-height)) + "" + (push ?\C-v exit-chars) + ", or C-v to scroll"))) + char) + (if offer-save (push ?! exit-chars)) + (while (null char) + (setq char (read-char-choice prompt exit-chars t)) + (when (eq char ?\C-v) + (condition-case nil + (scroll-up) + (error (goto-char (point-min)) + (recenter 1))) + (setq char nil))) + (when (and offer-save (= char ?!) unsafe-vars) + (customize-push-and-save 'safe-local-variable-values unsafe-vars)) + (prog1 (memq char '(?! ?\s ?y)) + (quit-window t))))))) (defun hack-local-variables-prop-line (&optional mode-only) "Return local variables specified in the -*- line. diff --git a/lisp/frame.el b/lisp/frame.el index 01225639ecf..c182a964820 100644 --- a/lisp/frame.el +++ b/lisp/frame.el @@ -1657,6 +1657,10 @@ terminals, cursor blinking is controlled by the terminal." (make-variable-buffer-local 'show-trailing-whitespace) +;; Defined in dispnew.c. +(make-obsolete-variable + 'window-system-version "it does not give useful information." "24.3") + (provide 'frame) ;;; frame.el ends here diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index a4e3d9bde2b..5644c394f7e 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,112 @@ +2012-09-10 Stefan Monnier + + * qp.el (quoted-printable-decode-region): Inline+CSE+strength-reduction. + +2012-09-07 Chong Yidong + + * gnus-util.el + (gnus-put-text-property-excluding-characters-with-faces): Restore. + + * gnus-salt.el (gnus-tree-highlight-node): + * gnus-sum.el (gnus-summary-highlight-line): + * gnus-group.el (gnus-group-highlight-line): Revert use of add-face. + +2012-09-06 Lars Ingebrigtsen + + * gnus-util.el: Fix compilation error on XEmacs 21.4. + +2012-09-06 Juri Linkov + + * gnus-group.el (gnus-read-ephemeral-gmane-group): Change the naming + scheme for buffer names to be more consistent with other group and + article buffer names in Gnus. + +2012-09-06 Lars Ingebrigtsen + + * gnus-util.el + (gnus-put-text-property-excluding-characters-with-faces): Remove. + + * gnus-compat.el: Define compat function `add-face' from Wolfgang + Jenkner. + + * gnus-group.el (gnus-group-highlight-line): Use combining faces. + + * gnus-sum.el (gnus-summary-highlight-line): Ditto. + + * gnus-salt.el (gnus-tree-highlight-node): Ditto. + +2012-09-06 Katsumi Yamaoka + + * gnus-score.el (gnus-score-decode-text-parts): Use #' for + mm-text-parts used in labels macro to make it work with XEmacs 21.5. + + * gnus-util.el (gnus-string-prefix-p): New function, an alias to + string-prefix-p in Emacs >=23.2. + + * nnmaildir.el (nnmaildir--ensure-suffix, nnmaildir--add-flag) + (nnmaildir--remove-flag, nnmaildir--scan): Use gnus-string-match-p + instead of string-match-p. + (nnmaildir--scan): Use gnus-string-prefix-p instead of string-prefix-p. + +2012-09-06 Kenichi Handa + + * qp.el (quoted-printable-decode-region): Fix previous change; handle + lowercase a..f. + +2012-09-05 Magnus Henoch + + * nnmaildir.el (nnmaildir--article-set-flags): Fix compilation error. + +2012-09-05 Martin Stjernholm + + * gnus-demon.el (gnus-demon-init): Fixed regression when IDLE is t and + TIME is set. + +2012-09-05 Juri Linkov + + * gnus-group.el (gnus-read-ephemeral-bug-group): Allow opening more + than one group at a time (bug#11961). + +2012-09-05 Julien Danjou + + * gnus-srvr.el (gnus-server-open-server): Don't message on failure: + this hide the real reason with a message giving absolutely no hint. + +2012-09-05 Lars Ingebrigtsen + + * gnus-group.el (gnus-group-mark-article-read): Propagate the read mark + to the backend (bug#11804). + + * message.el (message-insert-newsgroups): Don't insert newsgroup + duplicates (bug#12275). + +2012-09-05 John Wiegley + + * gnus.el (gnus-expand-group-parameters): Allow regexp substitutions in + sieve rules. + +2012-09-05 Jan Tatarik + + * gnus-score.el (gnus-score-decode-text-parts): Use #' for the local + function. + + * gnus-logic.el (gnus-advanced-body): Allow scoring on decoded bodies. + + * gnus-score.el (gnus-score-decode-text-parts): Ditto. + +2012-09-05 Magnus Henoch + + * nnmaildir.el: Make nnmaildir understand and write maildir flags. + That is, rename files from "unique:2," to "unique:2,S" for "seen", etc. + This should make nnmaildir more usable with offlineimap. + +2012-09-03 Lars Ingebrigtsen + + * gnus-notifications.el (gnus-notifications-notify): Use it. + + * gnus-fun.el (gnus-funcall-no-warning): New function to silence + warnings on XEmacs. + 2012-09-01 Paul Eggert Better seeds for (random). @@ -2291,8 +2400,6 @@ 2011-06-30 Lars Magne Ingebrigtsen - * dgnushack.el: Autoload sha1 on XEmacs. - * gnus-group.el (gnus-read-ephemeral-emacs-bug-group): Take an optional quit window configuration. diff --git a/lisp/gnus/gnus-demon.el b/lisp/gnus/gnus-demon.el index 115c5777448..671c566d09f 100644 --- a/lisp/gnus/gnus-demon.el +++ b/lisp/gnus/gnus-demon.el @@ -144,9 +144,12 @@ marked with SPECIAL." (* (gnus-demon-time-to-step time) gnus-demon-timestep)) (t (* time gnus-demon-timestep)))) - (idle (if (numberp idle) - (* idle gnus-demon-timestep) - idle)) + (idle (cond ((numberp idle) + (* idle gnus-demon-timestep)) + ((and (eq idle t) (numberp time)) + time) + (t + idle))) (timer (cond diff --git a/lisp/gnus/gnus-fun.el b/lisp/gnus/gnus-fun.el index f33eb910c6a..f5e1c5ad691 100644 --- a/lisp/gnus/gnus-fun.el +++ b/lisp/gnus/gnus-fun.el @@ -278,6 +278,10 @@ colors of the displayed X-Faces." values)) (mapconcat 'identity values " "))) +(defun gnus-funcall-no-warning (function &rest args) + (when (fboundp function) + (apply function args))) + (provide 'gnus-fun) ;;; gnus-fun.el ends here diff --git a/lisp/gnus/gnus-group.el b/lisp/gnus/gnus-group.el index 2f6fc0ccd19..8c7d0165976 100644 --- a/lisp/gnus/gnus-group.el +++ b/lisp/gnus/gnus-group.el @@ -2388,7 +2388,7 @@ specified by `gnus-gmane-group-download-format'." group start (+ start range))) (write-region (point-min) (point-max) tmpfile) (gnus-group-read-ephemeral-group - (format "%s.start-%s.range-%s" group start range) + (format "nndoc+ephemeral:%s.start-%s.range-%s" group start range) `(nndoc ,tmpfile (nndoc-article-type mbox)))) (delete-file tmpfile))) @@ -2481,7 +2481,8 @@ the bug number, and browsing the URL must return mbox output." "/.*$" "")))) (write-region (point-min) (point-max) tmpfile) (gnus-group-read-ephemeral-group - "gnus-read-ephemeral-bug" + (format "nndoc+ephemeral:bug#%s" + (mapconcat 'number-to-string ids ",")) `(nndoc ,tmpfile (nndoc-article-type mbox)) nil window-conf)) @@ -4670,6 +4671,8 @@ you the groups that have both dormant articles and cached articles." (setq mark gnus-expirable-mark)) (setq mark (gnus-request-update-mark group article mark)) + (gnus-request-set-mark + group (list (list (list article) 'add '(read)))) (gnus-mark-article-as-read article mark) (setq gnus-newsgroup-active (gnus-active group)) (when active diff --git a/lisp/gnus/gnus-logic.el b/lisp/gnus/gnus-logic.el index 954295438c9..a440b779930 100644 --- a/lisp/gnus/gnus-logic.el +++ b/lisp/gnus/gnus-logic.el @@ -180,46 +180,51 @@ (setq header "article")) (with-current-buffer nntp-server-buffer (let* ((request-func (cond ((string= "head" header) - 'gnus-request-head) - ((string= "body" header) - 'gnus-request-body) - (t 'gnus-request-article))) - ofunc article) + 'gnus-request-head) + ;; We need to peek at the headers to detect the + ;; content encoding + ((string= "body" header) + 'gnus-request-article) + (t 'gnus-request-article))) + ofunc article handles) ;; Not all backends support partial fetching. In that case, we ;; just fetch the entire article. (unless (gnus-check-backend-function - (intern (concat "request-" header)) - gnus-newsgroup-name) - (setq ofunc request-func) - (setq request-func 'gnus-request-article)) + (intern (concat "request-" header)) + gnus-newsgroup-name) + (setq ofunc request-func) + (setq request-func 'gnus-request-article)) (setq article (mail-header-number gnus-advanced-headers)) (gnus-message 7 "Scoring article %s..." article) (when (funcall request-func article gnus-newsgroup-name) - (goto-char (point-min)) - ;; If just parts of the article is to be searched and the - ;; backend didn't support partial fetching, we just narrow to - ;; the relevant parts. - (when ofunc - (if (eq ofunc 'gnus-request-head) - (narrow-to-region - (point) - (or (search-forward "\n\n" nil t) (point-max))) - (narrow-to-region - (or (search-forward "\n\n" nil t) (point)) - (point-max)))) - (let* ((case-fold-search (not (eq (downcase (symbol-name type)) - (symbol-name type)))) - (search-func - (cond ((memq type '(r R regexp Regexp)) - 're-search-forward) - ((memq type '(s S string String)) - 'search-forward) - (t - (error "Invalid match type: %s" type))))) - (goto-char (point-min)) - (prog1 - (funcall search-func match nil t) - (widen))))))) + (when (string= "body" header) + (setq handles (gnus-score-decode-text-parts))) + (goto-char (point-min)) + ;; If just parts of the article is to be searched and the + ;; backend didn't support partial fetching, we just narrow to + ;; the relevant parts. + (when ofunc + (if (eq ofunc 'gnus-request-head) + (narrow-to-region + (point) + (or (search-forward "\n\n" nil t) (point-max))) + (narrow-to-region + (or (search-forward "\n\n" nil t) (point)) + (point-max)))) + (let* ((case-fold-search (not (eq (downcase (symbol-name type)) + (symbol-name type)))) + (search-func + (cond ((memq type '(r R regexp Regexp)) + 're-search-forward) + ((memq type '(s S string String)) + 'search-forward) + (t + (error "Invalid match type: %s" type))))) + (goto-char (point-min)) + (prog1 + (funcall search-func match nil t) + (widen))) + (when handles (mm-destroy-parts handles)))))) (provide 'gnus-logic) diff --git a/lisp/gnus/gnus-notifications.el b/lisp/gnus/gnus-notifications.el index c5129958997..f9c2d309a35 100644 --- a/lisp/gnus/gnus-notifications.el +++ b/lisp/gnus/gnus-notifications.el @@ -29,13 +29,16 @@ ;;; Code: -(require 'notifications nil t) +(ignore-errors + (require 'notifications)) (require 'gnus-sum) (require 'gnus-group) (require 'gnus-int) (require 'gnus-art) (require 'gnus-util) -(require 'google-contacts nil t) ; Optional +(ignore-errors + (require 'google-contacts)) ; Optional +(require 'gnus-fun) (defgroup gnus-notifications nil "Send notifications on new message in Gnus." @@ -81,12 +84,14 @@ not get notifications." "Send a notification about a new mail. Return a notification id if any, or t on success." (if (fboundp 'notifications-notify) - (notifications-notify + (gnus-funcall-no-warning + 'notifications-notify :title from :body subject :actions '("read" "Read") :on-action 'gnus-notifications-action - :app-icon (image-search-load-path "gnus/gnus.png") + :app-icon (gnus-funcall-no-warning + 'image-search-load-path "gnus/gnus.png") :app-name "Gnus" :category "email.arrived" :timeout gnus-notifications-timeout @@ -100,7 +105,8 @@ Return a notification id if any, or t on success." (let ((google-photo (when (and gnus-notifications-use-google-contacts (fboundp 'google-contacts-get-photo)) (ignore-errors - (google-contacts-get-photo mail-address))))) + (gnus-funcall-no-warning + 'google-contacts-get-photo mail-address))))) (if google-photo google-photo (when gnus-notifications-use-gravatar diff --git a/lisp/gnus/gnus-score.el b/lisp/gnus/gnus-score.el index f24d889216e..f215b845514 100644 --- a/lisp/gnus/gnus-score.el +++ b/lisp/gnus/gnus-score.el @@ -1717,105 +1717,140 @@ score in `gnus-newsgroup-scored' by SCORE." (setq entries rest))))) nil) +(defun gnus-score-decode-text-parts () + (labels ((mm-text-parts (handle) + (cond ((stringp (car handle)) + (let ((parts (mapcan #'mm-text-parts (cdr handle)))) + (if (equal "multipart/alternative" (car handle)) + ;; pick the first supported alternative + (list (car parts)) + parts))) + + ((bufferp (car handle)) + (when (string-match "^text/" (mm-handle-media-type handle)) + (list handle))) + + (t (mapcan #'mm-text-parts handle)))) + (my-mm-display-part (handle) + (when handle + (save-restriction + (narrow-to-region (point) (point)) + (mm-display-inline handle) + (goto-char (point-max)))))) + + (let (;(mm-text-html-renderer 'w3m-standalone) + (handles (mm-dissect-buffer t))) + (save-excursion + (article-goto-body) + (delete-region (point) (point-max)) + (mapc #'my-mm-display-part (mm-text-parts handles)) + handles)))) + (defun gnus-score-body (scores header now expire &optional trace) - (if gnus-agent-fetching - nil - (save-excursion - (setq gnus-scores-articles - (sort gnus-scores-articles - (lambda (a1 a2) - (< (mail-header-number (car a1)) - (mail-header-number (car a2)))))) - (set-buffer nntp-server-buffer) - (save-restriction - (let* ((buffer-read-only nil) - (articles gnus-scores-articles) - (all-scores scores) - (request-func (cond ((string= "head" header) - 'gnus-request-head) - ((string= "body" header) - 'gnus-request-body) - (t 'gnus-request-article))) - entries alist ofunc article last) - (when articles - (setq last (mail-header-number (caar (last articles)))) - ;; Not all backends support partial fetching. In that case, - ;; we just fetch the entire article. - (unless (gnus-check-backend-function - (and (string-match "^gnus-" (symbol-name request-func)) - (intern (substring (symbol-name request-func) - (match-end 0)))) - gnus-newsgroup-name) - (setq ofunc request-func) - (setq request-func 'gnus-request-article)) - (while articles - (setq article (mail-header-number (caar articles))) - (gnus-message 7 "Scoring article %s of %s..." article last) - (widen) - (when (funcall request-func article gnus-newsgroup-name) - (goto-char (point-min)) - ;; If just parts of the article is to be searched, but the - ;; backend didn't support partial fetching, we just narrow - ;; to the relevant parts. - (when ofunc - (if (eq ofunc 'gnus-request-head) - (narrow-to-region - (point) - (or (search-forward "\n\n" nil t) (point-max))) - (narrow-to-region - (or (search-forward "\n\n" nil t) (point)) - (point-max)))) - (setq scores all-scores) - ;; Find matches. - (while scores - (setq alist (pop scores) - entries (assoc header alist)) - (while (cdr entries) ;First entry is the header index. - (let* ((rest (cdr entries)) - (kill (car rest)) - (match (nth 0 kill)) - (type (or (nth 3 kill) 's)) - (score (or (nth 1 kill) - gnus-score-interactive-default-score)) - (date (nth 2 kill)) - (found nil) - (case-fold-search - (not (or (eq type 'R) (eq type 'S) - (eq type 'Regexp) (eq type 'String)))) - (search-func - (cond ((or (eq type 'r) (eq type 'R) - (eq type 'regexp) (eq type 'Regexp)) - 're-search-forward) - ((or (eq type 's) (eq type 'S) - (eq type 'string) (eq type 'String)) - 'search-forward) - (t - (error "Invalid match type: %s" type))))) - (goto-char (point-min)) - (when (funcall search-func match nil t) - ;; Found a match, update scores. - (setcdr (car articles) (+ score (cdar articles))) - (setq found t) - (when trace - (push - (cons (car-safe (rassq alist gnus-score-cache)) - kill) - gnus-score-trace))) - ;; Update expire date - (unless trace - (cond - ((null date)) ;Permanent entry. - ((and found gnus-update-score-entry-dates) - ;; Match, update date. - (gnus-score-set 'touched '(t) alist) - (setcar (nthcdr 2 kill) now)) - ((and expire (< date expire)) ;Old entry, remove. - (gnus-score-set 'touched '(t) alist) - (setcdr entries (cdr rest)) - (setq rest entries)))) - (setq entries rest))))) - (setq articles (cdr articles))))))) - nil)) + (if gnus-agent-fetching + nil + (save-excursion + (setq gnus-scores-articles + (sort gnus-scores-articles + (lambda (a1 a2) + (< (mail-header-number (car a1)) + (mail-header-number (car a2)))))) + (set-buffer nntp-server-buffer) + (save-restriction + (let* ((buffer-read-only nil) + (articles gnus-scores-articles) + (all-scores scores) + (request-func (cond ((string= "head" header) + 'gnus-request-head) + ;; We need to peek at the headers to detect + ;; the content encoding + ((string= "body" header) + 'gnus-request-article) + (t 'gnus-request-article))) + entries alist ofunc article last) + (when articles + (setq last (mail-header-number (caar (last articles)))) + ;; Not all backends support partial fetching. In that case, + ;; we just fetch the entire article. + (unless (gnus-check-backend-function + (and (string-match "^gnus-" (symbol-name request-func)) + (intern (substring (symbol-name request-func) + (match-end 0)))) + gnus-newsgroup-name) + (setq ofunc request-func) + (setq request-func 'gnus-request-article)) + (while articles + (setq article (mail-header-number (caar articles))) + (gnus-message 7 "Scoring article %s of %s..." article last) + (widen) + (let (handles) + (when (funcall request-func article gnus-newsgroup-name) + (when (string= "body" header) + (setq handles (gnus-score-decode-text-parts))) + (goto-char (point-min)) + ;; If just parts of the article is to be searched, but the + ;; backend didn't support partial fetching, we just narrow + ;; to the relevant parts. + (when ofunc + (if (eq ofunc 'gnus-request-head) + (narrow-to-region + (point) + (or (search-forward "\n\n" nil t) (point-max))) + (narrow-to-region + (or (search-forward "\n\n" nil t) (point)) + (point-max)))) + (setq scores all-scores) + ;; Find matches. + (while scores + (setq alist (pop scores) + entries (assoc header alist)) + (while (cdr entries) ;First entry is the header index. + (let* ((rest (cdr entries)) + (kill (car rest)) + (match (nth 0 kill)) + (type (or (nth 3 kill) 's)) + (score (or (nth 1 kill) + gnus-score-interactive-default-score)) + (date (nth 2 kill)) + (found nil) + (case-fold-search + (not (or (eq type 'R) (eq type 'S) + (eq type 'Regexp) (eq type 'String)))) + (search-func + (cond ((or (eq type 'r) (eq type 'R) + (eq type 'regexp) (eq type 'Regexp)) + 're-search-forward) + ((or (eq type 's) (eq type 'S) + (eq type 'string) (eq type 'String)) + 'search-forward) + (t + (error "Invalid match type: %s" type))))) + (goto-char (point-min)) + (when (funcall search-func match nil t) + ;; Found a match, update scores. + (setcdr (car articles) (+ score (cdar articles))) + (setq found t) + (when trace + (push + (cons (car-safe (rassq alist gnus-score-cache)) + kill) + gnus-score-trace))) + ;; Update expire date + (unless trace + (cond + ((null date)) ;Permanent entry. + ((and found gnus-update-score-entry-dates) + ;; Match, update date. + (gnus-score-set 'touched '(t) alist) + (setcar (nthcdr 2 kill) now)) + ((and expire (< date expire)) ;Old entry, remove. + (gnus-score-set 'touched '(t) alist) + (setcdr entries (cdr rest)) + (setq rest entries)))) + (setq entries rest)))) + (when handles (mm-destroy-parts handles)))) + (setq articles (cdr articles))))))) + nil)) (defun gnus-score-thread (scores header now expire &optional trace) (gnus-score-followup scores header now expire trace t)) diff --git a/lisp/gnus/gnus-srvr.el b/lisp/gnus/gnus-srvr.el index 66509c939dc..f58cb80311a 100644 --- a/lisp/gnus/gnus-srvr.el +++ b/lisp/gnus/gnus-srvr.el @@ -490,8 +490,7 @@ The following commands are available: (error "No such server: %s" server)) (gnus-server-set-status method 'ok) (prog1 - (or (gnus-open-server method) - (progn (message "Couldn't open %s" server) nil)) + (gnus-open-server method) (gnus-server-update-server server) (gnus-server-position-point)))) diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el index 26178afa864..4c5eabab723 100644 --- a/lisp/gnus/gnus-util.el +++ b/lisp/gnus/gnus-util.el @@ -1926,6 +1926,18 @@ Same as `string-match' except this function does not change the match data." (save-match-data (string-match regexp string start)))) +(if (fboundp 'string-prefix-p) + (defalias 'gnus-string-prefix-p 'string-prefix-p) + (defun gnus-string-prefix-p (str1 str2 &optional ignore-case) + "Return non-nil if STR1 is a prefix of STR2. +If IGNORE-CASE is non-nil, the comparison is done without paying attention +to case differences." + (and (<= (length str1) (length str2)) + (let ((prefix (substring str2 0 (length str1)))) + (if ignore-case + (string-equal (downcase str1) (downcase prefix)) + (string-equal str1 prefix)))))) + (eval-and-compile (if (fboundp 'macroexpand-all) (defalias 'gnus-macroexpand-all 'macroexpand-all) diff --git a/lisp/gnus/gnus.el b/lisp/gnus/gnus.el index 5862e7807a2..8fbde5c8ecc 100644 --- a/lisp/gnus/gnus.el +++ b/lisp/gnus/gnus.el @@ -3824,12 +3824,28 @@ You should probably use `gnus-find-method-for-group' instead." "Go through PARAMETERS and expand them according to the match data." (let (new) (dolist (elem parameters) - (if (and (stringp (cdr elem)) - (string-match "\\\\[0-9&]" (cdr elem))) - (push (cons (car elem) - (gnus-expand-group-parameter match (cdr elem) group)) - new) - (push elem new))) + (cond + ((and (stringp (cdr elem)) + (string-match "\\\\[0-9&]" (cdr elem))) + (push (cons (car elem) + (gnus-expand-group-parameter match (cdr elem) group)) + new)) + ;; For `sieve' group parameters, perform substitutions for every + ;; string within the match rule. This allows for parameters such + ;; as: + ;; ("list\\.\\(.*\\)" + ;; (sieve header :is "list-id" "<\\1.domain.org>")) + ((eq 'sieve (car elem)) + (push (mapcar (lambda (sieve-elem) + (if (and (stringp sieve-elem) + (string-match "\\\\[0-9&]" sieve-elem)) + (gnus-expand-group-parameter match sieve-elem + group) + sieve-elem)) + (cdr elem)) + new)) + (t + (push elem new)))) new)) (defun gnus-group-fast-parameter (group symbol &optional allow-list) @@ -3861,9 +3877,20 @@ The function `gnus-group-find-parameter' will do that for you." (when this-result (setq result (car this-result)) ;; Expand if necessary. - (if (and (stringp result) (string-match "\\\\[0-9&]" result)) - (setq result (gnus-expand-group-parameter - (car head) result group))))))) + (cond + ((and (stringp result) (string-match "\\\\[0-9&]" result)) + (setq result (gnus-expand-group-parameter + (car head) result group))) + ;; For `sieve' group parameters, perform substitutions + ;; for every string within the match rule (see above). + ((eq symbol 'sieve) + (setq result + (mapcar (lambda (elem) + (if (stringp elem) + (gnus-expand-group-parameter (car head) + elem group) + elem)) + result)))))))) ;; Done. result)))) diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 18088423eb0..42911ce0648 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -3292,11 +3292,33 @@ or in the synonym headers, defined by `message-header-synonyms'." (defun message-insert-newsgroups () "Insert the Newsgroups header from the article being replied to." (interactive) - (when (and (message-position-on-field "Newsgroups") - (mail-fetch-field "newsgroups") - (not (string-match "\\` *\\'" (mail-fetch-field "newsgroups")))) - (insert ",")) - (insert (or (message-fetch-reply-field "newsgroups") ""))) + (let ((old-newsgroups (mail-fetch-field "newsgroups")) + (new-newsgroups (message-fetch-reply-field "newsgroups")) + (first t) + insert-newsgroups) + (message-position-on-field "Newsgroups") + (cond + ((not new-newsgroups) + (error "No Newsgroups to insert")) + ((not old-newsgroups) + (insert new-newsgroups)) + (t + (setq new-newsgroups (split-string new-newsgroups "[, ]+") + old-newsgroups (split-string old-newsgroups "[, ]+")) + (dolist (group new-newsgroups) + (unless (member group old-newsgroups) + (push group insert-newsgroups))) + (if (null insert-newsgroups) + (error "Newgroup%s already in the header" + (if (> (length new-newsgroups) 1) + "s" "")) + (when old-newsgroups + (setq first nil)) + (dolist (group insert-newsgroups) + (unless first + (insert ",")) + (setq first nil) + (insert group))))))) diff --git a/lisp/gnus/nnmaildir.el b/lisp/gnus/nnmaildir.el index 7139a528e11..74a693a9c61 100644 --- a/lisp/gnus/nnmaildir.el +++ b/lisp/gnus/nnmaildir.el @@ -77,6 +77,56 @@ (defconst nnmaildir-version "Gnus") +(defconst nnmaildir-flag-mark-mapping + '((?F . tick) + (?R . reply) + (?S . read)) + "Alist mapping Maildir filename flags to Gnus marks. +Maildir filenames are of the form \"unique-id:2,FLAGS\", +where FLAGS are a string of characters in ASCII order. +Some of the FLAGS correspond to Gnus marks.") + +(defsubst nnmaildir--mark-to-flag (mark) + "Find the Maildir flag that corresponds to MARK (an atom). +Return a character, or `nil' if not found. +See `nnmaildir-flag-mark-mapping'." + (car (rassq mark nnmaildir-flag-mark-mapping))) + +(defsubst nnmaildir--flag-to-mark (flag) + "Find the Gnus mark that corresponds to FLAG (a character). +Return an atom, or `nil' if not found. +See `nnmaildir-flag-mark-mapping'." + (cdr (assq flag nnmaildir-flag-mark-mapping))) + +(defun nnmaildir--ensure-suffix (filename) + "Ensure that FILENAME contains the suffix \":2,\"." + (if (gnus-string-match-p ":2," filename) + filename + (concat filename ":2,"))) + +(defun nnmaildir--add-flag (flag suffix) + "Return a copy of SUFFIX where FLAG is set. +SUFFIX should start with \":2,\"." + (unless (gnus-string-match-p "^:2," suffix) + (error "Invalid suffix `%s'" suffix)) + (let* ((flags (substring suffix 3)) + (flags-as-list (append flags nil)) + (new-flags + (concat (gnus-delete-duplicates + ;; maildir flags must be sorted + (sort (cons flag flags-as-list) '<))))) + (concat ":2," new-flags))) + +(defun nnmaildir--remove-flag (flag suffix) + "Return a copy of SUFFIX where FLAG is cleared. +SUFFIX should start with \":2,\"." + (unless (gnus-string-match-p "^:2," suffix) + (error "Invalid suffix `%s'" suffix)) + (let* ((flags (substring suffix 3)) + (flags-as-list (append flags nil)) + (new-flags (concat (delq flag flags-as-list)))) + (concat ":2," new-flags))) + (defvar nnmaildir-article-file-name nil "*The filename of the most recently requested article. This variable is set by nnmaildir-request-article.") @@ -152,6 +202,16 @@ by nnmaildir-request-article.") (gnm nil) ;; flag: split from mail-sources? (target-prefix nil :type string)) ;; symlink target prefix +(defun nnmaildir--article-set-flags (article new-suffix curdir) + (let* ((prefix (nnmaildir--art-prefix article)) + (suffix (nnmaildir--art-suffix article)) + (article-file (concat curdir prefix suffix)) + (new-name (concat curdir prefix new-suffix))) + (unless (file-exists-p article-file) + (error "Couldn't find article file %s" article-file)) + (rename-file article-file new-name 'replace) + (setf (nnmaildir--art-suffix article) new-suffix))) + (defun nnmaildir--expired-article (group article) (setf (nnmaildir--art-nov article) nil) (let ((flist (nnmaildir--grp-flist group)) @@ -208,29 +268,33 @@ by nnmaildir-request-article.") (eval param)) (defmacro nnmaildir--with-nntp-buffer (&rest body) + (declare (debug (body))) `(with-current-buffer nntp-server-buffer ,@body)) (defmacro nnmaildir--with-work-buffer (&rest body) + (declare (debug (body))) `(with-current-buffer (get-buffer-create " *nnmaildir work*") ,@body)) (defmacro nnmaildir--with-nov-buffer (&rest body) + (declare (debug (body))) `(with-current-buffer (get-buffer-create " *nnmaildir nov*") ,@body)) (defmacro nnmaildir--with-move-buffer (&rest body) + (declare (debug (body))) `(with-current-buffer (get-buffer-create " *nnmaildir move*") ,@body)) -(defmacro nnmaildir--subdir (dir subdir) - `(file-name-as-directory (concat ,dir ,subdir))) -(defmacro nnmaildir--srvgrp-dir (srv-dir gname) - `(nnmaildir--subdir ,srv-dir ,gname)) -(defmacro nnmaildir--tmp (dir) `(nnmaildir--subdir ,dir "tmp")) -(defmacro nnmaildir--new (dir) `(nnmaildir--subdir ,dir "new")) -(defmacro nnmaildir--cur (dir) `(nnmaildir--subdir ,dir "cur")) -(defmacro nnmaildir--nndir (dir) `(nnmaildir--subdir ,dir ".nnmaildir")) -(defmacro nnmaildir--nov-dir (dir) `(nnmaildir--subdir ,dir "nov")) -(defmacro nnmaildir--marks-dir (dir) `(nnmaildir--subdir ,dir "marks")) -(defmacro nnmaildir--num-dir (dir) `(nnmaildir--subdir ,dir "num")) +(defsubst nnmaildir--subdir (dir subdir) + (file-name-as-directory (concat dir subdir))) +(defsubst nnmaildir--srvgrp-dir (srv-dir gname) + (nnmaildir--subdir srv-dir gname)) +(defsubst nnmaildir--tmp (dir) (nnmaildir--subdir dir "tmp")) +(defsubst nnmaildir--new (dir) (nnmaildir--subdir dir "new")) +(defsubst nnmaildir--cur (dir) (nnmaildir--subdir dir "cur")) +(defsubst nnmaildir--nndir (dir) (nnmaildir--subdir dir ".nnmaildir")) +(defsubst nnmaildir--nov-dir (dir) (nnmaildir--subdir dir "nov")) +(defsubst nnmaildir--marks-dir (dir) (nnmaildir--subdir dir "marks")) +(defsubst nnmaildir--num-dir (dir) (nnmaildir--subdir dir "num")) (defmacro nnmaildir--unlink (file-arg) `(let ((file ,file-arg)) @@ -305,6 +369,7 @@ by nnmaildir-request-article.") string) (defmacro nnmaildir--condcase (errsym body &rest handler) + (declare (debug (sexp form body))) `(condition-case ,errsym (let ((system-messages-locale "C")) ,body) (error . ,handler))) @@ -759,7 +824,7 @@ by nnmaildir-request-article.") (dolist (file (funcall ls ndir nil "\\`[^.]" 'nosort)) (setq x (concat ndir file)) (and (time-less-p (nth 5 (file-attributes x)) (current-time)) - (rename-file x (concat cdir file ":2,")))) + (rename-file x (concat cdir (nnmaildir--ensure-suffix file))))) (setf (nnmaildir--grp-new group) nattr)) (setq cattr (nth 5 (file-attributes cdir))) (if (equal cattr (nnmaildir--grp-cur group)) @@ -784,11 +849,23 @@ by nnmaildir-request-article.") cdir (nnmaildir--marks-dir nndir) ndir (nnmaildir--subdir cdir "tick") cdir (nnmaildir--subdir cdir "read")) - (dolist (file files) - (setq file (car file)) - (if (or (not (file-exists-p (concat cdir file))) - (file-exists-p (concat ndir file))) - (setq num (1+ num))))) + (dolist (prefix-suffix files) + (let ((prefix (car prefix-suffix)) + (suffix (cdr prefix-suffix))) + ;; increase num for each unread or ticked article + (when (or + ;; first look for marks in suffix, if it's valid... + (when (and (stringp suffix) + (gnus-string-prefix-p ":2," suffix)) + (or + (not (gnus-string-match-p + (string (nnmaildir--mark-to-flag 'read)) suffix)) + (gnus-string-match-p + (string (nnmaildir--mark-to-flag 'tick)) suffix))) + ;; then look in marks directories + (not (file-exists-p (concat cdir prefix))) + (file-exists-p (concat ndir prefix))) + (incf num))))) (setf (nnmaildir--grp-cache group) (make-vector num nil)) (let ((inhibit-quit t)) (set (intern gname groups) group)) @@ -916,12 +993,15 @@ by nnmaildir-request-article.") "\n"))))) 'group) -(defun nnmaildir-request-marks (gname info &optional server) - (let ((group (nnmaildir--prepare server gname)) - pgname flist always-marks never-marks old-marks dotfile num dir - markdirs marks mark ranges markdir article read end new-marks ls - old-mmth new-mmth mtime mark-sym existing missing deactivate-mark - article-list) +(defun nnmaildir-request-update-info (gname info &optional server) + (let* ((group (nnmaildir--prepare server gname)) + (curdir (nnmaildir--cur + (nnmaildir--srvgrp-dir + (nnmaildir--srv-dir nnmaildir--cur-server) gname))) + (curdir-mtime (nth 5 (file-attributes curdir))) + pgname flist always-marks never-marks old-marks dotfile num dir + all-marks marks mark ranges markdir read end new-marks ls + old-mmth new-mmth mtime mark-sym existing missing deactivate-mark) (catch 'return (unless group (setf (nnmaildir--srv-error nnmaildir--cur-server) @@ -950,34 +1030,71 @@ by nnmaildir-request-article.") dir (nnmaildir--nndir dir) dir (nnmaildir--marks-dir dir) ls (nnmaildir--group-ls nnmaildir--cur-server pgname) - markdirs (funcall ls dir nil "\\`[^.]" 'nosort) - new-mmth (nnmaildir--up2-1 (length markdirs)) + all-marks (gnus-delete-duplicates + ;; get mark names from mark dirs and from flag + ;; mappings + (append + (mapcar 'cdr nnmaildir-flag-mark-mapping) + (mapcar 'intern (funcall ls dir nil "\\`[^.]" 'nosort)))) + new-mmth (nnmaildir--up2-1 (length all-marks)) new-mmth (make-vector new-mmth 0) old-mmth (nnmaildir--grp-mmth group)) - (dolist (mark markdirs) - (setq markdir (nnmaildir--subdir dir mark) - mark-sym (intern mark) + (dolist (mark all-marks) + (setq markdir (nnmaildir--subdir dir (symbol-name mark)) ranges nil) (catch 'got-ranges - (if (memq mark-sym never-marks) (throw 'got-ranges nil)) - (when (memq mark-sym always-marks) + (if (memq mark never-marks) (throw 'got-ranges nil)) + (when (memq mark always-marks) (setq ranges existing) (throw 'got-ranges nil)) - (setq mtime (nth 5 (file-attributes markdir))) - (set (intern mark new-mmth) mtime) - (when (equal mtime (symbol-value (intern-soft mark old-mmth))) - (setq ranges (assq mark-sym old-marks)) + ;; Find the mtime for this mark. If this mark can be expressed as + ;; a filename flag, get the later of the mtimes for markdir and + ;; curdir, otherwise only the markdir counts. + (setq mtime + (let ((markdir-mtime (nth 5 (file-attributes markdir)))) + (cond + ((null (nnmaildir--mark-to-flag mark)) + markdir-mtime) + ((null markdir-mtime) + curdir-mtime) + ((null curdir-mtime) + ;; this should never happen... + markdir-mtime) + ((time-less-p markdir-mtime curdir-mtime) + curdir-mtime) + (t + markdir-mtime)))) + (set (intern (symbol-name mark) new-mmth) mtime) + (when (equal mtime (symbol-value (intern-soft (symbol-name mark) old-mmth))) + (setq ranges (assq mark old-marks)) (if ranges (setq ranges (cdr ranges))) (throw 'got-ranges nil)) - (setq article-list nil) - (dolist (prefix (funcall ls markdir nil "\\`[^.]" 'nosort)) - (setq article (nnmaildir--flist-art flist prefix)) - (if article - (setq article-list - (cons (nnmaildir--art-num article) article-list)))) - (setq ranges (gnus-add-to-range ranges (sort article-list '<)))) - (if (eq mark-sym 'read) (setq read ranges) - (if ranges (setq marks (cons (cons mark-sym ranges) marks))))) + (let ((article-list nil)) + ;; Consider the article marked if it either has the flag in the + ;; filename, or is in the markdir. As you'd rarely remove a + ;; flag/mark, this should avoid losing information in the most + ;; common usage pattern. + (or + (let ((flag (nnmaildir--mark-to-flag mark))) + ;; If this mark has a corresponding maildir flag... + (when flag + (let ((regexp + (concat "\\`[^.].*:2,[A-Z]*" (string flag)))) + ;; ...then find all files with that flag. + (dolist (filename (funcall ls curdir nil regexp 'nosort)) + (let* ((prefix (car (split-string filename ":2,"))) + (article (nnmaildir--flist-art flist prefix))) + (when article + (push (nnmaildir--art-num article) article-list))))))) + ;; Also check Gnus-specific mark directory, if it exists. + (when (file-directory-p markdir) + (dolist (prefix (funcall ls markdir nil "\\`[^.]" 'nosort)) + (let ((article (nnmaildir--flist-art flist prefix))) + (when article + (push (nnmaildir--art-num article) article-list)))))) + (setq ranges (gnus-add-to-range ranges (sort article-list '<))))) + (if (eq mark 'read) (setq read ranges) + (if ranges (setq marks (cons (cons mark ranges) marks))))) (gnus-info-set-read info (gnus-range-add read missing)) (gnus-info-set-marks info marks 'extend) (setf (nnmaildir--grp-mmth group) new-mmth) @@ -1525,39 +1642,63 @@ by nnmaildir-request-article.") didnt))) (defun nnmaildir-request-set-mark (gname actions &optional server) - (let ((group (nnmaildir--prepare server gname)) - (coding-system-for-write nnheader-file-coding-system) - (buffer-file-coding-system nil) - (file-coding-system-alist nil) - del-mark del-action add-action set-action marksdir nlist - ranges begin end article all-marks todo-marks mdir mfile - pgname ls permarkfile deactivate-mark) + (let* ((group (nnmaildir--prepare server gname)) + (curdir (nnmaildir--cur + (nnmaildir--srvgrp-dir + (nnmaildir--srv-dir nnmaildir--cur-server) + gname))) + (coding-system-for-write nnheader-file-coding-system) + (buffer-file-coding-system nil) + (file-coding-system-alist nil) + del-mark del-action add-action set-action marksdir nlist + ranges begin end article all-marks todo-marks mdir mfile + pgname ls permarkfile deactivate-mark) (setq del-mark (lambda (mark) - (setq mfile (nnmaildir--subdir marksdir (symbol-name mark)) - mfile (concat mfile (nnmaildir--art-prefix article))) - (nnmaildir--unlink mfile)) + (let ((prefix (nnmaildir--art-prefix article)) + (suffix (nnmaildir--art-suffix article)) + (flag (nnmaildir--mark-to-flag mark))) + (when flag + ;; If this mark corresponds to a flag, remove the flag from + ;; the file name. + (nnmaildir--article-set-flags + article (nnmaildir--remove-flag flag suffix) curdir)) + ;; We still want to delete the hardlink in the marks dir if + ;; present, regardless of whether this mark has a maildir flag or + ;; not, to avoid getting out of sync. + (setq mfile (nnmaildir--subdir marksdir (symbol-name mark)) + mfile (concat mfile prefix)) + (nnmaildir--unlink mfile))) del-action (lambda (article) (mapcar del-mark todo-marks)) add-action (lambda (article) (mapcar (lambda (mark) - (setq mdir (nnmaildir--subdir marksdir (symbol-name mark)) - permarkfile (concat mdir ":") - mfile (concat mdir (nnmaildir--art-prefix article))) - (nnmaildir--condcase err (add-name-to-file permarkfile mfile) - (cond - ((nnmaildir--eexist-p err)) - ((nnmaildir--enoent-p err) - (nnmaildir--mkdir mdir) - (nnmaildir--mkfile permarkfile) - (add-name-to-file permarkfile mfile)) - ((nnmaildir--emlink-p err) - (let ((permarkfilenew (concat permarkfile "{new}"))) - (nnmaildir--mkfile permarkfilenew) - (rename-file permarkfilenew permarkfile 'replace) - (add-name-to-file permarkfile mfile))) - (t (signal (car err) (cdr err)))))) + (let ((prefix (nnmaildir--art-prefix article)) + (suffix (nnmaildir--art-suffix article)) + (flag (nnmaildir--mark-to-flag mark))) + (if flag + ;; If there is a corresponding maildir flag, just rename + ;; the file. + (nnmaildir--article-set-flags + article (nnmaildir--add-flag flag suffix) curdir) + ;; Otherwise, use nnmaildir-specific marks dir. + (setq mdir (nnmaildir--subdir marksdir (symbol-name mark)) + permarkfile (concat mdir ":") + mfile (concat mdir prefix)) + (nnmaildir--condcase err (add-name-to-file permarkfile mfile) + (cond + ((nnmaildir--eexist-p err)) + ((nnmaildir--enoent-p err) + (nnmaildir--mkdir mdir) + (nnmaildir--mkfile permarkfile) + (add-name-to-file permarkfile mfile)) + ((nnmaildir--emlink-p err) + (let ((permarkfilenew (concat permarkfile "{new}"))) + (nnmaildir--mkfile permarkfilenew) + (rename-file permarkfilenew permarkfile 'replace) + (add-name-to-file permarkfile mfile))) + (t (signal (car err) (cdr err)))))))) todo-marks)) set-action (lambda (article) (funcall add-action article) @@ -1581,7 +1722,12 @@ by nnmaildir-request-article.") pgname (nnmaildir--pgname nnmaildir--cur-server gname) ls (nnmaildir--group-ls nnmaildir--cur-server pgname) all-marks (funcall ls marksdir nil "\\`[^.]" 'nosort) - all-marks (mapcar 'intern all-marks)) + all-marks (gnus-delete-duplicates + ;; get mark names from mark dirs and from flag + ;; mappings + (append + (mapcar 'cdr nnmaildir-flag-mark-mapping) + (mapcar 'intern all-marks)))) (dolist (action actions) (setq ranges (car action) todo-marks (caddr action)) diff --git a/lisp/gnus/qp.el b/lisp/gnus/qp.el index 87252684a48..c4487c68b5c 100644 --- a/lisp/gnus/qp.el +++ b/lisp/gnus/qp.el @@ -53,10 +53,7 @@ them into characters should be done separately." ;; or both of which are lowercase letters in "abcdef", is ;; formally illegal. A robust implementation might choose to ;; recognize them as the corresponding uppercase letters.'' - (let ((case-fold-search t) - (decode-hex #'(lambda (n1 n2) - (+ (* (if (<= n1 ?9) (- n1 ?0) (+ (- n1 ?A) 10)) 16) - (if (<= n2 ?9) (- n2 ?0) (+ (- n2 ?A) 10)))))) + (let ((case-fold-search t)) (narrow-to-region from to) ;; Do this in case we're called from Gnus, say, in a buffer ;; which already contains non-ASCII characters which would @@ -74,8 +71,15 @@ them into characters should be done separately." (let* ((n (/ (- (match-end 0) (point)) 3)) (str (make-string n 0))) (dotimes (i n) - (aset str i (funcall decode-hex (char-after (1+ (point))) - (char-after (+ 2 (point))))) + (let ((n1 (char-after (1+ (point)))) + (n2 (char-after (+ 2 (point))))) + (aset str i + (+ (* 16 (- n1 (if (<= n1 ?9) ?0 + (if (<= n1 ?F) (- ?A 10) + (- ?a 10))))) + (- n2 (if (<= n2 ?9) ?0 + (if (<= n2 ?F) (- ?A 10) + (- ?a 10))))))) (forward-char 3)) (delete-region (match-beginning 0) (match-end 0)) (insert str))) diff --git a/lisp/help.el b/lisp/help.el index 9740f8996c1..da11389d87c 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -585,6 +585,8 @@ temporarily enables it to allow getting help on disabled items and buttons." (setq saved-yank-menu (copy-sequence yank-menu)) (menu-bar-update-yank-menu "(any string)" nil)) (setq key (read-key-sequence "Describe key (or click or menu item): ")) + ;; Clear the echo area message (Bug#7014). + (message nil) ;; If KEY is a down-event, read and discard the ;; corresponding up-event. Note that there are also ;; down-events on scroll bars and mode lines: the actual @@ -962,7 +964,11 @@ is currently activated with completion." result)) ;;; Automatic resizing of temporary buffers. -(defcustom temp-buffer-max-height (lambda (buffer) (/ (- (frame-height) 2) 2)) +(defcustom temp-buffer-max-height + (lambda (buffer) + (if (eq (selected-window) (frame-root-window)) + (/ (x-display-pixel-height) (frame-char-height) 2) + (/ (- (frame-height) 2) 2))) "Maximum height of a window displaying a temporary buffer. This is effective only when Temp Buffer Resize mode is enabled. The value is the maximum height (in lines) which @@ -973,7 +979,16 @@ buffer, and should return a positive integer. At the time the function is called, the window to be resized is selected." :type '(choice integer function) :group 'help - :version "20.4") + :version "24.2") + +(defcustom temp-buffer-resize-frames nil + "Non-nil means `temp-buffer-resize-mode' can resize frames. +A frame can be resized if and only if its root window is a live +window. The height of the root window is subject to the values of +`temp-buffer-max-height' and `window-min-height'." + :type 'boolean + :version "24.2" + :group 'help) (define-minor-mode temp-buffer-resize-mode "Toggle auto-resizing temporary buffer windows (Temp Buffer Resize Mode). @@ -1008,9 +1023,21 @@ view." (with-selected-window window (funcall temp-buffer-max-height (window-buffer))) temp-buffer-max-height))) - (when (and (pos-visible-in-window-p (point-min) window) - (window-combined-p window)) - (fit-window-to-buffer window height)))) + (cond + ((and (pos-visible-in-window-p (point-min) window) + (window-combined-p window)) + (fit-window-to-buffer window height)) + ((and temp-buffer-resize-frames + (eq window (frame-root-window window)) + (memq (car (window-parameter window 'quit-restore)) + ;; If 'same is too strong, we might additionally check + ;; whether the second element is 'frame. + '(same frame))) + (let ((frame (window-frame window))) + (fit-frame-to-buffer + frame (+ (frame-height frame) + (- (window-total-size window)) + height))))))) ;;; Help windows. (defcustom help-window-select 'other diff --git a/lisp/isearch.el b/lisp/isearch.el index e6e0a01566a..04f5a7acc2c 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -1405,6 +1405,7 @@ Use `isearch-exit' to quit without signaling." (interactive) (setq isearch-word (unless (eq isearch-word 'isearch-symbol-regexp) 'isearch-symbol-regexp)) + (if isearch-word (setq isearch-regexp nil)) (setq isearch-success t isearch-adjusted t) (isearch-update)) @@ -1579,14 +1580,10 @@ way to run word replacements from Isearch is `M-s w ... M-%'." ;; set `search-upper-case' to nil to not call ;; `isearch-no-upper-case-p' in `perform-replace' (search-upper-case nil) - (replace-search-function - (if (and isearch-lax-whitespace (not regexp-flag)) - #'search-forward-lax-whitespace - replace-search-function)) - (replace-re-search-function - (if (and isearch-regexp-lax-whitespace regexp-flag) - #'re-search-forward-lax-whitespace - replace-re-search-function)) + (replace-lax-whitespace + isearch-lax-whitespace) + (replace-regexp-lax-whitespace + isearch-regexp-lax-whitespace) ;; Set `isearch-recursive-edit' to nil to prevent calling ;; `exit-recursive-edit' in `isearch-done' that terminates ;; the execution of this command when it is non-nil. @@ -2956,10 +2953,14 @@ Attempt to do the search exactly the way the pending Isearch would." (let ((case-fold-search isearch-lazy-highlight-case-fold-search) (isearch-regexp isearch-lazy-highlight-regexp) (isearch-word isearch-lazy-highlight-word) + (isearch-lax-whitespace + isearch-lazy-highlight-lax-whitespace) + (isearch-regexp-lax-whitespace + isearch-lazy-highlight-regexp-lax-whitespace) + (isearch-forward isearch-lazy-highlight-forward) (search-invisible nil) ; don't match invisible text (retry t) (success nil) - (isearch-forward isearch-lazy-highlight-forward) (bound (if isearch-lazy-highlight-forward (min (or isearch-lazy-highlight-end-limit (point-max)) (if isearch-lazy-highlight-wrapped diff --git a/lisp/loadup.el b/lisp/loadup.el index a460fcab339..d389427bafd 100644 --- a/lisp/loadup.el +++ b/lisp/loadup.el @@ -102,6 +102,19 @@ (setq load-source-file-function 'load-with-code-conversion) (load "files") +;; Load-time macro-expansion can only take effect after setting +;; load-source-file-function because of where it is called in lread.c. +(load "emacs-lisp/macroexp") +(if (byte-code-function-p (symbol-function 'macroexpand-all)) + nil + ;; Since loaddefs is not yet loaded, macroexp's uses of pcase will simply + ;; fail until pcase is explicitly loaded. This also means that we have to + ;; disable eager macro-expansion while loading pcase. + (let ((macroexp--pending-eager-loads '(skip))) + (load "emacs-lisp/pcase")) + ;; Re-load macroexp so as to eagerly macro-expand its uses of pcase. + (load "emacs-lisp/macroexp")) + (load "cus-face") (load "faces") ; after here, `defface' may be used. @@ -266,21 +279,6 @@ ;For other systems, you must edit ../src/Makefile.in. (load "site-load" t) -;; ¡¡¡ Big Ugly Hack !!! -;; src/bootstrap-emacs is mostly used to compile .el files, so it needs -;; macroexp, bytecomp, cconv, and byte-opt to be fast. Generally this is done -;; by compiling those files first, but this only makes a difference if those -;; files are not preloaded. As it so happens, macroexp.el tends to be -;; accidentally preloaded in src/bootstrap-emacs because cl.el and cl-macs.el -;; require it. So let's unload it here, if needed, to make sure the -;; byte-compiled version is used. -(if (or (not (fboundp 'macroexpand-all)) - (byte-code-function-p (symbol-function 'macroexpand-all))) - nil - (fmakunbound 'macroexpand-all) - (setq features (delq 'macroexp features)) - (autoload 'macroexpand-all "macroexp")) - ;; Determine which last version number to use ;; based on the executables that now exist. (if (and (or (equal (nth 3 command-line-args) "dump") diff --git a/lisp/mail/smtpmail.el b/lisp/mail/smtpmail.el index 804fe7a8798..69a405436a7 100644 --- a/lisp/mail/smtpmail.el +++ b/lisp/mail/smtpmail.el @@ -200,10 +200,10 @@ The list is in preference order.") ;; local binding in the mail buffer will take effect. (smtpmail-mail-address (or (and mail-specify-envelope-from (mail-envelope-from)) - (smtpmail-user-mail-address) - (let ((from (mail-fetch-field "from"))) + (let ((from (mail-fetch-field "from"))) (and from - (cadr (mail-extract-address-components from)))))) + (cadr (mail-extract-address-components from)))) + (smtpmail-user-mail-address))) (smtpmail-code-conv-from (if enable-multibyte-characters (let ((sendmail-coding-system smtpmail-code-conv-from)) @@ -653,12 +653,10 @@ Returns an error if the server cannot be contacted." (or smtpmail-mail-address (and mail-specify-envelope-from (mail-envelope-from)) - (smtpmail-user-mail-address) - ;; Fall back on the From: header as the envelope From - ;; address. (let ((from (mail-fetch-field "from"))) (and from - (cadr (mail-extract-address-components from)))))) + (cadr (mail-extract-address-components from)))) + (smtpmail-user-mail-address))) response-code process-buffer result diff --git a/lisp/net/browse-url.el b/lisp/net/browse-url.el index f7aa5f8ed52..8daf339d376 100644 --- a/lisp/net/browse-url.el +++ b/lisp/net/browse-url.el @@ -744,7 +744,7 @@ narrowed." (and buffer (set-buffer buffer)) (let ((file-name ;; Ignore real name if restricted - (and (= (- (point-max) (point-min)) (buffer-size)) + (and (not (buffer-narrowed-p)) (or buffer-file-name (and (boundp 'dired-directory) dired-directory))))) (or file-name diff --git a/lisp/play/blackbox.el b/lisp/play/blackbox.el index db2e18188e5..16189600156 100644 --- a/lisp/play/blackbox.el +++ b/lisp/play/blackbox.el @@ -97,7 +97,9 @@ (let ((map (make-keymap))) (suppress-keymap map t) (blackbox-redefine-key map 'backward-char 'bb-left) + (blackbox-redefine-key map 'left-char 'bb-left) (blackbox-redefine-key map 'forward-char 'bb-right) + (blackbox-redefine-key map 'right-char 'bb-right) (blackbox-redefine-key map 'previous-line 'bb-up) (blackbox-redefine-key map 'next-line 'bb-down) (blackbox-redefine-key map 'move-end-of-line 'bb-eol) diff --git a/lisp/progmodes/cc-cmds.el b/lisp/progmodes/cc-cmds.el index 7cd0a0b0ae2..eec6873dc19 100644 --- a/lisp/progmodes/cc-cmds.el +++ b/lisp/progmodes/cc-cmds.el @@ -493,13 +493,16 @@ inside a literal or a macro, nothing special happens." (insert-char ?\n 1) ;; In AWK (etc.) or in a macro, make sure this CR hasn't changed ;; the syntax. (There might already be an escaped NL there.) - (when (or (c-at-vsemi-p (1- (point))) - (let ((pt (point))) - (save-excursion - (backward-char) - (and (c-beginning-of-macro) - (progn (c-end-of-macro) - (< (point) pt)))))) + (when (or + (save-excursion + (c-skip-ws-backward (c-point 'bopl)) + (c-at-vsemi-p)) + (let ((pt (point))) + (save-excursion + (backward-char) + (and (c-beginning-of-macro) + (progn (c-end-of-macro) + (< (point) pt)))))) (backward-char) (insert-char ?\\ 1) (forward-char)) diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el index 142ec4cdd66..2aa04cb2b0b 100644 --- a/lisp/progmodes/cc-engine.el +++ b/lisp/progmodes/cc-engine.el @@ -3091,6 +3091,8 @@ comment at the start of cc-engine.el for more info." c-state-cache-good-pos 1 c-state-nonlit-pos-cache nil c-state-nonlit-pos-cache-limit 1 + c-state-semi-nonlit-pos-cache nil + c-state-semi-nonlit-pos-cache-limit 1 c-state-brace-pair-desert nil c-state-point-min 1 c-state-point-min-lit-type nil @@ -3350,6 +3352,8 @@ comment at the start of cc-engine.el for more info." c-state-cache-good-pos c-state-nonlit-pos-cache c-state-nonlit-pos-cache-limit + c-state-semi-nonlit-pos-cache + c-state-semi-nonlit-pos-cache-limit c-state-brace-pair-desert c-state-point-min c-state-point-min-lit-type @@ -9579,12 +9583,12 @@ comment at the start of cc-engine.el for more info." (setq tmpsymbol nil) (while (and (> (point) placeholder) (zerop (c-backward-token-2 1 t)) - (/= (char-after) ?=)) + (not (looking-at "=\\([^=]\\|$\\)"))) (and c-opt-inexpr-brace-list-key (not tmpsymbol) (looking-at c-opt-inexpr-brace-list-key) (setq tmpsymbol 'topmost-intro-cont))) - (eq (char-after) ?=)) + (looking-at "=\\([^=]\\|$\\)")) (looking-at c-brace-list-key)) (save-excursion (while (and (< (point) indent-point) diff --git a/lisp/progmodes/flymake.el b/lisp/progmodes/flymake.el index ad285274928..10d5fdf9c64 100644 --- a/lisp/progmodes/flymake.el +++ b/lisp/progmodes/flymake.el @@ -977,6 +977,9 @@ from compile.el") ;; :type '(repeat (string number number number)) ;;) +(defvar flymake-warning-re "^[wW]arning" + "Regexp matching against err-text to detect a warning.") + (defun flymake-parse-line (line) "Parse LINE to see if it is an error or warning. Return its components if so, nil otherwise." @@ -997,7 +1000,7 @@ Return its components if so, nil otherwise." (match-string (nth 4 (car patterns)) line) (flymake-patch-err-text (substring line (match-end 0))))) (or err-text (setq err-text "")) - (if (and err-text (string-match "^[wW]arning" err-text)) + (if (and err-text (string-match flymake-warning-re err-text)) (setq err-type "w") ) (flymake-log 3 "parse line: file-idx=%s line-idx=%s file=%s line=%s text=%s" file-idx line-idx diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el index 601850ed0fb..ffc6c1ac885 100644 --- a/lisp/progmodes/python.el +++ b/lisp/progmodes/python.el @@ -1824,7 +1824,11 @@ When MSG is non-nil messages the first line of STRING." (lines (split-string string "\n" t))) (and msg (message "Sent: %s..." (nth 0 lines))) (if (> (length lines) 1) - (let* ((temp-file-name (make-temp-file "py")) + (let* ((temporary-file-directory + (if (file-remote-p default-directory) + (concat (file-remote-p default-directory) "/tmp") + temporary-file-directory)) + (temp-file-name (make-temp-file "py")) (file-name (or (buffer-file-name) temp-file-name))) (with-temp-file temp-file-name (insert string) @@ -1931,8 +1935,14 @@ FILE-NAME." (interactive "fFile to send: ") (let* ((process (or process (python-shell-get-or-create-process))) (temp-file-name (when temp-file-name - (expand-file-name temp-file-name))) - (file-name (or (expand-file-name file-name) temp-file-name))) + (expand-file-name + (or (file-remote-p temp-file-name 'localname) + temp-file-name)))) + (file-name (or (when file-name + (expand-file-name + (or (file-remote-p file-name 'localname) + file-name))) + temp-file-name))) (when (not file-name) (error "If FILE-NAME is nil then TEMP-FILE-NAME must be non-nil")) (python-shell-send-string diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index 457c7fee36c..77ec8084ea2 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -64,8 +64,8 @@ "Regexp to match keywords that nest without blocks.") (defconst ruby-indent-beg-re - (concat "\\(\\s *" (regexp-opt '("class" "module" "def") t) "\\)\\|" - (regexp-opt '("if" "unless" "case" "while" "until" "for" "begin"))) + (concat "^\\s *" (regexp-opt '("class" "module" "def" "if" "unless" "case" + "while" "until" "for" "begin")) "\\_>") "Regexp to match where the indentation gets deeper.") (defconst ruby-modifier-beg-keywords @@ -98,6 +98,10 @@ (defconst ruby-block-end-re "\\_") +(defconst ruby-defun-beg-re + '"\\(def\\|class\\|module\\)" + "Regexp to match the beginning of a defun, in the general sense.") + (eval-and-compile (defconst ruby-here-doc-beg-re "\\(<\\)<\\(-\\)?\\(\\([a-zA-Z0-9_]+\\)\\|[\"]\\([^\"]+\\)[\"]\\|[']\\([^']+\\)[']\\)" @@ -138,18 +142,11 @@ This should only be called after matching against `ruby-here-doc-beg-re'." (defvar ruby-mode-map (let ((map (make-sparse-keymap))) - (define-key map "{" 'ruby-electric-brace) - (define-key map "}" 'ruby-electric-brace) - (define-key map (kbd "M-C-a") 'ruby-beginning-of-defun) - (define-key map (kbd "M-C-e") 'ruby-end-of-defun) (define-key map (kbd "M-C-b") 'ruby-backward-sexp) (define-key map (kbd "M-C-f") 'ruby-forward-sexp) (define-key map (kbd "M-C-p") 'ruby-beginning-of-block) (define-key map (kbd "M-C-n") 'ruby-end-of-block) - (define-key map (kbd "M-C-h") 'ruby-mark-defun) (define-key map (kbd "M-C-q") 'ruby-indent-exp) - (define-key map (kbd "C-M-h") 'backward-kill-word) - (define-key map (kbd "C-j") 'reindent-then-newline-and-indent) (define-key map (kbd "C-c {") 'ruby-toggle-block) map) "Keymap used in Ruby mode.") @@ -840,20 +837,13 @@ and `\\' when preceded by `?'." (+ indent ruby-indent-level) indent)))) -(defun ruby-electric-brace (arg) - "Insert a brace and re-indent the current line." - (interactive "P") - (self-insert-command (prefix-numeric-value arg)) - (ruby-indent-line t)) - -;; TODO: Why isn't one ruby-*-of-defun written in terms of the other? (defun ruby-beginning-of-defun (&optional arg) "Move backward to the beginning of the current top-level defun. With ARG, move backward multiple defuns. Negative ARG means move forward." (interactive "p") - (and (re-search-backward (concat "^\\(" ruby-block-beg-re "\\)\\b") - nil 'move (or arg 1)) + (and (re-search-backward (concat "^\\s *" ruby-defun-beg-re "\\_>") + nil t (or arg 1)) (beginning-of-line))) (defun ruby-end-of-defun (&optional arg) @@ -861,19 +851,18 @@ move forward." With ARG, move forward multiple defuns. Negative ARG means move backward." (interactive "p") - (and (re-search-forward (concat "^\\(" ruby-block-end-re "\\)\\($\\|\\b[^_]\\)") - nil 'move (or arg 1)) - (beginning-of-line)) - (forward-line 1)) + (ruby-forward-sexp) + (when (looking-back (concat "^\\s *" ruby-block-end-re)) + (forward-line 1))) (defun ruby-beginning-of-indent () - "TODO: document" - ;; I don't understand this function. - ;; It seems like it should move to the line where indentation should deepen, - ;; but ruby-indent-beg-re only accounts for whitespace before class, module and def, - ;; so this will only match other block beginners at the beginning of the line. - (and (re-search-backward (concat "^\\(" ruby-indent-beg-re "\\)\\_>") nil 'move) - (beginning-of-line))) + "Backtrack to a line which can be used as a reference for +calculating indentation on the lines after it." + (while (and (re-search-backward ruby-indent-beg-re nil 'move) + (if (ruby-in-ppss-context-p 'anything) + t + ;; We can stop, then. + (beginning-of-line))))) (defun ruby-move-to-block (n) "Move to the beginning (N < 0) or the end (N > 0) of the current block @@ -1024,15 +1013,6 @@ With ARG, do it many times. Negative ARG means move forward." ((error))) i))) -(defun ruby-mark-defun () - "Put mark at end of this Ruby function, point at beginning." - (interactive) - (push-mark (point)) - (ruby-end-of-defun) - (push-mark (point) nil t) - (ruby-beginning-of-defun) - (re-search-backward "^\n" (- (point) 1) t)) - (defun ruby-indent-exp (&optional ignored) "Indent each line in the balanced expression following the point." (interactive "*P") @@ -1073,7 +1053,7 @@ See `add-log-current-defun-function'." (let (mname mlist (indent 0)) ;; get current method (or class/module) (if (re-search-backward - (concat "^[ \t]*\\(def\\|class\\|module\\)[ \t]+" + (concat "^[ \t]*" ruby-defun-beg-re "[ \t]+" "\\(" ;; \\. and :: for class method "\\([A-Za-z_]" ruby-symbol-re "*\\|\\.\\|::" "\\)" @@ -1127,46 +1107,65 @@ See `add-log-current-defun-function'." (if mlist (concat mlist mname) mname) mlist))))) -(defun ruby-brace-to-do-end () - (when (looking-at "{") - (let ((orig (point)) (end (progn (ruby-forward-sexp) (point)))) - (when (eq (char-before) ?\}) - (delete-char -1) - (if (eq (char-syntax (char-before)) ?w) - (insert " ")) - (insert "end") - (if (eq (char-syntax (char-after)) ?w) - (insert " ")) - (goto-char orig) - (delete-char 1) - (if (eq (char-syntax (char-before)) ?w) - (insert " ")) - (insert "do") - (when (looking-at "\\sw\\||") - (insert " ") - (backward-char)) - t)))) +(defun ruby-brace-to-do-end (orig end) + (let (beg-marker end-marker) + (goto-char end) + (when (eq (char-before) ?\}) + (delete-char -1) + (skip-chars-backward " \t") + (when (not (bolp)) + (insert "\n")) + (insert "end") + (setq end-marker (point-marker)) + (when (and (not (eobp)) (eq (char-syntax (char-after)) ?w)) + (insert " ")) + (goto-char orig) + (delete-char 1) + (when (eq (char-syntax (char-before)) ?w) + (insert " ")) + (insert "do") + (setq beg-marker (point-marker)) + (when (looking-at "\\(\\s \\)*|") + (unless (match-beginning 1) + (insert " ")) + (goto-char (1+ (match-end 0))) + (search-forward "|")) + (unless (looking-at "\\s *$") + (insert "\n")) + (indent-region beg-marker end-marker) + (goto-char beg-marker) + t))) -(defun ruby-do-end-to-brace () - (when (and (or (bolp) - (not (memq (char-syntax (char-before)) '(?w ?_)))) - (looking-at "\\ end start))) + (if (match-beginning 1) + (ruby-brace-to-do-end beg end) + (ruby-do-end-to-brace beg end))) + (goto-char start)))) (declare-function ruby-syntax-propertize-heredoc "ruby-mode" (limit)) (declare-function ruby-syntax-enclosing-percent-literal "ruby-mode" (limit)) @@ -1193,8 +1192,6 @@ It will be properly highlighted even when the call omits parens.")) (ruby-syntax-enclosing-percent-literal end) (funcall (syntax-propertize-rules - ;; #{ }, #$hoge, #@foo are not comments. - ("\\(#\\)[{$@]" (1 ".")) ;; $' $" $` .... are variables. ;; ?' ?" ?` are ascii codes. ("\\([?$]\\)[#\"'`]" @@ -1326,8 +1323,7 @@ This should only be called after matching against `ruby-here-doc-end-re'." (concat "-?\\([\"']\\|\\)" contents "\\1")))))) (defconst ruby-font-lock-syntactic-keywords - `( ;; #{ }, #$hoge, #@foo are not comments - ("\\(#\\)[{$@]" 1 (1 . nil)) + `( ;; the last $', $", $` in the respective string is not variable ;; the last ?', ?", ?` in the respective string is not ascii code ("\\(^\\|[\[ \t\n<+\(,=]\\)\\(['\"`]\\)\\(\\\\.\\|\\2\\|[^'\"`\n\\\\]\\)*?\\\\?[?$]\\(\\2\\)" @@ -1549,6 +1545,9 @@ See `font-lock-syntax-table'.") ;; variables '("\\(^\\|[^_:.@$]\\|\\.\\.\\)\\b\\(nil\\|self\\|true\\|false\\)\\>" 2 font-lock-variable-name-face) + ;; symbols + '("\\(^\\|[^:]\\)\\(:\\([-+~]@?\\|[/%&|^`]\\|\\*\\*?\\|<\\(<\\|=>?\\)?\\|>[>=]?\\|===?\\|=~\\|![~=]?\\|\\[\\]=?\\|@?\\(\\w\\|_\\)+\\([!?=]\\|\\b_*\\)\\|#{[^}\n\\\\]*\\(\\\\.[^}\n\\\\]*\\)*}\\)\\)" + 2 font-lock-reference-face) ;; variables '("\\(\\$\\([^a-zA-Z0-9 \n]\\|[0-9]\\)\\)\\W" 1 font-lock-variable-name-face) @@ -1557,12 +1556,9 @@ See `font-lock-syntax-table'.") ;; constants '("\\(^\\|[^_]\\)\\b\\([A-Z]+\\(\\w\\|_\\)*\\)" 2 font-lock-type-face) - ;; symbols - '("\\(^\\|[^:]\\)\\(:\\([-+~]@?\\|[/%&|^`]\\|\\*\\*?\\|<\\(<\\|=>?\\)?\\|>[>=]?\\|===?\\|=~\\|![~=]?\\|\\[\\]=?\\|\\(\\w\\|_\\)+\\([!?=]\\|\\b_*\\)\\|#{[^}\n\\\\]*\\(\\\\.[^}\n\\\\]*\\)*}\\)\\)" - 2 font-lock-reference-face) '("\\(^\\s *\\|[\[\{\(,]\\s *\\|\\sw\\s +\\)\\(\\(\\sw\\|_\\)+\\):[^:]" 2 font-lock-reference-face) ;; expression expansion - '("#\\({[^}\n\\\\]*\\(\\\\.[^}\n\\\\]*\\)*}\\|\\(\\$\\|@\\|@@\\)\\(\\w\\|_\\)+\\)" + '(ruby-match-expression-expansion 0 font-lock-variable-name-face t) ;; warn lower camel case ;'("\\<[a-z]+[a-z0-9]*[A-Z][A-Za-z0-9]*\\([!?]?\\|\\>\\)" @@ -1570,6 +1566,11 @@ See `font-lock-syntax-table'.") ) "Additional expressions to highlight in Ruby mode.") +(defun ruby-match-expression-expansion (limit) + (when (re-search-forward "[^\\]\\(\\\\\\\\\\)*\\(#\\({[^}\n\\\\]*\\(\\\\.[^}\n\\\\]*\\)*}\\|\\(\\$\\|@\\|@@\\)\\(\\w\\|_\\)+\\)\\)" limit 'move) + (or (ruby-in-ppss-context-p 'string) + (ruby-match-expression-expansion limit)))) + ;;;###autoload (define-derived-mode ruby-mode prog-mode "Ruby" "Major mode for editing Ruby scripts. @@ -1586,6 +1587,10 @@ The variable `ruby-indent-level' controls the amount of indentation. 'ruby-imenu-create-index) (set (make-local-variable 'add-log-current-defun-function) 'ruby-add-log-current-method) + (set (make-local-variable 'beginning-of-defun-function) + 'ruby-beginning-of-defun) + (set (make-local-variable 'end-of-defun-function) + 'ruby-end-of-defun) (add-hook (cond ((boundp 'before-save-hook) 'before-save-hook) diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index a422462775d..b4d550bcee0 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -1062,21 +1062,22 @@ subshells can nest." (backward-char 1)) (when (eq (char-before) ?|) (backward-char 1) t))) - (when (progn (backward-char 2) - (if (> start (line-end-position)) - (put-text-property (point) (1+ start) - 'syntax-multiline t)) - ;; FIXME: The `in' may just be a random argument to - ;; a normal command rather than the real `in' keyword. - ;; I.e. we should look back to try and find the - ;; corresponding `case'. - (and (looking-at ";[;&]\\|\\_ (point) (1+ (point-min))) + (progn (backward-char 2) + (if (> start (line-end-position)) + (put-text-property (point) (1+ start) + 'syntax-multiline t)) + ;; FIXME: The `in' may just be a random argument to + ;; a normal command rather than the real `in' keyword. + ;; I.e. we should look back to try and find the + ;; corresponding `case'. + (and (looking-at ";[;&]\\|\\_ font-lock-maximum-size (buffer-size))) - (imenu-add-to-menubar "Index") - (message "Scanning buffer for index...buffer too big")))) + (imenu-add-to-menubar "Index"))) ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; Source file menu (using `easy-menu.el') @@ -14385,10 +14382,10 @@ if required." (define-key vhdl-speedbar-key-map (int-to-string key) `(lambda () (interactive) (vhdl-speedbar-set-depth ,key))) (setq key (1+ key))))) - (define-key speedbar-key-map "h" + (define-key speedbar-mode-map "h" (lambda () (interactive) (speedbar-change-initial-expansion-list "vhdl directory"))) - (define-key speedbar-key-map "H" + (define-key speedbar-mode-map "H" (lambda () (interactive) (speedbar-change-initial-expansion-list "vhdl project"))) ;; menu @@ -17400,7 +17397,8 @@ to visually support naming conventions.") "Display VARIABLE's documentation in *Help* buffer." (interactive) (unless (featurep 'xemacs) - (help-setup-xref (list #'vhdl-doc-variable variable) (interactive-p))) + (help-setup-xref (list #'vhdl-doc-variable variable) + (called-interactively-p 'interactive))) (with-output-to-temp-buffer (if (fboundp 'help-buffer) (help-buffer) "*Help*") (princ (documentation-property variable 'variable-documentation)) @@ -17412,7 +17410,8 @@ to visually support naming conventions.") "Display VHDL Mode documentation in *Help* buffer." (interactive) (unless (featurep 'xemacs) - (help-setup-xref (list #'vhdl-doc-mode) (interactive-p))) + (help-setup-xref (list #'vhdl-doc-mode) + (called-interactively-p 'interactive))) (with-output-to-temp-buffer (if (fboundp 'help-buffer) (help-buffer) "*Help*") (princ mode-name) diff --git a/lisp/register.el b/lisp/register.el index 2816c9831de..fb35a26a653 100644 --- a/lisp/register.el +++ b/lisp/register.el @@ -76,6 +76,22 @@ A list of the form (WINDOW-CONFIGURATION POSITION) A list of the form (FRAME-CONFIGURATION POSITION) represents a saved frame configuration plus a saved value of point.") +(defgroup register nil + "Register commands." + :group 'convenience + :version "24.3") + +(defcustom register-separator nil + "Register containing the text to put between collected texts, or nil if none. + +When collecting text with +`append-to-register' (resp. `prepend-to-register') contents of +this register is added to the beginning (resp. end) of the marked +text." + :group 'register + :type '(choice (const :tag "None" nil) + (character :tag "Use register" :value ?+))) + (defun get-register (register) "Return contents of Emacs register named REGISTER, or nil if none." (cdr (assq register register-alist))) @@ -192,13 +208,24 @@ Interactively, NUMBER is the prefix arg (none means nil)." (string-to-number (match-string 0))) 0)))) -(defun increment-register (number register) - "Add NUMBER to the contents of register REGISTER. -Interactively, NUMBER is the prefix arg." - (interactive "p\ncIncrement register: ") - (or (numberp (get-register register)) - (error "Register does not contain a number")) - (set-register register (+ number (get-register register)))) +(defun increment-register (prefix register) + "Augment contents of REGISTER. +Interactively, PREFIX is in raw form. + +If REGISTER contains a number, add `prefix-numeric-value' of +PREFIX to it. + +If REGISTER is empty or if it contains text, call +`append-to-register' with `delete-flag' set to PREFIX." + (interactive "P\ncIncrement register: ") + (let ((register-val (get-register register))) + (cond + ((numberp register-val) + (let ((number (prefix-numeric-value prefix))) + (set-register register (+ number register-val)))) + ((or (not register-val) (stringp register-val)) + (append-to-register register (region-beginning) (region-end) prefix)) + (t (error "Register does not contain a number or text"))))) (defun view-register (register) "Display what is contained in register named REGISTER. @@ -349,10 +376,11 @@ Called from program, takes four args: REGISTER, START, END and DELETE-FLAG. START and END are buffer positions indicating what to append." (interactive "cAppend to register: \nr\nP") (let ((reg (get-register register)) - (text (filter-buffer-substring start end))) + (text (filter-buffer-substring start end)) + (separator (and register-separator (get-register register-separator)))) (set-register register (cond ((not reg) text) - ((stringp reg) (concat reg text)) + ((stringp reg) (concat reg separator text)) (t (error "Register does not contain text"))))) (cond (delete-flag (delete-region start end)) @@ -366,10 +394,11 @@ Called from program, takes four args: REGISTER, START, END and DELETE-FLAG. START and END are buffer positions indicating what to prepend." (interactive "cPrepend to register: \nr\nP") (let ((reg (get-register register)) - (text (filter-buffer-substring start end))) + (text (filter-buffer-substring start end)) + (separator (and register-separator (get-register register-separator)))) (set-register register (cond ((not reg) text) - ((stringp reg) (concat text reg)) + ((stringp reg) (concat text separator reg)) (t (error "Register does not contain text"))))) (cond (delete-flag (delete-region start end)) diff --git a/lisp/replace.el b/lisp/replace.el index 3373ee8e512..001f7d1a78d 100644 --- a/lisp/replace.el +++ b/lisp/replace.el @@ -33,6 +33,22 @@ :type 'boolean :group 'matching) +(defcustom replace-lax-whitespace nil + "Non-nil means `query-replace' matches a sequence of whitespace chars. +When you enter a space or spaces in the strings to be replaced, +it will match any sequence matched by the regexp `search-whitespace-regexp'." + :type 'boolean + :group 'matching + :version "24.3") + +(defcustom replace-regexp-lax-whitespace nil + "Non-nil means `query-replace-regexp' matches a sequence of whitespace chars. +When you enter a space or spaces in the regexps to be replaced, +it will match any sequence matched by the regexp `search-whitespace-regexp'." + :type 'boolean + :group 'matching + :version "24.3") + (defvar query-replace-history nil "Default history list for query-replace commands. See `query-replace-from-history-variable' and @@ -226,6 +242,10 @@ letters. \(Transferring the case pattern means that if the old text matched is all caps, or capitalized, then its replacement is upcased or capitalized.) +If `replace-lax-whitespace' is non-nil, a space or spaces in the string +to be replaced will match a sequence of whitespace chars defined by the +regexp in `search-whitespace-regexp'. + Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace only matches surrounded by word boundaries. Fourth and fifth arg START and END specify the region to operate on. @@ -270,6 +290,10 @@ pattern of the old text to the new text, if `case-replace' and all caps, or capitalized, then its replacement is upcased or capitalized.) +If `replace-regexp-lax-whitespace' is non-nil, a space or spaces in the regexp +to be replaced will match a sequence of whitespace chars defined by the +regexp in `search-whitespace-regexp'. + Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace only matches surrounded by word boundaries. Fourth and fifth arg START and END specify the region to operate on. @@ -346,6 +370,10 @@ minibuffer. Preserves case in each replacement if `case-replace' and `case-fold-search' are non-nil and REGEXP has no uppercase letters. +If `replace-regexp-lax-whitespace' is non-nil, a space or spaces in the regexp +to be replaced will match a sequence of whitespace chars defined by the +regexp in `search-whitespace-regexp'. + Third arg DELIMITED (prefix arg if interactive), if non-nil, means replace only matches that are surrounded by word boundaries. Fourth and fifth arg START and END specify the region to operate on." @@ -437,6 +465,10 @@ are non-nil and FROM-STRING has no uppercase letters. \(Preserving case means that if the string matched is all caps, or capitalized, then its replacement is upcased or capitalized.) +If `replace-lax-whitespace' is non-nil, a space or spaces in the string +to be replaced will match a sequence of whitespace chars defined by the +regexp in `search-whitespace-regexp'. + In Transient Mark mode, if the mark is active, operate on the contents of the region. Otherwise, operate from point to the end of the buffer. @@ -475,6 +507,10 @@ and TO-STRING is also null.)" Preserve case in each match if `case-replace' and `case-fold-search' are non-nil and REGEXP has no uppercase letters. +If `replace-regexp-lax-whitespace' is non-nil, a space or spaces in the regexp +to be replaced will match a sequence of whitespace chars defined by the +regexp in `search-whitespace-regexp'. + In Transient Mark mode, if the mark is active, operate on the contents of the region. Otherwise, operate from point to the end of the buffer. @@ -1589,14 +1625,28 @@ E to edit the replacement string" (define-key map "?" 'help) (define-key map "\C-g" 'quit) (define-key map "\C-]" 'quit) - (define-key map "\e" 'exit-prefix) + (define-key map "\C-v" 'scroll-up) + (define-key map "\M-v" 'scroll-down) + (define-key map [next] 'scroll-up) + (define-key map [prior] 'scroll-down) + (define-key map [?\C-\M-v] 'scroll-other-window) + (define-key map [M-next] 'scroll-other-window) + (define-key map [?\C-\M-\S-v] 'scroll-other-window-down) + (define-key map [M-prior] 'scroll-other-window-down) + ;; Binding ESC would prohibit the M-v binding. Instead, callers + ;; should check for ESC specially. + ;; (define-key map "\e" 'exit-prefix) (define-key map [escape] 'exit-prefix) map) - "Keymap that defines the responses to questions in `query-replace'. + "Keymap of responses to questions posed by commands like `query-replace'. The \"bindings\" in this map are not commands; they are answers. The valid answers include `act', `skip', `act-and-show', -`exit', `act-and-exit', `edit', `edit-replacement', `delete-and-edit', -`recenter', `automatic', `backup', `exit-prefix', `quit', and `help'.") +`act-and-exit', `exit', `exit-prefix', `recenter', `scroll-up', +`scroll-down', `scroll-other-window', `scroll-other-window-down', +`edit', `edit-replacement', `delete-and-edit', `automatic', +`backup', `quit', and `help'. + +This keymap is used by `y-or-n-p' as well as `query-replace'.") (defvar multi-query-replace-map (let ((map (make-sparse-keymap))) @@ -1717,12 +1767,12 @@ passed in. If LITERAL is set, no checking is done, anyway." (replace-match newtext fixedcase literal) noedit) -(defvar replace-search-function 'search-forward +(defvar replace-search-function nil "Function to use when searching for strings to replace. It is used by `query-replace' and `replace-string', and is called with three arguments, as if it were `search-forward'.") -(defvar replace-re-search-function 're-search-forward +(defvar replace-re-search-function nil "Function to use when searching for regexps to replace. It is used by `query-replace-regexp', `replace-regexp', `query-replace-regexp-eval', and `map-query-replace-regexp'. @@ -1755,9 +1805,18 @@ make, or the user didn't cancel the call." (nocasify (not (and case-replace case-fold-search))) (literal (or (not regexp-flag) (eq regexp-flag 'literal))) (search-function - (if regexp-flag - replace-re-search-function - replace-search-function)) + (or (if regexp-flag + replace-re-search-function + replace-search-function) + (let ((isearch-regexp regexp-flag) + (isearch-word delimited-flag) + (isearch-lax-whitespace + replace-lax-whitespace) + (isearch-regexp-lax-whitespace + replace-regexp-lax-whitespace) + (isearch-case-fold-search case-fold-search) + (isearch-forward t)) + (isearch-search-fun)))) (search-string from-string) (real-match-data nil) ; The match data for the current match. (next-replacement nil) @@ -1811,12 +1870,6 @@ make, or the user didn't cancel the call." (vector repeat-count repeat-count replacements replacements))))) - (if delimited-flag - (setq search-function 're-search-forward - search-string (concat "\\b" - (if regexp-flag from-string - (regexp-quote from-string)) - "\\b"))) (when query-replace-lazy-highlight (setq isearch-lazy-highlight-last-string nil)) @@ -1898,7 +1951,7 @@ make, or the user didn't cancel the call." (replace-highlight (nth 0 real-match-data) (nth 1 real-match-data) start end search-string - (or delimited-flag regexp-flag) case-fold-search)) + regexp-flag delimited-flag case-fold-search)) (setq noedit (replace-match-maybe-edit next-replacement nocasify literal @@ -1917,7 +1970,7 @@ make, or the user didn't cancel the call." (replace-highlight (match-beginning 0) (match-end 0) start end search-string - (or delimited-flag regexp-flag) case-fold-search) + regexp-flag delimited-flag case-fold-search) ;; Bind message-log-max so we don't fill up the message log ;; with a bunch of identical messages. (let ((message-log-max nil) @@ -2099,15 +2152,11 @@ make, or the user didn't cancel the call." (if (= replace-count 1) "" "s"))) (or (and keep-going stack) multi-buffer))) -(defvar isearch-error) -(defvar isearch-forward) -(defvar isearch-case-fold-search) -(defvar isearch-string) - (defvar replace-overlay nil) (defun replace-highlight (match-beg match-end range-beg range-end - string regexp case-fold) + search-string regexp-flag delimited-flag + case-fold-search) (if query-replace-highlight (if replace-overlay (move-overlay replace-overlay match-beg match-end (current-buffer)) @@ -2115,13 +2164,14 @@ make, or the user didn't cancel the call." (overlay-put replace-overlay 'priority 1001) ;higher than lazy overlays (overlay-put replace-overlay 'face 'query-replace))) (if query-replace-lazy-highlight - (let ((isearch-string string) - (isearch-regexp regexp) - ;; Set isearch-word to nil because word-replace is regexp-based, - ;; so `isearch-search-fun' should not use `word-search-forward'. - (isearch-word nil) - (search-whitespace-regexp nil) - (isearch-case-fold-search case-fold) + (let ((isearch-string search-string) + (isearch-regexp regexp-flag) + (isearch-word delimited-flag) + (isearch-lax-whitespace + replace-lax-whitespace) + (isearch-regexp-lax-whitespace + replace-regexp-lax-whitespace) + (isearch-case-fold-search case-fold-search) (isearch-forward t) (isearch-error nil)) (isearch-lazy-highlight-new-loop range-beg range-end)))) diff --git a/lisp/ses.el b/lisp/ses.el index 8add16a6996..7cdac74e310 100644 --- a/lisp/ses.el +++ b/lisp/ses.el @@ -1270,11 +1270,9 @@ when the width of cell (ROW,COL) has changed." ;; The data area ;;---------------------------------------------------------------------------- -(defun ses-narrowed-p () (/= (- (point-max) (point-min)) (buffer-size))) - (defun ses-widen () "Turn off narrowing, to be reenabled at end of command loop." - (if (ses-narrowed-p) + (if (buffer-narrowed-p) (setq ses--deferred-narrow t)) (widen)) diff --git a/lisp/simple.el b/lisp/simple.el index b7a24f4f970..d87ae3c5c15 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -974,7 +974,9 @@ rather than the region. If called from Lisp, return the number of words between positions START and END." - (interactive "r\nP") + (interactive (if current-prefix-arg + (list nil nil current-prefix-arg) + (list (region-beginning) (region-end) nil))) (cond ((not (called-interactively-p 'any)) (count-words start end)) (arg @@ -1008,9 +1010,7 @@ END, without printing any message." (defun count-words--buffer-message () (count-words--message - (if (= (point-max) (1+ (buffer-size))) - "Buffer" - "Narrowed part of buffer") + (if (buffer-narrowed-p) "Narrowed part of buffer" "Buffer") (point-min) (point-max))) (defun count-words--message (str start end) diff --git a/lisp/speedbar.el b/lisp/speedbar.el index 16993ce1891..90cdea63e85 100644 --- a/lisp/speedbar.el +++ b/lisp/speedbar.el @@ -763,7 +763,7 @@ DIRECTORY-EXPRESSION to `speedbar-ignored-directory-expressions'." "Non-nil means to automatically update the display. When this is nil then speedbar will not follow the attached frame's directory. If you want to change this while speedbar is active, either use -\\[customize] or call \\ `\\[speedbar-toggle-updates]'." +\\[customize] or call \\ `\\[speedbar-toggle-updates]'." :group 'speedbar :initialize 'custom-initialize-default :set (lambda (sym val) @@ -1083,7 +1083,7 @@ Return nil if it doesn't exist." (define-derived-mode speedbar-mode fundamental-mode "Speedbar" "Major mode for managing a display of directories and tags. -\\ +\\ The first line represents the default directory of the speedbar frame. Each directory segment is a button which jumps speedbar's default directory to that directory. Buttons are activated by clicking `\\[speedbar-click]'. @@ -1120,7 +1120,7 @@ category of tags. Click the {+} to expand the category. Jump-able tags start with >. Click the name of the tag to go to that position in the selected file. -\\{speedbar-key-map}" +\\{speedbar-mode-map}" (save-excursion (setq font-lock-keywords nil) ;; no font-locking please (setq truncate-lines t) diff --git a/lisp/subr.el b/lisp/subr.el index 74afd59f8d5..be785ff8fba 100644 --- a/lisp/subr.el +++ b/lisp/subr.el @@ -1548,7 +1548,7 @@ if it is empty or a duplicate." (or keep-all (not (equal (car history) newelt)))) (if history-delete-duplicates - (delete newelt history)) + (setq history (delete newelt history))) (setq history (cons newelt history)) (when (integerp maxelt) (if (= 0 maxelt) @@ -2237,7 +2237,8 @@ keyboard-quit events while waiting for a valid input." (error "Called `read-char-choice' without valid char choices")) (let (char done show-help (helpbuf " *Char Help*")) (let ((cursor-in-echo-area t) - (executing-kbd-macro executing-kbd-macro)) + (executing-kbd-macro executing-kbd-macro) + (esc-flag nil)) (save-window-excursion ; in case we call help-form-show (while (not done) (unless (get-text-property 0 'face prompt) @@ -2261,8 +2262,12 @@ keyboard-quit events while waiting for a valid input." ;; there are no more events in the macro. Attempt to ;; get an event interactively. (setq executing-kbd-macro nil)) - ((and (not inhibit-keyboard-quit) (eq char ?\C-g)) - (keyboard-quit)))))) + ((not inhibit-keyboard-quit) + (cond + ((and (null esc-flag) (eq char ?\e)) + (setq esc-flag t)) + ((memq char '(?\C-g ?\e)) + (keyboard-quit)))))))) ;; Display the question with the answer. But without cursor-in-echo-area. (message "%s%s" prompt (char-to-string char)) char)) @@ -2314,11 +2319,19 @@ floating point support." PROMPT is the string to display to ask the question. It should end in a space; `y-or-n-p' adds \"(y or n) \" to it. -No confirmation of the answer is requested; a single character is enough. -Also accepts Space to mean yes, or Delete to mean no. \(Actually, it uses -the bindings in `query-replace-map'; see the documentation of that variable -for more information. In this case, the useful bindings are `act', `skip', -`recenter', and `quit'.\) +No confirmation of the answer is requested; a single character is +enough. SPC also means yes, and DEL means no. + +To be precise, this function translates user input into responses +by consulting the bindings in `query-replace-map'; see the +documentation of that variable for more information. In this +case, the useful bindings are `act', `skip', `recenter', +`scroll-up', `scroll-down', and `quit'. +An `act' response means yes, and a `skip' response means no. +A `quit' response means to invoke `keyboard-quit'. +If the user enters `recenter', `scroll-up', or `scroll-down' +responses, perform the requested window recentering or scrolling +and ask again. Under a windowing system a dialog box will be used if `last-nonmenu-event' is nil and `use-dialog-box' is non-nil." @@ -2350,21 +2363,33 @@ is nil and `use-dialog-box' is non-nil." "" " ") "(y or n) ")) (while - (let* ((key + (let* ((scroll-actions '(recenter scroll-up scroll-down + scroll-other-window scroll-other-window-down)) + (key (let ((cursor-in-echo-area t)) (when minibuffer-auto-raise (raise-frame (window-frame (minibuffer-window)))) - (read-key (propertize (if (eq answer 'recenter) + (read-key (propertize (if (memq answer scroll-actions) prompt (concat "Please answer y or n. " prompt)) 'face 'minibuffer-prompt))))) (setq answer (lookup-key query-replace-map (vector key) t)) (cond - ((memq answer '(skip act)) nil) - ((eq answer 'recenter) (recenter) t) - ((memq answer '(exit-prefix quit)) (signal 'quit nil) t) - (t t))) + ((memq answer '(skip act)) nil) + ((eq answer 'recenter) + (recenter) t) + ((eq answer 'scroll-up) + (ignore-errors (scroll-up-command)) t) + ((eq answer 'scroll-down) + (ignore-errors (scroll-down-command)) t) + ((eq answer 'scroll-other-window) + (ignore-errors (scroll-other-window)) t) + ((eq answer 'scroll-other-window-down) + (ignore-errors (scroll-other-window-down)) t) + ((or (memq answer '(exit-prefix quit)) (eq key ?\e)) + (signal 'quit nil) t) + (t t))) (ding) (discard-input)))) (let ((ret (eq answer 'act))) @@ -2647,6 +2672,10 @@ directory if it does not exist." ;;;; Misc. useful functions. +(defsubst buffer-narrowed-p () + "Return non-nil if the current buffer is narrowed." + (/= (- (point-max) (point-min)) (buffer-size))) + (defun find-tag-default () "Determine default tag to search for, based on text at point. If there is no plausible default, return nil." @@ -3728,7 +3757,7 @@ from `standard-syntax-table' otherwise." table)) (defun syntax-after (pos) - "Return the raw syntax of the char after POS. + "Return the raw syntax descriptor for the char after POS. If POS is outside the buffer's accessible portion, return nil." (unless (or (< pos (point-min)) (>= pos (point-max))) (let ((st (if parse-sexp-lookup-properties @@ -3737,7 +3766,12 @@ If POS is outside the buffer's accessible portion, return nil." (aref (or st (syntax-table)) (char-after pos)))))) (defun syntax-class (syntax) - "Return the syntax class part of the syntax descriptor SYNTAX. + "Return the code for the syntax class described by SYNTAX. + +SYNTAX should be a raw syntax descriptor; the return value is a +integer which encodes the corresponding syntax class. See Info +node `(elisp)Syntax Table Internals' for a list of codes. + If SYNTAX is nil, return nil." (and syntax (logand (car syntax) 65535))) diff --git a/lisp/textmodes/picture.el b/lisp/textmodes/picture.el index 24a4ac1b033..e663c1b45f4 100644 --- a/lisp/textmodes/picture.el +++ b/lisp/textmodes/picture.el @@ -612,13 +612,15 @@ Leaves the region surrounding the rectangle." (define-key map [remap self-insert-command] 'picture-self-insert) (define-key map [remap self-insert-command] 'picture-self-insert) (define-key map [remap completion-separator-self-insert-command] - 'picture-self-insert) + 'picture-self-insert) (define-key map [remap completion-separator-self-insert-autofilling] - 'picture-self-insert) + 'picture-self-insert) (define-key map [remap forward-char] 'picture-forward-column) + (define-key map [remap right-char] 'picture-forward-column) (define-key map [remap backward-char] 'picture-backward-column) + (define-key map [remap left-char] 'picture-backward-column) (define-key map [remap delete-char] 'picture-clear-column) - ;; There are two possibilities for what is normally on DEL. + ;; There are two possibilities for what is normally on DEL. (define-key map [remap backward-delete-char-untabify] 'picture-backward-clear-column) (define-key map [remap delete-backward-char] 'picture-backward-clear-column) diff --git a/lisp/userlock.el b/lisp/userlock.el index 705d9588249..4c003e423aa 100644 --- a/lisp/userlock.el +++ b/lisp/userlock.el @@ -108,37 +108,27 @@ You can rewrite this to use any criterion you like to choose which one to do. The buffer in question is current when this function is called." (discard-input) (save-window-excursion - (let (answer) + (let ((prompt + (format "%s changed on disk; \ +really edit the buffer? (y, n, r or C-h) " + (file-name-nondirectory fn))) + (choices '(?y ?n ?r ?? ?\C-h)) + answer) (while (null answer) - (message "%s changed on disk; really edit the buffer? (y, n, r or C-h) " - (file-name-nondirectory fn)) - (let ((tem (downcase (let ((cursor-in-echo-area t)) - (read-char-exclusive))))) - (setq answer - (if (= tem help-char) - 'help - (cdr (assoc tem '((?n . yield) - (?\C-g . yield) - (?y . proceed) - (?r . revert) - (?? . help)))))) - (cond ((null answer) - (beep) - (message "Please type y, n or r; or ? for help") - (sit-for 3)) - ((eq answer 'help) - (ask-user-about-supersession-help) - (setq answer nil)) - ((eq answer 'revert) - (revert-buffer nil (not (buffer-modified-p))) - ; ask confirmation if buffer modified - (signal 'file-supersession - (list "File reverted" fn))) - ((eq answer 'yield) - (signal 'file-supersession - (list "File changed on disk" fn)))))) + (setq answer (read-char-choice prompt choices)) + (cond ((memq answer '(?? ?\C-h)) + (ask-user-about-supersession-help) + (setq answer nil)) + ((eq answer ?r) + ;; Ask for confirmation if buffer modified + (revert-buffer nil (not (buffer-modified-p))) + (signal 'file-supersession + (list "File reverted" fn))) + ((eq answer ?n) + (signal 'file-supersession + (list "File changed on disk" fn))))) (message - "File on disk now will become a backup file if you save these changes.") + "File on disk now will become a backup file if you save these changes.") (setq buffer-backed-up nil)))) (defun ask-user-about-supersession-help () diff --git a/lisp/window.el b/lisp/window.el index f73c85e991b..dd1f55450c3 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -5521,6 +5521,62 @@ the selected one." (window--display-buffer buffer window 'reuse display-buffer-mark-dedicated))))) +(defun display-buffer-in-previous-window (buffer alist) + "Display BUFFER in a window previously showing it. +If ALIST has a non-nil `inhibit-same-window' entry, the selected +window is not eligible for reuse. + +If ALIST contains a `reusable-frames' entry, its value determines +which frames to search for a reusable window: + nil -- the selected frame (actually the last non-minibuffer frame) + A frame -- just that frame + `visible' -- all visible frames + 0 -- all frames on the current terminal + t -- all frames. + +If ALIST contains no `reusable-frames' entry, search just the +selected frame if `display-buffer-reuse-frames' and +`pop-up-frames' are both nil; search all frames on the current +terminal if either of those variables is non-nil. + +If ALIST has a `previous-window' entry, the window specified by +that entry will override any other window found by the methods +above, even if that window never showed BUFFER before." + (let* ((alist-entry (assq 'reusable-frames alist)) + (inhibit-same-window + (cdr (assq 'inhibit-same-window alist))) + (frames (cond + (alist-entry (cdr alist-entry)) + ((if (eq pop-up-frames 'graphic-only) + (display-graphic-p) + pop-up-frames) + 0) + (display-buffer-reuse-frames 0) + (t (last-nonminibuffer-frame)))) + entry best-window second-best-window window) + ;; Scan windows whether they have shown the buffer recently. + (catch 'best + (dolist (window (window-list-1 (frame-first-window) 'nomini frames)) + (when (and (assq buffer (window-prev-buffers window)) + (not (window-dedicated-p window))) + (if (eq window (selected-window)) + (unless inhibit-same-window + (setq second-best-window window)) + (setq best-window window) + (throw 'best t))))) + ;; When ALIST has a `previous-window' entry, that entry may override + ;; anything we found so far. + (when (and (setq window (cdr (assq 'previous-window alist))) + (window-live-p window) + (not (window-dedicated-p window))) + (if (eq window (selected-window)) + (unless inhibit-same-window + (setq second-best-window window)) + (setq best-window window))) + ;; Return best or second best window found. + (when (setq window (or best-window second-best-window)) + (window--display-buffer buffer window 'reuse)))) + (defun display-buffer-use-some-window (buffer alist) "Display BUFFER in an existing window. Search for a usable window, set that window to the buffer, and @@ -5642,26 +5698,28 @@ buffer with the name BUFFER-OR-NAME and return that buffer." (defun switch-to-buffer (buffer-or-name &optional norecord force-same-window) "Switch to buffer BUFFER-OR-NAME in the selected window. -If called interactively, prompt for the buffer name using the +If the selected window cannot display the specified +buffer (e.g. if it is a minibuffer window or strongly dedicated +to another buffer), call `pop-to-buffer' to select the buffer in +another window. + +If called interactively, read the buffer name using the minibuffer. The variable `confirm-nonexistent-file-or-buffer' determines whether to request confirmation before creating a new buffer. -BUFFER-OR-NAME may be a buffer, a string (a buffer name), or -nil. If BUFFER-OR-NAME is a string that does not identify an -existing buffer, create a buffer with that name. If -BUFFER-OR-NAME is nil, switch to the buffer returned by -`other-buffer'. +BUFFER-OR-NAME may be a buffer, a string (a buffer name), or nil. +If BUFFER-OR-NAME is a string that does not identify an existing +buffer, create a buffer with that name. If BUFFER-OR-NAME is +nil, switch to the buffer returned by `other-buffer'. -Optional argument NORECORD non-nil means do not put the buffer -specified by BUFFER-OR-NAME at the front of the buffer list and -do not make the window displaying it the most recently selected -one. +If optional argument NORECORD is non-nil, do not put the buffer +at the front of the buffer list, and do not make the window +displaying it the most recently selected one. -If FORCE-SAME-WINDOW is non-nil, BUFFER-OR-NAME must be displayed -in the selected window; signal an error if that is -impossible (e.g. if the selected window is minibuffer-only). If -nil, BUFFER-OR-NAME may be displayed in another window. +If optional argument FORCE-SAME-WINDOW is non-nil, the buffer +must be displayed in the selected window; if that is impossible, +signal an error rather than calling `pop-to-buffer'. Return the buffer switched to." (interactive @@ -5918,6 +5976,88 @@ WINDOW was scrolled." (error (setq delta nil))) delta)))) +(defcustom fit-frame-to-buffer-bottom-margin 4 + "Bottom margin for `fit-frame-to-buffer'. +This is the number of lines `fit-frame-to-buffer' leaves free at the +bottom of the display in order to not obscure the system task bar." + :type 'integer + :version "24.2" + :group 'windows) + +(defun fit-frame-to-buffer (&optional frame max-height min-height) + "Adjust height of FRAME to display its buffer's contents exactly. +FRAME can be any live frame and defaults to the selected one. + +Optional argument MAX-HEIGHT specifies the maximum height of +FRAME and defaults to the height of the display below the current +top line of FRAME minus FIT-FRAME-TO-BUFFER-BOTTOM-MARGIN. +Optional argument MIN-HEIGHT specifies the minimum height of +FRAME." + (interactive) + (setq frame (window-normalize-frame frame)) + (let* ((root (frame-root-window frame)) + (frame-min-height + (+ (- (frame-height frame) (window-total-size root)) + window-min-height)) + (frame-top (frame-parameter frame 'top)) + (top (if (consp frame-top) + (funcall (car frame-top) (cadr frame-top)) + frame-top)) + (frame-max-height + (- (/ (- (x-display-pixel-height frame) top) + (frame-char-height frame)) + fit-frame-to-buffer-bottom-margin)) + (compensate 0) + delta) + (when (and (window-live-p root) (not (window-size-fixed-p root))) + (with-selected-window root + (cond + ((not max-height) + (setq max-height frame-max-height)) + ((numberp max-height) + (setq max-height (min max-height frame-max-height))) + (t + (error "%s is an invalid maximum height" max-height))) + (cond + ((not min-height) + (setq min-height frame-min-height)) + ((numberp min-height) + (setq min-height (min min-height frame-min-height))) + (t + (error "%s is an invalid minimum height" min-height))) + ;; When tool-bar-mode is enabled and we have just created a new + ;; frame, reserve lines for toolbar resizing. This is needed + ;; because for reasons unknown to me Emacs (1) reserves one line + ;; for the toolbar when making the initial frame and toolbars + ;; are enabled, and (2) later adds the remaining lines needed. + ;; Our code runs IN BETWEEN (1) and (2). YMMV when you're on a + ;; system that behaves differently. + (let ((quit-restore (window-parameter root 'quit-restore)) + (lines (tool-bar-lines-needed frame))) + (when (and quit-restore (eq (car quit-restore) 'frame) + (not (zerop lines))) + (setq compensate (1- lines)))) + (message "%s" compensate) + (setq delta + ;; Always count a final newline - we don't do any + ;; post-processing, so let's play safe. + (+ (count-screen-lines nil nil t) + (- (window-body-size)) + compensate))) + ;; Move away from final newline. + (when (and (eobp) (bolp) (not (bobp))) + (set-window-point root (line-beginning-position 0))) + (set-window-start root (point-min)) + (set-window-vscroll root 0) + (condition-case nil + (set-frame-height + frame + (min (max (+ (frame-height frame) delta) + min-height) + max-height)) + (error (setq delta nil)))) + delta)) + (defun window-safely-shrinkable-p (&optional window) "Return t if WINDOW can be shrunk without shrinking other windows. WINDOW defaults to the selected window." @@ -6161,7 +6301,7 @@ This is different from `scroll-down-command' that scrolls a full screen." (put 'scroll-down-line 'scroll-command t) -(defun scroll-other-window-down (lines) +(defun scroll-other-window-down (&optional lines) "Scroll the \"other window\" down. For more details, see the documentation for `scroll-other-window'." (interactive "P") diff --git a/make-dist b/make-dist index b157d9a54d6..28d2ec15214 100755 --- a/make-dist +++ b/make-dist @@ -273,7 +273,7 @@ mkdir ${tempdir} ### README while the rest of the tar file is still unpacking. Whoopee. echo "Making links to top-level files" ln INSTALL README BUGS ${tempdir} -ln ChangeLog Makefile.in configure configure.ac ${tempdir} +ln ChangeLog Makefile.in autogen.sh configure configure.ac ${tempdir} ln config.bat make-dist .dir-locals.el ${tempdir} ln aclocal.m4 ${tempdir} diff --git a/nt/ChangeLog b/nt/ChangeLog index 4ceb74ed0b5..fd528315e2a 100644 --- a/nt/ChangeLog +++ b/nt/ChangeLog @@ -1,3 +1,26 @@ +2012-09-08 Eli Zaretskii + + * configure.bat : Don't leave it set in the + environment when the script exits. + +2012-09-07 Juanma Barranquero + + * config.nt: Sync with autogen/config.in. + (NO_ABORT, SIGNAL_H_AHB): Remove. + +2012-09-07 Eli Zaretskii + + * inc/ms-w32.h (struct sigaction): Declare sa_handler __cdecl. + +2012-09-05 Juanma Barranquero + + * config.nt: Sync with autogen/config.in. + +2012-09-04 Paul Eggert + + Simplify redefinition of 'abort' (Bug#12316). + * inc/ms-w32.h (w32_abort) [HAVE_NTGUI]: Remove. + 2012-09-02 Juanma Barranquero * config.nt: Sync with autogen/config.in. diff --git a/nt/config.nt b/nt/config.nt index 7658275f2d6..5dc171bae44 100644 --- a/nt/config.nt +++ b/nt/config.nt @@ -162,9 +162,16 @@ along with GNU Emacs. If not, see . */ #define FIRST_PTY_LETTER 'a' /* Define if the float library doesn't handle errors by either setting errno, - or signaling SIGFPE/SIGILL. */ + or signaling SIGFPE. */ #undef FLOAT_CHECK_DOMAIN +/* Enable compile-time and run-time bounds-checking, and some warnings, + without upsetting glibc 2.15+. */ + #if defined __OPTIMIZE__ && __OPTIMIZE__ + # define _FORTIFY_SOURCE 2 + #endif + + /* Define to 1 if futimesat mishandles a NULL file name. */ #undef FUTIMESAT_NULL_BUG @@ -1182,9 +1189,6 @@ along with GNU Emacs. If not, see . */ `NO'. */ #undef NARROWPROTO -/* Do not define abort in emacs.c. */ -#undef NO_ABORT - /* Define if XEditRes should not be used. */ #undef NO_EDITRES @@ -1306,9 +1310,6 @@ along with GNU Emacs. If not, see . */ /* Make process_send_signal work by "typing" a signal character on the pty. */ #undef SIGNALS_VIA_CHARACTERS -/* Define if AH_BOTTOM should include signal.h. */ -#undef SIGNAL_H_AHB - /* Define to l, ll, u, ul, ull, etc., as suitable for constants of type 'sig_atomic_t'. */ #undef SIG_ATOMIC_T_SUFFIX @@ -1468,9 +1469,6 @@ along with GNU Emacs. If not, see . */ /* Number of bits in a file offset, on hosts where this is settable. */ #undef _FILE_OFFSET_BITS -/* enable compile-time and run-time bounds-checking, and some warnings */ -#undef _FORTIFY_SOURCE - /* Define to 1 if Gnulib overrides 'struct stat' on Windows so that struct stat.st_size becomes 64-bit. */ #undef _GL_WINDOWS_64_BIT_ST_SIZE @@ -1547,10 +1545,12 @@ along with GNU Emacs. If not, see . */ declarations. Define as empty for no equivalent. */ #undef __restrict_arr -/* Some platforms redefine this. */ +/* Define to longjmp if _setjmp and _longjmp do not work. Because longjmp may + alter signal masks, callers of _longjmp should not assume that it leaves + signal masks alone. */ #undef _longjmp -/* Some platforms redefine this. */ +/* Define to setjmp if _setjmp and _longjmp do not work. See _longjmp. */ #undef _setjmp /* Some platforms that do not use configure define this to include extra diff --git a/nt/configure.bat b/nt/configure.bat index 56793a0d1c3..5890b12d02e 100755 --- a/nt/configure.bat +++ b/nt/configure.bat @@ -949,4 +949,6 @@ set HAVE_PNG= set HAVE_TIFF= set HAVE_XPM= set dbginfo= +endlocal +set use_extensions= diff --git a/nt/inc/ms-w32.h b/nt/inc/ms-w32.h index 8945fb7be4d..22255843f13 100644 --- a/nt/inc/ms-w32.h +++ b/nt/inc/ms-w32.h @@ -127,7 +127,7 @@ typedef int ssize_t; struct sigaction { int sa_flags; - void (*sa_handler)(int); + void (_CALLBACK_ *sa_handler)(int); sigset_t sa_mask; }; #define SIG_BLOCK 1 @@ -334,16 +334,7 @@ extern char *get_emacs_configuration_options (void); #include #endif -/* stdlib.h must be included after redefining malloc & friends, but - before redefining abort. Isn't library redefinition funny? */ #include - -/* Redefine abort. */ -#ifdef HAVE_NTGUI -#define abort w32_abort -extern _Noreturn void w32_abort (void); -#endif - #include /* Define for those source files that do not include enough NT system files. */ diff --git a/nt/inc/unistd.h b/nt/inc/unistd.h index fb1f1c4b3bf..7db6cf08bea 100644 --- a/nt/inc/unistd.h +++ b/nt/inc/unistd.h @@ -3,8 +3,12 @@ #ifndef _UNISTD_H #define _UNISTD_H +/* On Microsoft platforms, declares 'environ'; on POSIX + platforms, does. Every file in Emacs that includes + also includes , so there's no need to declare + 'environ' here. */ + extern ssize_t readlink (const char *, char *, size_t); extern int symlink (char const *, char const *); #endif /* _UNISTD_H */ - diff --git a/src/.gdbinit b/src/.gdbinit index de980c6345f..79419f66ac1 100644 --- a/src/.gdbinit +++ b/src/.gdbinit @@ -1222,14 +1222,9 @@ if ($ptr != 0) set $tem = (struct Lisp_String *) $ptr set $tem = (char *) $tem->data - # Don't let abort actually run, as it will make stdio stop working and - # therefore the `pr' command above as well. - if $tem[0] == 'w' && $tem[1] == 'i' && $tem[2] == 'n' && $tem[3] == 'd' - # The windows-nt build replaces abort with its own function. - break w32_abort - else - break abort - end + # Don't let emacs_abort actually run, as it will make stdio stop + # working and therefore the 'pr' command above as well. + break emacs_abort end # x_error_quitter is defined only on X. But window-system is set up diff --git a/src/ChangeLog b/src/ChangeLog index 43e629eb5f6..548c80b3b85 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,11 +1,440 @@ +2012-09-10 Chong Yidong + + * fns.c (Fdelq, Fdelete): Doc fix. + +2012-09-10 Paul Eggert + + * lisp.h (XSETINT, XSETCONS, XSETVECTOR, XSETSTRING, XSETSYMBOL) + (XSETFLOAT, XSETMISC): Parenthesize macro bodies. + +2012-09-09 Stefan Monnier + + * lisp.h (make_lisp_ptr): New macro to replace XSET. + (XSETCONS, XSETVECTOR, XSETSTRING, XSETSYMBOL, XSETFLOAT, XSETMISC): + Use it. + +2012-09-09 Eli Zaretskii + + * fringe.c (draw_fringe_bitmap_1): Don't reduce the width of the + left fringe if the window has a left margin. This avoids leaving + traces of the cursor because its leftmost pixel is not drawn over. + + * dispnew.c (update_window_line): When the left margin area of a + screen line is updated, set the redraw_fringe_bitmaps_p flag of + that screen line. (Bug#12277) + +2012-09-09 Paul Eggert + + Assume C89 or later for math functions (Bug#12381). + This simplifies the code, and makes it a bit smaller and faster, + and (most important) makes it easier to clean up signal handling + since we can stop worring about floating-point exceptions in + library code. That was a problem before C89, but the problem + went away many years ago on all practical Emacs targets. + * data.c, image.c, lread.c, print.c: + Don't include ; no longer needed. + * data.c, floatfns.c (IEEE_FLOATING_POINT): Don't worry that it + might be autoconfigured, as that never happens. + * data.c (fmod): + * doprnt.c (DBL_MAX_10_EXP): + * print.c (DBL_DIG): + Remove. C89 or later always defines these. + * floatfns.c (HAVE_MATHERR, FLOAT_CHECK_ERRNO, FLOAT_CHECK_DOMAIN) + (in_float, float_error_arg, float_error_arg2, float_error_fn_name) + (arith_error, domain_error, domain_error2): + Remove all this pre-C89 cruft. Do not include as that's + no longer needed -- we simply return what C returns. All uses removed. + (IN_FLOAT, IN_FLOAT2): Remove. All uses replaced with + the wrapped code. + (FLOAT_TO_INT, FLOAT_TO_INT2, range_error, range_error2): + Remove. All uses expanded, as these macros are no longer used + more than once and are now more trouble than they're worth. + (Ftan): Use tan, not sin / cos. + (Flogb): Assume C89 frexp. + (fmod_float): Assume C89 fmod. + (matherr) [HAVE_MATHERR]: Remove; no longer needed. + (init_floatfns): Remove. All uses removed. + +2012-09-08 Jan Djärv + + * nsterm.m (ns_draw_fringe_bitmap, ns_dumpglyphs_image): Take back + compositeToPoint for OSX < 10.6 (Bug#12390). + +2012-09-08 Paul Eggert + + * floatfns.c (Ftan): Use tan (x), not (sin (x) / cos (x)). + This produces more-accurate results. + +2012-09-08 Jan Djärv + + * nsterm.m (updateFrameSize): Call setFrame: on the view when size + changes (Bug#12088). + +2012-09-08 Chong Yidong + + * syntax.c (Fstring_to_syntax): Doc fix. + +2012-09-08 Jan Djärv + + * nsterm.m (ns_clip_to_row): Remove code that deals with drawing fringe + in the internal border. + (x_set_window_size): Remove static variables and their usage. + (ns_redraw_scroll_bars): Fix NSTRACE arg. + (ns_after_update_window_line, ns_draw_fringe_bitmap): Remove + fringe/internal border adjustment (Bug#11052). + (ns_draw_fringe_bitmap): Make code more like other terms (xterm.c). + (ns_draw_window_cursor): Remove fringe/internal border adjustment. + (ns_fix_rect_ibw): Remove. + (ns_get_glyph_string_clip_rect): Remove call to ns_fix_rect_ibw. + (ns_dumpglyphs_box_or_relief): Ditto. + (ns_maybe_dumpglyphs_background): Remove fringe/internal border + adjustment. + (ns_dumpglyphs_image): Ditto. + (ns_dumpglyphs_stretch): Fix coding style. Remove fringe/internal + border adjustment. + (ns_set_vertical_scroll_bar): Remove variables barOnVeryLeft/Right and + their usage. Add fringe_extended_p and its use as in other terms. + (ns_judge_scroll_bars): Code style fix. Call updateFrameSize if + scroll bar was removed. + (updateFrameSize): New function. + (windowDidResize): Move code to updateFrameSize and call it. + + * nsterm.h (EmacsView): Add updateFrameSize. + +2012-09-07 Chong Yidong + + * textprop.c (Fget_text_property): Minor doc fix (Bug#12323). + + * data.c (Flocal_variable_if_set_p): Doc fix (Bug#10713). + +2012-09-07 Paul Eggert + + More signal-handler cleanup (Bug#12327). + * emacs.c (main): Convert three 'signal' calls to 'sigaction' calls. + Problem introduced when merging patches. Noted by Eli Zaretskii in + . + * floatfns.c: Comment fix. + * lisp.h (force_auto_save_soon): Declare regardless of SIGDANGER. + SIGDANGER might not be in scope so "#ifdef SIGDANGER" is not right, + and anyway the declaration is harmless even if SIGDANGER is not defined. + * syssignal.h (SIGIO): Also #undef if (! defined FIONREAD || + defined BROKEN_FIONREAD). systty.h formerly did this, but other + source files not surprisingly expected syssignal.h to define, or + not define, SIGIO, and it's cleaner to do it that way, for consistency. + Include , for FIONREAD. + * systty.h (SIGIO): Do not #undef here; it's now syssignal.h's job. + This eliminates a problem whereby other files mysteriously had + to include "syssignal.h" before including "systty.h" if they + wanted to use "#ifdef SIGIO". + +2012-09-07 Eli Zaretskii + + * w32proc.c (sigaction): New function, emulates Posix 'sigaction'. + + * w32.c (sigemptyset): Empty the set. + (sigsetmask, sigmask, sigblock, sigunblock): Remove unused functions. + + * alloc.c [ENABLE_CHECKING]: Include signal.h, since we need SIGABRT. + +2012-09-07 Dmitry Antipov + + * alloc.c (mark_buffer): Revert unsafe marking optimization. + (mark_object): Likewise for frame objects. + +2012-09-07 Paul Eggert + + * syssignal.h (handle_on_main_thread): Always declare, + even if FORWARD_SIGNAL_TO_MAIN_THREAD is not defined. + This ports to platforms without HAVE_PTHREAD. + +2012-09-06 Paul Eggert + + Signal-handler cleanup (Bug#12327). + Emacs's signal handlers were written in the old 4.2BSD style with + sigblock and sigmask and so forth, and this led to some + inefficiencies and confusion. Rewrite these to use + pthread_sigmask etc. without copying signal sets around. Also, + get rid of the confusing macros 'SIGNAL_THREAD_CHECK' and + 'signal', and instead use functions that do not attempt to take + over the system name space. This patch causes Emacs's text + segment to shrink by 0.7% on my platform, Fedora 17 x86-64. + * alloc.c, emacsgtkfixed.c, nsfns.m, widget.c, xmenu.c: + Do not include or "syssignal.h", as these + modules do not use signals. + * atimer.c, callproc.c, data.c, dispnew.c, emacs.c, floatfns.c: + * gtkutil.c, keyboard.c, process.c, sound.c, sysdep.c, term.c, xterm.c: + Do not include , as "syssignal.h" does that for us now. + * atimer.c (sigmask_atimers): New function. + (block_atimers, unblock_atimers): New functions, + replacing the old macros BLOCK_ATIMERS and UNBLOCK_ATIMERS. + All uses replaced. + * conf_post.h [SIGNAL_H_AHB]: Do not include ; + no longer needed here. + * emacs.c (main): Inspect existing signal handler with sigaction, + so that there's no need to block and unblock SIGHUP. + * sysdep.c (struct save_signal): New member 'action', replacing + old member 'handler'. + (save_signal_handlers, restore_signal_handlers): + Use sigaction instead of 'signal' to save and restore. + (get_set_sighandler, set_sighandler) [!WINDOWSNT]: + New function. All users of 'signal' modified to use set_sighandler + if they're writeonly, and to use sys_signal if they're read+write. + (emacs_sigaction_init, forwarded_signal): New functions. + (sys_signal): Remove. All uses replaced by calls to sigaction + and emacs_sigaction_init, or by direct calls to 'signal'. + (sys_sigmask) [!__GNUC__]: Remove; no longer needed. + (sys_sigblock, sys_sigunblock, sys_sigsetmask): Remove; + all uses replaced by pthread_sigmask etc. calls. + * syssignal.h: Include . + (emacs_sigaction_init, forwarded_signal): New decls. + (SIGMASKTYPE): Remove. All uses replaced by its definiens, sigset_t. + (SIGEMPTYMASK): Remove; all uses replaced by its definiens, empty_mask. + (sigmask, sys_sigmask): Remove; no longer needed. + (sigpause): Remove. All uses replaced by its definiens, sigsuspend. + (sigblock, sigunblock, sigfree): + (sigsetmask) [!defined sigsetmask]: + Remove. All uses replaced by pthread_sigmask. + (signal): Remove. Its remaining uses (with SIG_DFL and SIG_IGN) + no longer need to be replaced, and its typical old uses + are now done via emacs_sigaction_init and sigaction. + (sys_sigblock, sys_sigunblock, sys_sigsetmask): Remove decls. + (sys_sigdel): Remove; unused. + (NSIG): Remove a FIXME; the code's fine. Remove an unnecessary ifdef. + +2012-09-06 Eli Zaretskii + + * process.c (CAN_HANDLE_MULTIPLE_CHILDREN): Fix a typo that broke + SIGCHLD handling on systems that don't have WNOHANG. (Bug#12327) + +2012-09-06 Dmitry Antipov + + Explicitly mark buffer_defaults and buffer_local_symbols. + * alloc.c (Fgarbage_collect): Mark buffer_defaults and + mark_local_symbols here. + (mark_object): If GC_CHECK_MARKED_OBJECTS, simplify checking + since special buffers aren't marked here any more. + (allocate_buffer): Chain new buffer with all_buffers here... + * buffer.c (Fget_buffer_create, Fmake_indirect_buffer): ...and + not here. + (Vbuffer_defaults, Vbuffer_local_symbols): Remove. + (syms_of_buffer): Remove staticpro of the above. + (init_buffer_once): Set names for buffer_defaults and + buffer_local_symbols. + +2012-09-06 Paul Eggert + + Use bool for booleans in font-related modules. + * font.c (font_intern_prop, font_style_to_value) + (font_style_symbolic, font_parse_xlfd, font_parse_fcname) + (generate_otf_features, font_check_otf_features, font_check_otf) + (font_match_p, font_list_entities, font_at): + * fontset.c (fontset_id_valid_p, reorder_font_vector + (fontset_find_font, Fset_fontset_font) + (face_suitable_for_char_p) [0]: + * ftfont.c (fc_initialized, ftfont_get_open_type_spec) + (ftfont_open, ftfont_text_extents, ftfont_check_otf): + (m17n_flt_initialized, ftfont_shape_by_flt): + * ftxfont.c (ftxfont_draw_bitmap, ftxfont_draw): + * nsfont.m (nsfont_draw): + * w32font.c (w32font_draw): + * w32term.c (x_draw_glyphless_glyph_string_foreground): + Use bool for booleans. + * font.h: Adjust to above API changes. + (struct font, struct font_driver, struct font_driver_list): + Use bool for booleans. + (struct font): Remove useless member encoding_type. + All users removed. + * fontset.c, xftfont.c: Omit unnecessary static decls. + +2012-09-06 Dmitry Antipov + + * alloc.c (mark_object): Revert window marking code + since it's unsafe for the Fset_window_configuration. + +2012-09-05 Paul Eggert + + Fix race conditions with signal handlers and errno (Bug#12327). + Be more systematic about preserving errno whenever a signal + handler returns, even if it's not in the main thread. Do this by + renaming signal handlers to distinguish between signal delivery + and signal handling. All uses changed. + * atimer.c (deliver_alarm_signal): Rename from alarm_signal_handler. + * data.c (deliver_arith_signal): Rename from arith_error. + * dispnew.c (deliver_window_change_signal): Rename from + window_change_signal. + * emacs.c (deliver_error_signal): Rename from fatal_error_signal. + (deliver_danger_signal) [SIGDANGER]: Rename from memory_warning_signal. + * keyboard.c (deliver_input_available_signal): Rename from + input_available_signal. + (deliver_user_signal): Rename from handle_user_signal. + (deliver_interrupt_signal): Rename from interrupt_signal. + * process.c (deliver_pipe_signal): Rename from send_process_trap. + (deliver_child_signal): Rename from sigchld_handler. + * atimer.c (handle_alarm_signal): + * data.c (handle_arith_signal): + * dispnew.c (handle_window_change_signal): + * emacs.c (handle_fatal_signal, handle_danger_signal): + * keyboard.c (handle_input_available_signal): + * keyboard.c (handle_user_signal, handle_interrupt_signal): + * process.c (handle_pipe_signal, handle_child_signal): + New functions, with the actual signal-handling code taken from the + original respective signal handlers, sans the sporadic attempts to + preserve errno, since that's now done by handle_on_main_thread. + * atimer.c (alarm_signal_handler): Remove unnecessary decl. + * emacs.c, floatfns.c, lisp.h: Remove unused FLOAT_CATCH_SIGKILL cruft. + * emacs.c (main_thread) [FORWARD_SIGNAL_TO_MAIN_THREAD]: + Move to sysdep.c. + (main) [FORWARD_SIGNAL_TO_MAIN_THREAD]: + Move initialization of main_thread to sysdep.c's init_signals. + * process.c (waitpid) [!WNOHANG]: #define to wait; that's good enough for + our usage, and simplifies the mainline code. + (record_child_status_change): New static function, as a helper + for handle_child_signal, and with most of the old child handler's + contents. + (CAN_HANDLE_MULTIPLE_CHILDREN): New constant. + (handle_child_signal): Use the above. + * sysdep.c (main_thread) [FORWARD_SIGNAL_TO_MAIN_THREAD]: + Moved here from emacs.c. + (init_signals) [FORWARD_SIGNAL_TO_MAIN_THREAD]: Initialize it; + code moved here from emacs.c's main function. + * sysdep.c, syssignal.h (handle_on_main_thread): New function, + replacing the old SIGNAL_THREAD_CHECK. All uses changed. This + lets callers save and restore errno properly. + +2012-09-05 Dmitry Antipov + + Remove redundant or unused things here and there. + * lisp.h (CYCLE_CHECK, CHAR_TABLE_TRANSLATE): Remove. + * conf_post.h (RE_TRANSLATE): Use char_table_translate. + * editfns.c (Fcompare_buffer_substrings): Likewise. + * frame.h (struct terminal, struct font_driver_list): + Remove redundant declarations. + * window.h (Qleft, Qright): Likewise. + +2012-09-05 Dmitry Antipov + + Do not mark objects from deleted buffers, windows and frames. + * alloc.c (mark_buffer): Mark just the buffer if it is dead. + (mark_object): Likewise for windows and frames. + +2012-09-05 Dmitry Antipov + + * alloc.c (valid_lisp_object_p): Treat killed buffers, + buffer_defaults and buffer_local_symbols as valid objects. + Return special value to denote them. + +2012-09-05 Paul Eggert + + * fileio.c, filelock.c, floatfns.c, fns.c: Use bool for boolean. + * fileio.c (auto_saving, auto_save_error_occurred, make_temp_name) + (Fexpand_file_name, barf_or_query_if_file_exists, Fcopy_file) + (file_name_absolute_p, Fsubstitute_in_file_name): + (check_executable, check_writable, Ffile_accessible_directory_p) + (Fset_file_selinux_context, Fdefault_file_modes) + (Finsert_file_contents, choose_write_coding_system) + (Fwrite_region, build_annotations, a_write, e_write) + (Fdo_auto_save): + * filelock.c (boot_time_initialized, get_boot_time) + (get_boot_time_1, lock_file_1, within_one_second): + * floatfns.c (in_float): + * fns.c (concat, internal_equal, Frequire, base64_encode_1) + (base64_decode_1, cmpfn_eql, cmpfn_user_defined) + (sweep_weak_table, sweep_weak_hash_tables, secure_hash): + * lisp.h (struct Lisp_Hash_Table.cmpfn): + * window.c (compare_window_configurations): + Use bool for booleans. + * fileio.c (auto_saving_dir_umask, auto_saving_mode_bits) + (Fdefault_file_modes): Now mode_t, not int, for modes. + (Fdo_auto_save): Set a boolean to 1 rather than using ++. + (internal_delete_file): Now returns void, not a (boolean) int, + since nobody was looking at the return value. + * lisp.h, window.h: Adjust to above API changes. + + * xdisp.c (set_message): Simplify and reindent last change. + +2012-09-05 Juanma Barranquero + + * makefile.w32-in ($(BLD)/sysdep.$(O)): Update dependencies. + +2012-09-04 Lars Ingebrigtsen + + * eval.c (call_debugger): Make the function non-static so that we + can call it from set_message. + + * xdisp.c (set_message): Implement the new variable `debug-on-message'. + (syms_of_xdisp): Defvar it and `inhibit-debug-on-message'. + +2012-09-04 Paul Eggert + + Give more-useful info on a fatal error (Bug#12328). + * alloc.c [ENABLE_CHECKING]: Do not include . + (die) [ENABLE_CHECKING]: Call fatal_error_backtrace instead + of doing the work ourselves. + * emacs.c (fatal_error_signal): Let fatal_error_backtrace + do most of the work. + (fatal_error_backtrace): New function, taken from the guts + of the old fatal_error_signal, but with a new option to output + a backtrace. + (shut_down_emacs) [!DOS_NT]: Use strsignal to give more-useful + info about the signal than just its number. + * lisp.h (fatal_error_backtrace, emacs_backtrace): New decls. + * sysdep.c: Include + (emacs_backtrace): New function, taken partly from the previous + code of the 'die' function. + (emacs_abort): Call fatal_error_backtrace rather than abort. + +2012-09-04 Stefan Monnier + + * lread.c (readevalloop): Call internal-macroexpand-for-load to perform + eager (load-time) macro-expansion. + * lisp.mk (lisp): Add macroexp. + +2012-09-04 Paul Eggert + + Simplify redefinition of 'abort' (Bug#12316). + Do not try to redefine the 'abort' function. Instead, redo + the code so that it calls 'emacs_abort' rather than 'abort'. + This removes the need for the NO_ABORT configure-time macro + and makes it easier to change the abort code to do a backtrace. + * .gdbinit: Just stop at emacs_abort, not at w32_abort or abort. + * emacs.c (abort) [!DOS_NT && !NO_ABORT]: + Remove; sysdep.c's emacs_abort now takes its place. + * lisp.h (emacs_abort): New decl. All calls from Emacs code to + 'abort' changed to use 'emacs_abort'. + * msdos.c (dos_abort) [defined abort]: Remove; not used. + (abort) [!defined abort]: Rename to ... + (emacs_abort): ... new name. + * sysdep.c (emacs_abort) [!HAVE_NTGUI]: New function, taking + the place of the old 'abort' in emacs.c. + * w32.c, w32fns.c (abort): Do not #undef. + * w32.c (emacs_abort): Rename from w32_abort. + +2012-09-04 Eli Zaretskii + + * w32uniscribe.c (uniscribe_shape): Reverse the sign of + offsets[j].dv, since the y axis of the screen coordinates points + down, while the y axis of the font definition coordinates points + up. This fixes display of Arabic diacritics such as KASRA and + KASRATAN. (Bug#11860) + +2012-09-04 Paul Eggert + + Be more systematic about _setjmp vs setjmp. + * alloc.c (test_setjmp, mark_stack): + * image.c (PNG_LONGJMP) [PNG_LIBPNG_VER < 10500]: + (PNG_JMPBUF) [! (PNG_LIBPNG_VER < 10500)]: + (png_load, my_error_exit, jpeg_load): + * process.c (send_process_trap, send_process): + Uniformly prefer _setjmp and _longjmp to setjmp and longjmp. + The underscored versions are up to 30x faster on some hosts. + Formerly, the code used setjmp+longjmp sometimes and + _setjmp+_longjmp at other times, with no particular reason to + prefer setjmp+longjmp. + 2012-09-03 Paul Eggert - Fix minor problems found by static checking. + Fix minor problem found by static checking. * buffer.c (Fdelete_all_overlays): Return nil. - * doc.c (Fsubstitute_command_keys): - * regex.c (WEAK_ALIAS): - * xdisp.c (redisplay_internal): - Move initialization down, to pacify GCC 4.7.1 -Wjump-misses-init. 2012-09-03 Martin Rudalics diff --git a/src/alloc.c b/src/alloc.c index 188a514376d..33dc68df48e 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -26,7 +26,9 @@ along with GNU Emacs. If not, see . */ #include /* For CHAR_BIT. */ #include -#include +#ifdef ENABLE_CHECKING +#include /* For SIGABRT. */ +#endif #ifdef HAVE_PTHREAD #include @@ -42,7 +44,6 @@ along with GNU Emacs. If not, see . */ #include "keyboard.h" #include "frame.h" #include "blockinput.h" -#include "syssignal.h" #include "termhooks.h" /* For struct terminal. */ #include #include @@ -278,6 +279,7 @@ static void gc_sweep (void); static Lisp_Object make_pure_vector (ptrdiff_t); static void mark_glyph_matrix (struct glyph_matrix *); static void mark_face_cache (struct face_cache *); +static void mark_buffer (struct buffer *); #if !defined REL_ALLOC || defined SYSTEM_MALLOC static void refill_memory_reserve (void); @@ -613,7 +615,7 @@ overrun_check_malloc (size_t size) register unsigned char *val; int overhead = ++check_depth == 1 ? XMALLOC_OVERRUN_CHECK_OVERHEAD : 0; if (SIZE_MAX - overhead < size) - abort (); + emacs_abort (); val = malloc (size + overhead); if (val && check_depth == 1) @@ -638,7 +640,7 @@ overrun_check_realloc (void *block, size_t size) register unsigned char *val = (unsigned char *) block; int overhead = ++check_depth == 1 ? XMALLOC_OVERRUN_CHECK_OVERHEAD : 0; if (SIZE_MAX - overhead < size) - abort (); + emacs_abort (); if (val && check_depth == 1 @@ -649,7 +651,7 @@ overrun_check_realloc (void *block, size_t size) size_t osize = xmalloc_get_size (val); if (memcmp (xmalloc_overrun_check_trailer, val + osize, XMALLOC_OVERRUN_CHECK_SIZE)) - abort (); + emacs_abort (); memset (val + osize, 0, XMALLOC_OVERRUN_CHECK_SIZE); val -= XMALLOC_OVERRUN_CHECK_SIZE + XMALLOC_OVERRUN_SIZE_SIZE; memset (val, 0, XMALLOC_OVERRUN_CHECK_SIZE + XMALLOC_OVERRUN_SIZE_SIZE); @@ -686,7 +688,7 @@ overrun_check_free (void *block) size_t osize = xmalloc_get_size (val); if (memcmp (xmalloc_overrun_check_trailer, val + osize, XMALLOC_OVERRUN_CHECK_SIZE)) - abort (); + emacs_abort (); #ifdef XMALLOC_CLEAR_FREE_MEMORY val -= XMALLOC_OVERRUN_CHECK_SIZE + XMALLOC_OVERRUN_SIZE_SIZE; memset (val, 0xff, osize + XMALLOC_OVERRUN_CHECK_OVERHEAD); @@ -1272,7 +1274,7 @@ emacs_blocked_free (void *ptr, const void *ptr2) { fprintf (stderr, "Freeing `%p' which wasn't allocated with malloc\n", ptr); - abort (); + emacs_abort (); } else { @@ -1331,7 +1333,7 @@ emacs_blocked_malloc (size_t size, const void *ptr) fprintf (stderr, "Region in use is %p...%p, %td bytes, type %d\n", m->start, m->end, (char *) m->end - (char *) m->start, m->type); - abort (); + emacs_abort (); } if (!dont_register_blocks) @@ -1369,7 +1371,7 @@ emacs_blocked_realloc (void *ptr, size_t size, const void *ptr2) fprintf (stderr, "Realloc of %p which wasn't allocated with malloc\n", ptr); - abort (); + emacs_abort (); } mem_delete (m); @@ -1391,7 +1393,7 @@ emacs_blocked_realloc (void *ptr, size_t size, const void *ptr2) if (m != MEM_NIL) { fprintf (stderr, "Realloc returns memory that is already in use\n"); - abort (); + emacs_abort (); } /* Can't handle zero size regions in the red-black tree. */ @@ -1804,7 +1806,7 @@ string_bytes (struct Lisp_String *s) if (!PURE_POINTER_P (s) && s->data && nbytes != SDATA_NBYTES (SDATA_OF_STRING (s))) - abort (); + emacs_abort (); return nbytes; } @@ -1878,7 +1880,7 @@ check_string_free_list (void) while (s != NULL) { if ((uintptr_t) s < 1024) - abort (); + emacs_abort (); s = NEXT_FREE_LISP_STRING (s); } } @@ -2107,7 +2109,7 @@ sweep_strings (void) back-pointer so that we know it's free. */ #ifdef GC_CHECK_STRING_BYTES if (string_bytes (s) != SDATA_NBYTES (data)) - abort (); + emacs_abort (); #else data->u.nbytes = STRING_BYTES (s); #endif @@ -2218,7 +2220,7 @@ compact_small_strings (void) /* Check that the string size recorded in the string is the same as the one recorded in the sdata structure. */ if (s && string_bytes (s) != SDATA_NBYTES (from)) - abort (); + emacs_abort (); #endif /* GC_CHECK_STRING_BYTES */ nbytes = s ? STRING_BYTES (s) : SDATA_NBYTES (from); @@ -2231,7 +2233,7 @@ compact_small_strings (void) if (memcmp (string_overrun_cookie, (char *) from_end - GC_STRING_OVERRUN_COOKIE_SIZE, GC_STRING_OVERRUN_COOKIE_SIZE)) - abort (); + emacs_abort (); #endif /* Non-NULL S means it's alive. Copy its data. */ @@ -2488,7 +2490,7 @@ make_uninit_multibyte_string (EMACS_INT nchars, EMACS_INT nbytes) struct Lisp_String *s; if (nchars < 0) - abort (); + emacs_abort (); if (!nbytes) return empty_multibyte_string; @@ -2809,7 +2811,7 @@ listn (enum constype type, ptrdiff_t count, Lisp_Object arg, ...) else if (type == CONSTYPE_HEAP) val = Fcons (objp[i], val); else - abort (); + emacs_abort (); } return val; } @@ -3281,7 +3283,10 @@ allocate_buffer (void) XSETPVECTYPESIZE (b, PVEC_BUFFER, (offsetof (struct buffer, own_text) - header_size) / word_size); - /* Note that the fields of B are not initialized. */ + /* Put B on the chain of all buffers including killed ones. */ + b->header.next.buffer = all_buffers; + all_buffers = b; + /* Note that the rest fields of B are not initialized. */ return b; } @@ -3919,7 +3924,7 @@ mem_insert (void *start, void *end, enum mem_type type) while (c != MEM_NIL) { if (start >= c->start && start < c->end) - abort (); + emacs_abort (); parent = c; c = start < c->start ? c->left : c->right; } @@ -3938,7 +3943,7 @@ mem_insert (void *start, void *end, enum mem_type type) #ifdef GC_MALLOC_CHECK x = _malloc_internal (sizeof *x); if (x == NULL) - abort (); + emacs_abort (); #else x = xmalloc (sizeof *x); #endif @@ -4613,7 +4618,7 @@ mark_maybe_pointer (void *p) break; default: - abort (); + emacs_abort (); } if (!NILP (obj)) @@ -4764,7 +4769,7 @@ test_setjmp (void) x = strlen (buf); x = 2 * x - 1; - setjmp (jbuf); + _setjmp (jbuf); if (longjmps_done == 1) { /* Came here after the longjmp at the end of the function. @@ -4789,7 +4794,7 @@ test_setjmp (void) ++longjmps_done; x = 2; if (longjmps_done == 1) - longjmp (jbuf, 1); + _longjmp (jbuf, 1); } #endif /* not GC_SAVE_REGISTERS_ON_STACK && not GC_SETJMP_WORKS */ @@ -4810,7 +4815,7 @@ check_gcpros (void) if (!survives_gc_p (p->var[i])) /* FIXME: It's not necessarily a bug. It might just be that the GCPRO is unnecessary or should release the object sooner. */ - abort (); + emacs_abort (); } #elif GC_MARK_STACK == GC_USE_GCPROS_CHECK_ZOMBIES @@ -4931,7 +4936,7 @@ mark_stack (void) } #endif /* GC_SETJMP_WORKS */ - setjmp (j.j); + _setjmp (j.j); end = stack_grows_down_p ? (char *) &j + sizeof j : (char *) &j; #endif /* not GC_SAVE_REGISTERS_ON_STACK */ #endif /* not HAVE___BUILTIN_UNWIND_INIT */ @@ -4981,7 +4986,8 @@ valid_pointer_p (void *p) #endif } -/* Return 1 if OBJ is a valid lisp object. +/* Return 2 if OBJ is a killed or special buffer object. + Return 1 if OBJ is a valid lisp object. Return 0 if OBJ is NOT a valid lisp object. Return -1 if we cannot validate OBJ. This function can be quite slow, @@ -5002,6 +5008,9 @@ valid_lisp_object_p (Lisp_Object obj) if (PURE_POINTER_P (p)) return 1; + if (p == &buffer_defaults || p == &buffer_local_symbols) + return 2; + #if !GC_MARK_STACK return valid_pointer_p (p); #else @@ -5027,7 +5036,7 @@ valid_lisp_object_p (Lisp_Object obj) return 0; case MEM_TYPE_BUFFER: - return live_buffer_p (m, p); + return live_buffer_p (m, p) ? 1 : 2; case MEM_TYPE_CONS: return live_cons_p (m, p); @@ -5351,7 +5360,7 @@ staticpro (Lisp_Object *varaddress) { staticvec[staticidx++] = varaddress; if (staticidx >= NSTATICS) - abort (); + emacs_abort (); } @@ -5406,7 +5415,7 @@ See Info node `(elisp)Garbage Collection'. */) Lisp_Object retval = Qnil; if (abort_on_gc) - abort (); + emacs_abort (); /* Can't GC if pure storage overflowed because we can't determine if something is a pure object or not. */ @@ -5469,6 +5478,9 @@ See Info node `(elisp)Garbage Collection'. */) /* Mark all the special slots that serve as the roots of accessibility. */ + mark_buffer (&buffer_defaults); + mark_buffer (&buffer_local_symbols); + for (i = 0; i < staticidx; i++) mark_object (*staticvec[i]); @@ -5887,7 +5899,7 @@ mark_object (Lisp_Object arg) do { \ m = mem_find (po); \ if (m == MEM_NIL) \ - abort (); \ + emacs_abort (); \ } while (0) /* Check that the object pointed to by PO is live, using predicate @@ -5895,7 +5907,7 @@ mark_object (Lisp_Object arg) #define CHECK_LIVE(LIVEP) \ do { \ if (!LIVEP (m, po)) \ - abort (); \ + emacs_abort (); \ } while (0) /* Check both of the above conditions. */ @@ -5940,10 +5952,8 @@ mark_object (Lisp_Object arg) #ifdef GC_CHECK_MARKED_OBJECTS m = mem_find (po); - if (m == MEM_NIL && !SUBRP (obj) - && po != &buffer_defaults - && po != &buffer_local_symbols) - abort (); + if (m == MEM_NIL && !SUBRP (obj)) + emacs_abort (); #endif /* GC_CHECK_MARKED_OBJECTS */ if (ptr->header.size & PSEUDOVECTOR_FLAG) @@ -5959,15 +5969,14 @@ mark_object (Lisp_Object arg) { case PVEC_BUFFER: #ifdef GC_CHECK_MARKED_OBJECTS - if (po != &buffer_defaults && po != &buffer_local_symbols) - { - struct buffer *b; - FOR_EACH_BUFFER (b) - if (b == po) - break; - if (b == NULL) - abort (); - } + { + struct buffer *b; + FOR_EACH_BUFFER (b) + if (b == po) + break; + if (b == NULL) + emacs_abort (); + } #endif /* GC_CHECK_MARKED_OBJECTS */ mark_buffer ((struct buffer *) ptr); break; @@ -5992,10 +6001,8 @@ mark_object (Lisp_Object arg) break; case PVEC_FRAME: - { - mark_vectorlike (ptr); - mark_face_cache (((struct frame *) ptr)->face_cache); - } + mark_vectorlike (ptr); + mark_face_cache (((struct frame *) ptr)->face_cache); break; case PVEC_WINDOW: @@ -6042,7 +6049,7 @@ mark_object (Lisp_Object arg) break; case PVEC_FREE: - abort (); + emacs_abort (); default: mark_vectorlike (ptr); @@ -6089,7 +6096,7 @@ mark_object (Lisp_Object arg) And if it's forwarded to a C variable, either it's not a Lisp_Object var, or it's staticpro'd already. */ break; - default: abort (); + default: emacs_abort (); } if (!PURE_POINTER_P (XSTRING (ptr->name))) MARK_STRING (XSTRING (ptr->name)); @@ -6143,7 +6150,7 @@ mark_object (Lisp_Object arg) break; default: - abort (); + emacs_abort (); } break; @@ -6165,7 +6172,7 @@ mark_object (Lisp_Object arg) obj = ptr->u.cdr; cdr_count++; if (cdr_count == mark_object_loop_halt) - abort (); + emacs_abort (); goto loop; } @@ -6178,7 +6185,7 @@ mark_object (Lisp_Object arg) break; default: - abort (); + emacs_abort (); } #undef CHECK_LIVE @@ -6247,7 +6254,7 @@ survives_gc_p (Lisp_Object obj) break; default: - abort (); + emacs_abort (); } return survives_p || PURE_POINTER_P ((void *) XPNTR (obj)); @@ -6685,21 +6692,14 @@ which_symbols (Lisp_Object obj, EMACS_INT find_max) #ifdef ENABLE_CHECKING -# include - bool suppress_checking; void die (const char *msg, const char *file, int line) { - enum { NPOINTERS_MAX = 500 }; - void *buffer[NPOINTERS_MAX]; - int npointers; fprintf (stderr, "\r\n%s:%d: Emacs fatal error: %s\r\n", file, line, msg); - npointers = backtrace (buffer, NPOINTERS_MAX); - backtrace_symbols_fd (buffer, npointers, STDERR_FILENO); - abort (); + fatal_error_backtrace (SIGABRT, INT_MAX); } #endif diff --git a/src/atimer.c b/src/atimer.c index eb3136ae55d..34731920af5 100644 --- a/src/atimer.c +++ b/src/atimer.c @@ -17,7 +17,6 @@ You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . */ #include -#include #include #include #include "lisp.h" @@ -41,7 +40,7 @@ static struct atimer *stopped_atimers; static struct atimer *atimers; -/* Non-zero means alarm_signal_handler has found ripe timers but +/* Non-zero means alarm signal handler has found ripe timers but interrupt_input_blocked was non-zero. In this case, timer functions are not called until the next UNBLOCK_INPUT because timer functions are expected to call X, and X cannot be assumed to be @@ -51,8 +50,24 @@ int pending_atimers; /* Block/unblock SIGALRM. */ -#define BLOCK_ATIMERS sigblock (sigmask (SIGALRM)) -#define UNBLOCK_ATIMERS sigunblock (sigmask (SIGALRM)) +static void +sigmask_atimers (int how) +{ + sigset_t blocked; + sigemptyset (&blocked); + sigaddset (&blocked, SIGALRM); + pthread_sigmask (how, &blocked, 0); +} +static void +block_atimers (void) +{ + sigmask_atimers (SIG_BLOCK); +} +static void +unblock_atimers (void) +{ + sigmask_atimers (SIG_UNBLOCK); +} /* Function prototypes. */ @@ -60,8 +75,6 @@ static void set_alarm (void); static void schedule_atimer (struct atimer *); static struct atimer *append_atimer_lists (struct atimer *, struct atimer *); -static void alarm_signal_handler (int signo); - /* Start a new atimer of type TYPE. TIME specifies when the timer is ripe. FN is the function to call when the timer fires. @@ -111,7 +124,7 @@ start_atimer (enum atimer_type type, EMACS_TIME timestamp, atimer_callback fn, t->fn = fn; t->client_data = client_data; - BLOCK_ATIMERS; + block_atimers (); /* Compute the timer's expiration time. */ switch (type) @@ -132,7 +145,7 @@ start_atimer (enum atimer_type type, EMACS_TIME timestamp, atimer_callback fn, /* Insert the timer in the list of active atimers. */ schedule_atimer (t); - UNBLOCK_ATIMERS; + unblock_atimers (); /* Arrange for a SIGALRM at the time the next atimer is ripe. */ set_alarm (); @@ -148,7 +161,7 @@ cancel_atimer (struct atimer *timer) { int i; - BLOCK_ATIMERS; + block_atimers (); for (i = 0; i < 2; ++i) { @@ -175,7 +188,7 @@ cancel_atimer (struct atimer *timer) } } - UNBLOCK_ATIMERS; + unblock_atimers (); } @@ -206,7 +219,7 @@ append_atimer_lists (struct atimer *list_1, struct atimer *list_2) void stop_other_atimers (struct atimer *t) { - BLOCK_ATIMERS; + block_atimers (); if (t) { @@ -231,7 +244,7 @@ stop_other_atimers (struct atimer *t) stopped_atimers = append_atimer_lists (atimers, stopped_atimers); atimers = t; - UNBLOCK_ATIMERS; + unblock_atimers (); } @@ -246,7 +259,7 @@ run_all_atimers (void) struct atimer *t = atimers; struct atimer *next; - BLOCK_ATIMERS; + block_atimers (); atimers = stopped_atimers; stopped_atimers = NULL; @@ -257,7 +270,7 @@ run_all_atimers (void) t = next; } - UNBLOCK_ATIMERS; + unblock_atimers (); } } @@ -374,13 +387,9 @@ run_timers (void) /* Signal handler for SIGALRM. SIGNO is the signal number, i.e. SIGALRM. */ -void -alarm_signal_handler (int signo) +static void +handle_alarm_signal (int sig) { -#ifndef SYNC_INPUT - SIGNAL_THREAD_CHECK (signo); -#endif - pending_atimers = 1; #ifdef SYNC_INPUT pending_signals = 1; @@ -389,17 +398,23 @@ alarm_signal_handler (int signo) #endif } +static void +deliver_alarm_signal (int sig) +{ + handle_on_main_thread (sig, handle_alarm_signal); +} -/* Call alarm_signal_handler for pending timers. */ + +/* Call alarm signal handler for pending timers. */ void do_pending_atimers (void) { if (pending_atimers) { - BLOCK_ATIMERS; + block_atimers (); run_timers (); - UNBLOCK_ATIMERS; + unblock_atimers (); } } @@ -412,7 +427,9 @@ turn_on_atimers (bool on) { if (on) { - signal (SIGALRM, alarm_signal_handler); + struct sigaction action; + emacs_sigaction_init (&action, deliver_alarm_signal); + sigaction (SIGALRM, &action, 0); set_alarm (); } else @@ -423,8 +440,10 @@ turn_on_atimers (bool on) void init_atimer (void) { + struct sigaction action; free_atimers = stopped_atimers = atimers = NULL; pending_atimers = 0; /* pending_signals is initialized in init_keyboard.*/ - signal (SIGALRM, alarm_signal_handler); + emacs_sigaction_init (&action, deliver_alarm_signal); + sigaction (SIGALRM, &action, 0); } diff --git a/src/bidi.c b/src/bidi.c index 6b3ac53d318..73fec3533a4 100644 --- a/src/bidi.c +++ b/src/bidi.c @@ -105,7 +105,7 @@ bidi_get_type (int ch, bidi_dir_t override) if (ch == BIDI_EOB) return NEUTRAL_B; if (ch < 0 || ch > MAX_CHAR) - abort (); + emacs_abort (); default_type = (bidi_type_t) XINT (CHAR_TABLE_REF (bidi_type_table, ch)); /* Every valid character code, even those that are unassigned by the @@ -113,7 +113,7 @@ bidi_get_type (int ch, bidi_dir_t override) DerivedBidiClass.txt file. Therefore, if we ever get UNKNOWN_BT (= zero) code from CHAR_TABLE_REF, that's a bug. */ if (default_type == UNKNOWN_BT) - abort (); + emacs_abort (); if (override == NEUTRAL_DIR) return default_type; @@ -141,7 +141,7 @@ bidi_get_type (int ch, bidi_dir_t override) else if (override == R2L) return STRONG_R; else - abort (); /* can't happen: handled above */ + emacs_abort (); /* can't happen: handled above */ } } } @@ -183,7 +183,7 @@ bidi_get_category (bidi_type_t type) case NEUTRAL_ON: return NEUTRAL; default: - abort (); + emacs_abort (); } } @@ -199,7 +199,7 @@ bidi_mirror_char (int c) if (c == BIDI_EOB) return c; if (c < 0 || c > MAX_CHAR) - abort (); + emacs_abort (); val = CHAR_TABLE_REF (bidi_mirror_table, c); if (INTEGERP (val)) @@ -215,7 +215,7 @@ bidi_mirror_char (int c) /* Minimal test we must do in optimized builds, to prevent weird crashes further down the road. */ if (v < 0 || v > MAX_CHAR) - abort (); + emacs_abort (); return v; } @@ -373,7 +373,7 @@ bidi_cache_fetch_state (ptrdiff_t idx, struct bidi_it *bidi_it) int current_scan_dir = bidi_it->scan_dir; if (idx < bidi_cache_start || idx >= bidi_cache_idx) - abort (); + emacs_abort (); bidi_copy_it (bidi_it, &bidi_cache[idx]); bidi_it->scan_dir = current_scan_dir; @@ -518,7 +518,7 @@ bidi_cache_iterator_state (struct bidi_it *bidi_it, bool resolved) /* We should never cache on backward scans. */ if (bidi_it->scan_dir == -1) - abort (); + emacs_abort (); idx = bidi_cache_search (bidi_it->charpos, -1, 1); if (idx < 0) @@ -537,7 +537,7 @@ bidi_cache_iterator_state (struct bidi_it *bidi_it, bool resolved) idx = bidi_cache_start; } if (bidi_it->nchars <= 0) - abort (); + emacs_abort (); bidi_copy_it (&bidi_cache[idx], bidi_it); if (!resolved) bidi_cache[idx].resolved_level = -1; @@ -592,7 +592,7 @@ static inline int bidi_peek_at_next_level (struct bidi_it *bidi_it) { if (bidi_cache_idx == bidi_cache_start || bidi_cache_last_idx == -1) - abort (); + emacs_abort (); return bidi_cache[bidi_cache_last_idx + bidi_it->scan_dir].resolved_level; } @@ -629,7 +629,7 @@ void bidi_pop_it (struct bidi_it *bidi_it) { if (bidi_cache_start <= 0) - abort (); + emacs_abort (); /* Reset the next free cache slot index to what it was before the call to bidi_push_it. */ @@ -640,7 +640,7 @@ bidi_pop_it (struct bidi_it *bidi_it) /* Pop the previous cache start from the stack. */ if (bidi_cache_sp <= 0) - abort (); + emacs_abort (); bidi_cache_start = bidi_cache_start_stack[--bidi_cache_sp]; /* Invalidate the last-used cache slot data. */ @@ -762,12 +762,12 @@ bidi_initialize (void) { bidi_type_table = uniprop_table (intern ("bidi-class")); if (NILP (bidi_type_table)) - abort (); + emacs_abort (); staticpro (&bidi_type_table); bidi_mirror_table = uniprop_table (intern ("mirroring")); if (NILP (bidi_mirror_table)) - abort (); + emacs_abort (); staticpro (&bidi_mirror_table); Qparagraph_start = intern ("paragraph-start"); @@ -885,7 +885,7 @@ bidi_count_bytes (const unsigned char *s, const ptrdiff_t beg, else { if (!CHAR_HEAD_P (*p)) - abort (); + emacs_abort (); while (pos < end) { @@ -965,7 +965,7 @@ bidi_fetch_char (ptrdiff_t bytepos, ptrdiff_t charpos, ptrdiff_t *disp_pos, /* We don't expect to find ourselves in the middle of a display property. Hopefully, it will never be needed. */ if (charpos > *disp_pos) - abort (); + emacs_abort (); /* Text covered by `display' properties and overlays with display properties or display strings is handled as a single character that represents the entire run of characters @@ -995,7 +995,7 @@ bidi_fetch_char (ptrdiff_t bytepos, ptrdiff_t charpos, ptrdiff_t *disp_pos, } *nchars = disp_end_pos - *disp_pos; if (*nchars <= 0) - abort (); + emacs_abort (); if (string->s) *ch_len = bidi_count_bytes (string->s, *disp_pos, bytepos, disp_end_pos, string->unibyte); @@ -1160,7 +1160,7 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, bool no_default_p) dir = L2R; /* We should never be called at EOB or before BEGV. */ else if (bidi_it->charpos >= end || bytepos < begbyte) - abort (); + emacs_abort (); if (dir == L2R) { @@ -1298,7 +1298,7 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, bool no_default_p) && no_default_p && bidi_it->paragraph_dir == NEUTRAL_DIR); } else - abort (); + emacs_abort (); /* Contrary to UAX#9 clause P3, we only default the paragraph direction to L2R if we have no previous usable paragraph @@ -1325,7 +1325,7 @@ bidi_explicit_dir_char (int ch) bidi_type_t ch_type; if (!bidi_initialized) - abort (); + emacs_abort (); ch_type = (bidi_type_t) XINT (CHAR_TABLE_REF (bidi_type_table, ch)); return (ch_type == LRE || ch_type == LRO || ch_type == RLE || ch_type == RLO @@ -1378,10 +1378,10 @@ bidi_resolve_explicit_1 (struct bidi_it *bidi_it) /* Advance to the next character, skipping characters covered by display strings (nchars > 1). */ if (bidi_it->nchars <= 0) - abort (); + emacs_abort (); bidi_it->charpos += bidi_it->nchars; if (bidi_it->ch_len == 0) - abort (); + emacs_abort (); bidi_it->bytepos += bidi_it->ch_len; } @@ -1581,7 +1581,7 @@ bidi_resolve_explicit (struct bidi_it *bidi_it) } if (bidi_it->nchars <= 0) - abort (); + emacs_abort (); if (level == prev_level) /* empty embedding */ saved_it.ignore_bn_limit = bidi_it->charpos + bidi_it->nchars; else /* this embedding is non-empty */ @@ -1644,7 +1644,7 @@ bidi_resolve_weak (struct bidi_it *bidi_it) || type == RLE || type == RLO || type == PDF) - abort (); + emacs_abort (); if (new_level != prev_level || bidi_it->type == NEUTRAL_B) @@ -1685,7 +1685,7 @@ bidi_resolve_weak (struct bidi_it *bidi_it) else if (bidi_it->sor == L2R) type = STRONG_L; else /* shouldn't happen! */ - abort (); + emacs_abort (); } if (type == WEAK_EN /* W2 */ && bidi_it->last_strong.type_after_w1 == STRONG_AL) @@ -1767,7 +1767,7 @@ bidi_resolve_weak (struct bidi_it *bidi_it) : bidi_it->string.s); if (bidi_it->nchars <= 0) - abort (); + emacs_abort (); next_char = (bidi_it->charpos + bidi_it->nchars >= eob ? BIDI_EOB @@ -1875,7 +1875,7 @@ bidi_resolve_neutral (struct bidi_it *bidi_it) || type == NEUTRAL_S || type == NEUTRAL_WS || type == NEUTRAL_ON)) - abort (); + emacs_abort (); if ((type != NEUTRAL_B /* Don't risk entering the long loop below if we are already at paragraph end. */ @@ -1930,7 +1930,7 @@ bidi_resolve_neutral (struct bidi_it *bidi_it) bidi_type_t next_type; if (bidi_it->scan_dir == -1) - abort (); + emacs_abort (); bidi_copy_it (&saved_it, bidi_it); /* Scan the text forward until we find the first non-neutral @@ -1979,7 +1979,7 @@ bidi_resolve_neutral (struct bidi_it *bidi_it) break; case WEAK_BN: if (!bidi_explicit_dir_char (bidi_it->ch)) - abort (); /* can't happen: BNs are skipped */ + emacs_abort (); /* can't happen: BNs are skipped */ /* FALLTHROUGH */ case NEUTRAL_B: /* Marched all the way to the end of this level run. @@ -1998,7 +1998,7 @@ bidi_resolve_neutral (struct bidi_it *bidi_it) } break; default: - abort (); + emacs_abort (); } type = bidi_resolve_neutral_1 (saved_it.prev_for_neutral.type, next_type, current_level); @@ -2023,7 +2023,7 @@ bidi_type_of_next_char (struct bidi_it *bidi_it) /* This should always be called during a forward scan. */ if (bidi_it->scan_dir != 1) - abort (); + emacs_abort (); /* Reset the limit until which to ignore BNs if we step out of the area where we found only empty levels. */ @@ -2107,7 +2107,7 @@ bidi_level_of_next_char (struct bidi_it *bidi_it) if (bidi_it->scan_dir > 0) { if (bidi_it->nchars <= 0) - abort (); + emacs_abort (); next_char_pos = bidi_it->charpos + bidi_it->nchars; } else if (bidi_it->charpos >= bob) @@ -2143,7 +2143,7 @@ bidi_level_of_next_char (struct bidi_it *bidi_it) if (bidi_it->scan_dir == -1) /* If we are going backwards, the iterator state is already cached from previous scans, and should be fully resolved. */ - abort (); + emacs_abort (); if (type == UNKNOWN_BT) type = bidi_type_of_next_char (bidi_it); @@ -2156,7 +2156,7 @@ bidi_level_of_next_char (struct bidi_it *bidi_it) || (type == WEAK_BN && prev_level == level)) { if (bidi_it->next_for_neutral.type == UNKNOWN_BT) - abort (); + emacs_abort (); /* If the cached state shows a neutral character, it was not resolved by bidi_resolve_neutral, so do it now. */ @@ -2170,7 +2170,7 @@ bidi_level_of_next_char (struct bidi_it *bidi_it) || type == WEAK_BN || type == WEAK_EN || type == WEAK_AN)) - abort (); + emacs_abort (); bidi_it->type = type; bidi_check_type (bidi_it->type); @@ -2192,7 +2192,7 @@ bidi_level_of_next_char (struct bidi_it *bidi_it) int dpp = bidi_it->disp_prop; if (bidi_it->nchars <= 0) - abort (); + emacs_abort (); do { ch = bidi_fetch_char (bpos += clen, cpos += nc, &disp_pos, &dpp, &bs, fwp, &clen, &nc); @@ -2301,8 +2301,9 @@ bidi_find_other_level_edge (struct bidi_it *bidi_it, int level, bool end_flag) { int new_level; + /* If we are at end of level, its edges must be cached. */ if (end_flag) - abort (); /* if we are at end of level, its edges must be cached */ + emacs_abort (); bidi_cache_iterator_state (bidi_it, 1); do { @@ -2320,7 +2321,7 @@ bidi_move_to_visually_next (struct bidi_it *bidi_it) struct gcpro gcpro1; if (bidi_it->charpos < 0 || bidi_it->bytepos < 0) - abort (); + emacs_abort (); if (bidi_it->scan_dir == 0) { @@ -2431,7 +2432,7 @@ bidi_move_to_visually_next (struct bidi_it *bidi_it) = bidi_at_paragraph_end (bidi_it->charpos + bidi_it->nchars, bidi_it->bytepos + bidi_it->ch_len); if (bidi_it->nchars <= 0) - abort (); + emacs_abort (); if (sep_len >= 0) { bidi_it->new_paragraph = 1; diff --git a/src/blockinput.h b/src/blockinput.h index dc02919cf4f..3f61b2b27b9 100644 --- a/src/blockinput.h +++ b/src/blockinput.h @@ -89,7 +89,7 @@ extern int pending_atimers; do_pending_atimers (); \ } \ else if (interrupt_input_blocked < 0) \ - abort (); \ + emacs_abort (); \ } \ while (0) @@ -124,4 +124,3 @@ extern int pending_atimers; extern void reinvoke_input_signal (void); #endif /* EMACS_BLOCKINPUT_H */ - diff --git a/src/buffer.c b/src/buffer.c index f4d38e50a47..3af45122a0d 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -44,7 +44,7 @@ along with GNU Emacs. If not, see . */ #include "keymap.h" #include "frame.h" -struct buffer *current_buffer; /* the current buffer */ +struct buffer *current_buffer; /* The current buffer. */ /* First buffer in chain of all buffers (in reverse order of creation). Threaded through ->header.next.buffer. */ @@ -60,10 +60,6 @@ struct buffer *all_buffers; struct buffer alignas (GCALIGNMENT) buffer_defaults; -/* A Lisp_Object pointer to the above, used for staticpro */ - -static Lisp_Object Vbuffer_defaults; - /* This structure marks which slots in a buffer have corresponding default values in buffer_defaults. Each such slot has a nonzero value in this structure. @@ -78,18 +74,15 @@ static Lisp_Object Vbuffer_defaults; and the corresponding slot in buffer_defaults is not used. If a slot in this structure corresponding to a DEFVAR_PER_BUFFER is - zero, that is a bug */ + zero, that is a bug. */ struct buffer buffer_local_flags; /* This structure holds the names of symbols whose values may be - buffer-local. It is indexed and accessed in the same way as the above. */ + buffer-local. It is indexed and accessed in the same way as the above. */ struct buffer alignas (GCALIGNMENT) buffer_local_symbols; -/* A Lisp_Object pointer to the above, used for staticpro */ -static Lisp_Object Vbuffer_local_symbols; - /* Return the symbol of the per-buffer variable at offset OFFSET in the buffer structure. */ @@ -115,7 +108,7 @@ static void call_overlay_mod_hooks (Lisp_Object list, Lisp_Object overlay, static void swap_out_buffer_local_variables (struct buffer *b); static void reset_buffer_local_variables (struct buffer *, bool); -/* Alist of all buffer names vs the buffers. */ +/* Alist of all buffer names vs the buffers. */ /* This used to be a variable, but is no longer, to prevent lossage due to user rplac'ing this alist or its elements. */ Lisp_Object Vbuffer_alist; @@ -134,7 +127,7 @@ static Lisp_Object Qpermanent_local_hook; static Lisp_Object Qprotected_field; -static Lisp_Object QSFundamental; /* A string "Fundamental" */ +static Lisp_Object QSFundamental; /* A string "Fundamental". */ static Lisp_Object Qkill_buffer_hook; static Lisp_Object Qbuffer_list_update_hook; @@ -595,10 +588,6 @@ even if it is dead. The return value is never nil. */) bset_width_table (b, Qnil); b->prevent_redisplay_optimizations_p = 1; - /* Put this on the chain of all buffers including killed ones. */ - b->header.next.buffer = all_buffers; - all_buffers = b; - /* An ordinary buffer normally doesn't need markers to handle BEGV and ZV. */ bset_pt_marker (b, Qnil); @@ -819,10 +808,6 @@ CLONE nil means the indirect buffer's state is reset to default values. */) b->width_run_cache = 0; bset_width_table (b, Qnil); - /* Put this on the chain of all buffers including killed ones. */ - b->header.next.buffer = all_buffers; - all_buffers = b; - name = Fcopy_sequence (name); set_string_intervals (name, NULL); bset_name (b, name); @@ -1242,7 +1227,7 @@ buffer_local_value_1 (Lisp_Object variable, Lisp_Object buffer) result = Fdefault_value (variable); break; } - default: abort (); + default: emacs_abort (); } return result; @@ -2671,7 +2656,7 @@ current buffer is cleared. */) /* Make sure no markers were put on the chain while the chain value was incorrect. */ if (BUF_MARKERS (current_buffer)) - abort (); + emacs_abort (); BUF_MARKERS (current_buffer) = markers; @@ -3413,7 +3398,7 @@ overlay_strings (ptrdiff_t pos, struct window *w, unsigned char **pstr) } } if (p != overlay_str_buf + total) - abort (); + emacs_abort (); if (pstr) *pstr = overlay_str_buf; return total; @@ -4596,7 +4581,7 @@ buffer_slot_type_mismatch (Lisp_Object newval, int type) case_Lisp_Int: predicate = Qintegerp; break; case Lisp_String: predicate = Qstringp; break; case Lisp_Symbol: predicate = Qsymbolp; break; - default: abort (); + default: emacs_abort (); } wrong_type_argument (predicate, newval); @@ -5145,10 +5130,11 @@ init_buffer_once (void) buffer_local_symbols.indirections = 0; set_buffer_intervals (&buffer_defaults, NULL); set_buffer_intervals (&buffer_local_symbols, NULL); + /* This is not strictly necessary, but let's make them initialized. */ + bset_name (&buffer_defaults, build_pure_c_string (" *buffer-defaults*")); + bset_name (&buffer_local_symbols, build_pure_c_string (" *buffer-local-symbols*")); XSETPVECTYPESIZE (&buffer_defaults, PVEC_BUFFER, pvecsize); - XSETBUFFER (Vbuffer_defaults, &buffer_defaults); XSETPVECTYPESIZE (&buffer_local_symbols, PVEC_BUFFER, pvecsize); - XSETBUFFER (Vbuffer_local_symbols, &buffer_local_symbols); /* Set up the default values of various buffer slots. */ /* Must do these before making the first buffer! */ @@ -5277,7 +5263,7 @@ init_buffer_once (void) /* Need more room? */ if (idx >= MAX_PER_BUFFER_VARS) - abort (); + emacs_abort (); last_per_buffer_idx = idx; Vbuffer_alist = Qnil; @@ -5418,7 +5404,7 @@ defvar_per_buffer (struct Lisp_Buffer_Objfwd *bo_fwd, const char *namestring, if (PER_BUFFER_IDX (offset) == 0) /* Did a DEFVAR_PER_BUFFER without initializing the corresponding slot of buffer_local_flags */ - abort (); + emacs_abort (); } @@ -5430,8 +5416,6 @@ syms_of_buffer (void) last_overlay_modification_hooks = Fmake_vector (make_number (10), Qnil); - staticpro (&Vbuffer_defaults); - staticpro (&Vbuffer_local_symbols); staticpro (&Qfundamental_mode); staticpro (&Qmode_class); staticpro (&QSFundamental); diff --git a/src/buffer.h b/src/buffer.h index 3acf1423816..da40a7ce3d8 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -1149,7 +1149,7 @@ BUF_FETCH_MULTIBYTE_CHAR (struct buffer *buf, ptrdiff_t pos) We assume you know which buffer it's pointing into. */ #define OVERLAY_POSITION(P) \ - (MARKERP (P) ? marker_position (P) : (abort (), 0)) + (MARKERP (P) ? marker_position (P) : (emacs_abort (), 0)) /*********************************************************************** @@ -1189,7 +1189,7 @@ extern int last_per_buffer_idx; #define PER_BUFFER_VALUE_P(B, IDX) \ (((IDX) < 0 || IDX >= last_per_buffer_idx) \ - ? (abort (), 0) \ + ? (emacs_abort (), 0) \ : ((B)->local_flags[IDX] != 0)) /* Set whether per-buffer variable with index IDX has a buffer-local @@ -1198,7 +1198,7 @@ extern int last_per_buffer_idx; #define SET_PER_BUFFER_VALUE_P(B, IDX, VAL) \ do { \ if ((IDX) < 0 || (IDX) >= last_per_buffer_idx) \ - abort (); \ + emacs_abort (); \ (B)->local_flags[IDX] = (VAL); \ } while (0) diff --git a/src/bytecode.c b/src/bytecode.c index 40729cbd453..97730636d0e 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -435,7 +435,7 @@ unmark_byte_stack (void) #ifdef BYTE_CODE_SAFE #define CHECK_RANGE(ARG) \ - if (ARG >= bytestr_length) abort () + if (ARG >= bytestr_length) emacs_abort () #else /* not BYTE_CODE_SAFE */ @@ -508,7 +508,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, if (FRAME_X_P (f) && FRAME_FONT (f)->direction != 0 && FRAME_FONT (f)->direction != 1) - abort (); + emacs_abort (); } #endif @@ -600,9 +600,9 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, { #ifdef BYTE_CODE_SAFE if (top > stacke) - abort (); + emacs_abort (); else if (top < stack.bottom - 1) - abort (); + emacs_abort (); #endif #ifdef BYTE_CODE_METER @@ -1875,7 +1875,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, /* Actually this is Bstack_ref with offset 0, but we use Bdup for that instead. */ /* CASE (Bstack_ref): */ - abort (); + emacs_abort (); /* Handy byte-codes for lexical binding. */ CASE (Bstack_ref1): @@ -1928,11 +1928,11 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, #ifdef BYTE_CODE_SAFE if (op < Bconstant) { - abort (); + emacs_abort (); } if ((op -= Bconstant) >= const_length) { - abort (); + emacs_abort (); } PUSH (vectorp[op]); #else @@ -1951,7 +1951,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth, #ifdef BYTE_CODE_SAFE error ("binding stack not balanced (serious byte compiler bug)"); #else - abort (); + emacs_abort (); #endif return result; diff --git a/src/callproc.c b/src/callproc.c index 2e9a8950700..a92959a1559 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -19,7 +19,6 @@ along with GNU Emacs. If not, see . */ #include -#include #include #include #include @@ -506,9 +505,6 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS) */) if (fd_output >= 0) fd1 = fd_output; -#if 0 /* Some systems don't have sigblock. */ - mask = sigblock (sigmask (SIGCHLD)); -#endif /* Record that we're about to create a synchronous process. */ synch_process_alive = 1; diff --git a/src/character.c b/src/character.c index cfaaf8eeca9..37963d1878c 100644 --- a/src/character.c +++ b/src/character.c @@ -541,7 +541,7 @@ multibyte_chars_in_text (const unsigned char *ptr, ptrdiff_t nbytes) int len = MULTIBYTE_LENGTH (ptr, endp); if (len == 0) - abort (); + emacs_abort (); ptr += len; chars++; } diff --git a/src/charset.c b/src/charset.c index 0673790e91c..972a0598059 100644 --- a/src/charset.c +++ b/src/charset.c @@ -636,7 +636,7 @@ load_charset (struct charset *charset, int control_flag) else { if (! CHARSET_UNIFIED_P (charset)) - abort (); + emacs_abort (); map = CHARSET_UNIFY_MAP (charset); } if (STRINGP (map)) @@ -2025,10 +2025,10 @@ CH in the charset. */) c = XFASTINT (ch); charset = CHAR_CHARSET (c); if (! charset) - abort (); + emacs_abort (); code = ENCODE_CHAR (charset, c); if (code == CHARSET_INVALID_CODE (charset)) - abort (); + emacs_abort (); dimension = CHARSET_DIMENSION (charset); for (val = Qnil; dimension > 0; dimension--) { diff --git a/src/cm.c b/src/cm.c index 1922cd8140a..4b17b92eebc 100644 --- a/src/cm.c +++ b/src/cm.c @@ -119,7 +119,7 @@ cmcheckmagic (struct tty_display_info *tty) if (curX (tty) == FrameCols (tty)) { if (!MagicWrap (tty) || curY (tty) >= FrameRows (tty) - 1) - abort (); + emacs_abort (); if (tty->termscript) putc ('\r', tty->termscript); putc ('\r', tty->output); diff --git a/src/coding.c b/src/coding.c index 02e7b34695e..94a2d9fea80 100644 --- a/src/coding.c +++ b/src/coding.c @@ -2051,7 +2051,7 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src, break; default: - abort (); + emacs_abort (); } CODING_DECODE_CHAR (coding, src, src_base, src_end, CHARSET_FROM_ID (charset_ID), code, c); @@ -2345,7 +2345,7 @@ decode_coding_emacs_mule (struct coding_system *coding) int i; if (charbuf_end - charbuf < cmp_status->length) - abort (); + emacs_abort (); for (i = 0; i < cmp_status->length; i++) *charbuf++ = cmp_status->carryover[i]; coding->annotated = 1; @@ -2619,7 +2619,7 @@ encode_coding_emacs_mule (struct coding_system *coding) preferred_charset_id = -1; break; default: - abort (); + emacs_abort (); } charbuf += -c - 1; continue; @@ -3482,7 +3482,7 @@ decode_coding_iso_2022 (struct coding_system *coding) if (cmp_status->state != COMPOSING_NO) { if (charbuf_end - charbuf < cmp_status->length) - abort (); + emacs_abort (); for (i = 0; i < cmp_status->length; i++) *charbuf++ = cmp_status->carryover[i]; coding->annotated = 1; @@ -3864,7 +3864,7 @@ decode_coding_iso_2022 (struct coding_system *coding) break; default: - abort (); + emacs_abort (); } if (cmp_status->state == COMPOSING_NO @@ -4419,7 +4419,7 @@ encode_coding_iso_2022 (struct coding_system *coding) preferred_charset_id = -1; break; default: - abort (); + emacs_abort (); } charbuf += -c - 1; continue; @@ -4933,7 +4933,7 @@ encode_coding_sjis (struct coding_system *coding) } } if (code == CHARSET_INVALID_CODE (charset)) - abort (); + emacs_abort (); if (charset == charset_kanji) { int c1, c2; @@ -5023,7 +5023,7 @@ encode_coding_big5 (struct coding_system *coding) } } if (code == CHARSET_INVALID_CODE (charset)) - abort (); + emacs_abort (); if (charset == charset_big5) { int c1, c2; @@ -7190,7 +7190,7 @@ handle_composition_annotation (ptrdiff_t pos, ptrdiff_t limit, *buf++ = XINT (XCAR (components)); } else - abort (); + emacs_abort (); *head -= len; } } @@ -9428,7 +9428,7 @@ usage: (set-coding-system-priority &rest coding-systems) */) && changed[coding_priorities[j]]) j++; if (j == coding_category_max) - abort (); + emacs_abort (); priorities[i] = coding_priorities[j]; } diff --git a/src/conf_post.h b/src/conf_post.h index f90ef90fb83..1bf40af260b 100644 --- a/src/conf_post.h +++ b/src/conf_post.h @@ -40,11 +40,6 @@ along with GNU Emacs. If not, see . */ #endif #endif -#ifdef SIGNAL_H_AHB -#undef SIGNAL_H_AHB -#include -#endif - /* This silences a few compilation warnings on FreeBSD. */ #ifdef BSD_SYSTEM_AHB #undef BSD_SYSTEM_AHB @@ -167,7 +162,7 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */ #ifdef emacs /* Don't do this for lib-src. */ /* Tell regex.c to use a type compatible with Emacs. */ #define RE_TRANSLATE_TYPE Lisp_Object -#define RE_TRANSLATE(TBL, C) CHAR_TABLE_TRANSLATE (TBL, C) +#define RE_TRANSLATE(TBL, C) char_table_translate (TBL, C) #ifdef make_number /* If make_number is a macro, use it. */ #define RE_TRANSLATE_P(TBL) (!EQ (TBL, make_number (0))) @@ -178,9 +173,6 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */ #endif #include -/* If you think about removing the line below, note that the - MS-Windows build relies on it for declaration of 'environ' needed - by a few source files. */ #include #if __GNUC__ >= 3 /* On GCC 3.0 we might get a warning. */ diff --git a/src/data.c b/src/data.c index d8b7f42ea3f..a4cca0a3ee5 100644 --- a/src/data.c +++ b/src/data.c @@ -19,7 +19,6 @@ along with GNU Emacs. If not, see . */ #include -#include #include #include @@ -37,17 +36,12 @@ along with GNU Emacs. If not, see . */ #include "keymap.h" #include -/* If IEEE_FLOATING_POINT isn't defined, default it from FLT_*. */ -#ifndef IEEE_FLOATING_POINT #if (FLT_RADIX == 2 && FLT_MANT_DIG == 24 \ && FLT_MIN_EXP == -125 && FLT_MAX_EXP == 128) #define IEEE_FLOATING_POINT 1 #else #define IEEE_FLOATING_POINT 0 #endif -#endif - -#include Lisp_Object Qnil, Qt, Qquote, Qlambda, Qunbound; static Lisp_Object Qsubr; @@ -108,7 +102,7 @@ wrong_type_argument (register Lisp_Object predicate, register Lisp_Object value) to try and do that by checking the tagbits, but nowadays all tagbits are potentially valid. */ /* if ((unsigned int) XTYPE (value) >= Lisp_Type_Limit) - * abort (); */ + * emacs_abort (); */ xsignal2 (Qwrong_type_argument, predicate, value); } @@ -182,7 +176,7 @@ for example, (type-of 1) returns `integer'. */) case Lisp_Misc_Float: return Qfloat; } - abort (); + emacs_abort (); case Lisp_Vectorlike: if (WINDOW_CONFIGURATIONP (object)) @@ -217,7 +211,7 @@ for example, (type-of 1) returns `integer'. */) return Qfloat; default: - abort (); + emacs_abort (); } } @@ -551,7 +545,7 @@ DEFUN ("boundp", Fboundp, Sboundp, 1, 1, 0, /* In set_internal, we un-forward vars when their value is set to Qunbound. */ return Qt; - default: abort (); + default: emacs_abort (); } return (EQ (valcontents, Qunbound) ? Qnil : Qt); @@ -864,7 +858,7 @@ do_symval_forwarding (register union Lisp_Fwd *valcontents) don't think anything will break. --lorentey */ return *(Lisp_Object *)(XKBOARD_OBJFWD (valcontents)->offset + (char *)FRAME_KBOARD (SELECTED_FRAME ())); - default: abort (); + default: emacs_abort (); } } @@ -950,7 +944,7 @@ store_symval_forwarding (union Lisp_Fwd *valcontents, register Lisp_Object newva break; default: - abort (); /* goto def; */ + emacs_abort (); /* goto def; */ } } @@ -1055,7 +1049,7 @@ find_symbol_value (Lisp_Object symbol) /* FALLTHROUGH */ case SYMBOL_FORWARDED: return do_symval_forwarding (SYMBOL_FWD (sym)); - default: abort (); + default: emacs_abort (); } } @@ -1265,7 +1259,7 @@ set_internal (Lisp_Object symbol, Lisp_Object newval, Lisp_Object where, store_symval_forwarding (/* sym, */ innercontents, newval, buf); break; } - default: abort (); + default: emacs_abort (); } return; } @@ -1316,7 +1310,7 @@ default_value (Lisp_Object symbol) /* For other variables, get the current value. */ return do_symval_forwarding (valcontents); } - default: abort (); + default: emacs_abort (); } } @@ -1414,7 +1408,7 @@ for this variable. */) else return Fset (symbol, value); } - default: abort (); + default: emacs_abort (); } } @@ -1538,7 +1532,7 @@ The function `default-value' gets the default value and `set-default' sets it. else if (BUFFER_OBJFWDP (valcontents.fwd)) return variable; break; - default: abort (); + default: emacs_abort (); } if (sym->constant) @@ -1611,7 +1605,7 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */) error ("Symbol %s may not be buffer-local", SDATA (SYMBOL_NAME (variable))); break; - default: abort (); + default: emacs_abort (); } if (sym->constant) @@ -1718,7 +1712,7 @@ From now on the default value will apply in this buffer. Return VARIABLE. */) if (blv->frame_local) return variable; break; - default: abort (); + default: emacs_abort (); } /* Get rid of this buffer's alist element, if any. */ @@ -1800,7 +1794,7 @@ frame-local bindings). */) error ("Symbol %s may not be frame-local", SDATA (SYMBOL_NAME (variable))); break; - default: abort (); + default: emacs_abort (); } if (sym->constant) @@ -1877,18 +1871,18 @@ BUFFER defaults to the current buffer. */) } return Qnil; } - default: abort (); + default: emacs_abort (); } } DEFUN ("local-variable-if-set-p", Flocal_variable_if_set_p, Slocal_variable_if_set_p, 1, 2, 0, - doc: /* Non-nil if VARIABLE will be local in buffer BUFFER when set there. -More precisely, this means that setting the variable \(with `set' or`setq'), -while it does not have a `let'-style binding that was made in BUFFER, -will produce a buffer local binding. See Info node -`(elisp)Creating Buffer-Local'. -BUFFER defaults to the current buffer. */) + doc: /* Non-nil if VARIABLE is local in buffer BUFFER when set there. +BUFFER defaults to the current buffer. + +More precisely, return non-nil if either VARIABLE already has a local +value in BUFFER, or if VARIABLE is automatically buffer-local (see +`make-variable-buffer-local'). */) (register Lisp_Object variable, Lisp_Object buffer) { struct Lisp_Symbol *sym; @@ -1912,7 +1906,7 @@ BUFFER defaults to the current buffer. */) case SYMBOL_FORWARDED: /* All BUFFER_OBJFWD slots become local if they are set. */ return (BUFFER_OBJFWDP (SYMBOL_FWD (sym)) ? Qt : Qnil); - default: abort (); + default: emacs_abort (); } } @@ -1956,7 +1950,7 @@ If the current binding is global (the default), the value is nil. */) return SYMBOL_BLV (sym)->where; else return Qnil; - default: abort (); + default: emacs_abort (); } } @@ -2272,7 +2266,7 @@ arithcompare (Lisp_Object num1, Lisp_Object num2, enum comparison comparison) return Qnil; default: - abort (); + emacs_abort (); } } @@ -2738,28 +2732,6 @@ Both must be integers or markers. */) return val; } -#ifndef HAVE_FMOD -double -fmod (double f1, double f2) -{ - double r = f1; - - if (f2 < 0.0) - f2 = -f2; - - /* If the magnitude of the result exceeds that of the divisor, or - the sign of the result does not agree with that of the dividend, - iterate with the reduced value. This does not yield a - particularly accurate result, but at least it will be in the - range promised by fmod. */ - do - r -= f2 * floor (r / f2); - while (f2 <= (r < 0 ? -r : r) || ((r < 0) != (f1 < 0) && ! isnan (r))); - - return r; -} -#endif /* ! HAVE_FMOD */ - DEFUN ("mod", Fmod, Smod, 2, 2, 0, doc: /* Return X modulo Y. The result falls between zero (inclusive) and Y (exclusive). @@ -3207,21 +3179,23 @@ syms_of_data (void) XSYMBOL (intern_c_string ("most-negative-fixnum"))->constant = 1; } -#ifndef FORWARD_SIGNAL_TO_MAIN_THREAD -_Noreturn -#endif -static void -arith_error (int signo) +static _Noreturn void +handle_arith_signal (int sig) { - sigsetmask (SIGEMPTYMASK); - - SIGNAL_THREAD_CHECK (signo); + pthread_sigmask (SIG_SETMASK, &empty_mask, 0); xsignal0 (Qarith_error); } +static void +deliver_arith_signal (int sig) +{ + handle_on_main_thread (sig, handle_arith_signal); +} + void init_data (void) { + struct sigaction action; /* Don't do this if just dumping out. We don't want to call `signal' in this case so that we don't have trouble with dumping @@ -3230,5 +3204,6 @@ init_data (void) if (!initialized) return; #endif /* CANNOT_DUMP */ - signal (SIGFPE, arith_error); + emacs_sigaction_init (&action, deliver_arith_signal); + sigaction (SIGFPE, &action, 0); } diff --git a/src/dired.c b/src/dired.c index fa293258107..9af5f76821b 100644 --- a/src/dired.c +++ b/src/dired.c @@ -275,7 +275,7 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, /* Some bug somewhere. */ if (nchars > nbytes) - abort (); + emacs_abort (); STRING_SET_CHARS (fullname, nchars); if (nchars == nbytes) diff --git a/src/dispnew.c b/src/dispnew.c index 2bd6d7f2a6f..bc9141a575d 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -20,7 +20,6 @@ along with GNU Emacs. If not, see . */ #define DISPEXTERN_INLINE EXTERN_INLINE -#include #include #include #include @@ -299,7 +298,7 @@ DEFUN ("dump-redisplay-history", Fdump_redisplay_history, void __executable_start (void) { - abort (); + emacs_abort (); } #endif @@ -349,7 +348,7 @@ free_glyph_matrix (struct glyph_matrix *matrix) /* Detect the case that more matrices are freed than were allocated. */ if (--glyph_matrix_count < 0) - abort (); + emacs_abort (); /* Free glyph memory if MATRIX owns it. */ if (matrix->pool == NULL) @@ -2341,9 +2340,9 @@ check_glyph_memory (void) /* Check that nothing is left allocated. */ if (glyph_matrix_count) - abort (); + emacs_abort (); if (glyph_pool_count) - abort (); + emacs_abort (); } @@ -3026,7 +3025,7 @@ check_matrix_pointers (struct glyph_matrix *window_matrix, { if (!glyph_row_slice_p (window_matrix->rows + i, frame_matrix->rows + j)) - abort (); + emacs_abort (); ++i, ++j; } } @@ -3455,7 +3454,7 @@ check_current_matrix_flags (struct window *w) if (!last_seen_p && MATRIX_ROW_BOTTOM_Y (row) >= yb) last_seen_p = 1; else if (last_seen_p && row->enabled_p) - abort (); + emacs_abort (); } } @@ -3957,6 +3956,11 @@ update_window_line (struct window *w, int vpos, bool *mouse_face_overwritten_p) { changed_p = 1; update_marginal_area (w, LEFT_MARGIN_AREA, vpos); + /* Setting this flag will ensure the vertical border, if + any, between this window and the one on its left will be + redrawn. This is necessary because updating the left + margin area can potentially draw over the border. */ + current_row->redraw_fringe_bitmaps_p = 1; } /* Update the display of the text area. */ @@ -4820,7 +4824,7 @@ scrolling (struct frame *frame) struct glyph_matrix *desired_matrix = frame->desired_matrix; if (!current_matrix) - abort (); + emacs_abort (); /* Compute hash codes of all the lines. Also calculate number of changed lines, number of unchanged lines at the beginning, and @@ -5488,7 +5492,7 @@ marginal_area_string (struct window *w, enum window_part part, else if (part == ON_RIGHT_MARGIN) area = RIGHT_MARGIN_AREA; else - abort (); + emacs_abort (); for (i = 0; row->enabled_p && i < w->current_matrix->nrows; ++i, ++row) if (wy >= row->y && wy < MATRIX_ROW_BOTTOM_Y (row)) @@ -5563,17 +5567,17 @@ marginal_area_string (struct window *w, enum window_part part, #ifdef SIGWINCH +static void deliver_window_change_signal (int); + static void -window_change_signal (int signalnum) /* If we don't have an argument, */ - /* some compilers complain in signal calls. */ +handle_window_change_signal (int sig) { int width, height; - int old_errno = errno; - struct tty_display_info *tty; - signal (SIGWINCH, window_change_signal); - SIGNAL_THREAD_CHECK (signalnum); + struct sigaction action; + emacs_sigaction_init (&action, deliver_window_change_signal); + sigaction (SIGWINCH, &action, 0); /* The frame size change obviously applies to a single termcap-controlled terminal, but we can't decide which. @@ -5602,8 +5606,12 @@ window_change_signal (int signalnum) /* If we don't have an argument, */ change_frame_size (XFRAME (frame), height, width, 0, 1, 0); } } +} - errno = old_errno; +static void +deliver_window_change_signal (int sig) +{ + handle_on_main_thread (sig, handle_window_change_signal); } #endif /* SIGWINCH */ @@ -5615,7 +5623,7 @@ window_change_signal (int signalnum) /* If we don't have an argument, */ void do_pending_window_change (bool safe) { - /* If window_change_signal should have run before, run it now. */ + /* If window change signal handler should have run before, run it now. */ if (redisplaying_p && !safe) return; @@ -6184,7 +6192,11 @@ init_display (void) #ifndef CANNOT_DUMP if (initialized) #endif /* CANNOT_DUMP */ - signal (SIGWINCH, window_change_signal); + { + struct sigaction action; + emacs_sigaction_init (&action, deliver_window_change_signal); + sigaction (SIGWINCH, &action, 0); + } #endif /* SIGWINCH */ /* If running as a daemon, no need to initialize any frames/terminal. */ @@ -6288,7 +6300,7 @@ init_display (void) /* Convert the initial frame to use the new display. */ if (f->output_method != output_initial) - abort (); + emacs_abort (); f->output_method = t->type; f->terminal = t; diff --git a/src/doc.c b/src/doc.c index c21935577f2..02a5b4b8143 100644 --- a/src/doc.c +++ b/src/doc.c @@ -848,10 +848,9 @@ Otherwise, return a new string, without any text properties. */) struct buffer *oldbuf; ptrdiff_t start_idx; /* This is for computing the SHADOWS arg for describe_map_tree. */ - Lisp_Object active_maps; + Lisp_Object active_maps = Fcurrent_active_maps (Qnil, Qnil); Lisp_Object earlier_maps; - active_maps = Fcurrent_active_maps (Qnil, Qnil); changed = 1; strp += 2; /* skip \{ or \< */ start = strp; diff --git a/src/doprnt.c b/src/doprnt.c index b36e946005d..3b7391f07d4 100644 --- a/src/doprnt.c +++ b/src/doprnt.c @@ -114,10 +114,6 @@ along with GNU Emacs. If not, see . */ another macro. */ #include "character.h" -#ifndef DBL_MAX_10_EXP -#define DBL_MAX_10_EXP 308 /* IEEE double */ -#endif - /* Generate output from a format-spec FORMAT, terminated at position FORMAT_END. (*FORMAT_END is not part of the format, but must exist and be readable.) diff --git a/src/editfns.c b/src/editfns.c index a14e043c1bf..65baaf4e3f8 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -2783,8 +2783,8 @@ determines whether case is significant or ignored. */) if (!NILP (trt)) { - c1 = CHAR_TABLE_TRANSLATE (trt, c1); - c2 = CHAR_TABLE_TRANSLATE (trt, c2); + c1 = char_table_translate (trt, c1); + c2 = char_table_translate (trt, c2); } if (c1 < c2) return make_number (- 1 - chars); @@ -4263,7 +4263,7 @@ usage: (format STRING &rest OBJECTS) */) } if (bufsize < p - buf) - abort (); + emacs_abort (); if (maybe_combine_byte) nchars = multibyte_chars_in_text ((unsigned char *) buf, p - buf); @@ -4603,7 +4603,7 @@ Transposing beyond buffer boundaries is an error. */) len1_byte, end2, start2_byte + len2_byte) || count_combining_after (BYTE_POS_ADDR (start1_byte), len1_byte, end2, start2_byte + len2_byte)) - abort (); + emacs_abort (); } else { @@ -4615,7 +4615,7 @@ Transposing beyond buffer boundaries is an error. */) len2_byte, end1, start1_byte + len1_byte) || count_combining_after (BYTE_POS_ADDR (start1_byte), len1_byte, end2, start2_byte + len2_byte)) - abort (); + emacs_abort (); } #endif diff --git a/src/emacs.c b/src/emacs.c index b454e2423fb..d0e2f1e021d 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -20,7 +20,6 @@ along with GNU Emacs. If not, see . */ #include -#include #include #include @@ -278,14 +277,6 @@ static int fatal_error_code; /* True if handling a fatal error already. */ bool fatal_error_in_progress; -#ifdef FORWARD_SIGNAL_TO_MAIN_THREAD -/* When compiled with GTK and running under Gnome, - multiple threads may be created. Keep track of our main - thread to make sure signals are delivered to it (see syssignal.h). */ - -pthread_t main_thread; -#endif - #ifdef HAVE_NS /* NS autrelease pool, for memory management. */ static void *ns_pool; @@ -294,13 +285,23 @@ static void *ns_pool; /* Handle bus errors, invalid instruction, etc. */ -#ifndef FLOAT_CATCH_SIGILL -static -#endif -void -fatal_error_signal (int sig) +static void +handle_fatal_signal (int sig) +{ + fatal_error_backtrace (sig, 10); +} + +static void +deliver_fatal_signal (int sig) +{ + handle_on_main_thread (sig, handle_fatal_signal); +} + +/* Report a fatal error due to signal SIG, output a backtrace of at + most BACKTRACE_LIMIT lines, and exit. */ +_Noreturn void +fatal_error_backtrace (int sig, int backtrace_limit) { - SIGNAL_THREAD_CHECK (sig); fatal_error_code = sig; signal (sig, SIG_DFL); @@ -315,6 +316,7 @@ fatal_error_signal (int sig) Fkill_emacs (make_number (sig)); shut_down_emacs (sig, Qnil); + emacs_backtrace (backtrace_limit); } /* Signal the same code; this time it will really be fatal. @@ -322,43 +324,44 @@ fatal_error_signal (int sig) going to send is probably blocked, so we have to unblock it if we want to really receive it. */ #ifndef MSDOS - sigunblock (sigmask (fatal_error_code)); + { + sigset_t unblocked; + sigemptyset (&unblocked); + sigaddset (&unblocked, fatal_error_code); + pthread_sigmask (SIG_UNBLOCK, &unblocked, 0); + } #endif kill (getpid (), fatal_error_code); + + /* This shouldn't be executed, but it prevents a warning. */ + exit (1); } #ifdef SIGDANGER /* Handler for SIGDANGER. */ -void -memory_warning_signal (int sig) +static void deliver_danger_signal (int); + +static void +handle_danger_signal (int sig) { - signal (sig, memory_warning_signal); - SIGNAL_THREAD_CHECK (sig); + struct sigaction action; + emacs_sigaction_init (&action, deliver_danger_signal); + sigaction (sig, &action, 0); malloc_warning ("Operating system warns that virtual memory is running low.\n"); /* It might be unsafe to call do_auto_save now. */ force_auto_save_soon (); } -#endif -/* We define abort, rather than using it from the library, - so that GDB can return from a breakpoint here. - MSDOS has its own definition in msdos.c. */ - -#if ! defined (DOS_NT) && ! defined (NO_ABORT) - -void -abort (void) +static void +deliver_danger_signal (int sig) { - kill (getpid (), SIGABRT); - /* This shouldn't be executed, but it prevents a warning. */ - exit (1); + handle_on_main_thread (sig, handle_danger_signal); } #endif - /* Code for dealing with Lisp access to the Unix command line. */ @@ -690,6 +693,7 @@ main (int argc, char **argv) char dname_arg2[80]; #endif char *ch_to_dir; + struct sigaction fatal_error_action; #if GC_MARK_STACK stack_base = &dummy; @@ -858,10 +862,6 @@ main (int argc, char **argv) # endif /* not SYNC_INPUT */ #endif /* not SYSTEM_MALLOC */ -#ifdef FORWARD_SIGNAL_TO_MAIN_THREAD - main_thread = pthread_self (); -#endif /* FORWARD_SIGNAL_TO_MAIN_THREAD */ - #if defined (MSDOS) || defined (WINDOWSNT) /* We do all file input/output as binary files. When we need to translate newlines, we do that manually. */ @@ -1114,6 +1114,7 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem } init_signals (); + emacs_sigaction_init (&fatal_error_action, deliver_fatal_signal); /* Don't catch SIGHUP if dumping. */ if (1 @@ -1122,13 +1123,17 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem #endif ) { - sigblock (sigmask (SIGHUP)); /* In --batch mode, don't catch SIGHUP if already ignored. That makes nohup work. */ - if (! noninteractive - || signal (SIGHUP, SIG_IGN) != SIG_IGN) - signal (SIGHUP, fatal_error_signal); - sigunblock (sigmask (SIGHUP)); + bool catch_SIGHUP = !noninteractive; + if (!catch_SIGHUP) + { + struct sigaction old_action; + sigaction (SIGHUP, 0, &old_action); + catch_SIGHUP = old_action.sa_handler != SIG_IGN; + } + if (catch_SIGHUP) + sigaction (SIGHUP, &fatal_error_action, 0); } if ( @@ -1142,9 +1147,9 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem /* Don't catch these signals in batch mode if dumping. On some machines, this sets static data that would make signal fail to work right when the dumped Emacs is run. */ - signal (SIGQUIT, fatal_error_signal); - signal (SIGILL, fatal_error_signal); - signal (SIGTRAP, fatal_error_signal); + sigaction (SIGQUIT, &fatal_error_action, 0); + sigaction (SIGILL, &fatal_error_action, 0); + sigaction (SIGTRAP, &fatal_error_action, 0); #ifdef SIGUSR1 add_user_signal (SIGUSR1, "sigusr1"); #endif @@ -1152,68 +1157,73 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem add_user_signal (SIGUSR2, "sigusr2"); #endif #ifdef SIGABRT - signal (SIGABRT, fatal_error_signal); + sigaction (SIGABRT, &fatal_error_action, 0); #endif #ifdef SIGHWE - signal (SIGHWE, fatal_error_signal); + sigaction (SIGHWE, &fatal_error_action, 0); #endif #ifdef SIGPRE - signal (SIGPRE, fatal_error_signal); + sigaction (SIGPRE, &fatal_error_action, 0); #endif #ifdef SIGORE - signal (SIGORE, fatal_error_signal); + sigaction (SIGORE, &fatal_error_action, 0); #endif #ifdef SIGUME - signal (SIGUME, fatal_error_signal); + sigaction (SIGUME, &fatal_error_action, 0); #endif #ifdef SIGDLK - signal (SIGDLK, fatal_error_signal); + sigaction (SIGDLK, &fatal_error_action, 0); #endif #ifdef SIGCPULIM - signal (SIGCPULIM, fatal_error_signal); + sigaction (SIGCPULIM, &fatal_error_action, 0); #endif #ifdef SIGIOT /* This is missing on some systems - OS/2, for example. */ - signal (SIGIOT, fatal_error_signal); + sigaction (SIGIOT, &fatal_error_action, 0); #endif #ifdef SIGEMT - signal (SIGEMT, fatal_error_signal); + sigaction (SIGEMT, &fatal_error_action, 0); #endif - signal (SIGFPE, fatal_error_signal); + sigaction (SIGFPE, &fatal_error_action, 0); #ifdef SIGBUS - signal (SIGBUS, fatal_error_signal); + sigaction (SIGBUS, &fatal_error_action, 0); #endif - signal (SIGSEGV, fatal_error_signal); + sigaction (SIGSEGV, &fatal_error_action, 0); #ifdef SIGSYS - signal (SIGSYS, fatal_error_signal); + sigaction (SIGSYS, &fatal_error_action, 0); #endif /* May need special treatment on MS-Windows. See http://lists.gnu.org/archive/html/emacs-devel/2010-09/msg01062.html Please update the doc of kill-emacs, kill-emacs-hook, and NEWS if you change this. */ - if (noninteractive) signal (SIGINT, fatal_error_signal); - signal (SIGTERM, fatal_error_signal); + if (noninteractive) + sigaction (SIGINT, &fatal_error_action, 0); + sigaction (SIGTERM, &fatal_error_action, 0); #ifdef SIGXCPU - signal (SIGXCPU, fatal_error_signal); + sigaction (SIGXCPU, &fatal_error_action, 0); #endif #ifdef SIGXFSZ - signal (SIGXFSZ, fatal_error_signal); + sigaction (SIGXFSZ, &fatal_error_action, 0); #endif /* SIGXFSZ */ #ifdef SIGDANGER /* This just means available memory is getting low. */ - signal (SIGDANGER, memory_warning_signal); + { + struct sigaction action; + emacs_sigaction_init (&action, deliver_danger_signal); + sigaction (SIGDANGER, &action, 0); + } #endif #ifdef AIX /* 20 is SIGCHLD, 21 is SIGTTIN, 22 is SIGTTOU. */ - signal (SIGXCPU, fatal_error_signal); - signal (SIGIOINT, fatal_error_signal); - signal (SIGGRANT, fatal_error_signal); - signal (SIGRETRACT, fatal_error_signal); - signal (SIGSOUND, fatal_error_signal); - signal (SIGMSG, fatal_error_signal); + sigaction (SIGXCPU, &fatal_error_action, 0); + sigaction (SIGIOINT, &fatal_error_action, 0); + sigaction (SIGGRANT, &fatal_error_action, 0); + sigaction (SIGRETRACT, &fatal_error_action, 0); + sigaction (SIGSOUND, &fatal_error_action, 0); + sigaction (SIGMSG, &fatal_error_action, 0); #endif /* AIX */ } @@ -1583,7 +1593,6 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem init_fringe (); #endif /* HAVE_WINDOW_SYSTEM */ init_macros (); - init_floatfns (); init_window (); init_font (); @@ -1898,7 +1907,7 @@ sort_args (int argc, char **argv) } if (best < 0) - abort (); + emacs_abort (); /* Copy the highest priority remaining option, with its args, to NEW. Unless it is a duplicate of the previous one. */ @@ -2014,7 +2023,7 @@ shut_down_emacs (int sig, Lisp_Object stuff) { reset_all_sys_modes (); if (sig && sig != SIGTERM) - fprintf (stderr, "Fatal error (%d)", sig); + fprintf (stderr, "Fatal error %d: %s", sig, strsignal (sig)); } } #else diff --git a/src/emacsgtkfixed.c b/src/emacsgtkfixed.c index e45cc716a31..5f90a5b90aa 100644 --- a/src/emacsgtkfixed.c +++ b/src/emacsgtkfixed.c @@ -21,7 +21,6 @@ along with GNU Emacs. If not, see . */ #include #include "emacsgtkfixed.h" -#include #include #include #include "lisp.h" diff --git a/src/eval.c b/src/eval.c index 3a4953665e3..4f0d6c69a51 100644 --- a/src/eval.c +++ b/src/eval.c @@ -191,7 +191,7 @@ restore_stack_limits (Lisp_Object data) /* Call the Lisp debugger, giving it argument ARG. */ -static Lisp_Object +Lisp_Object call_debugger (Lisp_Object arg) { bool debug_while_redisplaying; @@ -1493,7 +1493,7 @@ See also the function `condition-case'. */) immediate_quit = handling_signal = 0; abort_on_gc = 0; if (gc_in_progress || waiting_for_input) - abort (); + emacs_abort (); #if 0 /* rms: I don't know why this was here, but it is surely wrong for an error that is handled. */ @@ -1590,7 +1590,7 @@ void xsignal (Lisp_Object error_symbol, Lisp_Object data) { Fsignal (error_symbol, data); - abort (); + emacs_abort (); } /* Like xsignal, but takes 0, 1, 2, or 3 args instead of a list. */ @@ -2043,7 +2043,7 @@ eval_sub (Lisp_Object form) struct gcpro gcpro1, gcpro2, gcpro3; if (handling_signal) - abort (); + emacs_abort (); if (SYMBOLP (form)) { @@ -2207,7 +2207,7 @@ eval_sub (Lisp_Object form) is supported by this code. We need to either rewrite the subr to use a different argument protocol, or add more cases to this switch. */ - abort (); + emacs_abort (); } } } @@ -2850,7 +2850,7 @@ usage: (funcall FUNCTION &rest ARGUMENTS) */) /* If a subr takes more than 8 arguments without using MANY or UNEVALLED, we need to extend this function to support it. Until this is done, there is no way to call the function. */ - abort (); + emacs_abort (); } } } @@ -2981,7 +2981,7 @@ funcall_lambda (Lisp_Object fun, ptrdiff_t nargs, lexenv = Qnil; } else - abort (); + emacs_abort (); i = optional = rest = 0; for (; CONSP (syms_left); syms_left = XCDR (syms_left)) @@ -3195,7 +3195,7 @@ specbind (Lisp_Object symbol, Lisp_Object value) set_internal (symbol, value, Qnil, 1); break; } - default: abort (); + default: emacs_abort (); } } diff --git a/src/fileio.c b/src/fileio.c index 7466914af1c..f0b3f0cc2fd 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -85,18 +85,18 @@ along with GNU Emacs. If not, see . */ #include "commands.h" -/* Nonzero during writing of auto-save files. */ -static int auto_saving; +/* True during writing of auto-save files. */ +static bool auto_saving; /* Nonzero umask during creation of auto-save directories. */ -static int auto_saving_dir_umask; +static mode_t auto_saving_dir_umask; /* Set by auto_save_1 to mode of original file so Fwrite_region will create a new file with the same mode as the original. */ -static int auto_save_mode_bits; +static mode_t auto_save_mode_bits; /* Set by auto_save_1 if an error occurred during the last auto-save. */ -static int auto_save_error_occurred; +static bool auto_save_error_occurred; /* The symbol bound to coding-system-for-read when insert-file-contents is called for recovering a file. This is not @@ -145,10 +145,10 @@ Lisp_Object Qfile_name_history; static Lisp_Object Qcar_less_than_car; -static int a_write (int, Lisp_Object, ptrdiff_t, ptrdiff_t, - Lisp_Object *, struct coding_system *); -static int e_write (int, Lisp_Object, ptrdiff_t, ptrdiff_t, - struct coding_system *); +static bool a_write (int, Lisp_Object, ptrdiff_t, ptrdiff_t, + Lisp_Object *, struct coding_system *); +static bool e_write (int, Lisp_Object, ptrdiff_t, ptrdiff_t, + struct coding_system *); void @@ -595,7 +595,7 @@ static unsigned make_temp_name_count, make_temp_name_count_initialized_p; which has no existing file. To make this work, PREFIX should be an absolute file name. - BASE64_P non-zero means add the pid as 3 characters in base64 + BASE64_P means add the pid as 3 characters in base64 encoding. In this case, 6 characters will be added to PREFIX to form the file name. Otherwise, if Emacs is running on a system with long file names, add the pid as a decimal number. @@ -604,7 +604,7 @@ static unsigned make_temp_name_count, make_temp_name_count_initialized_p; generated. */ Lisp_Object -make_temp_name (Lisp_Object prefix, int base64_p) +make_temp_name (Lisp_Object prefix, bool base64_p) { Lisp_Object val; int len, clen; @@ -761,8 +761,8 @@ filesystem tree, not (expand-file-name ".." dirname). */) struct passwd *pw; #ifdef DOS_NT int drive = 0; - int collapse_newdir = 1; - int is_escaped = 0; + bool collapse_newdir = 1; + bool is_escaped = 0; #endif /* DOS_NT */ ptrdiff_t length; Lisp_Object handler, result, handled_name; @@ -920,10 +920,9 @@ filesystem tree, not (expand-file-name ".." dirname). */) /* If it turns out that the filename we want to return is just a suffix of FILENAME, we don't need to go through and edit things; we just need to construct a new string using data - starting at the middle of FILENAME. If we set lose to a - non-zero value, that means we've discovered that we can't do - that cool trick. */ - int lose = 0; + starting at the middle of FILENAME. If we set LOSE, that + means we've discovered that we can't do that cool trick. */ + bool lose = 0; char *p = nm; while (*p) @@ -1294,7 +1293,7 @@ filesystem tree, not (expand-file-name ".." dirname). */) if (!(IS_DIRECTORY_SEP (target[0]) && IS_DIRECTORY_SEP (target[1]))) #endif /* WINDOWSNT */ { - if (!drive) abort (); + if (!drive) emacs_abort (); target -= 2; target[0] = DRIVE_LETTER (drive); target[1] = ':'; @@ -1360,7 +1359,6 @@ See also the function `substitute-in-file-name'.") ptrdiff_t tlen; unsigned char *target; struct passwd *pw; - int lose; CHECK_STRING (name); nm = SDATA (name); @@ -1369,8 +1367,8 @@ See also the function `substitute-in-file-name'.") If no /./ or /../ we can return right away. */ if (nm[0] == '/') { + bool lose = 0; p = nm; - lose = 0; while (*p) { if (p[0] == '/' && p[1] == '/' @@ -1494,7 +1492,7 @@ See also the function `substitute-in-file-name'.") #endif /* If /~ or // appears, discard everything through first slash. */ -static int +static bool file_name_absolute_p (const char *filename) { return @@ -1560,12 +1558,10 @@ If `//' appears, everything up to and including the first of those `/' is discarded. */) (Lisp_Object filename) { - char *nm; - - register char *s, *p, *o, *x, *endp; + char *nm, *s, *p, *o, *x, *endp; char *target = NULL; int total = 0; - int substituted = 0; + bool substituted = 0; bool multibyte; char *xnm; Lisp_Object handler; @@ -1780,7 +1776,7 @@ expand_and_dir_to_file (Lisp_Object filename, Lisp_Object defdir) } /* Signal an error if the file ABSNAME already exists. - If INTERACTIVE is nonzero, ask the user whether to proceed, + If INTERACTIVE, ask the user whether to proceed, and bypass the error if the user says to go ahead. QUERYSTRING is a name for the action that is being considered to alter the file. @@ -1789,13 +1785,14 @@ expand_and_dir_to_file (Lisp_Object filename, Lisp_Object defdir) If the file does not exist, STATPTR->st_mode is set to 0. If STATPTR is null, we don't store into it. - If QUICK is nonzero, we ask for y or n, not yes or no. */ + If QUICK, ask for y or n, not yes or no. */ static void barf_or_query_if_file_exists (Lisp_Object absname, const char *querystring, - int interactive, struct stat *statptr, int quick) + bool interactive, struct stat *statptr, + bool quick) { - register Lisp_Object tem, encoded_filename; + Lisp_Object tem, encoded_filename; struct stat statbuf; struct gcpro gcpro1; @@ -1869,11 +1866,11 @@ on the system, we copy the SELinux context of FILE to NEWNAME. */) Lisp_Object handler; struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; ptrdiff_t count = SPECPDL_INDEX (); - int input_file_statable_p; + bool input_file_statable_p; Lisp_Object encoded_file, encoded_newname; #if HAVE_LIBSELINUX security_context_t con; - int fail, conlength = 0; + int conlength = 0; #endif encoded_file = encoded_newname = Qnil; @@ -1988,7 +1985,7 @@ on the system, we copy the SELinux context of FILE to NEWNAME. */) S_IREAD | S_IWRITE); #else /* not MSDOS */ { - int new_mask = 0666; + mode_t new_mask = 0666; if (input_file_statable_p) { if (!NILP (preserve_uid_gid)) @@ -2018,7 +2015,7 @@ on the system, we copy the SELinux context of FILE to NEWNAME. */) owner and group. */ if (input_file_statable_p) { - int mode_mask = 07777; + mode_t mode_mask = 07777; if (!NILP (preserve_uid_gid)) { /* Attempt to change owner and group. If that doesn't work @@ -2041,7 +2038,7 @@ on the system, we copy the SELinux context of FILE to NEWNAME. */) if (conlength > 0) { /* Set the modified context back to the file. */ - fail = fsetfilecon (ofd, con); + bool fail = fsetfilecon (ofd, con) != 0; /* See http://debbugs.gnu.org/11245 for ENOTSUP. */ if (fail && errno != ENOTSUP) report_file_error ("Doing fsetfilecon", Fcons (newname, Qnil)); @@ -2184,17 +2181,14 @@ internal_delete_file_1 (Lisp_Object ignore) return Qt; } -/* Delete file FILENAME, returning 1 if successful and 0 if failed. +/* Delete file FILENAME. This ignores `delete-by-moving-to-trash'. */ -int +void internal_delete_file (Lisp_Object filename) { - Lisp_Object tem; - - tem = internal_condition_case_2 (Fdelete_file, filename, Qnil, - Qt, internal_delete_file_1); - return NILP (tem); + internal_condition_case_2 (Fdelete_file, filename, Qnil, + Qt, internal_delete_file_1); } DEFUN ("rename-file", Frename_file, Srename_file, 2, 3, @@ -2430,9 +2424,9 @@ On Unix, this is a name starting with a `/' or a `~'. */) return file_name_absolute_p (SSDATA (filename)) ? Qt : Qnil; } -/* Return nonzero if file FILENAME exists and can be executed. */ +/* Return true if file FILENAME exists and can be executed. */ -static int +static bool check_executable (char *filename) { #ifdef DOS_NT @@ -2452,9 +2446,9 @@ check_executable (char *filename) #endif /* not DOS_NT */ } -/* Return nonzero if file FILENAME exists and can be written. */ +/* Return true if file FILENAME exists and can be written. */ -static int +static bool check_writable (const char *filename) { #ifdef MSDOS @@ -2464,7 +2458,7 @@ check_writable (const char *filename) return (st.st_mode & S_IWRITE || S_ISDIR (st.st_mode)); #else /* not MSDOS */ #ifdef HAVE_EUIDACCESS - int res = (euidaccess (filename, 2) >= 0); + bool res = (euidaccess (filename, 2) >= 0); #ifdef CYGWIN /* euidaccess may have returned failure because Cygwin couldn't determine the file's UID or GID; if so, we return success. */ @@ -2732,7 +2726,7 @@ searchable directory. */) (Lisp_Object filename) { Lisp_Object handler; - int tem; + bool tem; struct gcpro gcpro1; /* If the file name has special constructs in it, @@ -2868,7 +2862,8 @@ compiled with SELinux support. */) Lisp_Object type = CAR_SAFE (CDR_SAFE (CDR_SAFE (context))); Lisp_Object range = CAR_SAFE (CDR_SAFE (CDR_SAFE (CDR_SAFE (context)))); security_context_t con; - int fail, conlength; + bool fail; + int conlength; context_t parsed_con; #endif @@ -2912,8 +2907,9 @@ compiled with SELinux support. */) } /* Set the modified context back to the file. */ - fail = lsetfilecon (SSDATA (encoded_absname), - context_str (parsed_con)); + fail = (lsetfilecon (SSDATA (encoded_absname), + context_str (parsed_con)) + != 0); /* See http://debbugs.gnu.org/11245 for ENOTSUP. */ if (fail && errno != ENOTSUP) report_file_error ("Doing lsetfilecon", Fcons (absname, Qnil)); @@ -3004,7 +3000,7 @@ DEFUN ("default-file-modes", Fdefault_file_modes, Sdefault_file_modes, 0, 0, 0, The value is an integer. */) (void) { - int realmask; + mode_t realmask; Lisp_Object value; BLOCK_INPUT; @@ -3246,29 +3242,29 @@ variable `last-coding-system-used' to the coding system actually used. */) struct stat st; int file_status; EMACS_TIME mtime; - register int fd; + int fd; ptrdiff_t inserted = 0; - int nochange = 0; - register ptrdiff_t how_much; + bool nochange = 0; + ptrdiff_t how_much; off_t beg_offset, end_offset; - register int unprocessed; + int unprocessed; ptrdiff_t count = SPECPDL_INDEX (); struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; Lisp_Object handler, val, insval, orig_filename, old_undo; Lisp_Object p; ptrdiff_t total = 0; - int not_regular = 0; + bool not_regular = 0; int save_errno = 0; char read_buf[READ_BUF_SIZE]; struct coding_system coding; char buffer[1 << 14]; - int replace_handled = 0; - int set_coding_system = 0; + bool replace_handled = 0; + bool set_coding_system = 0; Lisp_Object coding_system; - int read_quit = 0; + bool read_quit = 0; Lisp_Object old_Vdeactivate_mark = Vdeactivate_mark; - int we_locked_file = 0; - int deferred_remove_unwind_protect = 0; + bool we_locked_file = 0; + bool deferred_remove_unwind_protect = 0; if (current_buffer->base_buffer && ! NILP (visit)) error ("Cannot do file visiting in an indirect buffer"); @@ -3569,9 +3565,9 @@ variable `last-coding-system-used' to the coding system actually used. */) ptrdiff_t same_at_end = ZV_BYTE; ptrdiff_t overlap; /* There is still a possibility we will find the need to do code - conversion. If that happens, we set this variable to 1 to + conversion. If that happens, set this variable to give up on handling REPLACE in the optimized way. */ - int giveup_match_end = 0; + bool giveup_match_end = 0; if (beg_offset != 0) { @@ -4427,8 +4423,8 @@ choose_write_coding_system (Lisp_Object start, Lisp_Object end, Lisp_Object file If it is not set locally, we anyway have to convert EOL format if the default value of `buffer-file-coding-system' tells that it is not Unix-like (LF only) format. */ - int using_default_coding = 0; - int force_raw_text = 0; + bool using_default_coding = 0; + bool force_raw_text = 0; val = BVAR (current_buffer, buffer_file_coding_system); if (NILP (val) @@ -4537,8 +4533,8 @@ This calls `write-region-annotate-functions' at the start, and `write-region-post-annotation-function' at the end. */) (Lisp_Object start, Lisp_Object end, Lisp_Object filename, Lisp_Object append, Lisp_Object visit, Lisp_Object lockname, Lisp_Object mustbenew) { - register int desc; - int failure; + int desc; + bool ok; int save_errno = 0; const char *fn; struct stat st; @@ -4548,8 +4544,8 @@ This calls `write-region-annotate-functions' at the start, and Lisp_Object visit_file; Lisp_Object annotations; Lisp_Object encoded_filename; - int visiting = (EQ (visit, Qt) || STRINGP (visit)); - int quietly = !NILP (visit); + bool visiting = (EQ (visit, Qt) || STRINGP (visit)); + bool quietly = !NILP (visit); struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5; struct buffer *given_buffer; struct coding_system coding; @@ -4713,37 +4709,27 @@ This calls `write-region-annotate-functions' at the start, and UNGCPRO; - failure = 0; immediate_quit = 1; if (STRINGP (start)) - { - failure = 0 > a_write (desc, start, 0, SCHARS (start), - &annotations, &coding); - save_errno = errno; - } + ok = a_write (desc, start, 0, SCHARS (start), &annotations, &coding); else if (XINT (start) != XINT (end)) - { - failure = 0 > a_write (desc, Qnil, - XINT (start), XINT (end) - XINT (start), - &annotations, &coding); - save_errno = errno; - } + ok = a_write (desc, Qnil, XINT (start), XINT (end) - XINT (start), + &annotations, &coding); else { - /* If file was empty, still need to write the annotations */ + /* If file was empty, still need to write the annotations. */ coding.mode |= CODING_MODE_LAST_BLOCK; - failure = 0 > a_write (desc, Qnil, XINT (end), 0, &annotations, &coding); - save_errno = errno; + ok = a_write (desc, Qnil, XINT (end), 0, &annotations, &coding); } + save_errno = errno; - if (CODING_REQUIRE_FLUSHING (&coding) - && !(coding.mode & CODING_MODE_LAST_BLOCK) - && ! failure) + if (ok && CODING_REQUIRE_FLUSHING (&coding) + && !(coding.mode & CODING_MODE_LAST_BLOCK)) { /* We have to flush out a data. */ coding.mode |= CODING_MODE_LAST_BLOCK; - failure = 0 > e_write (desc, Qnil, 1, 1, &coding); + ok = e_write (desc, Qnil, 1, 1, &coding); save_errno = errno; } @@ -4760,13 +4746,13 @@ This calls `write-region-annotate-functions' at the start, and ignore EINVAL which happens when fsync is not supported on this file. */ if (errno != EINTR && errno != EINVAL) - failure = 1, save_errno = errno; + ok = 0, save_errno = errno; } #endif /* NFS can report a write failure now. */ if (emacs_close (desc) < 0) - failure = 1, save_errno = errno; + ok = 0, save_errno = errno; stat (fn, &st); @@ -4803,7 +4789,7 @@ This calls `write-region-annotate-functions' at the start, and current_buffer->modtime_size = st.st_size; } - if (failure) + if (! ok) error ("IO error writing %s: %s", SDATA (filename), emacs_strerror (save_errno)); @@ -4859,7 +4845,8 @@ build_annotations (Lisp_Object start, Lisp_Object end) Lisp_Object p, res; struct gcpro gcpro1, gcpro2; Lisp_Object original_buffer; - int i, used_global = 0; + int i; + bool used_global = 0; XSETBUFFER (original_buffer, current_buffer); @@ -4939,11 +4926,11 @@ build_annotations (Lisp_Object start, Lisp_Object end) We modify *ANNOT by discarding elements as we use them up. - The return value is negative in case of system call failure. */ + Return true if successful. */ -static int +static bool a_write (int desc, Lisp_Object string, ptrdiff_t pos, - register ptrdiff_t nchars, Lisp_Object *annot, + ptrdiff_t nchars, Lisp_Object *annot, struct coding_system *coding) { Lisp_Object tem; @@ -4965,29 +4952,29 @@ a_write (int desc, Lisp_Object string, ptrdiff_t pos, /* Output buffer text up to the next annotation's position. */ if (nextpos > pos) { - if (0 > e_write (desc, string, pos, nextpos, coding)) - return -1; + if (!e_write (desc, string, pos, nextpos, coding)) + return 0; pos = nextpos; } /* Output the annotation. */ tem = Fcdr (Fcar (*annot)); if (STRINGP (tem)) { - if (0 > e_write (desc, tem, 0, SCHARS (tem), coding)) - return -1; + if (!e_write (desc, tem, 0, SCHARS (tem), coding)) + return 0; } *annot = Fcdr (*annot); } - return 0; + return 1; } /* Write text in the range START and END into descriptor DESC, encoding them with coding system CODING. If STRING is nil, START and END are character positions of the current buffer, else they - are indexes to the string STRING. */ + are indexes to the string STRING. Return true if successful. */ -static int +static bool e_write (int desc, Lisp_Object string, ptrdiff_t start, ptrdiff_t end, struct coding_system *coding) { @@ -5056,12 +5043,12 @@ e_write (int desc, Lisp_Object string, ptrdiff_t start, ptrdiff_t end, coding->produced); if (coding->produced) - return -1; + return 0; } start += coding->consumed_char; } - return 0; + return 1; } DEFUN ("verify-visited-file-modtime", Fverify_visited_file_modtime, @@ -5300,12 +5287,12 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */) { struct buffer *old = current_buffer, *b; Lisp_Object tail, buf, hook; - int auto_saved = 0; + bool auto_saved = 0; int do_handled_files; Lisp_Object oquit; FILE *stream = NULL; ptrdiff_t count = SPECPDL_INDEX (); - int orig_minibuffer_auto_raise = minibuffer_auto_raise; + bool orig_minibuffer_auto_raise = minibuffer_auto_raise; bool old_message_p = 0; struct gcpro gcpro1, gcpro2; @@ -5452,7 +5439,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */) if (!auto_saved && NILP (no_message)) message1 ("Auto-saving..."); internal_condition_case (auto_save_1, Qt, auto_save_error); - auto_saved++; + auto_saved = 1; BUF_AUTOSAVE_MODIFF (b) = BUF_MODIFF (b); XSETFASTINT (BVAR (current_buffer, save_length), Z - BEG); set_buffer_internal (old); diff --git a/src/filelock.c b/src/filelock.c index d21d8e7ba02..1f599c68912 100644 --- a/src/filelock.c +++ b/src/filelock.c @@ -100,10 +100,10 @@ along with GNU Emacs. If not, see . */ /* Return the time of the last system boot. */ static time_t boot_time; -static int boot_time_initialized; +static bool boot_time_initialized; #ifdef BOOT_TIME -static void get_boot_time_1 (const char *, int); +static void get_boot_time_1 (const char *, bool); #endif static time_t @@ -170,7 +170,7 @@ get_boot_time (void) { char cmd_string[sizeof WTMP_FILE ".19.gz"]; Lisp_Object tempname, filename; - int delete_flag = 0; + bool delete_flag = 0; filename = Qnil; @@ -225,13 +225,13 @@ get_boot_time (void) If FILENAME is zero, use the same file as before; if no FILENAME has ever been specified, this is the utmp file. - Use the newest reboot record if NEWEST is nonzero, + Use the newest reboot record if NEWEST, the first reboot record otherwise. Ignore all reboot records on or before BOOT_TIME. Success is indicated by setting BOOT_TIME to a larger value. */ void -get_boot_time_1 (const char *filename, int newest) +get_boot_time_1 (const char *filename, bool newest) { struct utmp ut, *utp; int desc; @@ -331,11 +331,11 @@ fill_in_lock_file_name (register char *lockfile, register Lisp_Object fn) } /* Lock the lock file named LFNAME. - If FORCE is nonzero, we do so even if it is already locked. - Return 1 if successful, 0 if not. */ + If FORCE, do so even if it is already locked. + Return true if successful. */ -static int -lock_file_1 (char *lfname, int force) +static bool +lock_file_1 (char *lfname, bool force) { int err; int symlink_errno; @@ -370,9 +370,9 @@ lock_file_1 (char *lfname, int force) return err == 0; } -/* Return 1 if times A and B are no more than one second apart. */ +/* Return true if times A and B are no more than one second apart. */ -static int +static bool within_one_second (time_t a, time_t b) { return (a - b >= -1 && a - b <= 1); @@ -491,7 +491,7 @@ current_lock_owner (lock_info_type *owner, char *lfname) static int lock_if_free (lock_info_type *clasher, register char *lfname) { - while (lock_file_1 (lfname, 0) == 0) + while (! lock_file_1 (lfname, 0)) { int locker; diff --git a/src/floatfns.c b/src/floatfns.c index cad071f1e15..8a9a9fd0886 100644 --- a/src/floatfns.c +++ b/src/floatfns.c @@ -22,47 +22,23 @@ You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . */ -/* ANSI C requires only these float functions: +/* C89 requires only these math.h functions: acos, asin, atan, atan2, ceil, cos, cosh, exp, fabs, floor, fmod, frexp, ldexp, log, log10, modf, pow, sin, sinh, sqrt, tan, tanh. - - Define HAVE_INVERSE_HYPERBOLIC if you have acosh, asinh, and atanh. - Define HAVE_CBRT if you have cbrt. - Define HAVE_RINT if you have a working rint. - If you don't define these, then the appropriate routines will be simulated. - - Define HAVE_MATHERR if on a system supporting the SysV matherr callback. - (This should happen automatically.) - - Define FLOAT_CHECK_ERRNO if the float library routines set errno. - This has no effect if HAVE_MATHERR is defined. - - Define FLOAT_CATCH_SIGILL if the float library routines signal SIGILL. - (What systems actually do this? Please let us know.) - - Define FLOAT_CHECK_DOMAIN if the float library doesn't handle errors by - either setting errno, or signaling SIGFPE/SIGILL. Otherwise, domain and - range checking will happen before calling the float routines. This has - no effect if HAVE_MATHERR is defined (since matherr will be called when - a domain error occurs.) */ #include -#include #include #include "lisp.h" #include "syssignal.h" #include -/* If IEEE_FLOATING_POINT isn't defined, default it from FLT_*. */ -#ifndef IEEE_FLOATING_POINT #if (FLT_RADIX == 2 && FLT_MANT_DIG == 24 \ && FLT_MIN_EXP == -125 && FLT_MAX_EXP == 128) #define IEEE_FLOATING_POINT 1 #else #define IEEE_FLOATING_POINT 0 #endif -#endif #include @@ -71,124 +47,6 @@ along with GNU Emacs. If not, see . */ extern double logb (double); #endif /* not HPUX and HAVE_LOGB and no logb macro */ -#if defined (DOMAIN) && defined (SING) && defined (OVERFLOW) - /* If those are defined, then this is probably a `matherr' machine. */ -# ifndef HAVE_MATHERR -# define HAVE_MATHERR -# endif -#endif - -#ifdef NO_MATHERR -#undef HAVE_MATHERR -#endif - -#ifdef HAVE_MATHERR -# ifdef FLOAT_CHECK_ERRNO -# undef FLOAT_CHECK_ERRNO -# endif -# ifdef FLOAT_CHECK_DOMAIN -# undef FLOAT_CHECK_DOMAIN -# endif -#endif - -#ifndef NO_FLOAT_CHECK_ERRNO -#define FLOAT_CHECK_ERRNO -#endif - -#ifdef FLOAT_CHECK_ERRNO -# include -#endif - -#ifdef FLOAT_CATCH_SIGILL -static void float_error (); -#endif - -/* Nonzero while executing in floating point. - This tells float_error what to do. */ - -static int in_float; - -/* If an argument is out of range for a mathematical function, - here is the actual argument value to use in the error message. - These variables are used only across the floating point library call - so there is no need to staticpro them. */ - -static Lisp_Object float_error_arg, float_error_arg2; - -static const char *float_error_fn_name; - -/* Evaluate the floating point expression D, recording NUM - as the original argument for error messages. - D is normally an assignment expression. - Handle errors which may result in signals or may set errno. - - Note that float_error may be declared to return void, so you can't - just cast the zero after the colon to (void) to make the types - check properly. */ - -#ifdef FLOAT_CHECK_ERRNO -#define IN_FLOAT(d, name, num) \ - do { \ - float_error_arg = num; \ - float_error_fn_name = name; \ - in_float = 1; errno = 0; (d); in_float = 0; \ - switch (errno) { \ - case 0: break; \ - case EDOM: domain_error (float_error_fn_name, float_error_arg); \ - case ERANGE: range_error (float_error_fn_name, float_error_arg); \ - default: arith_error (float_error_fn_name, float_error_arg); \ - } \ - } while (0) -#define IN_FLOAT2(d, name, num, num2) \ - do { \ - float_error_arg = num; \ - float_error_arg2 = num2; \ - float_error_fn_name = name; \ - in_float = 1; errno = 0; (d); in_float = 0; \ - switch (errno) { \ - case 0: break; \ - case EDOM: domain_error (float_error_fn_name, float_error_arg); \ - case ERANGE: range_error (float_error_fn_name, float_error_arg); \ - default: arith_error (float_error_fn_name, float_error_arg); \ - } \ - } while (0) -#else -#define IN_FLOAT(d, name, num) (in_float = 1, (d), in_float = 0) -#define IN_FLOAT2(d, name, num, num2) (in_float = 1, (d), in_float = 0) -#endif - -/* Convert float to Lisp_Int if it fits, else signal a range error - using the given arguments. */ -#define FLOAT_TO_INT(x, i, name, num) \ - do \ - { \ - if (FIXNUM_OVERFLOW_P (x)) \ - range_error (name, num); \ - XSETINT (i, (EMACS_INT)(x)); \ - } \ - while (0) -#define FLOAT_TO_INT2(x, i, name, num1, num2) \ - do \ - { \ - if (FIXNUM_OVERFLOW_P (x)) \ - range_error2 (name, num1, num2); \ - XSETINT (i, (EMACS_INT)(x)); \ - } \ - while (0) - -#define arith_error(op,arg) \ - xsignal2 (Qarith_error, build_string ((op)), (arg)) -#define range_error(op,arg) \ - xsignal2 (Qrange_error, build_string ((op)), (arg)) -#define range_error2(op,a1,a2) \ - xsignal3 (Qrange_error, build_string ((op)), (a1), (a2)) -#define domain_error(op,arg) \ - xsignal2 (Qdomain_error, build_string ((op)), (arg)) -#ifdef FLOAT_CHECK_DOMAIN -#define domain_error2(op,a1,a2) \ - xsignal3 (Qdomain_error, build_string ((op)), (a1), (a2)) -#endif - /* Extract a Lisp number as a `double', or signal an error. */ double @@ -205,27 +63,19 @@ extract_float (Lisp_Object num) DEFUN ("acos", Facos, Sacos, 1, 1, 0, doc: /* Return the inverse cosine of ARG. */) - (register Lisp_Object arg) + (Lisp_Object arg) { double d = extract_float (arg); -#ifdef FLOAT_CHECK_DOMAIN - if (d > 1.0 || d < -1.0) - domain_error ("acos", arg); -#endif - IN_FLOAT (d = acos (d), "acos", arg); + d = acos (d); return make_float (d); } DEFUN ("asin", Fasin, Sasin, 1, 1, 0, doc: /* Return the inverse sine of ARG. */) - (register Lisp_Object arg) + (Lisp_Object arg) { double d = extract_float (arg); -#ifdef FLOAT_CHECK_DOMAIN - if (d > 1.0 || d < -1.0) - domain_error ("asin", arg); -#endif - IN_FLOAT (d = asin (d), "asin", arg); + d = asin (d); return make_float (d); } @@ -235,50 +85,44 @@ If only one argument Y is given, return the inverse tangent of Y. If two arguments Y and X are given, return the inverse tangent of Y divided by X, i.e. the angle in radians between the vector (X, Y) and the x-axis. */) - (register Lisp_Object y, Lisp_Object x) + (Lisp_Object y, Lisp_Object x) { double d = extract_float (y); if (NILP (x)) - IN_FLOAT (d = atan (d), "atan", y); + d = atan (d); else { double d2 = extract_float (x); - - IN_FLOAT2 (d = atan2 (d, d2), "atan", y, x); + d = atan2 (d, d2); } return make_float (d); } DEFUN ("cos", Fcos, Scos, 1, 1, 0, doc: /* Return the cosine of ARG. */) - (register Lisp_Object arg) + (Lisp_Object arg) { double d = extract_float (arg); - IN_FLOAT (d = cos (d), "cos", arg); + d = cos (d); return make_float (d); } DEFUN ("sin", Fsin, Ssin, 1, 1, 0, doc: /* Return the sine of ARG. */) - (register Lisp_Object arg) + (Lisp_Object arg) { double d = extract_float (arg); - IN_FLOAT (d = sin (d), "sin", arg); + d = sin (d); return make_float (d); } DEFUN ("tan", Ftan, Stan, 1, 1, 0, doc: /* Return the tangent of ARG. */) - (register Lisp_Object arg) + (Lisp_Object arg) { double d = extract_float (arg); - double c = cos (d); -#ifdef FLOAT_CHECK_DOMAIN - if (c == 0.0) - domain_error ("tan", arg); -#endif - IN_FLOAT (d = sin (d) / c, "tan", arg); + d = tan (d); return make_float (d); } @@ -349,61 +193,61 @@ Returns the floating point value resulting from multiplying SGNFCAND DEFUN ("bessel-j0", Fbessel_j0, Sbessel_j0, 1, 1, 0, doc: /* Return the bessel function j0 of ARG. */) - (register Lisp_Object arg) + (Lisp_Object arg) { double d = extract_float (arg); - IN_FLOAT (d = j0 (d), "bessel-j0", arg); + d = j0 (d); return make_float (d); } DEFUN ("bessel-j1", Fbessel_j1, Sbessel_j1, 1, 1, 0, doc: /* Return the bessel function j1 of ARG. */) - (register Lisp_Object arg) + (Lisp_Object arg) { double d = extract_float (arg); - IN_FLOAT (d = j1 (d), "bessel-j1", arg); + d = j1 (d); return make_float (d); } DEFUN ("bessel-jn", Fbessel_jn, Sbessel_jn, 2, 2, 0, doc: /* Return the order N bessel function output jn of ARG. The first arg (the order) is truncated to an integer. */) - (register Lisp_Object n, Lisp_Object arg) + (Lisp_Object n, Lisp_Object arg) { int i1 = extract_float (n); double f2 = extract_float (arg); - IN_FLOAT (f2 = jn (i1, f2), "bessel-jn", n); + f2 = jn (i1, f2); return make_float (f2); } DEFUN ("bessel-y0", Fbessel_y0, Sbessel_y0, 1, 1, 0, doc: /* Return the bessel function y0 of ARG. */) - (register Lisp_Object arg) + (Lisp_Object arg) { double d = extract_float (arg); - IN_FLOAT (d = y0 (d), "bessel-y0", arg); + d = y0 (d); return make_float (d); } DEFUN ("bessel-y1", Fbessel_y1, Sbessel_y1, 1, 1, 0, doc: /* Return the bessel function y1 of ARG. */) - (register Lisp_Object arg) + (Lisp_Object arg) { double d = extract_float (arg); - IN_FLOAT (d = y1 (d), "bessel-y0", arg); + d = y1 (d); return make_float (d); } DEFUN ("bessel-yn", Fbessel_yn, Sbessel_yn, 2, 2, 0, doc: /* Return the order N bessel function output yn of ARG. The first arg (the order) is truncated to an integer. */) - (register Lisp_Object n, Lisp_Object arg) + (Lisp_Object n, Lisp_Object arg) { int i1 = extract_float (n); double f2 = extract_float (arg); - IN_FLOAT (f2 = yn (i1, f2), "bessel-yn", n); + f2 = yn (i1, f2); return make_float (f2); } @@ -413,43 +257,43 @@ The first arg (the order) is truncated to an integer. */) DEFUN ("erf", Ferf, Serf, 1, 1, 0, doc: /* Return the mathematical error function of ARG. */) - (register Lisp_Object arg) + (Lisp_Object arg) { double d = extract_float (arg); - IN_FLOAT (d = erf (d), "erf", arg); + d = erf (d); return make_float (d); } DEFUN ("erfc", Ferfc, Serfc, 1, 1, 0, doc: /* Return the complementary error function of ARG. */) - (register Lisp_Object arg) + (Lisp_Object arg) { double d = extract_float (arg); - IN_FLOAT (d = erfc (d), "erfc", arg); + d = erfc (d); return make_float (d); } DEFUN ("log-gamma", Flog_gamma, Slog_gamma, 1, 1, 0, doc: /* Return the log gamma of ARG. */) - (register Lisp_Object arg) + (Lisp_Object arg) { double d = extract_float (arg); - IN_FLOAT (d = lgamma (d), "log-gamma", arg); + d = lgamma (d); return make_float (d); } DEFUN ("cube-root", Fcube_root, Scube_root, 1, 1, 0, doc: /* Return the cube root of ARG. */) - (register Lisp_Object arg) + (Lisp_Object arg) { double d = extract_float (arg); #ifdef HAVE_CBRT - IN_FLOAT (d = cbrt (d), "cube-root", arg); + d = cbrt (d); #else if (d >= 0.0) - IN_FLOAT (d = pow (d, 1.0/3.0), "cube-root", arg); + d = pow (d, 1.0/3.0); else - IN_FLOAT (d = -pow (-d, 1.0/3.0), "cube-root", arg); + d = -pow (-d, 1.0/3.0); #endif return make_float (d); } @@ -458,23 +302,16 @@ DEFUN ("cube-root", Fcube_root, Scube_root, 1, 1, 0, DEFUN ("exp", Fexp, Sexp, 1, 1, 0, doc: /* Return the exponential base e of ARG. */) - (register Lisp_Object arg) + (Lisp_Object arg) { double d = extract_float (arg); -#ifdef FLOAT_CHECK_DOMAIN - if (d > 709.7827) /* Assume IEEE doubles here */ - range_error ("exp", arg); - else if (d < -709.0) - return make_float (0.0); - else -#endif - IN_FLOAT (d = exp (d), "exp", arg); + d = exp (d); return make_float (d); } DEFUN ("expt", Fexpt, Sexpt, 2, 2, 0, doc: /* Return the exponential ARG1 ** ARG2. */) - (register Lisp_Object arg1, Lisp_Object arg2) + (Lisp_Object arg1, Lisp_Object arg2) { double f1, f2, f3; @@ -503,72 +340,46 @@ DEFUN ("expt", Fexpt, Sexpt, 2, 2, 0, } f1 = FLOATP (arg1) ? XFLOAT_DATA (arg1) : XINT (arg1); f2 = FLOATP (arg2) ? XFLOAT_DATA (arg2) : XINT (arg2); - /* Really should check for overflow, too */ - if (f1 == 0.0 && f2 == 0.0) - f1 = 1.0; -#ifdef FLOAT_CHECK_DOMAIN - else if ((f1 == 0.0 && f2 < 0.0) || (f1 < 0 && f2 != floor (f2))) - domain_error2 ("expt", arg1, arg2); -#endif - IN_FLOAT2 (f3 = pow (f1, f2), "expt", arg1, arg2); - /* Check for overflow in the result. */ - if (f1 != 0.0 && f3 == 0.0) - range_error ("expt", arg1); + f3 = pow (f1, f2); return make_float (f3); } DEFUN ("log", Flog, Slog, 1, 2, 0, doc: /* Return the natural logarithm of ARG. If the optional argument BASE is given, return log ARG using that base. */) - (register Lisp_Object arg, Lisp_Object base) + (Lisp_Object arg, Lisp_Object base) { double d = extract_float (arg); -#ifdef FLOAT_CHECK_DOMAIN - if (d <= 0.0) - domain_error2 ("log", arg, base); -#endif if (NILP (base)) - IN_FLOAT (d = log (d), "log", arg); + d = log (d); else { double b = extract_float (base); -#ifdef FLOAT_CHECK_DOMAIN - if (b <= 0.0 || b == 1.0) - domain_error2 ("log", arg, base); -#endif if (b == 10.0) - IN_FLOAT2 (d = log10 (d), "log", arg, base); + d = log10 (d); else - IN_FLOAT2 (d = log (d) / log (b), "log", arg, base); + d = log (d) / log (b); } return make_float (d); } DEFUN ("log10", Flog10, Slog10, 1, 1, 0, doc: /* Return the logarithm base 10 of ARG. */) - (register Lisp_Object arg) + (Lisp_Object arg) { double d = extract_float (arg); -#ifdef FLOAT_CHECK_DOMAIN - if (d <= 0.0) - domain_error ("log10", arg); -#endif - IN_FLOAT (d = log10 (d), "log10", arg); + d = log10 (d); return make_float (d); } DEFUN ("sqrt", Fsqrt, Ssqrt, 1, 1, 0, doc: /* Return the square root of ARG. */) - (register Lisp_Object arg) + (Lisp_Object arg) { double d = extract_float (arg); -#ifdef FLOAT_CHECK_DOMAIN - if (d < 0.0) - domain_error ("sqrt", arg); -#endif - IN_FLOAT (d = sqrt (d), "sqrt", arg); + d = sqrt (d); return make_float (d); } @@ -576,83 +387,55 @@ DEFUN ("sqrt", Fsqrt, Ssqrt, 1, 1, 0, DEFUN ("acosh", Facosh, Sacosh, 1, 1, 0, doc: /* Return the inverse hyperbolic cosine of ARG. */) - (register Lisp_Object arg) + (Lisp_Object arg) { double d = extract_float (arg); -#ifdef FLOAT_CHECK_DOMAIN - if (d < 1.0) - domain_error ("acosh", arg); -#endif -#ifdef HAVE_INVERSE_HYPERBOLIC - IN_FLOAT (d = acosh (d), "acosh", arg); -#else - IN_FLOAT (d = log (d + sqrt (d*d - 1.0)), "acosh", arg); -#endif + d = acosh (d); return make_float (d); } DEFUN ("asinh", Fasinh, Sasinh, 1, 1, 0, doc: /* Return the inverse hyperbolic sine of ARG. */) - (register Lisp_Object arg) + (Lisp_Object arg) { double d = extract_float (arg); -#ifdef HAVE_INVERSE_HYPERBOLIC - IN_FLOAT (d = asinh (d), "asinh", arg); -#else - IN_FLOAT (d = log (d + sqrt (d*d + 1.0)), "asinh", arg); -#endif + d = asinh (d); return make_float (d); } DEFUN ("atanh", Fatanh, Satanh, 1, 1, 0, doc: /* Return the inverse hyperbolic tangent of ARG. */) - (register Lisp_Object arg) + (Lisp_Object arg) { double d = extract_float (arg); -#ifdef FLOAT_CHECK_DOMAIN - if (d >= 1.0 || d <= -1.0) - domain_error ("atanh", arg); -#endif -#ifdef HAVE_INVERSE_HYPERBOLIC - IN_FLOAT (d = atanh (d), "atanh", arg); -#else - IN_FLOAT (d = 0.5 * log ((1.0 + d) / (1.0 - d)), "atanh", arg); -#endif + d = atanh (d); return make_float (d); } DEFUN ("cosh", Fcosh, Scosh, 1, 1, 0, doc: /* Return the hyperbolic cosine of ARG. */) - (register Lisp_Object arg) + (Lisp_Object arg) { double d = extract_float (arg); -#ifdef FLOAT_CHECK_DOMAIN - if (d > 710.0 || d < -710.0) - range_error ("cosh", arg); -#endif - IN_FLOAT (d = cosh (d), "cosh", arg); + d = cosh (d); return make_float (d); } DEFUN ("sinh", Fsinh, Ssinh, 1, 1, 0, doc: /* Return the hyperbolic sine of ARG. */) - (register Lisp_Object arg) + (Lisp_Object arg) { double d = extract_float (arg); -#ifdef FLOAT_CHECK_DOMAIN - if (d > 710.0 || d < -710.0) - range_error ("sinh", arg); -#endif - IN_FLOAT (d = sinh (d), "sinh", arg); + d = sinh (d); return make_float (d); } DEFUN ("tanh", Ftanh, Stanh, 1, 1, 0, doc: /* Return the hyperbolic tangent of ARG. */) - (register Lisp_Object arg) + (Lisp_Object arg) { double d = extract_float (arg); - IN_FLOAT (d = tanh (d), "tanh", arg); + d = tanh (d); return make_float (d); } #endif @@ -697,33 +480,11 @@ This is the same as the exponent of a float. */) else { #ifdef HAVE_LOGB - IN_FLOAT (value = logb (f), "logb", arg); + value = logb (f); #else -#ifdef HAVE_FREXP int ivalue; - IN_FLOAT (frexp (f, &ivalue), "logb", arg); + frexp (f, &ivalue); value = ivalue - 1; -#else - int i; - double d; - if (f < 0.0) - f = -f; - value = -1; - while (f < 0.5) - { - for (i = 1, d = 0.5; d * d >= f; i += i) - d *= d; - f /= d; - value -= i; - } - while (f >= 1.0) - { - for (i = 1, d = 2.0; d * d <= f; i += i) - d *= d; - f /= d; - value += i; - } -#endif #endif } XSETINT (val, value); @@ -756,8 +517,10 @@ rounding_driver (Lisp_Object arg, Lisp_Object divisor, if (! IEEE_FLOATING_POINT && f2 == 0) xsignal0 (Qarith_error); - IN_FLOAT2 (f1 = (*double_round) (f1 / f2), name, arg, divisor); - FLOAT_TO_INT2 (f1, arg, name, arg, divisor); + f1 = (*double_round) (f1 / f2); + if (FIXNUM_OVERFLOW_P (f1)) + xsignal3 (Qrange_error, build_string (name), arg, divisor); + arg = make_number (f1); return arg; } @@ -773,10 +536,10 @@ rounding_driver (Lisp_Object arg, Lisp_Object divisor, if (FLOATP (arg)) { - double d; - - IN_FLOAT (d = (*double_round) (XFLOAT_DATA (arg)), name, arg); - FLOAT_TO_INT (d, arg, name, arg); + double d = (*double_round) (XFLOAT_DATA (arg)); + if (FIXNUM_OVERFLOW_P (d)) + xsignal2 (Qrange_error, build_string (name), arg); + arg = make_number (d); } return arg; @@ -893,125 +656,57 @@ fmod_float (Lisp_Object x, Lisp_Object y) f1 = FLOATP (x) ? XFLOAT_DATA (x) : XINT (x); f2 = FLOATP (y) ? XFLOAT_DATA (y) : XINT (y); - if (! IEEE_FLOATING_POINT && f2 == 0) - xsignal0 (Qarith_error); + f1 = fmod (f1, f2); /* If the "remainder" comes out with the wrong sign, fix it. */ - IN_FLOAT2 ((f1 = fmod (f1, f2), - f1 = (f2 < 0 ? f1 > 0 : f1 < 0) ? f1 + f2 : f1), - "mod", x, y); + if (f2 < 0 ? 0 < f1 : f1 < 0) + f1 += f2; + return make_float (f1); } -/* It's not clear these are worth adding. */ - DEFUN ("fceiling", Ffceiling, Sfceiling, 1, 1, 0, doc: /* Return the smallest integer no less than ARG, as a float. \(Round toward +inf.\) */) - (register Lisp_Object arg) + (Lisp_Object arg) { double d = extract_float (arg); - IN_FLOAT (d = ceil (d), "fceiling", arg); + d = ceil (d); return make_float (d); } DEFUN ("ffloor", Fffloor, Sffloor, 1, 1, 0, doc: /* Return the largest integer no greater than ARG, as a float. \(Round towards -inf.\) */) - (register Lisp_Object arg) + (Lisp_Object arg) { double d = extract_float (arg); - IN_FLOAT (d = floor (d), "ffloor", arg); + d = floor (d); return make_float (d); } DEFUN ("fround", Ffround, Sfround, 1, 1, 0, doc: /* Return the nearest integer to ARG, as a float. */) - (register Lisp_Object arg) + (Lisp_Object arg) { double d = extract_float (arg); - IN_FLOAT (d = emacs_rint (d), "fround", arg); + d = emacs_rint (d); return make_float (d); } DEFUN ("ftruncate", Fftruncate, Sftruncate, 1, 1, 0, doc: /* Truncate a floating point number to an integral float value. Rounds the value toward zero. */) - (register Lisp_Object arg) + (Lisp_Object arg) { double d = extract_float (arg); if (d >= 0.0) - IN_FLOAT (d = floor (d), "ftruncate", arg); + d = floor (d); else - IN_FLOAT (d = ceil (d), "ftruncate", arg); + d = ceil (d); return make_float (d); } -#ifdef FLOAT_CATCH_SIGILL -static void -float_error (int signo) -{ - if (! in_float) - fatal_error_signal (signo); - -#ifdef BSD_SYSTEM - sigsetmask (SIGEMPTYMASK); -#else - /* Must reestablish handler each time it is called. */ - signal (SIGILL, float_error); -#endif /* BSD_SYSTEM */ - - SIGNAL_THREAD_CHECK (signo); - in_float = 0; - - xsignal1 (Qarith_error, float_error_arg); -} - -/* Another idea was to replace the library function `infnan' - where SIGILL is signaled. */ - -#endif /* FLOAT_CATCH_SIGILL */ - -#ifdef HAVE_MATHERR -int -matherr (struct exception *x) -{ - Lisp_Object args; - const char *name = x->name; - - if (! in_float) - /* Not called from emacs-lisp float routines; do the default thing. */ - return 0; - if (!strcmp (x->name, "pow")) - name = "expt"; - - args - = Fcons (build_string (name), - Fcons (make_float (x->arg1), - ((!strcmp (name, "log") || !strcmp (name, "pow")) - ? Fcons (make_float (x->arg2), Qnil) - : Qnil))); - switch (x->type) - { - case DOMAIN: xsignal (Qdomain_error, args); break; - case SING: xsignal (Qsingularity_error, args); break; - case OVERFLOW: xsignal (Qoverflow_error, args); break; - case UNDERFLOW: xsignal (Qunderflow_error, args); break; - default: xsignal (Qarith_error, args); break; - } - return (1); /* don't set errno or print a message */ -} -#endif /* HAVE_MATHERR */ - -void -init_floatfns (void) -{ -#ifdef FLOAT_CATCH_SIGILL - signal (SIGILL, float_error); -#endif - in_float = 0; -} - void syms_of_floatfns (void) { diff --git a/src/fns.c b/src/fns.c index 4d82e4e6e1d..95450c5e911 100644 --- a/src/fns.c +++ b/src/fns.c @@ -51,7 +51,7 @@ static Lisp_Object Qcodeset, Qdays, Qmonths, Qpaper; static Lisp_Object Qmd5, Qsha1, Qsha224, Qsha256, Qsha384, Qsha512; -static int internal_equal (Lisp_Object , Lisp_Object, int, int); +static bool internal_equal (Lisp_Object, Lisp_Object, int, bool); DEFUN ("identity", Fidentity, Sidentity, 1, 1, 0, doc: /* Return the argument unchanged. */) @@ -352,7 +352,7 @@ Symbols are also allowed; their print names are used instead. */) } static Lisp_Object concat (ptrdiff_t nargs, Lisp_Object *args, - enum Lisp_Type target_type, int last_special); + enum Lisp_Type target_type, bool last_special); /* ARGSUSED */ Lisp_Object @@ -450,19 +450,19 @@ struct textprop_rec static Lisp_Object concat (ptrdiff_t nargs, Lisp_Object *args, - enum Lisp_Type target_type, int last_special) + enum Lisp_Type target_type, bool last_special) { Lisp_Object val; - register Lisp_Object tail; - register Lisp_Object this; + Lisp_Object tail; + Lisp_Object this; ptrdiff_t toindex; ptrdiff_t toindex_byte = 0; - register EMACS_INT result_len; - register EMACS_INT result_len_byte; + EMACS_INT result_len; + EMACS_INT result_len_byte; ptrdiff_t argnum; Lisp_Object last_tail; Lisp_Object prev; - int some_multibyte; + bool some_multibyte; /* When we make a multibyte string, we can't copy text properties while concatenating each string because the length of resulting string can't be decided until we finish the whole concatenation. @@ -1527,11 +1527,14 @@ The value is actually the first element of LIST whose cdr equals KEY. */) } DEFUN ("delq", Fdelq, Sdelq, 2, 2, 0, - doc: /* Delete by side effect any occurrences of ELT as a member of LIST. -The modified LIST is returned. Comparison is done with `eq'. -If the first member of LIST is ELT, there is no way to remove it by side effect; -therefore, write `(setq foo (delq element foo))' -to be sure of changing the value of `foo'. */) + doc: /* Delete members of LIST which are `eq' to ELT, and return the result. +More precisely, this function skips any members `eq' to ELT at the +front of LIST, then removes members `eq' to ELT from the remaining +sublist by modifying its list structure, then returns the resulting +list. + +Write `(setq foo (delq element foo))' to be sure of correctly changing +the value of a list `foo'. */) (register Lisp_Object elt, Lisp_Object list) { register Lisp_Object tail, prev; @@ -1559,13 +1562,19 @@ to be sure of changing the value of `foo'. */) } DEFUN ("delete", Fdelete, Sdelete, 2, 2, 0, - doc: /* Delete by side effect any occurrences of ELT as a member of SEQ. -SEQ must be a list, a vector, or a string. -The modified SEQ is returned. Comparison is done with `equal'. -If SEQ is not a list, or the first member of SEQ is ELT, deleting it -is not a side effect; it is simply using a different sequence. -Therefore, write `(setq foo (delete element foo))' -to be sure of changing the value of `foo'. */) + doc: /* Delete members of SEQ which are `equal' to ELT, and return the result. +SEQ must be a sequence (i.e. a list, a vector, or a string). +The return value is a sequence of the same type. + +If SEQ is a list, this behaves like `delq', except that it compares +with `equal' instead of `eq'. In particular, it may remove elements +by altering the list structure. + +If SEQ is not a list, deletion is never performed destructively; +instead this function creates and returns a new vector or string. + +Write `(setq foo (delete element foo))' to be sure of correctly +changing the value of a sequence `foo'. */) (Lisp_Object elt, Lisp_Object seq) { if (VECTORP (seq)) @@ -1988,10 +1997,10 @@ of strings. (`equal' ignores text properties.) */) /* DEPTH is current depth of recursion. Signal an error if it gets too deep. - PROPS, if non-nil, means compare string text properties too. */ + PROPS means compare string text properties too. */ -static int -internal_equal (register Lisp_Object o1, register Lisp_Object o2, int depth, int props) +static bool +internal_equal (Lisp_Object o1, Lisp_Object o2, int depth, bool props) { if (depth > 200) error ("Stack overflow in equal"); @@ -2589,9 +2598,9 @@ Normally the return value is FEATURE. The normal messages at start and end of loading FILENAME are suppressed. */) (Lisp_Object feature, Lisp_Object filename, Lisp_Object noerror) { - register Lisp_Object tem; + Lisp_Object tem; struct gcpro gcpro1, gcpro2; - int from_file = load_in_progress; + bool from_file = load_in_progress; CHECK_SYMBOL (feature); @@ -2917,8 +2926,8 @@ static const short base64_char_to_value[128] = base64 characters. */ -static ptrdiff_t base64_encode_1 (const char *, char *, ptrdiff_t, int, int); -static ptrdiff_t base64_decode_1 (const char *, char *, ptrdiff_t, int, +static ptrdiff_t base64_encode_1 (const char *, char *, ptrdiff_t, bool, bool); +static ptrdiff_t base64_decode_1 (const char *, char *, ptrdiff_t, bool, ptrdiff_t *); DEFUN ("base64-encode-region", Fbase64_encode_region, Sbase64_encode_region, @@ -2953,7 +2962,7 @@ into shorter lines. */) encoded, length, NILP (no_line_break), !NILP (BVAR (current_buffer, enable_multibyte_characters))); if (encoded_length > allength) - abort (); + emacs_abort (); if (encoded_length < 0) { @@ -3009,7 +3018,7 @@ into shorter lines. */) encoded, length, NILP (no_line_break), STRING_MULTIBYTE (string)); if (encoded_length > allength) - abort (); + emacs_abort (); if (encoded_length < 0) { @@ -3026,7 +3035,7 @@ into shorter lines. */) static ptrdiff_t base64_encode_1 (const char *from, char *to, ptrdiff_t length, - int line_break, int multibyte) + bool line_break, bool multibyte) { int counter = 0; ptrdiff_t i = 0; @@ -3133,7 +3142,7 @@ If the region can't be decoded, signal an error and don't modify the buffer. */ ptrdiff_t old_pos = PT; ptrdiff_t decoded_length; ptrdiff_t inserted_chars; - int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); + bool multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); USE_SAFE_ALLOCA; validate_region (&beg, &end); @@ -3154,7 +3163,7 @@ If the region can't be decoded, signal an error and don't modify the buffer. */ decoded, length, multibyte, &inserted_chars); if (decoded_length > allength) - abort (); + emacs_abort (); if (decoded_length < 0) { @@ -3204,7 +3213,7 @@ DEFUN ("base64-decode-string", Fbase64_decode_string, Sbase64_decode_string, decoded_length = base64_decode_1 (SSDATA (string), decoded, length, 0, NULL); if (decoded_length > length) - abort (); + emacs_abort (); else if (decoded_length >= 0) decoded_string = make_unibyte_string (decoded, decoded_length); else @@ -3218,13 +3227,13 @@ DEFUN ("base64-decode-string", Fbase64_decode_string, Sbase64_decode_string, } /* Base64-decode the data at FROM of LENGTH bytes into TO. If - MULTIBYTE is nonzero, the decoded result should be in multibyte + MULTIBYTE, the decoded result should be in multibyte form. If NCHARS_RETURN is not NULL, store the number of produced characters in *NCHARS_RETURN. */ static ptrdiff_t base64_decode_1 (const char *from, char *to, ptrdiff_t length, - int multibyte, ptrdiff_t *nchars_return) + bool multibyte, ptrdiff_t *nchars_return) { ptrdiff_t i = 0; /* Used inside READ_QUADRUPLET_BYTE */ char *e = to; @@ -3340,7 +3349,7 @@ static Lisp_Object Qhash_table_test, Qkey_or_value, Qkey_and_value; static struct Lisp_Hash_Table *check_hash_table (Lisp_Object); static ptrdiff_t get_key_arg (Lisp_Object, ptrdiff_t, Lisp_Object *, char *); static void maybe_resize_hash_table (struct Lisp_Hash_Table *); -static int sweep_weak_table (struct Lisp_Hash_Table *, int); +static bool sweep_weak_table (struct Lisp_Hash_Table *, bool); @@ -3432,10 +3441,10 @@ larger_vector (Lisp_Object vec, ptrdiff_t incr_min, ptrdiff_t nitems_max) ***********************************************************************/ /* Compare KEY1 which has hash code HASH1 and KEY2 with hash code - HASH2 in hash table H using `eql'. Value is non-zero if KEY1 and + HASH2 in hash table H using `eql'. Value is true if KEY1 and KEY2 are the same. */ -static int +static bool cmpfn_eql (struct Lisp_Hash_Table *h, Lisp_Object key1, EMACS_UINT hash1, Lisp_Object key2, EMACS_UINT hash2) @@ -3447,10 +3456,10 @@ cmpfn_eql (struct Lisp_Hash_Table *h, /* Compare KEY1 which has hash code HASH1 and KEY2 with hash code - HASH2 in hash table H using `equal'. Value is non-zero if KEY1 and + HASH2 in hash table H using `equal'. Value is true if KEY1 and KEY2 are the same. */ -static int +static bool cmpfn_equal (struct Lisp_Hash_Table *h, Lisp_Object key1, EMACS_UINT hash1, Lisp_Object key2, EMACS_UINT hash2) @@ -3460,10 +3469,10 @@ cmpfn_equal (struct Lisp_Hash_Table *h, /* Compare KEY1 which has hash code HASH1, and KEY2 with hash code - HASH2 in hash table H using H->user_cmp_function. Value is non-zero + HASH2 in hash table H using H->user_cmp_function. Value is true if KEY1 and KEY2 are the same. */ -static int +static bool cmpfn_user_defined (struct Lisp_Hash_Table *h, Lisp_Object key1, EMACS_UINT hash1, Lisp_Object key2, EMACS_UINT hash2) @@ -3923,16 +3932,16 @@ hash_clear (struct Lisp_Hash_Table *h) Weak Hash Tables ************************************************************************/ -/* Sweep weak hash table H. REMOVE_ENTRIES_P non-zero means remove +/* Sweep weak hash table H. REMOVE_ENTRIES_P means remove entries from the table that don't survive the current GC. - REMOVE_ENTRIES_P zero means mark entries that are in use. Value is - non-zero if anything was marked. */ + !REMOVE_ENTRIES_P means mark entries that are in use. Value is + true if anything was marked. */ -static int -sweep_weak_table (struct Lisp_Hash_Table *h, int remove_entries_p) +static bool +sweep_weak_table (struct Lisp_Hash_Table *h, bool remove_entries_p) { ptrdiff_t bucket, n; - int marked; + bool marked; n = ASIZE (h->index) & ~ARRAY_MARK_FLAG; marked = 0; @@ -3949,7 +3958,7 @@ sweep_weak_table (struct Lisp_Hash_Table *h, int remove_entries_p) ptrdiff_t i = XFASTINT (idx); bool key_known_to_survive_p = survives_gc_p (HASH_KEY (h, i)); bool value_known_to_survive_p = survives_gc_p (HASH_VALUE (h, i)); - int remove_p; + bool remove_p; if (EQ (h->weak, Qkey)) remove_p = !key_known_to_survive_p; @@ -3960,7 +3969,7 @@ sweep_weak_table (struct Lisp_Hash_Table *h, int remove_entries_p) else if (EQ (h->weak, Qkey_and_value)) remove_p = !(key_known_to_survive_p && value_known_to_survive_p); else - abort (); + emacs_abort (); next = HASH_NEXT (h, i); @@ -4022,7 +4031,7 @@ void sweep_weak_hash_tables (void) { struct Lisp_Hash_Table *h, *used, *next; - int marked; + bool marked; /* Mark all keys and values that are in use. Keep on marking until there is no more change. This is necessary for cases like @@ -4256,7 +4265,7 @@ sxhash (Lisp_Object obj, int depth) break; default: - abort (); + emacs_abort (); } return hash; @@ -4674,7 +4683,7 @@ secure_hash (Lisp_Object algorithm, Lisp_Object object, Lisp_Object start, Lisp_ coding_system = Vcoding_system_for_write; else { - int force_raw_text = 0; + bool force_raw_text = 0; coding_system = BVAR (XBUFFER (object), buffer_file_coding_system); if (NILP (coding_system) diff --git a/src/font.c b/src/font.c index cf9964f08f3..49a09bced28 100644 --- a/src/font.c +++ b/src/font.c @@ -216,13 +216,12 @@ static int num_font_drivers; /* Return a Lispy value of a font property value at STR and LEN bytes. - If STR is "*", return nil. - If FORCE_SYMBOL is zero and all characters in STR are digits, - return an integer. Otherwise, return a symbol interned from - STR. */ + If STR is "*", return nil. If FORCE_SYMBOL, or if STR does not + consist entirely of one or more digits, return a symbol interned + from STR. Otherwise, return an integer. */ Lisp_Object -font_intern_prop (const char *str, ptrdiff_t len, int force_symbol) +font_intern_prop (const char *str, ptrdiff_t len, bool force_symbol) { ptrdiff_t i; Lisp_Object tem; @@ -306,7 +305,8 @@ font_pixel_size (FRAME_PTR f, Lisp_Object spec) VAL is an integer. */ int -font_style_to_value (enum font_property_index prop, Lisp_Object val, int noerror) +font_style_to_value (enum font_property_index prop, Lisp_Object val, + bool noerror) { Lisp_Object table = AREF (font_style_table, prop - FONT_WEIGHT_INDEX); int len; @@ -385,7 +385,8 @@ font_style_to_value (enum font_property_index prop, Lisp_Object val, int noerror } Lisp_Object -font_style_symbolic (Lisp_Object font, enum font_property_index prop, int for_face) +font_style_symbolic (Lisp_Object font, enum font_property_index prop, + bool for_face) { Lisp_Object val = AREF (font, prop); Lisp_Object table, elt; @@ -1101,7 +1102,7 @@ font_parse_xlfd (char *name, ptrdiff_t len, Lisp_Object font) } else { - int wild_card_found = 0; + bool wild_card_found = 0; Lisp_Object prop[XLFD_LAST_INDEX]; if (FONT_ENTITY_P (font)) @@ -1337,7 +1338,7 @@ font_parse_fcname (char *name, ptrdiff_t len, Lisp_Object font) } else if (*p == '-') { - int decimal = 0, size_found = 1; + bool decimal = 0, size_found = 1; for (q = p + 1; *q && *q != ':'; q++) if (! c_isdigit (*q)) { @@ -1938,7 +1939,7 @@ generate_otf_features (Lisp_Object spec, char *features) { Lisp_Object val; char *p; - int asterisk; + bool asterisk; p = features; *p = '\0'; @@ -2302,11 +2303,12 @@ font_update_sort_order (int *order) } } -static int -font_check_otf_features (Lisp_Object script, Lisp_Object langsys, Lisp_Object features, Lisp_Object table) +static bool +font_check_otf_features (Lisp_Object script, Lisp_Object langsys, + Lisp_Object features, Lisp_Object table) { Lisp_Object val; - int negative; + bool negative; table = assq_no_quit (script, table); if (NILP (table)) @@ -2342,7 +2344,7 @@ font_check_otf_features (Lisp_Object script, Lisp_Object langsys, Lisp_Object fe /* Check if OTF_CAPABILITY satisfies SPEC (otf-spec). */ -static int +static bool font_check_otf (Lisp_Object spec, Lisp_Object otf_capability) { Lisp_Object script, langsys = Qnil, gsub = Qnil, gpos = Qnil; @@ -2376,7 +2378,7 @@ font_check_otf (Lisp_Object spec, Lisp_Object otf_capability) /* Check if FONT (font-entity or font-object) matches with the font specification SPEC. */ -int +bool font_match_p (Lisp_Object spec, Lisp_Object font) { Lisp_Object prop[FONT_SPEC_MAX], *props; @@ -2694,7 +2696,7 @@ font_list_entities (Lisp_Object frame, Lisp_Object spec) Lisp_Object ftype, val; Lisp_Object list = Qnil; int size; - int need_filtering = 0; + bool need_filtering = 0; int i; eassert (FONT_SPEC_P (spec)); @@ -3036,15 +3038,14 @@ font_select_entity (Lisp_Object frame, Lisp_Object entities, Lisp_Object *attrs, { Lisp_Object font_entity; Lisp_Object prefer; - int result, i; + int i; FRAME_PTR f = XFRAME (frame); if (NILP (XCDR (entities)) && ASIZE (XCAR (entities)) == 1) { font_entity = AREF (XCAR (entities), 0); - if (c < 0 - || (result = font_has_char (f, font_entity, c)) > 0) + if (c < 0 || font_has_char (f, font_entity, c) > 0) return font_entity; return Qnil; } @@ -3618,7 +3619,7 @@ font_at (int c, ptrdiff_t pos, struct face *face, struct window *w, Lisp_Object string) { FRAME_PTR f; - int multibyte; + bool multibyte; Lisp_Object font_object; multibyte = (NILP (string) diff --git a/src/font.h b/src/font.h index 3b90bc2ab8a..0475eb665dd 100644 --- a/src/font.h +++ b/src/font.h @@ -320,19 +320,10 @@ struct font negative if that information is not in the font. */ int underline_position; - /* 1 if `vertical-centering-font-regexp' matches this font name. + /* True if `vertical-centering-font-regexp' matches this font name. In this case, we render characters at vertical center positions of lines. */ - int vertical_centering; - - /* Encoding type of the font. The value is one of - 0, 1, 2, or 3: - 0: code points 0x20..0x7F or 0x2020..0x7F7F are used - 1: code points 0xA0..0xFF or 0xA0A0..0xFFFF are used - 2: code points 0x20A0..0x7FFF are used - 3: code points 0xA020..0xFF7F are used - If the member `font_encoder' is not NULL, this member is ignored. */ - unsigned char encoding_type; + bool vertical_centering; /* The baseline position of a font is normally `ascent' value of the font. However, there exist many fonts which don't set `ascent' to @@ -506,9 +497,9 @@ struct font_driver /* Symbol indicating the type of the font-driver. */ Lisp_Object type; - /* 1 iff the font's foundry, family, and adstyle names are case + /* True iff the font's foundry, family, and adstyle names are case sensitive. */ - int case_sensitive; + bool case_sensitive; /* Return a cache of font-entities on frame F. The cache must be a cons whose cdr part is the actual cache area. */ @@ -592,11 +583,11 @@ struct font_driver /* Optional. Draw glyphs between FROM and TO of S->char2b at (X Y) pixel - position of frame F with S->FACE and S->GC. If WITH_BACKGROUND - is nonzero, fill the background in advance. It is assured that - WITH_BACKGROUND is zero when (FROM > 0 || TO < S->nchars). */ + position of frame F with S->FACE and S->GC. If WITH_BACKGROUND, + fill the background in advance. It is assured that WITH_BACKGROUND + is false when (FROM > 0 || TO < S->nchars). */ int (*draw) (struct glyph_string *s, int from, int to, - int x, int y, int with_background); + int x, int y, bool with_background); /* Optional. Store bitmap data for glyph-code CODE of FONT in BITMAP. It is @@ -648,7 +639,7 @@ struct font_driver short, return -1. */ int (*otf_drive) (struct font *font, Lisp_Object features, Lisp_Object gstring_in, int from, int to, - Lisp_Object gstring_out, int idx, int alternate_subst); + Lisp_Object gstring_out, int idx, bool alternate_subst); /* Optional. Make the font driver ready for frame F. Usually this function @@ -699,9 +690,9 @@ struct font_driver Return non-zero if FONT_OBJECT can be used as a (cached) font for ENTITY on frame F. */ - int (*cached_font_ok) (struct frame *f, - Lisp_Object font_object, - Lisp_Object entity); + bool (*cached_font_ok) (struct frame *f, + Lisp_Object font_object, + Lisp_Object entity); }; @@ -711,9 +702,9 @@ struct font_driver struct font_driver_list { - /* 1 iff this driver is currently used. It is ignored in the global + /* True iff this driver is currently used. It is ignored in the global font driver list.*/ - int on; + bool on; /* Pointer to the font driver. */ struct font_driver *driver; /* Pointer to the next element of the chain. */ @@ -744,12 +735,12 @@ extern Lisp_Object find_font_encoding (Lisp_Object); extern int font_registry_charsets (Lisp_Object, struct charset **, struct charset **); extern int font_style_to_value (enum font_property_index prop, - Lisp_Object name, int noerror); + Lisp_Object name, bool noerror); extern Lisp_Object font_style_symbolic (Lisp_Object font, enum font_property_index prop, - int for_face); + bool for_face); -extern int font_match_p (Lisp_Object spec, Lisp_Object font); +extern bool font_match_p (Lisp_Object spec, Lisp_Object font); extern Lisp_Object font_list_entities (Lisp_Object frame, Lisp_Object spec); @@ -774,7 +765,7 @@ extern Lisp_Object font_open_by_spec (FRAME_PTR f, Lisp_Object spec); extern Lisp_Object font_open_by_name (FRAME_PTR f, Lisp_Object name); extern Lisp_Object font_intern_prop (const char *str, ptrdiff_t len, - int force_symbol); + bool force_symbol); extern void font_update_sort_order (int *order); extern void font_parse_family_registry (Lisp_Object family, diff --git a/src/fontset.c b/src/fontset.c index 01e38fe45e5..2b955fe6b11 100644 --- a/src/fontset.c +++ b/src/fontset.c @@ -185,21 +185,12 @@ void (*check_window_system_func) (void); /* Prototype declarations for static functions. */ -static void fontset_add (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object); -static Lisp_Object fontset_find_font (Lisp_Object, int, struct face *, - int, int); -static void reorder_font_vector (Lisp_Object, struct font *); -static Lisp_Object fontset_font (Lisp_Object, int, struct face *, int); static Lisp_Object make_fontset (Lisp_Object, Lisp_Object, Lisp_Object); -static Lisp_Object fontset_pattern_regexp (Lisp_Object); -static void accumulate_script_ranges (Lisp_Object, Lisp_Object, - Lisp_Object); -static void set_fontset_font (Lisp_Object, Lisp_Object); -/* Return 1 if ID is a valid fontset id, else return 0. +/* Return true if ID is a valid fontset id. Optimized away if ENABLE_CHECKING is not defined. */ -static int +static bool fontset_id_valid_p (int id) { return (id >= 0 && id < ASIZE (Vfontset_table) - 1); @@ -413,7 +404,7 @@ reorder_font_vector (Lisp_Object font_group, struct font *font) Lisp_Object vec, font_object; int size; int i; - int score_changed = 0; + bool score_changed = 0; if (font) XSETFONT (font_object, font); @@ -544,10 +535,11 @@ fontset_get_font_group (Lisp_Object fontset, int c) ID is a charset-id that must be preferred, or -1 meaning no preference. - If FALLBACK is nonzero, search only fallback fonts. */ + If FALLBACK, search only fallback fonts. */ static Lisp_Object -fontset_find_font (Lisp_Object fontset, int c, struct face *face, int id, int fallback) +fontset_find_font (Lisp_Object fontset, int c, struct face *face, int id, + bool fallback) { Lisp_Object vec, font_group; int i, charset_matched = 0, found_index; @@ -919,11 +911,11 @@ free_face_fontset (FRAME_PTR f, struct face *face) #if 0 -/* Return 1 if FACE is suitable for displaying character C. - Otherwise return 0. Called from the macro FACE_SUITABLE_FOR_CHAR_P +/* Return true if FACE is suitable for displaying character C. + Called from the macro FACE_SUITABLE_FOR_CHAR_P when C is not an ASCII character. */ -int +bool face_suitable_for_char_p (struct face *face, int c) { Lisp_Object fontset, rfont_def; @@ -1470,7 +1462,7 @@ appended. By default, FONT-SPEC overrides the previous settings. */) Lisp_Object range_list; struct charset *charset = NULL; Lisp_Object fontname; - int ascii_changed = 0; + bool ascii_changed = 0; fontset = check_fontset_name (name, &frame); diff --git a/src/frame.c b/src/frame.c index 968cb4905a2..9b12842bf89 100644 --- a/src/frame.c +++ b/src/frame.c @@ -214,7 +214,7 @@ See also `frame-live-p'. */) case output_ns: return Qns; default: - abort (); + emacs_abort (); } } @@ -620,7 +620,7 @@ affects all frames on the same terminal device. */) #ifdef MSDOS if (sf->output_method != output_msdos_raw && sf->output_method != output_termcap) - abort (); + emacs_abort (); #else /* not MSDOS */ #ifdef WINDOWSNT /* This should work now! */ @@ -767,7 +767,7 @@ do_switch_frame (Lisp_Object frame, int track, int for_deletion, Lisp_Object nor Lisp_Object focus; if (!FRAMEP (XCAR (tail))) - abort (); + emacs_abort (); focus = FRAME_FOCUS_FRAME (XFRAME (XCAR (tail))); @@ -897,7 +897,7 @@ next_frame (Lisp_Object frame, Lisp_Object minibuf) /* There must always be at least one frame in Vframe_list. */ if (! CONSP (Vframe_list)) - abort (); + emacs_abort (); /* If this frame is dead, it won't be in Vframe_list, and we'll loop forever. Forestall that. */ @@ -975,7 +975,7 @@ prev_frame (Lisp_Object frame, Lisp_Object minibuf) /* There must always be at least one frame in Vframe_list. */ if (! CONSP (Vframe_list)) - abort (); + emacs_abort (); prev = Qnil; for (tail = Vframe_list; CONSP (tail); tail = XCDR (tail)) @@ -984,7 +984,7 @@ prev_frame (Lisp_Object frame, Lisp_Object minibuf) f = XCAR (tail); if (!FRAMEP (f)) - abort (); + emacs_abort (); if (EQ (frame, f) && !NILP (prev)) return prev; @@ -1385,7 +1385,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force) this = XCAR (frames); if (!FRAMEP (this)) - abort (); + emacs_abort (); f1 = XFRAME (this); if (kb == FRAME_KBOARD (f1)) @@ -1421,7 +1421,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force) this = XCAR (frames); if (!FRAMEP (this)) - abort (); + emacs_abort (); f1 = XFRAME (this); /* Consider only frames on the same kboard @@ -1447,7 +1447,7 @@ delete_frame (Lisp_Object frame, Lisp_Object force) that is prohibited at the top; you can't delete surrogate minibuffer frames. */ if (NILP (frame_with_minibuf)) - abort (); + emacs_abort (); kset_default_minibuffer_frame (kb, frame_with_minibuf); } @@ -2108,7 +2108,7 @@ store_frame_param (struct frame *f, Lisp_Object prop, Lisp_Object val) swap_in_global_binding (sym); break; } - default: abort (); + default: emacs_abort (); } } @@ -3835,7 +3835,7 @@ x_get_arg (Display_Info *dpyinfo, Lisp_Object alist, Lisp_Object param, } default: - abort (); + emacs_abort (); } } else diff --git a/src/frame.h b/src/frame.h index 1fe3ebd9182..661ea2ea67c 100644 --- a/src/frame.h +++ b/src/frame.h @@ -81,9 +81,6 @@ enum fullscreen_type #define FRAME_FOREGROUND_PIXEL(f) ((f)->foreground_pixel) #define FRAME_BACKGROUND_PIXEL(f) ((f)->background_pixel) -struct terminal; - -struct font_driver_list; struct frame { @@ -981,7 +978,7 @@ extern Lisp_Object selected_frame; ((FRAMEP (selected_frame) \ && FRAME_LIVE_P (XFRAME (selected_frame))) \ ? XFRAME (selected_frame) \ - : (abort (), (struct frame *) 0)) + : (emacs_abort (), (struct frame *) 0)) /*********************************************************************** diff --git a/src/fringe.c b/src/fringe.c index 97d03a2bfae..0c2109a0f8e 100644 --- a/src/fringe.c +++ b/src/fringe.c @@ -659,7 +659,14 @@ draw_fringe_bitmap_1 (struct window *w, struct glyph_row *row, int left_p, int o { /* If W has a vertical border to its left, don't draw over it. */ wd -= ((!WINDOW_LEFTMOST_P (w) - && !WINDOW_HAS_VERTICAL_SCROLL_BAR (w)) + && !WINDOW_HAS_VERTICAL_SCROLL_BAR (w) + /* But don't reduce the fringe width if the window + has a left margin, because that means we are not + in danger of drawing over the vertical border, + and OTOH leaving out that one pixel leaves behind + traces of the cursor, if it was in column zero + before drawing non-empty margin area. */ + && NILP (w->left_margin_cols)) ? 1 : 0); p.bx = x - wd; p.nx = wd; diff --git a/src/ftfont.c b/src/ftfont.c index e16f967f596..a85773a9a21 100644 --- a/src/ftfont.c +++ b/src/ftfont.c @@ -45,7 +45,7 @@ static Lisp_Object Qfreetype; static Lisp_Object Qmonospace, Qsans_serif, Qserif, Qmono, Qsans, Qsans__serif; /* Flag to tell if FcInit is already called or not. */ -static int fc_initialized; +static bool fc_initialized; /* Handle to a FreeType library instance. */ static FT_Library ft_library; @@ -65,7 +65,7 @@ struct ftfont_info #ifdef HAVE_LIBOTF /* The following four members must be here in this order to be compatible with struct xftfont_info (in xftfont.c). */ - int maybe_otf; /* Flag to tell if this may be OTF or not. */ + bool maybe_otf; /* Flag to tell if this may be OTF or not. */ OTF *otf; #endif /* HAVE_LIBOTF */ FT_Size ft_size; @@ -543,9 +543,9 @@ struct font_driver ftfont_driver = /* We can't draw a text without device dependent functions. */ NULL, /* draw */ ftfont_get_bitmap, - NULL, /* get_bitmap */ NULL, /* free_bitmap */ NULL, /* get_outline */ + NULL, /* free_outline */ ftfont_anchor_point, #ifdef HAVE_LIBOTF ftfont_otf_capability, @@ -661,7 +661,8 @@ ftfont_get_open_type_spec (Lisp_Object otf_spec) { struct OpenTypeSpec *spec = malloc (sizeof *spec); Lisp_Object val; - int i, j, negative; + int i, j; + bool negative; if (! spec) return NULL; @@ -1185,7 +1186,7 @@ ftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) FT_Size ft_size; FT_UInt size; Lisp_Object val, filename, idx, cache, font_object; - int scalable; + bool scalable; int spacing; char name[256]; int i, len; @@ -1243,7 +1244,7 @@ ftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) ftfont_info->ft_size = ft_face->size; ftfont_info->index = XINT (idx); #ifdef HAVE_LIBOTF - ftfont_info->maybe_otf = ft_face->face_flags & FT_FACE_FLAG_SFNT; + ftfont_info->maybe_otf = (ft_face->face_flags & FT_FACE_FLAG_SFNT) != 0; ftfont_info->otf = NULL; #endif /* HAVE_LIBOTF */ /* This means that there's no need of transformation. */ @@ -1392,7 +1393,8 @@ ftfont_text_extents (struct font *font, unsigned int *code, int nglyphs, struct struct ftfont_info *ftfont_info = (struct ftfont_info *) font; FT_Face ft_face = ftfont_info->ft_size->face; int width = 0; - int i, first; + int i; + bool first; if (ftfont_info->ft_size != ft_face->size) FT_Activate_Size (ftfont_info->ft_size); @@ -1630,7 +1632,7 @@ ftfont_get_metrics (MFLTFont *font, MFLTGlyphString *gstring, FT_Glyph_Metrics *m; if (FT_Load_Glyph (ft_face, g->code, FT_LOAD_DEFAULT) != 0) - abort (); + emacs_abort (); m = &ft_face->glyph->metrics; if (flt_font_ft->matrix) { @@ -1682,10 +1684,12 @@ ftfont_check_otf (MFLTFont *font, MFLTOtfSpec *spec) struct MFLTFontFT *flt_font_ft = (struct MFLTFontFT *) font; OTF *otf = flt_font_ft->otf; OTF_Tag *tags; - int i, n, negative; + int i, n; + bool negative; if (FEATURE_ANY (0) && FEATURE_ANY (1)) - /* Return 1 iff any of GSUB or GPOS support the script (and language). */ + /* Return true iff any of GSUB or GPOS support the script (and + language). */ return (otf && (OTF_check_features (otf, 0, spec->script, spec->langsys, NULL, 0) > 0 @@ -2390,7 +2394,7 @@ ftfont_drive_otf (MFLTFont *font, MFLTOtfSpec *spec, MFLTGlyphString *in, static MFLTGlyphString gstring; -static int m17n_flt_initialized; +static bool m17n_flt_initialized; static Lisp_Object ftfont_shape_by_flt (Lisp_Object lgstring, struct font *font, @@ -2400,7 +2404,7 @@ ftfont_shape_by_flt (Lisp_Object lgstring, struct font *font, ptrdiff_t i; struct MFLTFontFT flt_font_ft; MFLT *flt = NULL; - int with_variation_selector = 0; + bool with_variation_selector = 0; if (! m17n_flt_initialized) { @@ -2421,7 +2425,7 @@ ftfont_shape_by_flt (Lisp_Object lgstring, struct font *font, break; c = LGLYPH_CHAR (g); if (CHAR_VARIATION_SELECTOR_P (c)) - with_variation_selector++; + with_variation_selector = 1; } len = i; diff --git a/src/ftxfont.c b/src/ftxfont.c index 6ebe0798b4e..c705ede62c4 100644 --- a/src/ftxfont.c +++ b/src/ftxfont.c @@ -43,14 +43,6 @@ static #endif struct font_driver ftxfont_driver; -/* Prototypes for helper function. */ -static GC *ftxfont_get_gcs (FRAME_PTR, unsigned long, unsigned long); -static int ftxfont_draw_bitmap (FRAME_PTR, GC, GC *, struct font *, - unsigned, int, int, XPoint *, int, int *, - int); -static void ftxfont_draw_background (FRAME_PTR, struct font *, GC, - int, int, int); - struct ftxfont_frame_data { /* Background and foreground colors. */ @@ -143,7 +135,9 @@ ftxfont_get_gcs (FRAME_PTR f, long unsigned int foreground, long unsigned int ba } static int -ftxfont_draw_bitmap (FRAME_PTR f, GC gc_fore, GC *gcs, struct font *font, unsigned int code, int x, int y, XPoint *p, int size, int *n, int flush) +ftxfont_draw_bitmap (FRAME_PTR f, GC gc_fore, GC *gcs, struct font *font, + unsigned int code, int x, int y, XPoint *p, int size, + int *n, bool flush) { struct font_bitmap bitmap; unsigned char *b; @@ -232,13 +226,6 @@ ftxfont_draw_background (FRAME_PTR f, struct font *font, GC gc, int x, int y, XSetForeground (FRAME_X_DISPLAY (f), gc, xgcv.foreground); } -/* Prototypes for font-driver methods. */ -static Lisp_Object ftxfont_list (Lisp_Object, Lisp_Object); -static Lisp_Object ftxfont_match (Lisp_Object, Lisp_Object); -static Lisp_Object ftxfont_open (FRAME_PTR, Lisp_Object, int); -static void ftxfont_close (FRAME_PTR, struct font *); -static int ftxfont_draw (struct glyph_string *, int, int, int, int, int); - static Lisp_Object ftxfont_list (Lisp_Object frame, Lisp_Object spec) { @@ -280,7 +267,8 @@ ftxfont_close (FRAME_PTR f, struct font *font) } static int -ftxfont_draw (struct glyph_string *s, int from, int to, int x, int y, int with_background) +ftxfont_draw (struct glyph_string *s, int from, int to, int x, int y, + bool with_background) { FRAME_PTR f = s->f; struct face *face = s->face; diff --git a/src/gtkutil.c b/src/gtkutil.c index f0d2c022f0c..884574e1062 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -21,7 +21,6 @@ along with GNU Emacs. If not, see . */ #ifdef USE_GTK #include -#include #include #include @@ -254,7 +253,7 @@ void free_widget_value (widget_value *wv) { if (wv->free_list) - abort (); + emacs_abort (); if (malloc_cpt > 25) { @@ -1979,7 +1978,10 @@ xg_get_file_name (FRAME_PTR f, /* I really don't know why this is needed, but without this the GLIBC add on library linuxthreads hangs when the Gnome file chooser backend creates threads. */ - sigblock (sigmask (__SIGRTMIN)); + sigset_t blocked; + sigemptyset (&blocked); + sigaddset (&blocked, __SIGRTMIN); + pthread_sigmask (SIG_BLOCK, &blocked, 0); #endif /* HAVE_PTHREAD */ #ifdef HAVE_GTK_FILE_SELECTION_NEW @@ -2001,7 +2003,7 @@ xg_get_file_name (FRAME_PTR f, filesel_done = xg_dialog_run (f, w); #if defined (HAVE_PTHREAD) && defined (__SIGRTMIN) - sigunblock (sigmask (__SIGRTMIN)); + pthread_sigmask (SIG_UNBLOCK, &blocked, 0); #endif if (filesel_done == GTK_RESPONSE_OK) @@ -2057,7 +2059,10 @@ xg_get_font (FRAME_PTR f, const char *default_name) Lisp_Object font = Qnil; #if defined (HAVE_PTHREAD) && defined (__SIGRTMIN) - sigblock (sigmask (__SIGRTMIN)); + sigset_t blocked; + sigemptyset (&blocked); + sigaddset (&blocked, __SIGRTMIN); + pthread_sigmask (SIG_BLOCK, &blocked, 0); #endif /* HAVE_PTHREAD */ w = gtk_font_chooser_dialog_new @@ -2086,7 +2091,7 @@ xg_get_font (FRAME_PTR f, const char *default_name) done = xg_dialog_run (f, w); #if defined (HAVE_PTHREAD) && defined (__SIGRTMIN) - sigunblock (sigmask (__SIGRTMIN)); + pthread_sigmask (SIG_UNBLOCK, &blocked, 0); #endif if (done == GTK_RESPONSE_OK) @@ -3519,7 +3524,7 @@ xg_store_widget_in_map (GtkWidget *w) } /* Should never end up here */ - abort (); + emacs_abort (); } /* Remove pointer at IDX from id_to_widget. @@ -4087,7 +4092,7 @@ xg_tool_bar_menu_proxy (GtkToolItem *toolitem, gpointer user_data) else { fprintf (stderr, "internal error: GTK_IMAGE_PIXBUF failed\n"); - abort (); + emacs_abort (); } } else if (store_type == GTK_IMAGE_ICON_NAME) @@ -4102,7 +4107,7 @@ xg_tool_bar_menu_proxy (GtkToolItem *toolitem, gpointer user_data) else { fprintf (stderr, "internal error: store_type is %d\n", store_type); - abort (); + emacs_abort (); } } if (wmenuimage) diff --git a/src/image.c b/src/image.c index a067dae7737..4ec6105d72d 100644 --- a/src/image.c +++ b/src/image.c @@ -19,7 +19,6 @@ along with GNU Emacs. If not, see . */ #include #include -#include #include #ifdef HAVE_PNG @@ -841,7 +840,7 @@ parse_image_spec (Lisp_Object spec, struct image_keyword *keywords, break; default: - abort (); + emacs_abort (); break; } @@ -5517,13 +5516,13 @@ init_png_functions (Lisp_Object libraries) #if (PNG_LIBPNG_VER < 10500) -#define PNG_LONGJMP(ptr) (longjmp ((ptr)->jmpbuf, 1)) +#define PNG_LONGJMP(ptr) (_longjmp ((ptr)->jmpbuf, 1)) #define PNG_JMPBUF(ptr) ((ptr)->jmpbuf) #else /* In libpng version 1.5, the jmpbuf member is hidden. (Bug#7908) */ #define PNG_LONGJMP(ptr) (fn_png_longjmp ((ptr), 1)) #define PNG_JMPBUF(ptr) \ - (*fn_png_set_longjmp_fn ((ptr), longjmp, sizeof (jmp_buf))) + (*fn_png_set_longjmp_fn ((ptr), _longjmp, sizeof (jmp_buf))) #endif /* Error and warning handlers installed when the PNG library @@ -5696,7 +5695,7 @@ png_load (struct frame *f, struct image *img) /* Set error jump-back. We come back here when the PNG library detects an error. */ - if (setjmp (PNG_JMPBUF (png_ptr))) + if (_setjmp (PNG_JMPBUF (png_ptr))) { error: if (png_ptr) @@ -6114,7 +6113,7 @@ static _Noreturn void my_error_exit (j_common_ptr cinfo) { struct my_jpeg_error_mgr *mgr = (struct my_jpeg_error_mgr *) cinfo->err; - longjmp (mgr->setjmp_buffer, 1); + _longjmp (mgr->setjmp_buffer, 1); } @@ -6365,7 +6364,7 @@ jpeg_load (struct frame *f, struct image *img) cinfo.err = fn_jpeg_std_error (&mgr.pub); mgr.pub.error_exit = my_error_exit; - if ((rc = setjmp (mgr.setjmp_buffer)) != 0) + if ((rc = _setjmp (mgr.setjmp_buffer)) != 0) { if (rc == 1) { @@ -6411,12 +6410,12 @@ jpeg_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); - longjmp (mgr.setjmp_buffer, 2); + _longjmp (mgr.setjmp_buffer, 2); } /* Create X image and pixmap. */ if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap)) - longjmp (mgr.setjmp_buffer, 2); + _longjmp (mgr.setjmp_buffer, 2); /* Allocate colors. When color quantization is used, cinfo.actual_number_of_colors has been set with the number of diff --git a/src/indent.c b/src/indent.c index 160b8c7479e..c60315a7f6e 100644 --- a/src/indent.c +++ b/src/indent.c @@ -122,7 +122,7 @@ disptab_matches_widthtab (struct Lisp_Char_Table *disptab, struct Lisp_Vector *w int i; if (widthtab->header.size != 256) - abort (); + emacs_abort (); for (i = 0; i < 256; i++) if (character_width (i, disptab) @@ -144,7 +144,7 @@ recompute_width_table (struct buffer *buf, struct Lisp_Char_Table *disptab) bset_width_table (buf, Fmake_vector (make_number (256), make_number (0))); widthtab = XVECTOR (BVAR (buf, width_table)); if (widthtab->header.size != 256) - abort (); + emacs_abort (); for (i = 0; i < 256; i++) XSETFASTINT (widthtab->contents[i], character_width (i, disptab)); diff --git a/src/insdel.c b/src/insdel.c index da258c19a1e..604a9bbf3df 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -69,13 +69,13 @@ check_markers (void) for (tail = BUF_MARKERS (current_buffer); tail; tail = tail->next) { if (tail->buffer->text != current_buffer->text) - abort (); + emacs_abort (); if (tail->charpos > Z) - abort (); + emacs_abort (); if (tail->bytepos > Z_BYTE) - abort (); + emacs_abort (); if (multibyte && ! CHAR_HEAD_P (FETCH_BYTE (tail->bytepos))) - abort (); + emacs_abort (); } } @@ -808,7 +808,7 @@ insert_1_both (const char *string, #ifdef BYTE_COMBINING_DEBUG if (count_combining_before (string, nbytes, PT, PT_BYTE) || count_combining_after (string, nbytes, PT, PT_BYTE)) - abort (); + emacs_abort (); #endif /* Record deletion of the surrounding text that combines with @@ -943,7 +943,7 @@ insert_from_string_1 (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte, the text that has been stored by copy_text. */ if (count_combining_before (GPT_ADDR, outgoing_nbytes, PT, PT_BYTE) || count_combining_after (GPT_ADDR, outgoing_nbytes, PT, PT_BYTE)) - abort (); + emacs_abort (); #endif record_insert (PT, nchars); @@ -1126,7 +1126,7 @@ insert_from_buffer_1 (struct buffer *buf, the text that has been stored by copy_text. */ if (count_combining_before (GPT_ADDR, outgoing_nbytes, PT, PT_BYTE) || count_combining_after (GPT_ADDR, outgoing_nbytes, PT, PT_BYTE)) - abort (); + emacs_abort (); #endif record_insert (PT, nchars); @@ -1187,7 +1187,7 @@ adjust_after_replace (ptrdiff_t from, ptrdiff_t from_byte, #ifdef BYTE_COMBINING_DEBUG if (count_combining_before (GPT_ADDR, len_byte, from, from_byte) || count_combining_after (GPT_ADDR, len_byte, from, from_byte)) - abort (); + emacs_abort (); #endif if (STRINGP (prev_text)) @@ -1370,7 +1370,7 @@ replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object new, the text that has been stored by copy_text. */ if (count_combining_before (GPT_ADDR, outgoing_insbytes, from, from_byte) || count_combining_after (GPT_ADDR, outgoing_insbytes, from, from_byte)) - abort (); + emacs_abort (); #endif if (! EQ (BVAR (current_buffer, undo_list), Qt)) @@ -1496,7 +1496,7 @@ replace_range_2 (ptrdiff_t from, ptrdiff_t from_byte, the text that has been stored by copy_text. */ if (count_combining_before (GPT_ADDR, insbytes, from, from_byte) || count_combining_after (GPT_ADDR, insbytes, from, from_byte)) - abort (); + emacs_abort (); #endif GAP_SIZE -= insbytes; @@ -1704,7 +1704,7 @@ del_range_2 (ptrdiff_t from, ptrdiff_t from_byte, #ifdef BYTE_COMBINING_DEBUG if (count_combining_before (BUF_BYTE_ADDRESS (current_buffer, to_byte), Z_BYTE - to_byte, from, from_byte)) - abort (); + emacs_abort (); #endif if (ret_string || ! EQ (BVAR (current_buffer, undo_list), Qt)) diff --git a/src/intervals.c b/src/intervals.c index 49d61b2f9b0..e508f968963 100644 --- a/src/intervals.c +++ b/src/intervals.c @@ -199,13 +199,13 @@ intervals_equal (INTERVAL i0, INTERVAL i1) i0_sym = XCAR (i0_cdr); i0_cdr = XCDR (i0_cdr); if (!CONSP (i0_cdr)) - return 0; /* abort (); */ + return 0; i1_val = i1->plist; while (CONSP (i1_val) && !EQ (XCAR (i1_val), i0_sym)) { i1_val = XCDR (i1_val); if (!CONSP (i1_val)) - return 0; /* abort (); */ + return 0; i1_val = XCDR (i1_val); } @@ -223,7 +223,7 @@ intervals_equal (INTERVAL i0, INTERVAL i1) i1_cdr = XCDR (i1_cdr); if (!CONSP (i1_cdr)) - return 0; /* abort (); */ + return 0; i1_cdr = XCDR (i1_cdr); } @@ -1253,7 +1253,7 @@ delete_interval (register INTERVAL i) else if (STRINGP (owner)) set_string_intervals (owner, parent); else - abort (); + emacs_abort (); return; } @@ -1408,7 +1408,7 @@ offset_intervals (struct buffer *buffer, ptrdiff_t start, ptrdiff_t length) start, length); else { - IF_LINT (if (length < - TYPE_MAXIMUM (ptrdiff_t)) abort ();) + lint_assume (- TYPE_MAXIMUM (ptrdiff_t) <= length); adjust_intervals_for_deletion (buffer, start, -length); } } @@ -1468,7 +1468,7 @@ merge_interval_right (register INTERVAL i) /* This must be the rightmost or last interval and cannot be merged right. The caller should have known. */ - abort (); + emacs_abort (); } /* Merge interval I with its lexicographic predecessor. The resulting @@ -1524,7 +1524,7 @@ merge_interval_left (register INTERVAL i) /* This must be the leftmost or first interval and cannot be merged left. The caller should have known. */ - abort (); + emacs_abort (); } /* Create a copy of SOURCE but with the default value of UP. */ @@ -2170,7 +2170,7 @@ get_property_and_range (ptrdiff_t pos, Lisp_Object prop, Lisp_Object *val, else if (STRINGP (object)) i = find_interval (string_intervals (object), pos); else - abort (); + emacs_abort (); if (!i || (i->position + LENGTH (i) <= pos)) return 0; @@ -2209,7 +2209,7 @@ get_local_map (register ptrdiff_t position, register struct buffer *buffer, /* Perhaps we should just change `position' to the limit. */ if (position > BUF_ZV (buffer) || position < BUF_BEGV (buffer)) - abort (); + emacs_abort (); /* Ignore narrowing, so that a local map continues to be valid even if the visible region contains no characters and hence no properties. */ diff --git a/src/keyboard.c b/src/keyboard.c index 9d103d673b2..691a06d36cf 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -21,7 +21,6 @@ along with GNU Emacs. If not, see . */ #define KEYBOARD_INLINE EXTERN_INLINE -#include #include #include #include "lisp.h" @@ -452,9 +451,8 @@ static void restore_getcjmp (jmp_buf); static Lisp_Object apply_modifiers (int, Lisp_Object); static void clear_event (struct input_event *); static Lisp_Object restore_kboard_configuration (Lisp_Object); -static void interrupt_signal (int signalnum); #ifdef SIGIO -static void input_available_signal (int signo); +static void deliver_input_available_signal (int signo); #endif static void handle_interrupt (void); static _Noreturn void quit_throw_to_read_char (int); @@ -462,7 +460,7 @@ static void process_special_events (void); static void timer_start_idle (void); static void timer_stop_idle (void); static void timer_resume_idle (void); -static void handle_user_signal (int); +static void deliver_user_signal (int); static char *find_user_signal_name (int); static int store_user_signal_events (void); @@ -1026,7 +1024,7 @@ restore_kboard_configuration (Lisp_Object was_locked) pop_kboard (); /* The pop should not change the kboard. */ if (single_kboard && current_kboard != prev) - abort (); + emacs_abort (); } return Qnil; } @@ -2608,13 +2606,13 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps, Lisp_Object last = KVAR (kb, kbd_queue); /* We shouldn't get here if we were in single-kboard mode! */ if (single_kboard) - abort (); + emacs_abort (); if (CONSP (last)) { while (CONSP (XCDR (last))) last = XCDR (last); if (!NILP (XCDR (last))) - abort (); + emacs_abort (); } if (!CONSP (last)) kset_kbd_queue (kb, Fcons (c, Qnil)); @@ -2787,7 +2785,7 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps, if (current_kboard->kbd_queue_has_data) { if (!CONSP (KVAR (current_kboard, kbd_queue))) - abort (); + emacs_abort (); c = XCAR (KVAR (current_kboard, kbd_queue)); kset_kbd_queue (current_kboard, XCDR (KVAR (current_kboard, kbd_queue))); @@ -2854,7 +2852,7 @@ read_char (int commandflag, ptrdiff_t nmaps, Lisp_Object *maps, while (CONSP (XCDR (last))) last = XCDR (last); if (!NILP (XCDR (last))) - abort (); + emacs_abort (); } if (!CONSP (last)) kset_kbd_queue (kb, Fcons (c, Qnil)); @@ -3563,7 +3561,7 @@ kbd_buffer_store_event_hold (register struct input_event *event, struct input_event *hold_quit) { if (event->kind == NO_EVENT) - abort (); + emacs_abort (); if (hold_quit && hold_quit->kind != NO_EVENT) return; @@ -3684,7 +3682,7 @@ kbd_buffer_store_event_hold (register struct input_event *event, if (immediate_quit && NILP (Vinhibit_quit)) { immediate_quit = 0; - sigfree (); + pthread_sigmask (SIG_SETMASK, &empty_mask, 0); QUIT; } } @@ -3836,7 +3834,11 @@ kbd_buffer_get_event (KBOARD **kbp, unhold_keyboard_input (); #ifdef SIGIO if (!noninteractive) - signal (SIGIO, input_available_signal); + { + struct sigaction action; + emacs_sigaction_init (&action, deliver_input_available_signal); + sigaction (SIGIO, &action, 0); + } #endif /* SIGIO */ start_polling (); } @@ -3958,7 +3960,7 @@ kbd_buffer_get_event (KBOARD **kbp, #else /* We're getting selection request events, but we don't have a window system. */ - abort (); + emacs_abort (); #endif } @@ -4202,7 +4204,7 @@ kbd_buffer_get_event (KBOARD **kbp, else /* We were promised by the above while loop that there was something for us to read! */ - abort (); + emacs_abort (); input_pending = readable_events (0); @@ -4271,7 +4273,7 @@ process_special_events (void) #else /* We're getting selection request events, but we don't have a window system. */ - abort (); + emacs_abort (); #endif } } @@ -5624,7 +5626,7 @@ make_lispy_event (struct input_event *event) else if (FRAMEP (event->frame_or_window)) f = XFRAME (event->frame_or_window); else - abort (); + emacs_abort (); if (FRAME_WINDOW_P (f)) fuzz = double_click_fuzz; @@ -5731,7 +5733,7 @@ make_lispy_event (struct input_event *event) else /* Every mouse event should either have the down_modifier or the up_modifier set. */ - abort (); + emacs_abort (); { /* Get the symbol we should use for the mouse click. */ @@ -5792,7 +5794,7 @@ make_lispy_event (struct input_event *event) else if (FRAMEP (event->frame_or_window)) fr = XFRAME (event->frame_or_window); else - abort (); + emacs_abort (); fuzz = FRAME_WINDOW_P (fr) ? double_click_fuzz : double_click_fuzz / 8; @@ -5812,7 +5814,7 @@ make_lispy_event (struct input_event *event) else /* Every wheel event should either have the down_modifier or the up_modifier set. */ - abort (); + emacs_abort (); if (event->kind == HORIZ_WHEEL_EVENT) symbol_num += 2; @@ -5981,7 +5983,7 @@ make_lispy_event (struct input_event *event) { char *name = find_user_signal_name (event->code); if (!name) - abort (); + emacs_abort (); return intern (name); } @@ -6068,7 +6070,7 @@ make_lispy_event (struct input_event *event) /* The 'kind' field of the event is something we don't recognize. */ default: - abort (); + emacs_abort (); } } @@ -6245,7 +6247,7 @@ apply_modifiers_uncached (int modifiers, char *base, int base_len, int base_len_ /* Only the event queue may use the `up' modifier; it should always be turned into a click or drag event before presented to lisp code. */ if (modifiers & up_modifier) - abort (); + emacs_abort (); if (modifiers & alt_modifier) { *p++ = 'A'; *p++ = '-'; } if (modifiers & ctrl_modifier) { *p++ = 'C'; *p++ = '-'; } @@ -6340,7 +6342,7 @@ parse_modifiers (Lisp_Object symbol) Qnil); if (modifiers & ~INTMASK) - abort (); + emacs_abort (); XSETFASTINT (mask, modifiers); elements = Fcons (unmodified, Fcons (mask, Qnil)); @@ -6797,10 +6799,12 @@ gobble_input (int expected) #ifdef SIGIO if (interrupt_input) { - SIGMASKTYPE mask; - mask = sigblock (sigmask (SIGIO)); + sigset_t blocked, procmask; + sigemptyset (&blocked); + sigaddset (&blocked, SIGIO); + pthread_sigmask (SIG_BLOCK, &blocked, &procmask); read_avail_input (expected); - sigsetmask (mask); + pthread_sigmask (SIG_SETMASK, &procmask, 0); } else #ifdef POLL_FOR_INPUT @@ -6809,10 +6813,12 @@ gobble_input (int expected) it's always set. */ if (!interrupt_input && poll_suppress_count == 0) { - SIGMASKTYPE mask; - mask = sigblock (sigmask (SIGALRM)); + sigset_t blocked, procmask; + sigemptyset (&blocked); + sigaddset (&blocked, SIGALRM); + pthread_sigmask (SIG_BLOCK, &blocked, &procmask); read_avail_input (expected); - sigsetmask (mask); + pthread_sigmask (SIG_SETMASK, &procmask, 0); } else #endif @@ -6848,10 +6854,12 @@ record_asynch_buffer_change (void) #ifdef SIGIO if (interrupt_input) { - SIGMASKTYPE mask; - mask = sigblock (sigmask (SIGIO)); + sigset_t blocked, procmask; + sigemptyset (&blocked); + sigaddset (&blocked, SIGIO); + pthread_sigmask (SIG_BLOCK, &blocked, &procmask); kbd_buffer_store_event (&event); - sigsetmask (mask); + pthread_sigmask (SIG_SETMASK, &procmask, 0); } else #endif @@ -7017,7 +7025,7 @@ tty_read_avail_input (struct terminal *terminal, if (terminal->type != output_termcap && terminal->type != output_msdos_raw) - abort (); + emacs_abort (); /* XXX I think the following code should be moved to separate hook functions in system-dependent files. */ @@ -7252,12 +7260,8 @@ process_pending_signals (void) /* Note SIGIO has been undef'd if FIONREAD is missing. */ static void -input_available_signal (int signo) +handle_input_available_signal (int sig) { - /* Must preserve main program's value of errno. */ - int old_errno = errno; - SIGNAL_THREAD_CHECK (signo); - #ifdef SYNC_INPUT interrupt_input_pending = 1; pending_signals = 1; @@ -7269,8 +7273,12 @@ input_available_signal (int signo) #ifndef SYNC_INPUT handle_async_input (); #endif +} - errno = old_errno; +static void +deliver_input_available_signal (int sig) +{ + handle_on_main_thread (sig, handle_input_available_signal); } #endif /* SIGIO */ @@ -7312,6 +7320,7 @@ static struct user_signal_info *user_signals = NULL; void add_user_signal (int sig, const char *name) { + struct sigaction action; struct user_signal_info *p; for (p = user_signals; p; p = p->next) @@ -7326,18 +7335,16 @@ add_user_signal (int sig, const char *name) p->next = user_signals; user_signals = p; - signal (sig, handle_user_signal); + emacs_sigaction_init (&action, deliver_user_signal); + sigaction (sig, &action, 0); } static void handle_user_signal (int sig) { - int old_errno = errno; struct user_signal_info *p; const char *special_event_name = NULL; - SIGNAL_THREAD_CHECK (sig); - if (SYMBOLP (Vdebug_on_event)) special_event_name = SSDATA (SYMBOL_NAME (Vdebug_on_event)); @@ -7371,8 +7378,12 @@ handle_user_signal (int sig) } break; } +} - errno = old_errno; +static void +deliver_user_signal (int sig) +{ + handle_on_main_thread (sig, handle_user_signal); } static char * @@ -7397,7 +7408,7 @@ store_user_signal_events (void) for (p = user_signals; p; p = p->next) if (p->npending > 0) { - SIGMASKTYPE mask; + sigset_t blocked, procmask; if (nstored == 0) { @@ -7407,7 +7418,10 @@ store_user_signal_events (void) } nstored += p->npending; - mask = sigblock (sigmask (p->sig)); + sigemptyset (&blocked); + sigaddset (&blocked, p->sig); + pthread_sigmask (SIG_BLOCK, &blocked, &procmask); + do { buf.code = p->sig; @@ -7415,7 +7429,8 @@ store_user_signal_events (void) p->npending--; } while (p->npending > 0); - sigsetmask (mask); + + pthread_sigmask (SIG_SETMASK, &procmask, 0); } return nstored; @@ -10792,17 +10807,10 @@ clear_waiting_for_input (void) Otherwise, tell QUIT to kill Emacs. */ static void -interrupt_signal (int signalnum) /* If we don't have an argument, some */ - /* compilers complain in signal calls. */ +handle_interrupt_signal (int sig) { - /* Must preserve main program's value of errno. */ - int old_errno = errno; - struct terminal *terminal; - - SIGNAL_THREAD_CHECK (signalnum); - /* See if we have an active terminal on our controlling tty. */ - terminal = get_named_tty ("/dev/tty"); + struct terminal *terminal = get_named_tty ("/dev/tty"); if (!terminal) { /* If there are no frames there, let's pretend that we are a @@ -10823,10 +10831,15 @@ interrupt_signal (int signalnum) /* If we don't have an argument, some */ handle_interrupt (); } - - errno = old_errno; } +static void +deliver_interrupt_signal (int sig) +{ + handle_on_main_thread (sig, handle_interrupt_signal); +} + + /* If Emacs is stuck because `inhibit-quit' is true, then keep track of the number of times C-g has been requested. If C-g is pressed enough times, then quit anyway. See bug#6585. */ @@ -10856,7 +10869,10 @@ handle_interrupt (void) /* If SIGINT isn't blocked, don't let us be interrupted by another SIGINT, it might be harmful due to non-reentrancy in I/O functions. */ - sigblock (sigmask (SIGINT)); + sigset_t blocked; + sigemptyset (&blocked); + sigaddset (&blocked, SIGINT); + pthread_sigmask (SIG_BLOCK, &blocked, 0); fflush (stdout); reset_all_sys_modes (); @@ -10918,7 +10934,7 @@ handle_interrupt (void) #endif /* not MSDOS */ fflush (stdout); if (((c = getchar ()) & ~040) == 'Y') - abort (); + emacs_abort (); while (c != '\n') c = getchar (); #ifdef MSDOS printf ("\r\nContinuing...\r\n"); @@ -10927,7 +10943,7 @@ handle_interrupt (void) #endif /* not MSDOS */ fflush (stdout); init_all_sys_modes (); - sigfree (); + pthread_sigmask (SIG_SETMASK, &empty_mask, 0); } else { @@ -10940,7 +10956,7 @@ handle_interrupt (void) struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; immediate_quit = 0; - sigfree (); + pthread_sigmask (SIG_SETMASK, &empty_mask, 0); saved = gl_state; GCPRO4 (saved.object, saved.global_code, saved.current_syntax_table, saved.old_prop); @@ -10985,7 +11001,7 @@ quit_throw_to_read_char (int from_signal) if (!from_signal && EQ (Vquit_flag, Qkill_emacs)) Fkill_emacs (Qnil); - sigfree (); + pthread_sigmask (SIG_SETMASK, &empty_mask, 0); /* Prevent another signal from doing this before we finish. */ clear_waiting_for_input (); input_pending = 0; @@ -10999,7 +11015,7 @@ quit_throw_to_read_char (int from_signal) #ifdef POLL_FOR_INPUT /* May be > 1 if in recursive minibuffer. */ if (poll_suppress_count == 0) - abort (); + emacs_abort (); #endif #endif if (FRAMEP (internal_last_event_frame) @@ -11357,7 +11373,7 @@ delete_kboard (KBOARD *kb) for (kbp = &all_kboards; *kbp != kb; kbp = &(*kbp)->next_kboard) if (*kbp == NULL) - abort (); + emacs_abort (); *kbp = kb->next_kboard; /* Prevent a dangling reference to KB. */ @@ -11368,7 +11384,7 @@ delete_kboard (KBOARD *kb) current_kboard = FRAME_KBOARD (XFRAME (selected_frame)); single_kboard = 0; if (current_kboard == kb) - abort (); + emacs_abort (); } wipe_kboard (kb); @@ -11420,17 +11436,23 @@ init_keyboard (void) SIGINT. There is special code in interrupt_signal to exit Emacs on SIGINT when there are no termcap frames on the controlling terminal. */ - signal (SIGINT, interrupt_signal); + struct sigaction action; + emacs_sigaction_init (&action, deliver_interrupt_signal); + sigaction (SIGINT, &action, 0); #ifndef DOS_NT /* For systems with SysV TERMIO, C-g is set up for both SIGINT and SIGQUIT and we can't tell which one it will give us. */ - signal (SIGQUIT, interrupt_signal); + sigaction (SIGQUIT, &action, 0); #endif /* not DOS_NT */ } /* Note SIGIO has been undef'd if FIONREAD is missing. */ #ifdef SIGIO if (!noninteractive) - signal (SIGIO, input_available_signal); + { + struct sigaction action; + emacs_sigaction_init (&action, deliver_input_available_signal); + sigaction (SIGIO, &action, 0); + } #endif /* SIGIO */ /* Use interrupt input by default, if it works and noninterrupt input @@ -11442,7 +11464,7 @@ init_keyboard (void) interrupt_input = 0; #endif - sigfree (); + pthread_sigmask (SIG_SETMASK, &empty_mask, 0); dribble = 0; if (keyboard_init_hook) diff --git a/src/keymap.c b/src/keymap.c index 85c384b8180..d79ff89ed67 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -2923,7 +2923,7 @@ You type Translation\n\ char *title, *p; if (!SYMBOLP (modes[i])) - abort (); + emacs_abort (); p = title = alloca (42 + SCHARS (SYMBOL_NAME (modes[i]))); *p++ = '\f'; diff --git a/src/lisp.h b/src/lisp.h index 1fe6ebb13ab..0470e452899 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -325,7 +325,7 @@ enum CHECK_LISP_OBJECT_TYPE { CHECK_LISP_OBJECT_TYPE = 1 }; typedef EMACS_INT Lisp_Object; #define XLI(o) (o) #define XIL(i) (i) -#define LISP_MAKE_RVALUE(o) (0+(o)) +#define LISP_MAKE_RVALUE(o) (0 + (o)) #define LISP_INITIALLY_ZERO 0 enum CHECK_LISP_OBJECT_TYPE { CHECK_LISP_OBJECT_TYPE = 0 }; #endif /* CHECK_LISP_OBJECT_TYPE */ @@ -422,9 +422,9 @@ enum lsb_bits #define XINT(a) (XLI (a) >> INTTYPEBITS) #define XUINT(a) ((EMACS_UINT) XLI (a) >> INTTYPEBITS) #define make_number(N) XIL ((EMACS_INT) (N) << INTTYPEBITS) -#define XSET(var, type, ptr) \ +#define make_lisp_ptr(ptr, type) \ (eassert (XTYPE (XIL ((intptr_t) (ptr))) == 0), /* Check alignment. */ \ - (var) = XIL ((type) | (intptr_t) (ptr))) + XIL ((type) | (intptr_t) (ptr))) #define XPNTR(a) ((intptr_t) (XLI (a) & ~TYPEMASK)) #define XUNTAG(a, type) ((intptr_t) (XLI (a) - (type))) @@ -449,13 +449,13 @@ static EMACS_INT const VALMASK #define XUINT(a) ((EMACS_UINT) (XLI (a) & INTMASK)) #define make_number(N) XIL ((EMACS_INT) (N) & INTMASK) -#define XSET(var, type, ptr) \ - ((var) = XIL ((EMACS_INT) ((EMACS_UINT) (type) << VALBITS) \ - + ((intptr_t) (ptr) & VALMASK))) +#define make_lisp_ptr(ptr, type) \ + (XIL ((EMACS_INT) ((EMACS_UINT) (type) << VALBITS) \ + + ((intptr_t) (ptr) & VALMASK))) #if DATA_SEG_BITS /* DATA_SEG_BITS forces extra bits to be or'd in with any pointers - which were stored in a Lisp_Object */ + which were stored in a Lisp_Object. */ #define XPNTR(a) ((uintptr_t) ((XLI (a) & VALMASK)) | DATA_SEG_BITS)) #else #define XPNTR(a) ((uintptr_t) (XLI (a) & VALMASK)) @@ -559,16 +559,16 @@ clip_to_bounds (ptrdiff_t lower, EMACS_INT num, ptrdiff_t upper) /* Construct a Lisp_Object from a value or address. */ -#define XSETINT(a, b) (a) = make_number (b) -#define XSETCONS(a, b) XSET (a, Lisp_Cons, b) -#define XSETVECTOR(a, b) XSET (a, Lisp_Vectorlike, b) -#define XSETSTRING(a, b) XSET (a, Lisp_String, b) -#define XSETSYMBOL(a, b) XSET (a, Lisp_Symbol, b) -#define XSETFLOAT(a, b) XSET (a, Lisp_Float, b) +#define XSETINT(a, b) ((a) = make_number (b)) +#define XSETCONS(a, b) ((a) = make_lisp_ptr (b, Lisp_Cons)) +#define XSETVECTOR(a, b) ((a) = make_lisp_ptr (b, Lisp_Vectorlike)) +#define XSETSTRING(a, b) ((a) = make_lisp_ptr (b, Lisp_String)) +#define XSETSYMBOL(a, b) ((a) = make_lisp_ptr (b, Lisp_Symbol)) +#define XSETFLOAT(a, b) ((a) = make_lisp_ptr (b, Lisp_Float)) /* Misc types. */ -#define XSETMISC(a, b) XSET (a, Lisp_Misc, b) +#define XSETMISC(a, b) ((a) = make_lisp_ptr (b, Lisp_Misc)) #define XSETMARKER(a, b) (XSETMISC (a, b), XMISCTYPE (a) = Lisp_Misc_Marker) /* Pseudovector types. */ @@ -914,14 +914,6 @@ enum (ASCII_CHAR_P (IDX) ? CHAR_TABLE_REF_ASCII ((CT), (IDX)) \ : char_table_ref ((CT), (IDX))) -/* Almost equivalent to Faref (CT, IDX). However, if the result is - not a character, return IDX. - - For these characters, do not check validity of CT - and do not follow parent. */ -#define CHAR_TABLE_TRANSLATE(CT, IDX) \ - char_table_translate (CT, IDX) - /* Equivalent to Faset (CT, IDX, VAL) with optimization for ASCII and 8-bit European characters. Do not check validity of CT. */ #define CHAR_TABLE_SET(CT, IDX, VAL) \ @@ -1210,9 +1202,9 @@ struct Lisp_Hash_Table struct Lisp_Hash_Table *next_weak; /* C function to compare two keys. */ - int (*cmpfn) (struct Lisp_Hash_Table *, - Lisp_Object, EMACS_UINT, - Lisp_Object, EMACS_UINT); + bool (*cmpfn) (struct Lisp_Hash_Table *, + Lisp_Object, EMACS_UINT, + Lisp_Object, EMACS_UINT); /* C function to compute hash code. */ EMACS_UINT (*hashfn) (struct Lisp_Hash_Table *, Lisp_Object); @@ -1632,7 +1624,7 @@ typedef struct { int mouse_face_image_state; } Mouse_HLInfo; -/* Data type checking */ +/* Data type checking. */ #define NILP(x) EQ (x, Qnil) @@ -2005,7 +1997,7 @@ struct specbinding { Lisp_Object symbol, old_value; specbinding_func func; - Lisp_Object unused; /* Dividing by 16 is faster than by 12 */ + Lisp_Object unused; /* Dividing by 16 is faster than by 12. */ }; extern struct specbinding *specpdl; @@ -2293,7 +2285,7 @@ extern int gcpro_level; #define UNGCPRO \ ((--gcpro_level != gcpro1.level) \ - ? (abort (), 0) \ + ? (emacs_abort (), 0) \ : ((gcprolist = gcpro1.next), 0)) #endif /* DEBUG_GCPRO */ @@ -2584,10 +2576,10 @@ extern Lisp_Object Qfont_spec, Qfont_entity, Qfont_object; EXFUN (Fbyteorder, 0) ATTRIBUTE_CONST; -/* Defined in frame.c */ +/* Defined in frame.c. */ extern Lisp_Object Qframep; -/* Defined in data.c */ +/* Defined in data.c. */ extern Lisp_Object indirect_function (Lisp_Object); extern Lisp_Object find_symbol_value (Lisp_Object); @@ -2634,7 +2626,7 @@ extern void swap_in_global_binding (struct Lisp_Symbol *); extern void syms_of_cmds (void); extern void keys_of_cmds (void); -/* Defined in coding.c */ +/* Defined in coding.c. */ extern Lisp_Object Qcharset; extern Lisp_Object detect_coding_system (const unsigned char *, ptrdiff_t, ptrdiff_t, bool, bool, Lisp_Object); @@ -2642,7 +2634,7 @@ extern void init_coding (void); extern void init_coding_once (void); extern void syms_of_coding (void); -/* Defined in character.c */ +/* 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); @@ -2650,21 +2642,21 @@ 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 */ +/* Defined in charset.c. */ extern void init_charset (void); extern void init_charset_once (void); extern void syms_of_charset (void); /* Structure forward declarations. */ struct charset; -/* Defined in composite.c */ +/* Defined in composite.c. */ extern void syms_of_composite (void); -/* Defined in syntax.c */ +/* Defined in syntax.c. */ extern void init_syntax_once (void); extern void syms_of_syntax (void); -/* Defined in fns.c */ +/* Defined in fns.c. */ extern Lisp_Object QCrehash_size, QCrehash_threshold; enum { NEXT_ALMOST_PRIME_LIMIT = 11 }; EXFUN (Fidentity, 1) ATTRIBUTE_CONST; @@ -2698,13 +2690,12 @@ extern Lisp_Object string_to_multibyte (Lisp_Object); extern Lisp_Object string_make_unibyte (Lisp_Object); extern void syms_of_fns (void); -/* Defined in floatfns.c */ +/* Defined in floatfns.c. */ extern double extract_float (Lisp_Object); -extern void init_floatfns (void); extern void syms_of_floatfns (void); extern Lisp_Object fmod_float (Lisp_Object x, Lisp_Object y); -/* Defined in fringe.c */ +/* Defined in fringe.c. */ extern void syms_of_fringe (void); extern void init_fringe (void); #ifdef HAVE_WINDOW_SYSTEM @@ -2712,13 +2703,13 @@ extern void mark_fringe_data (void); extern void init_fringe_once (void); #endif /* HAVE_WINDOW_SYSTEM */ -/* Defined in image.c */ +/* Defined in image.c. */ extern Lisp_Object QCascent, QCmargin, QCrelief; extern Lisp_Object QCconversion; extern int x_bitmap_mask (struct frame *, ptrdiff_t); extern void syms_of_image (void); -/* Defined in insdel.c */ +/* Defined in insdel.c. */ extern Lisp_Object Qinhibit_modification_hooks; extern void move_gap (ptrdiff_t); extern void move_gap_both (ptrdiff_t, ptrdiff_t); @@ -2764,7 +2755,7 @@ extern void replace_range_2 (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t, const char *, ptrdiff_t, ptrdiff_t, bool); extern void syms_of_insdel (void); -/* Defined in dispnew.c */ +/* Defined in dispnew.c. */ #if (defined PROFILING \ && (defined __FreeBSD__ || defined GNU_LINUX || defined __MINGW32__)) _Noreturn void __executable_start (void); @@ -2775,7 +2766,7 @@ extern Lisp_Object sit_for (Lisp_Object, bool, int); extern void init_display (void); extern void syms_of_display (void); -/* Defined in xdisp.c */ +/* Defined in xdisp.c. */ extern Lisp_Object Qinhibit_point_motion_hooks; extern Lisp_Object Qinhibit_redisplay, Qdisplay; extern Lisp_Object Qmenu_bar_update_hook; @@ -2826,13 +2817,13 @@ extern Lisp_Object safe_eval (Lisp_Object); extern int pos_visible_p (struct window *, ptrdiff_t, int *, int *, int *, int *, int *, int *); -/* Defined in xsettings.c */ +/* Defined in xsettings.c. */ extern void syms_of_xsettings (void); /* Defined in vm-limit.c. */ extern void memory_warnings (void *, void (*warnfun) (const char *)); -/* Defined in alloc.c */ +/* Defined in alloc.c. */ extern void check_pure_size (void); extern void allocate_string_data (struct Lisp_String *, EMACS_INT, EMACS_INT); extern void reset_malloc_hooks (void); @@ -2935,7 +2926,7 @@ extern void check_cons_list (void); #endif #ifdef REL_ALLOC -/* Defined in ralloc.c */ +/* Defined in ralloc.c. */ extern void *r_alloc (void **, size_t); extern void r_alloc_free (void **); extern void *r_re_alloc (void **, size_t); @@ -2943,7 +2934,7 @@ extern void r_alloc_reset_variable (void **, void **); extern void r_alloc_inhibit_buffer_relocation (int); #endif -/* Defined in chartab.c */ +/* 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, @@ -2961,7 +2952,7 @@ extern void map_char_table_for_charset (void (*c_function) (Lisp_Object, Lisp_Ob extern Lisp_Object uniprop_table (Lisp_Object); extern void syms_of_chartab (void); -/* Defined in print.c */ +/* Defined in print.c. */ extern Lisp_Object Vprin1_to_string_buffer; extern void debug_print (Lisp_Object) EXTERNALLY_VISIBLE; extern Lisp_Object Qstandard_output; @@ -2978,7 +2969,7 @@ enum FLOAT_TO_STRING_BUFSIZE { FLOAT_TO_STRING_BUFSIZE = 350 }; extern int float_to_string (char *, double); extern void syms_of_print (void); -/* Defined in doprnt.c */ +/* Defined in doprnt.c. */ extern ptrdiff_t doprnt (char *, ptrdiff_t, const char *, const char *, va_list); extern ptrdiff_t esprintf (char *, char const *, ...) @@ -3081,6 +3072,7 @@ extern _Noreturn void error (const char *, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2); extern _Noreturn void verror (const char *, va_list) ATTRIBUTE_FORMAT_PRINTF (1, 0); extern Lisp_Object un_autoload (Lisp_Object); +extern Lisp_Object call_debugger (Lisp_Object arg); extern void init_eval_once (void); extern Lisp_Object safe_call (ptrdiff_t, Lisp_Object, ...); extern Lisp_Object safe_call1 (Lisp_Object, Lisp_Object); @@ -3143,7 +3135,7 @@ extern Lisp_Object set_marker_restricted_both (Lisp_Object, Lisp_Object, extern Lisp_Object build_marker (struct buffer *, ptrdiff_t, ptrdiff_t); extern void syms_of_marker (void); -/* Defined in fileio.c */ +/* Defined in fileio.c. */ extern Lisp_Object Qfile_error; extern Lisp_Object Qfile_exists_p; @@ -3151,16 +3143,16 @@ extern Lisp_Object Qfile_directory_p; extern Lisp_Object Qinsert_file_contents; extern Lisp_Object Qfile_name_history; extern Lisp_Object expand_and_dir_to_file (Lisp_Object, Lisp_Object); -EXFUN (Fread_file_name, 6); /* not a normal DEFUN */ +EXFUN (Fread_file_name, 6); /* Not a normal DEFUN. */ extern Lisp_Object close_file_unwind (Lisp_Object); extern Lisp_Object restore_point_unwind (Lisp_Object); extern _Noreturn void report_file_error (const char *, Lisp_Object); -extern int internal_delete_file (Lisp_Object); +extern void internal_delete_file (Lisp_Object); extern void syms_of_fileio (void); -extern Lisp_Object make_temp_name (Lisp_Object, int); +extern Lisp_Object make_temp_name (Lisp_Object, bool); extern Lisp_Object Qdelete_file; -/* Defined in search.c */ +/* Defined in search.c. */ extern void shrink_regexp_cache (void); extern void restore_search_regs (void); extern void record_unwind_save_match_data (void); @@ -3233,9 +3225,7 @@ extern void cmd_error_internal (Lisp_Object, const char *); extern Lisp_Object command_loop_1 (void); extern Lisp_Object recursive_edit_1 (void); extern void record_auto_save (void); -#ifdef SIGDANGER extern void force_auto_save_soon (void); -#endif extern void init_keyboard (void); extern void syms_of_keyboard (void); extern void keys_of_keyboard (void); @@ -3268,9 +3258,7 @@ extern bool display_arg; extern Lisp_Object decode_env_path (const char *, const char *); extern Lisp_Object empty_unibyte_string, empty_multibyte_string; extern Lisp_Object Qfile_name_handler_alist; -#ifdef FLOAT_CATCH_SIGILL -extern void fatal_error_signal (int); -#endif +extern _Noreturn void fatal_error_backtrace (int, int); extern Lisp_Object Qkill_emacs; #if HAVE_SETLOCALE void fixup_locale (void); @@ -3339,14 +3327,14 @@ extern void init_callproc (void); extern void set_initial_environment (void); extern void syms_of_callproc (void); -/* Defined in doc.c */ +/* Defined in doc.c. */ extern Lisp_Object Qfunction_documentation; extern Lisp_Object read_doc_string (Lisp_Object); extern Lisp_Object get_doc_string (Lisp_Object, bool, bool); extern void syms_of_doc (void); extern int read_bytecode_char (bool); -/* Defined in bytecode.c */ +/* Defined in bytecode.c. */ extern Lisp_Object Qbytecode; extern void syms_of_bytecode (void); extern struct byte_stack *byte_stack_list; @@ -3357,12 +3345,12 @@ extern void unmark_byte_stack (void); extern Lisp_Object exec_byte_code (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, ptrdiff_t, Lisp_Object *); -/* Defined in macros.c */ +/* Defined in macros.c. */ extern Lisp_Object Qexecute_kbd_macro; extern void init_macros (void); extern void syms_of_macros (void); -/* Defined in undo.c */ +/* Defined in undo.c. */ extern Lisp_Object Qapply; extern Lisp_Object Qinhibit_read_only; extern void truncate_undo_list (struct buffer *); @@ -3375,7 +3363,7 @@ extern void record_property_change (ptrdiff_t, ptrdiff_t, Lisp_Object, Lisp_Object, Lisp_Object); extern void syms_of_undo (void); -/* Defined in textprop.c */ +/* Defined in textprop.c. */ extern Lisp_Object Qfont, Qmouse_face; extern Lisp_Object Qinsert_in_front_hooks, Qinsert_behind_hooks; extern Lisp_Object Qfront_sticky, Qrear_nonsticky; @@ -3383,19 +3371,19 @@ extern Lisp_Object Qminibuffer_prompt; extern void report_interval_modification (Lisp_Object, Lisp_Object); -/* Defined in menu.c */ +/* Defined in menu.c. */ extern void syms_of_menu (void); -/* Defined in xmenu.c */ +/* Defined in xmenu.c. */ extern void syms_of_xmenu (void); -/* Defined in termchar.h */ +/* Defined in termchar.h. */ struct tty_display_info; -/* Defined in termhooks.h */ +/* Defined in termhooks.h. */ struct terminal; -/* Defined in sysdep.c */ +/* Defined in sysdep.c. */ #ifndef HAVE_GET_CURRENT_DIR_NAME extern char *get_current_dir_name (void); #endif @@ -3417,6 +3405,8 @@ extern int set_window_size (int, int, int); extern EMACS_INT get_random (void); extern void seed_random (void *, ptrdiff_t); extern void init_random (void); +extern void emacs_backtrace (int); +extern _Noreturn void emacs_abort (void) NO_INLINE; extern int emacs_open (const char *, int, int); extern int emacs_close (int); extern ptrdiff_t emacs_read (int, char *, ptrdiff_t); @@ -3430,45 +3420,45 @@ extern void unlock_file (Lisp_Object); extern void unlock_buffer (struct buffer *); extern void syms_of_filelock (void); -/* Defined in sound.c */ +/* Defined in sound.c. */ extern void syms_of_sound (void); -/* Defined in category.c */ +/* Defined in category.c. */ extern void init_category_once (void); extern Lisp_Object char_category_set (int); extern void syms_of_category (void); -/* Defined in ccl.c */ +/* Defined in ccl.c. */ extern void syms_of_ccl (void); -/* Defined in dired.c */ +/* Defined in dired.c. */ extern void syms_of_dired (void); extern Lisp_Object directory_files_internal (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, bool, Lisp_Object); -/* Defined in term.c */ +/* Defined in term.c. */ extern int *char_ins_del_vector; extern void syms_of_term (void); extern _Noreturn void fatal (const char *msgid, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2); -/* Defined in terminal.c */ +/* Defined in terminal.c. */ extern void syms_of_terminal (void); -/* Defined in font.c */ +/* Defined in font.c. */ extern void syms_of_font (void); extern void init_font (void); #ifdef HAVE_WINDOW_SYSTEM -/* Defined in fontset.c */ +/* Defined in fontset.c. */ extern void syms_of_fontset (void); -/* Defined in xfns.c, w32fns.c, or macfns.c */ +/* Defined in xfns.c, w32fns.c, or macfns.c. */ extern Lisp_Object Qfont_param; #endif -/* Defined in xfaces.c */ +/* Defined in xfaces.c. */ extern Lisp_Object Qdefault, Qtool_bar, Qfringe; extern Lisp_Object Qheader_line, Qscroll_bar, Qcursor; extern Lisp_Object Qmode_line_inactive; @@ -3484,26 +3474,26 @@ extern Lisp_Object Vface_alternative_font_registry_alist; extern void syms_of_xfaces (void); #ifdef HAVE_X_WINDOWS -/* Defined in xfns.c */ +/* Defined in xfns.c. */ extern void syms_of_xfns (void); -/* Defined in xsmfns.c */ +/* Defined in xsmfns.c. */ extern void syms_of_xsmfns (void); -/* Defined in xselect.c */ +/* Defined in xselect.c. */ extern void syms_of_xselect (void); -/* Defined in xterm.c */ +/* Defined in xterm.c. */ extern void syms_of_xterm (void); #endif /* HAVE_X_WINDOWS */ #ifdef HAVE_WINDOW_SYSTEM -/* Defined in xterm.c, nsterm.m, w32term.c */ +/* Defined in xterm.c, nsterm.m, w32term.c. */ extern char *x_get_keysym_name (int); #endif /* HAVE_WINDOW_SYSTEM */ #ifdef HAVE_LIBXML2 -/* Defined in xml.c */ +/* Defined in xml.c. */ extern void syms_of_xml (void); extern void xml_cleanup_parser (void); #endif @@ -3514,12 +3504,12 @@ extern int have_menus_p (void); #endif #ifdef HAVE_DBUS -/* Defined in dbusbind.c */ +/* Defined in dbusbind.c. */ void syms_of_dbusbind (void); #endif #ifdef DOS_NT -/* Defined in msdos.c, w32.c */ +/* Defined in msdos.c, w32.c. */ extern char *emacs_root_dir (void); #endif /* DOS_NT */ @@ -3527,7 +3517,7 @@ extern char *emacs_root_dir (void); Used during startup to detect startup of dumped Emacs. */ extern bool initialized; -extern int immediate_quit; /* Nonzero means ^G can quit instantly */ +extern int immediate_quit; /* Nonzero means ^G can quit instantly. */ extern void *xmalloc (size_t); extern void *xzalloc (size_t); @@ -3557,36 +3547,10 @@ extern void init_system_name (void); #define make_fixnum_or_float(val) \ (FIXNUM_OVERFLOW_P (val) ? make_float (val) : make_number (val)) - -/* Checks the `cycle check' variable CHECK to see if it indicates that - EL is part of a cycle; CHECK must be either Qnil or a value returned - by an earlier use of CYCLE_CHECK. SUSPICIOUS is the number of - elements after which a cycle might be suspected; after that many - elements, this macro begins consing in order to keep more precise - track of elements. - - Returns nil if a cycle was detected, otherwise a new value for CHECK - that includes EL. - - CHECK is evaluated multiple times, EL and SUSPICIOUS 0 or 1 times, so - the caller should make sure that's ok. */ - -#define CYCLE_CHECK(check, el, suspicious) \ - (NILP (check) \ - ? make_number (0) \ - : (INTEGERP (check) \ - ? (XFASTINT (check) < (suspicious) \ - ? make_number (XFASTINT (check) + 1) \ - : Fcons (el, Qnil)) \ - : (!NILP (Fmemq ((el), (check))) \ - ? Qnil \ - : Fcons ((el), (check))))) - - /* SAFE_ALLOCA normally allocates memory on the stack, but if size is larger than MAX_ALLOCA, use xmalloc to avoid overflowing the stack. */ -enum MAX_ALLOCA { MAX_ALLOCA = 16*1024 }; +enum MAX_ALLOCA { MAX_ALLOCA = 16 * 1024 }; extern Lisp_Object safe_alloca_unwind (Lisp_Object); extern void *record_xmalloc (size_t); diff --git a/src/lisp.mk b/src/lisp.mk index 162d8819917..3d60e07dea3 100644 --- a/src/lisp.mk +++ b/src/lisp.mk @@ -65,6 +65,7 @@ lisp = \ $(lispsource)/format.elc \ $(lispsource)/bindings.elc \ $(lispsource)/files.elc \ + $(lispsource)/emacs-lisp/macroexp.elc \ $(lispsource)/cus-face.elc \ $(lispsource)/faces.elc \ $(lispsource)/button.elc \ diff --git a/src/lread.c b/src/lread.c index 1dd6275684b..02b13affb6a 100644 --- a/src/lread.c +++ b/src/lread.c @@ -50,7 +50,6 @@ along with GNU Emacs. If not, see . */ #endif #include -#include #ifdef HAVE_SETLOCALE #include @@ -1680,6 +1679,17 @@ readevalloop (Lisp_Object readcharfun, int whole_buffer = 0; /* 1 on the first time around. */ int first_sexp = 1; + Lisp_Object macroexpand = intern ("internal-macroexpand-for-load"); + + if (NILP (Ffboundp (macroexpand)) + /* Don't macroexpand in .elc files, since it should have been done + already. We actually don't know whether we're in a .elc file or not, + so we use circumstancial evidence: .el files normally go through + Vload_source_file_function -> load-with-code-conversion + -> eval-buffer. */ + || EQ (readcharfun, Qget_file_char) + || EQ (readcharfun, Qget_emacs_mule_file_char)) + macroexpand = Qnil; if (MARKERP (readcharfun)) { @@ -1694,7 +1704,7 @@ readevalloop (Lisp_Object readcharfun, /* We assume START is nil when input is not from a buffer. */ if (! NILP (start) && !b) - abort (); + emacs_abort (); specbind (Qstandard_input, readcharfun); /* GCPROs readcharfun. */ specbind (Qcurrent_load_list, Qnil); @@ -1809,6 +1819,8 @@ readevalloop (Lisp_Object readcharfun, unbind_to (count1, Qnil); /* Now eval what we just read. */ + if (!NILP (macroexpand)) + val = call1 (macroexpand, val); val = eval_sub (val); if (printflag) @@ -3671,7 +3683,7 @@ intern_c_string_1 (const char *str, ptrdiff_t len) /* Creating a non-pure string from a string literal not implemented yet. We could just use make_string here and live with the extra copy. */ - abort (); + emacs_abort (); return Fintern (make_pure_c_string (str, len), obarray); } diff --git a/src/makefile.w32-in b/src/makefile.w32-in index a8dcf5f2ae8..7b9c67bf135 100644 --- a/src/makefile.w32-in +++ b/src/makefile.w32-in @@ -1365,6 +1365,7 @@ $(BLD)/sysdep.$(O) : \ $(NT_INC)/sys/stat.h \ $(NT_INC)/unistd.h \ $(GNU_LIB)/allocator.h \ + $(GNU_LIB)/execinfo.h \ $(GNU_LIB)/ignore-value.h \ $(GNU_LIB)/utimens.h \ $(BLOCKINPUT_H) \ diff --git a/src/marker.c b/src/marker.c index 4ea06c7cd57..de3c19c3bcb 100644 --- a/src/marker.c +++ b/src/marker.c @@ -59,7 +59,7 @@ byte_char_debug_check (struct buffer *b, ptrdiff_t charpos, ptrdiff_t bytepos) bytepos - BUF_BEG_BYTE (b)); if (charpos - 1 != nchars) - abort (); + emacs_abort (); } #else /* not MARKER_DEBUG */ @@ -67,7 +67,7 @@ byte_char_debug_check (struct buffer *b, ptrdiff_t charpos, ptrdiff_t bytepos) #define byte_char_debug_check(b, charpos, bytepos) do { } while (0) #endif /* MARKER_DEBUG */ - + void clear_charpos_cache (struct buffer *b) { @@ -142,7 +142,7 @@ buf_charpos_to_bytepos (struct buffer *b, ptrdiff_t charpos) ptrdiff_t best_below, best_below_byte; if (charpos < BUF_BEG (b) || charpos > BUF_Z (b)) - abort (); + emacs_abort (); best_above = BUF_Z (b); best_above_byte = BUF_Z_BYTE (b); @@ -296,7 +296,7 @@ buf_bytepos_to_charpos (struct buffer *b, ptrdiff_t bytepos) ptrdiff_t best_below, best_below_byte; if (bytepos < BUF_BEG_BYTE (b) || bytepos > BUF_Z_BYTE (b)) - abort (); + emacs_abort (); best_above = BUF_Z (b); best_above_byte = BUF_Z_BYTE (b); @@ -506,7 +506,7 @@ set_marker_internal (Lisp_Object marker, Lisp_Object position, else { register ptrdiff_t charpos, bytepos; - + CHECK_NUMBER_COERCE_MARKER (position); charpos = clip_to_bounds (restricted ? BUF_BEGV (b) : BUF_BEG (b), XINT (position), @@ -570,8 +570,8 @@ set_marker_restricted_both (Lisp_Object marker, Lisp_Object buffer, if (b) { - attach_marker - (m, b, + attach_marker + (m, b, clip_to_bounds (BUF_BEGV (b), charpos, BUF_ZV (b)), clip_to_bounds (BUF_BEGV_BYTE (b), bytepos, BUF_ZV_BYTE (b))); } @@ -605,12 +605,12 @@ unchain_marker (register struct Lisp_Marker *marker) { if (*prev == BUF_MARKERS (b)) { - /* Deleting first marker from the buffer's chain. Crash + /* Deleting first marker from the buffer's chain. Crash if new first marker in chain does not say it belongs to the same buffer, or at least that they have the same base buffer. */ if (tail->next && b->text != tail->next->buffer->text) - abort (); + emacs_abort (); } *prev = tail->next; /* We have removed the marker from the chain; diff --git a/src/menu.c b/src/menu.c index 20770537326..bfdc68ca118 100644 --- a/src/menu.c +++ b/src/menu.c @@ -733,7 +733,7 @@ digest_single_submenu (int start, int end, int top_level_items) /* All items should be contained in panes. */ if (panes_seen == 0) - abort (); + emacs_abort (); item_name = AREF (menu_items, i + MENU_ITEMS_ITEM_NAME); enable = AREF (menu_items, i + MENU_ITEMS_ITEM_ENABLE); @@ -807,7 +807,7 @@ digest_single_submenu (int start, int end, int top_level_items) else if (EQ (type, QCtoggle)) wv->button_type = BUTTON_TYPE_TOGGLE; else - abort (); + emacs_abort (); wv->selected = !NILP (selected); if (! STRINGP (help)) diff --git a/src/minibuf.c b/src/minibuf.c index 2035a3e3985..655a02f5eca 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -110,7 +110,7 @@ choose_minibuf_frame (void) /* I don't think that any frames may validly have a null minibuffer window anymore. */ if (NILP (sf->minibuffer_window)) - abort (); + emacs_abort (); /* Under X, we come here with minibuf_window being the minibuffer window of the unused termcap window created in diff --git a/src/msdos.c b/src/msdos.c index ac348e94375..ed5d3240aa1 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -796,7 +796,7 @@ IT_set_face (int face) /* The default face for the frame should always be realized and cached. */ if (!fp) - abort (); + emacs_abort (); } screen_face = face; fg = fp->foreground; @@ -1393,7 +1393,7 @@ IT_insert_glyphs (struct frame *f, struct glyph *start, int len) static void IT_delete_glyphs (struct frame *f, int n) { - abort (); + emacs_abort (); } /* set-window-configuration on window.c needs this. */ @@ -3013,7 +3013,7 @@ XMenuAddPane (Display *foo, XMenu *menu, const char *txt, int enable) const char *p; if (!enable) - abort (); + emacs_abort (); IT_menu_make_room (menu); menu->submenu[menu->count] = IT_menu_create (); @@ -4119,7 +4119,7 @@ sys_select (int nfds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds, FD_ZERO (efds); if (nfds != 1) - abort (); + emacs_abort (); /* If we are looking only for the terminal, with no timeout, just read it and wait -- that's more efficient. */ @@ -4214,26 +4214,8 @@ init_gettimeofday (void) } #endif -#ifdef abort -#undef abort void -dos_abort (char *file, int line) -{ - char buffer1[200], buffer2[400]; - int i, j; - - sprintf (buffer1, "", file, line); - for (i = j = 0; buffer1[i]; i++) { - buffer2[j++] = buffer1[i]; - buffer2[j++] = 0x70; - } - dosmemput (buffer2, j, (int)ScreenPrimary); - ScreenSetCursor (2, 0); - abort (); -} -#else -void -abort (void) +emacs_abort (void) { dos_ttcooked (); ScreenSetCursor (10, 0); @@ -4249,7 +4231,6 @@ abort (void) #endif /* __DJGPP_MINOR__ >= 2 */ exit (2); } -#endif void syms_of_msdos (void) diff --git a/src/nsfns.m b/src/nsfns.m index e8b5d22077a..f73086eeee9 100644 --- a/src/nsfns.m +++ b/src/nsfns.m @@ -30,7 +30,6 @@ GNUstep port and post-20 update by Adrian Robert (arobert@cogsci.ucsd.edu) interpretation of even the system includes. */ #include -#include #include #include #include diff --git a/src/nsfont.m b/src/nsfont.m index 412a6777c64..1c9976ec6cc 100644 --- a/src/nsfont.m +++ b/src/nsfont.m @@ -625,7 +625,7 @@ static unsigned int nsfont_encode_char (struct font *font, int c); static int nsfont_text_extents (struct font *font, unsigned int *code, int nglyphs, struct font_metrics *metrics); static int nsfont_draw (struct glyph_string *s, int from, int to, int x, int y, - int with_background); + bool with_background); struct font_driver nsfont_driver = { @@ -833,7 +833,6 @@ nsfont_open (FRAME_PTR f, Lisp_Object font_entity, int pixel_size) font = (struct font *) font_info; font->pixel_size = [sfont pointSize]; font->driver = &nsfont_driver; - font->encoding_type = FONT_ENCODING_NOT_DECIDED; font->encoding_charset = -1; font->repertory_charset = -1; font->default_ascent = 0; @@ -1042,12 +1041,12 @@ nsfont_text_extents (struct font *font, unsigned int *code, int nglyphs, /* Draw glyphs between FROM and TO of S->char2b at (X Y) pixel - position of frame F with S->FACE and S->GC. If WITH_BACKGROUND - is nonzero, fill the background in advance. It is assured that - WITH_BACKGROUND is zero when (FROM > 0 || TO < S->nchars). */ + position of frame F with S->FACE and S->GC. If WITH_BACKGROUND, + fill the background in advance. It is assured that WITH_BACKGROUND + is false when (FROM > 0 || TO < S->nchars). */ static int nsfont_draw (struct glyph_string *s, int from, int to, int x, int y, - int with_background) + bool with_background) /* NOTE: focus and clip must be set also, currently assumed (true in nsterm.m call) from ==0, to ==nchars */ { @@ -1330,7 +1329,7 @@ ns_uni_to_glyphs (struct nsfont_info *font_info, unsigned char block) font_info->glyphs[block] = xmalloc (0x100 * sizeof (unsigned short)); if (!unichars || !(font_info->glyphs[block])) - abort (); + emacs_abort (); /* create a string containing all Unicode characters in this block */ for (idx = block<<8, i = 0; i < 0x100; idx++, i++) @@ -1405,7 +1404,7 @@ ns_glyph_metrics (struct nsfont_info *font_info, unsigned char block) font_info->metrics[block] = xzalloc (0x100 * sizeof (struct font_metrics)); if (!(font_info->metrics[block])) - abort (); + emacs_abort (); metrics = font_info->metrics[block]; for (g = block<<8, i =0; i<0x100 && g < numGlyphs; g++, i++, metrics++) diff --git a/src/nsmenu.m b/src/nsmenu.m index 9e290486213..d0f3e45e939 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m @@ -948,7 +948,7 @@ ns_menu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, else if (EQ (type, QCradio)) wv->button_type = BUTTON_TYPE_RADIO; else - abort (); + emacs_abort (); wv->selected = !NILP (selected); diff --git a/src/nsterm.h b/src/nsterm.h index f0cae193005..b1836692b2c 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -103,6 +103,7 @@ along with GNU Emacs. If not, see . */ - (void) setWindowClosing: (BOOL)closing; - (EmacsToolbar *) toolbar; - (void) deleteWorkingText; +- (void) updateFrameSize; #ifdef NS_IMPL_GNUSTEP /* Not declared, but useful. */ diff --git a/src/nsterm.m b/src/nsterm.m index c892a5486a7..74a3d858710 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -650,7 +650,6 @@ ns_update_window_begin (struct window *w) struct frame *f = XFRAME (WINDOW_FRAME (w)); Mouse_HLInfo *hlinfo = MOUSE_HL_INFO (f); NSTRACE (ns_update_window_begin); - updated_window = w; set_output_cursor (&w->cursor); @@ -871,25 +870,12 @@ ns_clip_to_row (struct window *w, struct glyph_row *row, int area, BOOL gc) window_box (w, area, &window_x, &window_y, &window_width, 0); - clip_rect.origin.x = window_x - FRAME_INTERNAL_BORDER_WIDTH (f); + clip_rect.origin.x = window_x; clip_rect.origin.y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, row->y)); clip_rect.origin.y = max (clip_rect.origin.y, window_y); - clip_rect.size.width = window_width + 2 * FRAME_INTERNAL_BORDER_WIDTH (f); + clip_rect.size.width = window_width; clip_rect.size.height = row->visible_height; - /* allow a full-height row at the top when requested - (used to draw fringe all the way through internal border area) */ - if (gc && clip_rect.origin.y < 5) - { - clip_rect.origin.y -= FRAME_INTERNAL_BORDER_WIDTH (f); - clip_rect.size.height += FRAME_INTERNAL_BORDER_WIDTH (f); - } - - /* likewise at bottom */ - if (gc && - FRAME_PIXEL_HEIGHT (f) - (clip_rect.origin.y + clip_rect.size.height) < 5) - clip_rect.size.height += FRAME_INTERNAL_BORDER_WIDTH (f); - ns_focus (f, &clip_rect, 1); } @@ -1237,18 +1223,10 @@ x_set_window_size (struct frame *f, int change_grav, int cols, int rows) NSRect wr = [window frame]; int tb = FRAME_EXTERNAL_TOOL_BAR (f); int pixelwidth, pixelheight; - static int oldRows, oldCols, oldFontWidth, oldFontHeight; - static int oldTB; - static struct frame *oldF; NSTRACE (x_set_window_size); - if (view == nil || - (f == oldF - && rows == oldRows && cols == oldCols - && oldFontWidth == FRAME_COLUMN_WIDTH (f) - && oldFontHeight == FRAME_LINE_HEIGHT (f) - && oldTB == tb)) + if (view == nil) return; /*fprintf (stderr, "\tsetWindowSize: %d x %d, font size %d x %d\n", cols, rows, FRAME_COLUMN_WIDTH (f), FRAME_LINE_HEIGHT (f)); */ @@ -1256,12 +1234,6 @@ x_set_window_size (struct frame *f, int change_grav, int cols, int rows) BLOCK_INPUT; check_frame_size (f, &rows, &cols); - oldF = f; - oldRows = rows; - oldCols = cols; - oldFontWidth = FRAME_COLUMN_WIDTH (f); - oldFontHeight = FRAME_LINE_HEIGHT (f); - oldTB = tb; f->scroll_bar_actual_width = NS_SCROLL_BAR_WIDTH (f); compute_fringe_widths (f, 0); @@ -1939,7 +1911,7 @@ ns_redraw_scroll_bars (struct frame *f) int i; id view; NSArray *subviews = [[FRAME_NS_VIEW (f) superview] subviews]; - NSTRACE (ns_judge_scroll_bars); + NSTRACE (ns_redraw_scroll_bars); for (i =[subviews count]-1; i >= 0; i--) { view = [subviews objectAtIndex: i]; @@ -2125,9 +2097,9 @@ ns_after_update_window_line (struct glyph_row *desired_row) desired_row->redraw_fringe_bitmaps_p = 1; /* When a window has disappeared, make sure that no rest of - full-width rows stays visible in the internal border. - Under NS this is drawn inside the fringes. */ + full-width rows stays visible in the internal border. */ if (windows_or_buffers_changed + && desired_row->full_width_p && (f = XFRAME (w->frame), width = FRAME_INTERNAL_BORDER_WIDTH (f), width != 0) @@ -2136,24 +2108,11 @@ ns_after_update_window_line (struct glyph_row *desired_row) { int y = WINDOW_TO_FRAME_PIXEL_Y (w, max (0, desired_row->y)); - /* Internal border is drawn below the tool bar. */ - if (WINDOWP (f->tool_bar_window) - && w == XWINDOW (f->tool_bar_window)) - y -= width; - /* end copy from other terms */ - BLOCK_INPUT; - if (!desired_row->full_width_p) - { - int x1 = WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (w) - + WINDOW_LEFT_FRINGE_WIDTH (w); - int x2 = WINDOW_LEFT_SCROLL_BAR_AREA_WIDTH (w) - + FRAME_PIXEL_WIDTH (f) - NS_SCROLL_BAR_WIDTH (f) - - WINDOW_RIGHT_FRINGE_WIDTH (w) - - FRAME_INTERNAL_BORDER_WIDTH (f); - ns_clear_frame_area (f, x1, y, width, height); - ns_clear_frame_area (f, x2, y, width, height); - } + ns_clear_frame_area (f, 0, y, width, height); + ns_clear_frame_area (f, + FRAME_PIXEL_WIDTH (f) - width, + y, width, height); UNBLOCK_INPUT; } } @@ -2238,17 +2197,6 @@ ns_draw_fringe_bitmap (struct window *w, struct glyph_row *row, int rowY; static EmacsImage **bimgs = NULL; static int nBimgs = 0; - /* NS-specific: move internal border inside fringe */ - int x = p->bx < 0 ? p->x : p->bx; - int wd = p->bx < 0 ? p->wd : p->nx; - BOOL fringeOnVeryLeft - = x - WINDOW_LEFT_SCROLL_BAR_COLS (w) * WINDOW_FRAME_COLUMN_WIDTH (w) - - FRAME_INTERNAL_BORDER_WIDTH (f) < 10; - BOOL fringeOnVeryRight - = FRAME_PIXEL_WIDTH (f) - x - wd - FRAME_INTERNAL_BORDER_WIDTH (f) - - WINDOW_RIGHT_SCROLL_BAR_COLS (w) * WINDOW_FRAME_COLUMN_WIDTH (w) < 10; - int xAdjust = FRAME_INTERNAL_BORDER_WIDTH (f) * - (fringeOnVeryLeft ? -1 : (fringeOnVeryRight ? 1 : 0)); /* grow bimgs if needed */ if (nBimgs < max_used_fringe_bitmap) @@ -2263,22 +2211,68 @@ ns_draw_fringe_bitmap (struct window *w, struct glyph_row *row, rowY = WINDOW_TO_FRAME_PIXEL_Y (w, row->y); ns_clip_to_row (w, row, -1, YES); - if (p->bx >= 0 && !p->overlay_p) + if (!p->overlay_p) { - int yAdjust = rowY - FRAME_INTERNAL_BORDER_WIDTH (f) < 5 ? - -FRAME_INTERNAL_BORDER_WIDTH (f) : 0; - int yIncr = FRAME_PIXEL_HEIGHT (f) - (p->by+yAdjust + p->ny) < 5 ? - FRAME_INTERNAL_BORDER_WIDTH (f) : 0 - + (yAdjust ? FRAME_INTERNAL_BORDER_WIDTH (f) : 0); - NSRect r = NSMakeRect (p->bx+xAdjust, p->by+yAdjust, p->nx, p->ny+yIncr); - NSRectClip (r); - [ns_lookup_indexed_color(face->background, f) set]; - NSRectFill (r); + int bx = p->bx, by = p->by, nx = p->nx, ny = p->ny; + + /* If the fringe is adjacent to the left (right) scroll bar of a + leftmost (rightmost, respectively) window, then extend its + background to the gap between the fringe and the bar. */ + if ((WINDOW_LEFTMOST_P (w) + && WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (w)) + || (WINDOW_RIGHTMOST_P (w) + && WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_RIGHT (w))) + { + int sb_width = WINDOW_CONFIG_SCROLL_BAR_WIDTH (w); + + if (sb_width > 0) + { + int bar_area_x = WINDOW_SCROLL_BAR_AREA_X (w); + int bar_area_width = (WINDOW_CONFIG_SCROLL_BAR_COLS (w) + * FRAME_COLUMN_WIDTH (f)); + + if (bx < 0) + { + /* Bitmap fills the fringe. */ + if (bar_area_x + bar_area_width == p->x) + bx = bar_area_x + sb_width; + else if (p->x + p->wd == bar_area_x) + bx = bar_area_x; + if (bx >= 0) + { + int header_line_height = WINDOW_HEADER_LINE_HEIGHT (w); + + nx = bar_area_width - sb_width; + by = WINDOW_TO_FRAME_PIXEL_Y (w, max (header_line_height, + row->y)); + ny = row->visible_height; + } + } + else + { + if (bar_area_x + bar_area_width == bx) + { + bx = bar_area_x + sb_width; + nx += bar_area_width - sb_width; + } + else if (bx + nx == bar_area_x) + nx += bar_area_width - sb_width; + } + } + } + + if (bx >= 0 && nx > 0) + { + NSRect r = NSMakeRect (bx, by, nx, ny); + NSRectClip (r); + [ns_lookup_indexed_color (face->background, f) set]; + NSRectFill (r); + } } if (p->which) { - NSRect r = NSMakeRect (p->x+xAdjust, p->y, p->wd, p->h); + NSRect r = NSMakeRect (p->x, p->y, p->wd, p->h); EmacsImage *img = bimgs[p->which - 1]; if (!img) @@ -2288,7 +2282,7 @@ ns_draw_fringe_bitmap (struct window *w, struct glyph_row *row, int i; unsigned char *cbits = xmalloc (len); - for (i =0; ih flip: NO]; @@ -2302,12 +2296,20 @@ ns_draw_fringe_bitmap (struct window *w, struct glyph_row *row, [ns_lookup_indexed_color(face->background, f) set]; NSRectFill (r); [img setXBMColor: ns_lookup_indexed_color(face->foreground, f)]; +#if !defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 [img drawInRect: r fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0 respectFlipped: YES hints: nil]; +#else + { + NSPoint pt = r.origin; + pt.y += p->h; + [img compositeToPoint: pt operation: NSCompositeSourceOver]; + } +#endif } ns_unfocus (f); } @@ -2386,14 +2388,6 @@ ns_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, r.size.height = h; r.size.width = w->phys_cursor_width; - /* FIXME: if we overwrite the internal border area, it does not get erased; - fix by truncating cursor, but better would be to erase properly */ - overspill = r.origin.x + r.size.width - - WINDOW_TEXT_TO_FRAME_PIXEL_X (w, WINDOW_BOX_RIGHT_EDGE_X (w) - - WINDOW_TOTAL_FRINGE_WIDTH (w) - FRAME_INTERNAL_BORDER_WIDTH (f)); - if (overspill > 0) - r.size.width -= overspill; - /* TODO: only needed in rare cases with last-resort font in HELLO.. should we do this more efficiently? */ ns_clip_to_row (w, glyph_row, -1, NO); /* do ns_focus(f, &r, 1); if remove */ @@ -2517,31 +2511,6 @@ hide_hourglass (void) ========================================================================== */ - -static inline NSRect -ns_fix_rect_ibw (NSRect r, int fibw, int frame_pixel_width) -/* -------------------------------------------------------------------------- - Under NS we draw internal borders inside fringes, and want full-width - rendering to go all the way to edge. This function makes that correction. - -------------------------------------------------------------------------- */ -{ - if (r.origin.y <= fibw+1) - { - r.size.height += r.origin.y; - r.origin.y = 0; - } - if (r.origin.x <= fibw+1) - { - r.size.width += r.origin.x; - r.origin.x = 0; - } - if (frame_pixel_width - (r.origin.x+r.size.width) <= fibw+1) - r.size.width += fibw; - - return r; -} - - static int ns_get_glyph_string_clip_rect (struct glyph_string *s, NativeRectangle *nr) /* -------------------------------------------------------------------------- @@ -2551,14 +2520,6 @@ ns_get_glyph_string_clip_rect (struct glyph_string *s, NativeRectangle *nr) -------------------------------------------------------------------------- */ { int n = get_glyph_string_clip_rects (s, nr, 2); - if (s->row->full_width_p) - { - *nr = ns_fix_rect_ibw (*nr, FRAME_INTERNAL_BORDER_WIDTH (s->f), - FRAME_PIXEL_WIDTH (s->f)); - if (n == 2) - *nr = ns_fix_rect_ibw (*(nr+1), FRAME_INTERNAL_BORDER_WIDTH (s->f), - FRAME_PIXEL_WIDTH (s->f)); - } return n; } @@ -2883,11 +2844,6 @@ ns_dumpglyphs_box_or_relief (struct glyph_string *s) r = NSMakeRect (s->x, s->y, right_x - s->x + 1, s->height); - /* expand full-width row over internal borders */ - if (s->row->full_width_p) - r = ns_fix_rect_ibw (r, FRAME_INTERNAL_BORDER_WIDTH (s->f), - FRAME_PIXEL_WIDTH (s->f)); - /* TODO: Sometimes box_color is 0 and this seems wrong; should investigate. */ if (s->face->box == FACE_SIMPLE_BOX && s->face->box_color) { @@ -2943,26 +2899,6 @@ ns_maybe_dumpglyphs_background (struct glyph_string *s, char force_p) NSRect r = NSMakeRect (s->x, s->y + box_line_width, s->background_width, s->height-2*box_line_width); - - /* expand full-width row over internal borders */ - if (s->row->full_width_p) - { - int fibw = FRAME_INTERNAL_BORDER_WIDTH (s->f); - if (r.origin.y <= fibw+1 + box_line_width) - { - r.size.height += r.origin.y; - r.origin.y = 0; - } - if (r.origin.x <= fibw+1) - { - r.size.width += 2*r.origin.x; - r.origin.x = 0; - } - if (FRAME_PIXEL_WIDTH (s->f) - (r.origin.x + r.size.width) - <= fibw+1) - r.size.width += fibw; - } - NSRectFill (r); } @@ -3028,34 +2964,23 @@ ns_dumpglyphs_image (struct glyph_string *s, NSRect r) br = NSMakeRect (x, y, s->slice.width, s->slice.height); } - /* expand full-width row over internal borders */ - if (s->row->full_width_p) - { - int fibw = FRAME_INTERNAL_BORDER_WIDTH (s->f); - if (br.origin.y <= fibw+1 + box_line_vwidth) - { - br.size.height += br.origin.y; - br.origin.y = 0; - } - if (br.origin.x <= fibw+1 + box_line_vwidth) - { - br.size.width += br.origin.x; - br.origin.x = 0; - } - if (FRAME_PIXEL_WIDTH (s->f) - (br.origin.x + br.size.width) <= fibw+1) - br.size.width += fibw; - } - NSRectFill (br); /* Draw the image.. do we need to draw placeholder if img ==nil? */ if (img != nil) + { +#if !defined (NS_IMPL_COCOA) || MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6 [img drawInRect: br - fromRect: NSZeroRect + fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0 respectFlipped: YES hints: nil]; +#else + [img compositeToPoint: NSMakePoint (x, y + s->slice.height) + operation: NSCompositeSourceOver]; +#endif + } if (s->hl == DRAW_CURSOR) { @@ -3143,7 +3068,7 @@ ns_dumpglyphs_stretch (struct glyph_string *s) bgCol = ns_lookup_indexed_color (NS_FACE_BACKGROUND (face), s->f); fgCol = ns_lookup_indexed_color (NS_FACE_FOREGROUND (face), s->f); - for (i=0; irow->full_width_p) { @@ -3173,13 +3098,6 @@ ns_dumpglyphs_stretch (struct glyph_string *s) r[i].size.height = min (s->height, s->row->visible_height); } - /* expand full-width rows over internal borders */ - else - { - r[i] = ns_fix_rect_ibw (r[i], FRAME_INTERNAL_BORDER_WIDTH (s->f), - FRAME_PIXEL_WIDTH (s->f)); - } - [bgCol set]; /* NOTE: under NS this is NOT used to draw cursors, but we must avoid @@ -3340,7 +3258,7 @@ ns_draw_glyph_string (struct glyph_string *s) break; default: - abort (); + emacs_abort (); } /* Draw box if not done already. */ @@ -3475,7 +3393,7 @@ ns_read_socket (struct terminal *terminal, int expected, if (++apploopnr != 1) { - abort (); + emacs_abort (); } [NSApp run]; --apploopnr; @@ -3515,7 +3433,7 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds, [outerpool release]; outerpool = [[NSAutoreleasePool alloc] init]; - + send_appdefined = YES; if (nr > 0) { @@ -3568,7 +3486,7 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds, emacs_event = &event; if (++apploopnr != 1) { - abort(); + emacs_abort (); } [NSApp run]; --apploopnr; @@ -3586,7 +3504,7 @@ ns_select (int nfds, fd_set *readfds, fd_set *writefds, { int t; if ([ev type] != NSApplicationDefined) - abort (); + emacs_abort (); t = [ev data1]; last_appdefined_event = 0; @@ -3639,9 +3557,9 @@ ns_set_vertical_scroll_bar (struct window *window, struct frame *f = XFRAME (WINDOW_FRAME (window)); EmacsView *view = FRAME_NS_VIEW (f); int window_y, window_height; - BOOL barOnVeryLeft, barOnVeryRight; int top, left, height, width, sb_width, sb_left; EmacsScroller *bar; + BOOL fringe_extended_p; /* optimization; display engine sends WAY too many of these.. */ if (!NILP (window->vertical_scroll_bar)) @@ -3668,26 +3586,27 @@ ns_set_vertical_scroll_bar (struct window *window, width = WINDOW_CONFIG_SCROLL_BAR_COLS (window) * FRAME_COLUMN_WIDTH (f); left = WINDOW_SCROLL_BAR_AREA_X (window); - if (top < 5) /* top scrollbar adjustment */ - { - top -= FRAME_INTERNAL_BORDER_WIDTH (f); - height += FRAME_INTERNAL_BORDER_WIDTH (f); - } - /* allow for displaying a skinnier scrollbar than char area allotted */ sb_width = (WINDOW_CONFIG_SCROLL_BAR_WIDTH (window) > 0) ? WINDOW_CONFIG_SCROLL_BAR_WIDTH (window) : width; - - barOnVeryLeft = left < 5; - barOnVeryRight = FRAME_PIXEL_WIDTH (f) - left - width < 5; - sb_left = left + FRAME_INTERNAL_BORDER_WIDTH (f) - * (barOnVeryLeft ? -1 : (barOnVeryRight ? 1 : 0)); + sb_left = left; r = NSMakeRect (sb_left, top, sb_width, height); /* the parent view is flipped, so we need to flip y value */ v = [view frame]; r.origin.y = (v.size.height - r.size.height - r.origin.y); + if (WINDOW_HAS_VERTICAL_SCROLL_BAR_ON_LEFT (window)) + fringe_extended_p = (WINDOW_LEFTMOST_P (window) + && WINDOW_LEFT_FRINGE_WIDTH (window) + && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (window) + || WINDOW_LEFT_MARGIN_COLS (window) == 0)); + else + fringe_extended_p = (WINDOW_RIGHTMOST_P (window) + && WINDOW_RIGHT_FRINGE_WIDTH (window) + && (WINDOW_HAS_FRINGES_OUTSIDE_MARGINS (window) + || WINDOW_RIGHT_MARGIN_COLS (window) == 0)); + XSETWINDOW (win, window); BLOCK_INPUT; @@ -3707,7 +3626,14 @@ ns_set_vertical_scroll_bar (struct window *window, if (NILP (window->vertical_scroll_bar)) { - ns_clear_frame_area (f, sb_left, top, width, height); + if (width > 0 && height > 0) + { + if (fringe_extended_p) + ns_clear_frame_area (f, sb_left, top, sb_width, height); + else + ns_clear_frame_area (f, left, top, width, height); + } + bar = [[EmacsScroller alloc] initFrame: r window: win]; wset_vertical_scroll_bar (window, make_save_value (bar, 0)); } @@ -3778,14 +3704,21 @@ ns_judge_scroll_bars (struct frame *f) { int i; id view; - NSArray *subviews = [[FRAME_NS_VIEW (f) superview] subviews]; + EmacsView *eview = FRAME_NS_VIEW (f); + NSArray *subviews = [[eview superview] subviews]; + BOOL removed = NO; + NSTRACE (ns_judge_scroll_bars); - for (i =[subviews count]-1; i >= 0; i--) + for (i = [subviews count]-1; i >= 0; --i) { view = [subviews objectAtIndex: i]; if (![view isKindOfClass: [EmacsScroller class]]) continue; [view judge]; + removed = YES; } + + if (removed) + [eview updateFrameSize]; } @@ -4053,7 +3986,7 @@ ns_term_init (Lisp_Object display_name) { fprintf (stderr, "Failed to create pipe: %s\n", emacs_strerror (errno)); - abort (); + emacs_abort (); } fcntl (selfds[0], F_SETFL, O_NONBLOCK|fcntl (selfds[0], F_GETFL)); @@ -4273,7 +4206,7 @@ ns_term_shutdown (int sig) } else // force a stack trace to happen { - abort(); + emacs_abort (); } } @@ -4534,10 +4467,10 @@ not_in_argv (NSString *arg) /* Don't open files from the command line unconditionally, Cocoa parses the command line wrong, --option value tries to open value if --option is the last option. */ - while ((file = [files nextObject]) != nil) + while ((file = [files nextObject]) != nil) if (ns_do_open_file || not_in_argv (file)) [ns_pending_files addObject: file]; - + [self replyToOpenOrPrint: NSApplicationDelegateReplySuccess]; } @@ -4604,7 +4537,7 @@ not_in_argv (NSString *arg) /* NSTRACE (fd_handler); */ - for (;;) + for (;;) { [pool release]; pool = [[NSAutoreleasePool alloc] init]; @@ -4889,7 +4822,7 @@ not_in_argv (NSString *arg) is_right_key = (flags & NSRightCommandKeyMask) == NSRightCommandKeyMask; is_left_key = (flags & NSLeftCommandKeyMask) == NSLeftCommandKeyMask || (! is_right_key && (flags & NSCommandKeyMask) == NSCommandKeyMask); - + if (is_right_key) emacs_event->modifiers |= parse_solitary_modifier (EQ (ns_right_command_modifier, Qleft) @@ -5420,6 +5353,50 @@ not_in_argv (NSString *arg) return NO; } +- (void) updateFrameSize +{ + NSWindow *window = [self window]; + NSRect wr = [window frame]; +#ifdef NS_IMPL_GNUSTEP + int extra = 3; +#else + int extra = 0; +#endif + + int oldc = cols, oldr = rows; + int oldw = FRAME_PIXEL_WIDTH (emacsframe), + oldh = FRAME_PIXEL_HEIGHT (emacsframe); + int neww, newh; + + cols = FRAME_PIXEL_WIDTH_TO_TEXT_COLS (emacsframe, wr.size.width + extra); + + if (cols < MINWIDTH) + cols = MINWIDTH; + + rows = FRAME_PIXEL_HEIGHT_TO_TEXT_LINES + (emacsframe, wr.size.height + - FRAME_NS_TITLEBAR_HEIGHT (emacsframe) + extra + - FRAME_TOOLBAR_HEIGHT (emacsframe)); + + if (rows < MINHEIGHT) + rows = MINHEIGHT; + + neww = (int)wr.size.width - emacsframe->border_width; + newh = ((int)wr.size.height + - FRAME_NS_TITLEBAR_HEIGHT (emacsframe) + - FRAME_TOOLBAR_HEIGHT (emacsframe)); + + if (oldr != rows || oldc != cols || neww != oldw || newh != oldh) + { + NSView *view = FRAME_NS_VIEW (emacsframe); + FRAME_PIXEL_WIDTH (emacsframe) = neww; + FRAME_PIXEL_HEIGHT (emacsframe) = newh; + change_frame_size (emacsframe, rows, cols, 0, 0, 1); + SET_FRAME_GARBAGED (emacsframe); + cancel_mouse_face (emacsframe); + [view setFrame: NSMakeRect (0, 0, neww, newh)]; + } +} - (NSSize)windowWillResize: (NSWindow *)sender toSize: (NSSize)frameSize /* normalize frame to gridded text size */ @@ -5517,16 +5494,7 @@ not_in_argv (NSString *arg) x_set_window_size (emacsframe, 0, cols, rows); else { - NSWindow *window = [self window]; - NSRect wr = [window frame]; - FRAME_PIXEL_WIDTH (emacsframe) = (int)wr.size.width - - emacsframe->border_width; - FRAME_PIXEL_HEIGHT (emacsframe) = (int)wr.size.height - - FRAME_NS_TITLEBAR_HEIGHT (emacsframe) - - FRAME_TOOLBAR_HEIGHT (emacsframe); - change_frame_size (emacsframe, rows, cols, 0, 0, 1); - SET_FRAME_GARBAGED (emacsframe); - cancel_mouse_face (emacsframe); + [self updateFrameSize]; } } #endif @@ -5853,7 +5821,7 @@ not_in_argv (NSString *arg) NSTRACE (menuDown); if (context_menu_value == -1) context_menu_value = [sender tag]; - else + else { NSInteger tag = [sender tag]; find_and_call_menu_selection (emacsframe, emacsframe->menu_bar_items_used, @@ -6180,7 +6148,7 @@ not_in_argv (NSString *arg) Lisp_Object str = Qnil; struct frame *f = SELECTED_FRAME (); struct buffer *curbuf = XBUFFER (XWINDOW (f->selected_window)->buffer); - + if ([attribute isEqualToString:NSAccessibilityRoleAttribute]) return NSAccessibilityTextFieldRole; @@ -6193,13 +6161,13 @@ not_in_argv (NSString *arg) { if (! NILP (BVAR (curbuf, mark_active))) str = ns_get_local_selection (QPRIMARY, QUTF8_STRING); - + if (NILP (str)) { ptrdiff_t start_byte = BUF_BEGV_BYTE (curbuf); ptrdiff_t byte_range = BUF_ZV_BYTE (curbuf) - start_byte; ptrdiff_t range = BUF_ZV (curbuf) - BUF_BEGV (curbuf); - + if (! NILP (BVAR (curbuf, enable_multibyte_characters))) str = make_uninit_multibyte_string (range, byte_range); else @@ -6209,9 +6177,9 @@ not_in_argv (NSString *arg) memcpy (SDATA (str), BYTE_POS_ADDR (start_byte), byte_range); } } - - - if (! NILP (str)) + + + if (! NILP (str)) { if (CONSP (str) && SYMBOLP (XCAR (str))) { @@ -6226,7 +6194,7 @@ not_in_argv (NSString *arg) return nsStr; } } - + return [super accessibilityAttributeValue:attribute]; } #endif /* NS_IMPL_COCOA */ @@ -6242,8 +6210,11 @@ not_in_argv (NSString *arg) NSTRACE (constrainFrameRect); if (nr_screens == 1) - return [super constrainFrameRect:frameRect toScreen:screen]; - + { + NSRect r = [super constrainFrameRect:frameRect toScreen:screen]; + return r; + } + if (f->output_data.ns->dont_constrain || ns_menu_bar_should_be_hidden ()) return frameRect; diff --git a/src/print.c b/src/print.c index 911e009ad25..c1b60c97d9e 100644 --- a/src/print.c +++ b/src/print.c @@ -47,15 +47,9 @@ static Lisp_Object Qtemp_buffer_setup_hook; static Lisp_Object Qfloat_output_format; -#include #include #include -/* Default to values appropriate for IEEE floating point. */ -#ifndef DBL_DIG -#define DBL_DIG 15 -#endif - /* Avoid actual stack overflow in print. */ static ptrdiff_t print_depth; @@ -2069,7 +2063,7 @@ print_object (Lisp_Object obj, register Lisp_Object printcharfun, int escapeflag { int len; /* We're in trouble if this happens! - Probably should just abort () */ + Probably should just emacs_abort (). */ strout ("#. */ #define PROCESS_INLINE EXTERN_INLINE -#include #include #include #include @@ -124,6 +123,14 @@ along with GNU Emacs. If not, see . */ #include "xgselect.h" #endif +#ifndef WNOHANG +# undef waitpid +# define waitpid(pid, status, options) wait (status) +#endif +#ifndef WUNTRACED +# define WUNTRACED 0 +#endif + /* Work around GCC 4.7.0 bug with strict overflow checking; see . These lines can be removed once the GCC bug is fixed. */ @@ -801,7 +808,7 @@ get_process (register Lisp_Object name) #ifdef SIGCHLD /* Fdelete_process promises to immediately forget about the process, but in reality, Emacs needs to remember those processes until they have been - treated by sigchld_handler; otherwise this handler would consider the + treated by the SIGCHLD handler; otherwise this handler would consider the process as being synchronous and say that the synchronous process is dead. */ static Lisp_Object deleted_pid_list; @@ -849,7 +856,8 @@ nil, indicating the current buffer's process. */) #endif { Fkill_process (process, Qnil); - /* Do this now, since remove_process will make sigchld_handler do nothing. */ + /* Do this now, since remove_process will make the + SIGCHLD handler do nothing. */ pset_status (p, Fcons (Qsignal, Fcons (make_number (SIGKILL), Qnil))); p->tick = ++process_tick; status_notify (p); @@ -1577,7 +1585,7 @@ static Lisp_Object start_process_unwind (Lisp_Object proc) { if (!PROCESSP (proc)) - abort (); + emacs_abort (); /* Was PROC started successfully? -2 is used for a pty with no process, eg for gdb. */ @@ -1603,8 +1611,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) #if !defined (WINDOWSNT) && defined (FD_CLOEXEC) int wait_child_setup[2]; #endif - sigset_t procmask; - sigset_t blocked; + sigset_t blocked, procmask; struct sigaction sigint_action; struct sigaction sigquit_action; struct sigaction sigpipe_action; @@ -1728,7 +1735,7 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) if (inchannel > max_process_desc) max_process_desc = inchannel; - /* Until we store the proper pid, enable sigchld_handler + /* Until we store the proper pid, enable the SIGCHLD handler to recognize an unknown pid as standing for this process. It is very important not to let this `marker' value stay in the table after this function has returned; if it does @@ -1756,12 +1763,6 @@ create_process (Lisp_Object process, char **new_argv, Lisp_Object current_dir) int xforkin = forkin; int xforkout = forkout; -#if 0 /* This was probably a mistake--it duplicates code later on, - but fails to handle all the cases. */ - /* Make sure SIGCHLD is not blocked in the child. */ - sigsetmask (SIGEMPTYMASK); -#endif - /* Make the pty be the controlling terminal of the process. */ #ifdef HAVE_PTYS /* First, disconnect its current controlling terminal. */ @@ -2550,7 +2551,7 @@ static Lisp_Object make_serial_process_unwind (Lisp_Object proc) { if (!PROCESSP (proc)) - abort (); + emacs_abort (); remove_process (proc); return Qnil; } @@ -3387,7 +3388,7 @@ usage: (make-network-process &rest ARGS) */) if (socktype == SOCK_DGRAM) { if (datagram_address[s].sa) - abort (); + emacs_abort (); datagram_address[s].sa = xmalloc (lres->ai_addrlen); datagram_address[s].len = lres->ai_addrlen; if (is_server) @@ -3973,7 +3974,7 @@ deactivate_process (Lisp_Object proc) FD_CLR (inchannel, &connect_wait_mask); FD_CLR (inchannel, &write_mask); if (--num_pending_connects < 0) - abort (); + emacs_abort (); } #endif if (inchannel == max_process_desc) @@ -4752,7 +4753,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, Cleanup occurs c/o status_notify after SIGCLD. */ no_avail = 1; /* Cannot depend on values returned */ #else - abort (); + emacs_abort (); #endif } else @@ -4956,8 +4957,8 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, if (p->pid == -2) { - /* If the EIO occurs on a pty, sigchld_handler's - waitpid() will not find the process object to + /* If the EIO occurs on a pty, the SIGCHLD handler's + waitpid call will not find the process object to delete. Do it here. */ p->tick = ++process_tick; pset_status (p, Qfailed); @@ -4993,7 +4994,7 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd, FD_CLR (channel, &connect_wait_mask); FD_CLR (channel, &write_mask); if (--num_pending_connects < 0) - abort (); + emacs_abort (); proc = chan_process[channel]; if (NILP (proc)) @@ -5422,16 +5423,20 @@ read_process_output (Lisp_Object proc, register int channel) static jmp_buf send_process_frame; static Lisp_Object process_sent_to; -#ifndef FORWARD_SIGNAL_TO_MAIN_THREAD -static _Noreturn void send_process_trap (int); -#endif +static _Noreturn void +handle_pipe_signal (int sig) +{ + sigset_t unblocked; + sigemptyset (&unblocked); + sigaddset (&unblocked, SIGPIPE); + pthread_sigmask (SIG_UNBLOCK, &unblocked, 0); + _longjmp (send_process_frame, 1); +} static void -send_process_trap (int ignore) +deliver_pipe_signal (int sig) { - SIGNAL_THREAD_CHECK (SIGPIPE); - sigunblock (sigmask (SIGPIPE)); - longjmp (send_process_frame, 1); + handle_on_main_thread (sig, handle_pipe_signal); } /* In send_process, when a write fails temporarily, @@ -5524,7 +5529,7 @@ send_process (volatile Lisp_Object proc, const char *volatile buf, struct Lisp_Process *p = XPROCESS (proc); ssize_t rv; struct coding_system *coding; - void (*volatile old_sigpipe) (int); + struct sigaction old_sigpipe_action; if (p->raw_status_new) update_status (p); @@ -5634,7 +5639,7 @@ send_process (volatile Lisp_Object proc, const char *volatile buf, /* 2000-09-21: Emacs 20.7, sparc-sun-solaris-2.6, GCC 2.95.2, CFLAGS="-g -O": The value of the parameter `proc' is clobbered when returning with longjmp despite being declared volatile. */ - if (!setjmp (send_process_frame)) + if (!_setjmp (send_process_frame)) { p = XPROCESS (proc); /* Repair any setjmp clobbering. */ process_sent_to = proc; @@ -5663,7 +5668,9 @@ send_process (volatile Lisp_Object proc, const char *volatile buf, /* Send this batch, using one or more write calls. */ ptrdiff_t written = 0; int outfd = p->outfd; - old_sigpipe = (void (*) (int)) signal (SIGPIPE, send_process_trap); + struct sigaction action; + emacs_sigaction_init (&action, deliver_pipe_signal); + sigaction (SIGPIPE, &action, &old_sigpipe_action); #ifdef DATAGRAM_SOCKETS if (DATAGRAM_CHAN_P (outfd)) { @@ -5674,7 +5681,7 @@ send_process (volatile Lisp_Object proc, const char *volatile buf, written = rv; else if (errno == EMSGSIZE) { - signal (SIGPIPE, old_sigpipe); + sigaction (SIGPIPE, &old_sigpipe_action, 0); report_file_error ("sending datagram", Fcons (proc, Qnil)); } @@ -5699,7 +5706,7 @@ send_process (volatile Lisp_Object proc, const char *volatile buf, } #endif } - signal (SIGPIPE, old_sigpipe); + sigaction (SIGPIPE, &old_sigpipe_action, 0); if (rv < 0) { @@ -5759,7 +5766,7 @@ send_process (volatile Lisp_Object proc, const char *volatile buf, } else { - signal (SIGPIPE, old_sigpipe); + sigaction (SIGPIPE, &old_sigpipe_action, 0); proc = process_sent_to; p = XPROCESS (proc); p->raw_status_new = 0; @@ -6354,7 +6361,7 @@ process has been transmitted to the serial port. */) #endif /* not HAVE_SHUTDOWN */ new_outfd = emacs_open (NULL_DEVICE, O_WRONLY, 0); if (new_outfd < 0) - abort (); + emacs_abort (); old_outfd = XPROCESS (proc)->outfd; if (!proc_encode_coding_system[new_outfd]) @@ -6397,143 +6404,135 @@ process has been transmitted to the serial port. */) indirectly; if it does, that is a bug */ #ifdef SIGCHLD -static void -sigchld_handler (int signo) + +/* Record one child's changed status. Return true if a child was found. */ +static bool +record_child_status_change (void) { - int old_errno = errno; Lisp_Object proc; struct Lisp_Process *p; + pid_t pid; + int w; + Lisp_Object tail; - SIGNAL_THREAD_CHECK (signo); + do + pid = waitpid (-1, &w, WNOHANG | WUNTRACED); + while (pid < 0 && errno == EINTR); - while (1) + /* PID == 0 means no processes found, PID == -1 means a real failure. + Either way, we have done all our job. */ + if (pid <= 0) + return false; + + /* Find the process that signaled us, and record its status. */ + + /* The process can have been deleted by Fdelete_process. */ + for (tail = deleted_pid_list; CONSP (tail); tail = XCDR (tail)) { - pid_t pid; - int w; - Lisp_Object tail; - -#ifdef WNOHANG -#ifndef WUNTRACED -#define WUNTRACED 0 -#endif /* no WUNTRACED */ - /* Keep trying to get a status until we get a definitive result. */ - do + Lisp_Object xpid = XCAR (tail); + if ((INTEGERP (xpid) && pid == XINT (xpid)) + || (FLOATP (xpid) && pid == XFLOAT_DATA (xpid))) { - errno = 0; - pid = waitpid (-1, &w, WNOHANG | WUNTRACED); + XSETCAR (tail, Qnil); + return true; } - while (pid < 0 && errno == EINTR); + } - if (pid <= 0) - { - /* PID == 0 means no processes found, PID == -1 means a real - failure. We have done all our job, so return. */ - - errno = old_errno; - return; - } -#else - pid = wait (&w); -#endif /* no WNOHANG */ - - /* Find the process that signaled us, and record its status. */ - - /* The process can have been deleted by Fdelete_process. */ - for (tail = deleted_pid_list; CONSP (tail); tail = XCDR (tail)) - { - Lisp_Object xpid = XCAR (tail); - if ((INTEGERP (xpid) && pid == XINT (xpid)) - || (FLOATP (xpid) && pid == XFLOAT_DATA (xpid))) - { - XSETCAR (tail, Qnil); - goto sigchld_end_of_loop; - } - } - - /* Otherwise, if it is asynchronous, it is in Vprocess_alist. */ + /* Otherwise, if it is asynchronous, it is in Vprocess_alist. */ + p = 0; + for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail)) + { + proc = XCDR (XCAR (tail)); + p = XPROCESS (proc); + if (EQ (p->type, Qreal) && p->pid == pid) + break; p = 0; - for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail)) + } + + /* Look for an asynchronous process whose pid hasn't been filled + in yet. */ + if (! p) + for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail)) + { + proc = XCDR (XCAR (tail)); + p = XPROCESS (proc); + if (p->pid == -1) + break; + p = 0; + } + + /* Change the status of the process that was found. */ + if (p) + { + int clear_desc_flag = 0; + + p->tick = ++process_tick; + p->raw_status = w; + p->raw_status_new = 1; + + /* If process has terminated, stop waiting for its output. */ + if ((WIFSIGNALED (w) || WIFEXITED (w)) + && p->infd >= 0) + clear_desc_flag = 1; + + /* We use clear_desc_flag to avoid a compiler bug in Microsoft C. */ + if (clear_desc_flag) { - proc = XCDR (XCAR (tail)); - p = XPROCESS (proc); - if (EQ (p->type, Qreal) && p->pid == pid) - break; - p = 0; + FD_CLR (p->infd, &input_wait_mask); + FD_CLR (p->infd, &non_keyboard_wait_mask); } - /* Look for an asynchronous process whose pid hasn't been filled - in yet. */ - if (p == 0) - for (tail = Vprocess_alist; CONSP (tail); tail = XCDR (tail)) - { - proc = XCDR (XCAR (tail)); - p = XPROCESS (proc); - if (p->pid == -1) - break; - p = 0; - } + /* Tell wait_reading_process_output that it needs to wake up and + look around. */ + if (input_available_clear_time) + *input_available_clear_time = make_emacs_time (0, 0); + } + /* There was no asynchronous process found for that pid: we have + a synchronous process. */ + else + { + synch_process_alive = 0; - /* Change the status of the process that was found. */ - if (p != 0) - { - int clear_desc_flag = 0; + /* Report the status of the synchronous process. */ + if (WIFEXITED (w)) + synch_process_retcode = WEXITSTATUS (w); + else if (WIFSIGNALED (w)) + synch_process_termsig = WTERMSIG (w); - p->tick = ++process_tick; - p->raw_status = w; - p->raw_status_new = 1; + /* Tell wait_reading_process_output that it needs to wake up and + look around. */ + if (input_available_clear_time) + *input_available_clear_time = make_emacs_time (0, 0); + } - /* If process has terminated, stop waiting for its output. */ - if ((WIFSIGNALED (w) || WIFEXITED (w)) - && p->infd >= 0) - clear_desc_flag = 1; + return true; +} - /* We use clear_desc_flag to avoid a compiler bug in Microsoft C. */ - if (clear_desc_flag) - { - FD_CLR (p->infd, &input_wait_mask); - FD_CLR (p->infd, &non_keyboard_wait_mask); - } - - /* Tell wait_reading_process_output that it needs to wake up and - look around. */ - if (input_available_clear_time) - *input_available_clear_time = make_emacs_time (0, 0); - } - - /* There was no asynchronous process found for that pid: we have - a synchronous process. */ - else - { - synch_process_alive = 0; - - /* Report the status of the synchronous process. */ - if (WIFEXITED (w)) - synch_process_retcode = WEXITSTATUS (w); - else if (WIFSIGNALED (w)) - synch_process_termsig = WTERMSIG (w); - - /* Tell wait_reading_process_output that it needs to wake up and - look around. */ - if (input_available_clear_time) - *input_available_clear_time = make_emacs_time (0, 0); - } - - sigchld_end_of_loop: - ; - - /* On some systems, we must return right away. - If any more processes want to signal us, we will - get another signal. - Otherwise (on systems that have WNOHANG), loop around - to use up all the processes that have something to tell us. */ +/* On some systems, the SIGCHLD handler must return right away. If + any more processes want to signal us, we will get another signal. + Otherwise, loop around to use up all the processes that have + something to tell us. */ #if (defined WINDOWSNT \ || (defined USG && !defined GNU_LINUX \ && !(defined HPUX && defined WNOHANG))) - errno = old_errno; - return; -#endif /* USG, but not HPUX with WNOHANG */ - } +enum { CAN_HANDLE_MULTIPLE_CHILDREN = 0 }; +#else +enum { CAN_HANDLE_MULTIPLE_CHILDREN = 1 }; +#endif + +static void +handle_child_signal (int sig) +{ + while (record_child_status_change () && CAN_HANDLE_MULTIPLE_CHILDREN) + continue; } + +static void +deliver_child_signal (int sig) +{ + handle_on_main_thread (sig, handle_child_signal); +} + #endif /* SIGCHLD */ @@ -7387,7 +7386,11 @@ init_process_emacs (void) #ifndef CANNOT_DUMP if (! noninteractive || initialized) #endif - signal (SIGCHLD, sigchld_handler); + { + struct sigaction action; + emacs_sigaction_init (&action, deliver_child_signal); + sigaction (SIGCHLD, &action, 0); + } #endif FD_ZERO (&input_wait_mask); diff --git a/src/ralloc.c b/src/ralloc.c index 3877e21d4f6..74834333aa3 100644 --- a/src/ralloc.c +++ b/src/ralloc.c @@ -237,7 +237,7 @@ obtain (POINTER address, SIZE size) } if (! heap) - abort (); + emacs_abort (); /* If we can't fit SIZE bytes in that heap, try successive later heaps. */ @@ -330,7 +330,7 @@ relinquish (void) /* This heap should have no blocs in it. */ if (last_heap->first_bloc != NIL_BLOC || last_heap->last_bloc != NIL_BLOC) - abort (); + emacs_abort (); /* Return the last heap, with its header, to the system. */ excess = (char *)last_heap->end - (char *)last_heap->start; @@ -355,7 +355,7 @@ relinquish (void) which returns the entire last heap to the system, seems unlikely to trigger this mode of failure. */ if (last_heap->end != (*real_morecore) (0)) - abort (); + emacs_abort (); } } } @@ -452,7 +452,7 @@ relocate_blocs (bloc_ptr bloc, heap_ptr heap, POINTER address) /* No need to ever call this if arena is frozen, bug somewhere! */ if (r_alloc_freeze_level) - abort (); + emacs_abort (); while (b) { @@ -576,7 +576,7 @@ resize_bloc (bloc_ptr bloc, SIZE size) /* No need to ever call this if arena is frozen, bug somewhere! */ if (r_alloc_freeze_level) - abort (); + emacs_abort (); if (bloc == NIL_BLOC || size == bloc->size) return 1; @@ -588,7 +588,7 @@ resize_bloc (bloc_ptr bloc, SIZE size) } if (heap == NIL_HEAP) - abort (); + emacs_abort (); old_size = bloc->size; bloc->size = size; @@ -937,7 +937,7 @@ r_alloc_free (register POINTER *ptr) dead_bloc = find_bloc (ptr); if (dead_bloc == NIL_BLOC) - abort (); /* Double free? PTR not originally used to allocate? */ + emacs_abort (); /* Double free? PTR not originally used to allocate? */ free_bloc (dead_bloc); *ptr = 0; @@ -979,7 +979,7 @@ r_re_alloc (POINTER *ptr, SIZE size) bloc = find_bloc (ptr); if (bloc == NIL_BLOC) - abort (); /* Already freed? PTR not originally used to allocate? */ + emacs_abort (); /* Already freed? PTR not originally used to allocate? */ if (size < bloc->size) { @@ -1152,7 +1152,7 @@ r_alloc_reset_variable (POINTER *old, POINTER *new) } if (bloc == NIL_BLOC || bloc->variable != old) - abort (); /* Already freed? OLD not originally used to allocate? */ + emacs_abort (); /* Already freed? OLD not originally used to allocate? */ /* Update variable to point to the new location. */ bloc->variable = new; @@ -1193,7 +1193,7 @@ r_alloc_init (void) first_heap->start = first_heap->bloc_start = virtual_break_value = break_value = (*real_morecore) (0); if (break_value == NIL) - abort (); + emacs_abort (); extra_bytes = ROUNDUP (50000); #endif diff --git a/src/regex.c b/src/regex.c index 28813304c8a..472ef727979 100644 --- a/src/regex.c +++ b/src/regex.c @@ -5160,13 +5160,11 @@ re_match_2_internal (struct re_pattern_buffer *bufp, const re_char *string1, { /* 1 if this match ends in the same string (string1 or string2) as the best previous match. */ - boolean same_str_p; + boolean same_str_p = (FIRST_STRING_P (match_end) + == FIRST_STRING_P (d)); /* 1 if this match is the best seen so far. */ boolean best_match_p; - same_str_p = (FIRST_STRING_P (match_end) - == FIRST_STRING_P (d)); - /* AIX compiler got confused when this was combined with the previous declaration. */ if (same_str_p) diff --git a/src/region-cache.c b/src/region-cache.c index d2bba8c11b2..c3eb087aade 100644 --- a/src/region-cache.c +++ b/src/region-cache.c @@ -194,7 +194,7 @@ find_cache_boundary (struct region_cache *c, ptrdiff_t pos) if (BOUNDARY_POS (c, low) > pos || (low + 1 < c->cache_len && BOUNDARY_POS (c, low + 1) <= pos)) - abort (); + emacs_abort (); return low; } @@ -217,12 +217,12 @@ move_cache_gap (struct region_cache *c, ptrdiff_t pos, ptrdiff_t min_size) if (pos < 0 || pos > c->cache_len) - abort (); + emacs_abort (); /* We mustn't ever try to put the gap before the dummy start boundary. That must always be start-relative. */ if (pos == 0) - abort (); + emacs_abort (); /* Need we move the gap right? */ while (gap_start < pos) @@ -291,24 +291,24 @@ insert_cache_boundary (struct region_cache *c, ptrdiff_t i, ptrdiff_t pos, { /* i must be a valid cache index. */ if (i < 0 || i > c->cache_len) - abort (); + emacs_abort (); /* We must never want to insert something before the dummy first boundary. */ if (i == 0) - abort (); + emacs_abort (); /* We must only be inserting things in order. */ if (! (BOUNDARY_POS (c, i - 1) < pos && (i == c->cache_len || pos < BOUNDARY_POS (c, i)))) - abort (); + emacs_abort (); /* The value must be different from the ones around it. However, we temporarily create boundaries that establish the same value as the subsequent boundary, so we're not going to flag that case. */ if (BOUNDARY_VALUE (c, i - 1) == value) - abort (); + emacs_abort (); move_cache_gap (c, i, 1); @@ -331,16 +331,16 @@ delete_cache_boundaries (struct region_cache *c, /* Gotta be in range. */ if (start < 0 || end > c->cache_len) - abort (); + emacs_abort (); /* Gotta be in order. */ if (start > end) - abort (); + emacs_abort (); /* Can't delete the dummy entry. */ if (start == 0 && end >= 1) - abort (); + emacs_abort (); /* Minimize gap motion. If we're deleting nothing, do nothing. */ if (len == 0) @@ -380,10 +380,10 @@ set_cache_region (struct region_cache *c, ptrdiff_t start, ptrdiff_t end, int value) { if (start > end) - abort (); + emacs_abort (); if (start < c->buffer_beg || end > c->buffer_end) - abort (); + emacs_abort (); /* Eliminate this case; then we can assume that start and end-1 are both the locations of real characters in the buffer. */ diff --git a/src/scroll.c b/src/scroll.c index 78ebe65bdcc..79dd464b29e 100644 --- a/src/scroll.c +++ b/src/scroll.c @@ -195,13 +195,13 @@ calculate_scrolling (FRAME_PTR frame, { cost = p1->writecost + first_insert_cost[i]; if ((int) p1->insertcount > i) - abort (); + emacs_abort (); cost1 = p1->insertcost + next_insert_cost[i - p1->insertcount]; } p->insertcost = min (cost, cost1) + draw_cost[i] + extra_cost; p->insertcount = (cost < cost1) ? 1 : p1->insertcount + 1; if ((int) p->insertcount > i) - abort (); + emacs_abort (); /* Calculate the cost if we do a delete line after outputting this line. diff --git a/src/search.c b/src/search.c index 0b4f635066c..72bd5605709 100644 --- a/src/search.c +++ b/src/search.c @@ -1009,7 +1009,7 @@ search_command (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror, if (!EQ (noerror, Qt)) { if (lim < BEGV || lim > ZV) - abort (); + emacs_abort (); SET_PT_BOTH (lim, lim_byte); return Qnil; #if 0 /* This would be clean, but maybe programs depend on @@ -1022,7 +1022,7 @@ search_command (Lisp_Object string, Lisp_Object bound, Lisp_Object noerror, } if (np < BEGV || np > ZV) - abort (); + emacs_abort (); SET_PT (np); @@ -2770,7 +2770,7 @@ Return value is undefined if the last search failed. */) } else /* last_thing_searched must always be Qt, a buffer, or Qnil. */ - abort (); + emacs_abort (); len = 2 * i + 2; } diff --git a/src/sound.c b/src/sound.c index 403f08240ce..5729d704b6a 100644 --- a/src/sound.c +++ b/src/sound.c @@ -48,7 +48,6 @@ along with GNU Emacs. If not, see . */ #include "lisp.h" #include "dispextern.h" #include "atimer.h" -#include #include "syssignal.h" /* END: Common Includes */ @@ -316,7 +315,12 @@ sound_perror (const char *msg) turn_on_atimers (1); #ifdef SIGIO - sigunblock (sigmask (SIGIO)); + { + sigset_t unblocked; + sigemptyset (&unblocked); + sigaddset (&unblocked, SIGIO); + pthread_sigmask (SIG_UNBLOCK, &unblocked, 0); + } #endif if (saved_errno != 0) error ("%s: %s", msg, strerror (saved_errno)); @@ -728,6 +732,9 @@ static void vox_configure (struct sound_device *sd) { int val; +#ifdef SIGIO + sigset_t blocked; +#endif eassert (sd->fd >= 0); @@ -736,7 +743,9 @@ vox_configure (struct sound_device *sd) troubles. */ turn_on_atimers (0); #ifdef SIGIO - sigblock (sigmask (SIGIO)); + sigemptyset (&blocked); + sigaddset (&blocked, SIGIO); + pthread_sigmask (SIG_BLOCK, &blocked, 0); #endif val = sd->format; @@ -770,7 +779,7 @@ vox_configure (struct sound_device *sd) turn_on_atimers (1); #ifdef SIGIO - sigunblock (sigmask (SIGIO)); + pthread_sigmask (SIG_UNBLOCK, &blocked, 0); #endif } @@ -786,7 +795,10 @@ vox_close (struct sound_device *sd) be interrupted by a signal. Block the ones we know to cause troubles. */ #ifdef SIGIO - sigblock (sigmask (SIGIO)); + sigset_t blocked; + sigemptyset (&blocked); + sigaddset (&blocked, SIGIO); + pthread_sigmask (SIG_BLOCK, &blocked, 0); #endif turn_on_atimers (0); @@ -795,7 +807,7 @@ vox_close (struct sound_device *sd) turn_on_atimers (1); #ifdef SIGIO - sigunblock (sigmask (SIGIO)); + pthread_sigmask (SIG_UNBLOCK, &blocked, 0); #endif /* Close the device. */ @@ -843,7 +855,7 @@ vox_choose_format (struct sound_device *sd, struct sound *s) } } else - abort (); + emacs_abort (); } @@ -1138,7 +1150,7 @@ alsa_choose_format (struct sound_device *sd, struct sound *s) } } else - abort (); + emacs_abort (); } diff --git a/src/syntax.c b/src/syntax.c index f995b8f2cac..fdd9353bb87 100644 --- a/src/syntax.c +++ b/src/syntax.c @@ -921,11 +921,11 @@ DEFUN ("matching-paren", Fmatching_paren, Smatching_paren, 1, 1, 0, } DEFUN ("string-to-syntax", Fstring_to_syntax, Sstring_to_syntax, 1, 1, 0, - doc: /* Convert a syntax specification STRING into syntax cell form. -STRING should be a string as it is allowed as argument of -`modify-syntax-entry'. Value is the equivalent cons cell -\(CODE . MATCHING-CHAR) that can be used as value of a `syntax-table' -text property. */) + doc: /* Convert a syntax descriptor STRING into a raw syntax descriptor. +STRING should be a string of the form allowed as argument of +`modify-syntax-entry'. The return value is a raw syntax descriptor: a +cons cell \(CODE . MATCHING-CHAR) which can be used, for example, as +the value of a `syntax-table' text property. */) (Lisp_Object string) { register const unsigned char *p; diff --git a/src/sysdep.c b/src/sysdep.c index b84e6a4ea3a..0f16d1a7645 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -21,7 +21,7 @@ along with GNU Emacs. If not, see . */ #define SYSTIME_INLINE EXTERN_INLINE -#include +#include #include #include #ifdef HAVE_PWD_H @@ -302,27 +302,34 @@ wait_for_termination_1 (pid_t pid, int interruptible) termination of subprocesses, perhaps involving a kernel bug too, but no idea what it is. Just as a hunch we signal SIGCHLD to see if that causes the problem to go away or get worse. */ - sigsetmask (sigmask (SIGCHLD)); + sigset_t sigchild_mask; + sigemptyset (&sigchild_mask); + sigaddset (&sigchild_mask, SIGCHLD); + pthread_sigmask (SIG_SETMASK, &sigchild_mask, 0); + if (0 > kill (pid, 0)) { - sigsetmask (SIGEMPTYMASK); + pthread_sigmask (SIG_SETMASK, &empty_mask, 0); kill (getpid (), SIGCHLD); break; } if (wait_debugging) sleep (1); else - sigpause (SIGEMPTYMASK); + sigsuspend (&empty_mask); #else /* not BSD_SYSTEM, and not HPUX version >= 6 */ #ifdef WINDOWSNT wait (0); break; #else /* not WINDOWSNT */ - sigblock (sigmask (SIGCHLD)); + sigset_t blocked; + sigemptyset (&blocked); + sigaddset (&blocked, SIGCHLD); + pthread_sigmask (SIG_BLOCK, &blocked, 0); errno = 0; if (kill (pid, 0) == -1 && errno == ESRCH) { - sigunblock (sigmask (SIGCHLD)); + pthread_sigmask (SIG_UNBLOCK, &blocked, 0); break; } @@ -456,11 +463,11 @@ child_setup_tty (int out) #endif /* not MSDOS */ -/* Record a signal code and the handler for it. */ +/* Record a signal code and the action for it. */ struct save_signal { int code; - void (*handler) (int); + struct sigaction action; }; static void save_signal_handlers (struct save_signal *); @@ -618,8 +625,9 @@ save_signal_handlers (struct save_signal *saved_handlers) { while (saved_handlers->code) { - saved_handlers->handler - = (void (*) (int)) signal (saved_handlers->code, SIG_IGN); + struct sigaction action; + emacs_sigaction_init (&action, SIG_IGN); + sigaction (saved_handlers->code, &action, &saved_handlers->action); saved_handlers++; } } @@ -629,7 +637,7 @@ restore_signal_handlers (struct save_signal *saved_handlers) { while (saved_handlers->code) { - signal (saved_handlers->code, saved_handlers->handler); + sigaction (saved_handlers->code, &saved_handlers->action, 0); saved_handlers++; } } @@ -686,13 +694,17 @@ reset_sigio (int fd) void request_sigio (void) { + sigset_t unblocked; + if (noninteractive) return; + sigemptyset (&unblocked); #ifdef SIGWINCH - sigunblock (sigmask (SIGWINCH)); + sigaddset (&unblocked, SIGWINCH); #endif - sigunblock (sigmask (SIGIO)); + sigaddset (&unblocked, SIGIO); + pthread_sigmask (SIG_UNBLOCK, &unblocked, 0); interrupts_deferred = 0; } @@ -700,6 +712,8 @@ request_sigio (void) void unrequest_sigio (void) { + sigset_t blocked; + if (noninteractive) return; @@ -708,10 +722,12 @@ unrequest_sigio (void) return; #endif + sigemptyset (&blocked); #ifdef SIGWINCH - sigblock (sigmask (SIGWINCH)); + sigaddset (&blocked, SIGWINCH); #endif - sigblock (sigmask (SIGIO)); + sigaddset (&blocked, SIGIO); + pthread_sigmask (SIG_BLOCK, &blocked, 0); interrupts_deferred = 1; } @@ -1470,20 +1486,16 @@ init_system_name (void) } } -/* POSIX signals support - DJB */ -/* Anyone with POSIX signals should have ANSI C declarations */ - sigset_t empty_mask; -#ifndef WINDOWSNT - -signal_handler_t -sys_signal (int signal_number, signal_handler_t action) +/* Store into *ACTION a signal action suitable for Emacs, with handler + HANDLER. */ +void +emacs_sigaction_init (struct sigaction *action, signal_handler_t handler) { - struct sigaction new_action, old_action; - sigemptyset (&new_action.sa_mask); - new_action.sa_handler = action; - new_action.sa_flags = 0; + sigemptyset (&action->sa_mask); + action->sa_handler = handler; + action->sa_flags = 0; #if defined (SA_RESTART) /* Emacs mostly works better with restartable system services. If this flag exists, we probably want to turn it on here. @@ -1500,56 +1512,44 @@ sys_signal (int signal_number, signal_handler_t action) # if defined (BROKEN_SA_RESTART) || defined (SYNC_INPUT) if (noninteractive) # endif - new_action.sa_flags = SA_RESTART; + action->sa_flags = SA_RESTART; #endif - sigaction (signal_number, &new_action, &old_action); - return (old_action.sa_handler); } -#endif /* WINDOWSNT */ - -#ifndef __GNUC__ -/* If we're compiling with GCC, we don't need this function, since it - can be written as a macro. */ -sigset_t -sys_sigmask (int sig) -{ - sigset_t mask; - sigemptyset (&mask); - sigaddset (&mask, sig); - return mask; -} +#ifdef FORWARD_SIGNAL_TO_MAIN_THREAD +pthread_t main_thread; #endif -/* I'd like to have these guys return pointers to the mask storage in here, - but there'd be trouble if the code was saving multiple masks. I'll be - safe and pass the structure. It normally won't be more than 2 bytes - anyhow. - DJB */ - -sigset_t -sys_sigblock (sigset_t new_mask) +/* If we are on the main thread, handle the signal SIG with HANDLER. + Otherwise, redirect the signal to the main thread, blocking it from + this thread. POSIX says any thread can receive a signal that is + associated with a process, process group, or asynchronous event. + On GNU/Linux that is not true, but for other systems (FreeBSD at + least) it is. */ +void +handle_on_main_thread (int sig, signal_handler_t handler) { - sigset_t old_mask; - pthread_sigmask (SIG_BLOCK, &new_mask, &old_mask); - return (old_mask); -} + /* Preserve errno, to avoid race conditions with signal handlers that + might change errno. Races can occur even in single-threaded hosts. */ + int old_errno = errno; -sigset_t -sys_sigunblock (sigset_t new_mask) -{ - sigset_t old_mask; - pthread_sigmask (SIG_UNBLOCK, &new_mask, &old_mask); - return (old_mask); -} + bool on_main_thread = true; +#ifdef FORWARD_SIGNAL_TO_MAIN_THREAD + if (! pthread_equal (pthread_self (), main_thread)) + { + sigset_t blocked; + sigemptyset (&blocked); + sigaddset (&blocked, sig); + pthread_sigmask (SIG_BLOCK, &blocked, 0); + pthread_kill (main_thread, sig); + on_main_thread = false; + } +#endif + if (on_main_thread) + handler (sig); -sigset_t -sys_sigsetmask (sigset_t new_mask) -{ - sigset_t old_mask; - pthread_sigmask (SIG_SETMASK, &new_mask, &old_mask); - return (old_mask); + errno = old_errno; } - #if !defined HAVE_STRSIGNAL && !HAVE_DECL_SYS_SIGLIST static char *my_sys_siglist[NSIG]; @@ -1564,6 +1564,10 @@ init_signals (void) { sigemptyset (&empty_mask); +#ifdef FORWARD_SIGNAL_TO_MAIN_THREAD + main_thread = pthread_self (); +#endif + #if !defined HAVE_STRSIGNAL && !HAVE_DECL_SYS_SIGLIST if (! initialized) { @@ -1856,6 +1860,33 @@ snprintf (char *buf, size_t bufsize, char const *format, ...) } #endif +/* If a backtrace is available, output the top lines of it to stderr. + Do not output more than BACKTRACE_LIMIT or BACKTRACE_LIMIT_MAX lines. + This function may be called from a signal handler, so it should + not invoke async-unsafe functions like malloc. */ +void +emacs_backtrace (int backtrace_limit) +{ + enum { BACKTRACE_LIMIT_MAX = 500 }; + void *buffer[BACKTRACE_LIMIT_MAX + 1]; + int bounded_limit = min (backtrace_limit, BACKTRACE_LIMIT_MAX); + int npointers = backtrace (buffer, bounded_limit + 1); + if (npointers) + ignore_value (write (STDERR_FILENO, "\nBacktrace:\n", 12)); + backtrace_symbols_fd (buffer, bounded_limit, STDERR_FILENO); + if (bounded_limit < npointers) + ignore_value (write (STDERR_FILENO, "...\n", 4)); +} + +#ifndef HAVE_NTGUI +/* Using emacs_abort lets GDB return from a breakpoint here. */ +void +emacs_abort (void) +{ + fatal_error_backtrace (SIGABRT, 10); +} +#endif + int emacs_open (const char *path, int oflag, int mode) { diff --git a/src/syssignal.h b/src/syssignal.h index 71151ed4c6a..c5529ae718a 100644 --- a/src/syssignal.h +++ b/src/syssignal.h @@ -17,6 +17,8 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see . */ +#include + extern void init_signals (void); #ifdef HAVE_PTHREAD @@ -26,66 +28,22 @@ extern void init_signals (void); #define FORWARD_SIGNAL_TO_MAIN_THREAD #endif -/* Don't #include . That header should always be #included - before "config.h", because some configuration files (like s/hpux.h) - indicate that SIGIO doesn't work by #undef-ing SIGIO. If this file - #includes , then that will re-#define SIGIO and confuse - things. */ -/* XXX This is not correct anymore, there is a BROKEN_SIGIO macro. */ - -#define SIGMASKTYPE sigset_t - -#define SIGEMPTYMASK (empty_mask) extern sigset_t empty_mask; -/* POSIX pretty much destroys any possibility of writing sigmask as a - macro in standard C. We always define our own version because the - predefined macro in Glibc 2.1 is only provided for compatibility for old - programs that use int as signal mask type. */ -#undef sigmask -#ifdef __GNUC__ -#define sigmask(SIG) \ - ({ \ - sigset_t _mask; \ - sigemptyset (&_mask); \ - sigaddset (&_mask, SIG); \ - _mask; \ - }) -#else /* ! defined (__GNUC__) */ -extern sigset_t sys_sigmask (); -#define sigmask(SIG) (sys_sigmask (SIG)) -#endif /* ! defined (__GNUC__) */ - -#undef sigpause -#define sigpause(MASK) sigsuspend (&(MASK)) - -#define sigblock(SIG) sys_sigblock (SIG) -#define sigunblock(SIG) sys_sigunblock (SIG) -#ifndef sigsetmask -#define sigsetmask(SIG) sys_sigsetmask (SIG) -#endif -#undef signal -#define signal(SIG,ACT) sys_signal(SIG,ACT) - -/* Whether this is what all systems want or not, this is what - appears to be assumed in the source, for example data.c:arith_error. */ typedef void (*signal_handler_t) (int); -signal_handler_t sys_signal (int signal_number, signal_handler_t action); -sigset_t sys_sigblock (sigset_t new_mask); -sigset_t sys_sigunblock (sigset_t new_mask); -sigset_t sys_sigsetmask (sigset_t new_mask); +extern void emacs_sigaction_init (struct sigaction *, signal_handler_t); + #if ! (defined TIOCNOTTY || defined USG5 || defined CYGWIN) _Noreturn void croak (char *); #endif -#define sys_sigdel(MASK,SIG) sigdelset (&MASK,SIG) - -#define sigfree() sigsetmask (SIGEMPTYMASK) - -#if defined (SIGIO) && defined (BROKEN_SIGIO) +/* Interrupt input is not used if there is no FIONREAD. */ +#include +#if defined BROKEN_SIGIO || ! defined FIONREAD || defined BROKEN_FIONREAD # undef SIGIO #endif + /* These are only used by AIX */ #if defined (SIGPOLL) && defined (BROKEN_SIGPOLL) #undef SIGPOLL @@ -97,12 +55,8 @@ _Noreturn void croak (char *); #undef SIGPTY #endif - -/* FIXME? Emacs only defines NSIG_MINIMUM on some platforms? */ #if NSIG < NSIG_MINIMUM -# ifdef NSIG -# undef NSIG -# endif +# undef NSIG # define NSIG NSIG_MINIMUM #endif @@ -133,24 +87,6 @@ char *strsignal (int); #ifdef FORWARD_SIGNAL_TO_MAIN_THREAD extern pthread_t main_thread; -#define SIGNAL_THREAD_CHECK(signo) \ - do { \ - if (!pthread_equal (pthread_self (), main_thread)) \ - { \ - /* POSIX says any thread can receive the signal. On GNU/Linux \ - that is not true, but for other systems (FreeBSD at least) \ - it is. So direct the signal to the correct thread and block \ - it from this thread. */ \ - sigset_t new_mask; \ - \ - sigemptyset (&new_mask); \ - sigaddset (&new_mask, signo); \ - pthread_sigmask (SIG_BLOCK, &new_mask, 0); \ - pthread_kill (main_thread, signo); \ - return; \ - } \ - } while (0) +#endif -#else /* not FORWARD_SIGNAL_TO_MAIN_THREAD */ -#define SIGNAL_THREAD_CHECK(signo) -#endif /* not FORWARD_SIGNAL_TO_MAIN_THREAD */ +void handle_on_main_thread (int, signal_handler_t); diff --git a/src/systty.h b/src/systty.h index ae98f123f2a..b660441a91e 100644 --- a/src/systty.h +++ b/src/systty.h @@ -47,11 +47,6 @@ along with GNU Emacs. If not, see . */ #undef ASYNC #endif -/* Interrupt input is not used if there is no FIONREAD. */ -#ifndef FIONREAD -#undef SIGIO -#endif - /* Try to establish the correct character to disable terminal functions in a system-independent manner. Note that USG (at least) define diff --git a/src/term.c b/src/term.c index f1a09b39cf9..0eaf76a13df 100644 --- a/src/term.c +++ b/src/term.c @@ -25,7 +25,6 @@ along with GNU Emacs. If not, see . */ #include #include #include -#include #include #include "lisp.h" @@ -1498,7 +1497,7 @@ append_glyph (struct it *it) { glyph->resolved_level = it->bidi_it.resolved_level; if ((it->bidi_it.type & 7) != it->bidi_it.type) - abort (); + emacs_abort (); glyph->bidi_type = it->bidi_it.type; } else @@ -1695,7 +1694,7 @@ append_composite_glyph (struct it *it) { glyph->resolved_level = it->bidi_it.resolved_level; if ((it->bidi_it.type & 7) != it->bidi_it.type) - abort (); + emacs_abort (); glyph->bidi_type = it->bidi_it.type; } else @@ -1780,7 +1779,7 @@ append_glyphless_glyph (struct it *it, int face_id, const char *str) { glyph->resolved_level = it->bidi_it.resolved_level; if ((it->bidi_it.type & 7) != it->bidi_it.type) - abort (); + emacs_abort (); glyph->bidi_type = it->bidi_it.type; } else @@ -2250,7 +2249,7 @@ get_named_tty (const char *name) struct terminal *t; if (!name) - abort (); + emacs_abort (); for (t = terminal_list; t; t = t->next_terminal) { @@ -2798,7 +2797,7 @@ create_tty_output (struct frame *f) struct tty_output *t = xzalloc (sizeof *t); if (! FRAME_TERMCAP_P (f)) - abort (); + emacs_abort (); t->display_info = FRAME_TERMINAL (f)->display_info.tty; @@ -2811,7 +2810,7 @@ static void tty_free_frame_resources (struct frame *f) { if (! FRAME_TERMCAP_P (f)) - abort (); + emacs_abort (); if (FRAME_FACE_CACHE (f)) free_frame_faces (f); @@ -2827,7 +2826,7 @@ static void tty_free_frame_resources (struct frame *f) { if (! FRAME_TERMCAP_P (f) && ! FRAME_MSDOS_P (f)) - abort (); + emacs_abort (); if (FRAME_FACE_CACHE (f)) free_frame_faces (f); @@ -2932,7 +2931,10 @@ dissociate_if_controlling_tty (int fd) no_controlling_tty = 1; #else #ifdef TIOCNOTTY /* Try BSD ioctls. */ - sigblock (sigmask (SIGTTOU)); + sigset_t blocked; + sigemptyset (&blocked); + sigaddset (&blocked, SIGTTOU); + pthread_sigmask (SIG_BLOCK, &blocked, 0); fd = emacs_open (DEV_TTY, O_RDWR, 0); if (fd != -1 && ioctl (fd, TIOCNOTTY, 0) != -1) { @@ -2940,7 +2942,7 @@ dissociate_if_controlling_tty (int fd) } if (fd != -1) emacs_close (fd); - sigunblock (sigmask (SIGTTOU)); + pthread_sigmask (SIG_UNBLOCK, &blocked, 0); #else /* Unknown system. */ croak (); @@ -3074,9 +3076,14 @@ init_tty (const char *name, const char *terminal_type, int must_succeed) /* On some systems, tgetent tries to access the controlling terminal. */ - sigblock (sigmask (SIGTTOU)); - status = tgetent (tty->termcap_term_buffer, terminal_type); - sigunblock (sigmask (SIGTTOU)); + { + sigset_t blocked; + sigemptyset (&blocked); + sigaddset (&blocked, SIGTTOU); + pthread_sigmask (SIG_BLOCK, &blocked, 0); + status = tgetent (tty->termcap_term_buffer, terminal_type); + pthread_sigmask (SIG_UNBLOCK, &blocked, 0); + } if (status < 0) { @@ -3108,7 +3115,7 @@ use the Bourne shell command `TERM=... export TERM' (C-shell:\n\ #ifndef TERMINFO if (strlen (tty->termcap_term_buffer) >= buffer_size) - abort (); + emacs_abort (); buffer_size = strlen (tty->termcap_term_buffer); #endif tty->termcap_strings_buffer = area = xmalloc (buffer_size); @@ -3467,7 +3474,7 @@ maybe_fatal (int must_succeed, struct terminal *terminal, verror (str1, ap); va_end (ap); - abort (); + emacs_abort (); } void @@ -3494,7 +3501,7 @@ delete_tty (struct terminal *terminal) return; if (terminal->type != output_termcap) - abort (); + emacs_abort (); tty = terminal->display_info.tty; @@ -3508,7 +3515,7 @@ delete_tty (struct terminal *terminal) if (! p) /* This should not happen. */ - abort (); + emacs_abort (); p->next = tty->next; tty->next = 0; diff --git a/src/termchar.h b/src/termchar.h index 102fe45350e..5c57593c04f 100644 --- a/src/termchar.h +++ b/src/termchar.h @@ -207,6 +207,6 @@ extern struct tty_display_info *tty_list; (((f)->output_method == output_termcap \ || (f)->output_method == output_msdos_raw) \ ? (f)->terminal->display_info.tty \ - : (abort (), (struct tty_display_info *) 0)) + : (emacs_abort (), (struct tty_display_info *) 0)) #define CURTTY() FRAME_TTY (SELECTED_FRAME()) diff --git a/src/terminal.c b/src/terminal.c index d94164a4e40..c51a18dfa61 100644 --- a/src/terminal.c +++ b/src/terminal.c @@ -294,7 +294,7 @@ delete_terminal (struct terminal *terminal) for (tp = &terminal_list; *tp != terminal; tp = &(*tp)->next_terminal) if (! *tp) - abort (); + emacs_abort (); *tp = terminal->next_terminal; xfree (terminal->keyboard_coding); @@ -411,7 +411,7 @@ possible return values. */) case output_ns: return Qns; default: - abort (); + emacs_abort (); } } @@ -519,7 +519,7 @@ struct terminal * init_initial_terminal (void) { if (initialized || terminal_list || tty_list) - abort (); + emacs_abort (); initial_terminal = create_terminal (); initial_terminal->type = output_initial; @@ -538,7 +538,7 @@ static void delete_initial_terminal (struct terminal *terminal) { if (terminal != initial_terminal) - abort (); + emacs_abort (); delete_terminal (terminal); initial_terminal = NULL; diff --git a/src/terminfo.c b/src/terminfo.c index dce7af77bcf..ca2d89a000b 100644 --- a/src/terminfo.c +++ b/src/terminfo.c @@ -46,7 +46,7 @@ tparam (const char *string, char *outstring, int len, /* Emacs always should pass a null OUTSTRING and zero LEN. */ if (outstring || len) - abort (); + emacs_abort (); temp = tparm (string, arg1, arg2, arg3, arg4); return xstrdup (temp); diff --git a/src/textprop.c b/src/textprop.c index b6895fc426a..2a9efba1c45 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -556,7 +556,8 @@ If POSITION is at the end of OBJECT, the value is nil. */) DEFUN ("get-text-property", Fget_text_property, Sget_text_property, 2, 3, 0, doc: /* Return the value of POSITION's property PROP, in OBJECT. -OBJECT is optional and defaults to the current buffer. +OBJECT should be a buffer or a string; if omitted or nil, it defaults +to the current buffer. If POSITION is at the end of OBJECT, the value is nil. */) (Lisp_Object position, Lisp_Object prop, Lisp_Object object) { diff --git a/src/tparam.c b/src/tparam.c index 9492d9dee36..58a825c90d7 100644 --- a/src/tparam.c +++ b/src/tparam.c @@ -247,7 +247,7 @@ tparam1 (const char *string, char *outstring, int len, break; default: - abort (); + emacs_abort (); } } else diff --git a/src/w32.c b/src/w32.c index fe612687f48..04f7471577c 100644 --- a/src/w32.c +++ b/src/w32.c @@ -1273,9 +1273,9 @@ init_user_info (void) /* Ensure HOME and SHELL are defined. */ if (getenv ("HOME") == NULL) - abort (); + emacs_abort (); if (getenv ("SHELL") == NULL) - abort (); + emacs_abort (); /* Set dir and shell from environment variables. */ strcpy (dflt_passwd.pw_dir, getenv ("HOME")); @@ -1530,34 +1530,10 @@ is_unc_volume (const char *filename) } /* Routines that are no-ops on NT but are defined to get Emacs to compile. */ - -int -sigsetmask (int signal_mask) -{ - return 0; -} - -int -sigmask (int sig) -{ - return 0; -} - -int -sigblock (int sig) -{ - return 0; -} - -int -sigunblock (int sig) -{ - return 0; -} - int sigemptyset (sigset_t *set) { + *set = 0; return 0; } @@ -1788,9 +1764,9 @@ init_environment (char ** argv) char modname[MAX_PATH]; if (!GetModuleFileName (NULL, modname, MAX_PATH)) - abort (); + emacs_abort (); if ((p = strrchr (modname, '\\')) == NULL) - abort (); + emacs_abort (); *p = 0; if ((p = strrchr (modname, '\\')) && xstrcasecmp (p, "\\bin") == 0) @@ -1902,13 +1878,13 @@ init_environment (char ** argv) /* FIXME: Do we need to resolve possible symlinks in startup_dir? Does it matter anywhere in Emacs? */ if (!GetCurrentDirectory (MAXPATHLEN, startup_dir)) - abort (); + emacs_abort (); { static char modname[MAX_PATH]; if (!GetModuleFileName (NULL, modname, MAX_PATH)) - abort (); + emacs_abort (); argv[0] = modname; } @@ -1930,7 +1906,7 @@ emacs_root_dir (void) p = getenv ("emacs_dir"); if (p == NULL) - abort (); + emacs_abort (); strcpy (root_dir, p); root_dir[parse_root (root_dir, NULL)] = '\0'; dostounix_filename (root_dir); @@ -3287,7 +3263,7 @@ generate_inode_val (const char * name) doesn't resolve aliasing due to subst commands, or recognize hard links. */ if (!w32_get_long_filename ((char *)name, fullname, MAX_PATH)) - abort (); + emacs_abort (); parse_root (fullname, &p); /* Normal W32 filesystems are still case insensitive. */ @@ -5587,7 +5563,7 @@ socket_to_fd (SOCKET s) if (fd_info[ fd ].cp != NULL) { DebPrint (("sys_socket: fd_info[%d] apparently in use!\n", fd)); - abort (); + emacs_abort (); } fd_info[ fd ].cp = cp; @@ -5966,7 +5942,7 @@ sys_close (int fd) { if (fd_info[fd].flags & FILE_SOCKET) { - if (winsock_lib == NULL) abort (); + if (winsock_lib == NULL) emacs_abort (); pfn_shutdown (SOCK_HANDLE (fd), 2); rc = pfn_closesocket (SOCK_HANDLE (fd)); @@ -6084,7 +6060,7 @@ _sys_read_ahead (int fd) || (fd_info[fd].flags & FILE_READ) == 0) { DebPrint (("_sys_read_ahead: internal error: fd %d is not a pipe, serial port, or socket!\n", fd)); - abort (); + emacs_abort (); } cp->status = STATUS_READ_IN_PROGRESS; @@ -6220,7 +6196,7 @@ sys_read (int fd, char * buffer, unsigned int count) /* re-read CR carried over from last read */ if (fd_info[fd].flags & FILE_LAST_CR) { - if (fd_info[fd].flags & FILE_BINARY) abort (); + if (fd_info[fd].flags & FILE_BINARY) emacs_abort (); *buffer++ = 0x0d; count--; nchars++; @@ -6323,7 +6299,7 @@ sys_read (int fd, char * buffer, unsigned int count) } else /* FILE_SOCKET */ { - if (winsock_lib == NULL) abort (); + if (winsock_lib == NULL) emacs_abort (); /* do the equivalent of a non-blocking read */ pfn_ioctlsocket (SOCK_HANDLE (fd), FIONREAD, &waiting); @@ -6474,7 +6450,7 @@ sys_write (int fd, const void * buffer, unsigned int count) else if (fd < MAXDESC && fd_info[fd].flags & FILE_SOCKET) { unsigned long nblock = 0; - if (winsock_lib == NULL) abort (); + if (winsock_lib == NULL) emacs_abort (); /* TODO: implement select() properly so non-blocking I/O works. */ /* For now, make sure the write blocks. */ @@ -6640,8 +6616,7 @@ check_windows_init_file (void) buffer, "Emacs Abort Dialog", MB_OK | MB_ICONEXCLAMATION | MB_TASKMODAL); - /* Use the low-level Emacs abort. */ -#undef abort + /* Use the low-level system abort. */ abort (); } else diff --git a/src/w32fns.c b/src/w32fns.c index 5a1b6dfabab..ec1acbd89d9 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -2280,7 +2280,7 @@ w32_msg_pump (deferred_msg * msg_buf) CoInitialize (NULL); w32_createwindow ((struct frame *) msg.wParam); if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, 0, 0)) - abort (); + emacs_abort (); break; case WM_EMACS_SETLOCALE: SetThreadLocale (msg.wParam); @@ -2290,7 +2290,7 @@ w32_msg_pump (deferred_msg * msg_buf) result = (int) ActivateKeyboardLayout ((HKL) msg.wParam, 0); if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, result, 0)) - abort (); + emacs_abort (); break; case WM_EMACS_REGISTER_HOT_KEY: focus_window = GetFocus (); @@ -2311,7 +2311,7 @@ w32_msg_pump (deferred_msg * msg_buf) GC. */ XSETCAR ((Lisp_Object) ((EMACS_INT) msg.lParam), Qnil); if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, 0, 0)) - abort (); + emacs_abort (); break; case WM_EMACS_TOGGLE_LOCK_KEY: { @@ -2343,7 +2343,7 @@ w32_msg_pump (deferred_msg * msg_buf) } if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, cur_state, 0)) - abort (); + emacs_abort (); } break; #ifdef MSG_DEBUG @@ -2398,11 +2398,11 @@ send_deferred_msg (deferred_msg * msg_buf, { /* Only input thread can send deferred messages. */ if (GetCurrentThreadId () != dwWindowsThreadId) - abort (); + emacs_abort (); /* It is an error to send a message that is already deferred. */ if (find_deferred_msg (hwnd, msg) != NULL) - abort (); + emacs_abort (); /* Enforced synchronization is not needed because this is the only function that alters deferred_msg_head, and the following critical @@ -2475,7 +2475,7 @@ w32_msg_worker (void *arg) PeekMessage (&msg, NULL, 0, 0, PM_NOREMOVE); if (!PostThreadMessage (dwMainThreadId, WM_EMACS_DONE, 0, 0)) - abort (); + emacs_abort (); memset (&dummy_buf, 0, sizeof (dummy_buf)); dummy_buf.w32msg.msg.hwnd = NULL; @@ -3136,7 +3136,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) msg = WM_MBUTTONUP; button_state &= ~MMOUSE; - if (button_state) abort (); + if (button_state) emacs_abort (); } else return 0; @@ -3367,7 +3367,7 @@ w32_wnd_proc (HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) /* Detect if message has already been deferred; in this case we cannot return any sensible value to ignore this. */ if (find_deferred_msg (hwnd, msg) != NULL) - abort (); + emacs_abort (); menubar_in_use = 1; @@ -3842,7 +3842,7 @@ my_create_window (struct frame * f) MSG msg; if (!PostThreadMessage (dwWindowsThreadId, WM_EMACS_CREATEWINDOW, (WPARAM)f, 0)) - abort (); + emacs_abort (); GetMessage (&msg, NULL, WM_EMACS_DONE, WM_EMACS_DONE); } @@ -6287,7 +6287,7 @@ w32_parse_hot_key (Lisp_Object key) lisp_modifiers = XINT (Fcar (Fcdr (c))); c = Fcar (c); if (!SYMBOLP (c)) - abort (); + emacs_abort (); vk_code = lookup_vk_code (SDATA (SYMBOL_NAME (c))); } else if (INTEGERP (c)) @@ -7194,10 +7194,8 @@ globals_of_w32fns (void) syms_of_w32uniscribe (); } -#undef abort - void -w32_abort (void) +emacs_abort (void) { int button; button = MessageBox (NULL, diff --git a/src/w32font.c b/src/w32font.c index cfd453282dd..8b3a0e4312e 100644 --- a/src/w32font.c +++ b/src/w32font.c @@ -635,9 +635,9 @@ w32font_text_extents (struct font *font, unsigned *code, /* w32 implementation of draw for font backend. Optional. Draw glyphs between FROM and TO of S->char2b at (X Y) pixel - position of frame F with S->FACE and S->GC. If WITH_BACKGROUND - is nonzero, fill the background in advance. It is assured that - WITH_BACKGROUND is zero when (FROM > 0 || TO < S->nchars). + position of frame F with S->FACE and S->GC. If WITH_BACKGROUND, + fill the background in advance. It is assured that WITH_BACKGROUND + is false when (FROM > 0 || TO < S->nchars). TODO: Currently this assumes that the colors and fonts are already set in the DC. This seems to be true now, but maybe only due to @@ -647,7 +647,7 @@ w32font_text_extents (struct font *font, unsigned *code, int w32font_draw (struct glyph_string *s, int from, int to, - int x, int y, int with_background) + int x, int y, bool with_background) { UINT options; HRGN orig_clip = NULL; @@ -804,7 +804,7 @@ static int w32font_otf_drive (struct font *font, Lisp_Object features, Lisp_Object gstring_in, int from, int to, Lisp_Object gstring_out, int idx, - int alternate_subst); + bool alternate_subst); */ /* Internal implementation of w32font_list. @@ -987,7 +987,6 @@ w32font_open_internal (FRAME_PTR f, Lisp_Object font_entity, font->space_width = font->average_width = w32_font->metrics.tmAveCharWidth; font->vertical_centering = 0; - font->encoding_type = 0; font->baseline_offset = 0; font->relative_compose = 0; font->default_ascent = w32_font->metrics.tmAscent; diff --git a/src/w32font.h b/src/w32font.h index a29ddbe778c..8fa00a9b524 100644 --- a/src/w32font.h +++ b/src/w32font.h @@ -77,7 +77,7 @@ int w32font_has_char (Lisp_Object entity, int c); int w32font_text_extents (struct font *font, unsigned *code, int nglyphs, struct font_metrics *metrics); int w32font_draw (struct glyph_string *s, int from, int to, - int x, int y, int with_background); + int x, int y, bool with_background); int uniscribe_check_otf (LOGFONT *font, Lisp_Object otf_spec); diff --git a/src/w32menu.c b/src/w32menu.c index 3aa4c8bc96d..d4de73a0de7 100644 --- a/src/w32menu.c +++ b/src/w32menu.c @@ -820,7 +820,7 @@ w32_menu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, else if (EQ (type, QCradio)) wv->button_type = BUTTON_TYPE_RADIO; else - abort (); + emacs_abort (); wv->selected = !NILP (selected); diff --git a/src/w32proc.c b/src/w32proc.c index 33aed5eb8e3..b9239cbb99a 100644 --- a/src/w32proc.c +++ b/src/w32proc.c @@ -103,6 +103,29 @@ sys_signal (int sig, signal_handler handler) return old; } +/* Emulate sigaction. */ +int +sigaction (int sig, const struct sigaction *act, struct sigaction *oact) +{ + signal_handler old; + + if (sig != SIGCHLD) + { + errno = EINVAL; + return -1; + } + old = sig_handlers[sig]; + if (act) + sig_handlers[sig] = act->sa_handler; + if (oact) + { + oact->sa_handler = old; + oact->sa_flags = 0; + oact->sa_mask = empty_mask; + } + return 0; +} + /* Defined in which conflicts with the local copy */ #define _P_NOWAIT 1 @@ -176,7 +199,7 @@ delete_child (child_process *cp) /* Should not be deleting a child that is still needed. */ for (i = 0; i < MAXDESC; i++) if (fd_info[i].cp == cp) - abort (); + emacs_abort (); if (!CHILD_ACTIVE (cp)) return; @@ -316,7 +339,7 @@ create_child (char *exe, char *cmdline, char *env, int is_gui_app, DWORD flags; char dir[ MAXPATHLEN ]; - if (cp == NULL) abort (); + if (cp == NULL) emacs_abort (); memset (&start, 0, sizeof (start)); start.cb = sizeof (start); @@ -405,7 +428,7 @@ register_child (int pid, int fd) if (fd_info[fd].cp != NULL) { DebPrint (("register_child: fd_info[%d] apparently in use!\n", fd)); - abort (); + emacs_abort (); } fd_info[fd].cp = cp; @@ -459,7 +482,7 @@ sys_wait (int *status) /* We want to wait for a specific child */ wait_hnd[nh] = dead_child->procinfo.hProcess; cps[nh] = dead_child; - if (!wait_hnd[nh]) abort (); + if (!wait_hnd[nh]) emacs_abort (); nh++; active = 0; goto get_result; @@ -507,7 +530,7 @@ sys_wait (int *status) active -= WAIT_ABANDONED_0; } else - abort (); + emacs_abort (); get_result: if (!GetExitCodeProcess (wait_hnd[active], &retval)) @@ -1189,7 +1212,7 @@ sys_select (int nfds, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds, #endif wait_hnd[nh] = cp->char_avail; fdindex[nh] = i; - if (!wait_hnd[nh]) abort (); + if (!wait_hnd[nh]) emacs_abort (); nh++; #ifdef FULL_DEBUG DebPrint (("select waiting on child %d fd %d\n", @@ -1276,7 +1299,7 @@ count_children: active -= WAIT_ABANDONED_0; } else - abort (); + emacs_abort (); /* Loop over all handles after active (now officially documented as being the first signaled handle in the array). We do this to diff --git a/src/w32select.c b/src/w32select.c index 59ff4405368..3fb88d4f17f 100644 --- a/src/w32select.c +++ b/src/w32select.c @@ -394,7 +394,7 @@ run_protected (Lisp_Object (*code) (Lisp_Object), Lisp_Object arg) BLOCK_INPUT; - /* Fsignal calls abort() if it sees that waiting_for_input is + /* Fsignal calls emacs_abort () if it sees that waiting_for_input is set. */ owfi = waiting_for_input; waiting_for_input = 0; diff --git a/src/w32term.c b/src/w32term.c index 6948a98998e..571db3cbe8e 100644 --- a/src/w32term.c +++ b/src/w32term.c @@ -2426,7 +2426,7 @@ x_draw_glyph_string (struct glyph_string *s) break; default: - abort (); + emacs_abort (); } if (!s->for_overlaps) @@ -2626,7 +2626,7 @@ x_delete_glyphs (struct frame *f, register int n) if (! FRAME_W32_P (f)) return; - abort (); + emacs_abort (); } @@ -2709,7 +2709,7 @@ x_ins_del_lines (struct frame *f, int vpos, int n) if (! FRAME_W32_P (f)) return; - abort (); + emacs_abort (); } @@ -3431,7 +3431,7 @@ x_window_to_scroll_bar (Window window_id) frame = XCAR (tail); /* All elements of Vframe_list should be frames. */ if (! FRAMEP (frame)) - abort (); + emacs_abort (); /* Scan this frame's scroll bar list for a scroll bar with the right window ID. */ @@ -3854,7 +3854,7 @@ w32_redeem_scroll_bar (struct window *window) /* We can't redeem this window's scroll bar if it doesn't have one. */ if (NILP (window->vertical_scroll_bar)) - abort (); + emacs_abort (); bar = XSCROLL_BAR (window->vertical_scroll_bar); @@ -3873,7 +3873,7 @@ w32_redeem_scroll_bar (struct window *window) else /* If its prev pointer is nil, it must be at the front of one or the other! */ - abort (); + emacs_abort (); } else XSCROLL_BAR (bar->prev)->next = bar->next; @@ -3928,7 +3928,7 @@ w32_scroll_bar_handle_click (struct scroll_bar *bar, W32Msg *msg, struct input_event *emacs_event) { if (! WINDOWP (bar->window)) - abort (); + emacs_abort (); emacs_event->kind = SCROLL_BAR_CLICK_EVENT; emacs_event->code = 0; @@ -5233,7 +5233,7 @@ w32_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, break; default: - abort (); + emacs_abort (); } } } diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c index bc45e2c648c..cf99d14dc77 100644 --- a/src/w32uniscribe.c +++ b/src/w32uniscribe.c @@ -454,7 +454,11 @@ uniscribe_shape (Lisp_Object lgstring) } else ASET (vec, 0, make_number (offsets[j].du + adj_offset)); - ASET (vec, 1, make_number (offsets[j].dv)); + /* In the font definition coordinate system, the + Y coordinate points up, while in our screen + coordinates Y grows downwards. So we need to + reverse the sign of Y-OFFSET here. */ + ASET (vec, 1, make_number (-offsets[j].dv)); /* Based on what ftfont.c does... */ ASET (vec, 2, make_number (advances[j])); LGLYPH_SET_ADJUSTMENT (lglyph, vec); diff --git a/src/w32xfns.c b/src/w32xfns.c index 62e45dd987b..820dbcc76c6 100644 --- a/src/w32xfns.c +++ b/src/w32xfns.c @@ -122,7 +122,7 @@ get_frame_dc (FRAME_PTR f) HDC hdc; if (f->output_method != output_w32) - abort (); + emacs_abort (); enter_crit (); diff --git a/src/widget.c b/src/widget.c index ea9bdb61b13..0100acc8143 100644 --- a/src/widget.c +++ b/src/widget.c @@ -50,9 +50,6 @@ along with GNU Emacs. If not, see . */ #include #include "../lwlib/lwlib.h" -#include -#include "syssignal.h" - #include "character.h" #include "font.h" @@ -226,7 +223,7 @@ get_wm_shell (Widget w) static void mark_shell_size_user_specified (Widget wmshell) { - if (! XtIsWMShell (wmshell)) abort (); + if (! XtIsWMShell (wmshell)) emacs_abort (); /* This is kind of sleazy, but I can't see how else to tell it to make it mark the WM_SIZE_HINTS size as user specified when appropriate. */ ((WMShellWidget) wmshell)->wm.size_hints.flags |= USSize; @@ -290,7 +287,7 @@ set_frame_size (EmacsFrame ew) Widget wmshell = get_wm_shell ((Widget) ew); /* Each Emacs shell is now independent and top-level. */ - if (! XtIsSubclass (wmshell, shellWidgetClass)) abort (); + if (! XtIsSubclass (wmshell, shellWidgetClass)) emacs_abort (); /* We don't need this for the moment. The geometry is computed in xfns.c. */ @@ -677,8 +674,8 @@ EmacsFrameDestroy (Widget widget) EmacsFrame ew = (EmacsFrame) widget; struct frame* s = ew->emacs_frame.frame; - if (! s) abort (); - if (! s->output_data.x) abort (); + if (! s) emacs_abort (); + if (! s->output_data.x) emacs_abort (); BLOCK_INPUT; x_free_gcs (s); diff --git a/src/window.c b/src/window.c index 93fef54c95f..87429b51448 100644 --- a/src/window.c +++ b/src/window.c @@ -387,7 +387,7 @@ the first window of that frame. */) else if (! NILP (XWINDOW (window)->vchild)) window = XWINDOW (window)->vchild; else - abort (); + emacs_abort (); } return window; @@ -1290,7 +1290,7 @@ If they are in the windows's left or right marginal areas, `left-margin'\n\ return Qnil; default: - abort (); + emacs_abort (); } } @@ -1949,7 +1949,7 @@ unshow_buffer (register struct window *w) buf = w->buffer; b = XBUFFER (buf); if (b != XMARKER (w->pointm)->buffer) - abort (); + emacs_abort (); #if 0 if (w == XWINDOW (selected_window) @@ -2670,7 +2670,7 @@ window_loop (enum window_loop type, Lisp_Object obj, int mini, Lisp_Object frame case CHECK_ALL_WINDOWS: if (! NILP (w->buffer) && NILP (BVAR (XBUFFER (w->buffer), name))) - abort (); + emacs_abort (); break; case WINDOW_LOOP_UNUSED: @@ -6580,15 +6580,17 @@ freeze_window_starts (struct frame *f, int freeze_p) /* Return 1 if window configurations CONFIGURATION1 and CONFIGURATION2 describe the same state of affairs. This is used by Fequal. - ignore_positions non-zero means ignore non-matching scroll positions + IGNORE_POSITIONS means ignore non-matching scroll positions and the like. This ignores a couple of things like the dedication status of window, combination_limit and the like. This might have to be fixed. */ -int -compare_window_configurations (Lisp_Object configuration1, Lisp_Object configuration2, int ignore_positions) +bool +compare_window_configurations (Lisp_Object configuration1, + Lisp_Object configuration2, + bool ignore_positions) { register struct save_window_data *d1, *d2; struct Lisp_Vector *sws1, *sws2; diff --git a/src/window.h b/src/window.h index dfb88b2cf3c..a70bc55bac5 100644 --- a/src/window.h +++ b/src/window.h @@ -27,8 +27,6 @@ INLINE_HEADER_BEGIN # define WINDOW_INLINE INLINE #endif -extern Lisp_Object Qleft, Qright; - /* Windows are allocated as if they were vectors, but then the Lisp data type is changed to Lisp_Window. They are garbage collected along with the vectors. @@ -973,7 +971,7 @@ extern Lisp_Object Qwindowp, Qwindow_live_p; extern Lisp_Object Vwindow_list; extern struct window *decode_live_window (Lisp_Object); -extern int compare_window_configurations (Lisp_Object, Lisp_Object, int); +extern bool compare_window_configurations (Lisp_Object, Lisp_Object, bool); extern void mark_window_cursors_off (struct window *); extern int window_internal_height (struct window *); extern int window_body_cols (struct window *w); diff --git a/src/xdisp.c b/src/xdisp.c index fcd76c94681..df402cd106e 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -366,6 +366,7 @@ static Lisp_Object Qslice; Lisp_Object Qcenter; static Lisp_Object Qmargin, Qpointer; static Lisp_Object Qline_height; +Lisp_Object Qinhibit_debug_on_message; /* These setters are used only in this file, so they can be private. */ static inline void @@ -7347,7 +7348,7 @@ set_iterator_to_next (struct it *it, int reseat_p) #endif default: /* There are no other methods defined, so this should be a bug. */ - abort (); + emacs_abort (); } eassert (it->method != GET_FROM_STRING @@ -7815,7 +7816,7 @@ compute_stop_pos_backwards (struct it *it) compute_stop_pos (it); /* We must advance forward, right? */ if (it->stop_charpos <= charpos) - abort (); + emacs_abort (); } while (charpos > BEGV && it->stop_charpos >= it->end_charpos); @@ -7864,7 +7865,7 @@ handle_stop_backwards (struct it *it, ptrdiff_t charpos) compute_stop_pos (it); /* We must advance forward, right? */ if (it->stop_charpos <= it->prev_stop) - abort (); + emacs_abort (); charpos = it->stop_charpos; } while (charpos <= where_we_are); @@ -8952,7 +8953,7 @@ move_it_to (struct it *it, ptrdiff_t to_charpos, int to_x, int to_y, int to_vpos break; default: - abort (); + emacs_abort (); } /* Reset/increment for the next run. */ @@ -10586,7 +10587,7 @@ void check_message_stack (void) { if (!NILP (Vmessage_stack)) - abort (); + emacs_abort (); } @@ -10625,7 +10626,6 @@ truncate_message_1 (ptrdiff_t nchars, Lisp_Object a2, ptrdiff_t a3, ptrdiff_t a4 return 0; } - /* Set the current message to a substring of S or STRING. If STRING is a Lisp string, set the message to the first NBYTES @@ -10644,6 +10644,8 @@ static void set_message (const char *s, Lisp_Object string, ptrdiff_t nbytes, int multibyte_p) { + ptrdiff_t count = SPECPDL_INDEX (); + message_enable_multibyte = ((s && multibyte_p) || (STRINGP (string) && STRING_MULTIBYTE (string))); @@ -10652,6 +10654,15 @@ set_message (const char *s, Lisp_Object string, (intptr_t) s, string, nbytes, multibyte_p); message_buf_print = 0; help_echo_showing_p = 0; + + if (NILP (Vinhibit_debug_on_message) && STRINGP (Vdebug_on_message) + && fast_string_match (Vdebug_on_message, string) >= 0) + { + specbind (Qinhibit_debug_on_message, Qt); + call_debugger (list2 (Qerror, string)); + } + + unbind_to (count, Qnil); } @@ -13572,10 +13583,9 @@ redisplay_internal (void) } else if (FRAME_VISIBLE_P (sf) && !FRAME_OBSCURED_P (sf)) { - Lisp_Object mini_window; + Lisp_Object mini_window = FRAME_MINIBUF_WINDOW (sf); struct frame *mini_frame; - mini_window = FRAME_MINIBUF_WINDOW (sf); displayed_buffer = XBUFFER (XWINDOW (selected_window)->buffer); /* Use list_of_error, not Qerror, so that we catch only errors and don't run the debugger. */ @@ -14477,7 +14487,7 @@ set_cursor_from_row (struct window *w, struct glyph_row *row, for (g = row->glyphs[TEXT_AREA], x = row->x; g < glyph; g++) { if (g >= row->glyphs[TEXT_AREA] + row->used[TEXT_AREA]) - abort (); + emacs_abort (); x += g->pixel_width; } } @@ -14598,7 +14608,7 @@ run_window_scroll_functions (Lisp_Object window, struct text_pos startp) SET_MARKER_FROM_TEXT_POS (w->start, startp); if (current_buffer != XBUFFER (w->buffer)) - abort (); + emacs_abort (); if (!NILP (Vwindow_scroll_functions)) { @@ -15567,9 +15577,9 @@ redisplay_window (Lisp_Object window, int just_this_one_p) /* Some sanity checks. */ CHECK_WINDOW_END (w); if (Z == Z_BYTE && CHARPOS (opoint) != BYTEPOS (opoint)) - abort (); + emacs_abort (); if (BYTEPOS (opoint) < CHARPOS (opoint)) - abort (); + emacs_abort (); /* If %c is in mode line, update it if needed. */ if (!NILP (w->column_number_displayed) @@ -15781,7 +15791,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p) goto try_to_scroll; default: - abort (); + emacs_abort (); } } /* If current starting point was originally the beginning of a line @@ -15944,7 +15954,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p) break; default: - abort (); + emacs_abort (); } } @@ -17413,7 +17423,7 @@ try_window_id (struct window *w) if (row) set_cursor_from_row (w, row, current_matrix, 0, 0, 0, 0); else - abort (); + emacs_abort (); return 1; } } @@ -17457,7 +17467,7 @@ try_window_id (struct window *w) if (row) set_cursor_from_row (w, row, current_matrix, 0, 0, 0, 0); else - abort (); + emacs_abort (); return 2; } } @@ -17946,7 +17956,7 @@ try_window_id (struct window *w) IF_DEBUG (debug_method_add (w, "C")); } else - abort (); + emacs_abort (); IF_DEBUG (debug_end_pos = XFASTINT (w->window_end_pos); debug_end_vpos = XFASTINT (w->window_end_vpos)); @@ -19346,7 +19356,7 @@ find_row_edges (struct it *it, struct glyph_row *row, /* A line that is entirely from a string/image/stretch... */ row->maxpos = row->minpos; else - abort (); + emacs_abort (); } else row->maxpos = it->current.pos; @@ -20187,7 +20197,7 @@ See also `bidi-paragraph-direction'. */) return Qright_to_left; break; default: - abort (); + emacs_abort (); } } } @@ -22100,7 +22110,7 @@ display_string (const char *string, Lisp_Object lisp_string, Lisp_Object face_st { /* Glyph is off the left margin of the display area. Should not happen. */ - abort (); + emacs_abort (); } row->ascent = max (row->ascent, it->max_ascent); @@ -23507,7 +23517,7 @@ compute_overhangs_and_x (struct glyph_string *s, int x, int backward_p) break; \ \ default: \ - abort (); \ + emacs_abort (); \ } \ \ if (s) \ @@ -23860,7 +23870,7 @@ append_glyph (struct it *it) { glyph->resolved_level = it->bidi_it.resolved_level; if ((it->bidi_it.type & 7) != it->bidi_it.type) - abort (); + emacs_abort (); glyph->bidi_type = it->bidi_it.type; } else @@ -23934,7 +23944,7 @@ append_composite_glyph (struct it *it) { glyph->resolved_level = it->bidi_it.resolved_level; if ((it->bidi_it.type & 7) != it->bidi_it.type) - abort (); + emacs_abort (); glyph->bidi_type = it->bidi_it.type; } ++it->glyph_row->used[area]; @@ -24113,7 +24123,7 @@ produce_image_glyph (struct it *it) { glyph->resolved_level = it->bidi_it.resolved_level; if ((it->bidi_it.type & 7) != it->bidi_it.type) - abort (); + emacs_abort (); glyph->bidi_type = it->bidi_it.type; } ++it->glyph_row->used[area]; @@ -24257,7 +24267,7 @@ append_stretch_glyph (struct it *it, Lisp_Object object, { glyph->resolved_level = it->bidi_it.resolved_level; if ((it->bidi_it.type & 7) != it->bidi_it.type) - abort (); + emacs_abort (); glyph->bidi_type = it->bidi_it.type; } else @@ -24512,7 +24522,7 @@ produce_special_glyphs (struct it *it, enum display_element_type what) } } else - abort (); + emacs_abort (); #ifdef HAVE_WINDOW_SYSTEM /* On a GUI frame, when the right fringe (left fringe for R2L rows) @@ -24709,7 +24719,7 @@ append_glyphless_glyph (struct it *it, int face_id, int for_no_font, int len, { glyph->resolved_level = it->bidi_it.resolved_level; if ((it->bidi_it.type & 7) != it->bidi_it.type) - abort (); + emacs_abort (); glyph->bidi_type = it->bidi_it.type; } ++it->glyph_row->used[area]; @@ -29552,6 +29562,15 @@ Its value should be an ASCII acronym string, `hex-code', `empty-box', or Vglyphless_char_display = Fmake_char_table (Qglyphless_char_display, Qnil); Fset_char_table_extra_slot (Vglyphless_char_display, make_number (0), Qempty_box); + + DEFVAR_LISP ("debug-on-message", Vdebug_on_message, + doc: /* If non-nil, debug if a message matching this regexp is displayed. */); + Vdebug_on_message = Qnil; + + DEFVAR_LISP ("inhibit-debug-on-message", Vinhibit_debug_on_message, + doc: /* If non-nil, inhibit `debug-on-message' from entering the debugger. */); + Vinhibit_debug_on_message = Qnil; + DEFSYM(Qinhibit_debug_on_message, "inhibit-debug-on-message"); } diff --git a/src/xfaces.c b/src/xfaces.c index 4df5caf6f2a..aee5158036f 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -510,7 +510,7 @@ unregister_color (unsigned long pixel) if (color_count[pixel] > 0) --color_count[pixel]; else - abort (); + emacs_abort (); } @@ -727,7 +727,7 @@ init_frame_faces (struct frame *f) if (!FRAME_NS_P (f) || FRAME_NS_WINDOW (f)) #endif if (!realize_basic_faces (f)) - abort (); + emacs_abort (); } @@ -771,7 +771,7 @@ recompute_basic_faces (struct frame *f) { clear_face_cache (0); if (!realize_basic_faces (f)) - abort (); + emacs_abort (); } } @@ -1108,7 +1108,7 @@ defined_color (struct frame *f, const char *color_name, XColor *color_def, return ns_defined_color (f, color_name, color_def, alloc, 1); #endif else - abort (); + emacs_abort (); } @@ -1304,7 +1304,7 @@ load_color (struct frame *f, struct face *face, Lisp_Object name, break; default: - abort (); + emacs_abort (); } } #ifdef GLYPH_DEBUG @@ -4548,7 +4548,7 @@ lookup_named_face (struct frame *f, Lisp_Object symbol, int signal_p) return -1; default_face = FACE_FROM_ID (f, DEFAULT_FACE_ID); if (default_face == NULL) - abort (); /* realize_basic_faces must have set it up */ + emacs_abort (); /* realize_basic_faces must have set it up */ } if (! get_lface_attributes (f, symbol, symbol_attrs, signal_p, 0)) @@ -4591,7 +4591,7 @@ lookup_basic_face (struct frame *f, int face_id) case MENU_FACE_ID: name = Qmenu; break; default: - abort (); /* the caller is supposed to pass us a basic face id */ + emacs_abort (); /* the caller is supposed to pass us a basic face id */ } /* Do a quick scan through Vface_remapping_alist, and return immediately @@ -4712,7 +4712,7 @@ lookup_derived_face (struct frame *f, Lisp_Object symbol, int face_id, struct face *default_face = FACE_FROM_ID (f, face_id); if (!default_face) - abort (); + emacs_abort (); if (!get_lface_attributes (f, symbol, symbol_attrs, signal_p, 0)) return -1; @@ -5102,7 +5102,7 @@ face for italic. */) error ("Cannot realize default face"); def_face = FACE_FROM_ID (f, DEFAULT_FACE_ID); if (def_face == NULL) - abort (); /* realize_basic_faces must have set it up */ + emacs_abort (); /* realize_basic_faces must have set it up */ } /* Dispatch to the appropriate handler. */ @@ -5387,7 +5387,7 @@ realize_default_face (struct frame *f) else if (FRAME_INITIAL_P (f) || FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f)) ASET (lface, LFACE_FOREGROUND_INDEX, build_string (unspecified_fg)); else - abort (); + emacs_abort (); } if (UNSPECIFIEDP (LFACE_BACKGROUND (lface))) @@ -5402,7 +5402,7 @@ realize_default_face (struct frame *f) else if (FRAME_INITIAL_P (f) || FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f)) ASET (lface, LFACE_BACKGROUND_INDEX, build_string (unspecified_bg)); else - abort (); + emacs_abort (); } if (UNSPECIFIEDP (LFACE_STIPPLE (lface))) @@ -5502,7 +5502,7 @@ realize_face (struct face_cache *cache, Lisp_Object *attrs, int former_face_id) face = make_realized_face (attrs); } else - abort (); + emacs_abort (); /* Insert the new face. */ cache_face (cache, face, lface_hash (attrs)); @@ -5597,7 +5597,7 @@ realize_x_face (struct face_cache *cache, Lisp_Object *attrs) if (default_face) fontset = default_face->fontset; if (fontset == -1) - abort (); + emacs_abort (); } if (! FONT_OBJECT_P (attrs[LFACE_FONT_INDEX])) attrs[LFACE_FONT_INDEX] diff --git a/src/xfont.c b/src/xfont.c index be9556d585a..7755b780815 100644 --- a/src/xfont.c +++ b/src/xfont.c @@ -126,7 +126,7 @@ static int xfont_has_char (Lisp_Object, int); static unsigned xfont_encode_char (struct font *, int); static int xfont_text_extents (struct font *, unsigned *, int, struct font_metrics *); -static int xfont_draw (struct glyph_string *, int, int, int, int, int); +static int xfont_draw (struct glyph_string *, int, int, int, int, bool); static int xfont_check (FRAME_PTR, struct font *); struct font_driver xfont_driver = @@ -217,9 +217,9 @@ xfont_encode_coding_xlfd (char *xlfd) /* Check if CHARS (cons or vector) is supported by XFONT whose encoding charset is ENCODING (XFONT is NULL) or by a font whose registry corresponds to ENCODING and REPERTORY. - Return 1 if supported, return 0 otherwise. */ + Return true if supported. */ -static int +static bool xfont_chars_supported (Lisp_Object chars, XFontStruct *xfont, struct charset *encoding, struct charset *repertory) { @@ -1019,7 +1019,8 @@ xfont_text_extents (struct font *font, unsigned int *code, int nglyphs, struct f } static int -xfont_draw (struct glyph_string *s, int from, int to, int x, int y, int with_background) +xfont_draw (struct glyph_string *s, int from, int to, int x, int y, + bool with_background) { XFontStruct *xfont = ((struct xfont_info *) s->font)->xfont; int len = to - from; @@ -1040,7 +1041,7 @@ xfont_draw (struct glyph_string *s, int from, int to, int x, int y, int with_bac for (i = 0; i < len ; i++) str[i] = XCHAR2B_BYTE2 (s->char2b + from + i); BLOCK_INPUT; - if (with_background > 0) + if (with_background) { if (s->padding_p) for (i = 0; i < len; i++) @@ -1066,7 +1067,7 @@ xfont_draw (struct glyph_string *s, int from, int to, int x, int y, int with_bac } BLOCK_INPUT; - if (with_background > 0) + if (with_background) { if (s->padding_p) for (i = 0; i < len; i++) diff --git a/src/xftfont.c b/src/xftfont.c index 5e60ab0c4d3..404b9124099 100644 --- a/src/xftfont.c +++ b/src/xftfont.c @@ -52,7 +52,7 @@ struct xftfont_info /* The following five members must be here in this order to be compatible with struct ftfont_info (in ftfont.c). */ #ifdef HAVE_LIBOTF - int maybe_otf; /* Flag to tell if this may be OTF or not. */ + bool maybe_otf; /* Flag to tell if this may be OTF or not. */ OTF *otf; #endif /* HAVE_LIBOTF */ FT_Size ft_size; @@ -92,7 +92,7 @@ xftfont_get_colors (FRAME_PTR f, struct face *face, GC gc, struct xftface_info * else { XGCValues xgcv; - int fg_done = 0, bg_done = 0; + bool fg_done = 0, bg_done = 0; BLOCK_INPUT; XGetGCValues (FRAME_X_DISPLAY (f), gc, @@ -111,7 +111,7 @@ xftfont_get_colors (FRAME_PTR f, struct face *face, GC gc, struct xftface_info * *bg = xftface_info->xft_fg, bg_done = 1; } - if (fg_done + bg_done < 2) + if (! (fg_done & bg_done)) { XColor colors[2]; @@ -137,19 +137,6 @@ xftfont_get_colors (FRAME_PTR f, struct face *face, GC gc, struct xftface_info * } -static Lisp_Object xftfont_list (Lisp_Object, Lisp_Object); -static Lisp_Object xftfont_match (Lisp_Object, Lisp_Object); -static Lisp_Object xftfont_open (FRAME_PTR, Lisp_Object, int); -static void xftfont_close (FRAME_PTR, struct font *); -static int xftfont_prepare_face (FRAME_PTR, struct face *); -static void xftfont_done_face (FRAME_PTR, struct face *); -static int xftfont_has_char (Lisp_Object, int); -static unsigned xftfont_encode_char (struct font *, int); -static int xftfont_text_extents (struct font *, unsigned *, int, - struct font_metrics *); -static int xftfont_draw (struct glyph_string *, int, int, int, int, int); -static int xftfont_end_for_frame (FRAME_PTR f); - struct font_driver xftfont_driver; static Lisp_Object @@ -470,7 +457,7 @@ xftfont_open (FRAME_PTR f, Lisp_Object entity, int pixel_size) font->underline_thickness = 0; } #ifdef HAVE_LIBOTF - xftfont_info->maybe_otf = ft_face->face_flags & FT_FACE_FLAG_SFNT; + xftfont_info->maybe_otf = (ft_face->face_flags & FT_FACE_FLAG_SFNT) != 0; xftfont_info->otf = NULL; #endif /* HAVE_LIBOTF */ xftfont_info->ft_size = ft_face->size; @@ -630,7 +617,8 @@ xftfont_get_xft_draw (FRAME_PTR f) } static int -xftfont_draw (struct glyph_string *s, int from, int to, int x, int y, int with_background) +xftfont_draw (struct glyph_string *s, int from, int to, int x, int y, + bool with_background) { FRAME_PTR f = s->f; struct face *face = s->face; @@ -711,15 +699,17 @@ xftfont_end_for_frame (FRAME_PTR f) return 0; } -static int -xftfont_cached_font_ok (struct frame *f, Lisp_Object font_object, Lisp_Object entity) +static bool +xftfont_cached_font_ok (struct frame *f, Lisp_Object font_object, + Lisp_Object entity) { struct xftfont_info *info = (struct xftfont_info *) XFONT_OBJECT (font_object); FcPattern *oldpat = info->xftfont->pattern; Display *display = FRAME_X_DISPLAY (f); FcPattern *pat = FcPatternCreate (); FcBool b1, b2; - int ok = 0, i1, i2, r1, r2; + bool ok = 0; + int i1, i2, r1, r2; xftfont_add_rendering_parameters (pat, entity); XftDefaultSubstitute (display, FRAME_X_SCREEN_NUMBER (f), pat); diff --git a/src/xmenu.c b/src/xmenu.c index 54a7849218a..605db13e149 100644 --- a/src/xmenu.c +++ b/src/xmenu.c @@ -32,11 +32,6 @@ along with GNU Emacs. If not, see . */ #include -#if 0 /* Why was this included? And without syssignal.h? */ -/* On 4.3 this loses if it comes after xterm.h. */ -#include -#endif - #include #include @@ -169,7 +164,7 @@ mouse_position_for_popup (FRAME_PTR f, int *x, int *y) int dummy; if (! FRAME_X_P (f)) - abort (); + emacs_abort (); BLOCK_INPUT; @@ -636,7 +631,7 @@ void x_activate_menubar (FRAME_PTR f) { if (! FRAME_X_P (f)) - abort (); + emacs_abort (); if (!f->output_data.x->saved_menu_event->type) return; @@ -852,7 +847,7 @@ update_frame_menubar (FRAME_PTR f) int columns, rows; if (! FRAME_X_P (f)) - abort (); + emacs_abort (); x = f->output_data.x; @@ -940,7 +935,7 @@ set_frame_menubar (FRAME_PTR f, int first_time, int deep_p) int *submenu_top_level_items, *submenu_n_panes; if (! FRAME_X_P (f)) - abort (); + emacs_abort (); menubar_widget = f->output_data.x->menubar_widget; @@ -1299,7 +1294,7 @@ free_frame_menubar (FRAME_PTR f) Widget menubar_widget; if (! FRAME_X_P (f)) - abort (); + emacs_abort (); menubar_widget = f->output_data.x->menubar_widget; @@ -1450,7 +1445,7 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, int x, int y, #endif if (! FRAME_X_P (f)) - abort (); + emacs_abort (); xg_crazy_callback_abort = 1; menu = xg_create_widget ("popup", first_wv->name, f, first_wv, @@ -1557,7 +1552,7 @@ create_and_show_popup_menu (FRAME_PTR f, widget_value *first_wv, Widget menu; if (! FRAME_X_P (f)) - abort (); + emacs_abort (); #ifdef USE_LUCID apply_systemfont_to_menu (f, f->output_data.x->widget); @@ -1646,7 +1641,7 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, ptrdiff_t specpdl_count = SPECPDL_INDEX (); if (! FRAME_X_P (f)) - abort (); + emacs_abort (); *error_name = NULL; @@ -1792,7 +1787,7 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, else if (EQ (type, QCradio)) wv->button_type = BUTTON_TYPE_RADIO; else - abort (); + emacs_abort (); wv->selected = !NILP (selected); @@ -1930,7 +1925,7 @@ create_and_show_dialog (FRAME_PTR f, widget_value *first_wv) GtkWidget *menu; if (! FRAME_X_P (f)) - abort (); + emacs_abort (); menu = xg_create_widget ("dialog", first_wv->name, f, first_wv, G_CALLBACK (dialog_selection_callback), @@ -1977,7 +1972,7 @@ create_and_show_dialog (FRAME_PTR f, widget_value *first_wv) LWLIB_ID dialog_id; if (!FRAME_X_P (f)) - abort (); + emacs_abort (); dialog_id = widget_id_tick++; #ifdef USE_LUCID @@ -2036,7 +2031,7 @@ xdialog_show (FRAME_PTR f, ptrdiff_t specpdl_count = SPECPDL_INDEX (); if (! FRAME_X_P (f)) - abort (); + emacs_abort (); *error_name = NULL; @@ -2301,7 +2296,7 @@ xmenu_show (FRAME_PTR f, int x, int y, int for_click, int keymaps, ptrdiff_t specpdl_count = SPECPDL_INDEX (); if (! FRAME_X_P (f) && ! FRAME_MSDOS_P (f)) - abort (); + emacs_abort (); *error_name = 0; if (menu_items_n_panes == 0) diff --git a/src/xselect.c b/src/xselect.c index 463bd6e37b0..5a3b7452c6d 100644 --- a/src/xselect.c +++ b/src/xselect.c @@ -193,7 +193,7 @@ static void x_start_queuing_selection_requests (void) { if (x_queue_selection_requests) - abort (); + emacs_abort (); x_queue_selection_requests++; TRACE1 ("x_start_queuing_selection_requests %d", x_queue_selection_requests); @@ -245,7 +245,7 @@ symbol_to_x_atom (struct x_display_info *dpyinfo, Lisp_Object sym) if (EQ (sym, QEMACS_TMP)) return dpyinfo->Xatom_EMACS_TMP; if (EQ (sym, QTARGETS)) return dpyinfo->Xatom_TARGETS; if (EQ (sym, QNULL)) return dpyinfo->Xatom_NULL; - if (!SYMBOLP (sym)) abort (); + if (!SYMBOLP (sym)) emacs_abort (); TRACE1 (" XInternAtom %s", SSDATA (SYMBOL_NAME (sym))); BLOCK_INPUT; @@ -1138,7 +1138,7 @@ wait_for_property_change (struct prop_location *location) ptrdiff_t count = SPECPDL_INDEX (); if (property_change_reply_object) - abort (); + emacs_abort (); /* Make sure to do unexpect_property_change if we quit or err. */ record_unwind_protect (wait_for_property_change_unwind, diff --git a/src/xterm.c b/src/xterm.c index 23cc72305ba..4ce87142c1a 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -21,7 +21,6 @@ along with GNU Emacs. If not, see . */ /* Xt features made by Fred Pierresteguy. */ #include -#include #include #include @@ -29,9 +28,6 @@ along with GNU Emacs. If not, see . */ #include "lisp.h" #include "blockinput.h" - -/* Need syssignal.h for various externs and definitions that may be required - by some configurations for calls to signal later in this source file. */ #include "syssignal.h" /* This may include sys/types.h, and that somehow loses @@ -1470,7 +1466,7 @@ x_frame_of_widget (Widget widget) && f->output_data.x->widget == widget) return f; - abort (); + emacs_abort (); } /* Allocate a color which is lighter or darker than *PIXEL by FACTOR @@ -2699,7 +2695,7 @@ x_draw_underwave (struct glyph_string *s) y2 += dy; if (INT_MAX - dx < xmax) - abort (); + emacs_abort (); while (x1 <= xmax) { @@ -2814,7 +2810,7 @@ x_draw_glyph_string (struct glyph_string *s) break; default: - abort (); + emacs_abort (); } if (!s->for_overlaps) @@ -3014,7 +3010,7 @@ x_shift_glyphs_for_insert (struct frame *f, int x, int y, int width, int height, static void x_delete_glyphs (struct frame *f, register int n) { - abort (); + emacs_abort (); } @@ -3287,7 +3283,7 @@ XTset_terminal_window (struct frame *f, int n) static void x_ins_del_lines (struct frame *f, int vpos, int n) { - abort (); + emacs_abort (); } @@ -4124,7 +4120,7 @@ x_window_to_scroll_bar (Display *display, Window window_id) frame = XCAR (tail); /* All elements of Vframe_list should be frames. */ if (! FRAMEP (frame)) - abort (); + emacs_abort (); if (! FRAME_X_P (XFRAME (frame))) continue; @@ -5443,7 +5439,7 @@ XTredeem_scroll_bar (struct window *window) /* We can't redeem this window's scroll bar if it doesn't have one. */ if (NILP (window->vertical_scroll_bar)) - abort (); + emacs_abort (); bar = XSCROLL_BAR (window->vertical_scroll_bar); @@ -5462,7 +5458,7 @@ XTredeem_scroll_bar (struct window *window) else /* If its prev pointer is nil, it must be at the front of one or the other! */ - abort (); + emacs_abort (); } else XSCROLL_BAR (bar->prev)->next = bar->next; @@ -5560,7 +5556,7 @@ static void x_scroll_bar_handle_click (struct scroll_bar *bar, XEvent *event, struct input_event *emacs_event) { if (! WINDOWP (bar->window)) - abort (); + emacs_abort (); emacs_event->kind = SCROLL_BAR_CLICK_EVENT; emacs_event->code = event->xbutton.button - Button1; @@ -6466,7 +6462,7 @@ handle_one_xevent (struct x_display_info *dpyinfo, XEvent *eventptr, } else if (status_return != XLookupKeySym && status_return != XLookupBoth) - abort (); + emacs_abort (); } else nbytes = XLookupString (&event.xkey, (char *) copy_bufptr, @@ -7510,7 +7506,7 @@ x_draw_window_cursor (struct window *w, struct glyph_row *glyph_row, int x, int break; default: - abort (); + emacs_abort (); } } @@ -7780,7 +7776,9 @@ x_connection_signal (int signalnum) /* If we don't have an argument, */ #ifdef USG /* USG systems forget handlers when they are used; must reestablish each time */ - signal (signalnum, x_connection_signal); + struct sigaction action; + emacs_sigaction_init (&action, x_connection_signal); + sigaction (signalnum, &action, 0); #endif /* USG */ } @@ -7863,7 +7861,7 @@ When compiled with GTK, Emacs cannot recover from X disconnects.\n\ This is a GTK bug: https://bugzilla.gnome.org/show_bug.cgi?id=85715\n\ For details, see etc/PROBLEMS.\n", error_msg); - abort (); + emacs_abort (); #endif /* USE_GTK */ /* Indicate that this display is dead. */ @@ -7873,7 +7871,7 @@ For details, see etc/PROBLEMS.\n", dpyinfo->terminal->reference_count--; if (dpyinfo->reference_count != 0) /* We have just closed all frames on this display. */ - abort (); + emacs_abort (); { Lisp_Object tmp; @@ -7890,10 +7888,15 @@ For details, see etc/PROBLEMS.\n", } /* Ordinary stack unwind doesn't deal with these. */ + { + sigset_t unblocked; + sigemptyset (&unblocked); #ifdef SIGIO - sigunblock (sigmask (SIGIO)); + sigaddset (&unblocked, SIGIO); #endif - sigunblock (sigmask (SIGALRM)); + sigaddset (&unblocked, SIGALRM); + pthread_sigmask (SIG_UNBLOCK, &unblocked, 0); + } TOTALLY_UNBLOCK_INPUT; unbind_to (idx, Qnil); @@ -10454,7 +10457,7 @@ x_term_init (Lisp_Object display_name, char *xrm_option, char *resource_name) to.addr = (XPointer)&font; x_catch_errors (dpy); if (!XtCallConverter (dpy, XtCvtStringToFont, &d, 1, &fr, &to, NULL)) - abort (); + emacs_abort (); if (x_had_errors_p (dpy) || !XQueryFont (dpy, font)) XrmPutLineResource (&xrdb, "Emacs.dialog.*.font: 9x15"); x_uncatch_errors (); @@ -10777,6 +10780,8 @@ x_create_terminal (struct x_display_info *dpyinfo) void x_initialize (void) { + struct sigaction action; + baud_rate = 19200; x_noop_count = 0; @@ -10823,7 +10828,8 @@ x_initialize (void) XSetErrorHandler (x_error_handler); XSetIOErrorHandler (x_io_error_quitter); - signal (SIGPIPE, x_connection_signal); + emacs_sigaction_init (&action, x_connection_signal); + sigaction (SIGPIPE, &action, 0); } diff --git a/test/ChangeLog b/test/ChangeLog index f523f6f59a9..a7e22aa9ae1 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,14 @@ +2012-09-08 Dmitry Gutov + + * automated/ruby-mode-tests.el: + (ruby-toggle-block-to-multiline): New test. + (ruby-should-indent-buffer, ruby-toggle-block-to-do-end) + (ruby-toggle-block-to-brace): Use buffer-string. + +2012-09-07 Dmitry Gutov + + * automated/ruby-mode-tests.el: New tests (Bug#11613). + 2012-08-28 Chong Yidong * automated/files.el: Test every combination of values for diff --git a/test/automated/ruby-mode-tests.el b/test/automated/ruby-mode-tests.el index df51aa0d15a..e711b52fb9c 100644 --- a/test/automated/ruby-mode-tests.el +++ b/test/automated/ruby-mode-tests.el @@ -40,8 +40,7 @@ The whitespace before and including \"|\" on each line is removed." (insert (fix-indent content)) (ruby-mode) (indent-region (point-min) (point-max)) - (should (string= (fix-indent expected) (buffer-substring-no-properties - (point-min) (point-max))))))) + (should (string= (fix-indent expected) (buffer-string)))))) (defun ruby-assert-state (content &rest values-plist) "Assert syntax state values at the end of CONTENT. @@ -57,6 +56,13 @@ VALUES-PLIST is a list with alternating index and value elements." (cadr values-plist))) (setq values-plist (cddr values-plist))))) +(defun ruby-assert-face (content pos face) + (with-temp-buffer + (insert content) + (ruby-mode) + (font-lock-fontify-buffer) + (should (eq face (get-text-property pos 'face))))) + (ert-deftest ruby-indent-after-symbol-made-from-string-interpolation () "It can indent the line after symbol made using string interpolation." (ruby-should-indent "def foo(suffix)\n :\"bar#{suffix}\"\n" @@ -84,6 +90,11 @@ VALUES-PLIST is a list with alternating index and value elements." (ruby-should-indent "foo = {\na: b" ruby-indent-level) (ruby-should-indent "foo(\na" ruby-indent-level))) +(ert-deftest ruby-indent-after-keyword-in-a-string () + (ruby-should-indent "a = \"abc\nif\"\n " 0) + (ruby-should-indent "a = %w[abc\n def]\n " 0) + (ruby-should-indent "a = \"abc\n def\"\n " 0)) + (ert-deftest ruby-indent-simple () (ruby-should-indent-buffer "if foo @@ -201,21 +212,42 @@ VALUES-PLIST is a list with alternating index and value elements." (ert-deftest ruby-toggle-block-to-do-end () (with-temp-buffer - (insert "foo {|b|\n}\n") + (insert "foo {|b|\n}") (ruby-mode) - (search-backward "{") + (beginning-of-line) (ruby-toggle-block) - (should (string= "foo do |b|\nend\n" (buffer-substring-no-properties - (point-min) (point-max)))))) + (should (string= "foo do |b|\nend" (buffer-string))))) (ert-deftest ruby-toggle-block-to-brace () (with-temp-buffer - (insert "foo do |b|\nend\n") + (insert "foo do |b|\nend") (ruby-mode) - (search-backward "do") + (beginning-of-line) (ruby-toggle-block) - (should (string= "foo {|b|\n}\n" (buffer-substring-no-properties - (point-min) (point-max)))))) + (should (string= "foo {|b|\n}" (buffer-string))))) + +(ert-deftest ruby-toggle-block-to-multiline () + (with-temp-buffer + (insert "foo {|b| b + 1}") + (ruby-mode) + (beginning-of-line) + (ruby-toggle-block) + (should (string= "foo do |b|\n b + 1\nend" (buffer-string))))) + +(ert-deftest ruby-recognize-symbols-starting-with-at-character () + (ruby-assert-face ":@abc" 3 'font-lock-constant-face)) + +(ert-deftest ruby-hash-character-not-interpolation () + (ruby-assert-face "\"This is #{interpolation}\"" 15 + 'font-lock-variable-name-face) + (ruby-assert-face "\"This is \\#{no interpolation} despite the #\"" + 15 'font-lock-string-face) + (ruby-assert-face "\n#@comment, not ruby code" 5 'font-lock-comment-face) + (ruby-assert-state "\n#@comment, not ruby code" 4 t) + (ruby-assert-face "# A comment cannot have #{an interpolation} in it" + 30 'font-lock-comment-face) + (ruby-assert-face "# #{comment}\n \"#{interpolation}\"" 16 + 'font-lock-variable-name-face)) (provide 'ruby-mode-tests)