]> code.delx.au - gnu-emacs/commitdiff
merge trunk
authorKenichi Handa <handa@m17n.org>
Tue, 28 Aug 2012 13:44:20 +0000 (22:44 +0900)
committerKenichi Handa <handa@m17n.org>
Tue, 28 Aug 2012 13:44:20 +0000 (22:44 +0900)
98 files changed:
ChangeLog
admin/ChangeLog
admin/merge-gnulib
autogen/Makefile.in
autogen/aclocal.m4
autogen/config.in
autogen/configure
configure.ac
doc/emacs/ChangeLog
doc/emacs/cmdargs.texi
etc/NEWS
lib/execinfo.c [new file with mode: 0644]
lib/execinfo.in.h [new file with mode: 0644]
lib/gnulib.mk
lib/makefile.w32-in
lisp/ChangeLog
lisp/calc/calccomp.el
lisp/calendar/cal-tex.el
lisp/dired.el
lisp/faces.el
lisp/gnus/ChangeLog
lisp/gnus/gnus-cus.el
lisp/gnus/gnus-msg.el
lisp/gnus/gnus-sum.el
lisp/help.el
lisp/info.el
lisp/isearch.el
lisp/misc.el
lisp/progmodes/compile.el
lisp/progmodes/executable.el
lisp/progmodes/gdb-mi.el
lisp/progmodes/gud.el
lisp/vc/vc-cvs.el
lisp/window.el
lisp/woman.el
m4/execinfo.m4 [new file with mode: 0644]
m4/gnulib-comp.m4
nt/ChangeLog
nt/config.nt
src/ChangeLog
src/Makefile.in
src/alloc.c
src/atimer.c
src/atimer.h
src/bidi.c
src/buffer.c
src/buffer.h
src/bytecode.c
src/callint.c
src/callproc.c
src/casefiddle.c
src/casetab.c
src/category.c
src/category.h
src/character.c
src/character.h
src/charset.c
src/charset.h
src/chartab.c
src/cmds.c
src/coding.c
src/coding.h
src/composite.c
src/composite.h
src/data.c
src/dbusbind.c
src/dired.c
src/dispextern.h
src/dispnew.c
src/editfns.c
src/emacs.c
src/eval.c
src/fileio.c
src/fns.c
src/frame.c
src/frame.h
src/insdel.c
src/keyboard.c
src/keymap.c
src/lisp.h
src/makefile.w32-in
src/minibuf.c
src/nsmenu.m
src/nsterm.h
src/nsterm.m
src/print.c
src/process.c
src/process.h
src/textprop.c
src/undo.c
src/w32.c
src/window.c
src/window.h
src/xdisp.c
src/xgselect.c
src/xgselect.h
src/xsmfns.c
src/xterm.c

index 5657f8bb3aa9976b6dafd3f0a6e6758e955f4aa4..228cf1d74d7d595053ae396d1cbdece228e0e6f7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,27 @@
+2012-08-26  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * configure.ac (CFLAGS): Prefer -g3 to -g if -g3 works
+       and if the user has not specified CFLAGS.  -g3 simplifies
+       debugging, since it makes macros visible to the debugger.
+
+2012-08-25  Juanma Barranquero  <lekktu@gmail.com>
+
+       * lib/makefile.w32-in ($(BLD)/execinfo.$(O)): Update dependencies.
+
+2012-08-25  Eli Zaretskii  <eliz@gnu.org>
+
+       * lib/makefile.w32-in ($(BLD)/execinfo.$(O), execinfo.h): New targets.
+       (GNULIBOBJS): Add $(BLD)/execinfo.$(O).
+
+2012-08-24  Paul Eggert  <eggert@cs.ucla.edu>
+
+       On assertion failure, print backtrace if available.
+       Merge from gnulib, incorporating:
+       2012-08-24 execinfo: port to FreeBSD
+       2012-08-22 execinfo: new module
+       * lib/gnulib.mk, m4/gnulib-comp.m4: Regenerate.
+       * lib/execinfo.c, lib/execinfo.in.h, m4/execinfo.m4: New files.
+
 2012-08-22  Glenn Morris  <rgm@gnu.org>
 
        * Makefile.in (install-arch-dep): If NO_BIN_LINK is non-null,
index ea977e80cfadaa17a73bd04cc1a402337395fcb0..0c674b91ea4ffbaa832e97cb7fd990bf5dd9fcf7 100644 (file)
@@ -1,3 +1,8 @@
+2012-08-24  Paul Eggert  <eggert@cs.ucla.edu>
+
+       On assertion failure, print backtrace if available.
+       * merge-gnulib (GNULIB_MODULES): Add execinfo.
+
 2012-08-16  Paul Eggert  <eggert@cs.ucla.edu>
 
        Use ASCII tests for character types.
index 63865edf3ceca45a8fc0a7a3499d96751c93cda4..775d43e68d393c0d039ae22dbbd6f1b87101c2aa 100755 (executable)
@@ -28,7 +28,7 @@ GNULIB_URL=git://git.savannah.gnu.org/gnulib.git
 GNULIB_MODULES='
   alloca-opt c-ctype c-strcase
   careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512
-  dtoastr dtotimespec dup2 environ
+  dtoastr dtotimespec dup2 environ execinfo
   filemode getloadavg getopt-gnu gettime gettimeofday
   ignore-value intprops largefile lstat
   manywarnings mktime pselect pthread_sigmask readlink
index ebcbed86fc78528cc1983e4880d1003a93d0479a..58462459d6f2cc446f56dd0435b49fb03f5b15e8 100644 (file)
@@ -36,7 +36,7 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=errno --avoid=fcntl --avoid=fcntl-h --avoid=fstat --avoid=msvc-inval --avoid=msvc-nothrow --avoid=raise --avoid=select --avoid=sigprocmask --avoid=sys_types --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt c-ctype c-strcase careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ filemode getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat manywarnings mktime pselect pthread_sigmask readlink socklen stat-time stdalign stdarg stdbool stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timespec-add timespec-sub utimens warnings
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=errno --avoid=fcntl --avoid=fcntl-h --avoid=fstat --avoid=msvc-inval --avoid=msvc-nothrow --avoid=raise --avoid=select --avoid=sigprocmask --avoid=sys_types --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt c-ctype c-strcase careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo filemode getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat manywarnings mktime pselect pthread_sigmask readlink socklen stat-time stdalign stdarg stdbool stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timespec-add timespec-sub utimens warnings
 
 VPATH = @srcdir@
 pkgdatadir = $(datadir)/@PACKAGE@
@@ -65,7 +65,8 @@ ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
 am__aclocal_m4_deps = $(top_srcdir)/m4/00gnulib.m4 \
        $(top_srcdir)/m4/alloca.m4 $(top_srcdir)/m4/c-strtod.m4 \
        $(top_srcdir)/m4/clock_time.m4 $(top_srcdir)/m4/dup2.m4 \
-       $(top_srcdir)/m4/environ.m4 $(top_srcdir)/m4/extensions.m4 \
+       $(top_srcdir)/m4/environ.m4 $(top_srcdir)/m4/execinfo.m4 \
+       $(top_srcdir)/m4/extensions.m4 \
        $(top_srcdir)/m4/extern-inline.m4 $(top_srcdir)/m4/filemode.m4 \
        $(top_srcdir)/m4/getloadavg.m4 $(top_srcdir)/m4/getopt.m4 \
        $(top_srcdir)/m4/gettime.m4 $(top_srcdir)/m4/gettimeofday.m4 \
@@ -180,6 +181,7 @@ ECHO_C = @ECHO_C@
 ECHO_N = @ECHO_N@
 ECHO_T = @ECHO_T@
 EGREP = @EGREP@
+EXECINFO_H = @EXECINFO_H@
 EXEEXT = @EXEEXT@
 FONTCONFIG_CFLAGS = @FONTCONFIG_CFLAGS@
 FONTCONFIG_LIBS = @FONTCONFIG_LIBS@
@@ -556,6 +558,7 @@ LIBXTR6 = @LIBXTR6@
 LIBXT_OTHER = @LIBXT_OTHER@
 LIBX_OTHER = @LIBX_OTHER@
 LIB_CLOCK_GETTIME = @LIB_CLOCK_GETTIME@
+LIB_EXECINFO = @LIB_EXECINFO@
 LIB_GCC = @LIB_GCC@
 LIB_MATH = @LIB_MATH@
 LIB_PTHREAD = @LIB_PTHREAD@
@@ -845,16 +848,17 @@ x_default_search_path = @x_default_search_path@
 # statements but through direct file reference. Therefore this snippet must be
 # present in all Makefile.am that need it. This is ensured by the applicability
 # 'all' defined above.
-BUILT_SOURCES = $(ALLOCA_H) $(GETOPT_H) inttypes.h signal.h \
-       arg-nonnull.h c++defs.h warn-on-use.h $(STDALIGN_H) \
+BUILT_SOURCES = $(ALLOCA_H) $(EXECINFO_H) $(GETOPT_H) inttypes.h \
+       signal.h arg-nonnull.h c++defs.h warn-on-use.h $(STDALIGN_H) \
        $(STDARG_H) $(STDBOOL_H) $(STDDEF_H) $(STDINT_H) stdio.h \
        stdlib.h sys/select.h sys/stat.h sys/time.h time.h unistd.h
 EXTRA_DIST = alloca.in.h allocator.h careadlinkat.h md5.h sha1.h \
        sha256.h sha512.h dosname.h ftoastr.c ftoastr.h dup2.c \
-       filemode.h getloadavg.c getopt.c getopt.in.h getopt1.c \
-       getopt_int.h gettimeofday.c ignore-value.h intprops.h \
-       inttypes.in.h lstat.c mktime-internal.h mktime.c pathmax.h \
-       pselect.c pthread_sigmask.c readlink.c signal.in.h \
+       execinfo.c execinfo.in.h filemode.h getloadavg.c getopt.c \
+       getopt.in.h getopt1.c getopt_int.h gettimeofday.c \
+       ignore-value.h intprops.h inttypes.in.h lstat.c \
+       mktime-internal.h mktime.c pathmax.h pselect.c \
+       pthread_sigmask.c readlink.c signal.in.h \
        $(top_srcdir)/build-aux/snippet/_Noreturn.h \
        $(top_srcdir)/build-aux/snippet/arg-nonnull.h \
        $(top_srcdir)/build-aux/snippet/c++defs.h \
@@ -866,14 +870,15 @@ EXTRA_DIST = alloca.in.h allocator.h careadlinkat.h md5.h sha1.h \
        sys_time.in.h time.in.h time_r.c timespec.h u64.h unistd.in.h \
        utimens.h verify.h
 MOSTLYCLEANDIRS = sys sys
-MOSTLYCLEANFILES = core *.stackdump alloca.h alloca.h-t getopt.h \
-       getopt.h-t inttypes.h inttypes.h-t signal.h signal.h-t \
-       arg-nonnull.h arg-nonnull.h-t c++defs.h c++defs.h-t \
-       warn-on-use.h warn-on-use.h-t stdalign.h stdalign.h-t stdarg.h \
-       stdarg.h-t stdbool.h stdbool.h-t stddef.h stddef.h-t stdint.h \
-       stdint.h-t stdio.h stdio.h-t stdlib.h stdlib.h-t sys/select.h \
-       sys/select.h-t sys/stat.h sys/stat.h-t sys/time.h sys/time.h-t \
-       time.h time.h-t unistd.h unistd.h-t
+MOSTLYCLEANFILES = core *.stackdump alloca.h alloca.h-t execinfo.h \
+       execinfo.h-t getopt.h getopt.h-t inttypes.h inttypes.h-t \
+       signal.h signal.h-t arg-nonnull.h arg-nonnull.h-t c++defs.h \
+       c++defs.h-t warn-on-use.h warn-on-use.h-t stdalign.h \
+       stdalign.h-t stdarg.h stdarg.h-t stdbool.h stdbool.h-t \
+       stddef.h stddef.h-t stdint.h stdint.h-t stdio.h stdio.h-t \
+       stdlib.h stdlib.h-t sys/select.h sys/select.h-t sys/stat.h \
+       sys/stat.h-t sys/time.h sys/time.h-t time.h time.h-t unistd.h \
+       unistd.h-t
 noinst_LIBRARIES = libgnu.a
 AM_CFLAGS = $(GNULIB_WARN_CFLAGS) $(WERROR_CFLAGS)
 DEFAULT_INCLUDES = -I. -I$(top_srcdir)/lib -I../src -I$(top_srcdir)/src
@@ -884,8 +889,8 @@ libgnu_a_SOURCES = allocator.c c-ctype.h c-ctype.c c-strcase.h \
        timespec-add.c timespec-sub.c u64.c utimens.c
 libgnu_a_LIBADD = $(gl_LIBOBJS)
 libgnu_a_DEPENDENCIES = $(gl_LIBOBJS)
-EXTRA_libgnu_a_SOURCES = ftoastr.c dup2.c getloadavg.c getopt.c \
-       getopt1.c gettimeofday.c lstat.c mktime.c pselect.c \
+EXTRA_libgnu_a_SOURCES = ftoastr.c dup2.c execinfo.c getloadavg.c \
+       getopt.c getopt1.c gettimeofday.c lstat.c mktime.c pselect.c \
        pthread_sigmask.c readlink.c stat.c strtoimax.c strtol.c \
        strtoll.c strtol.c strtoul.c strtoull.c strtoimax.c \
        strtoumax.c symlink.c time_r.c
@@ -954,6 +959,7 @@ distclean-compile:
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dtoastr.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dtotimespec.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/dup2.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/execinfo.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/filemode.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ftoastr.Po@am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/getloadavg.Po@am__quote@
@@ -1213,6 +1219,17 @@ uninstall-am:
 @GL_GENERATE_ALLOCA_H_FALSE@alloca.h: $(top_builddir)/config.status
 @GL_GENERATE_ALLOCA_H_FALSE@   rm -f $@
 
+# We need the following in order to create <execinfo.h> when the system
+# doesn't have one that works.
+@GL_GENERATE_EXECINFO_H_TRUE@execinfo.h: execinfo.in.h $(top_builddir)/config.status
+@GL_GENERATE_EXECINFO_H_TRUE@  $(AM_V_GEN)rm -f $@-t $@ && \
+@GL_GENERATE_EXECINFO_H_TRUE@  { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+@GL_GENERATE_EXECINFO_H_TRUE@    cat $(srcdir)/execinfo.in.h; \
+@GL_GENERATE_EXECINFO_H_TRUE@  } > $@-t && \
+@GL_GENERATE_EXECINFO_H_TRUE@  mv $@-t $@
+@GL_GENERATE_EXECINFO_H_FALSE@execinfo.h: $(top_builddir)/config.status
+@GL_GENERATE_EXECINFO_H_FALSE@ rm -f $@
+
 # We need the following in order to create <getopt.h> when the system
 # doesn't have one that works with the given compiler.
 getopt.h: getopt.in.h $(top_builddir)/config.status $(ARG_NONNULL_H)
index f7ef80bb805b0b86a5f7ea69d9131b535d75b076..38f7863ba9d118705bb027844845683285317e54 100644 (file)
@@ -990,6 +990,7 @@ m4_include([m4/c-strtod.m4])
 m4_include([m4/clock_time.m4])
 m4_include([m4/dup2.m4])
 m4_include([m4/environ.m4])
+m4_include([m4/execinfo.m4])
 m4_include([m4/extensions.m4])
 m4_include([m4/extern-inline.m4])
 m4_include([m4/filemode.m4])
index bd10c9f4076f8aa03fb14e244c409074edf6e473..8cda73e6cbe61c6e599235f8abd738742a60c905 100644 (file)
@@ -358,6 +358,9 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 /* Define to 1 if you have the `euidaccess' function. */
 #undef HAVE_EUIDACCESS
 
+/* Define to 1 if you have the <execinfo.h> header file. */
+#undef HAVE_EXECINFO_H
+
 /* Define to 1 if you have the <fcntl.h> header file. */
 #undef HAVE_FCNTL_H
 
@@ -1554,20 +1557,34 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #if __GNUC__ ? __GNUC_STDC_INLINE__ : 199901L <= __STDC_VERSION__
 # define _GL_INLINE inline
 # define _GL_EXTERN_INLINE extern inline
-# if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNUC__
-#  define _GL_INLINE_HEADER_BEGIN \
-     _Pragma ("GCC diagnostic push") \
-     _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \
-     _Pragma ("GCC diagnostic ignored \"-Wmissing-declarations\"")
-#  define _GL_INLINE_HEADER_END \
-     _Pragma ("GCC diagnostic pop")
+#elif 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
+# if __GNUC_GNU_INLINE__
+   /* __gnu_inline__ suppresses a GCC 4.2 diagnostic.  */
+#  define _GL_INLINE extern inline __attribute__ ((__gnu_inline__))
+# else
+#  define _GL_INLINE extern inline
 # endif
+# define _GL_EXTERN_INLINE extern
 #else
 # define _GL_INLINE static inline
 # define _GL_EXTERN_INLINE static inline
 #endif
 
-#ifndef _GL_INLINE_HEADER_BEGIN
+#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
+# if __GNUC_STDC_INLINE__
+#  define _GL_INLINE_HEADER_CONST_PRAGMA
+# else
+#  define _GL_INLINE_HEADER_CONST_PRAGMA \
+     _Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"")
+# endif
+# define _GL_INLINE_HEADER_BEGIN \
+    _Pragma ("GCC diagnostic push") \
+    _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \
+    _Pragma ("GCC diagnostic ignored \"-Wmissing-declarations\"") \
+    _GL_INLINE_HEADER_CONST_PRAGMA
+# define _GL_INLINE_HEADER_END \
+    _Pragma ("GCC diagnostic pop")
+#else
 # define _GL_INLINE_HEADER_BEGIN
 # define _GL_INLINE_HEADER_END
 #endif
index 7a94dcb7598915eb9194b7e6d29856861e4e29c5..487f8de395a3bc02f5316bed972b4405ea0ddbfa 100755 (executable)
@@ -971,6 +971,10 @@ GNULIB_CANONICALIZE_FILE_NAME
 GNULIB_CALLOC_POSIX
 GNULIB_ATOLL
 GNULIB__EXIT
+GL_GENERATE_EXECINFO_H_FALSE
+GL_GENERATE_EXECINFO_H_TRUE
+LIB_EXECINFO
+EXECINFO_H
 UNISTD_H_HAVE_WINSOCK2_H_AND_USE_SOCKETS
 UNISTD_H_HAVE_WINSOCK2_H
 REPLACE_WRITE
@@ -3194,6 +3198,7 @@ as_fn_append ac_header_list " maillock.h"
 as_fn_append ac_header_list " sys/un.h"
 as_fn_append ac_func_list " tzset"
 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"
@@ -6956,6 +6961,7 @@ esac
   # Code from module dtotimespec:
   # Code from module dup2:
   # Code from module environ:
+  # Code from module execinfo:
   # Code from module extensions:
 
   # Code from module extern-inline:
@@ -7021,6 +7027,55 @@ esac
   # Code from module warnings:
 
 
+# It's helpful to have C macros available to GDB, so prefer -g3 to -g
+# if -g3 works and the user does not specify CFLAGS.
+# This test must follow gl_EARLY; otherwise AC_LINK_IFELSE complains.
+if test "$ac_test_CFLAGS" != set; then
+  case $CFLAGS in
+    '-g')
+      emacs_g3_CFLAGS='-g3';;
+    '-g -O2')
+      emacs_g3_CFLAGS='-g3 -O2';;
+    *)
+      emacs_g3_CFLAGS='';;
+  esac
+  if test -n "$emacs_g3_CFLAGS"; then
+    emacs_save_CFLAGS=$CFLAGS
+    CFLAGS=$emacs_g3_CFLAGS
+    { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts $emacs_g3_CFLAGS" >&5
+$as_echo_n "checking whether $CC accepts $emacs_g3_CFLAGS... " >&6; }
+if test "${emacs_cv_prog_cc_g3+set}" = set; then :
+  $as_echo_n "(cached) " >&6
+else
+  cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h.  */
+
+int
+main ()
+{
+
+  ;
+  return 0;
+}
+_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+  emacs_cv_prog_cc_g3=yes
+else
+  emacs_cv_prog_cc_g3=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_prog_cc_g3" >&5
+$as_echo "$emacs_cv_prog_cc_g3" >&6; }
+    if test $emacs_cv_prog_cc_g3 = yes; then
+      CFLAGS=$emacs_g3_CFLAGS
+    else
+      CFLAGS=$emacs_save_CFLAGS
+    fi
+  fi
+fi
+
 # Check whether --enable-gcc-warnings was given.
 if test "${enable_gcc_warnings+set}" = set; then :
   enableval=$enable_gcc_warnings; case $enableval in
@@ -16464,6 +16519,8 @@ $as_echo "#define HAVE_ENVIRON_DECL 1" >>confdefs.h
 
 
 
+
+
 { $as_echo "$as_me:${as_lineno-$LINENO}: checking for st_dm_mode in struct stat" >&5
 $as_echo_n "checking for st_dm_mode in struct stat... " >&6; }
 if test "${ac_cv_struct_st_dm_mode+set}" = set; then :
@@ -20100,6 +20157,99 @@ $as_echo "$gl_cv_func_dup2_works" >&6; }
 
 
 
+  LIB_EXECINFO=''
+  EXECINFO_H='execinfo.h'
+
+  if test $ac_cv_header_execinfo_h = yes; then
+    gl_saved_libs=$LIBS
+      { $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing backtrace_symbols_fd" >&5
+$as_echo_n "checking for library containing backtrace_symbols_fd... " >&6; }
+if test "${ac_cv_search_backtrace_symbols_fd+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 backtrace_symbols_fd ();
+int
+main ()
+{
+return backtrace_symbols_fd ();
+  ;
+  return 0;
+}
+_ACEOF
+for ac_lib in '' execinfo; 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_backtrace_symbols_fd=$ac_res
+fi
+rm -f core conftest.err conftest.$ac_objext \
+    conftest$ac_exeext
+  if test "${ac_cv_search_backtrace_symbols_fd+set}" = set; then :
+  break
+fi
+done
+if test "${ac_cv_search_backtrace_symbols_fd+set}" = set; then :
+
+else
+  ac_cv_search_backtrace_symbols_fd=no
+fi
+rm conftest.$ac_ext
+LIBS=$ac_func_search_save_LIBS
+fi
+{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_backtrace_symbols_fd" >&5
+$as_echo "$ac_cv_search_backtrace_symbols_fd" >&6; }
+ac_res=$ac_cv_search_backtrace_symbols_fd
+if test "$ac_res" != no; then :
+  test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+  test "$ac_cv_search_backtrace_symbols_fd" = "none required" ||
+         LIB_EXECINFO=$ac_cv_search_backtrace_symbols_fd
+fi
+
+    LIBS=$gl_saved_libs
+    test "$ac_cv_search_backtrace_symbols_fd" = no || EXECINFO_H=''
+  fi
+
+  if test -n "$EXECINFO_H"; then
+
+
+
+
+
+
+
+
+  gl_LIBOBJS="$gl_LIBOBJS execinfo.$ac_objext"
+
+  fi
+
+
+
+   if test -n "$EXECINFO_H"; then
+  GL_GENERATE_EXECINFO_H_TRUE=
+  GL_GENERATE_EXECINFO_H_FALSE='#'
+else
+  GL_GENERATE_EXECINFO_H_TRUE='#'
+  GL_GENERATE_EXECINFO_H_FALSE=
+fi
+
+
+
+
+
 
 
 
@@ -24190,6 +24340,10 @@ if test -z "${GL_GENERATE_ALLOCA_H_TRUE}" && test -z "${GL_GENERATE_ALLOCA_H_FAL
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
 fi
 
+if test -z "${GL_GENERATE_EXECINFO_H_TRUE}" && test -z "${GL_GENERATE_EXECINFO_H_FALSE}"; then
+  as_fn_error "conditional \"GL_GENERATE_EXECINFO_H\" was never defined.
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
+fi
 if test -z "${GL_GENERATE_STDINT_H_TRUE}" && test -z "${GL_GENERATE_STDINT_H_FALSE}"; then
   as_fn_error "conditional \"GL_GENERATE_STDINT_H\" was never defined.
 Usually this means the macro was only invoked conditionally." "$LINENO" 5
index b10cb24bab67044160a1105c85c1669a913155bf..71ec98390aa18788cfb67b6a2ab84467d89cbf30 100644 (file)
@@ -577,6 +577,34 @@ fi
 # Initialize gnulib right after choosing the compiler.
 gl_EARLY
 
+# It's helpful to have C macros available to GDB, so prefer -g3 to -g
+# if -g3 works and the user does not specify CFLAGS.
+# This test must follow gl_EARLY; otherwise AC_LINK_IFELSE complains.
+if test "$ac_test_CFLAGS" != set; then
+  case $CFLAGS in
+    '-g')
+      emacs_g3_CFLAGS='-g3';;
+    '-g -O2')
+      emacs_g3_CFLAGS='-g3 -O2';;
+    *)
+      emacs_g3_CFLAGS='';;
+  esac
+  if test -n "$emacs_g3_CFLAGS"; then
+    emacs_save_CFLAGS=$CFLAGS
+    CFLAGS=$emacs_g3_CFLAGS
+    AC_CACHE_CHECK([whether $CC accepts $emacs_g3_CFLAGS],
+      [emacs_cv_prog_cc_g3],
+      [AC_LINK_IFELSE([AC_LANG_PROGRAM()],
+        [emacs_cv_prog_cc_g3=yes],
+         [emacs_cv_prog_cc_g3=no])])
+    if test $emacs_cv_prog_cc_g3 = yes; then
+      CFLAGS=$emacs_g3_CFLAGS
+    else
+      CFLAGS=$emacs_save_CFLAGS
+    fi
+  fi
+fi
+
 AC_ARG_ENABLE([gcc-warnings],
   [AS_HELP_STRING([--enable-gcc-warnings],
                   [turn on lots of GCC warnings. This is intended for
index fa78cc4c50255dab3b81873cfe606bd80cfb599d..a4f9985ad85bd5a2d1d6e0972bcc784482e139bd 100644 (file)
@@ -1,3 +1,9 @@
+2012-08-24  Michael Albinus  <michael.albinus@gmx.de>
+
+       * 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  <eliz@gnu.org>
 
        * building.texi (Debugger Operation): Correct and improve
index 2dea1577c04abc66f1a6908c3425fdb227c78017..d4573eed5a8afa41b90974899af80861fd15b719 100644 (file)
@@ -434,6 +434,11 @@ variables to be set, but it uses their values if they are set.
 @item CDPATH
 Used by the @code{cd} command to search for the directory you specify,
 when you specify a relative directory name.
+@item DBUS_SESSION_BUS_ADDRESS
+Used by D-Bus when Emacs is compiled with it.  Usually, there is no
+need to change it.  Setting it to a dummy address, like
+@samp{unix:path=/tmp/foo}, suppresses connections to the D-Bus session
+bus.
 @item EMACSDATA
 Directory for the architecture-independent files that come with Emacs.
 This is used to initialize the variable @code{data-directory}.
index 0c9ffe500938b137dac002801e9e7fc5ad9d9347..fb8722ab8f881391d2c74275608ff245af3eb203 100644 (file)
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -23,7 +23,7 @@ so we will look at it and add it to the manual.
 \f
 * Installation Changes in Emacs 24.3
 
-** New configure option '--without-all' to disable additonal features.
+** New configure option '--without-all' to disable additional features.
 This disables most of the features that are normally enabled by default.
 
 ** New configure option '--enable-link-time-optimization' to utilize
@@ -179,6 +179,13 @@ end of the buffer.  It defaults to t.
 and `M-s _' in Isearch toggles symbol search mode.
 `M-s c' in Isearch toggles search case-sensitivity.
 
+*** `search-whitespace-regexp' now acts on ordinary incremental search
+as well, so that each sequence of spaces in the search string matches
+any combination of one or more whitespace characters.  To change this
+behavior, you can give `search-whitespace-regexp' a cons cell value,
+where the car and cdr specify values for ordinary and regular
+expression incremental search respectively.
+
 ** M-x move-to-column, if called interactively with no prefix arg, now
 prompts for a column number.
 
@@ -612,6 +619,19 @@ now accept a third argument to avoid choosing the selected window.
 *** New display action alist `inhibit-switch-frame', if non-nil, tells
 display action functions to avoid changing which frame is selected.
 
+*** New display action alist `pop-up-frame-parameters', if non-nil,
+specifies frame parameters to give any newly-created frame.
+
+*** 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'
+**** `special-display-buffer-names'
+**** `special-display-function'
+
 ** Completion
 
 *** New function `completion-table-with-quoting' to handle completion
diff --git a/lib/execinfo.c b/lib/execinfo.c
new file mode 100644 (file)
index 0000000..0bcd9f0
--- /dev/null
@@ -0,0 +1,3 @@
+#include <config.h>
+#define _GL_EXECINFO_INLINE _GL_EXTERN_INLINE
+#include "execinfo.h"
diff --git a/lib/execinfo.in.h b/lib/execinfo.in.h
new file mode 100644 (file)
index 0000000..d76b0e1
--- /dev/null
@@ -0,0 +1,54 @@
+/* Information about executables.
+
+   Copyright (C) 2012 Free Software Foundation, Inc.
+
+   This program is free software: you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 3 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
+
+/* Written by Paul Eggert.  */
+
+#ifndef _GL_EXECINFO_H
+#define _GL_EXECINFO_H
+
+_GL_INLINE_HEADER_BEGIN
+#ifndef _GL_EXECINFO_INLINE
+# define _GL_EXECINFO_INLINE _GL_INLINE
+#endif
+
+_GL_EXECINFO_INLINE int
+backtrace (void **buffer, int size)
+{
+  (void) buffer;
+  (void) size;
+  return 0;
+}
+
+_GL_EXECINFO_INLINE char **
+backtrace_symbols (void *const *buffer, int size)
+{
+  (void) buffer;
+  (void) size;
+  return 0;
+}
+
+_GL_EXECINFO_INLINE void
+backtrace_symbols_fd (void *const *buffer, int size, int fd)
+{
+  (void) buffer;
+  (void) size;
+  (void) fd;
+}
+
+_GL_INLINE_HEADER_END
+
+#endif
index a90cc59bbde5ce60ad377c517295b0dd6b37d33a..d49eb4fdf7ab1096a51ecc473c188153c173b167 100644 (file)
@@ -21,7 +21,7 @@
 # the same distribution terms as the rest of that program.
 #
 # Generated by gnulib-tool.
-# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=errno --avoid=fcntl --avoid=fcntl-h --avoid=fstat --avoid=msvc-inval --avoid=msvc-nothrow --avoid=raise --avoid=select --avoid=sigprocmask --avoid=sys_types --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt c-ctype c-strcase careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ filemode getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat manywarnings mktime pselect pthread_sigmask readlink socklen stat-time stdalign stdarg stdbool stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timespec-add timespec-sub utimens warnings
+# Reproduce by: gnulib-tool --import --dir=. --lib=libgnu --source-base=lib --m4-base=m4 --doc-base=doc --tests-base=tests --aux-dir=build-aux --avoid=errno --avoid=fcntl --avoid=fcntl-h --avoid=fstat --avoid=msvc-inval --avoid=msvc-nothrow --avoid=raise --avoid=select --avoid=sigprocmask --avoid=sys_types --avoid=threadlib --makefile-name=gnulib.mk --conditional-dependencies --no-libtool --macro-prefix=gl --no-vc-files alloca-opt c-ctype c-strcase careadlinkat crypto/md5 crypto/sha1 crypto/sha256 crypto/sha512 dtoastr dtotimespec dup2 environ execinfo filemode getloadavg getopt-gnu gettime gettimeofday ignore-value intprops largefile lstat manywarnings mktime pselect pthread_sigmask readlink socklen stat-time stdalign stdarg stdbool stdio strftime strtoimax strtoumax symlink sys_stat sys_time time timespec-add timespec-sub utimens warnings
 
 
 MOSTLYCLEANFILES += core *.stackdump
@@ -150,6 +150,31 @@ EXTRA_libgnu_a_SOURCES += dup2.c
 
 ## end   gnulib module dup2
 
+## begin gnulib module execinfo
+
+BUILT_SOURCES += $(EXECINFO_H)
+
+# We need the following in order to create <execinfo.h> when the system
+# doesn't have one that works.
+if GL_GENERATE_EXECINFO_H
+execinfo.h: execinfo.in.h $(top_builddir)/config.status
+       $(AM_V_GEN)rm -f $@-t $@ && \
+       { echo '/* DO NOT EDIT! GENERATED AUTOMATICALLY! */'; \
+         cat $(srcdir)/execinfo.in.h; \
+       } > $@-t && \
+       mv $@-t $@
+else
+execinfo.h: $(top_builddir)/config.status
+       rm -f $@
+endif
+MOSTLYCLEANFILES += execinfo.h execinfo.h-t
+
+EXTRA_DIST += execinfo.c execinfo.in.h
+
+EXTRA_libgnu_a_SOURCES += execinfo.c
+
+## end   gnulib module execinfo
+
 ## begin gnulib module filemode
 
 libgnu_a_SOURCES += filemode.c
index 11251d55f77c9cf41eeec714b356f8e40eccb522..f0cea56f829cbb5fd87077bed8be42506e5b64d0 100644 (file)
@@ -28,6 +28,7 @@ GNULIBOBJS = $(BLD)/c-ctype.$(O) \
             $(BLD)/c-strncasecmp.$(O) \
             $(BLD)/dtoastr.$(O) \
             $(BLD)/dtotimespec.$(O)  \
+            $(BLD)/execinfo.$(O)  \
             $(BLD)/getopt.$(O)  \
             $(BLD)/getopt1.$(O) \
             $(BLD)/gettime.$(O) \
@@ -129,6 +130,11 @@ $(BLD)/dtotimespec.$(O) : \
        $(GNU_LIB)/timespec.h \
        $(CONFIG_H)
 
+$(BLD)/execinfo.$(O) : \
+       $(GNU_LIB)/execinfo.c \
+       $(GNU_LIB)/execinfo.h \
+       $(CONFIG_H)
+
 $(BLD)/getopt.$(O) : \
        $(GNU_LIB)/getopt.c \
        $(GNU_LIB)/getopt.h \
@@ -299,3 +305,7 @@ getopt_h:
              < getopt.in.h > getopt_.h-t
        $(CP) getopt_.h-t getopt_.h
        - $(DEL) getopt_.h-t
+
+execinfo.h: execinfo.in.h
+       $(CP) execinfo.in.h $@
+
index 4296280b22e340303b7bcd454ff7d5e403a74526..3dd2b7b12720a704e0a6d3855706cd19b5a0a688 100644 (file)
@@ -1,3 +1,101 @@
+2012-08-28  Juri Linkov  <juri@jurta.org>
+
+       * info.el (Info-fontify-node): Hide empty lines at the end of
+       the node.  (Bug#12272)
+
+2012-08-27  Drew Adams  <drew.adams@oracle.com>
+
+       * dired.el (dired-pop-to-buffer): Make window start at beginning
+       of buffer (Bug#12281).
+
+2012-08-26  Chong Yidong  <cyd@gnu.org>
+
+       * window.el (special-display-regexps, special-display-frame-alist)
+       (special-display-buffer-names, special-display-function)
+       (display-buffer-reuse-frames): Mark as obsolete.
+
+       * progmodes/compile.el: Don't use display-buffer-reuse-frames.
+
+       * help.el (help-print-return-message): Don't treat
+       display-buffer-reuse-frames specially.
+
+2012-08-26  Chong Yidong  <cyd@gnu.org>
+
+       * progmodes/gdb-mi.el (gdb-display-buffer-other-frame-action): New
+       variable, replacing gdb-frame-parameters.
+       (gdb-frame-io-buffer, gdb-frame-breakpoints-buffer)
+       (gdb-frame-threads-buffer, gdb-frame-memory-buffer)
+       (gdb-frame-disassembly-buffer, gdb-frame-stack-buffer)
+       (gdb-frame-locals-buffer, gdb-frame-registers-buffer): Use it.
+       (def-gdb-frame-for-buffer): Macro deleted.  It is easier to define
+       the functions directly with gdb-display-buffer-other-frame-action.
+       (gdb-display-breakpoints-buffer, gdb-display-threads-buffer)
+       (gdb-display-memory-buffer, gdb-display-disassembly-buffer)
+       (gdb-display-stack-buffer, gdb-display-locals-buffer)
+       (gdb-display-registers-buffer): Define directly.
+       (def-gdb-display-buffer): Macro deleted.
+       (gdb-display-buffer): Remove second and third args, callers don't
+       use them.  Defer to the default display-buffer behavior, apart
+       from making windows dedicated.
+       (gdb-setup-windows): Don't call display-buffer unnecessarily.
+
+       * progmodes/gud.el (gud-display-line): Just use display-buffer.
+
+       * window.el (display-buffer-pop-up-frame): Handle a
+       pop-up-frame-parameters alist entry.
+       (display-buffer): Document it.
+
+2012-08-26  Chong Yidong  <cyd@gnu.org>
+
+       * isearch.el (search-whitespace-regexp): Make string and nil
+       values apply to both ordinary and regexp search.  Allow a cons
+       cell value to distinguish between the two.
+       (isearch-whitespace-regexp, isearch-search-forward)
+       (isearch-search-backward): New functions.
+       (isearch-occur, isearch-search-fun-default, isearch-search)
+       (isearch-lazy-highlight-new-loop): Use them.
+       (isearch-forward, isearch-forward-regexp): Doc fix.
+
+2012-08-26  Chong Yidong  <cyd@gnu.org>
+
+       * faces.el (help-argument-name): Always inherit from italic
+       (Bug#12213).
+
+2012-08-25  Martin Rudalics  <rudalics@gmx.at>
+
+       * window.el (window--even-window-heights): Even heights when
+       WINDOW and the selected window form a vertical combination.
+       (display-buffer-use-some-window): Provide that window used gets
+       sized back by quit-window.  (Bug#11880) and (Bug#12091)
+
+2012-08-24  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Fix file time stamp problem with bzr and CVS (Bug#12001).
+       * vc/vc-cvs.el (vc-cvs-parse-entry): Ignore subsecond information
+       in the file's time stamp, since the version control system loses
+       that information.
+
+2012-08-22  Juri Linkov  <juri@jurta.org>
+
+       * info.el (Info-fontify-node): Hide the suffix of the
+       Info file name in the header line.  (Bug#12187)
+
+2012-08-22  Glenn Morris  <rgm@gnu.org>
+
+       * calendar/cal-tex.el (cal-tex-weekly-common):
+       Restore leading blank page.
+
+2012-08-22  Le Wang  <l26wang@gmail.com>  (tiny change)
+
+       * misc.el (forward-to-word, backward-to-word): Activate or extend
+       the region under `shift-select-mode'.  (Bug#12231)
+
+2012-08-22  Bastien Guerry  <bzg@gnu.org>
+
+       * progmodes/executable.el (executable-prefix): Set to "#!" instead
+       of "#! ".  http://www.in-ulm.de/~mascheck/various/shebang/#details
+       gives details on why the space is never needed.
+
 2012-08-22  Martin Rudalics  <rudalics@gmx.at>
 
        * window.el (walk-window-tree, window-with-parameter): New
        (window-in-direction): Simplify and rewrite doc-string.
        (window--size-ignore): Rename to window--size-ignore-p.  Update
        callers.
+       (display-buffer-in-atom-window, window--major-non-side-window)
+       (window--major-side-window, display-buffer-in-major-side-window)
+       (delete-side-window, display-buffer-in-side-window): New
+       functions.
+       (window--side-check, window-deletable-p, delete-window)
+       (delete-other-windows, split-window): Handle side windows and
+       atomic windows appropriately.
+       (window--display-buffer): Call display-buffer-record-window also
+       when the window buffer did not change.
 
 2012-08-22  Christopher Schmidt  <christopher@ch.ristopher.com>
 
 
 2012-08-13  Bastien Guerry  <bzg@gnu.org>
 
-       * window.el (special-display-popup-frame): Small docstring
+       * window.el (special-display-popup-frame): Minor docstring
        enhancement.  (Bug#12172)
 
 2012-08-13  Andreas Schwab  <schwab@linux-m68k.org>
index 51ea8e7b7a3f542aef8f26023bf5c4a4d442dccf..2f1c95b766828faf07e8abb4babfb266dc1e1d77 100644 (file)
@@ -86,7 +86,7 @@
           (setq sn (math-to-underscores sn)))
       sn)))
 
-;;; Give multiplication precendence when composing to avoid
+;;; Give multiplication precedence when composing to avoid
 ;;; writing a*(b c) instead of a b c
 (defun math-compose-expr (a prec &optional div)
   (let ((calc-multiplication-has-precedence t)
index d8d2a09c87111451086484a0beebd49713736b2b..9c01ab40c0c02b9303930c55013d29a728fda593 100644 (file)
@@ -1080,8 +1080,8 @@ shown are hard-coded to 8-12, 13-17."
           (cal-tex-longday "weekend" "0.8in")
           (insert cal-tex-lefthead)
           (cal-tex-longday "leftday" "1.85in"))
-    (cal-tex-preamble "twoside,12pt")
-    (insert "\\textwidth 7in
+      (cal-tex-preamble "twoside,12pt")
+      (insert "\\textwidth 7in
 \\textheight 10.5in
 \\oddsidemargin 0in
 \\evensidemargin 0in
@@ -1090,13 +1090,19 @@ shown are hard-coded to 8-12, 13-17."
 \\headsep 0.125in
 \\footskip .125in
 ")
-    (insert cal-tex-righthead)
-    (cal-tex-longday "rightday" "2.75in")
-    (cal-tex-longday "weekend" "1.8in")
-    (insert cal-tex-lefthead)
-    (cal-tex-longday "leftday" "2.75in"))
+      (insert cal-tex-righthead)
+      (cal-tex-longday "rightday" "2.75in")
+      (cal-tex-longday "weekend" "1.8in")
+      (insert cal-tex-lefthead)
+      (cal-tex-longday "leftday" "2.75in"))
     (cal-tex-b-document)
     (cal-tex-cmd "\\pagestyle" "empty")
+    ;; Let's assume this is something to with twopage documents.
+    ;; It has the downside that we start with a blank page.
+    ;; It doesn't make obvious sense when oddside and evenside margins
+    ;; are the same (non-filofax), but consider the left and right
+    ;; versions of various functions as applicable to even and odd pages.
+    (cal-tex-newpage)
     (dotimes (i n)
       (insert "\\lefthead")
       (cal-tex-arg
index 6182e13372653fd2aa1372a8068a713420433d84..b82b7781e39f76211abadf12296b2ebe50b88976 100644 (file)
@@ -2950,6 +2950,8 @@ or \"* [3 files]\"."
               (split-window-sensibly window))))
        pop-up-frames)
     (pop-to-buffer (get-buffer-create buf)))
+  ;; See Bug#12281.
+  (set-window-start nil (point-min))
   ;; If dired-shrink-to-fit is t, make its window fit its contents.
   (when dired-shrink-to-fit
     ;; Try to not delete window when we want to display less than
index 2e1ba7798e9b39aaa6380b5225fe020d2cd0a62e..6a477e172e1951aa4cb87e53b8f62b086b76d25c 100644 (file)
@@ -2444,7 +2444,7 @@ Note: Other faces cannot inherit from the cursor face."
   :group 'menu
   :group 'basic-faces)
 
-(defface help-argument-name '((((supports :slant italic)) :inherit italic))
+(defface help-argument-name '((t :inherit italic))
   "Face to highlight argument names in *Help* buffers."
   :group 'help)
 
index 7592c405076b07402847cedade4f6d9873de81cf..4b56d351ac25b4cc4a5ff1ed1d6dd83f85142239 100644 (file)
@@ -1,3 +1,18 @@
+2012-08-28  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * gnus-sum.el (gnus-summary-enter-digest-group): Decode content
+       transfer encoding first; bind gnus-newsgroup-charset to the charset
+       that the article specifies (Bug#12209).
+
+2012-08-22  Katsumi Yamaoka  <yamaoka@jpl.org>
+
+       * gnus-cus.el (gnus-group-customize): Decode values posting-style holds.
+       (gnus-group-customize-done): Encode values posting-style holds.
+
+       * gnus-msg.el (gnus-summary-resend-message)
+       (gnus-configure-posting-styles): Decode values posting-style group
+       parameter holds.
+
 2012-08-21  Katsumi Yamaoka  <yamaoka@jpl.org>
 
        * gnus-msg.el (gnus-summary-resend-message): Honor posting-style for
index 234d0f7ae56f2a49b57bf3caecf9f7ea62495c99..3440e6310af3307e2bc0a29844fc4510091afbde 100644 (file)
@@ -417,6 +417,11 @@ category."))
            (delq elem tmp))
          (setq tmp (cdr tmp))))
 
+      ;; Decode values posting-style holds.
+      (dolist (style (cdr (assq 'posting-style values)))
+       (when (stringp (cadr style))
+         (setcdr style (list (mm-decode-coding-string (cadr style) 'utf-8)))))
+
       (setq gnus-custom-params
             (apply 'widget-create 'group
                    :value values
@@ -487,14 +492,17 @@ form, but who cares?"
 (defun gnus-group-customize-done (&rest ignore)
   "Apply changes and bury the buffer."
   (interactive)
-  (if gnus-custom-topic
-      (gnus-topic-set-parameters gnus-custom-topic
-                                (widget-value gnus-custom-params))
-    (gnus-group-edit-group-done 'params gnus-custom-group
-                               (widget-value gnus-custom-params))
-    (gnus-group-edit-group-done 'method gnus-custom-group
-                               (widget-value gnus-custom-method)))
-  (bury-buffer))
+  (let ((params (widget-value gnus-custom-params)))
+    ;; Encode values posting-style holds.
+    (dolist (style (cdr (assq 'posting-style params)))
+      (when (stringp (cadr style))
+       (setcdr style (list (mm-encode-coding-string (cadr style) 'utf-8)))))
+    (if gnus-custom-topic
+       (gnus-topic-set-parameters gnus-custom-topic params)
+      (gnus-group-edit-group-done 'params gnus-custom-group params)
+      (gnus-group-edit-group-done 'method gnus-custom-group
+                                 (widget-value gnus-custom-method)))
+    (bury-buffer)))
 
 ;;; Score Customization:
 
index 07748bebb81c8428f553e4ab72910df74ff391e5..c2f79e70d1e928822d7a4c8466c97793ac855315 100644 (file)
@@ -1376,6 +1376,9 @@ For the \"inline\" alternatives, also see the variable
        (user-full-name user-full-name)
        (user-mail-address user-mail-address)
        tem)
+    (dolist (style styles)
+      (when (stringp (cadr style))
+       (setcdr style (list (mm-decode-coding-string (cadr style) 'utf-8)))))
     (dolist (style (if styles
                       (append gnus-posting-styles (list (cons ".*" styles)))
                     gnus-posting-styles))
@@ -1807,6 +1810,10 @@ this is a reply."
       (when gnus-newsgroup-name
        (let ((tmp-style (gnus-group-find-parameter group 'posting-style t)))
          (when tmp-style
+           (dolist (style tmp-style)
+             (when (stringp (cadr style))
+               (setcdr style (list (mm-decode-coding-string (cadr style)
+                                                            'utf-8)))))
            (setq styles (append styles (list (cons ".*" tmp-style)))))))
       ;; Go through all styles and look for matches.
       (dolist (style styles)
index 06f17bcf646b8c467e0bd9ddfd496373669a34ef..b44b953bec64bb12f07792491c7749fbaaa1b9d9 100644 (file)
@@ -9137,7 +9137,7 @@ To control what happens when you exit the group, see the
                           (list (cons 'save-article-group ogroup))))
           (case-fold-search t)
           (buf (current-buffer))
-          dig to-address)
+          dig to-address charset)
       (with-current-buffer gnus-original-article-buffer
        ;; Have the digest group inherit the main mail address of
        ;; the parent article.
@@ -9150,16 +9150,32 @@ To control what happens when you exit the group, see the
                                      to-address))))))
        (setq dig (nnheader-set-temp-buffer " *gnus digest buffer*"))
        (insert-buffer-substring gnus-original-article-buffer)
-       ;; Remove lines that may lead nndoc to misinterpret the
-       ;; document type.
        (narrow-to-region
         (goto-char (point-min))
         (or (search-forward "\n\n" nil t) (point)))
+       ;; Remove lines that may lead nndoc to misinterpret the
+       ;; document type.
        (goto-char (point-min))
        (delete-matching-lines "^Path:\\|^From ")
+       ;; Parse charset, and decode content transfer encoding.
+       (setq charset (mail-content-type-get
+                      (mail-header-parse-content-type
+                       (or (gnus-fetch-field "content-type") ""))
+                      'charset))
+       (let ((encoding (gnus-fetch-field "content-transfer-encoding")))
+         (when encoding
+           (message-remove-header "content-transfer-encoding")
+           (goto-char (point-max))
+           (widen)
+           (narrow-to-region (point) (point-max))
+           (mm-decode-content-transfer-encoding
+            (intern (downcase (mail-header-strip encoding))))))
        (widen))
       (unwind-protect
-         (if (let ((gnus-newsgroup-ephemeral-charset gnus-newsgroup-charset)
+         (if (let ((gnus-newsgroup-ephemeral-charset
+                    (if charset
+                        (intern (downcase (gnus-strip-whitespace charset)))
+                      gnus-newsgroup-charset))
                    (gnus-newsgroup-ephemeral-ignored-charsets
                     gnus-newsgroup-ignored-charsets))
                (gnus-group-read-ephemeral-group
index 19cb811bcf53230f922a261e6c7d25bbc0271fcd..19db7c255d1d33ff0784f692665746ece8701842 100644 (file)
@@ -145,10 +145,6 @@ specifies what to do when the user exits the help buffer."
                     ;; Secondly, the buffer has not been displayed yet,
                     ;; so we don't know whether its frame will be selected.
                     nil)
-                   (display-buffer-reuse-frames
-                    (setq help-return-method (cons (selected-window)
-                                                   'quit-window))
-                    nil)
                    ((not (one-window-p t))
                     (setq help-return-method
                           (cons (selected-window) 'quit-window))
index 15478f9063c66291dbef903387bf8bed9c919f00..fe4afd7216321db226012007511665be7b7cf960 100644 (file)
@@ -4527,7 +4527,17 @@ first line or header line, and for breadcrumb links.")
              ((not (bobp))
               ;; Hide the punctuation at the end, too.
               (skip-chars-backward " \t,")
-              (put-text-property (point) header-end 'invisible t))))))
+              (put-text-property (point) header-end 'invisible t)
+             ;; Hide the suffix of the Info file name.
+             (beginning-of-line)
+             (if (re-search-forward
+                  (format "File: %s\\([^,\n\t]+\\),"
+                          (if (stringp Info-current-file)
+                              (file-name-nondirectory Info-current-file)
+                            Info-current-file))
+                  header-end t)
+                 (put-text-property (match-beginning 1) (match-end 1)
+                                    'invisible t)))))))
 
       ;; Fontify titles
       (goto-char (point-min))
@@ -4815,6 +4825,12 @@ first line or header line, and for breadcrumb links.")
                                  mouse-face highlight
                                  help-echo "mouse-2: go to this URL"))))
 
+      ;; Hide empty lines at the end of the node.
+      (goto-char (point-max))
+      (skip-chars-backward "\n")
+      (when (< (1+ (point)) (point-max))
+       (put-text-property (1+ (point)) (point-max) 'invisible t))
+
       (set-buffer-modified-p nil))))
 \f
 ;;; Speedbar support:
index 9271ce32484af38506792935ee910d113bfb4dfd..6ea8d86336a9f474148ea3e43c22f2a307479229 100644 (file)
@@ -111,17 +111,32 @@ string, and RET terminates editing and does a nonincremental search."
 
 (defcustom search-whitespace-regexp (purecopy "\\s-+")
   "If non-nil, regular expression to match a sequence of whitespace chars.
-This applies to regular expression incremental search.
-When you put a space or spaces in the incremental regexp, it stands for
-this, unless it is inside of a regexp construct such as [...] or *, + or ?.
+When you enter a space or spaces in the incremental search, it
+will match any sequence matched by this regexp.  As an exception,
+spaces are treated normally in regexp incremental search if they
+occur in a regexp construct like [...] or *, + or ?.
+
+If the value is a string, it applies to both ordinary and regexp
+incremental search.  If the value is nil, each space you type
+matches literally, against one space.
+
+The value can also be a cons cell (REGEXP-1 . REGEXP-2).  In that
+case, REGEXP-1 is used as the value for ordinary incremental
+search, and REGEXP-2 is used for regexp incremental search.
+
 You might want to use something like \"[ \\t\\r\\n]+\" instead.
 In the Customization buffer, that is `[' followed by a space,
-a tab, a carriage return (control-M), a newline, and `]+'.
-
-When this is nil, each space you type matches literally, against one space."
-  :type '(choice (const :tag "Find Spaces Literally" nil)
+a tab, a carriage return (control-M), a newline, and `]+'."
+  :type '(choice (const :tag "Treat Spaces Literally" nil)
+                (cons (choice :tag "For Ordinary Isearch"
+                              regexp
+                              (const :tag "Treat Spaces Literally" nil))
+                      (choice :tag "For Regexp Isearch"
+                              regexp
+                              (const :tag "Treat Spaces Literally" nil)))
                 regexp)
-  :group 'isearch)
+  :group 'isearch
+  :version "24.3")
 
 (defcustom search-invisible 'open
   "If t incremental search can match hidden text.
@@ -687,6 +702,9 @@ Type \\[isearch-describe-bindings] to display all Isearch key bindings.
 Type \\[isearch-describe-key] to display documentation of Isearch key.
 Type \\[isearch-describe-mode] to display documentation of Isearch mode.
 
+In incremental searches, a space or spaces normally matches any
+whitespace; see the variable `search-whitespace-regexp'.
+
 If an input method is turned on in the current buffer, that input
 method is also active while you are typing characters to search.
 To toggle the input method, type \\[isearch-toggle-input-method].  \
@@ -710,22 +728,19 @@ the calling function until the search is done."
   (isearch-mode t (not (null regexp-p)) nil (not no-recursive-edit)))
 
 (defun isearch-forward-regexp (&optional not-regexp no-recursive-edit)
-  "\
-Do incremental search forward for regular expression.
+  "Do incremental search forward for regular expression.
 With a prefix argument, do a regular string search instead.
 Like ordinary incremental search except that your input is treated
 as a regexp.  See the command `isearch-forward' for more information.
 
-In regexp incremental searches, a space or spaces normally matches
-any whitespace (the variable `search-whitespace-regexp' controls
-precisely what that means).  If you want to search for a literal space
-and nothing else, enter C-q SPC."
+In incremental searches, a space or spaces normally matches any
+whitespace; see the variable `search-whitespace-regexp'.  To
+search for a literal space and nothing else, enter C-q SPC."
   (interactive "P\np")
   (isearch-mode t (null not-regexp) nil (not no-recursive-edit)))
 
 (defun isearch-forward-word (&optional not-word no-recursive-edit)
-  "\
-Do incremental search forward for a sequence of words.
+  "Do incremental search forward for a sequence of words.
 With a prefix argument, do a regular string search instead.
 Like ordinary incremental search except that your input is treated
 as a sequence of words without regard to how the words are separated.
@@ -734,8 +749,7 @@ See the command `isearch-forward' for more information."
   (isearch-mode t nil nil (not no-recursive-edit) (null not-word)))
 
 (defun isearch-forward-symbol (&optional not-symbol no-recursive-edit)
-  "\
-Do incremental search forward for a symbol.
+  "Do incremental search forward for a symbol.
 The prefix argument is currently unused.
 Like ordinary incremental search except that your input is treated
 as a symbol surrounded by symbol boundary constructs \\_< and \\_>.
@@ -744,16 +758,14 @@ See the command `isearch-forward' for more information."
   (isearch-mode t nil nil (not no-recursive-edit) 'isearch-symbol-regexp))
 
 (defun isearch-backward (&optional regexp-p no-recursive-edit)
-  "\
-Do incremental search backward.
+  "Do incremental search backward.
 With a prefix argument, do a regular expression search instead.
 See the command `isearch-forward' for more information."
   (interactive "P\np")
   (isearch-mode nil (not (null regexp-p)) nil (not no-recursive-edit)))
 
 (defun isearch-backward-regexp (&optional not-regexp no-recursive-edit)
-  "\
-Do incremental search backward for regular expression.
+  "Do incremental search backward for regular expression.
 With a prefix argument, do a regular string search instead.
 Like ordinary incremental search except that your input is treated
 as a regexp.  See the command `isearch-forward' for more information."
@@ -895,8 +907,7 @@ The last thing it does is to run `isearch-update-post-hook'."
             (if (< isearch-other-end (point)) ; isearch-forward?
                 (isearch-highlight isearch-other-end (point))
               (isearch-highlight (point) isearch-other-end))
-          (isearch-dehighlight))
-        ))
+          (isearch-dehighlight))))
   (setq ;; quit-flag nil  not for isearch-mode
    isearch-adjusted nil
    isearch-yank-flag nil)
@@ -1547,6 +1558,15 @@ See `isearch-query-replace' for more information."
    (list current-prefix-arg))
   (isearch-query-replace delimited t))
 
+(defun isearch-whitespace-regexp ()
+  "Return the value of `search-whitespace-regexp' for the current search."
+  (cond ((not (consp search-whitespace-regexp))
+        search-whitespace-regexp)
+       (isearch-regexp
+        (cdr search-whitespace-regexp))
+       (t
+        (car search-whitespace-regexp))))
+
 (defun isearch-occur (regexp &optional nlines)
   "Run `occur' using the last search string as the regexp.
 Interactively, REGEXP is constructed using the search string from the
@@ -1586,7 +1606,7 @@ characters in that string."
        ;; Set `search-upper-case' to nil to not call
        ;; `isearch-no-upper-case-p' in `occur-1'.
        (search-upper-case nil)
-       (search-spaces-regexp (if isearch-regexp search-whitespace-regexp)))
+       (search-spaces-regexp (isearch-whitespace-regexp)))
     (occur regexp nlines)))
 
 (declare-function hi-lock-read-face-name "hi-lock" ())
@@ -2426,7 +2446,13 @@ Can be changed via `isearch-search-fun-function' for special needs."
    (isearch-regexp
     (if isearch-forward 're-search-forward 're-search-backward))
    (t
-    (if isearch-forward 'search-forward 'search-backward))))
+    (if isearch-forward 'isearch-search-forward 'isearch-search-backward))))
+
+(defun isearch-search-forward (string &optional bound noerror count)
+  (re-search-forward (regexp-quote string) bound noerror count))
+
+(defun isearch-search-backward (string &optional bound noerror count)
+  (re-search-backward (regexp-quote string) bound noerror count))
 
 (defun isearch-search-string (string bound noerror)
   "Search for the first occurrence of STRING or its translation.
@@ -2487,7 +2513,7 @@ update the match data, and return point."
                  search-invisible))
            (inhibit-quit nil)
            (case-fold-search isearch-case-fold-search)
-           (search-spaces-regexp search-whitespace-regexp)
+           (search-spaces-regexp (isearch-whitespace-regexp))
            (retry t))
        (setq isearch-error nil)
        (while retry
@@ -2847,7 +2873,7 @@ by other Emacs features."
          isearch-lazy-highlight-last-string  isearch-string
          isearch-lazy-highlight-case-fold-search isearch-case-fold-search
          isearch-lazy-highlight-regexp       isearch-regexp
-         isearch-lazy-highlight-space-regexp search-whitespace-regexp
+         isearch-lazy-highlight-space-regexp (isearch-whitespace-regexp)
          isearch-lazy-highlight-word         isearch-word
          isearch-lazy-highlight-forward      isearch-forward)
       (unless (equal isearch-string "")
index cb52ecbd36eed555547b7120e14db7e4254177d1..96b739dc2b7b13965432795a137df60e2b6d8913 100644 (file)
@@ -99,14 +99,14 @@ Ignores CHAR at point."
 (defun forward-to-word (arg)
   "Move forward until encountering the beginning of a word.
 With argument, do this that many times."
-  (interactive "p")
+  (interactive "^p")
   (or (re-search-forward (if (> arg 0) "\\W\\b" "\\b\\W") nil t arg)
       (goto-char (if (> arg 0) (point-max) (point-min)))))
 
 (defun backward-to-word (arg)
   "Move backward until encountering the end of a word.
 With argument, do this that many times."
-  (interactive "p")
+  (interactive "^p")
   (forward-to-word (- arg)))
 
 ;;;###autoload
index 21a323d8b45dc7739230cf44ba655fd4af5617b4..eb966e8a90db2c6008539a7e005c00f134495856 100644 (file)
@@ -2461,10 +2461,7 @@ and overlay is highlighted between MK and END-MK."
                 ;; the error location if the two buffers are in two
                 ;; different frames.  So don't do it if it's not necessary.
                 pre-existing
-              (let ((display-buffer-reuse-frames t)
-                    (pop-up-windows t))
-               ;; Pop up a window.
-                (display-buffer (marker-buffer msg)))))
+             (display-buffer (marker-buffer msg))))
         (highlight-regexp (with-current-buffer (marker-buffer msg)
                             ;; also do this while we change buffer
                             (compilation-set-window w msg)
index e51425719721052092b89d1dbdefd309558cde6a..092e1a4d578993dedc14c05d2e2730da44ec2a0a 100644 (file)
@@ -84,8 +84,9 @@ When this is `function', only ask when called non-interactively."
   :group 'executable)
 
 
-(defcustom executable-prefix "#! "
+(defcustom executable-prefix "#!"
   "Interpreter magic number prefix inserted when there was no magic number."
+  :version "24.3"                       ; "#! " -> "#!"
   :type 'string
   :group 'executable)
 
index 0a99c2f5c24790723c2471b088069eaced131222..59c419abfc3e6be2c79ee904c9782c68cf567e7e 100644 (file)
@@ -1413,29 +1413,6 @@ this trigger is subscribed to `gdb-buf-publisher' and called with
      (with-current-buffer ,buffer
        (apply ',expr args))))
 
-;; Used to define all gdb-frame-*-buffer functions except
-;; `gdb-frame-io-buffer'
-(defmacro def-gdb-frame-for-buffer (name buffer &optional doc)
-  "Define a function NAME which shows gdb BUFFER in a separate frame.
-
-DOC is an optional documentation string."
-  `(defun ,name (&optional thread)
-     ,(when doc doc)
-     (interactive)
-     (let ((special-display-regexps (append special-display-regexps '(".*")))
-           (special-display-frame-alist gdb-frame-parameters))
-       (display-buffer (gdb-get-buffer-create ,buffer thread)))))
-
-(defmacro def-gdb-display-buffer (name buffer &optional doc)
-  "Define a function NAME which shows gdb BUFFER.
-
-DOC is an optional documentation string."
-  `(defun ,name (&optional thread)
-     ,(when doc doc)
-     (interactive)
-     (gdb-display-buffer
-      (gdb-get-buffer-create ,buffer thread) t)))
-
 ;; Used to display windows with thread-bound buffers
 (defmacro def-gdb-preempt-display-buffer (name buffer &optional doc
                                               split-horizontal)
@@ -1511,8 +1488,7 @@ DOC is an optional documentation string."
 (defun gdb-display-io-buffer ()
   "Display IO of debugged program in a separate window."
   (interactive)
-  (gdb-display-buffer
-   (gdb-get-buffer-create 'gdb-inferior-io) t))
+  (gdb-display-buffer (gdb-get-buffer-create 'gdb-inferior-io)))
 
 (defun gdb-inferior-io--init-proc (proc)
   ;; Set up inferior I/O.  Needs GDB 6.4 onwards.
@@ -1540,19 +1516,24 @@ DOC is an optional documentation string."
        (comint-exec io-buffer "gdb-inferior" nil nil nil)
        (gdb-inferior-io--init-proc (get-buffer-process io-buffer))))))
 
-(defconst gdb-frame-parameters
-  '((height . 14) (width . 80)
-    (unsplittable . t)
-    (tool-bar-lines . nil)
-    (menu-bar-lines . nil)
-    (minibuffer . nil)))
+(defvar gdb-display-buffer-other-frame-action
+  `((display-buffer-reuse-window display-buffer-pop-up-frame)
+    (reusable-frames . 0)
+    (inhibit-same-window . t)
+    (pop-up-frame-parameters (height . 14)
+                            (width . 80)
+                            (unsplittable . t)
+                            (tool-bar-lines . nil)
+                            (menu-bar-lines . nil)
+                            (minibuffer . nil)))
+  "A `display-buffer' action for displaying GDB utility frames.")
+(put 'gdb-display-buffer-other-frame-action 'risky-local-variable t)
 
 (defun gdb-frame-io-buffer ()
-  "Display IO of debugged program in a new frame."
+  "Display IO of debugged program in another frame."
   (interactive)
-  (let ((special-display-regexps (append special-display-regexps '(".*")))
-       (special-display-frame-alist gdb-frame-parameters))
-    (display-buffer (gdb-get-buffer-create 'gdb-inferior-io))))
+  (display-buffer (gdb-get-buffer-create 'gdb-inferior-io)
+                 gdb-display-buffer-other-frame-action))
 
 (defvar gdb-inferior-io-mode-map
   (let ((map (make-sparse-keymap)))
@@ -1571,7 +1552,7 @@ DOC is an optional documentation string."
 
 (defun gdb-inferior-filter (proc string)
   (unless (string-equal string "")
-    (gdb-display-buffer (gdb-get-buffer-create 'gdb-inferior-io) t))
+    (gdb-display-buffer (gdb-get-buffer-create 'gdb-inferior-io)))
   (with-current-buffer (gdb-get-buffer-create 'gdb-inferior-io)
     (comint-output-filter proc string)))
 
@@ -2615,15 +2596,16 @@ If not in a source or disassembly buffer just set point."
 (defun gdb-breakpoints-buffer-name ()
   (concat "*breakpoints of " (gdb-get-target-string) "*"))
 
-(def-gdb-display-buffer
-  gdb-display-breakpoints-buffer
-  'gdb-breakpoints-buffer
-  "Display status of user-settable breakpoints.")
+(defun gdb-display-breakpoints-buffer (&optional thread)
+  "Display GDB breakpoints."
+  (interactive)
+  (gdb-display-buffer (gdb-get-buffer-create 'gdb-breakpoints-buffer thread)))
 
-(def-gdb-frame-for-buffer
-  gdb-frame-breakpoints-buffer
-  'gdb-breakpoints-buffer
-  "Display status of user-settable breakpoints in a new frame.")
+(defun gdb-frame-breakpoints-buffer (&optional thread)
+  "Display GDB breakpoints in another frame."
+  (interactive)
+  (display-buffer (gdb-get-buffer-create 'gdb-breakpoints-buffer thread)
+                 gdb-display-buffer-other-frame-action))
 
 (defvar gdb-breakpoints-mode-map
   (let ((map (make-sparse-keymap))
@@ -2684,15 +2666,16 @@ corresponding to the mode line clicked."
 (defun gdb-threads-buffer-name ()
   (concat "*threads of " (gdb-get-target-string) "*"))
 
-(def-gdb-display-buffer
-  gdb-display-threads-buffer
-  'gdb-threads-buffer
-  "Display GDB threads.")
+(defun gdb-display-threads-buffer (&optional thread)
+  "Display GDB threads."
+  (interactive)
+  (gdb-display-buffer (gdb-get-buffer-create 'gdb-threads-buffer thread)))
 
-(def-gdb-frame-for-buffer
-  gdb-frame-threads-buffer
-  'gdb-threads-buffer
-  "Display GDB threads in a new frame.")
+(defun gdb-frame-threads-buffer (&optional thread)
+  "Display GDB threads in another frame."
+  (interactive)
+  (display-buffer (gdb-get-buffer-create 'gdb-threads-buffer thread)
+                 gdb-display-buffer-other-frame-action))
 
 (def-gdb-trigger-and-handler
   gdb-invalidate-threads (gdb-current-context-command "-thread-info")
@@ -2868,26 +2851,22 @@ on the current line."
 (def-gdb-thread-buffer-simple-command
   gdb-frame-stack-for-thread
   gdb-frame-stack-buffer
-  "Display a new frame with stack buffer for the thread at
-current line.")
+  "Display another frame with stack buffer for thread at current line.")
 
 (def-gdb-thread-buffer-simple-command
   gdb-frame-locals-for-thread
   gdb-frame-locals-buffer
-  "Display a new frame with locals buffer for the thread at
-current line.")
+  "Display another frame with locals buffer for thread at current line.")
 
 (def-gdb-thread-buffer-simple-command
   gdb-frame-registers-for-thread
   gdb-frame-registers-buffer
-  "Display a new frame with registers buffer for the thread at
-current line.")
+  "Display another frame with registers buffer for the thread at current line.")
 
 (def-gdb-thread-buffer-simple-command
   gdb-frame-disassembly-for-thread
   gdb-frame-disassembly-buffer
-  "Display a new frame with disassembly buffer for the thread at
-current line.")
+  "Display another frame with disassembly buffer for the thread at current line.")
 
 (defmacro def-gdb-thread-buffer-gud-command (name gud-command &optional doc)
   "Define a NAME which will execute GUD-COMMAND with
@@ -3290,21 +3269,16 @@ DOC is an optional documentation string."
 (defun gdb-memory-buffer-name ()
   (concat "*memory of " (gdb-get-target-string) "*"))
 
-(def-gdb-display-buffer
-  gdb-display-memory-buffer
-  'gdb-memory-buffer
-  "Display memory contents.")
+(defun gdb-display-memory-buffer (&optional thread)
+  "Display GDB memory contents."
+  (interactive)
+  (gdb-display-buffer (gdb-get-buffer-create 'gdb-memory-buffer thread)))
 
 (defun gdb-frame-memory-buffer ()
-  "Display memory contents in a new frame."
+  "Display memory contents in another frame."
   (interactive)
-  (let* ((special-display-regexps (append special-display-regexps '(".*")))
-        (special-display-frame-alist
-         `((left-fringe . 0)
-            (right-fringe . 0)
-            (width . 83)
-            ,@gdb-frame-parameters)))
-    (display-buffer (gdb-get-buffer-create 'gdb-memory-buffer))))
+  (display-buffer (gdb-get-buffer-create 'gdb-memory-buffer)
+                 gdb-display-buffer-other-frame-action))
 
 \f
 ;;; Disassembly view
@@ -3313,19 +3287,20 @@ DOC is an optional documentation string."
   (gdb-current-context-buffer-name
    (concat "disassembly of " (gdb-get-target-string))))
 
-(def-gdb-display-buffer
-  gdb-display-disassembly-buffer
-  'gdb-disassembly-buffer
-  "Display disassembly for current stack frame.")
+(defun gdb-display-disassembly-buffer (&optional thread)
+  "Display GDB disassembly information."
+  (interactive)
+  (gdb-display-buffer (gdb-get-buffer-create 'gdb-disassembly-buffer thread)))
 
 (def-gdb-preempt-display-buffer
   gdb-preemptively-display-disassembly-buffer
   'gdb-disassembly-buffer)
 
-(def-gdb-frame-for-buffer
-  gdb-frame-disassembly-buffer
-  'gdb-disassembly-buffer
-  "Display disassembly in a new frame.")
+(defun gdb-frame-disassembly-buffer (&optional thread)
+  "Display GDB disassembly information in another frame."
+  (interactive)
+  (display-buffer (gdb-get-buffer-create 'gdb-disassembly-buffer thread)
+                 gdb-display-buffer-other-frame-action))
 
 (def-gdb-auto-update-trigger gdb-invalidate-disassembly
   (let* ((frame (gdb-current-buffer-frame))
@@ -3560,19 +3535,20 @@ member."
   (gdb-current-context-buffer-name
    (concat "stack frames of " (gdb-get-target-string))))
 
-(def-gdb-display-buffer
-  gdb-display-stack-buffer
-  'gdb-stack-buffer
-  "Display backtrace of current stack.")
+(defun gdb-display-stack-buffer (&optional thread)
+  "Display GDB backtrace for current stack."
+  (interactive)
+  (gdb-display-buffer (gdb-get-buffer-create 'gdb-stack-buffer thread)))
 
 (def-gdb-preempt-display-buffer
   gdb-preemptively-display-stack-buffer
   'gdb-stack-buffer nil t)
 
-(def-gdb-frame-for-buffer
-  gdb-frame-stack-buffer
-  'gdb-stack-buffer
-  "Display backtrace of current stack in a new frame.")
+(defun gdb-frame-stack-buffer (&optional thread)
+  "Display GDB backtrace for current stack in another frame."
+  (interactive)
+  (display-buffer (gdb-get-buffer-create 'gdb-stack-buffer thread)
+                 gdb-display-buffer-other-frame-action))
 
 (defvar gdb-frames-mode-map
   (let ((map (make-sparse-keymap)))
@@ -3719,19 +3695,20 @@ member."
   (gdb-current-context-buffer-name
    (concat "locals of " (gdb-get-target-string))))
 
-(def-gdb-display-buffer
-  gdb-display-locals-buffer
-  'gdb-locals-buffer
-  "Display local variables of current stack and their values.")
+(defun gdb-display-locals-buffer (&optional thread)
+  "Display the local variables of current GDB stack."
+  (interactive)
+  (gdb-display-buffer (gdb-get-buffer-create 'gdb-locals-buffer thread)))
 
 (def-gdb-preempt-display-buffer
   gdb-preemptively-display-locals-buffer
   'gdb-locals-buffer nil t)
 
-(def-gdb-frame-for-buffer
-  gdb-frame-locals-buffer
-  'gdb-locals-buffer
-  "Display local variables of current stack and their values in a new frame.")
+(defun gdb-frame-locals-buffer (&optional thread)
+  "Display the local variables of the current GDB stack in another frame."
+  (interactive)
+  (display-buffer (gdb-get-buffer-create 'gdb-locals-buffer thread)
+                 gdb-display-buffer-other-frame-action))
 
 \f
 ;; Registers buffer.
@@ -3818,19 +3795,20 @@ member."
   (gdb-current-context-buffer-name
    (concat "registers of " (gdb-get-target-string))))
 
-(def-gdb-display-buffer
-  gdb-display-registers-buffer
-  'gdb-registers-buffer
-  "Display integer register contents.")
+(defun gdb-display-registers-buffer (&optional thread)
+  "Display GDB register contents."
+  (interactive)
+  (gdb-display-buffer (gdb-get-buffer-create 'gdb-registers-buffer thread)))
 
 (def-gdb-preempt-display-buffer
   gdb-preemptively-display-registers-buffer
   'gdb-registers-buffer nil t)
 
-(def-gdb-frame-for-buffer
-  gdb-frame-registers-buffer
-  'gdb-registers-buffer
-  "Display integer register contents in a new frame.")
+(defun gdb-frame-registers-buffer (&optional thread)
+  "Display GDB register contents in another frame."
+  (interactive)
+  (display-buffer (gdb-get-buffer-create 'gdb-registers-buffer thread)
+                 gdb-display-buffer-other-frame-action))
 
 ;; Needs GDB 6.4 onwards (used to fail with no stack).
 (defun gdb-get-changed-registers ()
@@ -3917,26 +3895,26 @@ overlay arrow in source buffer."
   (setq gdb-filter-output (concat gdb-filter-output gdb-prompt-name)))
 
 ;;;; Window management
-(defun gdb-display-buffer (buf dedicated &optional frame)
-  "Show buffer BUF.
-
-If BUF is already displayed in some window, show it, deiconifying
-the frame if necessary. Otherwise, find least recently used
-window and show BUF there, if the window is not used for GDB
-already, in which case that window is split first."
-  (let ((answer (get-buffer-window buf (or frame 0))))
-    (if answer
-       (display-buffer buf nil (or frame 0)) ;Deiconify frame if necessary.
-      (let ((window (get-lru-window)))
-       (if (eq (buffer-local-value 'gud-minor-mode (window-buffer window))
-                'gdbmi)
-           (let ((largest (get-largest-window)))
-             (setq answer (split-window largest))
-             (set-window-buffer answer buf)
-             (set-window-dedicated-p answer dedicated)
-             answer)
-         (set-window-buffer window buf)
-         window)))))
+(defun gdb-display-buffer (buf)
+  "Show buffer BUF, and make that window dedicated."
+  (let ((window (display-buffer buf)))
+    (set-window-dedicated-p window t)
+    window))
+
+  ;; (let ((answer (get-buffer-window buf 0)))
+  ;;   (if answer
+  ;;   (display-buffer buf nil 0) ;Deiconify frame if necessary.
+  ;;     (let ((window (get-lru-window)))
+  ;;   (if (eq (buffer-local-value 'gud-minor-mode (window-buffer window))
+  ;;               'gdbmi)
+  ;;       (let ((largest (get-largest-window)))
+  ;;         (setq answer (split-window largest))
+  ;;         (set-window-buffer answer buf)
+  ;;         (set-window-dedicated-p answer t)
+  ;;         answer)
+  ;;     (set-window-buffer window buf)
+  ;;     window)))))
+
 
 (defun gdb-preempt-existing-or-display-buffer (buf &optional split-horizontal)
   "Find window displaying a buffer with the same
@@ -3963,7 +3941,7 @@ SPLIT-HORIZONTAL and show BUF in the new window."
               (if dedicated-window
                   (set-window-buffer
                    (split-window dedicated-window nil split-horizontal) buf)
-                (gdb-display-buffer buf t))))))
+                (gdb-display-buffer buf))))))
     (error "Null buffer")))
 \f
 ;;; Shared keymap initialization:
@@ -4067,7 +4045,7 @@ SPLIT-HORIZONTAL and show BUF in the new window."
   'all-threads)
 
 (defun gdb-frame-gdb-buffer ()
-  "Display GUD buffer in a new frame."
+  "Display GUD buffer in another frame."
   (interactive)
   (display-buffer-other-frame gud-comint-buffer))
 
@@ -4089,13 +4067,12 @@ window is dedicated."
 
 (defun gdb-setup-windows ()
   "Layout the window pattern for `gdb-many-windows'."
-  (gdb-display-locals-buffer)
-  (gdb-display-stack-buffer)
-  (delete-other-windows)
-  (gdb-display-breakpoints-buffer)
-  (delete-other-windows)
-  ;; Don't dedicate.
+  (gdb-get-buffer-create 'gdb-locals-buffer)
+  (gdb-get-buffer-create 'gdb-stack-buffer)
+  (gdb-get-buffer-create 'gdb-breakpoints-buffer)
+  (set-window-dedicated-p (selected-window) nil)
   (switch-to-buffer gud-comint-buffer)
+  (delete-other-windows)
   (let ((win0 (selected-window))
         (win1 (split-window nil ( / ( * (window-height) 3) 4)))
         (win2 (split-window nil ( / (window-height) 3)))
index 5946e93f34deca48e7b9c922ef9f71a20cc7a8ef..2e3858b2cc54508d76e8a551ac860378be6b0322 100644 (file)
@@ -2685,7 +2685,6 @@ Obeying it means displaying in another window the specified file and line."
 (declare-function global-hl-line-highlight  "hl-line" ())
 (declare-function hl-line-highlight         "hl-line" ())
 (declare-function gdb-display-source-buffer "gdb-mi"  (buffer))
-(declare-function gdb-display-buffer "gdb-mi" (buf dedicated &optional size))
 
 ;; Make sure the file named TRUE-FILE is in a buffer that appears on the screen
 ;; and that its line LINE is visible.
@@ -2702,10 +2701,7 @@ Obeying it means displaying in another window the specified file and line."
         (window (and buffer
                      (or (get-buffer-window buffer)
                          (if (eq gud-minor-mode 'gdbmi)
-                             (or (if (get-buffer-window buffer 'visible)
-                                     (display-buffer buffer nil 'visible))
-                                 (unless (gdb-display-source-buffer buffer)
-                                   (gdb-display-buffer buffer nil 'visible))))
+                             (display-buffer buffer nil 'visible))
                          (display-buffer buffer))))
         (pos))
     (if buffer
index 2a672623c010666c2a05d905985979b074ed5382..c1c4b750267a62e52c322867532461e85570d5ce 100644 (file)
@@ -1178,7 +1178,11 @@ is non-nil."
                                (parse-time-string (concat time " +0000")))))
       (cond ((and (not (string-match "\\+" time))
                   (car parsed-time)
-                  (equal mtime (apply 'encode-time parsed-time)))
+                  ;; Compare just the seconds part of the file time,
+                  ;; since CVS file time stamp resolution is just 1 second.
+                  (let ((ptime (apply 'encode-time parsed-time)))
+                    (and (eq (car mtime) (car ptime))
+                         (eq (cadr mtime) (cadr ptime)))))
              (vc-file-setprop file 'vc-checkout-time mtime)
              (if set-state (vc-file-setprop file 'vc-state 'up-to-date)))
             (t
index ab90d8a4bde34453543338c0c90aa3a237bad887..3599ff5527f0e3d7ba20ac73dc76405420ff755b 100644 (file)
@@ -357,6 +357,45 @@ WINDOW must be an internal window.  Return WINDOW."
      window t)
     window))
 
+(defun display-buffer-in-atom-window (buffer alist)
+  "Display BUFFER in an atomic window.
+This function displays BUFFER in a new window that will be
+combined with an existing window to form an atomic window.  If
+the existing window is already part of an atomic window, add the
+new window to that atomic window.  Operations like `split-window'
+or `delete-window', when applied to a constituent of an atomic
+window, are applied atomically to the root of that atomic window.
+
+ALIST is an association list of symbols and values.  The
+following symbols can be used.
+
+`window' specifies the existing window the new window shall be
+  combined with.  Use `window-atom-root' to make the new window a
+  sibling of an atomic window's root.  If an internal window is
+  specified here, all children of that window become part of the
+  atomic window too.  If no window is specified, the new window
+  becomes a sibling of the selected window.
+
+`side' denotes the side of the existing window where the new
+  window shall be located.  Valid values are `below', `right',
+  `above' and `left'.  The default is `below'.
+
+The return value is the new window, nil when creating that window
+failed."
+  (let ((ignore-window-parameters t)
+       (window-combination-limit t)
+       (window (cdr (assq 'window alist)))
+       (side (cdr (assq 'side alist)))
+       new)
+    (setq window (window-normalize-window window))
+    ;; Split off new window
+    (when (setq new (split-window window nil side))
+      ;; Make sure we have a valid atomic window.
+      (window-make-atom (window-parent window))
+      ;; Display BUFFER in NEW and return NEW.
+      (window--display-buffer
+       buffer new 'window display-buffer-mark-dedicated))))
+
 (defun window--atom-check-1 (window)
   "Subroutine of `window--atom-check'."
   (when window
@@ -446,23 +485,273 @@ number of slots on that side."
      (integer :tag "Number" :value 3 :size 5)))
   :group 'windows)
 
+(defun window--major-non-side-window (&optional frame)
+  "Return the major non-side window of frame FRAME.
+The optional argument FRAME must be a live frame and defaults to
+the selected one.
+
+If FRAME has at least one side window, the major non-side window
+is either an internal non-side window such that all other
+non-side windows on FRAME descend from it, or the single live
+non-side window of FRAME.  If FRAME has no side windows, return
+its root window."
+  (let ((frame (window-normalize-frame frame))
+       major sibling)
+    ;; Set major to the _last_ window found by `walk-window-tree' that
+    ;; is not a side window but has a side window as its sibling.
+    (walk-window-tree
+     (lambda (window)
+       (and (not (window-parameter window 'window-side))
+           (or (and (setq sibling (window-prev-sibling window))
+                    (window-parameter sibling 'window-side))
+               (and (setq sibling (window-next-sibling window))
+                    (window-parameter sibling 'window-side)))
+           (setq major window)))
+     frame t)
+    (or major (frame-root-window frame))))
+
+(defun window--major-side-window (side)
+  "Return major side window on SIDE.
+SIDE must be one of the symbols `left', `top', `right' or
+`bottom'.  Return nil if no such window exists."
+  (let ((root (frame-root-window))
+       window)
+    ;; (1) If a window on the opposite side exists, return that window's
+    ;;     sibling.
+    ;; (2) If the new window shall span the entire side, return the
+    ;;     frame's root window.
+    ;; (3) If a window on an orthogonal side exists, return that
+    ;;     window's sibling.
+    ;; (4) Otherwise return the frame's root window.
+    (cond
+     ((or (and (eq side 'left)
+              (setq window (window-with-parameter 'window-side 'right nil t)))
+         (and (eq side 'top)
+              (setq window (window-with-parameter 'window-side 'bottom nil t))))
+      (window-prev-sibling window))
+     ((or (and (eq side 'right)
+              (setq window (window-with-parameter 'window-side 'left nil t)))
+         (and (eq side 'bottom)
+              (setq window (window-with-parameter 'window-side 'top nil t))))
+      (window-next-sibling window))
+     ((memq side '(left right))
+      (cond
+       (window-sides-vertical
+       root)
+       ((setq window (window-with-parameter 'window-side 'top nil t))
+       (window-next-sibling window))
+       ((setq window (window-with-parameter 'window-side 'bottom nil t))
+       (window-prev-sibling window))
+       (t root)))
+     ((memq side '(top bottom))
+      (cond
+       ((not window-sides-vertical)
+       root)
+       ((setq window (window-with-parameter 'window-side 'left nil t))
+       (window-next-sibling window))
+       ((setq window (window-with-parameter 'window-side 'right nil t))
+       (window-prev-sibling window))
+       (t root))))))
+
+(defun display-buffer-in-major-side-window (buffer side slot &optional alist)
+  "Display BUFFER in a new window on SIDE of the selected frame.
+SIDE must be one of `left', `top', `right' or `bottom'.  SLOT
+specifies the slot to use.  ALIST is an association list of
+symbols and values as passed to `display-buffer-in-side-window'.
+This function may be called only if no window on SIDE exists yet.
+The new window automatically becomes the \"major\" side window on
+SIDE.  Return the new window, nil if its creation window failed."
+  (let* ((root (frame-root-window))
+        (left-or-right (memq side '(left right)))
+        (size (or (assq 'size alist)
+                  (/ (window-total-size (frame-root-window) left-or-right)
+                     ;; By default use a fourth of the size of the
+                     ;; frame's root window.  This has to be made
+                     ;; customizable via ALIST.
+                     4)))
+        (major (window--major-side-window side))
+        (selected-window (selected-window))
+        (on-side (cond
+                  ((eq side 'top) 'above)
+                  ((eq side 'bottom) 'below)
+                  (t side)))
+        ;; The following two bindings will tell `split-window' to take
+        ;; the space for the new window from `major' and not make a new
+        ;; parent window unless needed.
+        (window-combination-resize 'side)
+        (window-combination-limit nil)
+        (new (split-window major (- size) on-side))
+        fun)
+    (when new
+      ;; Initialize `window-side' parameter of new window to SIDE.
+      (set-window-parameter new 'window-side side)
+      ;; Install `window-slot' parameter of new window.
+      (set-window-parameter new 'window-slot slot)
+      ;; Install `delete-window' parameter thus making sure that when
+      ;; the new window is deleted, a side window on the opposite side
+      ;; does not get resized.
+      (set-window-parameter new 'delete-window 'delete-side-window)
+      ;; Install BUFFER in new window and return NEW.
+      (window--display-buffer buffer new 'window 'side))))
+
+(defun delete-side-window (window)
+  "Delete side window WINDOW."
+  (let ((window-combination-resize
+        (window-parameter (window-parent window) 'window-side))
+       (ignore-window-parameters t))
+    (delete-window window)))
+
+(defun display-buffer-in-side-window (buffer alist)
+  "Display BUFFER in a window on side SIDE of the selected frame.
+ALIST is an association list of symbols and values.  The
+following symbols can be used:
+
+`side' denotes the side of the existing window where the new
+  window shall be located.  Valid values are `bottom', `right',
+  `top' and `left'.  The default is `bottom'.
+
+`slot' if non-nil, specifies the window slot where to display
+  BUFFER.  A value of zero or nil means use the middle slot on
+  the specified side.  A negative value means use a slot
+  preceding (that is, above or on the left of) the middle slot.
+  A positive value means use a slot following (that is, below or
+  on the right of) the middle slot.  The default is zero."
+  (let ((side (or (cdr (assq 'side alist)) 'bottom))
+       (slot (or (cdr (assq 'slot alist)) 0))
+       new)
+    (cond
+     ((not (memq side '(top bottom left right)))
+      (error "Invalid side %s specified" side))
+     ((not (numberp slot))
+      (error "Invalid slot %s specified" slot)))
+
+    (let* ((major (window-with-parameter 'window-side side nil t))
+          ;; `major' is the major window on SIDE, `windows' the list of
+          ;; life windows on SIDE.
+          (windows
+           (when major
+             (let (windows)
+               (walk-window-tree
+                (lambda (window)
+                  (when (eq (window-parameter window 'window-side) side)
+                    (setq windows (cons window windows)))))
+               (nreverse windows))))
+          (slots (when major (max 1 (window-child-count major))))
+          (max-slots
+           (nth (cond
+                 ((eq side 'left) 0)
+                 ((eq side 'top) 1)
+                 ((eq side 'right) 2)
+                 ((eq side 'bottom) 3))
+                window-sides-slots))
+          (selected-window (selected-window))
+          window this-window this-slot prev-window next-window
+          best-window best-slot abs-slot new-window)
+
+      (cond
+       ((and (numberp max-slots) (<= max-slots 0))
+       ;; No side-slots available on this side.  Don't create an error,
+       ;; just return nil.
+       nil)
+       ((not windows)
+       ;; No major window exists on this side, make one.
+       (display-buffer-in-major-side-window buffer side slot alist))
+       (t
+       ;; Scan windows on SIDE.
+       (catch 'found
+         (dolist (window windows)
+           (setq this-slot (window-parameter window 'window-slot))
+           (cond
+            ;; The following should not happen and probably be checked
+            ;; by window--side-check.
+            ((not (numberp this-slot)))
+            ((= this-slot slot)
+             ;; A window with a matching slot has been found.
+             (setq this-window window)
+             (throw 'found t))
+            (t
+             ;; Check if this window has a better slot value wrt the
+             ;; slot of the window we want.
+             (setq abs-slot
+                   (if (or (and (> this-slot 0) (> slot 0))
+                           (and (< this-slot 0) (< slot 0)))
+                       (abs (- slot this-slot))
+                     (+ (abs slot) (abs this-slot))))
+             (unless (and best-slot (<= best-slot abs-slot))
+               (setq best-window window)
+               (setq best-slot abs-slot))
+             (cond
+              ((<= this-slot slot)
+               (setq prev-window window))
+              ((not next-window)
+               (setq next-window window)))))))
+
+       ;; `this-window' is the first window with the same SLOT.
+       ;; `prev-window' is the window with the largest slot < SLOT.  A new
+       ;; window will be created after it.
+       ;; `next-window' is the window with the smallest slot > SLOT.  A new
+       ;; window will be created before it.
+       ;; `best-window' is the window with the smallest absolute difference
+       ;; of its slot and SLOT.
+
+       ;; Note: We dedicate the window used softly to its buffer to
+       ;; avoid that "other" (non-side) buffer display functions steal
+       ;; it from us.  This must eventually become customizable via
+       ;; ALIST (or, better, avoided in the "other" functions).
+       (or (and this-window
+                ;; Reuse `this-window'.
+                (window--display-buffer buffer this-window 'reuse 'side))
+           (and (or (not max-slots) (< slots max-slots))
+                (or (and next-window
+                         ;; Make new window before `next-window'.
+                         (let ((next-side
+                                (if (memq side '(left right)) 'above 'left))
+                               (window-combination-resize 'side))
+                           (setq window (split-window next-window nil next-side))
+                           ;; When the new window is deleted, its space
+                           ;; is returned to other side windows.
+                           (set-window-parameter
+                            window 'delete-window 'delete-side-window)
+                           window))
+                    (and prev-window
+                         ;; Make new window after `prev-window'.
+                         (let ((prev-side
+                                (if (memq side '(left right)) 'below 'right))
+                               (window-combination-resize 'side))
+                           (setq window (split-window prev-window nil prev-side))
+                           ;; When the new window is deleted, its space
+                           ;; is returned to other side windows.
+                           (set-window-parameter
+                            window 'delete-window 'delete-side-window)
+                           window)))
+                  (set-window-parameter window 'window-slot slot)
+                  (window--display-buffer buffer window 'window 'side))
+           (and best-window
+                ;; Reuse `best-window'.
+                (progn
+                  ;; Give best-window the new slot value.
+                  (set-window-parameter best-window 'window-slot slot)
+                  (window--display-buffer buffer best-window 'reuse 'side)))))))))
+
 (defun window--side-check (&optional frame)
-  "Check the window-side parameter of all windows on FRAME.
-FRAME defaults to the selected frame.  If the configuration is
-invalid, reset all window-side parameters to nil.
-
-A valid configuration has to preserve the following invariant:
-
-- If a window has a non-nil window-side parameter, it must have a
-  parent window and the parent window's window-side parameter
-  must be either nil or the same as for window.
-
-- If windows with non-nil window-side parameters exist, there
-  must be at most one window of each side and non-side with a
-  parent whose window-side parameter is nil and there must be no
-  leaf window whose window-side parameter is nil."
-  (let (normal none left top right bottom
-       side parent parent-side)
+  "Check the side window configuration of FRAME.
+FRAME defaults to the selected frame.
+
+A valid side window configuration preserves the following two
+invariants:
+
+- If there exists a window whose window-side parameter is
+  non-nil, there must exist at least one live window whose
+  window-side parameter is nil.
+
+- If a window W has a non-nil window-side parameter (i) it must
+  have a parent window and that parent's window-side parameter
+  must be either nil or the same as for W, and (ii) any child
+  window of W must have the same window-side parameter as W.
+
+If the configuration is invalid, reset the window-side parameters
+of all windows on FRAME to nil."
+  (let (left top right bottom none side parent parent-side)
     (when (or (catch 'reset
                (walk-window-tree
                 (lambda (window)
@@ -478,40 +767,34 @@ A valid configuration has to preserve the following invariant:
                       ;; A parent whose window-side is non-nil must
                       ;; have a child with the same window-side.
                       (throw 'reset t)))
-                   ;; Now check that there's more than one main window
-                   ;; for any of none, left, top, right and bottom.
-                   ((eq side 'none)
-                    (if none
-                        (throw 'reset t)
+                   ((not side)
+                    (when (window-buffer window)
+                      ;; Record that we have at least one non-side,
+                      ;; live window.
                       (setq none t)))
+                   ((if (memq side '(left top))
+                        (window-prev-sibling window)
+                      (window-next-sibling window))
+                    ;; Left and top major side windows must not have a
+                    ;; previous sibling, right and bottom major side
+                    ;; windows must not have a next sibling.
+                    (throw 'reset t))
+                   ;; Now check that there's no more than one major
+                   ;; window for any of left, top, right and bottom.
                    ((eq side 'left)
-                    (if left
-                        (throw 'reset t)
-                      (setq left t)))
+                    (if left (throw 'reset t) (setq left t)))
                    ((eq side 'top)
-                    (if top
-                        (throw 'reset t)
-                      (setq top t)))
+                    (if top (throw 'reset t) (setq top t)))
                    ((eq side 'right)
-                    (if right
-                        (throw 'reset t)
-                      (setq right t)))
+                    (if right (throw 'reset t) (setq right t)))
                    ((eq side 'bottom)
-                    (if bottom
-                        (throw 'reset t)
-                      (setq bottom t)))
-                   ((window-buffer window)
-                    ;; A leaf window without window-side parameter,
-                    ;; record its existence.
-                    (setq normal t))))
+                    (if bottom (throw 'reset t) (setq bottom t)))
+                   (t 
+                    (throw 'reset t))))
                 frame t))
-             (if none
-                 ;; At least one non-side window exists, so there must
-                 ;; be at least one side-window and no normal window.
-                 (or (not (or left top right bottom)) normal)
-               ;; No non-side window exists, so there must be no side
-               ;; window either.
-               (or left top right bottom)))
+             ;; If there's a side window, there must be at least one
+             ;; non-side window.
+             (and (or left top right bottom) (not none)))
       (walk-window-tree
        (lambda (window)
         (set-window-parameter window 'window-side nil))
@@ -2393,8 +2676,7 @@ Return `frame' if deleting WINDOW should also delete its frame."
     (when (window-parameter window 'window-atom)
       (setq window (window-atom-root window))))
 
-  (let ((parent (window-parent window))
-        (frame (window-frame window)))
+  (let ((frame (window-frame window)))
     (cond
      ((frame-root-window-p window)
       ;; WINDOW's frame can be deleted only if there are other frames
@@ -2405,10 +2687,9 @@ Return `frame' if deleting WINDOW should also delete its frame."
                    (and minibuf (eq frame (window-frame minibuf)))))
        'frame))
      ((or ignore-window-parameters
-         (not (eq (window-parameter window 'window-side) 'none))
-         (and parent (eq (window-parameter parent 'window-side) 'none)))
-      ;; WINDOW can be deleted unless it is the main window of its
-      ;; frame.
+         (not (eq window (window--major-non-side-window frame))))
+      ;; WINDOW can be deleted unless it is the major non-side window of
+      ;; its frame.
       t))))
 
 (defun window--in-subtree-p (window root)
@@ -2459,13 +2740,13 @@ that is its frame's root window."
        ((and (window-parameter window 'window-atom)
             (setq atom-root (window-atom-root window))
             (not (eq atom-root window)))
-       (throw 'done (delete-window atom-root)))
-       ((and (eq (window-parameter window 'window-side) 'none)
-            (or (not parent)
-                (not (eq (window-parameter parent 'window-side) 'none))))
-       (error "Attempt to delete last non-side window"))
+       (if (eq atom-root (frame-root-window frame))
+           (error "Root of atomic window is root window of its frame")
+         (throw 'done (delete-window atom-root))))
        ((not parent)
-       (error "Attempt to delete minibuffer or sole ordinary window")))
+       (error "Attempt to delete minibuffer or sole ordinary window"))
+       ((eq window (window--major-non-side-window frame))
+       (error "Attempt to delete last non-side window")))
 
       (let* ((horizontal (window-left-child parent))
             (size (window-total-size window horizontal))
@@ -2539,13 +2820,19 @@ window signal an error."
        ((and (window-parameter window 'window-atom)
             (setq atom-root (window-atom-root window))
             (not (eq atom-root window)))
-       (throw 'done (delete-other-windows atom-root)))
-       ((eq window-side 'none)
-       ;; Set side-main to the major non-side window.
-       (setq side-main (window-with-parameter 'window-side 'none frame t)))
+       (if (eq atom-root (frame-root-window frame))
+           (error "Root of atomic window is root window of its frame")
+         (throw 'done (delete-other-windows atom-root))))
        ((memq window-side window-sides)
-       (error "Cannot make side window the only window")))
-      ;; If WINDOW is the main non-side window, do nothing.
+       (error "Cannot make side window the only window"))
+       ((and (window-minibuffer-p window)
+            (not (eq window (frame-root-window window))))
+       (error "Can't expand minibuffer to full frame")))
+
+      ;; If WINDOW is the major non-side window, do nothing.
+      (if (window-with-parameter 'window-side)
+         (setq side-main (window--major-non-side-window frame))
+       (setq side-main (frame-root-window frame)))
       (unless (eq window side-main)
        (delete-other-windows-internal window side-main)
        (run-window-configuration-change-hook frame)
@@ -3204,14 +3491,16 @@ frame.  The selected window is not changed by this function."
                ((not side) 'below)
                ((memq side '(below above right left)) side)
                (t 'right)))
-        (horizontal (not (memq side '(nil below above))))
+        (horizontal (not (memq side '(below above))))
         (frame (window-frame window))
         (parent (window-parent window))
         (function (window-parameter window 'split-window))
         (window-side (window-parameter window 'window-side))
-        ;; Rebind `window-combination-limit' since in some cases we may
-        ;; have to override its value.
+        ;; Rebind `window-combination-limit' and
+        ;; `window-combination-resize' since in some cases we may have
+        ;; to override their value.
         (window-combination-limit window-combination-limit)
+        (window-combination-resize window-combination-resize)
         atom-root)
 
     (window--check frame)
@@ -3229,20 +3518,32 @@ frame.  The selected window is not changed by this function."
        ((and (window-parameter window 'window-atom)
             (setq atom-root (window-atom-root window))
             (not (eq atom-root window)))
-       (throw 'done (split-window atom-root size side))))
-
-      (when (and window-side
-                (or (not parent)
-                    (not (window-parameter parent 'window-side))))
-       ;; WINDOW is a side root window.  To make sure that a new parent
-       ;; window gets created set `window-combination-limit' to t.
-       (setq window-combination-limit t))
-
-      (when (and window-combination-resize size (> size 0))
-       ;; If `window-combination-resize' is non-nil and SIZE is a
-       ;; non-negative integer, we cannot reasonably resize other
-       ;; windows.  Rather bind `window-combination-limit' to t to make
-       ;; sure that subsequent window deletions are handled correctly.
+       (throw 'done (split-window atom-root size side)))
+       ;; If WINDOW is a side window or its first or last child is a
+       ;; side window, throw an error unless `window-combination-resize'
+       ;; equals 'side.
+       ((and (not (eq window-combination-resize 'side))
+            (or (window-parameter window 'window-side)
+                (and (window-child window)
+                     (or (window-parameter
+                          (window-child window) 'window-side)
+                         (window-parameter
+                          (window-last-child window) 'window-side)))))
+       (error "Cannot split side window or parent of side window"))
+       ;; If `window-combination-resize' is 'side and window has a side
+       ;; window sibling, bind `window-combination-limit' to t.
+       ((and (not (eq window-combination-resize 'side))
+            (or (and (window-prev-sibling window)
+                     (window-parameter
+                      (window-prev-sibling window) 'window-side))
+                (and (window-next-sibling window)
+                     (window-parameter
+                      (window-next-sibling window) 'window-side))))
+       (setq window-combination-limit t)))
+
+      ;; If `window-combination-resize' is t and SIZE is non-negative,
+      ;; bind `window-combination-limit' to t.
+      (when (and (eq window-combination-resize t) size (> size 0))
        (setq window-combination-limit t))
 
       (let* ((parent-size
@@ -3252,7 +3553,10 @@ frame.  The selected window is not changed by this function."
             ;; `resize' non-nil means we are supposed to resize other
             ;; windows in WINDOW's combination.
             (resize
-             (and window-combination-resize (not window-combination-limit)
+             (and window-combination-resize
+                  (or (window-parameter window 'window-side)
+                      (not (eq window-combination-resize 'side)))
+                  (not window-combination-limit)
                   ;; Resize makes sense in iso-combinations only.
                   (window-combined-p window horizontal)))
             ;; `old-size' is the current size of WINDOW.
@@ -3363,10 +3667,21 @@ frame.  The selected window is not changed by this function."
                     new-normal)))
 
        (let* ((new (split-window-internal window new-size side new-normal)))
-         ;; Inherit window-side parameters, if any.
-         (when (and window-side new-parent)
-           (set-window-parameter (window-parent new) 'window-side window-side)
-           (set-window-parameter new 'window-side window-side))
+         ;; Assign window-side parameters, if any.
+         (when (eq window-combination-resize 'side)
+           (let ((window-side
+                  (cond
+                   (window-side window-side)
+                   ((eq side 'above) 'top)
+                   ((eq side 'below) 'bottom)
+                   (t side))))
+             ;; We made a new side window.
+             (set-window-parameter new 'window-side window-side)
+             (when (and new-parent (window-parameter window 'window-side))
+               ;; We've been splitting a side root window.  Give the
+               ;; new parent the same window-side parameter.
+               (set-window-parameter
+                (window-parent new) 'window-side window-side))))
 
          (run-window-configuration-change-hook frame)
          (window--check frame)
@@ -4054,12 +4369,11 @@ of the window used."
          (function :tag "function"))
   :group 'windows)
 
+;; Eventually, we want to turn this into a defvar; instead of
+;; customizing this, the user should use a `pop-up-frame-parameters'
+;; alist entry in `display-buffer-base-action'.
 (defcustom pop-up-frame-alist nil
   "Alist of parameters for automatically generated new frames.
-You can set this in your init file; for example,
-
-  (setq pop-up-frame-alist '((width . 80) (height . 20)))
-
 If non-nil, the value you specify here is used by the default
 `pop-up-frame-function' for the creation of new frames.
 
@@ -4146,8 +4460,7 @@ See also `special-display-regexps'."
                        (repeat :tag "Arguments" (sexp)))))
   :group 'windows
   :group 'frames)
-
-;;;###autoload
+(make-obsolete-variable 'special-display-buffer-names 'display-buffer-alist "24.3")
 (put 'special-display-buffer-names 'risky-local-variable t)
 
 (defcustom special-display-regexps nil
@@ -4214,6 +4527,8 @@ See also `special-display-buffer-names'."
                        (repeat :tag "Arguments" (sexp)))))
   :group 'windows
   :group 'frames)
+(make-obsolete-variable 'special-display-regexps 'display-buffer-alist "24.3")
+(put 'special-display-regexps 'risky-local-variable t)
 
 (defun special-display-p (buffer-name)
   "Return non-nil if a buffer named BUFFER-NAME gets a special frame.
@@ -4255,6 +4570,7 @@ These supersede the values given in `default-frame-alist'."
                         (symbol :tag "Parameter")
                         (sexp :tag "Value")))
   :group 'frames)
+(make-obsolete-variable 'special-display-frame-alist 'display-buffer-alist "24.3")
 
 (defun special-display-popup-frame (buffer &optional args)
   "Pop up a frame displaying BUFFER and return its window.
@@ -4321,6 +4637,7 @@ with corresponding arguments to set up the quit-restore parameter
 of the window used."
   :type 'function
   :group 'frames)
+(make-obsolete-variable 'special-display-function 'display-buffer-alist "24.3")
 
 (defcustom same-window-buffer-names nil
   "List of names of buffers that should appear in the \"same\" window.
@@ -4393,6 +4710,7 @@ that frame."
   :type 'boolean
   :version "21.1"
   :group 'windows)
+(make-obsolete-variable 'display-buffer-reuse-frames 'display-buffer-alist "24.3")
 
 (defcustom pop-up-windows t
   "Non-nil means `display-buffer' should make a new window."
@@ -4596,23 +4914,19 @@ Do this only if these windows are vertically adjacent to each
 other, `even-window-heights' is non-nil, and the selected window
 is higher than WINDOW."
   (when (and even-window-heights
-            (not (eq window (selected-window)))
-            ;; Don't resize minibuffer windows.
-            (not (window-minibuffer-p (selected-window)))
-            (> (window-height (selected-window)) (window-height window))
-            (eq (window-frame window) (window-frame (selected-window)))
-            (let ((sel-edges (window-edges (selected-window)))
-                  (win-edges (window-edges window)))
-              (and (= (nth 0 sel-edges) (nth 0 win-edges))
-                   (= (nth 2 sel-edges) (nth 2 win-edges))
-                   (or (= (nth 1 sel-edges) (nth 3 win-edges))
-                       (= (nth 3 sel-edges) (nth 1 win-edges))))))
-    (let ((window-min-height 1))
-      ;; Don't throw an error if we can't even window heights for
-      ;; whatever reason.
-      (condition-case nil
-         (enlarge-window (/ (- (window-height window) (window-height)) 2))
-       (error nil)))))
+            ;; Even iff WINDOW forms a vertical combination with the
+            ;; selected window, and WINDOW's height exceeds that of the
+            ;; selected window, see also bug#11880.
+            (window-combined-p window)
+            (= (window-child-count (window-parent window)) 2)
+            (eq (window-parent) (window-parent window))
+            (> (window-total-height) (window-total-height window)))
+    ;; Don't throw an error if we can't even window heights for
+    ;; whatever reason.
+    (condition-case nil
+       (enlarge-window
+        (/ (- (window-total-height window) (window-total-height)) 2))
+      (error nil))))
 
 (defun window--display-buffer (buffer window type &optional dedicated)
   "Display BUFFER in WINDOW and make its frame visible.
@@ -4621,9 +4935,9 @@ is passed unaltered to `display-buffer-record-window'. Set
 `window-dedicated-p' to DEDICATED if non-nil.  Return WINDOW if
 BUFFER and WINDOW are live."
   (when (and (buffer-live-p buffer) (window-live-p window))
+    (display-buffer-record-window type window buffer)
     (unless (eq buffer (window-buffer window))
       (set-window-dedicated-p window nil)
-      (display-buffer-record-window type window buffer)
       (set-window-buffer window buffer)
       (when dedicated
        (set-window-dedicated-p window dedicated))
@@ -4797,6 +5111,10 @@ Recognized alist entries include:
                       window that already displays the buffer.
                       See `display-buffer-reuse-window'.
 
+ `pop-up-frame-parameters' -- Value specifies an alist of frame
+                              parameters to give a new frame, if
+                              one is created.
+
 The ACTION argument to `display-buffer' can also have a non-nil
 and non-list value.  This means to display the buffer in a window
 other than the selected one, even if it is already displayed in
@@ -4939,9 +5257,15 @@ This works by calling `pop-up-frame-function'.  If successful,
 return the window used; otherwise return nil.
 
 If ALIST has a non-nil `inhibit-switch-frame' entry, avoid
-raising the new frame."
-  (let ((fun pop-up-frame-function)
-       frame window)
+raising the new frame.
+
+If ALIST has a non-nil `pop-up-frame-parameters' entry, the
+corresponding value is an alist of frame parameters to give the
+new frame."
+  (let* ((params (cdr (assq 'pop-up-frame-parameters alist)))
+        (pop-up-frame-alist (append params pop-up-frame-alist))
+        (fun pop-up-frame-function)
+        frame window)
     (when (and fun
               (setq frame (funcall fun))
               (setq window (frame-selected-window frame)))
@@ -5019,8 +5343,9 @@ that frame."
                  window))
              (get-largest-window 0 not-this-window))))
     (when (window-live-p window)
-      (window--even-window-heights window)
-      (prog1 (window--display-buffer buffer window 'reuse)
+      (prog1
+         (window--display-buffer buffer window 'reuse)
+       (window--even-window-heights window)
        (unless (cdr (assq 'inhibit-switch-frame alist))
          (window--maybe-raise-frame (window-frame window)))))))
 
index 5933d593aa5cfcd88795c68607ecc99e179b2ec1..c8cc7ea676615704d5fb1638b165051372f5d7c2 100644 (file)
@@ -2531,7 +2531,7 @@ REQUEST is the invoking directive without the leading dot."
     (cond
      ;; ((looking-at "[no]") (setq c t))     ; accept n(roff) and o(dd page)
      ;; ((looking-at "[te]") (setq c nil))   ; reject t(roff) and e(ven page)
-     ;; Per groff ".if v" is recognised as false (it means -Tversatec).
+     ;; Per groff ".if v" is recognized as false (it means -Tversatec).
      ((looking-at "[ntoev]")
       (setq c (memq (following-char) woman-if-conditions-true)))
      ;; Unrecognized letter so reject:
diff --git a/m4/execinfo.m4 b/m4/execinfo.m4
new file mode 100644 (file)
index 0000000..f1f3cd9
--- /dev/null
@@ -0,0 +1,31 @@
+# Check for GNU-style execinfo.h.
+
+dnl Copyright 2012 Free Software Foundation, Inc.
+dnl This file is free software; the Free Software Foundation
+dnl gives unlimited permission to copy and/or distribute it,
+dnl with or without modifications, as long as this notice is preserved.
+
+AC_DEFUN([gl_EXECINFO_H],
+[
+  AC_CHECK_HEADERS_ONCE([execinfo.h])
+
+  LIB_EXECINFO=''
+  EXECINFO_H='execinfo.h'
+
+  if test $ac_cv_header_execinfo_h = yes; then
+    gl_saved_libs=$LIBS
+      AC_SEARCH_LIBS([backtrace_symbols_fd], [execinfo],
+        [test "$ac_cv_search_backtrace_symbols_fd" = "none required" ||
+         LIB_EXECINFO=$ac_cv_search_backtrace_symbols_fd])
+    LIBS=$gl_saved_libs
+    test "$ac_cv_search_backtrace_symbols_fd" = no || EXECINFO_H=''
+  fi
+
+  if test -n "$EXECINFO_H"; then
+    AC_LIBOBJ([execinfo])
+  fi
+
+  AC_SUBST([EXECINFO_H])
+  AC_SUBST([LIB_EXECINFO])
+  AM_CONDITIONAL([GL_GENERATE_EXECINFO_H], [test -n "$EXECINFO_H"])
+])
index 12c8ca8734b9fb70eb8e931aab29e041313e7863..0d73faee8d143cc76cb447f5dbe3f32133849f78 100644 (file)
@@ -53,6 +53,7 @@ AC_DEFUN([gl_EARLY],
   # Code from module dtotimespec:
   # Code from module dup2:
   # Code from module environ:
+  # Code from module execinfo:
   # Code from module extensions:
   AC_REQUIRE([gl_USE_SYSTEM_EXTENSIONS])
   # Code from module extern-inline:
@@ -152,6 +153,7 @@ AC_DEFUN([gl_INIT],
   gl_UNISTD_MODULE_INDICATOR([dup2])
   gl_ENVIRON
   gl_UNISTD_MODULE_INDICATOR([environ])
+  gl_EXECINFO_H
   AC_REQUIRE([gl_EXTERN_INLINE])
   gl_FILEMODE
   gl_GETLOADAVG
@@ -534,6 +536,8 @@ AC_DEFUN([gl_FILE_LIST], [
   lib/dtoastr.c
   lib/dtotimespec.c
   lib/dup2.c
+  lib/execinfo.c
+  lib/execinfo.in.h
   lib/filemode.c
   lib/filemode.h
   lib/ftoastr.c
@@ -605,6 +609,7 @@ AC_DEFUN([gl_FILE_LIST], [
   m4/clock_time.m4
   m4/dup2.m4
   m4/environ.m4
+  m4/execinfo.m4
   m4/extensions.m4
   m4/extern-inline.m4
   m4/filemode.m4
index 12273ec78530743cb43f87697669f74c2b121c3b..7729f09d00f2bf2fbd78cceb14984f262af1d1d3 100644 (file)
@@ -1,3 +1,7 @@
+2012-08-22  Juanma Barranquero  <lekktu@gmail.com>
+
+       * config.nt: Sync with autogen/config.in.
+
 2012-08-17  Juanma Barranquero  <lekktu@gmail.com>
 
        * config.nt: Sync with autogen/config.in.
index 5181e09e64eabe642925b11ed3dc893b9e2b38a1..34495928b9299c39c84393f446c6b95ef2eec472 100644 (file)
@@ -1563,20 +1563,34 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #if __GNUC__ ? __GNUC_STDC_INLINE__ : 199901L <= __STDC_VERSION__
 # define _GL_INLINE inline
 # define _GL_EXTERN_INLINE extern inline
-# if (__GNUC__ == 4 && 6 <= __GNUC_MINOR__) || 4 < __GNUC__
-#  define _GL_INLINE_HEADER_BEGIN \
-     _Pragma ("GCC diagnostic push") \
-     _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \
-     _Pragma ("GCC diagnostic ignored \"-Wmissing-declarations\"")
-#  define _GL_INLINE_HEADER_END \
-     _Pragma ("GCC diagnostic pop")
+#elif 2 < __GNUC__ + (7 <= __GNUC_MINOR__)
+# if __GNUC_GNU_INLINE__
+   /* __gnu_inline__ suppresses a GCC 4.2 diagnostic.  */
+#  define _GL_INLINE extern inline __attribute__ ((__gnu_inline__))
+# else
+#  define _GL_INLINE extern inline
 # endif
+# define _GL_EXTERN_INLINE extern
 #else
 # define _GL_INLINE static inline
 # define _GL_EXTERN_INLINE static inline
 #endif
 
-#ifndef _GL_INLINE_HEADER_BEGIN
+#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
+# if __GNUC_STDC_INLINE__
+#  define _GL_INLINE_HEADER_CONST_PRAGMA
+# else
+#  define _GL_INLINE_HEADER_CONST_PRAGMA \
+     _Pragma ("GCC diagnostic ignored \"-Wsuggest-attribute=const\"")
+# endif
+# define _GL_INLINE_HEADER_BEGIN \
+    _Pragma ("GCC diagnostic push") \
+    _Pragma ("GCC diagnostic ignored \"-Wmissing-prototypes\"") \
+    _Pragma ("GCC diagnostic ignored \"-Wmissing-declarations\"") \
+    _GL_INLINE_HEADER_CONST_PRAGMA
+# define _GL_INLINE_HEADER_END \
+    _Pragma ("GCC diagnostic pop")
+#else
 # define _GL_INLINE_HEADER_BEGIN
 # define _GL_INLINE_HEADER_END
 #endif
index c43404fa438c3112ef867b0db103b823a44381b6..1040b93fe70c92c3e7831f49c882915d466505e8 100644 (file)
@@ -1,3 +1,307 @@
+2012-08-28  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Do not allow to set major mode for a dead buffer.
+       * buffer.c (Fset_buffer_major_mode): Signal an error
+       if the buffer is dead.
+       (Fother_buffer, other_buffer_safely): Remove redundant
+       nested declaration.
+
+2012-08-28  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Always use set_buffer_if_live to restore original buffer at unwind.
+       * buffer.h (record_unwind_current_buffer): New function.
+       * bytecode.c, dispnew.c, editfns.c, fileio.c, fns.c, insdel.c:
+       * keyboard.c, keymap.c, minibuf.c, print.c, process.c, textprop.c:
+       * undo.c, window.c: Adjust users.
+       * buffer.c (set_buffer_if_live): Fix comment.
+
+2012-08-28  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Fix usage of set_buffer_internal.
+       * buffer.h (set_buffer_internal): Make it BUFFER_INLINE.
+       * buffer.c (set_buffer_if_live): Use set_buffer_internal.
+       * coding.c (decode_coding): Omit redundant test.
+       * fileio.c (decide_coding_unwind): Likewise.
+       * fns.c (secure_hash): Likewise.
+       * insdel.c (modify_region): Likewise.
+       * keyboard.c (command_loop_1): Likewise.
+       * print.c (PRINTFINISH): Likewise.
+       * xdisp.c (run_window_scroll_functions): Use set_buffer_internal.
+
+2012-08-27  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * dispnew.c: Use bool for boolean.
+       (frame_garbaged, display_completed, delayed_size_change)
+       (fonts_changed_p, add_window_display_history)
+       (add_frame_display_history, verify_row_hash)
+       (adjust_glyph_matrix, clear_window_matrices, glyph_row_slice_p)
+       (row_equal_p, realloc_glyph_pool)
+       (allocate_matrices_for_frame_redisplay)
+       (showing_window_margins_p)
+       (adjust_frame_glyphs_for_frame_redisplay)
+       (build_frame_matrix_from_leaf_window, make_current)
+       (mirrored_line_dance, mirror_line_dance, update_frame)
+       (update_window_tree, update_single_window)
+       (check_current_matrix_flags, update_window, update_text_area)
+       (update_window_line, set_window_update_flags, scrolling_window)
+       (update_frame_1, scrolling, buffer_posn_from_coords)
+       (do_pending_window_change, change_frame_size)
+       (change_frame_size_1, sit_for):
+       Use bool for boolean.
+       (clear_glyph_matrix_rows): Rename from enable_glyph_matrix_rows,
+       and remove last int (actually boolean) argument, which was always 0.
+       All callers changed.
+       * dispextern.h, frame.h, lisp.h: Reflect above API changes.
+       * dispextern.h (struct composition_it): Use bool for boolean.
+       (struct glyph_matrix): Don't assume buffer sizes can fit in 'int'.
+       (struct bidi_it): Use unsigned:1, not int, for boolean prev_was_pdf.
+       * dired.c (file_name_completion):
+       Use bool for boolean.  (This was missed in an earlier change.)
+
+2012-08-27  Martin Rudalics  <rudalics@gmx.at>
+
+       * window.c (Fset_window_configuration): Revert first part of
+       last change.
+
+2012-08-27  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * nsterm.h (NSPanel): New class variable dialog_return.
+
+       * nsmenu.m (initWithContentRect:styleMask:backing:defer:): Initialize
+       dialog_return.
+       (windowShouldClose:): Use stop instead of stopModalWithCode.
+       (clicked:): Ditto, and also set dialog_return (Bug#12258).
+       (timeout_handler:): Use stop instead of abortModal.  Send a dummy
+       event.
+       (runDialogAt:): Make ret Lisp_Object.  Set it from dialog_return when
+       modal loop returns.
+
+2012-08-27  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * composite.c, data.c, dbusbind.c, dired.c: Use bool for booleans.
+       * composite.c (find_composition, composition_gstring_p)
+       (composition_reseat_it, find_automatic_composition):
+       * data.c (let_shadows_buffer_binding_p)
+       (let_shadows_global_binding_p, set_internal, make_blv)
+       (Fmake_variable_buffer_local, Fmake_local_variable)
+       (Fmake_variable_frame_local, arithcompare, cons_to_unsigned)
+       (cons_to_signed, arith_driver):
+       * dbusbind.c (xd_in_read_queued_messages):
+       * dired.c (directory_files_internal, file_name_completion):
+       Use bool for booleans.
+       * dired.c (file_name_completion):
+       * process.h (fd_callback):
+       Omit int (actually boolean) argument.  It wasn't being used.
+       All uses changed.
+       * composite.h, lisp.h: Reflect above API changes.
+
+       * cmds.c, coding.c: Use bool for booleans.
+       * cmds.c (move_point, Fself_insert_command):
+       * coding.h (struct composition status, struct coding_system):
+       * coding.c (detect_coding_utf_8, encode_coding_utf_8)
+       (detect_coding_utf_16, encode_coding_utf_16, detect_coding_emacs_mule)
+       (emacs_mule_char, decode_coding_emacs_mule)
+       (encode_coding_emacs_mule, detect_coding_iso_2022)
+       (decode_coding_iso_2022, encode_invocation_designation)
+       (encode_designation_at_bol, encode_coding_iso_2022)
+       (detect_coding_sjis, detect_coding_big5, decode_coding_sjis)
+       (decode_coding_big5, encode_coding_sjis, encode_coding_big5)
+       (detect_coding_ccl, encode_coding_ccl, decode_coding_raw_text)
+       (encode_coding_raw_text, detect_coding_charset)
+       (decode_coding_charset, encode_coding_charset, detect_eol)
+       (detect_coding, get_translation_table, produce_chars)
+       (consume_chars, reused_workbuf_in_use)
+       (make_conversion_work_buffer, code_conversion_save)
+       (decode_coding_object, encode_coding_object)
+       (detect_coding_system, char_encodable_p)
+       (Funencodable_char_position, code_convert_region)
+       (code_convert_string, code_convert_string_norecord)
+       (Fset_coding_system_priority):
+       * fileio.c (Finsert_file_contents):
+       Use bool for booleans.
+       * coding.h, lisp.h: Reflect above API changes.
+       * coding.c: Remove unnecessary static function decls.
+       (detect_coding): Use unsigned, not signed, to copy an unsigned field.
+       (decode_coding, encode_coding, decode_coding_gap): Return 'void',
+       not a boolean 'int', since callers never look at the return value.
+       (ALLOC_CONVERSION_WORK_AREA): Assume caller returns 'void', not 'int'.
+       * coding.h (decoding_buffer_size, encoding_buffer_size)
+       (emacs_mule_string_char): Remove unused extern decls.
+       (struct iso_2022_spec, struct coding_system):
+       Use 'unsigned int : 1' for boolean fields, since there's more than one.
+       (struct emacs_mule_spec): Remove unused field 'full_support'.
+       All initializations removed.
+       * cmds.c (internal_self_insert): Don't assume EMACS_INT fits in 'int'.
+
+2012-08-27  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Fix spare memory change (Bug#12286).
+       * alloc.c (mark_maybe_pointer): Handle MEM_TYPE_SPARE.
+       (valid_lisp_object_p): Likewise.
+
+2012-08-27  Martin Rudalics  <rudalics@gmx.at>
+
+       * window.c (Fset_window_configuration): Record any window's old
+       buffer if it's replaced (see Bug#8789).  If the new current
+       buffer doesn't appear in the selected window, go to its old
+       point (Bug#12208).
+
+2012-08-27  Dmitry Antipov  <dmantipov@yandex.ru>
+
+       Special MEM_TYPE_SPARE to denote reserved memory.
+       * alloc.c (enum mem_type): New memory type.
+       (refill_memory_reserve): Use new type for spare memory.
+       This prevents live_cons_p and live_string_p from incorrect
+       detection of uninitialized objects from spare memory as live.
+
+2012-08-26  Paul Eggert  <eggert@cs.ucla.edu>
+
+       Spelling fixes.
+       * Makefile.in (.PHONY): versioclean -> versionclean.
+
+       Remove unused external symbols.
+       * data.c (Qcons, Qfloat, Qmisc, Qstring, Qvector):
+       * window.c (Qwindow_valid_p, decode_valid_window):
+       Now static, not extern.
+       * data.c (Qinterval): Remove; unused.
+       (syms_of_data): Do not define 'interval'.
+       * lisp.h (Qinteger, Qstring, Qmisc, Qvector, Qfloat, Qcons):
+       * window.h (decode_valid_window):
+       Remove decls.
+
+       * character.c, charset.c, chartab.c: Use bool for booleans.
+       * character.c (lisp_string_width, string_count_byte8)
+       (string_escape_byte8):
+       * charset.c (charset_map_loaded, load_charset_map, read_hex):
+       (load_charset_map_from_file, map_charset_chars)
+       (Fdefine_charset_internal, define_charset_internal)
+       (Fdeclare_equiv_charset, find_charsets_in_text)
+       (Ffind_charset_region, char_charset, Fiso_charset):
+       * chartab.c (sub_char_table_ref, sub_char_table_ref_and_range)
+       (sub_char_table_set, sub_char_table_set_range)
+       (char_table_set_range, optimize_sub_char_table)
+       (map_sub_char_table):
+       Use bool for boolean.
+       * character.c (str_to_unibyte): Omit last boolean argument; it was
+       always 0.  All callers changed.
+       * character.h, charset.h: Adjust to match previous changes.
+       * character.h (char_printable_p): Remove decl of nonexistent function.
+       * charset.h (struct charset): Members code_linear_p, iso_chars_96,
+       ascii_compatible_p, supplementary_p, compact_codes_p, unified_p
+       are all boolean, so make them single-bit bitfields.
+
+       * lisp.h (ASET): Remove attempt to detect side effects.
+       It was meant to be temporary and it often doesn't work,
+       because when IDX has side effects the behavior of IDX==IDX
+       is undefined.  See Stefan Monnier in
+       <http://lists.gnu.org/archive/html/emacs-devel/2012-08/msg00762.html>.
+
+2012-08-26  Barry OReilly  <gundaetiapo@gmail.com>  (tiny change)
+
+       * lisp.h (functionp): New function (extracted from Ffunctionp).
+       (FUNCTIONP): Use it.
+       * eval.c (Ffunctionp): Use it.
+
+2012-08-25  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * xgselect.c (xg_select): Use auto storage for the GPollFD buffer
+       as that's faster and simpler than static storage.  Don't bother
+       with the g_main_context_query overhead if g_main_context_pending
+       says no events are pending.
+       (gfds, gfds_size): Remove these static vars.
+       (xgselect_initialize): Remove; no longer needed.
+       All uses and decls removed.
+
+       * emacs.c (fatal_error_signal_hook): Remove.
+       All uses removed.  This leftover from old code was always 0.
+
+       * casefiddle.c, casetab.c, category.c: Use bool for boolean.
+       * casefiddle.c (casify_object, casify_region):
+       * casetab.c (set_case_table):
+       * category.c, category.h (word_boundary_p):
+       * category.h (CHAR_HAS_CATEGORY):
+       Use bool for booleans, instead of int.
+
+2012-08-25  Eli Zaretskii  <eliz@gnu.org>
+
+       * makefile.w32-in ($(BLD)/alloc.$(O)): Depend on $(GNU_LIB)/execinfo.h.
+
+2012-08-25  Paul Eggert  <eggert@cs.ucla.edu>
+
+       On assertion failure, print backtrace if available.
+       * alloc.c [ENABLE_CHECKING]: Include <execinfo.h>.
+       (die) [ENABLE_CHECKING]: Print a backtrace if available.
+       * Makefile.in (LIB_EXECINFO): New macro.
+       (LIBES): Use it.
+
+       * bytecode.c, callint.c, callproc.c: Use bool for boolean.
+       * bytecode.c (exec_byte_code):
+       * callint.c (check_mark, Fcall_interactively):
+       * callproc.c (Fcall_process, add_env, child_setup, getenv_internal_1)
+       (getenv_internal, sync_process_alive, call_process_exited):
+       * lisp.h (USE_SAFE_ALLOCA):
+       Use bool for booleans, instead of int.
+       * lisp.h, process.h: Adjust prototypes to match above changes.
+       * callint.c (Fcall_interactively): Don't assume the mark's
+       offset fits in 'int'.
+
+2012-08-24  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * buffer.c, buffer.h: Use bool for boolean.
+       * buffer.c (reset_buffer_local_variables)
+       (buffer_lisp_local_variables, Fset_buffer_modified_p)
+       (Frestore_buffer_modified_p, Fset_buffer_multibyte):
+       (overlays_at, overlays_in, mouse_face_overlay_overlaps)
+       (overlay_touches_p, overlay_strings, Foverlay_put)
+       (report_overlay_modification, call_overlay_mod_hooks):
+       (mmap_enlarge, mmap_set_vars):
+       * buffer.h (buffer_has_overlays, uppercasep, lowercasep):
+       Use bool for booleans, instead of int.
+       * buffer.c (compact_buffer, mmap_free_1): Return void, not int,
+       since the 1-or-0 return value is always ignored anyway.
+       (mmap_initialized_p):
+       * buffer.h (struct buffer_text.inhibit_shrinking): Now bool, not int.
+       * buffer.h, lisp.h: Adjust prototypes to match above changes.
+
+2012-08-23  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * bidi.c: Use bool for boolean.
+       This is a bit more readable, and makes the text segment of bidi.o
+       0.4% smaller on my platform (GCC 4.7.1 x86-64, Fedora 15).
+       Presumably it's faster too.
+       (bidi_initialized, bidi_ignore_explicit_marks_for_paragraph_level):
+       Now bool.
+       (bidi_cache_find_level_change, bidi_cache_iterator_state)
+       (bidi_unshelve_cache, bidi_init_it, bidi_count_bytes)
+       (bidi_char_at_pos, bidi_fetch_char, bidi_paragraph_init)
+       (bidi_explicit_dir_char, bidi_level_of_next_char)
+       (bidi_find_other_level_edge, bidi_move_to_visually_next):
+       Use bool for booleans, instead of int.
+       * dispextern.h (bidi_init_it, bidi_paragraph_init)
+       (bidi_unshelve_cache): Adjust decls to match code.
+
+2012-08-23  Martin Rudalics  <rudalics@gmx.at>
+
+       * keyboard.c (Fposn_at_x_y): Do not allow internal window as
+       argument.
+
+2012-08-23  Paul Eggert  <eggert@cs.ucla.edu>
+
+       * atimer.c, atimer.h (turn_on_atimers): Use bool for boolean.
+       * atimer.h: Include <stdbool.h>.
+
+2012-08-22  Dan Nicolaescu  <dann@gnu.org>
+
+       * frame.h (FRAME_W32_P, FRAME_MSDOS_P, FRAME_NS_P): Change to
+       compile time tests instead of run time tests on systems that do
+       not use them.
+       (FRAME_MAC_P): Remove leftover from deleted code.
+       * frame.c (syms_of_frame): Remove leftover from deleted code.
+
+2012-08-22  Jan Djärv  <jan.h.d@swipnet.se>
+
+       * nsterm.m (insertText:): Don't clear modifiers if code is space.
+
 2012-08-22  Paul Eggert  <eggert@cs.ucla.edu>
 
        * fontset.c (FONTSET_ADD): Return void, not Lisp_Object.
        * w32uniscribe.c (uniscribe_shape): Fix producing gstring
        components for RTL text (Bug#11860).  Adjust X-OFFSET of each
        non-base glyph for the width of the base character, according to
-       what x_draw_composite_glyph_string_foreground expects.  Generate
-       WADJUST value according to composition_gstring_width's
+       what x_draw_composite_glyph_string_foreground expects.
+       Generate WADJUST value according to composition_gstring_width's
        expectations, to produce correct width of the composed character.
        Reverse the sign of the DU offset produced by ScriptPlace.
 
index 1d89af314015ef0183150dc8891a5ccaccb9f7e8..60df1f1c67789e6b87ef4c4cf1eb63260907b0ef 100644 (file)
@@ -159,6 +159,8 @@ DBUS_LIBS = @DBUS_LIBS@
 ## dbusbind.o if HAVE_DBUS, else empty.
 DBUS_OBJ = @DBUS_OBJ@
 
+LIB_EXECINFO=@LIB_EXECINFO@
+
 SETTINGS_CFLAGS = @SETTINGS_CFLAGS@
 SETTINGS_LIBS = @SETTINGS_LIBS@
 
@@ -383,6 +385,7 @@ otherobj= $(TERMCAP_OBJ) $(PRE_ALLOC_OBJ) $(GMALLOC_OBJ) $(RALLOC_OBJ) \
 ## with GCC, we might need LIB_GCC again after them.
 LIBES = $(LIBS) $(LIBX_BASE) $(LIBX_OTHER) $(LIBSOUND) \
    $(RSVG_LIBS) $(IMAGEMAGICK_LIBS) $(LIB_CLOCK_GETTIME) $(DBUS_LIBS) \
+   $(LIB_EXECINFO) \
    $(LIBXML2_LIBS) $(LIBGPM) $(LIBRESOLV) $(LIBS_SYSTEM) \
    $(LIBS_TERMCAP) $(GETLOADAVG_LIBS) $(SETTINGS_LIBS) $(LIBSELINUX_LIBS) \
    $(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \
@@ -499,7 +502,7 @@ doc.o: buildobj.h
 @ns_frag@
 
 .PHONY: mostlyclean clean bootstrap-clean distclean maintainer-clean
-.PHONY: versioclean extraclean frc
+.PHONY: versionclean extraclean frc
 
 mostlyclean:
        rm -f temacs$(EXEEXT) core *.core \#* *.o libXMenu11.a liblw.a
index f0da9416eceafa3d7fc01c77a202361455f5ac67..36ba22cc5352a956e8b0cfd1369a4805aa2f3b20 100644 (file)
@@ -305,7 +305,9 @@ enum mem_type
      and runtime slowdown.  Minor but pointless.  */
   MEM_TYPE_VECTORLIKE,
   /* Special type to denote vector blocks.  */
-  MEM_TYPE_VECTOR_BLOCK
+  MEM_TYPE_VECTOR_BLOCK,
+  /* Special type to denote reserved memory.  */
+  MEM_TYPE_SPARE
 };
 
 static void *lisp_malloc (size_t, enum mem_type);
@@ -3816,22 +3818,22 @@ refill_memory_reserve (void)
     spare_memory[0] = malloc (SPARE_MEMORY);
   if (spare_memory[1] == 0)
     spare_memory[1] = lisp_align_malloc (sizeof (struct cons_block),
-                                                 MEM_TYPE_CONS);
+                                                 MEM_TYPE_SPARE);
   if (spare_memory[2] == 0)
     spare_memory[2] = lisp_align_malloc (sizeof (struct cons_block),
-                                        MEM_TYPE_CONS);
+                                        MEM_TYPE_SPARE);
   if (spare_memory[3] == 0)
     spare_memory[3] = lisp_align_malloc (sizeof (struct cons_block),
-                                        MEM_TYPE_CONS);
+                                        MEM_TYPE_SPARE);
   if (spare_memory[4] == 0)
     spare_memory[4] = lisp_align_malloc (sizeof (struct cons_block),
-                                        MEM_TYPE_CONS);
+                                        MEM_TYPE_SPARE);
   if (spare_memory[5] == 0)
     spare_memory[5] = lisp_malloc (sizeof (struct string_block),
-                                  MEM_TYPE_STRING);
+                                  MEM_TYPE_SPARE);
   if (spare_memory[6] == 0)
     spare_memory[6] = lisp_malloc (sizeof (struct string_block),
-                                  MEM_TYPE_STRING);
+                                  MEM_TYPE_SPARE);
   if (spare_memory[0] && spare_memory[1] && spare_memory[5])
     Vmemory_full = Qnil;
 #endif
@@ -4561,6 +4563,7 @@ mark_maybe_pointer (void *p)
       switch (m->type)
        {
        case MEM_TYPE_NON_LISP:
+       case MEM_TYPE_SPARE:
          /* Nothing to do; not a pointer to Lisp memory.  */
          break;
 
@@ -5017,6 +5020,7 @@ valid_lisp_object_p (Lisp_Object obj)
   switch (m->type)
     {
     case MEM_TYPE_NON_LISP:
+    case MEM_TYPE_SPARE:
       return 0;
 
     case MEM_TYPE_BUFFER:
@@ -6681,13 +6685,21 @@ which_symbols (Lisp_Object obj, EMACS_INT find_max)
 }
 
 #ifdef ENABLE_CHECKING
+
+# include <execinfo.h>
+
 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 ();
 }
 #endif
index d67e1375f9a742a972ea4c2f7b60527576983c82..eb3136ae55d86323120a65bdb5cd6c0529aa0b65 100644 (file)
@@ -408,7 +408,7 @@ do_pending_atimers (void)
    some systems like HPUX (see process.c).  */
 
 void
-turn_on_atimers (int on)
+turn_on_atimers (bool on)
 {
   if (on)
     {
index 4282bab49bae156ee7bd69fc8e30c9eb2e44e10c..6d441d71641faad8a23199688486637be6cf3605 100644 (file)
@@ -20,6 +20,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define EMACS_ATIMER_H
 
 #include "systime.h"           /* for EMACS_TIME */
+#include <stdbool.h>
 
 /* Forward declaration.  */
 
@@ -74,7 +75,7 @@ struct atimer *start_atimer (enum atimer_type, EMACS_TIME,
 void cancel_atimer (struct atimer *);
 void do_pending_atimers (void);
 void init_atimer (void);
-void turn_on_atimers (int);
+void turn_on_atimers (bool);
 void stop_other_atimers (struct atimer *);
 Lisp_Object unwind_stop_other_atimers (Lisp_Object);
 
index 4df585d4f48db5327109d7de5af3d149b7e00bfd..6b3ac53d318f4165e888d3bde1c52f2fb1bd4e73 100644 (file)
@@ -63,7 +63,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "buffer.h"
 #include "dispextern.h"
 
-static int bidi_initialized = 0;
+static bool bidi_initialized = 0;
 
 static Lisp_Object bidi_type_table, bidi_mirror_table;
 
@@ -82,10 +82,10 @@ typedef enum {
 /* UAX#9 says to search only for L, AL, or R types of characters, and
    ignore RLE, RLO, LRE, and LRO, when determining the base paragraph
    level.  Yudit indeed ignores them.  This variable is therefore set
-   by default to ignore them, but setting it to zero will take them
-   into account.  */
-extern int bidi_ignore_explicit_marks_for_paragraph_level EXTERNALLY_VISIBLE;
-int bidi_ignore_explicit_marks_for_paragraph_level = 1;
+   by default to ignore them, but clearing it will take them into
+   account.  */
+extern bool bidi_ignore_explicit_marks_for_paragraph_level EXTERNALLY_VISIBLE;
+bool bidi_ignore_explicit_marks_for_paragraph_level = 1;
 
 static Lisp_Object paragraph_start_re, paragraph_separate_re;
 static Lisp_Object Qparagraph_start, Qparagraph_separate;
@@ -438,7 +438,7 @@ bidi_cache_search (ptrdiff_t charpos, int level, int dir)
    that is lower than LEVEL, and return its cache slot index.  DIR is
    the direction to search, starting with the last used cache slot.
    If DIR is zero, we search backwards from the last occupied cache
-   slot.  BEFORE, if non-zero, means return the index of the slot that
+   slot.  BEFORE means return the index of the slot that
    is ``before'' the level change in the search direction.  That is,
    given the cached levels like this:
 
@@ -448,9 +448,9 @@ bidi_cache_search (ptrdiff_t charpos, int level, int dir)
    and assuming we are at the position cached at the slot marked with
    C, searching backwards (DIR = -1) for LEVEL = 2 will return the
    index of slot B or A, depending whether BEFORE is, respectively,
-   non-zero or zero.  */
+   true or false.  */
 static ptrdiff_t
-bidi_cache_find_level_change (int level, int dir, int before)
+bidi_cache_find_level_change (int level, int dir, bool before)
 {
   if (bidi_cache_idx)
     {
@@ -512,7 +512,7 @@ bidi_cache_ensure_space (ptrdiff_t idx)
 }
 
 static inline void
-bidi_cache_iterator_state (struct bidi_it *bidi_it, int resolved)
+bidi_cache_iterator_state (struct bidi_it *bidi_it, bool resolved)
 {
   ptrdiff_t idx;
 
@@ -690,11 +690,11 @@ bidi_shelve_cache (void)
 
 /* Restore the cache state from a copy stashed away by
    bidi_shelve_cache, and free the buffer used to stash that copy.
-   JUST_FREE non-zero means free the buffer, but don't restore the
+   JUST_FREE means free the buffer, but don't restore the
    cache; used when the corresponding iterator is discarded instead of
    being restored.  */
 void
-bidi_unshelve_cache (void *databuf, int just_free)
+bidi_unshelve_cache (void *databuf, bool just_free)
 {
   unsigned char *p = databuf;
 
@@ -802,7 +802,7 @@ bidi_set_paragraph_end (struct bidi_it *bidi_it)
 
 /* Initialize the bidi iterator from buffer/string position CHARPOS.  */
 void
-bidi_init_it (ptrdiff_t charpos, ptrdiff_t bytepos, int frame_window_p,
+bidi_init_it (ptrdiff_t charpos, ptrdiff_t bytepos, bool frame_window_p,
              struct bidi_it *bidi_it)
 {
   if (! bidi_initialized)
@@ -872,11 +872,10 @@ bidi_line_init (struct bidi_it *bidi_it)
 
 /* Count bytes in string S between BEG/BEGBYTE and END.  BEG and END
    are zero-based character positions in S, BEGBYTE is byte position
-   corresponding to BEG.  UNIBYTE, if non-zero, means S is a unibyte
-   string.  */
+   corresponding to BEG.  UNIBYTE means S is a unibyte string.  */
 static inline ptrdiff_t
 bidi_count_bytes (const unsigned char *s, const ptrdiff_t beg,
-                 const ptrdiff_t begbyte, const ptrdiff_t end, int unibyte)
+                 const ptrdiff_t begbyte, const ptrdiff_t end, bool unibyte)
 {
   ptrdiff_t pos = beg;
   const unsigned char *p = s + begbyte, *start = p;
@@ -900,10 +899,10 @@ bidi_count_bytes (const unsigned char *s, const ptrdiff_t beg,
 
 /* Fetch and returns the character at byte position BYTEPOS.  If S is
    non-NULL, fetch the character from string S; otherwise fetch the
-   character from the current buffer.  UNIBYTE non-zero means S is a
+   character from the current buffer.  UNIBYTE means S is a
    unibyte string.  */
 static inline int
-bidi_char_at_pos (ptrdiff_t bytepos, const unsigned char *s, int unibyte)
+bidi_char_at_pos (ptrdiff_t bytepos, const unsigned char *s, bool unibyte)
 {
   if (s)
     {
@@ -923,9 +922,9 @@ bidi_char_at_pos (ptrdiff_t bytepos, const unsigned char *s, int unibyte)
    specifies the character position of the next display string, or -1
    if not yet computed.  When the next character is at or beyond that
    position, the function updates DISP_POS with the position of the
-   next display string.  DISP_PROP non-zero means that there's really
+   next display string.  *DISP_PROP non-zero means that there's really
    a display string at DISP_POS, as opposed to when we searched till
-   DISP_POS without finding one.  If DISP_PROP is 2, it means the
+   DISP_POS without finding one.  If *DISP_PROP is 2, it means the
    display spec is of the form `(space ...)', which is replaced with
    u+2029 to handle it as a paragraph separator.  STRING->s is the C
    string to iterate, or NULL if iterating over a buffer or a Lisp
@@ -933,7 +932,7 @@ bidi_char_at_pos (ptrdiff_t bytepos, const unsigned char *s, int unibyte)
 static inline int
 bidi_fetch_char (ptrdiff_t bytepos, ptrdiff_t charpos, ptrdiff_t *disp_pos,
                 int *disp_prop, struct bidi_string_data *string,
-                int frame_window_p, ptrdiff_t *ch_len, ptrdiff_t *nchars)
+                bool frame_window_p, ptrdiff_t *ch_len, ptrdiff_t *nchars)
 {
   int ch;
   ptrdiff_t endpos
@@ -1134,7 +1133,7 @@ bidi_find_paragraph_start (ptrdiff_t pos, ptrdiff_t pos_byte)
    R2L, just use that.  Otherwise, determine the paragraph direction
    from the first strong directional character of the paragraph.
 
-   NO_DEFAULT_P non-zero means don't default to L2R if the paragraph
+   NO_DEFAULT_P means don't default to L2R if the paragraph
    has no strong directional characters and both DIR and
    bidi_it->paragraph_dir are NEUTRAL_DIR.  In that case, search back
    in the buffer until a paragraph is found with a strong character,
@@ -1145,10 +1144,10 @@ bidi_find_paragraph_start (ptrdiff_t pos, ptrdiff_t pos_byte)
    direction as the preceding paragraph, even though Emacs generally
    views the separator as not belonging to any paragraph.  */
 void
-bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, int no_default_p)
+bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, bool no_default_p)
 {
   ptrdiff_t bytepos = bidi_it->bytepos;
-  int string_p = bidi_it->string.s != NULL || STRINGP (bidi_it->string.lstring);
+  bool string_p = bidi_it->string.s || STRINGP (bidi_it->string.lstring);
   ptrdiff_t pstartbyte;
   /* Note that begbyte is a byte position, while end is a character
      position.  Yes, this is ugly, but we are trying to avoid costly
@@ -1221,8 +1220,8 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, int no_default_p)
       bidi_it->separator_limit = -1;
       bidi_it->new_paragraph = 0;
 
-      /* The following loop is run more than once only if NO_DEFAULT_P
-        is non-zero, and only if we are iterating on a buffer.  */
+      /* The following loop is run more than once only if NO_DEFAULT_P,
+        and only if we are iterating on a buffer.  */
       do {
        ptrdiff_t pos1;
 
@@ -1320,7 +1319,7 @@ bidi_paragraph_init (bidi_dir_t dir, struct bidi_it *bidi_it, int no_default_p)
   The rest of this file constitutes the core of the UBA implementation.
  ***********************************************************************/
 
-static inline int
+static inline bool
 bidi_explicit_dir_char (int ch)
 {
   bidi_type_t ch_type;
@@ -1345,7 +1344,7 @@ bidi_resolve_explicit_1 (struct bidi_it *bidi_it)
   int current_level;
   int new_level;
   bidi_dir_t override;
-  int string_p = bidi_it->string.s != NULL || STRINGP (bidi_it->string.lstring);
+  bool string_p = bidi_it->string.s || STRINGP (bidi_it->string.lstring);
 
   /* If reseat()'ed, don't advance, so as to start iteration from the
      position where we were reseated.  bidi_it->bytepos can be less
@@ -2189,7 +2188,7 @@ bidi_level_of_next_char (struct bidi_it *bidi_it)
       ptrdiff_t nc = bidi_it->nchars;
       struct bidi_string_data bs = bidi_it->string;
       bidi_type_t chtype;
-      int fwp = bidi_it->frame_window_p;
+      bool fwp = bidi_it->frame_window_p;
       int dpp = bidi_it->disp_prop;
 
       if (bidi_it->nchars <= 0)
@@ -2268,8 +2267,8 @@ bidi_level_of_next_char (struct bidi_it *bidi_it)
   return level;
 }
 
-/* Move to the other edge of a level given by LEVEL.  If END_FLAG is
-   non-zero, we are at the end of a level, and we need to prepare to
+/* Move to the other edge of a level given by LEVEL.  If END_FLAG,
+   we are at the end of a level, and we need to prepare to
    resume the scan of the lower level.
 
    If this level's other edge is cached, we simply jump to it, filling
@@ -2289,7 +2288,7 @@ bidi_level_of_next_char (struct bidi_it *bidi_it)
    function moves to point C, whereas the UAX#9 ``level 2 run'' ends
    at point B.  */
 static void
-bidi_find_other_level_edge (struct bidi_it *bidi_it, int level, int end_flag)
+bidi_find_other_level_edge (struct bidi_it *bidi_it, int level, bool end_flag)
 {
   int dir = end_flag ? -bidi_it->scan_dir : bidi_it->scan_dir;
   ptrdiff_t idx;
@@ -2363,7 +2362,7 @@ bidi_move_to_visually_next (struct bidi_it *bidi_it)
      scanning the text whenever we find a level change.  */
   if (new_level != old_level)
     {
-      int ascending = new_level > old_level;
+      bool ascending = new_level > old_level;
       int level_to_search = ascending ? old_level + 1 : old_level;
       int incr = ascending ? 1 : -1;
       int expected_next_level = old_level + incr;
index c900ef8c5a82d39fdc22757fc8df9ec97fc27a3e..0e2e50d9f51630aab2e21fb125f43e74c3b3a903 100644 (file)
@@ -110,10 +110,10 @@ static char buffer_permanent_local_flags[MAX_PER_BUFFER_VARS];
 int last_per_buffer_idx;
 
 static void call_overlay_mod_hooks (Lisp_Object list, Lisp_Object overlay,
-                                    int after, Lisp_Object arg1,
+                                    bool after, Lisp_Object arg1,
                                     Lisp_Object arg2, Lisp_Object arg3);
 static void swap_out_buffer_local_variables (struct buffer *b);
-static void reset_buffer_local_variables (struct buffer *b, int permanent_too);
+static void reset_buffer_local_variables (struct buffer *, bool);
 
 /* Alist of all buffer names vs the buffers. */
 /* This used to be a variable, but is no longer,
@@ -155,7 +155,7 @@ static void alloc_buffer_text (struct buffer *, ptrdiff_t);
 static void free_buffer_text (struct buffer *b);
 static struct Lisp_Overlay * copy_overlays (struct buffer *, struct Lisp_Overlay *);
 static void modify_overlay (struct buffer *, ptrdiff_t, ptrdiff_t);
-static Lisp_Object buffer_lisp_local_variables (struct buffer *, int);
+static Lisp_Object buffer_lisp_local_variables (struct buffer *, bool);
 
 /* These setters are used only in this file, so they can be private.  */
 static inline void
@@ -979,15 +979,13 @@ reset_buffer (register struct buffer *b)
    it does not treat permanent locals consistently.
    Instead, use Fkill_all_local_variables.
 
-   If PERMANENT_TOO is 1, then we reset permanent
-   buffer-local variables.  If PERMANENT_TOO is 0,
-   we preserve those.  */
+   If PERMANENT_TOO, reset permanent buffer-local variables.
+   If not, preserve those.  */
 
 static void
-reset_buffer_local_variables (register struct buffer *b, int permanent_too)
+reset_buffer_local_variables (struct buffer *b, bool permanent_too)
 {
-  register int offset;
-  int i;
+  int offset, i;
 
   /* Reset the major mode to Fundamental, together with all the
      things that depend on the major mode.
@@ -1253,14 +1251,14 @@ buffer_local_value_1 (Lisp_Object variable, Lisp_Object buffer)
 /* Return an alist of the Lisp-level buffer-local bindings of
    buffer BUF.  That is, don't include the variables maintained
    in special slots in the buffer object.
-   If CLONE is zero elements of the form (VAR . unbound) are replaced
+   If not CLONE, replace elements of the form (VAR . unbound)
    by VAR.  */
 
 static Lisp_Object
-buffer_lisp_local_variables (struct buffer *buf, int clone)
+buffer_lisp_local_variables (struct buffer *buf, bool clone)
 {
   Lisp_Object result = Qnil;
-  register Lisp_Object tail;
+  Lisp_Object tail;
   for (tail = BVAR (buf, local_var_alist); CONSP (tail); tail = XCDR (tail))
     {
       Lisp_Object val, elt;
@@ -1351,11 +1349,9 @@ DEFUN ("set-buffer-modified-p", Fset_buffer_modified_p, Sset_buffer_modified_p,
        1, 1, 0,
        doc: /* Mark current buffer as modified or unmodified according to FLAG.
 A non-nil FLAG means mark the buffer modified.  */)
-  (register Lisp_Object flag)
+  (Lisp_Object flag)
 {
-  register int already;
-  register Lisp_Object fn;
-  Lisp_Object buffer, window;
+  Lisp_Object fn, buffer, window;
 
 #ifdef CLASH_DETECTION
   /* If buffer becoming modified, lock the file.
@@ -1365,7 +1361,7 @@ A non-nil FLAG means mark the buffer modified.  */)
   /* Test buffer-file-name so that binding it to nil is effective.  */
   if (!NILP (fn) && ! NILP (BVAR (current_buffer, filename)))
     {
-      already = SAVE_MODIFF < MODIFF;
+      bool already = SAVE_MODIFF < MODIFF;
       if (!already && !NILP (flag))
        lock_file (fn);
       else if (already && NILP (flag))
@@ -1432,7 +1428,7 @@ state of the current buffer.  Use with care.  */)
   /* Test buffer-file-name so that binding it to nil is effective.  */
   if (!NILP (fn) && ! NILP (BVAR (current_buffer, filename)))
     {
-      int already = SAVE_MODIFF < MODIFF;
+      bool already = SAVE_MODIFF < MODIFF;
       if (!already && !NILP (flag))
        lock_file (fn);
       else if (already && NILP (flag))
@@ -1557,7 +1553,6 @@ list first, followed by the list of all buffers.  If no other buffer
 exists, return the buffer `*scratch*' (creating it if necessary).  */)
   (register Lisp_Object buffer, Lisp_Object visible_ok, Lisp_Object frame)
 {
-  Lisp_Object Fset_buffer_major_mode (Lisp_Object buffer);
   Lisp_Object tail, buf, pred;
   Lisp_Object notsogood = Qnil;
 
@@ -1628,7 +1623,6 @@ exists, return the buffer `*scratch*' (creating it if necessary).  */)
 Lisp_Object
 other_buffer_safely (Lisp_Object buffer)
 {
-  Lisp_Object Fset_buffer_major_mode (Lisp_Object buffer);
   Lisp_Object tail, buf;
 
   tail = Vbuffer_alist;
@@ -1676,7 +1670,7 @@ No argument or nil as argument means do this for the current buffer.  */)
 
 /* Truncate undo list and shrink the gap of BUFFER.  */
 
-int
+void
 compact_buffer (struct buffer *buffer)
 {
   /* Verify indirection counters.  */
@@ -1718,9 +1712,7 @@ compact_buffer (struct buffer *buffer)
            }
        }
       buffer->text->compact = buffer->text->modiff;
-      return 1;
     }
-  return 0;
 }
 
 DEFUN ("kill-buffer", Fkill_buffer, Skill_buffer, 0, 1, "bKill buffer: ",
@@ -2070,8 +2062,10 @@ the current buffer's major mode.  */)
 
   CHECK_BUFFER (buffer);
 
-  if (STRINGP (BVAR (XBUFFER (buffer), name))
-      && strcmp (SSDATA (BVAR (XBUFFER (buffer), name)), "*scratch*") == 0)
+  if (NILP (BVAR (XBUFFER (buffer), name)))
+    error ("Attempt to set major mode for a dead buffer");
+
+  if (strcmp (SSDATA (BVAR (XBUFFER (buffer), name)), "*scratch*") == 0)
     function = find_symbol_value (intern ("initial-major-mode"));
   else
     {
@@ -2105,22 +2099,6 @@ DEFUN ("current-buffer", Fcurrent_buffer, Scurrent_buffer, 0, 0, 0,
   XSETBUFFER (buf, current_buffer);
   return buf;
 }
-\f
-/* Set the current buffer to B.
-
-   We previously set windows_or_buffers_changed here to invalidate
-   global unchanged information in beg_unchanged and end_unchanged.
-   This is no longer necessary because we now compute unchanged
-   information on a buffer-basis.  Every action affecting other
-   windows than the selected one requires a select_window at some
-   time, and that increments windows_or_buffers_changed.  */
-
-void
-set_buffer_internal (register struct buffer *b)
-{
-  if (current_buffer != b)
-    set_buffer_internal_1 (b);
-}
 
 /* Set the current buffer to B, and do not set windows_or_buffers_changed.
    This is used by redisplay.  */
@@ -2226,13 +2204,13 @@ ends when the current command terminates.  Use `switch-to-buffer' or
   return buffer;
 }
 
-/* Set the current buffer to BUFFER provided it is alive.  */
+/* Set the current buffer to BUFFER provided if it is alive.  */
 
 Lisp_Object
 set_buffer_if_live (Lisp_Object buffer)
 {
   if (! NILP (BVAR (XBUFFER (buffer), name)))
-    Fset_buffer (buffer);
+    set_buffer_internal (XBUFFER (buffer));
   return Qnil;
 }
 \f
@@ -2471,8 +2449,8 @@ current buffer is cleared.  */)
   struct Lisp_Marker *tail, *markers;
   struct buffer *other;
   ptrdiff_t begv, zv;
-  int narrowed = (BEG != BEGV || Z != ZV);
-  int modified_p = !NILP (Fbuffer_modified_p (Qnil));
+  bool narrowed = (BEG != BEGV || Z != ZV);
+  bool modified_p = !NILP (Fbuffer_modified_p (Qnil));
   Lisp_Object old_undo = BVAR (current_buffer, undo_list);
   struct gcpro gcpro1;
 
@@ -2821,19 +2799,19 @@ swap_out_buffer_local_variables (struct buffer *b)
    *VEC_PTR and *LEN_PTR should contain a valid vector and size
    when this function is called.
 
-   If EXTEND is non-zero, we make the vector bigger if necessary.
-   If EXTEND is zero, we never extend the vector,
-   and we store only as many overlays as will fit.
-   But we still return the total number of overlays.
+   If EXTEND, make the vector bigger if necessary.
+   If not, never extend the vector,
+   and store only as many overlays as will fit.
+   But still return the total number of overlays.
 
-   If CHANGE_REQ is true, then any position written into *PREV_PTR or
+   If CHANGE_REQ, any position written into *PREV_PTR or
    *NEXT_PTR is guaranteed to be not equal to POS, unless it is the
    default (BEGV or ZV).  */
 
 ptrdiff_t
-overlays_at (EMACS_INT pos, int extend, Lisp_Object **vec_ptr,
+overlays_at (EMACS_INT pos, bool extend, Lisp_Object **vec_ptr,
             ptrdiff_t *len_ptr,
-            ptrdiff_t *next_ptr, ptrdiff_t *prev_ptr, int change_req)
+            ptrdiff_t *next_ptr, ptrdiff_t *prev_ptr, bool change_req)
 {
   Lisp_Object overlay, start, end;
   struct Lisp_Overlay *tail;
@@ -2842,7 +2820,7 @@ overlays_at (EMACS_INT pos, int extend, Lisp_Object **vec_ptr,
   Lisp_Object *vec = *vec_ptr;
   ptrdiff_t next = ZV;
   ptrdiff_t prev = BEGV;
-  int inhibit_storing = 0;
+  bool inhibit_storing = 0;
 
   for (tail = current_buffer->overlays_before; tail; tail = tail->next)
     {
@@ -2959,13 +2937,13 @@ overlays_at (EMACS_INT pos, int extend, Lisp_Object **vec_ptr,
    *VEC_PTR and *LEN_PTR should contain a valid vector and size
    when this function is called.
 
-   If EXTEND is non-zero, we make the vector bigger if necessary.
-   If EXTEND is zero, we never extend the vector,
-   and we store only as many overlays as will fit.
-   But we still return the total number of overlays.  */
+   If EXTEND, make the vector bigger if necessary.
+   If not, never extend the vector,
+   and store only as many overlays as will fit.
+   But still return the total number of overlays.  */
 
 static ptrdiff_t
-overlays_in (EMACS_INT beg, EMACS_INT end, int extend,
+overlays_in (EMACS_INT beg, EMACS_INT end, bool extend,
             Lisp_Object **vec_ptr, ptrdiff_t *len_ptr,
             ptrdiff_t *next_ptr, ptrdiff_t *prev_ptr)
 {
@@ -2976,8 +2954,8 @@ overlays_in (EMACS_INT beg, EMACS_INT end, int extend,
   Lisp_Object *vec = *vec_ptr;
   ptrdiff_t next = ZV;
   ptrdiff_t prev = BEGV;
-  int inhibit_storing = 0;
-  int end_is_Z = end == Z;
+  bool inhibit_storing = 0;
+  bool end_is_Z = end == Z;
 
   for (tail = current_buffer->overlays_before; tail; tail = tail->next)
     {
@@ -3078,10 +3056,10 @@ overlays_in (EMACS_INT beg, EMACS_INT end, int extend,
 }
 
 
-/* Return non-zero if there exists an overlay with a non-nil
+/* Return true if there exists an overlay with a non-nil
    `mouse-face' property overlapping OVERLAY.  */
 
-int
+bool
 mouse_face_overlay_overlaps (Lisp_Object overlay)
 {
   ptrdiff_t start = OVERLAY_POSITION (OVERLAY_START (overlay));
@@ -3110,7 +3088,7 @@ mouse_face_overlay_overlaps (Lisp_Object overlay)
 
 \f
 /* Fast function to just test if we're at an overlay boundary.  */
-int
+bool
 overlay_touches_p (ptrdiff_t pos)
 {
   Lisp_Object overlay;
@@ -3327,7 +3305,7 @@ overlay_strings (ptrdiff_t pos, struct window *w, unsigned char **pstr)
   Lisp_Object overlay, window, str;
   struct Lisp_Overlay *ov;
   ptrdiff_t startpos, endpos;
-  int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
+  bool multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
 
   overlay_heads.used = overlay_heads.bytes = 0;
   overlay_tails.used = overlay_tails.bytes = 0;
@@ -4321,7 +4299,7 @@ VALUE will be returned.*/)
   (Lisp_Object overlay, Lisp_Object prop, Lisp_Object value)
 {
   Lisp_Object tail, buffer;
-  int changed;
+  bool changed;
 
   CHECK_OVERLAY (overlay);
 
@@ -4396,7 +4374,7 @@ add_overlay_mod_hooklist (Lisp_Object functionlist, Lisp_Object overlay)
    and the insert-after-hooks of overlay ending at START.
 
    This is called both before and after the modification.
-   AFTER is nonzero when we call after the modification.
+   AFTER is true when we call after the modification.
 
    ARG1, ARG2, ARG3 are arguments to pass to the hook functions.
    When AFTER is nonzero, they are the start position,
@@ -4404,13 +4382,13 @@ add_overlay_mod_hooklist (Lisp_Object functionlist, Lisp_Object overlay)
    and the length of deleted or replaced old text.  */
 
 void
-report_overlay_modification (Lisp_Object start, Lisp_Object end, int after,
+report_overlay_modification (Lisp_Object start, Lisp_Object end, bool after,
                             Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3)
 {
   Lisp_Object prop, overlay;
   struct Lisp_Overlay *tail;
-  /* 1 if this change is an insertion.  */
-  int insertion = (after ? XFASTINT (arg3) == 0 : EQ (start, end));
+  /* True if this change is an insertion.  */
+  bool insertion = (after ? XFASTINT (arg3) == 0 : EQ (start, end));
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
 
   overlay = Qnil;
@@ -4530,7 +4508,7 @@ report_overlay_modification (Lisp_Object start, Lisp_Object end, int after,
 }
 
 static void
-call_overlay_mod_hooks (Lisp_Object list, Lisp_Object overlay, int after,
+call_overlay_mod_hooks (Lisp_Object list, Lisp_Object overlay, bool after,
                        Lisp_Object arg1, Lisp_Object arg2, Lisp_Object arg3)
 {
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4;
@@ -4689,7 +4667,7 @@ static int mmap_page_size;
 
 /* 1 means mmap has been initialized.  */
 
-static int mmap_initialized_p;
+static bool mmap_initialized_p;
 
 /* Value is X rounded up to the next multiple of N.  */
 
@@ -4785,9 +4763,9 @@ mmap_find (void *start, void *end)
 
 
 /* Unmap a region.  P is a pointer to the start of the user-araa of
-   the region.  Value is non-zero if successful.  */
+   the region.  */
 
-static int
+static void
 mmap_free_1 (struct mmap_region *r)
 {
   if (r->next)
@@ -4798,24 +4776,19 @@ mmap_free_1 (struct mmap_region *r)
     mmap_regions = r->next;
 
   if (munmap (r, r->nbytes_mapped) == -1)
-    {
-      fprintf (stderr, "munmap: %s\n", emacs_strerror (errno));
-      return 0;
-    }
-
-  return 1;
+    fprintf (stderr, "munmap: %s\n", emacs_strerror (errno));
 }
 
 
 /* Enlarge region R by NPAGES pages.  NPAGES < 0 means shrink R.
-   Value is non-zero if successful.  */
+   Value is true if successful.  */
 
-static int
+static bool
 mmap_enlarge (struct mmap_region *r, int npages)
 {
   char *region_end = (char *) r + r->nbytes_mapped;
   size_t nbytes;
-  int success = 0;
+  bool success = 0;
 
   if (npages < 0)
     {
@@ -4865,17 +4838,16 @@ mmap_enlarge (struct mmap_region *r, int npages)
 }
 
 
-/* Set or reset variables holding references to mapped regions.  If
-   RESTORE_P is zero, set all variables to null.  If RESTORE_P is
-   non-zero, set all variables to the start of the user-areas
-   of mapped regions.
+/* Set or reset variables holding references to mapped regions.
+   If not RESTORE_P, set all variables to null.  If RESTORE_P, set all
+   variables to the start of the user-areas of mapped regions.
 
    This function is called from Fdump_emacs to ensure that the dumped
    Emacs doesn't contain references to memory that won't be mapped
    when Emacs starts.  */
 
 void
-mmap_set_vars (int restore_p)
+mmap_set_vars (bool restore_p)
 {
   struct mmap_region *r;
 
index 6c63c52dc475cb54187f6498feaee9208ea05909..3acf142381605155c9962c410d3946ea950dca4e 100644 (file)
@@ -471,7 +471,7 @@ struct buffer_text
     /* Usually 0.  Temporarily set to 1 in decode_coding_gap to
        prevent Fgarbage_collect from shrinking the gap and losing
        not-yet-decoded bytes.  */
-    int inhibit_shrinking;
+    bool inhibit_shrinking;
   };
 
 /* Most code should use this macro to access Lisp fields in struct buffer.  */
@@ -1006,23 +1006,46 @@ extern struct buffer buffer_local_symbols;
 \f
 extern void delete_all_overlays (struct buffer *);
 extern void reset_buffer (struct buffer *);
-extern int compact_buffer (struct buffer *);
+extern void compact_buffer (struct buffer *);
 extern void evaporate_overlays (ptrdiff_t);
-extern ptrdiff_t overlays_at (EMACS_INT pos, int extend, Lisp_Object **vec_ptr,
-                             ptrdiff_t *len_ptr, ptrdiff_t *next_ptr,
-                             ptrdiff_t *prev_ptr, int change_req);
+extern ptrdiff_t overlays_at (EMACS_INT, bool, Lisp_Object **,
+                             ptrdiff_t *, ptrdiff_t *, ptrdiff_t *, bool);
 extern ptrdiff_t sort_overlays (Lisp_Object *, ptrdiff_t, struct window *);
 extern void recenter_overlay_lists (struct buffer *, ptrdiff_t);
 extern ptrdiff_t overlay_strings (ptrdiff_t, struct window *, unsigned char **);
 extern void validate_region (Lisp_Object *, Lisp_Object *);
-extern void set_buffer_internal (struct buffer *);
 extern void set_buffer_internal_1 (struct buffer *);
 extern void set_buffer_temp (struct buffer *);
 extern Lisp_Object buffer_local_value_1 (Lisp_Object, Lisp_Object);
 extern void record_buffer (Lisp_Object);
 extern _Noreturn void buffer_slot_type_mismatch (Lisp_Object, int);
 extern void fix_overlays_before (struct buffer *, ptrdiff_t, ptrdiff_t);
-extern void mmap_set_vars (int);
+extern void mmap_set_vars (bool);
+
+/* Set the current buffer to B.
+
+   We previously set windows_or_buffers_changed here to invalidate
+   global unchanged information in beg_unchanged and end_unchanged.
+   This is no longer necessary because we now compute unchanged
+   information on a buffer-basis.  Every action affecting other
+   windows than the selected one requires a select_window at some
+   time, and that increments windows_or_buffers_changed.  */
+
+BUFFER_INLINE void
+set_buffer_internal (struct buffer *b)
+{
+  if (current_buffer != b)
+    set_buffer_internal_1 (b);
+}
+
+/* Arrange to go back to the original buffer after the next
+   call to unbind_to if the original buffer is still alive.  */
+
+BUFFER_INLINE void
+record_unwind_current_buffer (void)
+{
+  record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ());
+}
 
 /* Get overlays at POSN into array OVERLAYS with NOVERLAYS elements.
    If NEXTP is non-NULL, return next overlay there.
@@ -1067,7 +1090,7 @@ set_buffer_intervals (struct buffer *b, INTERVAL i)
 
 /* Non-zero if current buffer has overlays.  */
 
-BUFFER_INLINE int
+BUFFER_INLINE bool
 buffer_has_overlays (void)
 {
   return current_buffer->overlays_before || current_buffer->overlays_after;
@@ -1243,7 +1266,7 @@ downcase (int c)
 }
 
 /* 1 if C is upper case.  */
-BUFFER_INLINE int uppercasep (int c) { return downcase (c) != c; }
+BUFFER_INLINE bool uppercasep (int c) { return downcase (c) != c; }
 
 /* Upcase a character C known to be not upper case.  */
 BUFFER_INLINE int
@@ -1255,8 +1278,11 @@ upcase1 (int c)
 }
 
 /* 1 if C is lower case.  */
-BUFFER_INLINE int lowercasep (int c)
-{ return !uppercasep (c) && upcase1 (c) != c; }
+BUFFER_INLINE bool
+lowercasep (int c)
+{
+  return !uppercasep (c) && upcase1 (c) != c;
+}
 
 /* Upcase a character C, or make no change if that cannot be done.  */
 BUFFER_INLINE int upcase (int c) { return uppercasep (c) ? c : upcase1 (c); }
index 5ac8b4fa2bde1314e24b358b0439eeddc6036ec7..40729cbd45364f6e285c2cae62009d2f8e6d2d77 100644 (file)
@@ -553,7 +553,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
   if (INTEGERP (args_template))
     {
       ptrdiff_t at = XINT (args_template);
-      int rest = at & 128;
+      bool rest = (at & 128) != 0;
       int mandatory = at & 127;
       ptrdiff_t nonrest = at >> 8;
       eassert (mandatory <= nonrest);
@@ -1051,7 +1051,7 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
 
        CASE (Bsave_current_buffer): /* Obsolete since ??.  */
        CASE (Bsave_current_buffer_1):
-         record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ());
+         record_unwind_current_buffer ();
          NEXT;
 
        CASE (Bsave_window_excursion): /* Obsolete since 24.1.  */
index 36a59e812f2a9954245cb04ac3155f218b980247..b11545ddea24447a221e583abf381f9888796c58 100644 (file)
@@ -150,7 +150,7 @@ static const char *callint_argfuns[]
     = {"", "point", "mark", "region-beginning", "region-end"};
 
 static void
-check_mark (int for_region)
+check_mark (bool for_region)
 {
   Lisp_Object tem;
   tem = Fmarker_buffer (BVAR (current_buffer, mark));
@@ -273,11 +273,11 @@ invoke it.  If KEYS is omitted or nil, the return value of
   signed char *varies;
 
   ptrdiff_t i, nargs;
-  int foo;
-  int arg_from_tty = 0;
+  ptrdiff_t mark;
+  bool arg_from_tty = 0;
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
   ptrdiff_t key_count;
-  int record_then_fail = 0;
+  bool record_then_fail = 0;
 
   Lisp_Object save_this_command, save_last_command;
   Lisp_Object save_this_original_command, save_real_this_command;
@@ -685,7 +685,7 @@ invoke it.  If KEYS is omitted or nil, the return value of
            goto have_prefix_arg;
        case 'n':               /* Read number from minibuffer.  */
          {
-           int first = 1;
+           bool first = 1;
            do
              {
                Lisp_Object str;
@@ -726,11 +726,11 @@ invoke it.  If KEYS is omitted or nil, the return value of
          check_mark (1);
          set_marker_both (point_marker, Qnil, PT, PT_BYTE);
          /* visargs[i+1] = Qnil; */
-         foo = marker_position (BVAR (current_buffer, mark));
+         mark = marker_position (BVAR (current_buffer, mark));
          /* visargs[i] = Qnil; */
-         args[i] = PT < foo ? point_marker : BVAR (current_buffer, mark);
+         args[i] = PT < mark ? point_marker : BVAR (current_buffer, mark);
          varies[i] = 3;
-         args[++i] = PT > foo ? point_marker : BVAR (current_buffer, mark);
+         args[++i] = PT > mark ? point_marker : BVAR (current_buffer, mark);
          varies[i] = 4;
          break;
 
index 4bf1da04e1acde0eda4a916482eba8ce26a3b990..2e9a8950700c8d797a9ee697cc9dc549ee932436 100644 (file)
@@ -77,7 +77,7 @@ static Lisp_Object Vtemp_file_name_pattern;
 
 /* True if we are about to fork off a synchronous process or if we
    are waiting for it.  */
-int synch_process_alive;
+bool synch_process_alive;
 
 /* Nonzero => this is a string explaining death of synchronous subprocess.  */
 const char *synch_process_death;
@@ -94,8 +94,8 @@ int synch_process_retcode;
    On MSDOS, delete the temporary file on any kind of termination.
    On Unix, kill the process and any children on termination by signal.  */
 
-/* Nonzero if this is termination due to exit.  */
-static int call_process_exited;
+/* True if this is termination due to exit.  */
+static bool call_process_exited;
 
 static Lisp_Object
 call_process_kill (Lisp_Object fdpid)
@@ -190,7 +190,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS)  */)
   (ptrdiff_t nargs, Lisp_Object *args)
 {
   Lisp_Object infile, buffer, current_dir, path, cleanup_info_tail;
-  int display_p;
+  bool display_p;
   int fd[2];
   int filefd;
 #define CALLPROC_BUFFER_SIZE_MIN (16 * 1024)
@@ -217,7 +217,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS)  */)
   struct coding_system argument_coding;        /* coding-system of arguments */
   /* Set to the return value of Ffind_operation_coding_system.  */
   Lisp_Object coding_systems;
-  int output_to_buffer = 1;
+  bool output_to_buffer = 1;
 
   /* Qt denotes that Ffind_operation_coding_system is not yet called.  */
   coding_systems = Qt;
@@ -241,7 +241,7 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS)  */)
     /* If arguments are supplied, we may have to encode them.  */
     if (nargs >= 5)
       {
-       int must_encode = 0;
+       bool must_encode = 0;
        Lisp_Object coding_attrs;
 
        for (i = 4; i < nargs; i++)
@@ -610,12 +610,12 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS)  */)
       Lisp_Object volatile buffer_volatile = buffer;
       Lisp_Object volatile coding_systems_volatile = coding_systems;
       Lisp_Object volatile current_dir_volatile = current_dir;
-      int volatile display_p_volatile = display_p;
+      bool volatile display_p_volatile = display_p;
+      bool volatile output_to_buffer_volatile = output_to_buffer;
+      bool volatile sa_must_free_volatile = sa_must_free;
       int volatile fd1_volatile = fd1;
       int volatile fd_error_volatile = fd_error;
       int volatile fd_output_volatile = fd_output;
-      int volatile output_to_buffer_volatile = output_to_buffer;
-      int volatile sa_must_free_volatile = sa_must_free;
       ptrdiff_t volatile sa_count_volatile = sa_count;
       unsigned char const **volatile new_argv_volatile = new_argv;
 
@@ -766,11 +766,11 @@ usage: (call-process PROGRAM &optional INFILE BUFFER DISPLAY &rest ARGS)  */)
 
   if (output_to_buffer)
     {
-      register int nread;
-      int first = 1;
+      int nread;
+      bool first = 1;
       EMACS_INT total_read = 0;
       int carryover = 0;
-      int display_on_the_fly = display_p;
+      bool display_on_the_fly = display_p;
       struct coding_system saved_coding;
 
       saved_coding = process_coding;
@@ -1086,7 +1086,7 @@ static char **
 add_env (char **env, char **new_env, char *string)
 {
   char **ep;
-  int ok = 1;
+  bool ok = 1;
   if (string == NULL)
     return new_env;
 
@@ -1126,8 +1126,7 @@ add_env (char **env, char **new_env, char *string)
    Therefore, the superior process must save and restore the value
    of environ around the vfork and the call to this function.
 
-   SET_PGRP is nonzero if we should put the subprocess into a separate
-   process group.
+   If SET_PGRP, put the subprocess into a separate process group.
 
    CURRENT_DIR is an elisp string giving the path of the current
    directory the subprocess should have.  Since we can't really signal
@@ -1135,7 +1134,8 @@ add_env (char **env, char **new_env, char *string)
    executable directory by the parent.  */
 
 int
-child_setup (int in, int out, int err, register char **new_argv, int set_pgrp, Lisp_Object current_dir)
+child_setup (int in, int out, int err, char **new_argv, bool set_pgrp,
+            Lisp_Object current_dir)
 {
   char **env;
   char *pwd_var;
@@ -1394,7 +1394,7 @@ relocate_fd (int fd, int minfd)
 }
 #endif /* not WINDOWSNT */
 
-static int
+static bool
 getenv_internal_1 (const char *var, ptrdiff_t varlen, char **value,
                   ptrdiff_t *valuelen, Lisp_Object env)
 {
@@ -1429,7 +1429,7 @@ getenv_internal_1 (const char *var, ptrdiff_t varlen, char **value,
   return 0;
 }
 
-static int
+static bool
 getenv_internal (const char *var, ptrdiff_t varlen, char **value,
                 ptrdiff_t *valuelen, Lisp_Object frame)
 {
index 81e84252b72215bee903c9505a556aee178aa00c..1102054b153e9e972114e92a3287b34d73d96465 100644 (file)
@@ -35,8 +35,8 @@ Lisp_Object Qidentity;
 static Lisp_Object
 casify_object (enum case_action flag, Lisp_Object obj)
 {
-  register int c, c1;
-  register int inword = flag == CASE_DOWN;
+  int c, c1;
+  bool inword = flag == CASE_DOWN;
 
   /* If the case table is flagged as modified, rescan it.  */
   if (NILP (XCHAR_TABLE (BVAR (current_buffer, downcase_table))->extras[1]))
@@ -47,7 +47,8 @@ casify_object (enum case_action flag, Lisp_Object obj)
       int flagbits = (CHAR_ALT | CHAR_SUPER | CHAR_HYPER
                      | CHAR_SHIFT | CHAR_CTL | CHAR_META);
       int flags = XINT (obj) & flagbits;
-      int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
+      bool multibyte = ! NILP (BVAR (current_buffer,
+                                    enable_multibyte_characters));
 
       /* If the character has higher bits set
         above the flags, return it unchanged.
@@ -189,9 +190,9 @@ The argument object is not altered--the value is a copy.  */)
 static void
 casify_region (enum case_action flag, Lisp_Object b, Lisp_Object e)
 {
-  register int c;
-  register int inword = flag == CASE_DOWN;
-  register int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
+  int c;
+  bool inword = flag == CASE_DOWN;
+  bool multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters));
   ptrdiff_t start, end;
   ptrdiff_t start_byte;
 
index a163d5204f8dfde44832220ba4dcf9dd8fcc44fa..3e22d0d0b77c0c735977b3d2fecbb098ebceb25a 100644 (file)
@@ -79,7 +79,7 @@ This is the one used for new buffers.  */)
   return Vascii_downcase_table;
 }
 
-static Lisp_Object set_case_table (Lisp_Object table, int standard);
+static Lisp_Object set_case_table (Lisp_Object, bool);
 
 DEFUN ("set-case-table", Fset_case_table, Sset_case_table, 1, 1, 0,
        doc: /* Select a new case table for the current buffer.
@@ -113,7 +113,7 @@ See `set-case-table' for more info on case tables.  */)
 }
 
 static Lisp_Object
-set_case_table (Lisp_Object table, int standard)
+set_case_table (Lisp_Object table, bool standard)
 {
   Lisp_Object up, canon, eqv;
 
index 1c9085fd558c44cd65361aa6ce9b9533432b1814..80dc6938d8be9022dc23bd4b19002fa7002609d8 100644 (file)
@@ -406,17 +406,17 @@ then delete CATEGORY from the category set instead of adding it.  */)
   return Qnil;
 }
 \f
-/* Return 1 if there is a word boundary between two word-constituent
-   characters C1 and C2 if they appear in this order, else return 0.
+/* Return true if there is a word boundary between two word-constituent
+   characters C1 and C2 if they appear in this order.
    Use the macro WORD_BOUNDARY_P instead of calling this function
    directly.  */
 
-int
+bool
 word_boundary_p (int c1, int c2)
 {
   Lisp_Object category_set1, category_set2;
   Lisp_Object tail;
-  int default_result;
+  bool default_result;
 
   if (EQ (CHAR_TABLE_REF (Vchar_script_table, c1),
          CHAR_TABLE_REF (Vchar_script_table, c2)))
index 9fb981ed3832a7ef3f88ccfd4376f330a05496ca..17cd203db457985353f285582ddf561d0e638cf4 100644 (file)
@@ -77,14 +77,14 @@ INLINE_HEADER_BEGIN
 /* Return the category set of character C in the current category table.  */
 #define CATEGORY_SET(c) char_category_set (c)
 
-/* Return 1 if CATEGORY_SET contains CATEGORY, else return 0.
+/* Return true if CATEGORY_SET contains CATEGORY.
    The faster version of `!NILP (Faref (category_set, category))'.  */
 #define CATEGORY_MEMBER(category, category_set)                                \
   ((XCATEGORY_SET (category_set)->data[(category) / 8]                 \
     >> ((category) % 8)) & 1)
 
-/* Return 1 if category set of CH contains CATEGORY, else return 0.  */
-CATEGORY_INLINE int
+/* Return true if category set of CH contains CATEGORY.  */
+CATEGORY_INLINE bool
 CHAR_HAS_CATEGORY (int ch, int category)
 {
   Lisp_Object category_set = CATEGORY_SET (ch);
@@ -108,14 +108,14 @@ CHAR_HAS_CATEGORY (int ch, int category)
 #define CATEGORY_TABLE_VERSION (table) \
   Fchar_table_extra_slot (table, make_number (1))
 
-/* Return 1 if there is a word boundary between two word-constituent
-   characters C1 and C2 if they appear in this order, else return 0.
+/* Return true if there is a word boundary between two
+   word-constituent characters C1 and C2 if they appear in this order.
    There is no word boundary between two word-constituent ASCII and
    Latin-1 characters.  */
 #define WORD_BOUNDARY_P(c1, c2)                                        \
   (!(SINGLE_BYTE_CHAR_P (c1) && SINGLE_BYTE_CHAR_P (c2))       \
    && word_boundary_p (c1, c2))
 
-extern int word_boundary_p (int, int);
+extern bool word_boundary_p (int, int);
 
 INLINE_HEADER_END
index b2acf36ec158148002cb42d5ab4a41d5c74d1c34..cfaaf8eeca96b1f0a1887746851c83c7ec102455 100644 (file)
@@ -427,7 +427,7 @@ lisp_string_width (Lisp_Object string, ptrdiff_t precision,
   /* This set multibyte to 0 even if STRING is multibyte when it
      contains only ascii and eight-bit-graphic, but that's
      intentional.  */
-  int multibyte = len < SBYTES (string);
+  bool multibyte = len < SBYTES (string);
   unsigned char *str = SDATA (string);
   ptrdiff_t i = 0, i_byte = 0;
   ptrdiff_t width = 0;
@@ -765,13 +765,10 @@ str_as_unibyte (unsigned char *str, ptrdiff_t bytes)
    corresponding byte and store in DST.  CHARS is the number of
    characters in SRC.  The value is the number of bytes stored in DST.
    Usually, the value is the same as CHARS, but is less than it if SRC
-   contains a non-ASCII, non-eight-bit character.  If ACCEPT_LATIN_1
-   is nonzero, a Latin-1 character is accepted and converted to a byte
-   of that character code.
-   Note: Currently the arg ACCEPT_LATIN_1 is not used.  */
+   contains a non-ASCII, non-eight-bit character.  */
 
 ptrdiff_t
-str_to_unibyte (const unsigned char *src, unsigned char *dst, ptrdiff_t chars, int accept_latin_1)
+str_to_unibyte (const unsigned char *src, unsigned char *dst, ptrdiff_t chars)
 {
   ptrdiff_t i;
 
@@ -781,8 +778,7 @@ str_to_unibyte (const unsigned char *src, unsigned char *dst, ptrdiff_t chars, i
 
       if (CHAR_BYTE8_P (c))
        c = CHAR_TO_BYTE8 (c);
-      else if (! ASCII_CHAR_P (c)
-              && (! accept_latin_1 || c >= 0x100))
+      else if (! ASCII_CHAR_P (c))
        return i;
       *dst++ = c;
     }
@@ -793,7 +789,7 @@ str_to_unibyte (const unsigned char *src, unsigned char *dst, ptrdiff_t chars, i
 static ptrdiff_t
 string_count_byte8 (Lisp_Object string)
 {
-  int multibyte = STRING_MULTIBYTE (string);
+  bool multibyte = STRING_MULTIBYTE (string);
   ptrdiff_t nbytes = SBYTES (string);
   unsigned char *p = SDATA (string);
   unsigned char *pend = p + nbytes;
@@ -825,7 +821,7 @@ string_escape_byte8 (Lisp_Object string)
 {
   ptrdiff_t nchars = SCHARS (string);
   ptrdiff_t nbytes = SBYTES (string);
-  int multibyte = STRING_MULTIBYTE (string);
+  bool multibyte = STRING_MULTIBYTE (string);
   ptrdiff_t byte8_count;
   const unsigned char *src, *src_end;
   unsigned char *dst;
index 332dfee373a5359d53cfe54532be6866073843db..70d4e67a97811ffb4153c904b3251c9a3ac91a34 100644 (file)
@@ -676,7 +676,6 @@ extern int string_char (const unsigned char *,
                         const unsigned char **, int *);
 
 extern int translate_char (Lisp_Object, int c);
-extern int char_printable_p (int c);
 extern void parse_str_as_multibyte (const unsigned char *,
                                    ptrdiff_t, ptrdiff_t *, ptrdiff_t *);
 extern ptrdiff_t count_size_as_multibyte (const unsigned char *, ptrdiff_t);
@@ -685,7 +684,7 @@ extern ptrdiff_t str_as_multibyte (unsigned char *, ptrdiff_t, ptrdiff_t,
 extern ptrdiff_t str_to_multibyte (unsigned char *, ptrdiff_t, ptrdiff_t);
 extern ptrdiff_t str_as_unibyte (unsigned char *, ptrdiff_t);
 extern ptrdiff_t str_to_unibyte (const unsigned char *, unsigned char *,
-                                 ptrdiff_t, int);
+                                 ptrdiff_t);
 extern ptrdiff_t strwidth (const char *, ptrdiff_t);
 extern ptrdiff_t c_string_width (const unsigned char *, ptrdiff_t, int,
                                 ptrdiff_t *, ptrdiff_t *);
index 3e286fa947d34f74bf98f88572aa840c32cb7cc3..0673790e91c95a88af89e5ae99bae180efdd00ea 100644 (file)
@@ -215,7 +215,7 @@ static struct
 
 /* Set to 1 to warn that a charset map is loaded and thus a buffer
    text and a string data may be relocated.  */
-int charset_map_loaded;
+bool charset_map_loaded;
 
 struct charset_map_entries
 {
@@ -256,7 +256,7 @@ load_charset_map (struct charset *charset, struct charset_map_entries *entries,
 {
   Lisp_Object vec IF_LINT (= Qnil), table IF_LINT (= Qnil);
   unsigned max_code = CHARSET_MAX_CODE (charset);
-  int ascii_compatible_p = charset->ascii_compatible_p;
+  bool ascii_compatible_p = charset->ascii_compatible_p;
   int min_char, max_char, nonascii_min_char;
   int i;
   unsigned char *fast_map = charset->fast_map;
@@ -423,7 +423,7 @@ load_charset_map (struct charset *charset, struct charset_map_entries *entries,
    paying attention to comment character '#'.  */
 
 static inline unsigned
-read_hex (FILE *fp, int *eof, int *overflow)
+read_hex (FILE *fp, bool *eof, bool *overflow)
 {
   int c;
   unsigned n;
@@ -512,7 +512,7 @@ load_charset_map_from_file (struct charset *charset, Lisp_Object mapfile, int co
     {
       unsigned from, to, c;
       int idx;
-      int eof = 0, overflow = 0;
+      bool eof = 0, overflow = 0;
 
       from = read_hex (fp, &eof, &overflow);
       if (eof)
@@ -717,10 +717,8 @@ map_charset_chars (void (*c_function)(Lisp_Object, Lisp_Object), Lisp_Object fun
                   Lisp_Object arg, struct charset *charset, unsigned from, unsigned to)
 {
   Lisp_Object range;
-  int partial;
-
-  partial = (from > CHARSET_MIN_CODE (charset)
-            || to < CHARSET_MAX_CODE (charset));
+  bool partial = (from > CHARSET_MIN_CODE (charset)
+                 || to < CHARSET_MAX_CODE (charset));
 
   if (CHARSET_METHOD (charset) == CHARSET_METHOD_OFFSET)
     {
@@ -855,7 +853,7 @@ usage: (define-charset-internal ...)  */)
   struct charset charset;
   int id;
   int dimension;
-  int new_definition_p;
+  bool new_definition_p;
   int nchars;
 
   if (nargs != charset_arg_max)
@@ -1250,7 +1248,7 @@ define_charset_internal (Lisp_Object name,
                         const char *code_space_chars,
                         unsigned min_code, unsigned max_code,
                         int iso_final, int iso_revision, int emacs_mule_id,
-                        int ascii_compatible, int supplementary,
+                        bool ascii_compatible, bool supplementary,
                         int code_offset)
 {
   const unsigned char *code_space = (const unsigned char *) code_space_chars;
@@ -1448,7 +1446,7 @@ if CHARSET is designated instead.  */)
   (Lisp_Object dimension, Lisp_Object chars, Lisp_Object final_char, Lisp_Object charset)
 {
   int id;
-  int chars_flag;
+  bool chars_flag;
 
   CHECK_CHARSET_GET_ID (charset, id);
   check_iso_charset_parameter (dimension, chars, final_char);
@@ -1499,7 +1497,9 @@ string_xstring_p (Lisp_Object string)
    It may lookup a translation table TABLE if supplied.  */
 
 static void
-find_charsets_in_text (const unsigned char *ptr, ptrdiff_t nchars, ptrdiff_t nbytes, Lisp_Object charsets, Lisp_Object table, int multibyte)
+find_charsets_in_text (const unsigned char *ptr, ptrdiff_t nchars,
+                      ptrdiff_t nbytes, Lisp_Object charsets,
+                      Lisp_Object table, bool multibyte)
 {
   const unsigned char *pend = ptr + nbytes;
 
@@ -1549,7 +1549,7 @@ only `ascii', `eight-bit-control', and `eight-bit-graphic'.  */)
   ptrdiff_t from, from_byte, to, stop, stop_byte;
   int i;
   Lisp_Object val;
-  int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
+  bool multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
 
   validate_region (&beg, &end);
   from = XFASTINT (beg);
@@ -1735,7 +1735,7 @@ decode_char (struct charset *charset, unsigned int code)
 /* Variable used temporarily by the macro ENCODE_CHAR.  */
 Lisp_Object charset_work;
 
-/* Return a code-point of CHAR in CHARSET.  If CHAR doesn't belong to
+/* Return a code-point of C in CHARSET.  If C doesn't belong to
    CHARSET, return CHARSET_INVALID_CODE (CHARSET).  If STRICT is true,
    use CHARSET's strict_max_char instead of max_char.  */
 
@@ -1978,7 +1978,7 @@ is specified.  */)
 struct charset *
 char_charset (int c, Lisp_Object charset_list, unsigned int *code_return)
 {
-  int maybe_null = 0;
+  bool maybe_null = 0;
 
   if (NILP (charset_list))
     charset_list = Vcharset_ordered_list;
@@ -2106,7 +2106,7 @@ DIMENSION, CHARS, and FINAL-CHAR.  */)
   (Lisp_Object dimension, Lisp_Object chars, Lisp_Object final_char)
 {
   int id;
-  int chars_flag;
+  bool chars_flag;
 
   check_iso_charset_parameter (dimension, chars, final_char);
   chars_flag = XFASTINT (chars) == 96;
index 4ef8ddc2c332770900e90671b1dee68fcd112b76..50d230489fee435dc0d42eca059b545032360c2e 100644 (file)
@@ -173,12 +173,24 @@ struct charset
      check if a code-point is in a valid range.  */
   unsigned char *code_space_mask;
 
-  /* 1 if there's no gap in code-points.  */
-  int code_linear_p;
+  /* True if there's no gap in code-points.  */
+  unsigned code_linear_p : 1;
 
-  /* If the charset is treated as 94-chars in ISO-2022, the value is 0.
-     If the charset is treated as 96-chars in ISO-2022, the value is 1.  */
-  int iso_chars_96;
+  /* True if the charset is treated as 96 chars in ISO-2022
+     as opposed to 94 chars.  */
+  unsigned iso_chars_96 : 1;
+
+  /* True if the charset is compatible with ASCII.  */
+  unsigned ascii_compatible_p : 1;
+
+  /* True if the charset is supplementary.  */
+  unsigned supplementary_p : 1;
+
+  /* True if all the code points are representable by Lisp_Int.  */
+  unsigned compact_codes_p : 1;
+
+  /* True if the charset is unified with Unicode.  */
+  unsigned unified_p : 1;
 
   /* ISO final byte of the charset: 48..127.  It may be -1 if the
      charset doesn't conform to ISO-2022.  */
@@ -192,15 +204,6 @@ struct charset
      version.  Otherwise, -1.  */
   int emacs_mule_id;
 
-  /* Nonzero if the charset is compatible with ASCII.  */
-  int ascii_compatible_p;
-
-  /* Nonzero if the charset is supplementary.  */
-  int supplementary_p;
-
-  /* Nonzero if all the code points are representable by Lisp_Int.  */
-  int compact_codes_p;
-
   /* The method for encoding/decoding characters of the charset.  */
   enum charset_method method;
 
@@ -239,8 +242,6 @@ struct charset
   /* Offset value to calculate a character code from code-point, and
      visa versa.  */
   int code_offset;
-
-  int unified_p;
 };
 
 /* Hash table of charset symbols vs. the corresponding attribute
@@ -456,7 +457,7 @@ extern Lisp_Object charset_work;
 
 /* Set to 1 when a charset map is loaded to warn that a buffer text
    and a string data may be relocated.  */
-extern int charset_map_loaded;
+extern bool charset_map_loaded;
 
 
 /* Set CHARSET to the charset highest priority of C, CODE to the
@@ -474,10 +475,10 @@ extern int charset_map_loaded;
    macro ISO_CHARSET_TABLE (DIMENSION, CHARS, FINAL_CHAR).  */
 extern int iso_charset_table[ISO_MAX_DIMENSION][ISO_MAX_CHARS][ISO_MAX_FINAL];
 
-/* A charset of type iso2022 who has DIMENSION, CHARS, and FINAL
+/* A charset of type iso2022 who has DIMENSION, CHARS_96, and FINAL
    (final character).  */
 #define ISO_CHARSET_TABLE(dimension, chars_96, final)  \
-  iso_charset_table[(dimension) - 1][(chars_96)][(final)]
+  iso_charset_table[(dimension) - 1][chars_96][final]
 
 /* Nonzero if the charset who has FAST_MAP may contain C.  */
 #define CHARSET_FAST_MAP_REF(c, fast_map)              \
@@ -495,7 +496,7 @@ extern int iso_charset_table[ISO_MAX_DIMENSION][ISO_MAX_CHARS][ISO_MAX_FINAL];
 
 
 
-/* 1 if CHARSET may contain the character C.  */
+/* True if CHARSET may contain the character C.  */
 #define CHAR_CHARSET_P(c, charset)                                      \
   ((ASCII_CHAR_P (c) && (charset)->ascii_compatible_p)                  \
    || ((CHARSET_UNIFIED_P (charset)                                     \
index 711a49ed3973e37588b69ab0ed21dce310d7dbf2..c14df0ebac61360a35c4a54377db4678db12796d 100644 (file)
@@ -200,7 +200,7 @@ copy_char_table (Lisp_Object table)
 }
 
 static Lisp_Object
-sub_char_table_ref (Lisp_Object table, int c, int is_uniprop)
+sub_char_table_ref (Lisp_Object table, int c, bool is_uniprop)
 {
   struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table);
   int depth = XINT (tbl->depth);
@@ -245,7 +245,7 @@ char_table_ref (Lisp_Object table, int c)
 
 static Lisp_Object
 sub_char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to,
-                             Lisp_Object defalt, int is_uniprop)
+                             Lisp_Object defalt, bool is_uniprop)
 {
   struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table);
   int depth = XINT (tbl->depth);
@@ -320,7 +320,7 @@ char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to)
   struct Lisp_Char_Table *tbl = XCHAR_TABLE (table);
   int chartab_idx = CHARTAB_IDX (c, 0, 0), idx;
   Lisp_Object val;
-  int is_uniprop = UNIPROP_TABLE_P (table);
+  bool is_uniprop = UNIPROP_TABLE_P (table);
 
   val = tbl->contents[chartab_idx];
   if (*from < 0)
@@ -382,7 +382,7 @@ char_table_ref_and_range (Lisp_Object table, int c, int *from, int *to)
 
 
 static void
-sub_char_table_set (Lisp_Object table, int c, Lisp_Object val, int is_uniprop)
+sub_char_table_set (Lisp_Object table, int c, Lisp_Object val, bool is_uniprop)
 {
   struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table);
   int depth = XINT ((tbl)->depth);
@@ -438,7 +438,7 @@ char_table_set (Lisp_Object table, int c, Lisp_Object val)
 
 static void
 sub_char_table_set_range (Lisp_Object table, int from, int to, Lisp_Object val,
-                         int is_uniprop)
+                         bool is_uniprop)
 {
   struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table);
   int depth = XINT ((tbl)->depth);
@@ -484,7 +484,7 @@ char_table_set_range (Lisp_Object table, int from, int to, Lisp_Object val)
     char_table_set (table, from, val);
   else
     {
-      int is_uniprop = UNIPROP_TABLE_P (table);
+      bool is_uniprop = UNIPROP_TABLE_P (table);
       int lim = CHARTAB_IDX (to, 0, 0);
       int i, c;
 
@@ -683,7 +683,8 @@ optimize_sub_char_table (Lisp_Object table, Lisp_Object test)
   struct Lisp_Sub_Char_Table *tbl = XSUB_CHAR_TABLE (table);
   int depth = XINT (tbl->depth);
   Lisp_Object elt, this;
-  int i, optimizable;
+  int i;
+  bool optimizable;
 
   elt = XSUB_CHAR_TABLE (table)->contents[0];
   if (SUB_CHAR_TABLE_P (elt))
@@ -762,7 +763,7 @@ map_sub_char_table (void (*c_function) (Lisp_Object, Lisp_Object, Lisp_Object),
   int chars_in_block;
   int from = XINT (XCAR (range)), to = XINT (XCDR (range));
   int i, c;
-  int is_uniprop = UNIPROP_TABLE_P (top);
+  bool is_uniprop = UNIPROP_TABLE_P (top);
   uniprop_decoder_t decoder = UNIPROP_GET_DECODER (top);
 
   if (SUB_CHAR_TABLE_P (table))
@@ -811,7 +812,7 @@ map_sub_char_table (void (*c_function) (Lisp_Object, Lisp_Object, Lisp_Object),
            this = XCHAR_TABLE (top)->defalt;
          if (!EQ (val, this))
            {
-             int different_value = 1;
+             bool different_value = 1;
 
              if (NILP (val))
                {
index b416135ee9e395cb88975c81a39db805bc9056b0..90d3cd6dcedde7f4219b472662afda1bd8f5fa45 100644 (file)
@@ -47,10 +47,10 @@ DEFUN ("forward-point", Fforward_point, Sforward_point, 1, 1, 0,
   return make_number (PT + XINT (n));
 }
 
-/* Add N to point; or subtract N if FORWARD is zero.  N defaults to 1.
+/* Add N to point; or subtract N if FORWARD is false.  N defaults to 1.
    Validate the new location.  Return nil.  */
 static Lisp_Object
-move_point (Lisp_Object n, int forward)
+move_point (Lisp_Object n, bool forward)
 {
   /* This used to just set point to point + XINT (n), and then check
      to see if it was within boundaries.  But now that SET_PT can
@@ -277,7 +277,7 @@ After insertion, the value of `auto-fill-function' is called if the
 At the end, it runs `post-self-insert-hook'.  */)
   (Lisp_Object n)
 {
-  int remove_boundary = 1;
+  bool remove_boundary = 1;
   CHECK_NATNUM (n);
 
   if (!EQ (Vthis_command, KVAR (current_kboard, Vlast_command)))
@@ -438,7 +438,7 @@ internal_self_insert (int c, EMACS_INT n)
                  : UNIBYTE_TO_CHAR (XFASTINT (Fprevious_char ())))
          == Sword))
     {
-      int modiff = MODIFF;
+      EMACS_INT modiff = MODIFF;
       Lisp_Object sym;
 
       sym = call0 (Qexpand_abbrev);
index 971686dc180994f4454813d7817ce161e8d80db9..02e7b34695e2cca786daedbbbf835a2604fa68c6 100644 (file)
@@ -147,18 +147,18 @@ STRUCT CODING_SYSTEM
   CODING conforms to the format of XXX, and update the members of
   DETECT_INFO.
 
-  Return 1 if the byte sequence conforms to XXX, otherwise return 0.
+  Return true if the byte sequence conforms to XXX.
 
   Below is the template of these functions.  */
 
 #if 0
-static int
+static bool
 detect_coding_XXX (struct coding_system *coding,
                   struct coding_detection_info *detect_info)
 {
   const unsigned char *src = coding->source;
   const unsigned char *src_end = coding->source + coding->src_bytes;
-  int multibytep = coding->src_multibyte;
+  bool multibytep = coding->src_multibyte;
   ptrdiff_t consumed_chars = 0;
   int found = 0;
   ...;
@@ -212,7 +212,7 @@ decode_coding_XXXX (struct coding_system *coding)
   /* A buffer to produce decoded characters.  */
   int *charbuf = coding->charbuf + coding->charbuf_used;
   int *charbuf_end = coding->charbuf + coding->charbuf_size;
-  int multibytep = coding->src_multibyte;
+  bool multibytep = coding->src_multibyte;
 
   while (1)
     {
@@ -260,7 +260,7 @@ decode_coding_XXXX (struct coding_system *coding)
 static void
 encode_coding_XXX (struct coding_system *coding)
 {
-  int multibytep = coding->dst_multibyte;
+  bool multibytep = coding->dst_multibyte;
   int *charbuf = coding->charbuf;
   int *charbuf_end = charbuf->charbuf + coding->charbuf_used;
   unsigned char *dst = coding->destination + coding->produced;
@@ -651,8 +651,8 @@ static struct coding_system coding_categories[coding_category_max];
 
 /* Safely get one byte from the source text pointed by SRC which ends
    at SRC_END, and set C to that byte.  If there are not enough bytes
-   in the source, it jumps to `no_more_source'.  If multibytep is
-   nonzero, and a multibyte character is found at SRC, set C to the
+   in the source, it jumps to 'no_more_source'.  If MULTIBYTEP,
+   and a multibyte character is found at SRC, set C to the
    negative value of the character code.  The caller should declare
    and set these variables appropriately in advance:
        src, src_end, multibytep */
@@ -685,7 +685,7 @@ static struct coding_system coding_categories[coding_category_max];
 /* Safely get two bytes from the source text pointed by SRC which ends
    at SRC_END, and set C1 and C2 to those bytes while skipping the
    heading multibyte characters.  If there are not enough bytes in the
-   source, it jumps to `no_more_source'.  If multibytep is nonzero and
+   source, it jumps to 'no_more_source'.  If MULTIBYTEP and
    a multibyte character is found for C2, set C2 to the negative value
    of the character code.  The caller should declare and set these
    variables appropriately in advance:
@@ -746,8 +746,8 @@ static struct coding_system coding_categories[coding_category_max];
 
 
 /* Store a byte C in the place pointed by DST and increment DST to the
-   next free point, and increment PRODUCED_CHARS.  If MULTIBYTEP is
-   nonzero, store in an appropriate multibyte from.  The caller should
+   next free point, and increment PRODUCED_CHARS.  If MULTIBYTEP,
+   store in an appropriate multibyte form.  The caller should
    declare and set the variables `dst' and `multibytep' appropriately
    in advance.  */
 
@@ -806,83 +806,6 @@ static struct coding_system coding_categories[coding_category_max];
   } while (0)
 
 
-/* Prototypes for static functions.  */
-static void record_conversion_result (struct coding_system *coding,
-                                      enum coding_result_code result);
-static int detect_coding_utf_8 (struct coding_system *,
-                                struct coding_detection_info *info);
-static void decode_coding_utf_8 (struct coding_system *);
-static int encode_coding_utf_8 (struct coding_system *);
-
-static int detect_coding_utf_16 (struct coding_system *,
-                                 struct coding_detection_info *info);
-static void decode_coding_utf_16 (struct coding_system *);
-static int encode_coding_utf_16 (struct coding_system *);
-
-static int detect_coding_iso_2022 (struct coding_system *,
-                                   struct coding_detection_info *info);
-static void decode_coding_iso_2022 (struct coding_system *);
-static int encode_coding_iso_2022 (struct coding_system *);
-
-static int detect_coding_emacs_mule (struct coding_system *,
-                                     struct coding_detection_info *info);
-static void decode_coding_emacs_mule (struct coding_system *);
-static int encode_coding_emacs_mule (struct coding_system *);
-
-static int detect_coding_sjis (struct coding_system *,
-                               struct coding_detection_info *info);
-static void decode_coding_sjis (struct coding_system *);
-static int encode_coding_sjis (struct coding_system *);
-
-static int detect_coding_big5 (struct coding_system *,
-                               struct coding_detection_info *info);
-static void decode_coding_big5 (struct coding_system *);
-static int encode_coding_big5 (struct coding_system *);
-
-static int detect_coding_ccl (struct coding_system *,
-                              struct coding_detection_info *info);
-static void decode_coding_ccl (struct coding_system *);
-static int encode_coding_ccl (struct coding_system *);
-
-static void decode_coding_raw_text (struct coding_system *);
-static int encode_coding_raw_text (struct coding_system *);
-
-static void coding_set_source (struct coding_system *);
-static ptrdiff_t coding_change_source (struct coding_system *);
-static void coding_set_destination (struct coding_system *);
-static ptrdiff_t coding_change_destination (struct coding_system *);
-static void coding_alloc_by_realloc (struct coding_system *, ptrdiff_t);
-static void coding_alloc_by_making_gap (struct coding_system *,
-                                        ptrdiff_t, ptrdiff_t);
-static unsigned char *alloc_destination (struct coding_system *,
-                                         ptrdiff_t, unsigned char *);
-static void setup_iso_safe_charsets (Lisp_Object);
-static ptrdiff_t encode_designation_at_bol (struct coding_system *,
-                                     int *, int *, unsigned char *);
-static int detect_eol (const unsigned char *,
-                       ptrdiff_t, enum coding_category);
-static Lisp_Object adjust_coding_eol_type (struct coding_system *, int);
-static void decode_eol (struct coding_system *);
-static Lisp_Object get_translation_table (Lisp_Object, int, int *);
-static Lisp_Object get_translation (Lisp_Object, int *, int *);
-static int produce_chars (struct coding_system *, Lisp_Object, int);
-static inline void produce_charset (struct coding_system *, int *,
-                                    ptrdiff_t);
-static void produce_annotation (struct coding_system *, ptrdiff_t);
-static int decode_coding (struct coding_system *);
-static inline int *handle_composition_annotation (ptrdiff_t, ptrdiff_t,
-                                                  struct coding_system *,
-                                                  int *, ptrdiff_t *);
-static inline int *handle_charset_annotation (ptrdiff_t, ptrdiff_t,
-                                              struct coding_system *,
-                                              int *, ptrdiff_t *);
-static void consume_chars (struct coding_system *, Lisp_Object, int);
-static int encode_coding (struct coding_system *);
-static Lisp_Object make_conversion_work_buffer (int);
-static Lisp_Object code_conversion_restore (Lisp_Object);
-static inline int char_encodable_p (int, Lisp_Object);
-static Lisp_Object make_subsidiaries (Lisp_Object);
-
 static void
 record_conversion_result (struct coding_system *coding,
                          enum coding_result_code result)
@@ -1264,8 +1187,7 @@ alloc_destination (struct coding_system *coding, ptrdiff_t nbytes,
 /*** 3. UTF-8 ***/
 
 /* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions".
-   Check if a text is encoded in UTF-8.  If it is, return 1, else
-   return 0.  */
+   Return true if a text is encoded in UTF-8.  */
 
 #define UTF_8_1_OCTET_P(c)         ((c) < 0x80)
 #define UTF_8_EXTRA_OCTET_P(c)     (((c) & 0xC0) == 0x80)
@@ -1278,16 +1200,16 @@ alloc_destination (struct coding_system *coding, ptrdiff_t nbytes,
 #define UTF_8_BOM_2 0xBB
 #define UTF_8_BOM_3 0xBF
 
-static int
+static bool
 detect_coding_utf_8 (struct coding_system *coding,
                     struct coding_detection_info *detect_info)
 {
   const unsigned char *src = coding->source, *src_base;
   const unsigned char *src_end = coding->source + coding->src_bytes;
-  int multibytep = coding->src_multibyte;
+  bool multibytep = coding->src_multibyte;
   ptrdiff_t consumed_chars = 0;
-  int bom_found = 0;
-  int found = 0;
+  bool bom_found = 0;
+  bool found = 0;
 
   detect_info->checked |= CATEGORY_MASK_UTF_8;
   /* A coding system of this category is always ASCII compatible.  */
@@ -1371,10 +1293,10 @@ decode_coding_utf_8 (struct coding_system *coding)
   int *charbuf = coding->charbuf + coding->charbuf_used;
   int *charbuf_end = coding->charbuf + coding->charbuf_size;
   ptrdiff_t consumed_chars = 0, consumed_chars_base = 0;
-  int multibytep = coding->src_multibyte;
+  bool multibytep = coding->src_multibyte;
   enum utf_bom_type bom = CODING_UTF_8_BOM (coding);
-  int eol_dos =
-    !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
+  bool eol_dos
+    !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
   int byte_after_cr = -1;
 
   if (bom != utf_without_bom)
@@ -1513,10 +1435,10 @@ decode_coding_utf_8 (struct coding_system *coding)
 }
 
 
-static int
+static bool
 encode_coding_utf_8 (struct coding_system *coding)
 {
-  int multibytep = coding->dst_multibyte;
+  bool multibytep = coding->dst_multibyte;
   int *charbuf = coding->charbuf;
   int *charbuf_end = charbuf + coding->charbuf_used;
   unsigned char *dst = coding->destination + coding->produced;
@@ -1577,8 +1499,7 @@ encode_coding_utf_8 (struct coding_system *coding)
 
 
 /* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions".
-   Check if a text is encoded in one of UTF-16 based coding systems.
-   If it is, return 1, else return 0.  */
+   Return true if a text is encoded in one of UTF-16 based coding systems.  */
 
 #define UTF_16_HIGH_SURROGATE_P(val) \
   (((val) & 0xFC00) == 0xD800)
@@ -1587,13 +1508,13 @@ encode_coding_utf_8 (struct coding_system *coding)
   (((val) & 0xFC00) == 0xDC00)
 
 
-static int
+static bool
 detect_coding_utf_16 (struct coding_system *coding,
                      struct coding_detection_info *detect_info)
 {
   const unsigned char *src = coding->source;
   const unsigned char *src_end = coding->source + coding->src_bytes;
-  int multibytep = coding->src_multibyte;
+  bool multibytep = coding->src_multibyte;
   int c1, c2;
 
   detect_info->checked |= CATEGORY_MASK_UTF_16;
@@ -1680,12 +1601,12 @@ decode_coding_utf_16 (struct coding_system *coding)
   /* We may produces at most 3 chars in one loop.  */
   int *charbuf_end = coding->charbuf + coding->charbuf_size - 2;
   ptrdiff_t consumed_chars = 0, consumed_chars_base = 0;
-  int multibytep = coding->src_multibyte;
+  bool multibytep = coding->src_multibyte;
   enum utf_bom_type bom = CODING_UTF_16_BOM (coding);
   enum utf_16_endian_type endian = CODING_UTF_16_ENDIAN (coding);
   int surrogate = CODING_UTF_16_SURROGATE (coding);
-  int eol_dos =
-    !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
+  bool eol_dos
+    !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
   int byte_after_cr1 = -1, byte_after_cr2 = -1;
 
   if (bom == utf_with_bom)
@@ -1795,17 +1716,17 @@ decode_coding_utf_16 (struct coding_system *coding)
   coding->charbuf_used = charbuf - coding->charbuf;
 }
 
-static int
+static bool
 encode_coding_utf_16 (struct coding_system *coding)
 {
-  int multibytep = coding->dst_multibyte;
+  bool multibytep = coding->dst_multibyte;
   int *charbuf = coding->charbuf;
   int *charbuf_end = charbuf + coding->charbuf_used;
   unsigned char *dst = coding->destination + coding->produced;
   unsigned char *dst_end = coding->destination + coding->dst_bytes;
   int safe_room = 8;
   enum utf_bom_type bom = CODING_UTF_16_BOM (coding);
-  int big_endian = CODING_UTF_16_ENDIAN (coding) == utf_16_big_endian;
+  bool big_endian = CODING_UTF_16_ENDIAN (coding) == utf_16_big_endian;
   ptrdiff_t produced_chars = 0;
   int c;
 
@@ -1930,16 +1851,15 @@ char emacs_mule_bytes[256];
 
 
 /* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions".
-   Check if a text is encoded in `emacs-mule'.  If it is, return 1,
-   else return 0.  */
+   Return true if a text is encoded in 'emacs-mule'.  */
 
-static int
+static bool
 detect_coding_emacs_mule (struct coding_system *coding,
                          struct coding_detection_info *detect_info)
 {
   const unsigned char *src = coding->source, *src_base;
   const unsigned char *src_end = coding->source + coding->src_bytes;
-  int multibytep = coding->src_multibyte;
+  bool multibytep = coding->src_multibyte;
   ptrdiff_t consumed_chars = 0;
   int c;
   int found = 0;
@@ -2029,12 +1949,12 @@ emacs_mule_char (struct coding_system *coding, const unsigned char *src,
 {
   const unsigned char *src_end = coding->source + coding->src_bytes;
   const unsigned char *src_base = src;
-  int multibytep = coding->src_multibyte;
+  bool multibytep = coding->src_multibyte;
   int charset_ID;
   unsigned code;
   int c;
   int consumed_chars = 0;
-  int mseq_found = 0;
+  bool mseq_found = 0;
 
   ONE_MORE_BYTE (c);
   if (c < 0)
@@ -2411,12 +2331,12 @@ decode_coding_emacs_mule (struct coding_system *coding)
       /* We can produce up to 2 characters in a loop.  */
       - 1;
   ptrdiff_t consumed_chars = 0, consumed_chars_base;
-  int multibytep = coding->src_multibyte;
+  bool multibytep = coding->src_multibyte;
   ptrdiff_t char_offset = coding->produced_char;
   ptrdiff_t last_offset = char_offset;
   int last_id = charset_ascii;
-  int eol_dos =
-    !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
+  bool eol_dos
+    !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
   int byte_after_cr = -1;
   struct composition_status *cmp_status = &coding->spec.emacs_mule.cmp_status;
 
@@ -2657,10 +2577,10 @@ decode_coding_emacs_mule (struct coding_system *coding)
   } while (0);
 
 
-static int
+static bool
 encode_coding_emacs_mule (struct coding_system *coding)
 {
-  int multibytep = coding->dst_multibyte;
+  bool multibytep = coding->dst_multibyte;
   int *charbuf = coding->charbuf;
   int *charbuf_end = charbuf + coding->charbuf_used;
   unsigned char *dst = coding->destination + coding->produced;
@@ -2722,7 +2642,7 @@ encode_coding_emacs_mule (struct coding_system *coding)
 
          if (preferred_charset_id >= 0)
            {
-             int result;
+             bool result;
 
              charset = CHARSET_FROM_ID (preferred_charset_id);
              CODING_CHAR_CHARSET_P (coding, dst, dst_end, c, charset, result);
@@ -3017,17 +2937,17 @@ setup_iso_safe_charsets (Lisp_Object attrs)
 
 
 /* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions".
-   Check if a text is encoded in one of ISO-2022 based coding systems.
-   If it is, return 1, else return 0.  */
+   Return true if a text is encoded in one of ISO-2022 based coding
+   systems.  */
 
-static int
+static bool
 detect_coding_iso_2022 (struct coding_system *coding,
                        struct coding_detection_info *detect_info)
 {
   const unsigned char *src = coding->source, *src_base = src;
   const unsigned char *src_end = coding->source + coding->src_bytes;
-  int multibytep = coding->src_multibyte;
-  int single_shifting = 0;
+  bool multibytep = coding->src_multibyte;
+  bool single_shifting = 0;
   int id;
   int c, c1;
   ptrdiff_t consumed_chars = 0;
@@ -3390,8 +3310,6 @@ detect_coding_iso_2022 (struct coding_system *coding,
 
 /* Finish the current composition as invalid.  */
 
-static int finish_composition (int *, struct composition_status *);
-
 static int
 finish_composition (int *charbuf, struct composition_status *cmp_status)
 {
@@ -3541,7 +3459,7 @@ decode_coding_iso_2022 (struct coding_system *coding)
   int *charbuf_end
     = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 3);
   ptrdiff_t consumed_chars = 0, consumed_chars_base;
-  int multibytep = coding->src_multibyte;
+  bool multibytep = coding->src_multibyte;
   /* Charsets invoked to graphic plane 0 and 1 respectively.  */
   int charset_id_0 = CODING_ISO_INVOKED_CHARSET (coding, 0);
   int charset_id_1 = CODING_ISO_INVOKED_CHARSET (coding, 1);
@@ -3553,8 +3471,8 @@ decode_coding_iso_2022 (struct coding_system *coding)
   ptrdiff_t char_offset = coding->produced_char;
   ptrdiff_t last_offset = char_offset;
   int last_id = charset_ascii;
-  int eol_dos =
-    !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
+  bool eol_dos
+    !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
   int byte_after_cr = -1;
   int i;
 
@@ -4282,7 +4200,7 @@ encode_invocation_designation (struct charset *charset,
                               struct coding_system *coding,
                               unsigned char *dst, ptrdiff_t *p_nchars)
 {
-  int multibytep = coding->dst_multibyte;
+  bool multibytep = coding->dst_multibyte;
   ptrdiff_t produced_chars = *p_nchars;
   int reg;                     /* graphic register number */
   int id = CHARSET_ID (charset);
@@ -4380,7 +4298,7 @@ encode_designation_at_bol (struct coding_system *coding,
   int r[4];
   int c, found = 0, reg;
   ptrdiff_t produced_chars = 0;
-  int multibytep = coding->dst_multibyte;
+  bool multibytep = coding->dst_multibyte;
   Lisp_Object attrs;
   Lisp_Object charset_list;
 
@@ -4422,21 +4340,21 @@ encode_designation_at_bol (struct coding_system *coding,
 
 /* See the above "GENERAL NOTES on `encode_coding_XXX ()' functions".  */
 
-static int
+static bool
 encode_coding_iso_2022 (struct coding_system *coding)
 {
-  int multibytep = coding->dst_multibyte;
+  bool multibytep = coding->dst_multibyte;
   int *charbuf = coding->charbuf;
   int *charbuf_end = charbuf + coding->charbuf_used;
   unsigned char *dst = coding->destination + coding->produced;
   unsigned char *dst_end = coding->destination + coding->dst_bytes;
   int safe_room = 16;
-  int bol_designation
+  bool bol_designation
     = (CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_DESIGNATE_AT_BOL
        && CODING_ISO_BOL (coding));
   ptrdiff_t produced_chars = 0;
   Lisp_Object attrs, eol_type, charset_list;
-  int ascii_compatible;
+  bool ascii_compatible;
   int c;
   int preferred_charset_id = -1;
 
@@ -4523,8 +4441,9 @@ encode_coding_iso_2022 (struct coding_system *coding)
                    CODING_ISO_DESIGNATION (coding, i)
                      = CODING_ISO_INITIAL (coding, i);
                }
-             bol_designation
-               = CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_DESIGNATE_AT_BOL;
+             bol_designation = ((CODING_ISO_FLAGS (coding)
+                                 & CODING_ISO_FLAG_DESIGNATE_AT_BOL)
+                                != 0);
            }
          else if (CODING_ISO_FLAGS (coding) & CODING_ISO_FLAG_RESET_AT_CNTL)
            ENCODE_RESET_PLANE_AND_REGISTER ();
@@ -4551,7 +4470,7 @@ encode_coding_iso_2022 (struct coding_system *coding)
 
          if (preferred_charset_id >= 0)
            {
-             int result;
+             bool result;
 
              charset = CHARSET_FROM_ID (preferred_charset_id);
              CODING_CHAR_CHARSET_P (coding, dst, dst_end, c, charset, result);
@@ -4631,16 +4550,15 @@ encode_coding_iso_2022 (struct coding_system *coding)
   */
 
 /* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions".
-   Check if a text is encoded in SJIS.  If it is, return
-   CATEGORY_MASK_SJIS, else return 0.  */
+   Return true if a text is encoded in SJIS.  */
 
-static int
+static bool
 detect_coding_sjis (struct coding_system *coding,
                    struct coding_detection_info *detect_info)
 {
   const unsigned char *src = coding->source, *src_base;
   const unsigned char *src_end = coding->source + coding->src_bytes;
-  int multibytep = coding->src_multibyte;
+  bool multibytep = coding->src_multibyte;
   ptrdiff_t consumed_chars = 0;
   int found = 0;
   int c;
@@ -4688,16 +4606,15 @@ detect_coding_sjis (struct coding_system *coding,
 }
 
 /* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions".
-   Check if a text is encoded in BIG5.  If it is, return
-   CATEGORY_MASK_BIG5, else return 0.  */
+   Return true if a text is encoded in BIG5.  */
 
-static int
+static bool
 detect_coding_big5 (struct coding_system *coding,
                    struct coding_detection_info *detect_info)
 {
   const unsigned char *src = coding->source, *src_base;
   const unsigned char *src_end = coding->source + coding->src_bytes;
-  int multibytep = coding->src_multibyte;
+  bool multibytep = coding->src_multibyte;
   ptrdiff_t consumed_chars = 0;
   int found = 0;
   int c;
@@ -4735,8 +4652,7 @@ detect_coding_big5 (struct coding_system *coding,
   return 1;
 }
 
-/* See the above "GENERAL NOTES on `decode_coding_XXX ()' functions".
-   If SJIS_P is 1, decode SJIS text, else decode BIG5 test.  */
+/* See the above "GENERAL NOTES on `decode_coding_XXX ()' functions".  */
 
 static void
 decode_coding_sjis (struct coding_system *coding)
@@ -4750,15 +4666,15 @@ decode_coding_sjis (struct coding_system *coding)
   int *charbuf_end
     = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 2);
   ptrdiff_t consumed_chars = 0, consumed_chars_base;
-  int multibytep = coding->src_multibyte;
+  bool multibytep = coding->src_multibyte;
   struct charset *charset_roman, *charset_kanji, *charset_kana;
   struct charset *charset_kanji2;
   Lisp_Object attrs, charset_list, val;
   ptrdiff_t char_offset = coding->produced_char;
   ptrdiff_t last_offset = char_offset;
   int last_id = charset_ascii;
-  int eol_dos =
-    !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
+  bool eol_dos
+    !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
   int byte_after_cr = -1;
 
   CODING_GET_INFO (coding, attrs, charset_list);
@@ -4868,14 +4784,14 @@ decode_coding_big5 (struct coding_system *coding)
   int *charbuf_end
     = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 2);
   ptrdiff_t consumed_chars = 0, consumed_chars_base;
-  int multibytep = coding->src_multibyte;
+  bool multibytep = coding->src_multibyte;
   struct charset *charset_roman, *charset_big5;
   Lisp_Object attrs, charset_list, val;
   ptrdiff_t char_offset = coding->produced_char;
   ptrdiff_t last_offset = char_offset;
   int last_id = charset_ascii;
-  int eol_dos =
-    !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
+  bool eol_dos
+    !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
   int byte_after_cr = -1;
 
   CODING_GET_INFO (coding, attrs, charset_list);
@@ -4957,13 +4873,12 @@ decode_coding_big5 (struct coding_system *coding)
    `japanese-jisx0208', `chinese-big5-1', and `chinese-big5-2'.  We
    are sure that all these charsets are registered as official charset
    (i.e. do not have extended leading-codes).  Characters of other
-   charsets are produced without any encoding.  If SJIS_P is 1, encode
-   SJIS text, else encode BIG5 text.  */
+   charsets are produced without any encoding.  */
 
-static int
+static bool
 encode_coding_sjis (struct coding_system *coding)
 {
-  int multibytep = coding->dst_multibyte;
+  bool multibytep = coding->dst_multibyte;
   int *charbuf = coding->charbuf;
   int *charbuf_end = charbuf + coding->charbuf_used;
   unsigned char *dst = coding->destination + coding->produced;
@@ -4971,7 +4886,7 @@ encode_coding_sjis (struct coding_system *coding)
   int safe_room = 4;
   ptrdiff_t produced_chars = 0;
   Lisp_Object attrs, charset_list, val;
-  int ascii_compatible;
+  bool ascii_compatible;
   struct charset *charset_kanji, *charset_kana;
   struct charset *charset_kanji2;
   int c;
@@ -5054,10 +4969,10 @@ encode_coding_sjis (struct coding_system *coding)
   return 0;
 }
 
-static int
+static bool
 encode_coding_big5 (struct coding_system *coding)
 {
-  int multibytep = coding->dst_multibyte;
+  bool multibytep = coding->dst_multibyte;
   int *charbuf = coding->charbuf;
   int *charbuf_end = charbuf + coding->charbuf_used;
   unsigned char *dst = coding->destination + coding->produced;
@@ -5065,7 +4980,7 @@ encode_coding_big5 (struct coding_system *coding)
   int safe_room = 4;
   ptrdiff_t produced_chars = 0;
   Lisp_Object attrs, charset_list, val;
-  int ascii_compatible;
+  bool ascii_compatible;
   struct charset *charset_big5;
   int c;
 
@@ -5130,17 +5045,16 @@ encode_coding_big5 (struct coding_system *coding)
 /*** 10. CCL handlers ***/
 
 /* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions".
-   Check if a text is encoded in a coding system of which
-   encoder/decoder are written in CCL program.  If it is, return
-   CATEGORY_MASK_CCL, else return 0.  */
+   Return true if a text is encoded in a coding system of which
+   encoder/decoder are written in CCL program.  */
 
-static int
+static bool
 detect_coding_ccl (struct coding_system *coding,
                   struct coding_detection_info *detect_info)
 {
   const unsigned char *src = coding->source, *src_base;
   const unsigned char *src_end = coding->source + coding->src_bytes;
-  int multibytep = coding->src_multibyte;
+  bool multibytep = coding->src_multibyte;
   ptrdiff_t consumed_chars = 0;
   int found = 0;
   unsigned char *valids;
@@ -5182,7 +5096,7 @@ decode_coding_ccl (struct coding_system *coding)
   int *charbuf = coding->charbuf + coding->charbuf_used;
   int *charbuf_end = coding->charbuf + coding->charbuf_size;
   ptrdiff_t consumed_chars = 0;
-  int multibytep = coding->src_multibyte;
+  bool multibytep = coding->src_multibyte;
   struct ccl_program *ccl = &coding->spec.ccl->ccl;
   int source_charbuf[1024];
   int source_byteidx[1025];
@@ -5243,11 +5157,11 @@ decode_coding_ccl (struct coding_system *coding)
   coding->charbuf_used = charbuf - coding->charbuf;
 }
 
-static int
+static bool
 encode_coding_ccl (struct coding_system *coding)
 {
   struct ccl_program *ccl = &coding->spec.ccl->ccl;
-  int multibytep = coding->dst_multibyte;
+  bool multibytep = coding->dst_multibyte;
   int *charbuf = coding->charbuf;
   int *charbuf_end = charbuf + coding->charbuf_used;
   unsigned char *dst = coding->destination + coding->produced;
@@ -5308,7 +5222,6 @@ encode_coding_ccl (struct coding_system *coding)
   return 0;
 }
 
-
 \f
 /*** 10, 11. no-conversion handlers ***/
 
@@ -5317,8 +5230,8 @@ encode_coding_ccl (struct coding_system *coding)
 static void
 decode_coding_raw_text (struct coding_system *coding)
 {
-  int eol_dos =
-    !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
+  bool eol_dos
+    !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
 
   coding->chars_at_source = 1;
   coding->consumed_char = coding->src_chars;
@@ -5333,10 +5246,10 @@ decode_coding_raw_text (struct coding_system *coding)
     record_conversion_result (coding, CODING_RESULT_SUCCESS);
 }
 
-static int
+static bool
 encode_coding_raw_text (struct coding_system *coding)
 {
-  int multibytep = coding->dst_multibyte;
+  bool multibytep = coding->dst_multibyte;
   int *charbuf = coding->charbuf;
   int *charbuf_end = coding->charbuf + coding->charbuf_used;
   unsigned char *dst = coding->destination + coding->produced;
@@ -5414,21 +5327,20 @@ encode_coding_raw_text (struct coding_system *coding)
 }
 
 /* See the above "GENERAL NOTES on `detect_coding_XXX ()' functions".
-   Check if a text is encoded in a charset-based coding system.  If it
-   is, return 1, else return 0.  */
+   Return true if a text is encoded in a charset-based coding system.  */
 
-static int
+static bool
 detect_coding_charset (struct coding_system *coding,
                       struct coding_detection_info *detect_info)
 {
   const unsigned char *src = coding->source, *src_base;
   const unsigned char *src_end = coding->source + coding->src_bytes;
-  int multibytep = coding->src_multibyte;
+  bool multibytep = coding->src_multibyte;
   ptrdiff_t consumed_chars = 0;
   Lisp_Object attrs, valids, name;
   int found = 0;
   ptrdiff_t head_ascii = coding->head_ascii;
-  int check_latin_extra = 0;
+  bool check_latin_extra = 0;
 
   detect_info->checked |= CATEGORY_MASK_CHARSET;
 
@@ -5532,14 +5444,14 @@ decode_coding_charset (struct coding_system *coding)
   int *charbuf_end
     = coding->charbuf + coding->charbuf_size - (MAX_ANNOTATION_LENGTH * 2);
   ptrdiff_t consumed_chars = 0, consumed_chars_base;
-  int multibytep = coding->src_multibyte;
+  bool multibytep = coding->src_multibyte;
   Lisp_Object attrs = CODING_ID_ATTRS (coding->id);
   Lisp_Object valids;
   ptrdiff_t char_offset = coding->produced_char;
   ptrdiff_t last_offset = char_offset;
   int last_id = charset_ascii;
-  int eol_dos =
-    !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
+  bool eol_dos
+    !inhibit_eol_conversion && EQ (CODING_ID_EOL_TYPE (coding->id), Qdos);
   int byte_after_cr = -1;
 
   valids = AREF (attrs, coding_attr_charset_valids);
@@ -5648,10 +5560,10 @@ decode_coding_charset (struct coding_system *coding)
   coding->charbuf_used = charbuf - coding->charbuf;
 }
 
-static int
+static bool
 encode_coding_charset (struct coding_system *coding)
 {
-  int multibytep = coding->dst_multibyte;
+  bool multibytep = coding->dst_multibyte;
   int *charbuf = coding->charbuf;
   int *charbuf_end = charbuf + coding->charbuf_used;
   unsigned char *dst = coding->destination + coding->produced;
@@ -5659,7 +5571,7 @@ encode_coding_charset (struct coding_system *coding)
   int safe_room = MAX_MULTIBYTE_LENGTH;
   ptrdiff_t produced_chars = 0;
   Lisp_Object attrs, charset_list;
-  int ascii_compatible;
+  bool ascii_compatible;
   int c;
 
   CODING_GET_INFO (coding, attrs, charset_list);
@@ -5865,7 +5777,6 @@ setup_coding_system (Lisp_Object coding_system, struct coding_system *coding)
       coding->encoder = encode_coding_emacs_mule;
       coding->common_flags
        |= (CODING_REQUIRE_DECODING_MASK | CODING_REQUIRE_ENCODING_MASK);
-      coding->spec.emacs_mule.full_support = 1;
       if (! NILP (AREF (attrs, coding_attr_emacs_mule_full))
          && ! EQ (CODING_ATTR_CHARSET_LIST (attrs), Vemacs_mule_charset_list))
        {
@@ -5883,7 +5794,6 @@ setup_coding_system (Lisp_Object coding_system, struct coding_system *coding)
            SSET (safe_charsets, XFASTINT (XCAR (tail)), 0);
          coding->max_charset_id = max_charset_id;
          coding->safe_charsets = SDATA (safe_charsets);
-         coding->spec.emacs_mule.full_support = 1;
        }
       coding->spec.emacs_mule.cmp_status.state = COMPOSING_NO;
       coding->spec.emacs_mule.cmp_status.method = COMPOSITION_NO;
@@ -6216,11 +6126,9 @@ detect_eol (const unsigned char *source, ptrdiff_t src_bytes,
 
   if ((1 << category) & CATEGORY_MASK_UTF_16)
     {
-      int msb, lsb;
-
-      msb = category == (coding_category_utf_16_le
-                        | coding_category_utf_16_le_nosig);
-      lsb = 1 - msb;
+      bool msb = category == (coding_category_utf_16_le
+                             | coding_category_utf_16_le_nosig);
+      bool lsb = !msb;
 
       while (src + 1 < src_end)
        {
@@ -6335,7 +6243,7 @@ static void
 detect_coding (struct coding_system *coding)
 {
   const unsigned char *src, *src_end;
-  int saved_mode = coding->mode;
+  unsigned int saved_mode = coding->mode;
 
   coding->consumed = coding->consumed_char = 0;
   coding->produced = coding->produced_char = 0;
@@ -6350,7 +6258,7 @@ detect_coding (struct coding_system *coding)
     {
       int c, i;
       struct coding_detection_info detect_info;
-      int null_byte_found = 0, eight_bit_found = 0;
+      bool null_byte_found = 0, eight_bit_found = 0;
 
       detect_info.checked = detect_info.found = detect_info.rejected = 0;
       for (src = coding->source; src < src_end; src++)
@@ -6609,11 +6517,11 @@ decode_eol (struct coding_system *coding)
 
 
 /* Return a translation table (or list of them) from coding system
-   attribute vector ATTRS for encoding (ENCODEP is nonzero) or
-   decoding (ENCODEP is zero). */
+   attribute vector ATTRS for encoding (if ENCODEP) or decoding (if
+   not ENCODEP). */
 
 static Lisp_Object
-get_translation_table (Lisp_Object attrs, int encodep, int *max_lookup)
+get_translation_table (Lisp_Object attrs, bool encodep, int *max_lookup)
 {
   Lisp_Object standard, translation_table;
   Lisp_Object val;
@@ -6743,7 +6651,7 @@ get_translation (Lisp_Object trans, int *buf, int *buf_end)
 
 static int
 produce_chars (struct coding_system *coding, Lisp_Object translation_table,
-              int last_block)
+              bool last_block)
 {
   unsigned char *dst = coding->destination + coding->produced;
   unsigned char *dst_end = coding->destination + coding->dst_bytes;
@@ -6846,7 +6754,7 @@ produce_chars (struct coding_system *coding, Lisp_Object translation_table,
        {
          if (coding->src_multibyte)
            {
-             int multibytep = 1;
+             bool multibytep = 1;
              ptrdiff_t consumed_chars = 0;
 
              while (1)
@@ -6882,7 +6790,7 @@ produce_chars (struct coding_system *coding, Lisp_Object translation_table,
          else
            while (src < src_end)
              {
-               int multibytep = 1;
+               bool multibytep = 1;
                int c = *src++;
 
                if (dst >= dst_end - 1)
@@ -7018,7 +6926,7 @@ produce_charset (struct coding_system *coding, int *charbuf, ptrdiff_t pos)
     if (! coding->charbuf)                                             \
       {                                                                        \
        record_conversion_result (coding, CODING_RESULT_INSUFFICIENT_MEM); \
-       return coding->result;                                          \
+       return;                                                         \
       }                                                                        \
     coding->charbuf_size = size;                                       \
   } while (0)
@@ -7079,7 +6987,7 @@ produce_annotation (struct coding_system *coding, ptrdiff_t pos)
    CODING->dst_object.
 */
 
-static int
+static void
 decode_coding (struct coding_system *coding)
 {
   Lisp_Object attrs;
@@ -7098,8 +7006,7 @@ decode_coding (struct coding_system *coding)
   undo_list = Qt;
   if (BUFFERP (coding->dst_object))
     {
-      if (current_buffer != XBUFFER (coding->dst_object))
-       set_buffer_internal (XBUFFER (coding->dst_object));
+      set_buffer_internal (XBUFFER (coding->dst_object));
       if (GPT != PT)
        move_gap_both (PT, PT_BYTE);
 
@@ -7212,7 +7119,6 @@ decode_coding (struct coding_system *coding)
       bset_undo_list (current_buffer, undo_list);
       record_insert (coding->dst_pos, coding->produced_char);
     }
-  return coding->result;
 }
 
 
@@ -7341,7 +7247,7 @@ consume_chars (struct coding_system *coding, Lisp_Object translation_table,
   const unsigned char *src_end = coding->source + coding->src_bytes;
   ptrdiff_t pos = coding->src_pos + coding->consumed_char;
   ptrdiff_t end_pos = coding->src_pos + coding->src_chars;
-  int multibytep = coding->src_multibyte;
+  bool multibytep = coding->src_multibyte;
   Lisp_Object eol_type;
   int c;
   ptrdiff_t stop, stop_composition, stop_charset;
@@ -7488,7 +7394,7 @@ consume_chars (struct coding_system *coding, Lisp_Object translation_table,
    If CODING->dst_object is nil, the encoded data is placed at the
    memory area specified by CODING->destination.  */
 
-static int
+static void
 encode_coding (struct coding_system *coding)
 {
   Lisp_Object attrs;
@@ -7530,8 +7436,6 @@ encode_coding (struct coding_system *coding)
 
   if (BUFFERP (coding->dst_object) && coding->produced_char > 0)
     insert_from_gap (coding->produced_char, coding->produced);
-
-  return (coding->result);
 }
 
 
@@ -7545,26 +7449,27 @@ static Lisp_Object Vcode_conversion_workbuf_name;
    versions of Vcode_conversion_workbuf_name.  */
 static Lisp_Object Vcode_conversion_reused_workbuf;
 
-/* 1 iff Vcode_conversion_reused_workbuf is already in use.  */
-static int reused_workbuf_in_use;
+/* True iff Vcode_conversion_reused_workbuf is already in use.  */
+static bool reused_workbuf_in_use;
 
 
 /* Return a working buffer of code conversion.  MULTIBYTE specifies the
    multibyteness of returning buffer.  */
 
 static Lisp_Object
-make_conversion_work_buffer (int multibyte)
+make_conversion_work_buffer (bool multibyte)
 {
   Lisp_Object name, workbuf;
   struct buffer *current;
 
-  if (reused_workbuf_in_use++)
+  if (reused_workbuf_in_use)
     {
       name = Fgenerate_new_buffer_name (Vcode_conversion_workbuf_name, Qnil);
       workbuf = Fget_buffer_create (name);
     }
   else
     {
+      reused_workbuf_in_use = 1;
       if (NILP (Fbuffer_live_p (Vcode_conversion_reused_workbuf)))
        Vcode_conversion_reused_workbuf
          = Fget_buffer_create (Vcode_conversion_workbuf_name);
@@ -7606,7 +7511,7 @@ code_conversion_restore (Lisp_Object arg)
 }
 
 Lisp_Object
-code_conversion_save (int with_work_buf, int multibyte)
+code_conversion_save (bool with_work_buf, bool multibyte)
 {
   Lisp_Object workbuf = Qnil;
 
@@ -7617,7 +7522,7 @@ code_conversion_save (int with_work_buf, int multibyte)
   return workbuf;
 }
 
-int
+void
 decode_coding_gap (struct coding_system *coding,
                   ptrdiff_t chars, ptrdiff_t bytes)
 {
@@ -7660,7 +7565,6 @@ decode_coding_gap (struct coding_system *coding,
     }
 
   unbind_to (count, Qnil);
-  return coding->result;
 }
 
 
@@ -7706,8 +7610,8 @@ decode_coding_object (struct coding_system *coding,
   ptrdiff_t chars = to - from;
   ptrdiff_t bytes = to_byte - from_byte;
   Lisp_Object attrs;
-  int saved_pt = -1, saved_pt_byte IF_LINT (= 0);
-  int need_marker_adjustment = 0;
+  ptrdiff_t saved_pt = -1, saved_pt_byte IF_LINT (= 0);
+  bool need_marker_adjustment = 0;
   Lisp_Object old_deactivate_mark;
 
   old_deactivate_mark = Vdeactivate_mark;
@@ -7894,9 +7798,9 @@ encode_coding_object (struct coding_system *coding,
   ptrdiff_t chars = to - from;
   ptrdiff_t bytes = to_byte - from_byte;
   Lisp_Object attrs;
-  int saved_pt = -1, saved_pt_byte IF_LINT (= 0);
-  int need_marker_adjustment = 0;
-  int kill_src_buffer = 0;
+  ptrdiff_t saved_pt = -1, saved_pt_byte IF_LINT (= 0);
+  bool need_marker_adjustment = 0;
+  bool kill_src_buffer = 0;
   Lisp_Object old_deactivate_mark;
 
   old_deactivate_mark = Vdeactivate_mark;
@@ -8172,10 +8076,10 @@ function `define-coding-system'.  */)
 
 \f
 /* Detect how the bytes at SRC of length SRC_BYTES are encoded.  If
-   HIGHEST is nonzero, return the coding system of the highest
+   HIGHEST, return the coding system of the highest
    priority among the detected coding systems.  Otherwise return a
    list of detected coding systems sorted by their priorities.  If
-   MULTIBYTEP is nonzero, it is assumed that the bytes are in correct
+   MULTIBYTEP, it is assumed that the bytes are in correct
    multibyte form but contains only ASCII and eight-bit chars.
    Otherwise, the bytes are raw bytes.
 
@@ -8190,7 +8094,7 @@ function `define-coding-system'.  */)
 Lisp_Object
 detect_coding_system (const unsigned char *src,
                      ptrdiff_t src_chars, ptrdiff_t src_bytes,
-                     int highest, int multibytep,
+                     bool highest, bool multibytep,
                      Lisp_Object coding_system)
 {
   const unsigned char *src_end = src + src_bytes;
@@ -8200,7 +8104,7 @@ detect_coding_system (const unsigned char *src,
   ptrdiff_t id;
   struct coding_detection_info detect_info;
   enum coding_category base_category;
-  int null_byte_found = 0, eight_bit_found = 0;
+  bool null_byte_found = 0, eight_bit_found = 0;
 
   if (NILP (coding_system))
     coding_system = Qundecided;
@@ -8556,7 +8460,7 @@ highest priority.  */)
 }
 
 
-static inline int
+static inline bool
 char_encodable_p (int c, Lisp_Object attrs)
 {
   Lisp_Object tail;
@@ -8728,7 +8632,7 @@ to the string.  */)
   Lisp_Object positions;
   ptrdiff_t from, to;
   const unsigned char *p, *stop, *pend;
-  int ascii_compatible;
+  bool ascii_compatible;
 
   setup_coding_system (Fcheck_coding_system (coding_system), &coding);
   attrs = CODING_ID_ATTRS (coding.id);
@@ -8952,7 +8856,7 @@ is nil.  */)
 static Lisp_Object
 code_convert_region (Lisp_Object start, Lisp_Object end,
                     Lisp_Object coding_system, Lisp_Object dst_object,
-                    int encodep, int norecord)
+                    bool encodep, bool norecord)
 {
   struct coding_system coding;
   ptrdiff_t from, from_byte, to, to_byte;
@@ -9040,7 +8944,8 @@ not fully specified.)  */)
 
 Lisp_Object
 code_convert_string (Lisp_Object string, Lisp_Object coding_system,
-                    Lisp_Object dst_object, int encodep, int nocopy, int norecord)
+                    Lisp_Object dst_object, bool encodep, bool nocopy,
+                    bool norecord)
 {
   struct coding_system coding;
   ptrdiff_t chars, bytes;
@@ -9088,7 +8993,7 @@ code_convert_string (Lisp_Object string, Lisp_Object coding_system,
 
 Lisp_Object
 code_convert_string_norecord (Lisp_Object string, Lisp_Object coding_system,
-                             int encodep)
+                             bool encodep)
 {
   return code_convert_string (string, coding_system, Qt, encodep, 0, 1);
 }
@@ -9489,7 +9394,7 @@ usage: (set-coding-system-priority &rest coding-systems)  */)
   (ptrdiff_t nargs, Lisp_Object *args)
 {
   ptrdiff_t i, j;
-  int changed[coding_category_max];
+  bool changed[coding_category_max];
   enum coding_category priorities[coding_category_max];
 
   memset (changed, 0, sizeof changed);
index 2987f19607bbc3968a526e90421f2a05fe730dd3..c45d2ef86e275b3107e2bfe24de4ce200c71bde7 100644 (file)
@@ -321,7 +321,7 @@ struct composition_status
 {
   enum composition_state state;
   enum composition_method method;
-  int old_form;                  /* 0:pre-21 form, 1:post-21 form */
+  bool old_form;         /* true if pre-21 form */
   int length;            /* number of elements produced in charbuf */
   int nchars;            /* number of characters composed */
   int ncomps;            /* number of composition components */
@@ -350,18 +350,18 @@ struct iso_2022_spec
      there was an invalid designation previously.  */
   int current_designation[4];
 
-  /* Set to 1 temporarily only when graphic register 2 or 3 is invoked
-     by single-shift while encoding.  */
-  int single_shifting;
-
-  /* Set to 1 temporarily only when processing at beginning of line.  */
-  int bol;
-
   /* If positive, we are now scanning CTEXT extended segment.  */
   int ctext_extended_segment_len;
 
-  /* If nonzero, we are now scanning embedded UTF-8 sequence.  */
-  int embedded_utf_8;
+  /* True temporarily only when graphic register 2 or 3 is invoked by
+     single-shift while encoding.  */
+  unsigned single_shifting : 1;
+
+  /* True temporarily only when processing at beginning of line.  */
+  unsigned bol : 1;
+
+  /* If true, we are now scanning embedded UTF-8 sequence.  */
+  unsigned embedded_utf_8 : 1;
 
   /* The current composition.  */
   struct composition_status cmp_status;
@@ -369,7 +369,6 @@ struct iso_2022_spec
 
 struct emacs_mule_spec
 {
-  int full_support;
   struct composition_status cmp_status;
 };
 
@@ -470,10 +469,6 @@ struct coding_system
   Lisp_Object dst_object;
   unsigned char *destination;
 
-  /* Set to 1 if the source of conversion is not in the member
-     `charbuf', but at `src_object'.  */
-  int chars_at_source;
-
   /* If an element is non-negative, it is a character code.
 
      If it is in the range -128..-1, it is a 8-bit character code
@@ -489,18 +484,21 @@ struct coding_system
   int *charbuf;
   int charbuf_size, charbuf_used;
 
+  /* True if the source of conversion is not in the member
+     `charbuf', but at `src_object'.  */
+  unsigned chars_at_source : 1;
+
   /* Set to 1 if charbuf contains an annotation.  */
-  int annotated;
+  unsigned annotated : 1;
 
   unsigned char carryover[64];
   int carryover_bytes;
 
   int default_char;
 
-  int (*detector) (struct coding_system *,
-                   struct coding_detection_info *);
+  bool (*detector) (struct coding_system *, struct coding_detection_info *);
   void (*decoder) (struct coding_system *);
-  int (*encoder) (struct coding_system *);
+  bool (*encoder) (struct coding_system *);
 };
 
 /* Meanings of bits in the member `common_flags' of the structure
@@ -688,22 +686,20 @@ struct coding_system
 #define ENCODE_UTF_8(str) code_convert_string_norecord (str, Qutf_8, 1)
 
 /* Extern declarations.  */
-extern Lisp_Object code_conversion_save (int, int);
-extern int decoding_buffer_size (struct coding_system *, int);
-extern int encoding_buffer_size (struct coding_system *, int);
+extern Lisp_Object code_conversion_save (bool, bool);
 extern void setup_coding_system (Lisp_Object, struct coding_system *);
 extern Lisp_Object coding_charset_list (struct coding_system *);
 extern Lisp_Object coding_system_charset_list (Lisp_Object);
 extern Lisp_Object code_convert_string (Lisp_Object, Lisp_Object,
-                                        Lisp_Object, int, int, int);
+                                        Lisp_Object, bool, bool, bool);
 extern Lisp_Object code_convert_string_norecord (Lisp_Object, Lisp_Object,
-                                                 int);
+                                                 bool);
 extern Lisp_Object raw_text_coding_system (Lisp_Object);
 extern Lisp_Object coding_inherit_eol_type (Lisp_Object, Lisp_Object);
 extern Lisp_Object complement_process_encoding_system (Lisp_Object);
 
-extern int decode_coding_gap (struct coding_system *,
-                              ptrdiff_t, ptrdiff_t);
+extern void decode_coding_gap (struct coding_system *,
+                              ptrdiff_t, ptrdiff_t);
 extern void decode_coding_object (struct coding_system *,
                                   Lisp_Object, ptrdiff_t, ptrdiff_t,
                                   ptrdiff_t, ptrdiff_t, Lisp_Object);
@@ -778,6 +774,5 @@ extern struct coding_system safe_terminal_coding;
 extern Lisp_Object Qcoding_system_error;
 
 extern char emacs_mule_bytes[256];
-extern int emacs_mule_string_char (unsigned char *);
 
 #endif /* EMACS_CODING_H */
index 4e90e9bb91497d6875e6d6c1a9cb80e2d9ef6eda..eddabb66d336c2f7649e57af0bc30eff5f6f2243 100644 (file)
@@ -428,7 +428,7 @@ get_composition_id (ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t nchars,
 
    This doesn't check the validity of composition.  */
 
-int
+bool
 find_composition (ptrdiff_t pos, ptrdiff_t limit,
                  ptrdiff_t *start, ptrdiff_t *end,
                  Lisp_Object *prop, Lisp_Object object)
@@ -709,7 +709,7 @@ static Lisp_Object fill_gstring_header (Lisp_Object, Lisp_Object,
                                         Lisp_Object, Lisp_Object,
                                         Lisp_Object);
 
-int
+bool
 composition_gstring_p (Lisp_Object gstring)
 {
   Lisp_Object header;
@@ -1212,11 +1212,13 @@ composition_compute_stop_pos (struct composition_it *cmp_it, ptrdiff_t charpos,
    string.  In that case, FACE must not be NULL.
 
    If the character is composed, setup members of CMP_IT (id, nglyphs,
-   from, to, reversed_p), and return 1.  Otherwise, update
-   CMP_IT->stop_pos, and return 0.  */
+   from, to, reversed_p), and return true.  Otherwise, update
+   CMP_IT->stop_pos, and return false.  */
 
-int
-composition_reseat_it (struct composition_it *cmp_it, ptrdiff_t charpos, ptrdiff_t bytepos, ptrdiff_t endpos, struct window *w, struct face *face, Lisp_Object string)
+bool
+composition_reseat_it (struct composition_it *cmp_it, ptrdiff_t charpos,
+                      ptrdiff_t bytepos, ptrdiff_t endpos, struct window *w,
+                      struct face *face, Lisp_Object string)
 {
   if (endpos < 0)
     endpos = NILP (string) ? BEGV : 0;
@@ -1482,10 +1484,10 @@ struct position_record
 /* This is like find_composition, but find an automatic composition
    instead.  It is assured that POS is not within a static
    composition.  If found, set *GSTRING to the glyph-string
-   representing the composition, and return 1.  Otherwise, *GSTRING to
-   Qnil, and return 0.  */
+   representing the composition, and return true.  Otherwise, *GSTRING to
+   Qnil, and return false.  */
 
-static int
+static bool
 find_automatic_composition (ptrdiff_t pos, ptrdiff_t limit,
                            ptrdiff_t *start, ptrdiff_t *end,
                            Lisp_Object *gstring, Lisp_Object string)
@@ -1498,7 +1500,7 @@ find_automatic_composition (ptrdiff_t pos, ptrdiff_t limit,
   int c;
   Lisp_Object window;
   struct window *w;
-  int need_adjustment = 0;
+  bool need_adjustment = 0;
 
   window = Fget_buffer_window (Fcurrent_buffer (), Qnil);
   if (NILP (window))
index 6a7e0a5e2c7ab4d91a4d4716cc81f11813a05e89..68f5b27ee42b6951c3123fd43e7e34e2100d2348 100644 (file)
@@ -223,8 +223,8 @@ extern Lisp_Object Qcomposition;
 extern Lisp_Object composition_hash_table;
 extern ptrdiff_t get_composition_id (ptrdiff_t, ptrdiff_t, ptrdiff_t,
                                     Lisp_Object, Lisp_Object);
-extern int find_composition (ptrdiff_t, ptrdiff_t, ptrdiff_t *, ptrdiff_t *,
-                            Lisp_Object *, Lisp_Object);
+extern bool find_composition (ptrdiff_t, ptrdiff_t, ptrdiff_t *, ptrdiff_t *,
+                             Lisp_Object *, Lisp_Object);
 extern void update_compositions (ptrdiff_t, ptrdiff_t, int);
 extern void make_composition_value_copy (Lisp_Object);
 extern void compose_region (int, int, Lisp_Object, Lisp_Object,
@@ -310,17 +310,16 @@ struct font_metrics;
 
 extern Lisp_Object composition_gstring_put_cache (Lisp_Object, ptrdiff_t);
 extern Lisp_Object composition_gstring_from_id (ptrdiff_t);
-extern int composition_gstring_p (Lisp_Object);
+extern bool composition_gstring_p (Lisp_Object);
 extern int composition_gstring_width (Lisp_Object, ptrdiff_t, ptrdiff_t,
                                       struct font_metrics *);
 
 extern void composition_compute_stop_pos (struct composition_it *,
                                           ptrdiff_t, ptrdiff_t, ptrdiff_t,
                                           Lisp_Object);
-extern int composition_reseat_it (struct composition_it *,
-                                  ptrdiff_t, ptrdiff_t, ptrdiff_t,
-                                  struct window *, struct face *,
-                                  Lisp_Object);
+extern bool composition_reseat_it (struct composition_it *, ptrdiff_t,
+                                  ptrdiff_t, ptrdiff_t, struct window *,
+                                  struct face *, Lisp_Object);
 extern int composition_update_it (struct composition_it *,
                                   ptrdiff_t, ptrdiff_t, Lisp_Object);
 
index f812c280b402746592726ac3c8938628b197f1fe..d8b7f42ea3fd2b0868b7baf1f1ef34316366e3c2 100644 (file)
@@ -83,8 +83,8 @@ Lisp_Object Qoverflow_error, Qunderflow_error;
 Lisp_Object Qfloatp;
 Lisp_Object Qnumberp, Qnumber_or_marker_p;
 
-Lisp_Object Qinteger, Qinterval, Qfloat, Qvector;
-Lisp_Object Qsymbol, Qstring, Qcons, Qmisc;
+Lisp_Object Qinteger, Qsymbol;
+static Lisp_Object Qcons, Qfloat, Qmisc, Qstring, Qvector;
 Lisp_Object Qwindow;
 static Lisp_Object Qoverlay, Qwindow_configuration;
 static Lisp_Object Qprocess, Qmarker;
@@ -1080,10 +1080,10 @@ DEFUN ("set", Fset, Sset, 2, 2, 0,
   return newval;
 }
 
-/* Return 1 if SYMBOL currently has a let-binding
+/* Return true if SYMBOL currently has a let-binding
    which was made in the buffer that is now current.  */
 
-static int
+static bool
 let_shadows_buffer_binding_p (struct Lisp_Symbol *symbol)
 {
   struct specbinding *p;
@@ -1102,7 +1102,7 @@ let_shadows_buffer_binding_p (struct Lisp_Symbol *symbol)
   return 0;
 }
 
-static int
+static bool
 let_shadows_global_binding_p (Lisp_Object symbol)
 {
   struct specbinding *p;
@@ -1118,14 +1118,15 @@ let_shadows_global_binding_p (Lisp_Object symbol)
    If buffer/frame-locality is an issue, WHERE specifies which context to use.
    (nil stands for the current buffer/frame).
 
-   If BINDFLAG is zero, then if this symbol is supposed to become
+   If BINDFLAG is false, then if this symbol is supposed to become
    local in every buffer where it is set, then we make it local.
-   If BINDFLAG is nonzero, we don't do that.  */
+   If BINDFLAG is true, we don't do that.  */
 
 void
-set_internal (register Lisp_Object symbol, register Lisp_Object newval, register Lisp_Object where, int bindflag)
+set_internal (Lisp_Object symbol, Lisp_Object newval, Lisp_Object where,
+             bool bindflag)
 {
-  int voide = EQ (newval, Qunbound);
+  bool voide = EQ (newval, Qunbound);
   struct Lisp_Symbol *sym;
   Lisp_Object tem1;
 
@@ -1464,7 +1465,8 @@ union Lisp_Val_Fwd
   };
 
 static struct Lisp_Buffer_Local_Value *
-make_blv (struct Lisp_Symbol *sym, int forwarded, union Lisp_Val_Fwd valcontents)
+make_blv (struct Lisp_Symbol *sym, bool forwarded,
+         union Lisp_Val_Fwd valcontents)
 {
   struct Lisp_Buffer_Local_Value *blv = xmalloc (sizeof *blv);
   Lisp_Object symbol;
@@ -1508,7 +1510,7 @@ The function `default-value' gets the default value and `set-default' sets it.
   struct Lisp_Symbol *sym;
   struct Lisp_Buffer_Local_Value *blv = NULL;
   union Lisp_Val_Fwd valcontents IF_LINT (= {LISP_INITIALLY_ZERO});
-  int forwarded IF_LINT (= 0);
+  bool forwarded IF_LINT (= 0);
 
   CHECK_SYMBOL (variable);
   sym = XSYMBOL (variable);
@@ -1580,10 +1582,10 @@ See also `make-variable-buffer-local'.
 
 Do not use `make-local-variable' to make a hook variable buffer-local.
 Instead, use `add-hook' and specify t for the LOCAL argument.  */)
-  (register Lisp_Object variable)
+  (Lisp_Object variable)
 {
-  register Lisp_Object tem;
-  int forwarded IF_LINT (= 0);
+  Lisp_Object tem;
+  bool forwarded IF_LINT (= 0);
   union Lisp_Val_Fwd valcontents IF_LINT (= {LISP_INITIALLY_ZERO});
   struct Lisp_Symbol *sym;
   struct Lisp_Buffer_Local_Value *blv = NULL;
@@ -1767,9 +1769,9 @@ is to set the VARIABLE frame parameter of that frame.  See
 Note that since Emacs 23.1, variables cannot be both buffer-local and
 frame-local any more (buffer-local bindings used to take precedence over
 frame-local bindings).  */)
-  (register Lisp_Object variable)
+  (Lisp_Object variable)
 {
-  int forwarded;
+  bool forwarded;
   union Lisp_Val_Fwd valcontents;
   struct Lisp_Symbol *sym;
   struct Lisp_Buffer_Local_Value *blv = NULL;
@@ -2225,7 +2227,7 @@ static Lisp_Object
 arithcompare (Lisp_Object num1, Lisp_Object num2, enum comparison comparison)
 {
   double f1 = 0, f2 = 0;
-  int floatp = 0;
+  bool floatp = 0;
 
   CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (num1);
   CHECK_NUMBER_OR_FLOAT_COERCE_MARKER (num2);
@@ -2342,7 +2344,7 @@ DEFUN ("zerop", Fzerop, Szerop, 1, 1, 0,
 uintmax_t
 cons_to_unsigned (Lisp_Object c, uintmax_t max)
 {
-  int valid = 0;
+  bool valid = 0;
   uintmax_t val IF_LINT (= 0);
   if (INTEGERP (c))
     {
@@ -2395,7 +2397,7 @@ cons_to_unsigned (Lisp_Object c, uintmax_t max)
 intmax_t
 cons_to_signed (Lisp_Object c, intmax_t min, intmax_t max)
 {
-  int valid = 0;
+  bool valid = 0;
   intmax_t val IF_LINT (= 0);
   if (INTEGERP (c))
     {
@@ -2513,14 +2515,11 @@ static Lisp_Object float_arith_driver (double, ptrdiff_t, enum arithop,
 static Lisp_Object
 arith_driver (enum arithop code, ptrdiff_t nargs, Lisp_Object *args)
 {
-  register Lisp_Object val;
-  ptrdiff_t argnum;
-  register EMACS_INT accum = 0;
-  register EMACS_INT next;
-
-  int overflow = 0;
-  ptrdiff_t ok_args;
-  EMACS_INT ok_accum;
+  Lisp_Object val;
+  ptrdiff_t argnum, ok_args;
+  EMACS_INT accum = 0;
+  EMACS_INT next, ok_accum;
+  bool overflow = 0;
 
   switch (code)
     {
@@ -3090,8 +3089,6 @@ syms_of_data (void)
   DEFSYM (Qchar_table, "char-table");
   DEFSYM (Qbool_vector, "bool-vector");
   DEFSYM (Qhash_table, "hash-table");
-  /* Used by Fgarbage_collect.  */
-  DEFSYM (Qinterval, "interval");
   DEFSYM (Qmisc, "misc");
 
   DEFSYM (Qdefun, "defun");
index f63f2948304f979917283063d46d55562f8cede5..901820648cb15f12312114d366fa282b33cbed14 100644 (file)
@@ -70,7 +70,7 @@ static Lisp_Object QCdbus_registered_signal;
 static Lisp_Object xd_registered_buses;
 
 /* Whether we are reading a D-Bus event.  */
-static int xd_in_read_queued_messages = 0;
+static bool xd_in_read_queued_messages = 0;
 
 \f
 /* We use "xd_" and "XD_" as prefix for all internal symbols, because
@@ -997,8 +997,7 @@ xd_find_watch_fd (DBusWatch *watch)
 }
 
 /* Prototype.  */
-static void
-xd_read_queued_messages (int fd, void *data, int for_read);
+static void xd_read_queued_messages (int fd, void *data);
 
 /* Start monitoring WATCH for possible I/O.  */
 static dbus_bool_t
@@ -1686,7 +1685,7 @@ xd_read_message (Lisp_Object bus)
 
 /* Callback called when something is ready to read or write.  */
 static void
-xd_read_queued_messages (int fd, void *data, int for_read)
+xd_read_queued_messages (int fd, void *data)
 {
   Lisp_Object busp = xd_registered_buses;
   Lisp_Object bus = Qnil;
index 771230717e3dd5885cc00b55ceb960feb84c4586..fa293258107b1ec6a84beea41cc9f50255ec6e52 100644 (file)
@@ -109,18 +109,20 @@ directory_files_internal_unwind (Lisp_Object dh)
 }
 
 /* Function shared by Fdirectory_files and Fdirectory_files_and_attributes.
-   When ATTRS is zero, return a list of directory filenames; when
-   non-zero, return a list of directory filenames and their attributes.
+   If not ATTRS, return a list of directory filenames;
+   if ATTRS, return a list of directory filenames and their attributes.
    In the latter case, ID_FORMAT is passed to Ffile_attributes.  */
 
 Lisp_Object
-directory_files_internal (Lisp_Object directory, Lisp_Object full, Lisp_Object match, Lisp_Object nosort, int attrs, Lisp_Object id_format)
+directory_files_internal (Lisp_Object directory, Lisp_Object full,
+                         Lisp_Object match, Lisp_Object nosort, bool attrs,
+                         Lisp_Object id_format)
 {
   DIR *d;
   ptrdiff_t directory_nbytes;
   Lisp_Object list, dirfilename, encoded_directory;
   struct re_pattern_buffer *bufp = NULL;
-  int needsep = 0;
+  bool needsep = 0;
   ptrdiff_t count = SPECPDL_INDEX ();
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
   DIRENTRY *dp;
@@ -227,7 +229,7 @@ directory_files_internal (Lisp_Object directory, Lisp_Object full, Lisp_Object m
       if (DIRENTRY_NONEMPTY (dp))
        {
          ptrdiff_t len;
-         int wanted = 0;
+         bool wanted = 0;
          Lisp_Object name, finalname;
          struct gcpro gcpro1, gcpro2;
 
@@ -381,9 +383,8 @@ which see.  */)
 }
 
 \f
-static Lisp_Object file_name_completion
-  (Lisp_Object file, Lisp_Object dirname, int all_flag, int ver_flag,
-   Lisp_Object predicate);
+static Lisp_Object file_name_completion (Lisp_Object, Lisp_Object, bool,
+                                        Lisp_Object);
 
 DEFUN ("file-name-completion", Ffile_name_completion, Sfile_name_completion,
        2, 3, 0,
@@ -415,7 +416,7 @@ determined by the variable `completion-ignored-extensions', which see.  */)
   if (!NILP (handler))
     return call4 (handler, Qfile_name_completion, file, directory, predicate);
 
-  return file_name_completion (file, directory, 0, 0, predicate);
+  return file_name_completion (file, directory, 0, predicate);
 }
 
 DEFUN ("file-name-all-completions", Ffile_name_all_completions,
@@ -439,14 +440,15 @@ These are all file names in directory DIRECTORY which begin with FILE.  */)
   if (!NILP (handler))
     return call3 (handler, Qfile_name_all_completions, file, directory);
 
-  return file_name_completion (file, directory, 1, 0, Qnil);
+  return file_name_completion (file, directory, 1, Qnil);
 }
 
 static int file_name_completion_stat (Lisp_Object dirname, DIRENTRY *dp, struct stat *st_addr);
 static Lisp_Object Qdefault_directory;
 
 static Lisp_Object
-file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int ver_flag, Lisp_Object predicate)
+file_name_completion (Lisp_Object file, Lisp_Object dirname, bool all_flag,
+                     Lisp_Object predicate)
 {
   DIR *d;
   ptrdiff_t bestmatchsize = 0;
@@ -458,11 +460,11 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v
   Lisp_Object encoded_file;
   Lisp_Object encoded_dir;
   struct stat st;
-  int directoryp;
-  /* If includeall is zero, exclude files in completion-ignored-extensions as
+  bool directoryp;
+  /* If not INCLUDEALL, exclude files in completion-ignored-extensions as
      well as "." and "..".  Until shown otherwise, assume we can't exclude
      anything.  */
-  int includeall = 1;
+  bool includeall = 1;
   ptrdiff_t count = SPECPDL_INDEX ();
   struct gcpro gcpro1, gcpro2, gcpro3, gcpro4, gcpro5;
 
@@ -500,7 +502,7 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v
     {
       DIRENTRY *dp;
       ptrdiff_t len;
-      int canexclude = 0;
+      bool canexclude = 0;
 
       errno = 0;
       dp = readdir (d);
@@ -528,7 +530,7 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v
       if (file_name_completion_stat (encoded_dir, dp, &st) < 0)
        continue;
 
-      directoryp = S_ISDIR (st.st_mode);
+      directoryp = S_ISDIR (st.st_mode) != 0;
       tem = Qnil;
       /* If all_flag is set, always include all.
         It would not actually be helpful to the user to ignore any possible
@@ -716,7 +718,7 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v
              /* This tests that the current file is an exact match
                 but BESTMATCH is not (it is too long).  */
              if ((matchsize == SCHARS (name)
-                  && matchsize + !!directoryp < SCHARS (bestmatch))
+                  && matchsize + directoryp < SCHARS (bestmatch))
                  ||
                  /* If there is no exact match ignoring case,
                     prefer a match that does not change the case
@@ -728,7 +730,7 @@ file_name_completion (Lisp_Object file, Lisp_Object dirname, int all_flag, int v
                     either both or neither are exact.  */
                  (((matchsize == SCHARS (name))
                    ==
-                   (matchsize + !!directoryp == SCHARS (bestmatch)))
+                   (matchsize + directoryp == SCHARS (bestmatch)))
                   && (cmp = Fcompare_strings (name, zero,
                                               make_number (SCHARS (file)),
                                               file, zero,
index a25aac96df96d1e2a3dd00f535282d9802007bbe..1140d98f8a7ed52d6ce9128eaed35581e9516bd3 100644 (file)
@@ -671,7 +671,7 @@ struct glyph_matrix
 
   /* Values of BEGV and ZV as of last redisplay.  Set in
      mark_window_display_accurate_1.  */
-  int begv, zv;
+  ptrdiff_t begv, zv;
 };
 
 
@@ -1126,11 +1126,11 @@ struct glyph_row *matrix_row (struct glyph_matrix *, int);
       ((ROW)->phys_height - (ROW)->phys_ascent \
        > (ROW)->height - (ROW)->ascent)
 
-/* Non-zero means that fonts have been loaded since the last glyph
+/* True means that fonts have been loaded since the last glyph
    matrix adjustments.  The function redisplay_internal adjusts glyph
-   matrices when this flag is non-zero.  */
+   matrices when this flag is true.  */
 
-extern int fonts_changed_p;
+extern bool fonts_changed_p;
 
 /* A glyph for a space.  */
 
@@ -1149,7 +1149,7 @@ extern int updated_area;
 /* Non-zero means last display completed.  Zero means it was
    preempted.  */
 
-extern int display_completed;
+extern bool display_completed;
 
 
 \f
@@ -1415,7 +1415,7 @@ struct glyph_string
       && !NILP (BVAR (XBUFFER (W->buffer), mode_line_format))  \
       && WINDOW_TOTAL_LINES (W) > 1)
 
-/* Value is non-zero if window W wants a header line.  */
+/* Value is true if window W wants a header line.  */
 
 #define WINDOW_WANTS_HEADER_LINE_P(W)                                  \
      (!MINI_WINDOW_P ((W))                                             \
@@ -1856,7 +1856,6 @@ struct bidi_it {
   int resolved_level;          /* final resolved level of this character */
   int invalid_levels;          /* how many PDFs to ignore */
   int invalid_rl_levels;       /* how many PDFs from RLE/RLO to ignore */
-  int prev_was_pdf;            /* if non-zero, previous char was PDF */
   struct bidi_saved_info prev; /* info about previous character */
   struct bidi_saved_info last_strong; /* last-seen strong directional char */
   struct bidi_saved_info next_for_neutral; /* surrounding characters for... */
@@ -1879,6 +1878,7 @@ struct bidi_it {
   struct bidi_string_data string;      /* string to reorder */
   bidi_dir_t paragraph_dir;    /* current paragraph direction */
   ptrdiff_t separator_limit;   /* where paragraph separator should end */
+  unsigned prev_was_pdf : 1;   /* if non-zero, previous char was PDF */
   unsigned first_elt : 1;      /* if non-zero, examine current char first */
   unsigned new_paragraph : 1;  /* if non-zero, we expect a new paragraph */
   unsigned frame_window_p : 1; /* non-zero if displaying on a GUI frame */
@@ -2085,10 +2085,10 @@ struct composition_it
   ptrdiff_t lookback;
   /* If non-negative, number of glyphs of the glyph-string.  */
   int nglyphs;
-  /* Nonzero iff the composition is created while buffer is scanned in
+  /* True iff the composition is created while buffer is scanned in
      reverse order, and thus the grapheme clusters must be rendered
      from the last to the first.  */
-  int reversed_p;
+  bool reversed_p;
 
   /** The following members contain information about the current
       grapheme cluster.  */
@@ -3002,14 +3002,14 @@ enum tool_bar_item_image
 
 /* Defined in bidi.c */
 
-extern void bidi_init_it (ptrdiff_t, ptrdiff_t, int, struct bidi_it *);
+extern void bidi_init_it (ptrdiff_t, ptrdiff_t, bool, struct bidi_it *);
 extern void bidi_move_to_visually_next (struct bidi_it *);
-extern void bidi_paragraph_init (bidi_dir_t, struct bidi_it *, int);
+extern void bidi_paragraph_init (bidi_dir_t, struct bidi_it *, bool);
 extern int  bidi_mirror_char (int);
 extern void bidi_push_it (struct bidi_it *);
 extern void bidi_pop_it (struct bidi_it *);
 extern void *bidi_shelve_cache (void);
-extern void bidi_unshelve_cache (void *, int);
+extern void bidi_unshelve_cache (void *, bool);
 
 /* Defined in xdisp.c */
 
@@ -3304,7 +3304,7 @@ extern Lisp_Object marginal_area_string (struct window *, enum window_part,
 extern void redraw_frame (struct frame *);
 extern void cancel_line (int, struct frame *);
 extern void init_desired_glyphs (struct frame *);
-extern int update_frame (struct frame *, int, int);
+extern bool update_frame (struct frame *, bool, bool);
 extern void bitch_at_user (void);
 void adjust_glyphs (struct frame *);
 void free_glyphs (struct frame *);
@@ -3320,13 +3320,13 @@ void rotate_matrix (struct glyph_matrix *, int, int, int);
 void increment_matrix_positions (struct glyph_matrix *,
                                  int, int, ptrdiff_t, ptrdiff_t);
 void blank_row (struct window *, struct glyph_row *, int);
-void enable_glyph_matrix_rows (struct glyph_matrix *, int, int, int);
+void clear_glyph_matrix_rows (struct glyph_matrix *, int, int);
 void clear_glyph_row (struct glyph_row *);
 void prepare_desired_row (struct glyph_row *);
-void set_window_update_flags (struct window *, int);
-void update_single_window (struct window *, int);
-void do_pending_window_change (int);
-void change_frame_size (struct frame *, int, int, int, int, int);
+void set_window_update_flags (struct window *, bool);
+void update_single_window (struct window *, bool);
+void do_pending_window_change (bool);
+void change_frame_size (struct frame *, int, int, bool, bool, bool);
 void init_display (void);
 void syms_of_display (void);
 extern Lisp_Object Qredisplay_dont_pause;
index ce7c4ebcb4cb55155902c62e947895b52252aeb7..4e3078801117e4c110e89250d15aedb0bb4498eb 100644 (file)
@@ -88,7 +88,7 @@ static void update_frame_line (struct frame *, int);
 static int required_matrix_height (struct window *);
 static int required_matrix_width (struct window *);
 static void adjust_frame_glyphs (struct frame *);
-static void change_frame_size_1 (struct frame *, int, int, int, int, int);
+static void change_frame_size_1 (struct frame *, int, int, bool, bool, bool);
 static void increment_row_positions (struct glyph_row *, ptrdiff_t, ptrdiff_t);
 static void fill_up_frame_row_with_spaces (struct glyph_row *, int);
 static void build_frame_matrix_from_window_tree (struct glyph_matrix *,
@@ -98,20 +98,20 @@ static void build_frame_matrix_from_leaf_window (struct glyph_matrix *,
 static void adjust_frame_message_buffer (struct frame *);
 static void adjust_decode_mode_spec_buffer (struct frame *);
 static void fill_up_glyph_row_with_spaces (struct glyph_row *);
-static void clear_window_matrices (struct window *, int);
+static void clear_window_matrices (struct window *, bool);
 static void fill_up_glyph_row_area_with_spaces (struct glyph_row *, int);
-static int scrolling_window (struct window *, int);
-static int update_window_line (struct window *, int, int *);
+static int scrolling_window (struct window *, bool);
+static bool update_window_line (struct window *, int, bool *);
 static void mirror_make_current (struct window *, int);
 #ifdef GLYPH_DEBUG
 static void check_matrix_pointers (struct glyph_matrix *,
                                    struct glyph_matrix *);
 #endif
 static void mirror_line_dance (struct window *, int, int, int *, char *);
-static int update_window_tree (struct window *, int);
-static int update_window (struct window *, int);
-static int update_frame_1 (struct frame *, int, int);
-static int scrolling (struct frame *);
+static bool update_window_tree (struct window *, bool);
+static bool update_window (struct window *, bool);
+static bool update_frame_1 (struct frame *, bool, bool);
+static bool scrolling (struct frame *);
 static void set_window_cursor_after_update (struct window *);
 static void adjust_frame_glyphs_for_window_redisplay (struct frame *);
 static void adjust_frame_glyphs_for_frame_redisplay (struct frame *);
@@ -122,14 +122,14 @@ static void adjust_frame_glyphs_for_frame_redisplay (struct frame *);
 static EMACS_TIME preemption_period;
 static EMACS_TIME preemption_next_check;
 
-/* Nonzero upon entry to redisplay means do not assume anything about
+/* True upon entry to redisplay means do not assume anything about
    current contents of actual terminal frame; clear and redraw it.  */
 
-int frame_garbaged;
+bool frame_garbaged;
 
-/* Nonzero means last display completed.  Zero means it was preempted.  */
+/* True means last display completed.  False means it was preempted.  */
 
-int display_completed;
+bool display_completed;
 
 Lisp_Object Qdisplay_table, Qredisplay_dont_pause;
 
@@ -146,13 +146,13 @@ Lisp_Object selected_frame;
 
 struct frame *last_nonminibuf_frame;
 
-/* 1 means SIGWINCH happened when not safe.  */
+/* True means SIGWINCH happened when not safe.  */
 
-static int delayed_size_change;
+static bool delayed_size_change;
 
 /* 1 means glyph initialization has been completed at startup.  */
 
-static int glyphs_initialized_initially_p;
+static bool glyphs_initialized_initially_p;
 
 /* Updated window if != 0.  Set by update_window.  */
 
@@ -178,15 +178,15 @@ static int glyph_pool_count;
 
 static struct frame *frame_matrix_frame;
 
-/* Non-zero means that fonts have been loaded since the last glyph
+/* True means that fonts have been loaded since the last glyph
    matrix adjustments.  Redisplay must stop, and glyph matrices must
-   be adjusted when this flag becomes non-zero during display.  The
+   be adjusted when this flag becomes true during display.  The
    reason fonts can be loaded so late is that fonts of fontsets are
    loaded on demand.  Another reason is that a line contains many
    characters displayed by zero width or very narrow glyphs of
    variable-width fonts.  */
 
-int fonts_changed_p;
+bool fonts_changed_p;
 
 /* Convert vpos and hpos from frame to window and vice versa.
    This may only be used for terminal frames.  */
@@ -222,16 +222,14 @@ static int history_idx;
    history.  */
 
 static uprintmax_t history_tick;
-
-static void add_frame_display_history (struct frame *, int);
 \f
 /* Add to the redisplay history how window W has been displayed.
    MSG is a trace containing the information how W's glyph matrix
-   has been constructed.  PAUSED_P non-zero means that the update
+   has been constructed.  PAUSED_P means that the update
    has been interrupted for pending input.  */
 
 static void
-add_window_display_history (struct window *w, const char *msg, int paused_p)
+add_window_display_history (struct window *w, const char *msg, bool paused_p)
 {
   char *buf;
 
@@ -254,11 +252,11 @@ add_window_display_history (struct window *w, const char *msg, int paused_p)
 
 
 /* Add to the redisplay history that frame F has been displayed.
-   PAUSED_P non-zero means that the update has been interrupted for
+   PAUSED_P means that the update has been interrupted for
    pending input.  */
 
 static void
-add_frame_display_history (struct frame *f, int paused_p)
+add_frame_display_history (struct frame *f, bool paused_p)
 {
   char *buf;
 
@@ -395,10 +393,10 @@ margin_glyphs_to_reserve (struct window *w, int total_glyphs, Lisp_Object margin
   return n;
 }
 
-/* Return non-zero if ROW's hash value is correct, zero if not.
+/* Return true if ROW's hash value is correct.
    Optimized away if ENABLE_CHECKING is not defined.  */
 
-static int
+static bool
 verify_row_hash (struct glyph_row *row)
 {
   return row->hash == row_hash (row);
@@ -431,9 +429,9 @@ adjust_glyph_matrix (struct window *w, struct glyph_matrix *matrix, int x, int y
 {
   int i;
   int new_rows;
-  int marginal_areas_changed_p = 0;
-  int header_line_changed_p = 0;
-  int header_line_p = 0;
+  bool marginal_areas_changed_p = 0;
+  bool header_line_changed_p = 0;
+  bool header_line_p = 0;
   int left = -1, right = -1;
   int window_width = -1, window_height = -1;
 
@@ -736,30 +734,28 @@ increment_matrix_positions (struct glyph_matrix *matrix, int start, int end,
 }
 
 
-/* Enable a range of rows in glyph matrix MATRIX.  START and END are
-   the row indices of the first and last + 1 row to enable.  If
-   ENABLED_P is non-zero, enabled_p flags in rows will be set to 1.  */
+/* Clear the enable_p flags in a range of rows in glyph matrix MATRIX.
+   START and END are the row indices of the first and last + 1 row to clear.  */
 
 void
-enable_glyph_matrix_rows (struct glyph_matrix *matrix, int start, int end, int enabled_p)
+clear_glyph_matrix_rows (struct glyph_matrix *matrix, int start, int end)
 {
   eassert (start <= end);
   eassert (start >= 0 && start < matrix->nrows);
   eassert (end >= 0 && end <= matrix->nrows);
 
   for (; start < end; ++start)
-    matrix->rows[start].enabled_p = enabled_p != 0;
+    matrix->rows[start].enabled_p = 0;
 }
 
 
 /* Clear MATRIX.
 
-   This empties all rows in MATRIX by setting the enabled_p flag for
-   all rows of the matrix to zero.  The function prepare_desired_row
-   will eventually really clear a row when it sees one with a zero
-   enabled_p flag.
+   Empty all rows in MATRIX by clearing their enabled_p flags.
+   The function prepare_desired_row will eventually really clear a row
+   when it sees one with a false enabled_p flag.
 
-   Resets update hints to defaults value.  The only update hint
+   Reset update hints to default values.  The only update hint
    currently present is the flag MATRIX->no_scrolling_p.  */
 
 void
@@ -767,7 +763,7 @@ clear_glyph_matrix (struct glyph_matrix *matrix)
 {
   if (matrix)
     {
-      enable_glyph_matrix_rows (matrix, 0, matrix->nrows, 0);
+      clear_glyph_matrix_rows (matrix, 0, matrix->nrows);
       matrix->no_scrolling_p = 0;
     }
 }
@@ -853,11 +849,11 @@ clear_desired_matrices (register struct frame *f)
 }
 
 
-/* Clear matrices in window tree rooted in W.  If DESIRED_P is
-   non-zero clear desired matrices, otherwise clear current matrices.  */
+/* Clear matrices in window tree rooted in W.  If DESIRED_P,
+   clear desired matrices, otherwise clear current matrices.  */
 
 static void
-clear_window_matrices (struct window *w, int desired_p)
+clear_window_matrices (struct window *w, bool desired_p)
 {
   while (w)
     {
@@ -1109,12 +1105,12 @@ assign_row (struct glyph_row *to, struct glyph_row *from)
 /* Test whether the glyph memory of the glyph row WINDOW_ROW, which is
    a row in a window matrix, is a slice of the glyph memory of the
    glyph row FRAME_ROW which is a row in a frame glyph matrix.  Value
-   is non-zero if the glyph memory of WINDOW_ROW is part of the glyph
+   is true if the glyph memory of WINDOW_ROW is part of the glyph
    memory of FRAME_ROW.  */
 
 #ifdef GLYPH_DEBUG
 
-static int
+static bool
 glyph_row_slice_p (struct glyph_row *window_row, struct glyph_row *frame_row)
 {
   struct glyph *window_glyph_start = window_row->glyphs[0];
@@ -1161,7 +1157,7 @@ prepare_desired_row (struct glyph_row *row)
 {
   if (!row->enabled_p)
     {
-      int rp = row->reversed_p;
+      bool rp = row->reversed_p;
 
       clear_glyph_row (row);
       row->enabled_p = 1;
@@ -1260,12 +1256,11 @@ line_draw_cost (struct glyph_matrix *matrix, int vpos)
 }
 
 
-/* Test two glyph rows A and B for equality.  Value is non-zero if A
-   and B have equal contents.  MOUSE_FACE_P non-zero means compare the
-   mouse_face_p flags of A and B, too.  */
+/* Return true if the glyph rows A and B have equal contents.
+   MOUSE_FACE_P means compare the mouse_face_p flags of A and B, too.  */
 
-static inline int
-row_equal_p (struct glyph_row *a, struct glyph_row *b, int mouse_face_p)
+static inline bool
+row_equal_p (struct glyph_row *a, struct glyph_row *b, bool mouse_face_p)
 {
   eassert (verify_row_hash (a));
   eassert (verify_row_hash (b));
@@ -1380,14 +1375,14 @@ free_glyph_pool (struct glyph_pool *pool)
    is changed from a large value to a smaller one.  But, if someone
    does it once, we can expect that he will do it again.
 
-   Value is non-zero if the pool changed in a way which makes
+   Return true if the pool changed in a way which makes
    re-adjusting window glyph matrices necessary.  */
 
-static int
+static bool
 realloc_glyph_pool (struct glyph_pool *pool, struct dim matrix_dim)
 {
   ptrdiff_t needed;
-  int changed_p;
+  bool changed_p;
 
   changed_p = (pool->glyphs == 0
               || matrix_dim.height != pool->nrows
@@ -1561,7 +1556,7 @@ check_matrix_invariants (struct window *w)
 
    X and Y are column/row within the frame glyph matrix where
    sub-matrices for the window tree rooted at WINDOW must be
-   allocated.  DIM_ONLY_P non-zero means that the caller of this
+   allocated.  DIM_ONLY_P means that the caller of this
    function is only interested in the result matrix dimension, and
    matrix adjustments should not be performed.
 
@@ -1638,7 +1633,7 @@ check_matrix_invariants (struct window *w)
 
 static struct dim
 allocate_matrices_for_frame_redisplay (Lisp_Object window, int x, int y,
-                                      int dim_only_p, int *window_change_flags)
+                                      bool dim_only_p, int *window_change_flags)
 {
   struct frame *f = XFRAME (WINDOW_FRAME (XWINDOW (window)));
   int x0 = x, y0 = y;
@@ -1646,7 +1641,7 @@ allocate_matrices_for_frame_redisplay (Lisp_Object window, int x, int y,
   struct dim total;
   struct dim dim;
   struct window *w;
-  int in_horz_combination_p;
+  bool in_horz_combination_p;
 
   /* What combination is WINDOW part of?  Compute this once since the
      result is the same for all windows in the `next' chain.  The
@@ -1704,7 +1699,7 @@ allocate_matrices_for_frame_redisplay (Lisp_Object window, int x, int y,
          /* Actually change matrices, if allowed.  Do not consider
             CHANGED_LEAF_MATRIX computed above here because the pool
             may have been changed which we don't now here.  We trust
-            that we only will be called with DIM_ONLY_P != 0 when
+            that we only will be called with DIM_ONLY_P when
             necessary.  */
          if (!dim_only_p)
            {
@@ -1919,9 +1914,9 @@ adjust_frame_glyphs (struct frame *f)
   f->glyphs_initialized_p = 1;
 }
 
-/* Return 1 if any window in the tree has nonzero window margins.  See
+/* Return true if any window in the tree has nonzero window margins.  See
    the hack at the end of adjust_frame_glyphs_for_frame_redisplay.  */
-static int
+static bool
 showing_window_margins_p (struct window *w)
 {
   while (w)
@@ -2052,7 +2047,7 @@ static void
 adjust_frame_glyphs_for_frame_redisplay (struct frame *f)
 {
   struct dim matrix_dim;
-  int pool_changed_p;
+  bool pool_changed_p;
   int window_change_flags;
   int top_window_y;
 
@@ -2468,7 +2463,7 @@ build_frame_matrix_from_window_tree (struct glyph_matrix *matrix, struct window
    desired frame matrix built.  W is a leaf window whose desired or
    current matrix is to be added to FRAME_MATRIX.  W's flag
    must_be_updated_p determines which matrix it contributes to
-   FRAME_MATRIX.  If must_be_updated_p is non-zero, W's desired matrix
+   FRAME_MATRIX.  If W->must_be_updated_p, W's desired matrix
    is added to FRAME_MATRIX, otherwise W's current matrix is added.
    Adding a desired matrix means setting up used counters and such in
    frame rows, while adding a current window matrix to FRAME_MATRIX
@@ -2519,7 +2514,7 @@ build_frame_matrix_from_leaf_window (struct glyph_matrix *frame_matrix, struct w
     {
       struct glyph_row *frame_row = frame_matrix->rows + frame_y;
       struct glyph_row *window_row = window_matrix->rows + window_y;
-      int current_row_p = window_matrix == w->current_matrix;
+      bool current_row_p = window_matrix == w->current_matrix;
 
       /* Fill up the frame row with spaces up to the left margin of the
         window row.  */
@@ -2692,7 +2687,7 @@ make_current (struct glyph_matrix *desired_matrix, struct glyph_matrix *current_
 {
   struct glyph_row *current_row = MATRIX_ROW (current_matrix, row);
   struct glyph_row *desired_row = MATRIX_ROW (desired_matrix, row);
-  int mouse_face_p = current_row->mouse_face_p;
+  bool mouse_face_p = current_row->mouse_face_p;
 
   /* Do current_row = desired_row.  This exchanges glyph pointers
      between both rows, and does a structure assignment otherwise.  */
@@ -2789,7 +2784,7 @@ mirrored_line_dance (struct glyph_matrix *matrix, int unchanged_at_top, int nlin
   /* Assign new rows, maybe clear lines.  */
   for (i = 0; i < nlines; ++i)
     {
-      int enabled_before_p = new_rows[i].enabled_p;
+      bool enabled_before_p = new_rows[i].enabled_p;
 
       eassert (i + unchanged_at_top < matrix->nrows);
       eassert (unchanged_at_top + copy_from[i] < matrix->nrows);
@@ -2897,7 +2892,8 @@ mirror_line_dance (struct window *w, int unchanged_at_top, int nlines, int *copy
          /* W is a leaf window, and we are working on its current
             matrix m.  */
          struct glyph_matrix *m = w->current_matrix;
-         int i, sync_p = 0;
+         int i;
+         bool sync_p = 0;
          struct glyph_row *old_rows;
 
          /* Make a copy of the original rows of matrix m.  */
@@ -2919,22 +2915,19 @@ mirror_line_dance (struct window *w, int unchanged_at_top, int nlines, int *copy
              int window_from = frame_from - m->matrix_y;
 
              /* Is assigned line inside window?  */
-             int from_inside_window_p
+             bool from_inside_window_p
                = window_from >= 0 && window_from < m->matrix_h;
 
              /* Is assigned to line inside window?  */
-             int to_inside_window_p
+             bool to_inside_window_p
                = window_to >= 0 && window_to < m->matrix_h;
 
              if (from_inside_window_p && to_inside_window_p)
                {
-                 /* Enabled setting before assignment.  */
-                 int enabled_before_p;
-
                  /* Do the assignment.  The enabled_p flag is saved
                     over the assignment because the old redisplay did
                     that.  */
-                 enabled_before_p = m->rows[window_to].enabled_p;
+                 bool enabled_before_p = m->rows[window_to].enabled_p;
                  m->rows[window_to] = old_rows[window_from];
                  m->rows[window_to].enabled_p = enabled_before_p;
 
@@ -3155,17 +3148,16 @@ DEFUN ("redraw-display", Fredraw_display, Sredraw_display, 0, 0, "",
 
 /* Update frame F based on the data in desired matrices.
 
-   If FORCE_P is non-zero, don't let redisplay be stopped by detecting
-   pending input.  If INHIBIT_HAIRY_ID_P is non-zero, don't try
-   scrolling.
+   If FORCE_P, don't let redisplay be stopped by detecting pending input.
+   If INHIBIT_HAIRY_ID_P, don't try scrolling.
 
-   Value is non-zero if redisplay was stopped due to pending input.  */
+   Value is true if redisplay was stopped due to pending input.  */
 
-int
-update_frame (struct frame *f, int force_p, int inhibit_hairy_id_p)
+bool
+update_frame (struct frame *f, bool force_p, bool inhibit_hairy_id_p)
 {
-  /* 1 means display has been paused because of pending input.  */
-  int paused_p;
+  /* True means display has been paused because of pending input.  */
+  bool paused_p;
   struct window *root_window = XWINDOW (f->root_window);
 
   if (redisplay_dont_pause)
@@ -3283,13 +3275,13 @@ update_frame (struct frame *f, int force_p, int inhibit_hairy_id_p)
                         Window-based updates
  ************************************************************************/
 
-/* Perform updates in window tree rooted at W.  FORCE_P non-zero means
-   don't stop updating when input is pending.  */
+/* Perform updates in window tree rooted at W.
+   If FORCE_P, don't stop updating if input is pending.  */
 
-static int
-update_window_tree (struct window *w, int force_p)
+static bool
+update_window_tree (struct window *w, bool force_p)
 {
-  int paused_p = 0;
+  bool paused_p = 0;
 
   while (w && !paused_p)
     {
@@ -3307,11 +3299,11 @@ update_window_tree (struct window *w, int force_p)
 }
 
 
-/* Update window W if its flag must_be_updated_p is non-zero.  If
-   FORCE_P is non-zero, don't stop updating if input is pending.  */
+/* Update window W if its flag must_be_updated_p is set.
+   If FORCE_P, don't stop updating if input is pending.  */
 
 void
-update_single_window (struct window *w, int force_p)
+update_single_window (struct window *w, bool force_p)
 {
   if (w->must_be_updated_p)
     {
@@ -3460,7 +3452,7 @@ redraw_overlapping_rows (struct window *w, int yb)
 static void
 check_current_matrix_flags (struct window *w)
 {
-  int last_seen_p = 0;
+  bool last_seen_p = 0;
   int i, yb = window_text_bottom_y (w);
 
   for (i = 0; i < w->current_matrix->nrows - 1; ++i)
@@ -3476,14 +3468,14 @@ check_current_matrix_flags (struct window *w)
 #endif /* GLYPH_DEBUG */
 
 
-/* Update display of window W.  FORCE_P non-zero means that we should
-   not stop when detecting pending input.  */
+/* Update display of window W.
+   If FORCE_P, don't stop updating when input is pending.  */
 
-static int
-update_window (struct window *w, int force_p)
+static bool
+update_window (struct window *w, bool force_p)
 {
   struct glyph_matrix *desired_matrix = w->desired_matrix;
-  int paused_p;
+  bool paused_p;
 #if !PERIODIC_PREEMPTION_CHECKING
   int preempt_count = baud_rate / 2400 + 1;
 #endif
@@ -3506,7 +3498,8 @@ update_window (struct window *w, int force_p)
       struct glyph_row *row, *end;
       struct glyph_row *mode_line_row;
       struct glyph_row *header_line_row;
-      int yb, changed_p = 0, mouse_face_overwritten_p = 0;
+      int yb;
+      bool changed_p = 0, mouse_face_overwritten_p = 0;
 #if ! PERIODIC_PREEMPTION_CHECKING
       int n_updated = 0;
 #endif
@@ -3693,15 +3686,15 @@ update_marginal_area (struct window *w, int area, int vpos)
 
 
 /* Update the display of the text area of row VPOS in window W.
-   Value is non-zero if display has changed.  */
+   Value is true if display has changed.  */
 
-static int
+static bool
 update_text_area (struct window *w, int vpos)
 {
   struct glyph_row *current_row = MATRIX_ROW (w->current_matrix, vpos);
   struct glyph_row *desired_row = MATRIX_ROW (w->desired_matrix, vpos);
   struct redisplay_interface *rif = FRAME_RIF (XFRAME (WINDOW_FRAME (w)));
-  int changed_p = 0;
+  bool changed_p = 0;
 
   /* Let functions in xterm.c know what area subsequent X positions
      will be relative to.  */
@@ -3751,9 +3744,9 @@ update_text_area (struct window *w, int vpos)
       int stop, i, x;
       struct glyph *current_glyph = current_row->glyphs[TEXT_AREA];
       struct glyph *desired_glyph = desired_row->glyphs[TEXT_AREA];
-      int overlapping_glyphs_p = current_row->contains_overlapping_glyphs_p;
+      bool overlapping_glyphs_p = current_row->contains_overlapping_glyphs_p;
       int desired_stop_pos = desired_row->used[TEXT_AREA];
-      int abort_skipping = 0;
+      bool abort_skipping = 0;
 
       /* If the desired row extends its face to the text area end, and
         unless the current row also does so at the same position,
@@ -3773,7 +3766,7 @@ update_text_area (struct window *w, int vpos)
         in common.  */
       while (i < stop)
        {
-         int can_skip_p = !abort_skipping;
+         bool can_skip_p = !abort_skipping;
 
          /* Skip over glyphs that both rows have in common.  These
             don't have to be written.  We can't skip if the last
@@ -3847,7 +3840,7 @@ update_text_area (struct window *w, int vpos)
              int start_x = x, start_hpos = i;
              struct glyph *start = desired_glyph;
              int current_x = x;
-             int skip_first_p = !can_skip_p;
+             bool skip_first_p = !can_skip_p;
 
              /* Find the next glyph that's equal again.  */
              while (i < stop
@@ -3938,16 +3931,15 @@ update_text_area (struct window *w, int vpos)
 }
 
 
-/* Update row VPOS in window W.  Value is non-zero if display has been
-   changed.  */
+/* Update row VPOS in window W.  Value is true if display has been changed.  */
 
-static int
-update_window_line (struct window *w, int vpos, int *mouse_face_overwritten_p)
+static bool
+update_window_line (struct window *w, int vpos, bool *mouse_face_overwritten_p)
 {
   struct glyph_row *current_row = MATRIX_ROW (w->current_matrix, vpos);
   struct glyph_row *desired_row = MATRIX_ROW (w->desired_matrix, vpos);
   struct redisplay_interface *rif = FRAME_RIF (XFRAME (WINDOW_FRAME (w)));
-  int changed_p = 0;
+  bool changed_p = 0;
 
   /* Set the row being updated.  This is important to let xterm.c
      know what line height values are in effect.  */
@@ -4095,7 +4087,7 @@ set_window_cursor_after_update (struct window *w)
    tree rooted at W.  */
 
 void
-set_window_update_flags (struct window *w, int on_p)
+set_window_update_flags (struct window *w, bool on_p)
 {
   while (w)
     {
@@ -4198,7 +4190,7 @@ add_row_entry (struct glyph_row *row)
 
 
 /* Try to reuse part of the current display of W by scrolling lines.
-   HEADER_LINE_P non-zero means W has a header line.
+   HEADER_LINE_P means W has a header line.
 
    The algorithm is taken from Communications of the ACM, Apr78 "A
    Technique for Isolating Differences Between Files."  It should take
@@ -4224,7 +4216,7 @@ add_row_entry (struct glyph_row *row)
    1   if we did scroll.  */
 
 static int
-scrolling_window (struct window *w, int header_line_p)
+scrolling_window (struct window *w, bool header_line_p)
 {
   struct glyph_matrix *desired_matrix = w->desired_matrix;
   struct glyph_matrix *current_matrix = w->current_matrix;
@@ -4237,7 +4229,7 @@ scrolling_window (struct window *w, int header_line_p)
   struct redisplay_interface *rif = FRAME_RIF (XFRAME (WINDOW_FRAME (w)));
 
   /* Skip over rows equal at the start.  */
-  for (i = header_line_p ? 1 : 0; i < current_matrix->nrows - 1; ++i)
+  for (i = header_line_p; i < current_matrix->nrows - 1; ++i)
     {
       struct glyph_row *d = MATRIX_ROW (desired_matrix, i);
       struct glyph_row *c = MATRIX_ROW (current_matrix, i);
@@ -4496,7 +4488,7 @@ scrolling_window (struct window *w, int header_line_p)
        for (j = nruns - 1; j > i; --j)
          {
            struct run *p = runs[j];
-           int truncated_p = 0;
+           bool truncated_p = 0;
 
            if (p->nrows > 0
                && p->desired_y < r->desired_y + r->height
@@ -4559,7 +4551,7 @@ scrolling_window (struct window *w, int header_line_p)
        for (j = 0; j < r->nrows; ++j)
          {
            struct glyph_row *from, *to;
-           int to_overlapped_p;
+           bool to_overlapped_p;
 
            to = MATRIX_ROW (current_matrix, r->desired_vpos + j);
            from = MATRIX_ROW (desired_matrix, r->desired_vpos + j);
@@ -4594,20 +4586,19 @@ scrolling_window (struct window *w, int header_line_p)
 
 /* Update the desired frame matrix of frame F.
 
-   FORCE_P non-zero means that the update should not be stopped by
-   pending input.  INHIBIT_HAIRY_ID_P non-zero means that scrolling
-   should not be tried.
+   FORCE_P means that the update should not be stopped by pending input.
+   INHIBIT_HAIRY_ID_P means that scrolling should not be tried.
 
-   Value is non-zero if update was stopped due to pending input.  */
+   Value is true if update was stopped due to pending input.  */
 
-static int
-update_frame_1 (struct frame *f, int force_p, int inhibit_id_p)
+static bool
+update_frame_1 (struct frame *f, bool force_p, bool inhibit_id_p)
 {
   /* Frame matrices to work on.  */
   struct glyph_matrix *current_matrix = f->current_matrix;
   struct glyph_matrix *desired_matrix = f->desired_matrix;
   int i;
-  int pause_p;
+  bool pause_p;
   int preempt_count = baud_rate / 2400 + 1;
 
   eassert (current_matrix && desired_matrix);
@@ -4699,7 +4690,7 @@ update_frame_1 (struct frame *f, int force_p, int inhibit_id_p)
        }
     }
 
-  pause_p = (i < FRAME_LINES (f) - 1) ? i : 0;
+  pause_p = 0 < i && i < FRAME_LINES (f) - 1;
 
   /* Now just clean up termcap drivers and set cursor, etc.  */
   if (!pause_p)
@@ -4809,7 +4800,7 @@ update_frame_1 (struct frame *f, int force_p, int inhibit_id_p)
 
 /* Do line insertions/deletions on frame F for frame-based redisplay.  */
 
-static int
+static bool
 scrolling (struct frame *frame)
 {
   int unchanged_at_top, unchanged_at_bottom;
@@ -4952,10 +4943,10 @@ update_frame_line (struct frame *f, int vpos)
   struct glyph_matrix *desired_matrix = f->desired_matrix;
   struct glyph_row *current_row = MATRIX_ROW (current_matrix, vpos);
   struct glyph_row *desired_row = MATRIX_ROW (desired_matrix, vpos);
-  int must_write_whole_line_p;
-  int write_spaces_p = FRAME_MUST_WRITE_SPACES (f);
-  int colored_spaces_p = (FACE_FROM_ID (f, DEFAULT_FACE_ID)->background
-                         != FACE_TTY_DEFAULT_BG_COLOR);
+  bool must_write_whole_line_p;
+  bool write_spaces_p = FRAME_MUST_WRITE_SPACES (f);
+  bool colored_spaces_p = (FACE_FROM_ID (f, DEFAULT_FACE_ID)->background
+                          != FACE_TTY_DEFAULT_BG_COLOR);
 
   if (colored_spaces_p)
     write_spaces_p = 1;
@@ -5289,7 +5280,7 @@ buffer_posn_from_coords (struct window *w, int *x, int *y, struct display_pos *p
   /* start_display takes into account the header-line row, but IT's
      vpos still counts from the glyph row that includes the window's
      start position.  Adjust for a possible header-line row.  */
-  it.vpos += WINDOW_WANTS_HEADER_LINE_P (w) ? 1 : 0;
+  it.vpos += WINDOW_WANTS_HEADER_LINE_P (w);
 
   x0 = *x;
 
@@ -5613,12 +5604,12 @@ window_change_signal (int signalnum) /* If we don't have an argument, */
 #endif /* SIGWINCH */
 
 
-/* Do any change in frame size that was requested by a signal.  SAFE
-   non-zero means this function is called from a place where it is
-   safe to change frame sizes  while a redisplay is in progress.  */
+/* Do any change in frame size that was requested by a signal.
+   SAFE means this function is called from a place where it is
+   safe to change frame sizes while a redisplay is in progress.  */
 
 void
-do_pending_window_change (int safe)
+do_pending_window_change (bool safe)
 {
   /* If window_change_signal should have run before, run it now.  */
   if (redisplaying_p && !safe)
@@ -5645,16 +5636,17 @@ do_pending_window_change (int safe)
 /* Change the frame height and/or width.  Values may be given as zero to
    indicate no change is to take place.
 
-   If DELAY is non-zero, then assume we're being called from a signal
-   handler, and queue the change for later - perhaps the next
-   redisplay.  Since this tries to resize windows, we can't call it
+   If DELAY, assume we're being called from a signal handler, and
+   queue the change for later - perhaps the next redisplay.
+   Since this tries to resize windows, we can't call it
    from a signal handler.
 
-   SAFE non-zero means this function is called from a place where it's
+   SAFE means this function is called from a place where it's
    safe to change frame sizes while a redisplay is in progress.  */
 
 void
-change_frame_size (register struct frame *f, int newheight, int newwidth, int pretend, int delay, int safe)
+change_frame_size (struct frame *f, int newheight, int newwidth,
+                  bool pretend, bool delay, bool safe)
 {
   Lisp_Object tail, frame;
 
@@ -5673,7 +5665,8 @@ change_frame_size (register struct frame *f, int newheight, int newwidth, int pr
 }
 
 static void
-change_frame_size_1 (register struct frame *f, int newheight, int newwidth, int pretend, int delay, int safe)
+change_frame_size_1 (struct frame *f, int newheight, int newwidth,
+                    bool pretend, bool delay, bool safe)
 {
   int new_frame_total_cols;
   ptrdiff_t count = SPECPDL_INDEX ();
@@ -5769,7 +5762,7 @@ change_frame_size_1 (register struct frame *f, int newheight, int newwidth, int
 
   UNBLOCK_INPUT;
 
-  record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
+  record_unwind_current_buffer ();
 
   run_window_configuration_change_hook (f);
 
@@ -5929,13 +5922,13 @@ additional wait period, in milliseconds; this is for backwards compatibility.
 
    TIMEOUT is number of seconds to wait (float or integer),
    or t to wait forever.
-   READING is 1 if reading input.
+   READING is true if reading input.
    If DO_DISPLAY is >0 display process output while waiting.
    If DO_DISPLAY is >1 perform an initial redisplay before waiting.
 */
 
 Lisp_Object
-sit_for (Lisp_Object timeout, int reading, int do_display)
+sit_for (Lisp_Object timeout, bool reading, int do_display)
 {
   intmax_t sec;
   int nsec;
index 0bd632d14b74a8729ec4ed8150e06ee221b4758b..7b451e4e443d402065a1ef4c13ab8c5e0ab972e3 100644 (file)
@@ -946,13 +946,10 @@ BODY is executed just like `progn'.
 usage: (save-current-buffer &rest BODY)  */)
   (Lisp_Object args)
 {
-  Lisp_Object val;
   ptrdiff_t count = SPECPDL_INDEX ();
 
-  record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ());
-
-  val = Fprogn (args);
-  return unbind_to (count, val);
+  record_unwind_current_buffer ();
+  return unbind_to (count, Fprogn (args));
 }
 \f
 DEFUN ("buffer-size", Fbufsize, Sbufsize, 0, 1, 0,
index 9e7efcabbf7dba0bb6260aabbccc7c27f07fbcab..7ff5c43dbeab61de8f7454019aa663e29de50a47 100644 (file)
@@ -279,11 +279,6 @@ static int fatal_error_code;
 /* Nonzero if handling a fatal error already.  */
 int fatal_error_in_progress;
 
-/* If non-null, call this function from fatal_error_signal before
-   committing suicide.  */
-
-static void (*fatal_error_signal_hook) (void);
-
 #ifdef FORWARD_SIGNAL_TO_MAIN_THREAD
 /* When compiled with GTK and running under Gnome,
    multiple threads may be created.  Keep track of our main
@@ -331,9 +326,6 @@ fatal_error_signal (int sig)
   sigunblock (sigmask (fatal_error_code));
 #endif
 
-  if (fatal_error_signal_hook)
-    fatal_error_signal_hook ();
-
   kill (getpid (), fatal_error_code);
 }
 
index c41e3f54d4d38a89114c0b3b85ffdfa88ef4c099..df44c87dc254d3a5f8281a47cfa343f8d2a99698 100644 (file)
@@ -2722,33 +2722,9 @@ DEFUN ("functionp", Ffunctionp, Sfunctionp, 1, 1, 0,
        doc: /* Non-nil if OBJECT is a function.  */)
      (Lisp_Object object)
 {
-  if (SYMBOLP (object) && !NILP (Ffboundp (object)))
-    {
-      object = Findirect_function (object, Qt);
-
-      if (CONSP (object) && EQ (XCAR (object), Qautoload))
-       {
-         /* Autoloaded symbols are functions, except if they load
-            macros or keymaps.  */
-         int i;
-         for (i = 0; i < 4 && CONSP (object); i++)
-           object = XCDR (object);
-
-         return (CONSP (object) && !NILP (XCAR (object))) ? Qnil : Qt;
-       }
-    }
-
-  if (SUBRP (object))
-    return (XSUBR (object)->max_args != UNEVALLED) ? Qt : Qnil;
-  else if (COMPILEDP (object))
+  if (FUNCTIONP (object))
     return Qt;
-  else if (CONSP (object))
-    {
-      Lisp_Object car = XCAR (object);
-      return (EQ (car, Qlambda) || EQ (car, Qclosure)) ? Qt : Qnil;
-    }
-  else
-    return Qnil;
+  return Qnil;
 }
 
 DEFUN ("funcall", Ffuncall, Sfuncall, 1, MANY, 0,
index 6deca0bf1e170cc9a74141dedc743729a2b4a9bf..7466914af1cf13cf4082130ccd511f0ea41a0030 100644 (file)
@@ -3142,8 +3142,7 @@ decide_coding_unwind (Lisp_Object unwind_data)
   undo_list = XCAR (unwind_data);
   buffer = XCDR (unwind_data);
 
-  if (current_buffer != XBUFFER (buffer))
-    set_buffer_internal (XBUFFER (buffer));
+  set_buffer_internal (XBUFFER (buffer));
   adjust_markers_for_delete (BEG, BEG_BYTE, Z, Z_BYTE);
   adjust_overlays_for_delete (BEG, Z - BEG);
   set_buffer_intervals (current_buffer, NULL);
@@ -3481,7 +3480,7 @@ variable `last-coding-system-used' to the coding system actually used.  */)
                  Lisp_Object workbuf;
                  struct buffer *buf;
 
-                 record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
+                 record_unwind_current_buffer ();
 
                  workbuf = Fget_buffer_create (build_string (" *code-converting-work*"));
                  buf = XBUFFER (workbuf);
@@ -3760,7 +3759,8 @@ variable `last-coding-system-used' to the coding system actually used.  */)
       ptrdiff_t temp;
       ptrdiff_t this = 0;
       ptrdiff_t this_count = SPECPDL_INDEX ();
-      int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
+      bool multibyte
+       = ! NILP (BVAR (current_buffer, enable_multibyte_characters));
       Lisp_Object conversion_buffer;
       struct gcpro gcpro1;
 
index 3225fefc5e369e9a22a7d70089a5ad8418ad21f1..f6acdcada3f5aed996452bb5cc1cdc3911f36ccc 100644 (file)
--- a/src/fns.c
+++ b/src/fns.c
@@ -1100,7 +1100,7 @@ an error is signaled.  */)
     {
       ptrdiff_t chars = SCHARS (string);
       unsigned char *str = xmalloc (chars);
-      ptrdiff_t converted = str_to_unibyte (SDATA (string), str, chars, 0);
+      ptrdiff_t converted = str_to_unibyte (SDATA (string), str, chars);
 
       if (converted < chars)
        error ("Can't convert the %"pD"dth character to unibyte", converted);
@@ -4656,13 +4656,12 @@ secure_hash (Lisp_Object algorithm, Lisp_Object object, Lisp_Object start, Lisp_
     {
       struct buffer *prev = current_buffer;
 
-      record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
+      record_unwind_current_buffer ();
 
       CHECK_BUFFER (object);
 
       bp = XBUFFER (object);
-      if (bp != current_buffer)
-       set_buffer_internal (bp);
+      set_buffer_internal (bp);
 
       if (NILP (start))
        b = BEGV;
@@ -4749,8 +4748,7 @@ secure_hash (Lisp_Object algorithm, Lisp_Object object, Lisp_Object start, Lisp_
        }
 
       object = make_buffer_string (b, e, 0);
-      if (prev != current_buffer)
-       set_buffer_internal (prev);
+      set_buffer_internal (prev);
       /* Discard the unwind protect for recovering the current
         buffer.  */
       specpdl_ptr--;
index a00f44a1e5a31bdc3d519d368d42505352a9fe79..4785840a95f2671bdb7b7994770ac3b37c1880fe 100644 (file)
@@ -4247,7 +4247,6 @@ syms_of_frame (void)
   DEFSYM (Qx, "x");
   DEFSYM (Qw32, "w32");
   DEFSYM (Qpc, "pc");
-  DEFSYM (Qmac, "mac");
   DEFSYM (Qns, "ns");
   DEFSYM (Qvisible, "visible");
   DEFSYM (Qbuffer_predicate, "buffer-predicate");
index 92fbda42c709e1a89f99c664bf05e58ffecf48e6..9421aa45414a33afd6581ebe1cc197e5d87d3ab8 100644 (file)
@@ -34,7 +34,7 @@ INLINE_HEADER_BEGIN
 /* Miscellanea.  */
 
 /* Nonzero means there is at least one garbaged frame. */
-extern int frame_garbaged;
+extern bool frame_garbaged;
 
 \f
 /* The structure representing a frame.  */
@@ -621,11 +621,21 @@ typedef struct frame *FRAME_PTR;
 #define FRAME_INITIAL_P(f) ((f)->output_method == output_initial)
 #define FRAME_TERMCAP_P(f) ((f)->output_method == output_termcap)
 #define FRAME_X_P(f) ((f)->output_method == output_x_window)
+#ifndef WINDOWSNT
+#define FRAME_W32_P(f) (0)
+#else
 #define FRAME_W32_P(f) ((f)->output_method == output_w32)
+#endif
+#ifndef MSDOS
+#define FRAME_MSDOS_P(f) (0)
+#else
 #define FRAME_MSDOS_P(f) ((f)->output_method == output_msdos_raw)
-#define FRAME_MAC_P(f) ((f)->output_method == output_mac)
+#endif
+#ifndef HAVE_NS
+#define FRAME_NS_P(f) (0)
+#else
 #define FRAME_NS_P(f) ((f)->output_method == output_ns)
-
+#endif
 /* FRAME_WINDOW_P tests whether the frame is a window, and is
    defined to be the predicate for the window system being used.  */
 
index 1dceb67bffac868b7f00547a7eb797a21d1fbcf6..8cb98566085b98767b42113388c00eb7df60eaf1 100644 (file)
@@ -1779,8 +1779,7 @@ modify_region (struct buffer *buffer, ptrdiff_t start, ptrdiff_t end,
 {
   struct buffer *old_buffer = current_buffer;
 
-  if (buffer != old_buffer)
-    set_buffer_internal (buffer);
+  set_buffer_internal (buffer);
 
   prepare_to_modify_buffer (start, end, NULL);
 
@@ -1794,8 +1793,7 @@ modify_region (struct buffer *buffer, ptrdiff_t start, ptrdiff_t end,
 
   bset_point_before_scroll (buffer, Qnil);
 
-  if (buffer != old_buffer)
-    set_buffer_internal (old_buffer);
+  set_buffer_internal (old_buffer);
 }
 \f
 /* Check that it is okay to modify the buffer between START and END,
@@ -2119,7 +2117,7 @@ DEFUN ("combine-after-change-execute", Fcombine_after_change_execute,
       return Qnil;
     }
 
-  record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
+  record_unwind_current_buffer ();
 
   Fset_buffer (combine_after_change_buffer);
 
index 3d4061accfc03362a25a502edb95b420518fff41..d9b88a8a91120d070b2618b4e45ee2dd18ba999f 100644 (file)
@@ -1434,8 +1434,7 @@ command_loop_1 (void)
        Fkill_emacs (Qnil);
 
       /* Make sure the current window's buffer is selected.  */
-      if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer)
-       set_buffer_internal (XBUFFER (XWINDOW (selected_window)->buffer));
+      set_buffer_internal (XBUFFER (XWINDOW (selected_window)->buffer));
 
       /* Display any malloc warning that just came out.  Use while because
         displaying one warning can cause another.  */
@@ -1513,8 +1512,7 @@ command_loop_1 (void)
       /* A filter may have run while we were reading the input.  */
       if (! FRAME_LIVE_P (XFRAME (selected_frame)))
        Fkill_emacs (Qnil);
-      if (XBUFFER (XWINDOW (selected_window)->buffer) != current_buffer)
-       set_buffer_internal (XBUFFER (XWINDOW (selected_window)->buffer));
+      set_buffer_internal (XBUFFER (XWINDOW (selected_window)->buffer));
 
       ++num_input_keys;
 
@@ -9574,7 +9572,7 @@ read_key_sequence (Lisp_Object *keybuf, int bufsize, Lisp_Object prompt,
                         because we may get input from a subprocess which
                         wants to change the selected window and stuff (say,
                         emacsclient).  */
-                     record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
+                     record_unwind_current_buffer ();
 
                      if (! FRAME_LIVE_P (XFRAME (selected_frame)))
                        Fkill_emacs (Qnil);
@@ -11251,7 +11249,7 @@ The `posn-' functions access elements of such lists.  */)
 
   if (WINDOWP (frame_or_window))
     {
-      struct window *w = decode_valid_window (frame_or_window);
+      struct window *w = decode_live_window (frame_or_window);
 
       XSETINT (x, (XINT (x)
                   + WINDOW_LEFT_EDGE_X (w)
index 21f7dcb5d37f0162a62f1a9bb27149ec973137eb..4031091501cf8b961268ed48d378e91c994c8843 100644 (file)
@@ -1570,9 +1570,7 @@ like in the respective argument of `key-binding'. */)
             would not be a problem here, but it is easier to keep
             things the same.
          */
-
-         record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
-
+         record_unwind_current_buffer ();
          set_buffer_internal (XBUFFER (XWINDOW (window)->buffer));
        }
     }
index d9a7c9d0bdcb1dede1b3d51aa91cee5abb8d2453..49a2832d686024a1e369879094c0348edb864f90 100644 (file)
@@ -606,10 +606,8 @@ clip_to_bounds (ptrdiff_t lower, EMACS_INT num, ptrdiff_t upper)
 
 #define AREF(ARRAY, IDX)       XVECTOR ((ARRAY))->contents[IDX]
 #define ASIZE(ARRAY)           XVECTOR ((ARRAY))->header.size
-/* The IDX==IDX tries to detect when the macro argument is side-effecting.  */
 #define ASET(ARRAY, IDX, VAL)  \
-  (eassert ((IDX) == (IDX)),                           \
-   eassert ((IDX) >= 0 && (IDX) < ASIZE (ARRAY)),      \
+  (eassert (0 <= (IDX) && (IDX) < ASIZE (ARRAY)),      \
    XVECTOR (ARRAY)->contents[IDX] = (VAL))
 
 /* Convenience macros for dealing with Lisp strings.  */
@@ -1906,11 +1904,7 @@ typedef struct {
                         Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object)
 
 /* Non-zero if OBJ is a Lisp function.  */
-#define FUNCTIONP(OBJ)                                 \
-     ((CONSP (OBJ) && EQ (XCAR (OBJ), Qlambda))                \
-      || (SYMBOLP (OBJ) && !NILP (Ffboundp (OBJ)))     \
-      || COMPILEDP (OBJ)                               \
-      || SUBRP (OBJ))
+#define FUNCTIONP(OBJ) functionp(OBJ)
 
 /* defsubr (Sname);
    is how we define the symbol for function `name' at start-up time.  */
@@ -2579,8 +2573,7 @@ extern Lisp_Object Qoverflow_error, Qunderflow_error;
 extern Lisp_Object Qfloatp;
 extern Lisp_Object Qnumberp, Qnumber_or_marker_p;
 
-extern Lisp_Object Qinteger, Qinterval, Qsymbol, Qstring;
-extern Lisp_Object Qmisc, Qvector, Qfloat, Qcons, Qbuffer;
+extern Lisp_Object Qbuffer, Qinteger, Qsymbol;
 
 extern Lisp_Object Qfont_spec, Qfont_entity, Qfont_object;
 
@@ -2627,7 +2620,7 @@ extern _Noreturn void args_out_of_range_3 (Lisp_Object, Lisp_Object,
                                           Lisp_Object);
 extern _Noreturn Lisp_Object wrong_type_argument (Lisp_Object, Lisp_Object);
 extern Lisp_Object do_symval_forwarding (union Lisp_Fwd *);
-extern void set_internal (Lisp_Object, Lisp_Object, Lisp_Object, int);
+extern void set_internal (Lisp_Object, Lisp_Object, Lisp_Object, bool);
 extern void syms_of_data (void);
 extern void init_data (void);
 extern void swap_in_global_binding (struct Lisp_Symbol *);
@@ -2639,7 +2632,7 @@ extern void keys_of_cmds (void);
 /* Defined in coding.c */
 extern Lisp_Object Qcharset;
 extern Lisp_Object detect_coding_system (const unsigned char *, ptrdiff_t,
-                                         ptrdiff_t, int, int, Lisp_Object);
+                                         ptrdiff_t, bool, bool, Lisp_Object);
 extern void init_coding (void);
 extern void init_coding_once (void);
 extern void syms_of_coding (void);
@@ -2773,7 +2766,7 @@ _Noreturn void __executable_start (void);
 #endif
 extern Lisp_Object selected_frame;
 extern Lisp_Object Vwindow_system;
-extern Lisp_Object sit_for (Lisp_Object, int, int);
+extern Lisp_Object sit_for (Lisp_Object, bool, int);
 extern void init_display (void);
 extern void syms_of_display (void);
 
@@ -3110,14 +3103,14 @@ extern void syms_of_editfns (void);
 extern void set_time_zone_rule (const char *);
 
 /* Defined in buffer.c.  */
-extern int mouse_face_overlay_overlaps (Lisp_Object);
+extern bool mouse_face_overlay_overlaps (Lisp_Object);
 extern _Noreturn void nsberror (Lisp_Object);
 extern void adjust_overlays_for_insert (ptrdiff_t, ptrdiff_t);
 extern void adjust_overlays_for_delete (ptrdiff_t, ptrdiff_t);
 extern void fix_start_end_in_overlays (ptrdiff_t, ptrdiff_t);
-extern void report_overlay_modification (Lisp_Object, Lisp_Object, int,
+extern void report_overlay_modification (Lisp_Object, Lisp_Object, bool,
                                          Lisp_Object, Lisp_Object, Lisp_Object);
-extern int overlay_touches_p (ptrdiff_t);
+extern bool overlay_touches_p (ptrdiff_t);
 extern Lisp_Object Vbuffer_alist;
 extern Lisp_Object set_buffer_if_live (Lisp_Object);
 extern Lisp_Object other_buffer_safely (Lisp_Object);
@@ -3330,7 +3323,7 @@ extern void setup_process_coding_systems (Lisp_Object);
 #ifndef DOS_NT
  _Noreturn
 #endif
-extern int child_setup (int, int, int, char **, int, Lisp_Object);
+extern int child_setup (int, int, int, char **, bool, Lisp_Object);
 extern void init_callproc_1 (void);
 extern void init_callproc (void);
 extern void set_initial_environment (void);
@@ -3441,7 +3434,7 @@ extern void syms_of_ccl (void);
 extern void syms_of_dired (void);
 extern Lisp_Object directory_files_internal (Lisp_Object, Lisp_Object,
                                              Lisp_Object, Lisp_Object,
-                                             int, Lisp_Object);
+                                             bool, Lisp_Object);
 
 /* Defined in term.c */
 extern int *char_ins_del_vector;
@@ -3586,7 +3579,7 @@ extern Lisp_Object safe_alloca_unwind (Lisp_Object);
 extern void *record_xmalloc (size_t);
 
 #define USE_SAFE_ALLOCA                        \
-  ptrdiff_t sa_count = SPECPDL_INDEX (); int sa_must_free = 0
+  ptrdiff_t sa_count = SPECPDL_INDEX (); bool sa_must_free = 0
 
 /* SAFE_ALLOCA allocates a simple buffer.  */
 
@@ -3656,6 +3649,38 @@ maybe_gc (void)
     Fgarbage_collect ();
 }
 
+LISP_INLINE int
+functionp (Lisp_Object object)
+{
+  if (SYMBOLP (object) && !NILP (Ffboundp (object)))
+    {
+      object = Findirect_function (object, Qt);
+
+      if (CONSP (object) && EQ (XCAR (object), Qautoload))
+       {
+         /* Autoloaded symbols are functions, except if they load
+            macros or keymaps.  */
+         int i;
+         for (i = 0; i < 4 && CONSP (object); i++)
+           object = XCDR (object);
+
+         return ! (CONSP (object) && !NILP (XCAR (object)));
+       }
+    }
+
+  if (SUBRP (object))
+    return XSUBR (object)->max_args != UNEVALLED;
+  else if (COMPILEDP (object))
+    return 1;
+  else if (CONSP (object))
+    {
+      Lisp_Object car = XCAR (object);
+      return EQ (car, Qlambda) || EQ (car, Qclosure);
+    }
+  else
+    return 0;
+}
+
 INLINE_HEADER_END
 
 #endif /* EMACS_LISP_H */
index bdb292099bcc59416d58abd189920cd48568d062..e5959e0b1a5b4970dddabab80d4082ceba87eea5 100644 (file)
@@ -480,6 +480,7 @@ $(BLD)/alloc.$(O) : \
        $(SRC)/syssignal.h \
        $(SRC)/w32.h \
        $(NT_INC)/unistd.h \
+       $(GNU_LIB)/execinfo.h \
        $(GNU_LIB)/verify.h \
        $(BLOCKINPUT_H) \
        $(BUFFER_H) \
index 2154d1654dfdd8e0f4fd4d275e18339de88451e5..41cc48017eb111d4c728ff5737d67b4776d31e76 100644 (file)
@@ -817,7 +817,7 @@ get_minibuffer (EMACS_INT depth)
         while the buffer doesn't know about them any more.  */
       delete_all_overlays (XBUFFER (buf));
       reset_buffer (XBUFFER (buf));
-      record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
+      record_unwind_current_buffer ();
       Fset_buffer (buf);
       if (!NILP (Ffboundp (intern ("minibuffer-inactive-mode"))))
        call0 (intern ("minibuffer-inactive-mode"));
index e8a0b43a01b3cc82b8c5dd62b33b08fe68acfad1..ab285f26df2c447f1d1ba20e82e160701d9aab52 100644 (file)
@@ -1497,6 +1497,7 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header)
   FlippedView *contentView;
   NSImage *img;
 
+  dialog_return   = Qundefined;
   area.origin.x   = 3*SPACER;
   area.origin.y   = 2*SPACER;
   area.size.width = ICONSIZE;
@@ -1584,7 +1585,7 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header)
 
 - (BOOL)windowShouldClose: (id)sender
 {
-  [NSApp stopModalWithCode: XHASH (Qnil)]; // FIXME: BIG UGLY HACK!!
+  [NSApp stop:self];
   return NO;
 }
 
@@ -1673,7 +1674,11 @@ void process_dialog (id window, Lisp_Object list)
 
   seltag = [[sellist objectAtIndex: 0] tag];
   if (seltag != XHASH (Qundefined)) // FIXME: BIG UGLY HACK!!
-    [NSApp stopModalWithCode: seltag];
+    {
+      dialog_return = seltag;
+      [NSApp stop:self];
+    }
+
   return self;
 }
 
@@ -1756,13 +1761,27 @@ void process_dialog (id window, Lisp_Object list)
  
 - (void)timeout_handler: (NSTimer *)timedEntry
 {
+  NSEvent *nxev = [NSEvent otherEventWithType: NSApplicationDefined
+                            location: NSMakePoint (0, 0)
+                       modifierFlags: 0
+                           timestamp: 0
+                        windowNumber: [[NSApp mainWindow] windowNumber]
+                             context: [NSApp context]
+                             subtype: 0
+                               data1: 0
+                               data2: 0];
+
   timer_fired = 1;
-  [NSApp abortModal];
+  /* We use sto because stopModal/abortModal out of the main loop does not
+     seem to work in 10.6.  But as we use stop we must send a real event so
+     the stop is seen and acted upon.  */
+  [NSApp stop:self];
+  [NSApp postEvent: nxev atStart: NO];
 }
 
 - (Lisp_Object)runDialogAt: (NSPoint)p
 {
-  NSInteger ret = 0;
+  Lisp_Object ret = Qundefined;
 
   while (popup_activated_flag)
     {
@@ -1781,7 +1800,9 @@ void process_dialog (id window, Lisp_Object list)
                                        forMode: NSModalPanelRunLoopMode];
         }
       timer_fired = 0;
+      dialog_return = Qundefined;
       ret = [NSApp runModalForWindow: self];
+      ret = dialog_return;
       if (! timer_fired)
         {
           if (tmo != nil) [tmo invalidate]; /* Cancels timer */
index 54f4a4ec89e035408db73d863eb259b34288fdcf..72b8d13cc473bcc21934966559c221e45419097c 100644 (file)
@@ -196,6 +196,7 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
    NSMatrix *matrix;
    int rows, cols;
    int timer_fired;
+   Lisp_Object dialog_return;
    }
 - initFromContents: (Lisp_Object)menu isQuestion: (BOOL)isQ;
 - addButton: (char *)str value: (Lisp_Object)val row: (int)row;
index 12ca52684e6a124716e0779e6fe8d6aa32525020..c892a5486a7d9819f4dada94cf9c5dda9bf932f4 100644 (file)
@@ -5091,7 +5091,8 @@ not_in_argv (NSString *arg)
       /* TODO: still need this? */
       if (code == 0x2DC)
         code = '~'; /* 0x7E */
-      emacs_event->modifiers = 0;
+      if (code != 32) /* Space */
+        emacs_event->modifiers = 0;
       emacs_event->kind
        = code > 0xFF ? MULTIBYTE_CHAR_KEYSTROKE_EVENT : ASCII_KEYSTROKE_EVENT;
       emacs_event->code = code;
index 64449aeaf2aea6418adcb7eddcce482fe604921c..52c07c79122627dabbcede750747e902e933c37e 100644 (file)
@@ -197,8 +197,7 @@ int print_output_debug_flag EXTERNALLY_VISIBLE = 1;
                               ? PT - start_point : 0),                 \
                  old_point_byte + (old_point_byte >= start_point_byte  \
                                    ? PT_BYTE - start_point_byte : 0)); \
-   if (old != current_buffer)                                          \
-     set_buffer_internal (old);
+   set_buffer_internal (old);
 
 #define PRINTCHAR(ch) printchar (ch, printcharfun)
 
@@ -488,7 +487,7 @@ temp_output_buffer_setup (const char *bufname)
   register struct buffer *old = current_buffer;
   register Lisp_Object buf;
 
-  record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ());
+  record_unwind_current_buffer ();
 
   Fset_buffer (Fget_buffer_create (build_string (bufname)));
 
index 7f6f6bafbeab62d02329dd63b8b4127336d6cff5..fbe56ebcb549ac6021abc47b382df426f0baa8fe 100644 (file)
@@ -4870,15 +4870,13 @@ wait_reading_process_output (intmax_t time_limit, int nsecs, int read_kbd,
       for (channel = 0; channel <= max_input_desc; ++channel)
         {
           struct fd_callback_data *d = &fd_callback_info[channel];
-          if (FD_ISSET (channel, &Available)
-              && d->func != 0
-              && (d->condition & FOR_READ) != 0)
-            d->func (channel, d->data, 1);
-          if (FD_ISSET (channel, &write_mask)
-              && d->func != 0
-              && (d->condition & FOR_WRITE) != 0)
-            d->func (channel, d->data, 0);
-          }
+          if (d->func
+             && ((d->condition & FOR_READ
+                  && FD_ISSET (channel, &Available))
+                 || (d->condition & FOR_WRITE
+                     && FD_ISSET (channel, &write_mask))))
+            d->func (channel, d->data);
+       }
 
       for (channel = 0; channel <= max_process_desc; channel++)
        {
@@ -5198,7 +5196,7 @@ read_process_output (Lisp_Object proc, register int channel)
   /* There's no good reason to let process filters change the current
      buffer, and many callers of accept-process-output, sit-for, and
      friends don't expect current-buffer to be changed from under them.  */
-  record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ());
+  record_unwind_current_buffer ();
 
   /* Read and dispose of the process output.  */
   outstream = p->filter;
@@ -6589,7 +6587,7 @@ exec_sentinel (Lisp_Object proc, Lisp_Object reason)
   /* There's no good reason to let sentinels change the current
      buffer, and many callers of accept-process-output, sit-for, and
      friends don't expect current-buffer to be changed from under them.  */
-  record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ());
+  record_unwind_current_buffer ();
 
   sentinel = p->sentinel;
   if (NILP (sentinel))
index 55a572117c6f00acfd3976887984fa4b8862b478..ce3d2e702cc239c907419d70fd0890ffe52d3cfa 100644 (file)
@@ -184,7 +184,7 @@ pset_gnutls_cred_type (struct Lisp_Process *p, Lisp_Object val)
 
 /* True if we are about to fork off a synchronous process or if we
    are waiting for it.  */
-extern int synch_process_alive;
+extern bool synch_process_alive;
 
 /* Communicate exit status of sync process to from sigchld_handler
    to Fcall_process.  */
@@ -219,7 +219,7 @@ extern void hold_keyboard_input (void);
 extern void unhold_keyboard_input (void);
 extern int kbd_on_hold_p (void);
 
-typedef void (*fd_callback)(int fd, void *data, int for_read);
+typedef void (*fd_callback) (int fd, void *data);
 
 extern void add_read_fd (int fd, fd_callback func, void *data);
 extern void delete_read_fd (int fd);
index 20d98b0e6f31b42e2a4e7420d7793cc59a5997f7..b6895fc426a0ad8dc7e73c2669a2cf0768705ccd 100644 (file)
@@ -760,7 +760,7 @@ past position LIMIT; return LIMIT if nothing is found before LIMIT.  */)
 
       if (BUFFERP (object) && current_buffer != XBUFFER (object))
        {
-         record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
+         record_unwind_current_buffer ();
          Fset_buffer (object);
        }
 
@@ -843,7 +843,7 @@ position LIMIT; return LIMIT if nothing is found before reaching LIMIT.  */)
 
       if (BUFFERP (object) && current_buffer != XBUFFER (object))
        {
-         record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
+         record_unwind_current_buffer ();
          Fset_buffer (object);
        }
 
index 777e3291806246a48615297dd628e34d354889fc..9cd1d5f9f67b8a57b3eb54679f96fd635c7b77ab 100644 (file)
@@ -324,7 +324,7 @@ truncate_undo_list (struct buffer *b)
   /* Make the buffer current to get its local values of variables such
      as undo_limit.  Also so that Vundo_outer_limit_function can
      tell which buffer to operate on.  */
-  record_unwind_protect (set_buffer_if_live, Fcurrent_buffer ());
+  record_unwind_current_buffer ();
   set_buffer_internal (b);
 
   list = BVAR (b, undo_list);
index b460660cb8c09f88fc8838cd0e0a51239dae4f27..84a46e522bb9f27792867c6f9d37f8d8b8252c93 100644 (file)
--- a/src/w32.c
+++ b/src/w32.c
@@ -4098,7 +4098,7 @@ symlink (char const *filename, char const *linkname)
     dir_access = sys_access (filename, D_OK);
 
   /* Since Windows distinguishes between symlinks to directories and
-     to files, we provide a kludgey feature: if FILENAME doesn't
+     to files, we provide a kludgy feature: if FILENAME doesn't
      exist, but ends in a slash, we create a symlink to directory.  If
      FILENAME exists and is a directory, we always create a symlink to
      directory.  */
@@ -4165,7 +4165,7 @@ symlink (char const *filename, char const *linkname)
    whether the underlying volume actually supports symlinks, by
    testing the FILE_SUPPORTS_REPARSE_POINTS bit in volume's flags, and
    avoid the call to this function if it doesn't.  That's because the
-   call to GetFileAttributes takes a non-negligible time, expecially
+   call to GetFileAttributes takes a non-negligible time, especially
    on non-local or removable filesystems.  See stat_worker for an
    example of how to do that.  */
 static int
index 4d92566b243ece497b3f6bf92081f533fc762dd3..ba1ec2544f8177527faca36d67b150e80c58076d 100644 (file)
@@ -54,7 +54,8 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #include "nsterm.h"
 #endif
 
-Lisp_Object Qwindowp, Qwindow_live_p, Qwindow_valid_p;
+Lisp_Object Qwindowp, Qwindow_live_p;
+static Lisp_Object Qwindow_valid_p;
 static Lisp_Object Qwindow_configuration_p, Qrecord_window_buffer;
 static Lisp_Object Qwindow_deletable_p, Qdelete_window, Qdisplay_buffer;
 static Lisp_Object Qreplace_buffer_in_windows, Qget_mru_window;
@@ -268,7 +269,7 @@ decode_any_window (register Lisp_Object window)
   return w;
 }
 
-struct window *
+static struct window *
 decode_valid_window (register Lisp_Object window)
 {
   struct window *w;
@@ -1968,6 +1969,9 @@ unshow_buffer (register struct window *w)
      is actually stored in that buffer, and the window's pointm isn't used.
      So don't clobber point in that buffer.  */
   if (! EQ (buf, XWINDOW (selected_window)->buffer)
+      /* Don't clobber point in current buffer either (this could be
+        useful in connection with bug#12208).
+      && XBUFFER (buf) != current_buffer  */
       /* This line helps to fix Horsley's testbug.el bug.  */
       && !(WINDOWP (BVAR (b, last_selected_window))
           && w != XWINDOW (BVAR (b, last_selected_window))
@@ -3097,7 +3101,7 @@ run_window_configuration_change_hook (struct frame *f)
   /* Use the right buffer.  Matters when running the local hooks.  */
   if (current_buffer != XBUFFER (Fwindow_buffer (Qnil)))
     {
-      record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
+      record_unwind_current_buffer ();
       Fset_buffer (Fwindow_buffer (Qnil));
     }
 
@@ -3134,7 +3138,7 @@ run_window_configuration_change_hook (struct frame *f)
 DEFUN ("run-window-configuration-change-hook", Frun_window_configuration_change_hook,
        Srun_window_configuration_change_hook, 1, 1, 0,
        doc: /* Run `window-configuration-change-hook' for FRAME.  */)
-     (Lisp_Object frame)
+  (Lisp_Object frame)
 {
   CHECK_LIVE_FRAME (frame);
   run_window_configuration_change_hook (XFRAME (frame));
@@ -3201,7 +3205,7 @@ set_window_buffer (Lisp_Object window, Lisp_Object buffer, int run_hooks_p, int
      because that might itself be a local variable.  */
   if (window_initialized)
     {
-      record_unwind_protect (Fset_buffer, Fcurrent_buffer ());
+      record_unwind_current_buffer ();
       Fset_buffer (buffer);
     }
 
@@ -5899,7 +5903,13 @@ the return value is nil.  Otherwise the value is t.  */)
     }
 
   if (!NILP (new_current_buffer))
-    Fset_buffer (new_current_buffer);
+    {
+      Fset_buffer (new_current_buffer);
+      /* If the new current buffer doesn't appear in the selected
+        window, go to its old point (see bug#12208).  */
+      if (!EQ (XWINDOW (data->current_window)->buffer, new_current_buffer))
+       Fgoto_char (make_number (old_point));
+    }
 
   Vminibuf_scroll_window = data->minibuf_scroll_window;
   minibuf_selected_window = data->minibuf_selected_window;
index 28b9678b667aceab893224a7cde4b615276656b9..dfb88b2cf3c6867d31a821a81d8f648652f4c866 100644 (file)
@@ -972,7 +972,6 @@ struct glyph *get_phys_cursor_glyph (struct window *w);
 extern Lisp_Object Qwindowp, Qwindow_live_p;
 extern Lisp_Object Vwindow_list;
 
-extern struct window *decode_valid_window (Lisp_Object);
 extern struct window *decode_live_window (Lisp_Object);
 extern int compare_window_configurations (Lisp_Object, Lisp_Object, int);
 extern void mark_window_cursors_off (struct window *);
index f5edb4b16f873784625468d36b939739ac837539..13b03736bde05044d012b6aa7db3e19437b9e36f 100644 (file)
@@ -2420,7 +2420,7 @@ remember_mouse_glyph (struct frame *f, int gx, int gy, NativeRectangle *rect)
 static Lisp_Object
 safe_eval_handler (Lisp_Object arg, ptrdiff_t nargs, Lisp_Object *args)
 {
-  add_to_log ("Error during redisplay: %S signalled %S",
+  add_to_log ("Error during redisplay: %S signaled %S",
              Flist (nargs, args), arg);
   return Qnil;
 }
@@ -14551,8 +14551,7 @@ run_window_scroll_functions (Lisp_Object window, struct text_pos startp)
                            make_number (CHARPOS (startp)));
       SET_TEXT_POS_FROM_MARKER (startp, w->start);
       /* In case the hook functions switch buffers.  */
-      if (current_buffer != XBUFFER (w->buffer))
-       set_buffer_internal_1 (XBUFFER (w->buffer));
+      set_buffer_internal (XBUFFER (w->buffer));
     }
 
   return startp;
@@ -15380,7 +15379,7 @@ set_vertical_scroll_bar (struct window *w)
    selected_window is redisplayed.
 
    We can return without actually redisplaying the window if
-   fonts_changed_p is nonzero.  In that case, redisplay_internal will
+   fonts_changed_p.  In that case, redisplay_internal will
    retry.  */
 
 static void
@@ -16224,7 +16223,7 @@ redisplay_window (Lisp_Object window, int just_this_one_p)
     }
 #endif /* HAVE_WINDOW_SYSTEM */
 
-  /* We go to this label, with fonts_changed_p nonzero,
+  /* We go to this label, with fonts_changed_p set,
      if it is necessary to try again using larger glyph matrices.
      We have to redeem the scroll bar even in this case,
      because the loop in redisplay_internal expects that.  */
@@ -17705,15 +17704,15 @@ try_window_id (struct window *w)
     {
       rotate_matrix (current_matrix, first_unchanged_at_end_vpos + dvpos,
                     bottom_vpos, dvpos);
-      enable_glyph_matrix_rows (current_matrix, bottom_vpos + dvpos,
-                               bottom_vpos, 0);
+      clear_glyph_matrix_rows (current_matrix, bottom_vpos + dvpos,
+                              bottom_vpos);
     }
   else if (dvpos > 0)
     {
       rotate_matrix (current_matrix, first_unchanged_at_end_vpos,
                     bottom_vpos, dvpos);
-      enable_glyph_matrix_rows (current_matrix, first_unchanged_at_end_vpos,
-                               first_unchanged_at_end_vpos + dvpos, 0);
+      clear_glyph_matrix_rows (current_matrix, first_unchanged_at_end_vpos,
+                              first_unchanged_at_end_vpos + dvpos);
     }
 
   /* For frame-based redisplay, make sure that current frame and window
index 04ca00274e8ac821512636d016bcbdb215d7764c..0c00d815820b0e191fc91471d8372bee5ca8e097 100644 (file)
@@ -29,9 +29,6 @@ along with GNU Emacs.  If not, see <http§://www.gnu.org/licenses/>.  */
 #include <setjmp.h>
 #include "xterm.h"
 
-static GPollFD *gfds;
-static ptrdiff_t gfds_size;
-
 int
 xg_select (int fds_lim, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
           EMACS_TIME *timeout, sigset_t *sigmask)
@@ -41,35 +38,31 @@ xg_select (int fds_lim, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
 
   GMainContext *context;
   int have_wfds = wfds != NULL;
-  int n_gfds = 0, retval = 0, our_fds = 0, max_fds = fds_lim - 1;
+  GPollFD gfds_buf[128];
+  GPollFD *gfds = gfds_buf;
+  int gfds_size = sizeof gfds_buf / sizeof *gfds_buf;
+  int n_gfds, retval = 0, our_fds = 0, max_fds = fds_lim - 1;
   int i, nfds, tmo_in_millisec;
+  USE_SAFE_ALLOCA;
 
-  if (!x_in_use)
-    return pselect (fds_lim, rfds, wfds, efds, tmop, sigmask);
+  if (! (x_in_use
+        && g_main_context_pending (context = g_main_context_default ())))
+    return pselect (fds_lim, rfds, wfds, efds, timeout, sigmask);
 
   if (rfds) memcpy (&all_rfds, rfds, sizeof (all_rfds));
   else FD_ZERO (&all_rfds);
   if (wfds) memcpy (&all_wfds, wfds, sizeof (all_rfds));
   else FD_ZERO (&all_wfds);
 
-  /* Update event sources in GLib. */
-  context = g_main_context_default ();
-  g_main_context_pending (context);
-
-  do {
-    if (n_gfds > gfds_size)
-      {
-        xfree (gfds);
-       gfds = xpalloc (0, &gfds_size, n_gfds - gfds_size, INT_MAX,
-                       sizeof *gfds);
-      }
-
-    n_gfds = g_main_context_query (context,
-                                   G_PRIORITY_LOW,
-                                   &tmo_in_millisec,
-                                   gfds,
-                                   gfds_size);
-  } while (n_gfds > gfds_size);
+  n_gfds = g_main_context_query (context, G_PRIORITY_LOW, &tmo_in_millisec,
+                                gfds, gfds_size);
+  if (gfds_size < n_gfds)
+    {
+      SAFE_NALLOCA (gfds, sizeof *gfds, n_gfds);
+      gfds_size = n_gfds;
+      n_gfds = g_main_context_query (context, G_PRIORITY_LOW, &tmo_in_millisec,
+                                    gfds, gfds_size);
+    }
 
   for (i = 0; i < n_gfds; ++i)
     {
@@ -86,6 +79,8 @@ xg_select (int fds_lim, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
         }
     }
 
+  SAFE_FREE ();
+
   if (tmo_in_millisec >= 0)
     {
       tmo = make_emacs_time (tmo_in_millisec / 1000,
@@ -147,12 +142,3 @@ xg_select (int fds_lim, SELECT_TYPE *rfds, SELECT_TYPE *wfds, SELECT_TYPE *efds,
   return retval;
 }
 #endif /* USE_GTK || HAVE_GCONF || HAVE_GSETTINGS */
-
-void
-xgselect_initialize (void)
-{
-#if defined (USE_GTK) || defined (HAVE_GCONF) || defined (HAVE_GSETTINGS)
-  gfds_size = 128;
-  gfds = xmalloc (gfds_size * sizeof *gfds);
-#endif
-}
index 8e5614ea972854aed0c4dc5d4dd7f2985629df06..5509e23c5c0de7c5cfc447fe7eaa75480db1521a 100644 (file)
@@ -31,6 +31,4 @@ extern int xg_select (int max_fds,
                       EMACS_TIME *timeout,
                      sigset_t *sigmask);
 
-extern void xgselect_initialize (void);
-
 #endif /* XGSELECT_H */
index 1f6eb84260e7dc9e648568312ea5f1a2819a26c7..cddbb2aae86e9ecc0a3602c318e410477604ced1 100644 (file)
@@ -97,7 +97,7 @@ ice_connection_closed (void)
    open to a session manager, just return.  */
 
 static void
-x_session_check_input (int fd, void *data, int for_read)
+x_session_check_input (int fd, void *data)
 {
   int ret;
 
index 118c8767c23e55c72a9e00a67d1f22954fe87d3e..7e61cc4d8eae139bec48f5efb0c0940e4c1956a2 100644 (file)
@@ -10815,8 +10815,6 @@ x_initialize (void)
   XSetIOErrorHandler (x_io_error_quitter);
 
   signal (SIGPIPE, x_connection_signal);
-
-  xgselect_initialize ();
 }