diff options
213 files changed, 6720 insertions, 3593 deletions
diff --git a/ChangeLog b/ChangeLog index 4a531145e20..a6b66dbc3e2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,78 @@ +2012-09-04 Paul Eggert <eggert@cs.ucla.edu> + + * configure.ac (_setjmp, _longjmp): Check by compiling + instead of by guessing. The guesses were wrong for + recent versions of Solaris, such as Solaris 11. + +2012-09-03 Paul Eggert <eggert@cs.ucla.edu> + + * configure.ac (WARN_CFLAGS): Omit -Wjump-misses-init. + It generates false alarms in doc.c, regex.c, xdisp.c. See + <http://lists.gnu.org/archive/html/emacs-devel/2012-09/msg00040.html>. + + Merge from gnulib, incorporating: + 2012-08-29 stdbool: be more compatible with mixed C/C++ compiles + 2011-11-30 manywarnings: update the list of "all" warnings + +2012-09-02 Jan Djärv <jan.h.d@swipnet.se> + + * configure.ac (HAVE_GOBJECT): Check for gobject-2.0 (Bug#12332). + +2012-09-01 Paul Eggert <eggert@cs.ucla.edu> + + * configure.ac (_FORTIFY_SOURCE): Define only when optimizing. + This ports to glibc 2.15 or later, when configured with + --enable-gcc-warnings. See Eric Blake in + <http://lists.gnu.org/archive/html/bug-grep/2012-09/msg00000.html>. + +2012-09-01 Daniel Colascione <dan.colascione@gmail.com> + + * configure.ac: Introduce term_header variable, which holds the + value which will become TERM_HEADER in code. We effect our choice + of window system by setting term_header and WINDOW_SYSTEM_OBJ + instead of using ad-hoc variables and flags for each window + system. + +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, + do not create the bin/emacs link. (Bug#12011) + +2012-08-21 Paul Eggert <eggert@cs.ucla.edu> + + Merge from gnulib, incorporating: + 2012-08-20 extern-inline: support old GCC 'inline' + +2012-08-20 Glenn Morris <rgm@gnu.org> + + * configure.ac (AC_PROG_LN_S): Test for ln. + * Makefile.in (LN_S): New, set by configure. + (install-arch-dep): Use $LN_S. + 2012-08-19 Paul Eggert <eggert@cs.ucla.edu> Merge from gnulib, incorporating: diff --git a/Makefile.in b/Makefile.in index ab9f16c0353..122a35d4416 100644 --- a/Makefile.in +++ b/Makefile.in @@ -246,6 +246,7 @@ INSTALL_INFO = @INSTALL_INFO@ # By default, we uphold the dignity of our programs. INSTALL_STRIP = MKDIR_P = @MKDIR_P@ +LN_S = @LN_S@ # We use gzip to compress installed .el files. GZIP_PROG = @GZIP_PROG@ @@ -436,8 +437,10 @@ install-arch-dep: install-arch-indep install-doc if test "${ns_self_contained}" = "no"; then \ ${INSTALL_PROGRAM} $(INSTALL_STRIP) src/emacs${EXEEXT} $(DESTDIR)${bindir}/$(EMACSFULL) || exit 1 ; \ chmod 1755 $(DESTDIR)${bindir}/$(EMACSFULL) ; \ - rm -f $(DESTDIR)${bindir}/$(EMACS) ; \ - ln $(DESTDIR)${bindir}/$(EMACSFULL) $(DESTDIR)${bindir}/$(EMACS) || true ; \ + if test "x${NO_BIN_LINK}" = x; then \ + rm -f $(DESTDIR)${bindir}/$(EMACS) ; \ + cd $(DESTDIR)${bindir} && $(LN_S) $(EMACSFULL) $(EMACS); \ + fi; \ else \ subdir=${ns_appresdir}/site-lisp; \ ${write_subdir} || exit 1; \ diff --git a/admin/ChangeLog b/admin/ChangeLog index ea977e80cfa..145028ec815 100644 --- a/admin/ChangeLog +++ b/admin/ChangeLog @@ -1,3 +1,16 @@ +2012-08-28 Glenn Morris <rgm@gnu.org> + + * bzrmerge.el (bzrmerge-merges): Allow unversioned files in the tree. + +2012-08-28 Andreas Schwab <schwab@linux-m68k.org> + + * charsets/mule-charsets.el (header): Fix typo. + +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. diff --git a/admin/bzrmerge.el b/admin/bzrmerge.el index e174312143d..8d64dd9edbf 100644 --- a/admin/bzrmerge.el +++ b/admin/bzrmerge.el @@ -45,16 +45,23 @@ The list returned is sorted by oldest-first." (erase-buffer) ;; We generally want to make sure we start with a clean tree, but we also ;; want to allow restarts (i.e. with some part of FROM already merged but - ;; not yet committed). + ;; not yet committed). Unversioned (unknown) files in the tree + ;; are also ok. (call-process "bzr" nil t nil "status" "-v") (goto-char (point-min)) (when (re-search-forward "^conflicts:\n" nil t) (error "You still have unresolved conflicts")) - (let ((merges ())) + (let ((merges ()) + found) (if (not (re-search-forward "^pending merges:\n" nil t)) (when (save-excursion (goto-char (point-min)) - (re-search-forward "^[a-z ]*:\n" nil t)) + (while (and + (re-search-forward "^\\([a-z ]*\\):\n" nil t) + (not + (setq found + (not (equal "unknown" (match-string 1))))))) + found) (error "You still have uncommitted changes")) ;; This is really stupid, but it seems there's no easy way to figure ;; out which revisions have been merged already. The only info I can diff --git a/admin/charsets/mule-charsets.el b/admin/charsets/mule-charsets.el index 9ac08bef724..4a48d994b1b 100644 --- a/admin/charsets/mule-charsets.el +++ b/admin/charsets/mule-charsets.el @@ -45,7 +45,7 @@ (defconst header (format - "# Generated by running amdin/charsets/mule-charsets.el in Emacs %d.%d.\n" + "# Generated by running admin/charsets/mule-charsets.el in Emacs %d.%d.\n" emacs-major-version emacs-minor-version)) (dolist (elt charset-alist) diff --git a/admin/merge-gnulib b/admin/merge-gnulib index 63865edf3ce..775d43e68d3 100755 --- a/admin/merge-gnulib +++ b/admin/merge-gnulib @@ -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 diff --git a/autogen/Makefile.in b/autogen/Makefile.in index 16af943f331..dbedb5d12e5 100644 --- a/autogen/Makefile.in +++ b/autogen/Makefile.in @@ -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@ @@ -357,6 +359,8 @@ GNULIB_WRITE = @GNULIB_WRITE@ GNULIB__EXIT = @GNULIB__EXIT@ GNUSTEP_CFLAGS = @GNUSTEP_CFLAGS@ GNU_OBJC_CFLAGS = @GNU_OBJC_CFLAGS@ +GOBJECT_CFLAGS = @GOBJECT_CFLAGS@ +GOBJECT_LIBS = @GOBJECT_LIBS@ GREP = @GREP@ GSETTINGS_CFLAGS = @GSETTINGS_CFLAGS@ GSETTINGS_LIBS = @GSETTINGS_LIBS@ @@ -556,11 +560,13 @@ 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@ LIB_PTHREAD_SIGMASK = @LIB_PTHREAD_SIGMASK@ LIB_STANDARD = @LIB_STANDARD@ +LN_S = @LN_S@ LTLIBINTL = @LTLIBINTL@ LTLIBOBJS = @LTLIBOBJS@ M17N_FLT_CFLAGS = @M17N_FLT_CFLAGS@ @@ -751,6 +757,7 @@ WERROR_CFLAGS = @WERROR_CFLAGS@ WIDGET_OBJ = @WIDGET_OBJ@ WINDOWS_64_BIT_OFF_T = @WINDOWS_64_BIT_OFF_T@ WINDOWS_64_BIT_ST_SIZE = @WINDOWS_64_BIT_ST_SIZE@ +WINDOW_SYSTEM_OBJ = @WINDOW_SYSTEM_OBJ@ WINT_T_SUFFIX = @WINT_T_SUFFIX@ XFT_CFLAGS = @XFT_CFLAGS@ XFT_LIBS = @XFT_LIBS@ @@ -844,16 +851,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 \ @@ -865,14 +873,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 @@ -883,8 +892,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 @@ -953,6 +962,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@ @@ -1212,6 +1222,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) diff --git a/autogen/aclocal.m4 b/autogen/aclocal.m4 index f7ef80bb805..38f7863ba9d 100644 --- a/autogen/aclocal.m4 +++ b/autogen/aclocal.m4 @@ -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]) diff --git a/autogen/config.in b/autogen/config.in index bd10c9f4076..59bc8dca231 100644 --- a/autogen/config.in +++ b/autogen/config.in @@ -161,6 +161,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ or signaling SIGFPE/SIGILL. */ #undef FLOAT_CHECK_DOMAIN +/* Enable compile-time and run-time bounds-checking, and some warnings, + without upsetting glibc 2.15+. */ + #if defined __OPTIMIZE__ && __OPTIMIZE__ + # define _FORTIFY_SOURCE 2 + #endif + + /* Define to 1 if futimesat mishandles a NULL file name. */ #undef FUTIMESAT_NULL_BUG @@ -358,6 +365,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 @@ -1342,6 +1352,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* Define to 1 if you use terminfo instead of termcap. */ #undef TERMINFO +/* Define to the header for the built-in window system. */ +#undef TERM_HEADER + /* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ #undef TIME_WITH_SYS_TIME @@ -1452,9 +1465,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* Number of bits in a file offset, on hosts where this is settable. */ #undef _FILE_OFFSET_BITS -/* enable compile-time and run-time bounds-checking, and some warnings */ -#undef _FORTIFY_SOURCE - /* Define to 1 if Gnulib overrides 'struct stat' on Windows so that struct stat.st_size becomes 64-bit. */ #undef _GL_WINDOWS_64_BIT_ST_SIZE @@ -1532,10 +1542,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ declarations. Define as empty for no equivalent. */ #undef __restrict_arr -/* Some platforms redefine this. */ +/* Define to longjmp if _setjmp and _longjmp do not work. Because longjmp may + alter signal masks, callers of _longjmp should not assume that it leaves + signal masks alone. */ #undef _longjmp -/* Some platforms redefine this. */ +/* Define to setjmp if _setjmp and _longjmp do not work. See _longjmp. */ #undef _setjmp /* Some platforms that do not use configure define this to include extra @@ -1554,20 +1566,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 diff --git a/autogen/configure b/autogen/configure index 7efbd25f0d6..885b6f4b471 100755 --- a/autogen/configure +++ b/autogen/configure @@ -604,6 +604,7 @@ am__EXEEXT_TRUE LTLIBOBJS LIBOBJS SUBDIR_MAKEFILES_IN +WINDOW_SYSTEM_OBJ LIB_GCC LD_FIRSTFLAG LD_SWITCH_SYSTEM_TEMACS @@ -971,6 +972,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 @@ -1176,6 +1181,8 @@ LIBGNUTLS_CFLAGS LIBSELINUX_LIBS SETTINGS_LIBS SETTINGS_CFLAGS +GOBJECT_LIBS +GOBJECT_CFLAGS GCONF_LIBS GCONF_CFLAGS GSETTINGS_LIBS @@ -1224,6 +1231,7 @@ HAVE_MAKEINFO PAXCTL GZIP_PROG INSTALL_INFO +LN_S GNULIB_WARN_CFLAGS WARN_CFLAGS WERROR_CFLAGS @@ -3193,6 +3201,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" @@ -6955,6 +6964,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: @@ -7020,6 +7030,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 @@ -7159,6 +7218,7 @@ fi nw="$nw -Wswitch-default" # Too many warnings for now nw="$nw -Wfloat-equal" # warns about high-quality code nw="$nw -Winline" # OK to ignore 'inline' + nw="$nw -Wjump-misses-init" # We sometimes safely jump over init. nw="$nw -Wsync-nand" # irrelevant here, and provokes ObjC warning nw="$nw -Wunsafe-loop-optimizations" # OK to suppress unsafe optimizations @@ -7248,95 +7308,118 @@ $as_echo "$gl_cv_cc_nomfi_needed" >&6; } gl_manywarn_set= for gl_manywarn_item in \ - -Wall \ -W \ - -Wformat-y2k \ - -Wformat-nonliteral \ - -Wformat-security \ - -Winit-self \ - -Wmissing-include-dirs \ - -Wswitch-default \ - -Wswitch-enum \ - -Wunused \ - -Wunknown-pragmas \ - -Wstrict-aliasing \ - -Wstrict-overflow \ - -Wsystem-headers \ - -Wfloat-equal \ - -Wtraditional \ - -Wtraditional-conversion \ - -Wdeclaration-after-statement \ - -Wundef \ - -Wshadow \ - -Wunsafe-loop-optimizations \ - -Wpointer-arith \ + -Wabi \ + -Waddress \ + -Wall \ + -Warray-bounds \ + -Wattributes \ -Wbad-function-cast \ - -Wc++-compat \ - -Wcast-qual \ - -Wcast-align \ - -Wwrite-strings \ - -Wconversion \ - -Wsign-conversion \ - -Wlogical-op \ - -Waggregate-return \ - -Wstrict-prototypes \ - -Wold-style-definition \ - -Wmissing-prototypes \ - -Wmissing-declarations \ - -Wmissing-noreturn \ - -Wmissing-format-attribute \ - -Wpacked \ - -Wpadded \ - -Wredundant-decls \ - -Wnested-externs \ - -Wunreachable-code \ - -Winline \ - -Winvalid-pch \ - -Wlong-long \ - -Wvla \ - -Wvolatile-register-var \ - -Wdisabled-optimization \ - -Wstack-protector \ - -Woverlength-strings \ -Wbuiltin-macro-redefined \ - -Wmudflap \ - -Wpacked-bitfield-compat \ - -Wsync-nand \ - ; do - gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item" - done - # The following are not documented in the manual but are included in - # output from gcc --help=warnings. - for gl_manywarn_item in \ - -Wattributes \ + -Wcast-align \ + -Wchar-subscripts \ + -Wclobbered \ + -Wcomment \ + -Wcomments \ -Wcoverage-mismatch \ - -Wunused-macros \ - ; do - gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item" - done - # More warnings from gcc 4.6.2 --help=warnings. - for gl_manywarn_item in \ - -Wabi \ -Wcpp \ -Wdeprecated \ -Wdeprecated-declarations \ + -Wdisabled-optimization \ -Wdiv-by-zero \ -Wdouble-promotion \ + -Wempty-body \ -Wendif-labels \ + -Wenum-compare \ -Wextra \ -Wformat-contains-nul \ -Wformat-extra-args \ + -Wformat-nonliteral \ + -Wformat-security \ + -Wformat-y2k \ -Wformat-zero-length \ -Wformat=2 \ + -Wfree-nonheap-object \ + -Wignored-qualifiers \ + -Wimplicit \ + -Wimplicit-function-declaration \ + -Wimplicit-int \ + -Winit-self \ + -Winline \ + -Wint-to-pointer-cast \ + -Winvalid-memory-model \ + -Winvalid-pch \ + -Wjump-misses-init \ + -Wlogical-op \ + -Wmain \ + -Wmaybe-uninitialized \ + -Wmissing-braces \ + -Wmissing-declarations \ + -Wmissing-field-initializers \ + -Wmissing-format-attribute \ + -Wmissing-include-dirs \ + -Wmissing-noreturn \ + -Wmissing-parameter-type \ + -Wmissing-prototypes \ + -Wmudflap \ -Wmultichar \ + -Wnarrowing \ + -Wnested-externs \ + -Wnonnull \ -Wnormalized=nfc \ + -Wold-style-declaration \ + -Wold-style-definition \ -Woverflow \ + -Woverlength-strings \ + -Woverride-init \ + -Wpacked \ + -Wpacked-bitfield-compat \ + -Wparentheses \ + -Wpointer-arith \ + -Wpointer-sign \ -Wpointer-to-int-cast \ -Wpragmas \ + -Wreturn-type \ + -Wsequence-point \ + -Wshadow \ + -Wsizeof-pointer-memaccess \ + -Wstack-protector \ + -Wstrict-aliasing \ + -Wstrict-overflow \ + -Wstrict-prototypes \ -Wsuggest-attribute=const \ + -Wsuggest-attribute=format \ -Wsuggest-attribute=noreturn \ -Wsuggest-attribute=pure \ + -Wswitch \ + -Wswitch-default \ + -Wsync-nand \ + -Wsystem-headers \ -Wtrampolines \ + -Wtrigraphs \ + -Wtype-limits \ + -Wuninitialized \ + -Wunknown-pragmas \ + -Wunreachable-code \ + -Wunsafe-loop-optimizations \ + -Wunused \ + -Wunused-but-set-parameter \ + -Wunused-but-set-variable \ + -Wunused-function \ + -Wunused-label \ + -Wunused-local-typedefs \ + -Wunused-macros \ + -Wunused-parameter \ + -Wunused-result \ + -Wunused-value \ + -Wunused-variable \ + -Wvarargs \ + -Wvariadic-macros \ + -Wvector-operation-performance \ + -Wvla \ + -Wvolatile-register-var \ + -Wwrite-strings \ + \ ; do gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item" done @@ -7727,8 +7810,6 @@ fi $as_echo "#define lint 1" >>confdefs.h -$as_echo "#define _FORTIFY_SOURCE 2" >>confdefs.h - $as_echo "#define GNULIB_PORTCHECK 1" >>confdefs.h @@ -7758,6 +7839,17 @@ fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 +$as_echo_n "checking whether ln -s works... " >&6; } +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 +$as_echo "no, using $LN_S" >&6; } +fi + # Extract the first word of "install-info", so it can be a program name with args. set dummy install-info; ac_word=$2 @@ -9082,6 +9174,12 @@ fi #### Choose a window system. +## We leave window_system equal to none if +## we end up building without one. Any new window system should +## set window_system to an appropriate value and add objects to +## window-system-specific substs. + +window_system=none { $as_echo "$as_me:${as_lineno-$LINENO}: checking for X" >&5 $as_echo_n "checking for X... " >&6; } @@ -9275,9 +9373,7 @@ else $as_echo "libraries $x_libraries, headers $x_includes" >&6; } fi -if test "$no_x" = yes; then - window_system=none -else +if test "$no_x" != yes; then window_system=x11 fi @@ -9452,7 +9548,6 @@ if test "${HAVE_NS}" = yes; then fi window_system=nextstep - with_xft=no # set up packaging dirs if test "${EN_NS_SELF_CONTAINED}" = yes; then ns_self_contained=yes @@ -9469,7 +9564,6 @@ if test "${HAVE_NS}" = yes; then INSTALL_ARCH_INDEP_EXTRA= fi ns_frag=$srcdir/src/ns.mk - NS_OBJ="fontset.o fringe.o image.o" NS_OBJC_OBJ="nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o" fi CFLAGS="$tmp_CFLAGS" @@ -9481,28 +9575,45 @@ CPPFLAGS="$tmp_CPPFLAGS" +## $window_system is now set to the window system we will +## ultimately use. + +term_header= +HAVE_X_WINDOWS=no +HAVE_X11=no +USE_X_TOOLKIT=none + case "${window_system}" in x11 ) HAVE_X_WINDOWS=yes HAVE_X11=yes + term_header=xterm.h case "${with_x_toolkit}" in athena | lucid ) USE_X_TOOLKIT=LUCID ;; motif ) USE_X_TOOLKIT=MOTIF ;; gtk ) with_gtk=yes + term_header=gtkutil.h USE_X_TOOLKIT=none ;; gtk3 ) with_gtk3=yes + term_header=gtkutil.h USE_X_TOOLKIT=none ;; no ) USE_X_TOOLKIT=none ;; * ) USE_X_TOOLKIT=maybe ;; esac ;; - nextstep | none ) - HAVE_X_WINDOWS=no - HAVE_X11=no - USE_X_TOOLKIT=none + nextstep ) + term_header=nsterm.h ;; esac +if test -n "${term_header}"; then + +cat >>confdefs.h <<_ACEOF +#define TERM_HEADER "${term_header}" +_ACEOF + +fi + if test "$window_system" = none && test "X$with_x" != "Xno"; then # Extract the first word of "X", so it can be a program name with args. set dummy X; ac_word=$2 @@ -10494,6 +10605,7 @@ $as_echo "no" >&6; } $as_echo "#define HAVE_GTK3 1" >>confdefs.h GTK_OBJ=emacsgtkfixed.o + term_header=gtkutil.h fi if test "$pkg_check_gtk" != "yes"; then @@ -10656,6 +10768,8 @@ _ACEOF fi done + + term_header=gtkutil.h fi HAVE_DBUS=no @@ -10862,6 +10976,60 @@ $as_echo "#define HAVE_GCONF 1" >>confdefs.h fi if test "$HAVE_GSETTINGS" = "yes" || test "$HAVE_GCONF" = "yes"; then + + succeeded=no + + if test "$PKG_CONFIG" = "no" ; then + HAVE_GOBJECT=no + else + PKG_CONFIG_MIN_VERSION=0.9.0 + if $PKG_CONFIG --atleast-pkgconfig-version $PKG_CONFIG_MIN_VERSION; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for gobject-2.0 >= 2.0" >&5 +$as_echo_n "checking for gobject-2.0 >= 2.0... " >&6; } + + if $PKG_CONFIG --exists "gobject-2.0 >= 2.0" 2>&5 && + GOBJECT_CFLAGS=`$PKG_CONFIG --cflags "gobject-2.0 >= 2.0" 2>&5` && + GOBJECT_LIBS=`$PKG_CONFIG --libs "gobject-2.0 >= 2.0" 2>&5`; then + edit_cflags=" + s,///*,/,g + s/^/ / + s/ -I/ $isystem/g + s/^ // + " + GOBJECT_CFLAGS=`$as_echo "$GOBJECT_CFLAGS" | sed -e "$edit_cflags"` + GOBJECT_LIBS=`$as_echo "$GOBJECT_LIBS" | sed -e 's,///*,/,g'` + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes CFLAGS='$GOBJECT_CFLAGS' LIBS='$GOBJECT_LIBS'" >&5 +$as_echo "yes CFLAGS='$GOBJECT_CFLAGS' LIBS='$GOBJECT_LIBS'" >&6; } + succeeded=yes + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + GOBJECT_CFLAGS="" + GOBJECT_LIBS="" + ## If we have a custom action on failure, don't print errors, but + ## do set a variable so people can do so. + GOBJECT_PKG_ERRORS=`$PKG_CONFIG --errors-to-stdout --print-errors "gobject-2.0 >= 2.0"` + + fi + + + + else + echo "*** Your version of pkg-config is too old. You need version $PKG_CONFIG_MIN_VERSION or newer." + echo "*** See http://www.freedesktop.org/software/pkgconfig" + fi + fi + + if test $succeeded = yes; then + HAVE_GOBJECT=yes + else + HAVE_GOBJECT=no + fi + + if test "$HAVE_GOBJECT" = "yes"; then + SETTINGS_CFLAGS="$SETTINGS_CFLAGS $GOBJECT_CFLAGS" + SETTINGS_LIBS="$SETTINGS_LIBS $GOBJECT_LIBS" + fi SAVE_CFLAGS="$CFLAGS" SAVE_LIBS="$LIBS" CFLAGS="$SETTINGS_CFLAGS $CFLAGS" @@ -15313,15 +15481,46 @@ else ;; esac fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for _setjmp" >&5 +$as_echo_n "checking for _setjmp... " >&6; } +if test "${emacs_cv_func__setjmp+set}" = set; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <setjmp.h> -case $opsys in - sol2* | unixware ) +int +main () +{ +jmp_buf j; + if (! _setjmp (j)) + _longjmp (j, 1); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + emacs_cv_func__setjmp=yes +else + emacs_cv_func__setjmp=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $emacs_cv_func__setjmp" >&5 +$as_echo "$emacs_cv_func__setjmp" >&6; } +if test $emacs_cv_func__setjmp = no; then $as_echo "#define _setjmp setjmp" >>confdefs.h $as_echo "#define _longjmp longjmp" >>confdefs.h +fi + +case $opsys in + sol2* | unixware ) $as_echo "#define TIOCSIGSEND TIOCSIGNAL" >>confdefs.h @@ -15576,6 +15775,14 @@ version=$PACKAGE_VERSION +if test -n "${term_header}"; then + +cat >>confdefs.h <<_ACEOF +#define TERM_HEADER "${term_header}" +_ACEOF + +fi + cat >>confdefs.h <<_ACEOF #define EMACS_CONFIGURATION "${canonical}" @@ -15596,7 +15803,7 @@ if test "${HAVE_X_WINDOWS}" = "yes" ; then $as_echo "#define HAVE_X_WINDOWS 1" >>confdefs.h XMENU_OBJ=xmenu.o - XOBJ="xterm.o xfns.o xselect.o xrdb.o fontset.o xsmfns.o fringe.o image.o xsettings.o xgselect.o" + XOBJ="xterm.o xfns.o xselect.o xrdb.o xsmfns.o xsettings.o xgselect.o" FONT_OBJ=xfont.o if test "$HAVE_XFT" = "yes"; then FONT_OBJ="$FONT_OBJ ftfont.o xftfont.o ftxfont.o" @@ -16452,6 +16659,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 : @@ -20088,6 +20297,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 + + + + + @@ -23908,20 +24210,21 @@ if test "x$GCC" = "xyes" && test "x$ORDINARY_LINK" != "xyes"; then esac fi - -## If we're using X11/GNUstep, define some consequences. -if test "$HAVE_X_WINDOWS" = "yes" || test "$HAVE_NS" = "yes"; then +## Common for all window systems +if test "$window_system" != "none"; then $as_echo "#define HAVE_WINDOW_SYSTEM 1" >>confdefs.h $as_echo "#define HAVE_MOUSE 1" >>confdefs.h + WINDOW_SYSTEM_OBJ="fontset.o fringe.o image.o" fi + #### Report on what we decided to do. #### Report GTK as a toolkit, even if it doesn't use Xt. #### It makes printing result more understandable as using GTK sets @@ -24178,6 +24481,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 diff --git a/configure.ac b/configure.ac index 90c0ef07aa1..d4b0fc256b4 100644 --- a/configure.ac +++ b/configure.ac @@ -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 @@ -677,6 +705,7 @@ else nw="$nw -Wswitch-default" # Too many warnings for now nw="$nw -Wfloat-equal" # warns about high-quality code nw="$nw -Winline" # OK to ignore 'inline' + nw="$nw -Wjump-misses-init" # We sometimes safely jump over init. nw="$nw -Wsync-nand" # irrelevant here, and provokes ObjC warning nw="$nw -Wunsafe-loop-optimizations" # OK to suppress unsafe optimizations @@ -709,8 +738,13 @@ else gl_WARN_ADD([-funit-at-a-time]) AC_DEFINE([lint], [1], [Define to 1 if the compiler is checking for lint.]) - AC_DEFINE([_FORTIFY_SOURCE], [2], - [enable compile-time and run-time bounds-checking, and some warnings]) + AH_VERBATIM([FORTIFY_SOURCE], + [/* Enable compile-time and run-time bounds-checking, and some warnings, + without upsetting glibc 2.15+. */ + #if defined __OPTIMIZE__ && __OPTIMIZE__ + # define _FORTIFY_SOURCE 2 + #endif + ]) AC_DEFINE([GNULIB_PORTCHECK], [1], [enable some gnulib portability checks]) # We use a slightly smaller set of warning options for lib/. @@ -731,6 +765,7 @@ dnl AC_PROG_MKDIR_P dnl if test "x$RANLIB" = x; then dnl AC_PROG_RANLIB dnl fi +AC_PROG_LN_S AC_PATH_PROG(INSTALL_INFO, install-info, :, $PATH$PATH_SEPARATOR/usr/sbin$PATH_SEPARATOR/sbin) @@ -1357,10 +1392,14 @@ AC_SYS_LONG_FILE_NAMES #### Choose a window system. +## We leave window_system equal to none if +## we end up building without one. Any new window system should +## set window_system to an appropriate value and add objects to +## window-system-specific substs. + +window_system=none AC_PATH_X -if test "$no_x" = yes; then - window_system=none -else +if test "$no_x" != yes; then window_system=x11 fi @@ -1499,7 +1538,6 @@ if test "${HAVE_NS}" = yes; then fi window_system=nextstep - with_xft=no # set up packaging dirs if test "${EN_NS_SELF_CONTAINED}" = yes; then ns_self_contained=yes @@ -1519,7 +1557,6 @@ if test "${HAVE_NS}" = yes; then INSTALL_ARCH_INDEP_EXTRA= fi ns_frag=$srcdir/src/ns.mk - NS_OBJ="fontset.o fringe.o image.o" NS_OBJC_OBJ="nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o" fi CFLAGS="$tmp_CFLAGS" @@ -1531,18 +1568,29 @@ AC_SUBST(NS_OBJC_OBJ) AC_SUBST(LIB_STANDARD) AC_SUBST_FILE(ns_frag) +## $window_system is now set to the window system we will +## ultimately use. + +term_header= +HAVE_X_WINDOWS=no +HAVE_X11=no +USE_X_TOOLKIT=none + case "${window_system}" in x11 ) HAVE_X_WINDOWS=yes HAVE_X11=yes + term_header=xterm.h case "${with_x_toolkit}" in athena | lucid ) USE_X_TOOLKIT=LUCID ;; motif ) USE_X_TOOLKIT=MOTIF ;; gtk ) with_gtk=yes + term_header=gtkutil.h dnl Don't set this for GTK. A lot of tests below assumes Xt when dnl USE_X_TOOLKIT is set. USE_X_TOOLKIT=none ;; gtk3 ) with_gtk3=yes + term_header=gtkutil.h USE_X_TOOLKIT=none ;; no ) USE_X_TOOLKIT=none ;; dnl If user did not say whether to use a toolkit, make this decision later: @@ -1550,13 +1598,16 @@ dnl use the toolkit if we have gtk, or X11R5 or newer. * ) USE_X_TOOLKIT=maybe ;; esac ;; - nextstep | none ) - HAVE_X_WINDOWS=no - HAVE_X11=no - USE_X_TOOLKIT=none + nextstep ) + term_header=nsterm.h ;; esac +if test -n "${term_header}"; then + AC_DEFINE_UNQUOTED(TERM_HEADER, "${term_header}", + [Define to the header for the built-in window system.]) +fi + if test "$window_system" = none && test "X$with_x" != "Xno"; then AC_CHECK_PROG(HAVE_XSERVER, X, true, false) if test "$HAVE_XSERVER" = true || @@ -1872,6 +1923,7 @@ if test "${with_gtk3}" = "yes"; then fi AC_DEFINE(HAVE_GTK3, 1, [Define to 1 if using GTK 3 or later.]) GTK_OBJ=emacsgtkfixed.o + term_header=gtkutil.h fi if test "$pkg_check_gtk" != "yes"; then @@ -1950,6 +2002,8 @@ if test "${HAVE_GTK}" = "yes"; then gtk_widget_get_mapped gtk_adjustment_get_page_size \ gtk_orientable_set_orientation \ gtk_window_set_has_resize_grip) + + term_header=gtkutil.h fi dnl D-Bus has been tested under GNU/Linux only. Must be adapted for @@ -2000,6 +2054,11 @@ if test "${HAVE_X11}" = "yes" && test "${with_gconf}" = "yes"; then fi if test "$HAVE_GSETTINGS" = "yes" || test "$HAVE_GCONF" = "yes"; then + PKG_CHECK_MODULES(GOBJECT, gobject-2.0 >= 2.0, HAVE_GOBJECT=yes, HAVE_GOBJECT=no) + if test "$HAVE_GOBJECT" = "yes"; then + SETTINGS_CFLAGS="$SETTINGS_CFLAGS $GOBJECT_CFLAGS" + SETTINGS_LIBS="$SETTINGS_LIBS $GOBJECT_LIBS" + fi SAVE_CFLAGS="$CFLAGS" SAVE_LIBS="$LIBS" CFLAGS="$SETTINGS_CFLAGS $CFLAGS" @@ -3732,13 +3791,27 @@ else esac fi dnl GCC? +AC_CACHE_CHECK([for _setjmp], [emacs_cv_func__setjmp], + [AC_LINK_IFELSE( + [AC_LANG_PROGRAM( + [[#include <setjmp.h> + ]], + [[jmp_buf j; + if (! _setjmp (j)) + _longjmp (j, 1);]])], + [emacs_cv_func__setjmp=yes], + [emacs_cv_func__setjmp=no])]) +if test $emacs_cv_func__setjmp = no; then + AC_DEFINE([_setjmp], [setjmp], + [Define to setjmp if _setjmp and _longjmp do not work. See _longjmp.]) + AC_DEFINE([_longjmp], [longjmp], + [Define to longjmp if _setjmp and _longjmp do not work. + Because longjmp may alter signal masks, callers of _longjmp + should not assume that it leaves signal masks alone.]) +fi case $opsys in sol2* | unixware ) - dnl setjmp and longjmp can safely replace _setjmp and _longjmp, - dnl but they will run more slowly. - AC_DEFINE(_setjmp, setjmp, [Some platforms redefine this.]) - AC_DEFINE(_longjmp, longjmp, [Some platforms redefine this.]) dnl TIOCGPGRP is broken in SysVr4, so we can't send signals to PTY dnl subprocesses the usual way. But TIOCSIGNAL does work for PTYs, dnl and this is all we need. @@ -3944,6 +4017,11 @@ AC_SUBST(ns_appsrc) AC_SUBST(GNU_OBJC_CFLAGS) AC_SUBST(OTHER_FILES) +if test -n "${term_header}"; then + AC_DEFINE_UNQUOTED(TERM_HEADER, "${term_header}", + [Define to the header for the built-in window system.]) +fi + AC_DEFINE_UNQUOTED(EMACS_CONFIGURATION, "${canonical}", [Define to the canonical Emacs configuration name.]) AC_DEFINE_UNQUOTED(EMACS_CONFIG_OPTIONS, "${ac_configure_args}", @@ -3958,7 +4036,7 @@ if test "${HAVE_X_WINDOWS}" = "yes" ; then AC_DEFINE(HAVE_X_WINDOWS, 1, [Define to 1 if you want to use the X window system.]) XMENU_OBJ=xmenu.o - XOBJ="xterm.o xfns.o xselect.o xrdb.o fontset.o xsmfns.o fringe.o image.o xsettings.o xgselect.o" + XOBJ="xterm.o xfns.o xselect.o xrdb.o xsmfns.o xsettings.o xgselect.o" FONT_OBJ=xfont.o if test "$HAVE_XFT" = "yes"; then FONT_OBJ="$FONT_OBJ ftfont.o xftfont.o ftxfont.o" @@ -4248,13 +4326,14 @@ if test "x$GCC" = "xyes" && test "x$ORDINARY_LINK" != "xyes"; then fi dnl if $GCC AC_SUBST(LIB_GCC) - -## If we're using X11/GNUstep, define some consequences. -if test "$HAVE_X_WINDOWS" = "yes" || test "$HAVE_NS" = "yes"; then +## Common for all window systems +if test "$window_system" != "none"; then AC_DEFINE(HAVE_WINDOW_SYSTEM, 1, [Define if you have a window system.]) AC_DEFINE(HAVE_MOUSE, 1, [Define if you have mouse support.]) + WINDOW_SYSTEM_OBJ="fontset.o fringe.o image.o" fi +AC_SUBST(WINDOW_SYSTEM_OBJ) AH_TOP([/* GNU Emacs site configuration template file. diff --git a/doc/emacs/ChangeLog b/doc/emacs/ChangeLog index fa78cc4c502..a4f9985ad85 100644 --- a/doc/emacs/ChangeLog +++ b/doc/emacs/ChangeLog @@ -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 diff --git a/doc/emacs/cmdargs.texi b/doc/emacs/cmdargs.texi index 2dea1577c04..d4573eed5a8 100644 --- a/doc/emacs/cmdargs.texi +++ b/doc/emacs/cmdargs.texi @@ -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}. diff --git a/doc/lispref/ChangeLog b/doc/lispref/ChangeLog index 6579cc48fd5..b0156e5ac7e 100644 --- a/doc/lispref/ChangeLog +++ b/doc/lispref/ChangeLog @@ -1,3 +1,23 @@ +2012-09-02 Chong Yidong <cyd@gnu.org> + + * windows.texi (Window Configurations): Recommend against using + save-window-excursion (Bug#12075). + + * control.texi (Catch and Throw): + * positions.texi (Excursions): Don't mention it. + +2012-09-01 Paul Eggert <eggert@cs.ucla.edu> + + Better seed support for (random). + * numbers.texi (Random Numbers): Document new behavior of + the calls (random) and (random STRING). + +2012-08-21 Martin Rudalics <rudalics@gmx.at> + + * windows.texi (Window Point): Document recent changes in + window-point and set-window-point. + (Selecting Windows): Document recent change in select-window. + 2012-08-06 Eli Zaretskii <eliz@gnu.org> * functions.texi (Closures): Put the main index entry for diff --git a/doc/lispref/control.texi b/doc/lispref/control.texi index 07d2d0d993c..25a7655b7b8 100644 --- a/doc/lispref/control.texi +++ b/doc/lispref/control.texi @@ -556,16 +556,14 @@ the @code{catch} in @code{foo-outer} specifies the same symbol, so that @code{catch} in between). Executing @code{throw} exits all Lisp constructs up to the matching -@code{catch}, including function calls. When binding constructs such as -@code{let} or function calls are exited in this way, the bindings are -unbound, just as they are when these constructs exit normally +@code{catch}, including function calls. When binding constructs such +as @code{let} or function calls are exited in this way, the bindings +are unbound, just as they are when these constructs exit normally (@pxref{Local Variables}). Likewise, @code{throw} restores the buffer and position saved by @code{save-excursion} (@pxref{Excursions}), and -the narrowing status saved by @code{save-restriction} and the window -selection saved by @code{save-window-excursion} (@pxref{Window -Configurations}). It also runs any cleanups established with the -@code{unwind-protect} special form when it exits that form -(@pxref{Cleanups}). +the narrowing status saved by @code{save-restriction}. It also runs +any cleanups established with the @code{unwind-protect} special form +when it exits that form (@pxref{Cleanups}). The @code{throw} need not appear lexically within the @code{catch} that it jumps to. It can equally well be called from another function diff --git a/doc/lispref/numbers.texi b/doc/lispref/numbers.texi index ce0716f39ef..17f3ee099bd 100644 --- a/doc/lispref/numbers.texi +++ b/doc/lispref/numbers.texi @@ -1199,30 +1199,32 @@ numbers are not truly random, but they have certain properties that mimic a random series. For example, all possible values occur equally often in a pseudo-random series. -In Emacs, pseudo-random numbers are generated from a ``seed'' number. +In Emacs, pseudo-random numbers are generated from a ``seed''. Starting from any given seed, the @code{random} function always -generates the same sequence of numbers. Emacs always starts with the -same seed value, so the sequence of values of @code{random} is actually -the same in each Emacs run! For example, in one operating system, the -first call to @code{(random)} after you start Emacs always returns -@minus{}1457731, and the second one always returns @minus{}7692030. This -repeatability is helpful for debugging. - -If you want random numbers that don't always come out the same, execute -@code{(random t)}. This chooses a new seed based on the current time of -day and on Emacs's process @acronym{ID} number. +generates the same sequence of numbers. Emacs typically starts with a +different seed each time, so the sequence of values of @code{random} +typically differs in each Emacs run. + +Sometimes you want the random number sequence to be repeatable. For +example, when debugging a program whose behavior depends on the random +number sequence, it is helpful to get the same behavior in each +program run. To make the sequence repeat, execute @code{(random "")}. +This sets the seed to a constant value for your particular Emacs +executable (though it may differ for other Emacs builds). You can use +other strings to choose various seed values. @defun random &optional limit This function returns a pseudo-random integer. Repeated calls return a series of pseudo-random integers. If @var{limit} is a positive integer, the value is chosen to be -nonnegative and less than @var{limit}. +nonnegative and less than @var{limit}. Otherwise, the value +might be any integer representable in Lisp. If @var{limit} is @code{t}, it means to choose a new seed based on the current time of day and on Emacs's process @acronym{ID} number. -On some machines, any integer representable in Lisp may be the result -of @code{random}. On other machines, the result can never be larger -than a certain maximum or less than a certain (negative) minimum. +If @var{limit} is a string, it means to choose a new seed based on the +string's contents. + @end defun diff --git a/doc/lispref/positions.texi b/doc/lispref/positions.texi index a59a99d124c..a0c65319850 100644 --- a/doc/lispref/positions.texi +++ b/doc/lispref/positions.texi @@ -850,9 +850,6 @@ after setting the desired current buffer, as in the following example: @cindex window excursions Likewise, @code{save-excursion} does not restore window-buffer correspondences altered by functions such as @code{switch-to-buffer}. -One way to restore these correspondences, and the selected window, is to -use @code{save-window-excursion} inside @code{save-excursion} -(@pxref{Window Configurations}). @strong{Warning:} Ordinary insertion of text adjacent to the saved point value relocates the saved value, just as it relocates all diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi index c7c466c7d36..5fe007ba02d 100644 --- a/doc/lispref/windows.texi +++ b/doc/lispref/windows.texi @@ -1129,16 +1129,15 @@ are the opposite of what they are in those other functions. @defun select-window window &optional norecord This function makes @var{window} the selected window, as well as the -window selected within its frame (@pxref{Basic Windows}). -@var{window} must be a live window. Unless @var{window} already is the -selected window, its buffer becomes the current buffer (@pxref{Buffers -and Windows}). The return value is @var{window}. +window selected within its frame (@pxref{Basic Windows}). @var{window} +must be a live window. This function makes also @var{window}'s buffer +current (@pxref{Buffers and Windows}). The return value is +@var{window}. -By default, this function also moves @var{window}'s selected buffer to -the front of the buffer list (@pxref{The Buffer List}), and makes -@var{window} the most recently selected window. However, if the -optional argument @var{norecord} is non-@code{nil}, these additional -actions are omitted. +By default, this function also moves @var{window}'s buffer to the front +of the buffer list (@pxref{The Buffer List}), and makes @var{window} the +most recently selected window. However, if the optional argument +@var{norecord} is non-@code{nil}, these additional actions are omitted. @end defun @cindex most recently selected windows @@ -2276,19 +2275,18 @@ For a nonselected window, this is the value point would have (in that window's buffer) if that window were selected. The default for @var{window} is the selected window. -When @var{window} is the selected window and its buffer is also the -current buffer, the value returned is the same as point in that buffer. -Strictly speaking, it would be more correct to return the ``top-level'' -value of point, outside of any @code{save-excursion} forms. But that -value is hard to find. +When @var{window} is the selected window, the value returned is the +value of point in that window's buffer. Strictly speaking, it would be +more correct to return the ``top-level'' value of point, outside of any +@code{save-excursion} forms. But that value is hard to find. @end defun @defun set-window-point window position This function positions point in @var{window} at position @var{position} in @var{window}'s buffer. It returns @var{position}. -If @var{window} is selected, and its buffer is current, -this simply does @code{goto-char}. +If @var{window} is selected, this simply does @code{goto-char} in +@var{window}'s buffer. @end defun @defvar window-point-insertion-type @@ -3155,42 +3153,21 @@ as @code{save-window-excursion}: @end defun @defmac save-window-excursion forms@dots{} -This special form records the window configuration, executes @var{forms} -in sequence, then restores the earlier window configuration. The window -configuration includes, for each window, the value of point and the -portion of the buffer that is visible. It also includes the choice of -selected window. However, it does not include the value of point in -the current buffer; use @code{save-excursion} also, if you wish to -preserve that. - -Don't use this construct when @code{save-selected-window} is sufficient. - -Exit from @code{save-window-excursion} always triggers execution of -@code{window-size-change-functions}. (It doesn't know how to tell -whether the restored configuration actually differs from the one in -effect at the end of the @var{forms}.) - -The return value is the value of the final form in @var{forms}. -For example: - -@example -@group -(split-window) - @result{} #<window 25 on control.texi> -@end group -@group -(setq w (selected-window)) - @result{} #<window 19 on control.texi> -@end group -@group -(save-window-excursion - (delete-other-windows w) - (switch-to-buffer "foo") - 'do-something) - @result{} do-something - ;; @r{The screen is now split again.} -@end group -@end example +This macro records the window configuration of the selected frame, +executes @var{forms} in sequence, then restores the earlier window +configuration. The return value is the value of the final form in +@var{forms}. + +Most Lisp code should not use this macro; @code{save-selected-window} +is typically sufficient. In particular, this macro cannot reliably +prevent the code in @var{forms} from opening new windows, because new +windows might be opened in other frames (@pxref{Choosing Window}), and +@code{save-window-excursion} only saves and restores the window +configuration on the current frame. + +Do not use this macro in @code{window-size-change-functions}; exiting +the macro triggers execution of @code{window-size-change-functions}, +leading to an endless loop. @end defmac @defun window-configuration-p object @@ -3426,11 +3403,11 @@ Creating or deleting windows counts as a size change, and therefore causes these functions to be called. Changing the frame size also counts, because it changes the sizes of the existing windows. -It is not a good idea to use @code{save-window-excursion} (@pxref{Window -Configurations}) in these functions, because that always counts as a -size change, and it would cause these functions to be called over and -over. In most cases, @code{save-selected-window} (@pxref{Selecting -Windows}) is what you need here. +You may use @code{save-selected-window} in these functions +(@pxref{Selecting Windows}). However, do not use +@code{save-window-excursion} (@pxref{Window Configurations}); exiting +that macro counts as a size change, which would cause these functions +to be called over and over. @end defvar @defvar window-configuration-change-hook diff --git a/etc/ChangeLog b/etc/ChangeLog index 452a99d2d9b..f3f244c7e39 100644 --- a/etc/ChangeLog +++ b/etc/ChangeLog @@ -1,3 +1,18 @@ +2012-09-01 Paul Eggert <eggert@cs.ucla.edu> + + Better seeds for (random). + * NEWS: Document new behavior of (random), (random "string"). + +2012-08-28 Andreas Schwab <schwab@linux-m68k.org> + + * charsets/MULE-ethiopic.map: Fix typo in comment. + * charsets/MULE-ipa.map: Likewise. + * charsets/MULE-is13194.map: Likewise. + * charsets/MULE-lviscii.map: Likewise. + * charsets/MULE-sisheng.map: Likewise. + * charsets/MULE-tibetan.map: Likewise. + * charsets/MULE-uviscii.map: Likewise. + 2012-08-09 Chong Yidong <cyd@gnu.org> * images/splash.svg, images/splash.png: Tweak SVG paths to improve @@ -23,7 +23,7 @@ so we will look at it and add it to the manual. * 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 @@ -39,6 +39,11 @@ may be useful. as it was confusingly-named and rarely useful. --- +** You can use `NO_BIN_LINK=t make install' to prevent the installation +overwriting "emacs" in the installation bin/ directory with a link +to emacs-VERSION. + +--- ** Emacs uses libtinfo in preference to libncurses, if available. --- @@ -160,6 +165,10 @@ The PCL-CVS commands are still available via the keyboard. * Editing Changes in Emacs 24.3 +** The `z' key no longer has a binding in most special modes. +It used to be bound to `kill-this-buffer', but `z' is too easy to +accidentally type. + ** New option `yank-handled-properties' allows processing of text properties on yanked text, in more ways that are more general than just removing them, as done by `yank-excluded-properties'. @@ -174,6 +183,15 @@ 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. +*** `M-s SPC' in Isearch toggles whitespace matching mode +in both ordinary and regexp incremental search, so that each +sequence of spaces in the search string matches any combination +of one or more whitespace characters defined by the variable +`search-whitespace-regexp'. In ordinary incremental search, +`isearch-toggle-lax-whitespace' toggles the value of the variable +`isearch-lax-whitespace'. In regexp incremental search, it toggles +the value of the variable `isearch-regexp-lax-whitespace'. + ** M-x move-to-column, if called interactively with no prefix arg, now prompts for a column number. @@ -195,6 +213,8 @@ It copies the region-rectangle as the last rectangle kill. * Changes in Specialized Modes and Packages in Emacs 24.3 +** Compilation has a new `compilation-always-kill' configuration variable. + ** Term changes The variables `term-default-fg-color' and `term-default-bg-color' are @@ -510,6 +530,11 @@ inefficiency, and not namespace-clean. * Incompatible Lisp Changes in Emacs 24.3 +** (random) by default now returns a different random sequence in +every Emacs run. Use (random S), where S is a string, to set the +random seed to a value based on S, in order to get a repeatable +sequence in later calls. + ** The function `x-select-font' can return a font spec, instead of a font name as a string. Whether it returns a font spec or a font name depends on the graphical library. @@ -576,6 +601,8 @@ are deprecated and will be removed eventually. * Lisp changes in Emacs 24.3 +** New minor mode `read-only-mode' to replace toggle-read-only (now obsolete). + ** New functions `autoloadp' and `autoload-do-load'. ** New function `posnp' to test if an object is a `posn'. @@ -604,9 +631,26 @@ The interpretation of the DECLS is determined by `defun-declarations-alist'. *** The functions get-lru-window, get-mru-window and get-largest-window now accept a third argument to avoid choosing the selected window. +*** New macro with-temp-buffer-window. + +*** New display action function display-buffer-below-selected. + *** 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/etc/charsets/MULE-ethiopic.map b/etc/charsets/MULE-ethiopic.map index d2720bd10ba..30cf5736763 100644 --- a/etc/charsets/MULE-ethiopic.map +++ b/etc/charsets/MULE-ethiopic.map @@ -1,4 +1,4 @@ -# Generated by running amdin/charsets/mule-charsets.el in Emacs 22.3. +# Generated by running admin/charsets/mule-charsets.el in Emacs 22.3. 0x2121 0x1200 0x2122 0x1201 0x2123 0x1202 diff --git a/etc/charsets/MULE-ipa.map b/etc/charsets/MULE-ipa.map index 35e5d50ecec..0a6c61d5a95 100644 --- a/etc/charsets/MULE-ipa.map +++ b/etc/charsets/MULE-ipa.map @@ -1,4 +1,4 @@ -# Generated by running amdin/charsets/mule-charsets.el in Emacs 22.3. +# Generated by running admin/charsets/mule-charsets.el in Emacs 22.3. 0x20 0x0069 0x21 0x026A 0x22 0x0065 diff --git a/etc/charsets/MULE-is13194.map b/etc/charsets/MULE-is13194.map index 1fa9b21dcf8..390132cd375 100644 --- a/etc/charsets/MULE-is13194.map +++ b/etc/charsets/MULE-is13194.map @@ -1,4 +1,4 @@ -# Generated by running amdin/charsets/mule-charsets.el in Emacs 22.3. +# Generated by running admin/charsets/mule-charsets.el in Emacs 22.3. 0x21 0x0901 0x22 0x0902 0x23 0x0903 diff --git a/etc/charsets/MULE-lviscii.map b/etc/charsets/MULE-lviscii.map index 3b6a38be616..e4d2eca90ac 100644 --- a/etc/charsets/MULE-lviscii.map +++ b/etc/charsets/MULE-lviscii.map @@ -1,4 +1,4 @@ -# Generated by running amdin/charsets/mule-charsets.el in Emacs 22.3. +# Generated by running admin/charsets/mule-charsets.el in Emacs 22.3. 0x21 0x1EAF 0x22 0x1EB1 0x23 0x1EB7 diff --git a/etc/charsets/MULE-sisheng.map b/etc/charsets/MULE-sisheng.map index 405bb1ffa2c..144a3ff5134 100644 --- a/etc/charsets/MULE-sisheng.map +++ b/etc/charsets/MULE-sisheng.map @@ -1,4 +1,4 @@ -# Generated by running amdin/charsets/mule-charsets.el in Emacs 22.3. +# Generated by running admin/charsets/mule-charsets.el in Emacs 22.3. 0x21 0x0101 0x22 0x00E1 0x23 0x01CE diff --git a/etc/charsets/MULE-tibetan.map b/etc/charsets/MULE-tibetan.map index 0d6ff3a0a39..b885585c094 100644 --- a/etc/charsets/MULE-tibetan.map +++ b/etc/charsets/MULE-tibetan.map @@ -1,4 +1,4 @@ -# Generated by running amdin/charsets/mule-charsets.el in Emacs 22.3. +# Generated by running admin/charsets/mule-charsets.el in Emacs 22.3. 0x2130 0x0F00 0x2131 0x0F01 0x2132 0x0F02 diff --git a/etc/charsets/MULE-uviscii.map b/etc/charsets/MULE-uviscii.map index 65e5d2968e5..dc19583bdfe 100644 --- a/etc/charsets/MULE-uviscii.map +++ b/etc/charsets/MULE-uviscii.map @@ -1,4 +1,4 @@ -# Generated by running amdin/charsets/mule-charsets.el in Emacs 22.3. +# Generated by running admin/charsets/mule-charsets.el in Emacs 22.3. 0x21 0x1EAE 0x22 0x1EB0 0x23 0x1EB6 diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog index 4e3f3424c91..35190fd2a8f 100644 --- a/lib-src/ChangeLog +++ b/lib-src/ChangeLog @@ -1,3 +1,8 @@ +2012-08-31 Andreas Schwab <schwab@linux-m68k.org> + + * etags.c (consider_token): Always zero-terminate token buffer. + (Bug#12306) + 2012-08-19 Paul Eggert <eggert@cs.ucla.edu> Rely on <config.h> + <unistd.h> to declare 'environ'. diff --git a/lib-src/etags.c b/lib-src/etags.c index 9c03735c954..e65082de534 100644 --- a/lib-src/etags.c +++ b/lib-src/etags.c @@ -2878,6 +2878,7 @@ consider_token (register char *str, register int len, register int c, int *c_ext objdef = omethodtag; linebuffer_setlen (&token_name, oldlen + len); memcpy (token_name.buffer + oldlen, str, len); + token_name.buffer[oldlen + len] = '\0'; return TRUE; } return FALSE; diff --git a/lib/execinfo.c b/lib/execinfo.c new file mode 100644 index 00000000000..0bcd9f078ba --- /dev/null +++ b/lib/execinfo.c @@ -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 index 00000000000..d76b0e1b771 --- /dev/null +++ b/lib/execinfo.in.h @@ -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 diff --git a/lib/gnulib.mk b/lib/gnulib.mk index a90cc59bbde..d49eb4fdf7a 100644 --- a/lib/gnulib.mk +++ b/lib/gnulib.mk @@ -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 diff --git a/lib/makefile.w32-in b/lib/makefile.w32-in index 11251d55f77..f0cea56f829 100644 --- a/lib/makefile.w32-in +++ b/lib/makefile.w32-in @@ -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 $@ + diff --git a/lib/stdbool.in.h b/lib/stdbool.in.h index ed1f9aa488b..1f8caee4f2d 100644 --- a/lib/stdbool.in.h +++ b/lib/stdbool.in.h @@ -66,24 +66,19 @@ # undef true #endif -/* For the sake of symbolic names in gdb, we define true and false as - enum constants, not only as macros. - It is tempting to write - typedef enum { false = 0, true = 1 } _Bool; - so that gdb prints values of type 'bool' symbolically. But if we do - this, values of type '_Bool' may promote to 'int' or 'unsigned int' - (see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int' - (see ISO C 99 6.3.1.1.(2)). So we add a negative value to the - enum; this ensures that '_Bool' promotes to 'int'. */ -#if defined __cplusplus || (defined __BEOS__ && !defined __HAIKU__) +#ifdef __cplusplus +# define _Bool bool +# define bool bool +#else +# if defined __BEOS__ && !defined __HAIKU__ /* A compiler known to have 'bool'. */ /* If the compiler already has both 'bool' and '_Bool', we can assume they are the same types. */ -# if !@HAVE__BOOL@ +# if !@HAVE__BOOL@ typedef bool _Bool; -# endif -#else -# if !defined __GNUC__ +# endif +# else +# if !defined __GNUC__ /* If @HAVE__BOOL@: Some HP-UX cc and AIX IBM C compiler versions have compiler bugs when the built-in _Bool type is used. See @@ -103,19 +98,35 @@ typedef bool _Bool; "Invalid enumerator. (badenum)" with HP-UX cc on Tru64. The only benefit of the enum, debuggability, is not important with these compilers. So use 'signed char' and no enum. */ -# define _Bool signed char -# else +# define _Bool signed char +# else /* With this compiler, trust the _Bool type if the compiler has it. */ -# if !@HAVE__BOOL@ +# if !@HAVE__BOOL@ + /* For the sake of symbolic names in gdb, define true and false as + enum constants, not only as macros. + It is tempting to write + typedef enum { false = 0, true = 1 } _Bool; + so that gdb prints values of type 'bool' symbolically. But then + values of type '_Bool' might promote to 'int' or 'unsigned int' + (see ISO C 99 6.7.2.2.(4)); however, '_Bool' must promote to 'int' + (see ISO C 99 6.3.1.1.(2)). So add a negative value to the + enum; this ensures that '_Bool' promotes to 'int'. */ typedef enum { _Bool_must_promote_to_int = -1, false = 0, true = 1 } _Bool; +# endif # endif # endif +# define bool _Bool #endif -#define bool _Bool /* The other macros must be usable in preprocessor directives. */ -#define false 0 -#define true 1 +#ifdef __cplusplus +# define false false +# define true true +#else +# define false 0 +# define true 1 +#endif + #define __bool_true_false_are_defined 1 #endif /* _GL_STDBOOL_H */ diff --git a/lisp/ChangeLog b/lisp/ChangeLog index d748214959d..d4630d36691 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,454 @@ +2012-09-04 Dmitry Gutov <dgutov@yandex.ru> + + * progmodes/ruby-mode.el: Clean up keybindings. + (ruby-mode-map): Don't bind ruby-electric-brace, + ruby-beginning-of-defun, ruby-end-of-defun, ruby-mark-defun, + backward-kill-word, reindent-then-newline-and-indent. + (ruby-mark-defun): Remove. + (ruby-electric-brace): Remove. Obsoleted by electric-indent-chars. + (ruby-mode): Set local beginning-of-defun-function and + end-of-defun-function values. + +2012-09-03 Martin Rudalics <rudalics@gmx.at> + + * window.el (temp-buffer-window-setup-hook) + (temp-buffer-window-show-hook): New hooks. + (temp-buffer-window-setup, temp-buffer-window-show) + (with-temp-buffer-window): New functions. + (fit-window-to-buffer): Remove unused optional argument + OVERRIDE. + (special-display-popup-frame): Make sure the window used shows + BUFFER. + + * help.el (temp-buffer-resize-mode): Fix doc-string. + (resize-temp-buffer-window): New optional argument WINDOW. + + * files.el (recover-file, save-buffers-kill-emacs): + * dired.el (dired-mark-pop-up): Use with-temp-buffer-window. + +2012-09-02 Michael Albinus <michael.albinus@gmx.de> + + * eshell/em-unix.el (eshell/sudo): When we have an ad-hoc + remote definition of `default-directory', ensure we can connect. + +2012-09-02 Juri Linkov <juri@jurta.org> + + Toggle whitespace matching mode with M-s SPC. + http://lists.gnu.org/archive/html/emacs-devel/2012-09/msg00008.html + + * isearch.el (search-whitespace-regexp): Doc fix. + Remove cons cell customization. + (isearch-mode-map): Bind "\M-s " to isearch-toggle-lax-whitespace. + (isearch-lax-whitespace, isearch-regexp-lax-whitespace): + New variables. + (isearch-forward, isearch-forward-regexp): Doc fix. + (isearch-toggle-lax-whitespace): New command. + (search-forward-lax-whitespace, search-backward-lax-whitespace) + (re-search-forward-lax-whitespace) + (re-search-backward-lax-whitespace): New functions. + (isearch-whitespace-regexp): Remove function. + (isearch-query-replace): Let-bind replace-search-function and + replace-re-search-function. + (isearch-occur): Let-bind search-spaces-regexp according to the + value of isearch-lax-whitespace and isearch-regexp-lax-whitespace. + (isearch-quote-char): Check isearch-regexp-lax-whitespace in the + condition for C-q SPC. + (isearch-search-fun-default): Use new functions mentioned above. + (isearch-search-forward, isearch-search-backward): Remove functions. + (isearch-search): Don't let-bind search-spaces-regexp. + (isearch-lazy-highlight-space-regexp): Remove variable. + (isearch-lazy-highlight-lax-whitespace) + (isearch-lazy-highlight-regexp-lax-whitespace): New variables. + (isearch-lazy-highlight-new-loop): Use them. + (isearch-lazy-highlight-search): Don't let-bind search-spaces-regexp. + +2012-09-02 Chong Yidong <cyd@gnu.org> + + * dired.el (dired-mode-map): Menu string fixes (Bug#11616). + +2012-09-02 Glenn Morris <rgm@gnu.org> + + * simple.el (undo): Tweak message in undo-only case. (Bug#12283) + +2012-09-01 Glenn Morris <rgm@gnu.org> + + * term.el: Tidy up menu definitions. + (term-mode-map): Use easymenu for In/Out, Complete menus. + (term-pager-break-map): Initialize in the defvar. + (term-terminal-menu, term-signals-menu): Define with easymenu. + (term-terminal-menu): Also show it in line-mode. (Bug#11957) + (term-pager-menu): New, extracted from term-process-pager. + (term-mode, term-char-mode, term-process-pager): Use easymenu-add. + (term-update-mode-line): Propertize line/char and page items. + (term-process-pager): Move keymap initialization elsewhere. + +2012-09-01 Martin Rudalics <rudalics@gmx.at> + + * window.el (switch-to-prev-buffer): Handle additional values of + BURY-OR-KILL argument. Don't switch in minibuffer window. + (switch-to-next-buffer): Don't switch in minibuffer window. + (quit-restore-window): New function based on quit-window. + Handle additional values of former KILL argument. + (quit-window): Call quit-restore-window with appropriate + interpretation of KILL argument. + (display-buffer-below-selected): New buffer display action + function. + +2012-09-01 Stefan Monnier <monnier@iro.umontreal.ca> + + * minibuffer.el (completion-at-point-functions): Complete docstring + (bug#12254). + +2012-09-01 Paul Eggert <eggert@cs.ucla.edu> + + Better seed support for (random). + * play/5x5.el, play/animate.el, play/cookie1.el, play/dissociate.el: + * play/doctor.el, play/dunnet.el, play/gomoku.el, play/landmark.el: + * play/mpuz.el, play/tetris.el, play/zone.el: + * calc/calc-comb.el (math-init-random-base): + * play/blackbox.el (bb-init-board): + * play/life.el (life): + * server.el (server-use-tcp): + * type-break.el (type-break): + Remove unnecessary call to (random t). + * net/sasl.el (sasl-unique-id-function): + Change (random t) to (random), now that the latter is more random. + * play/life.el (life-initialized): Remove no-longer-needed var. + +2012-08-31 Alp Aker <alp.tekin.aker@gmail.com> + + * window.el (switch-to-prev-buffer, switch-to-next-buffer): + Consider frame's buffer predicate when choosing the buffer. + (Bug#12081) + +2012-08-30 Richard Stallman <rms@gnu.org> + + * simple.el (special-mode-map): Delete binding for `z'. + +2012-08-30 Andreas Schwab <schwab@linux-m68k.org> + + * progmodes/compile.el (compilation-always-kill): Doc fix. + +2012-08-30 Chong Yidong <cyd@gnu.org> + + * window.el (display-buffer-reuse-frames): Make the obsolescence + message more informative. + +2012-08-30 Glenn Morris <rgm@gnu.org> + + * paren.el (show-paren-delay): + Add a :set function. Doc fix. (Bug#12297) + +2012-08-29 Martin Blais <blais@furius.ca> (tiny change) + + * progmodes/compile.el (compilation-always-kill): New var. + (compilation-start): Use it. + +2012-08-29 Stefan Monnier <monnier@iro.umontreal.ca> + + * simple.el (read-only-mode): Move from files.el for bootstrapping. + * files.el (read-only-mode): Move to simple.el. + + * files.el (read-only-mode): New minor mode. + (toggle-read-only): Use it and mark obsolete. + (find-file--read-only): + * vc/vc.el (vc-next-action, vc-checkout): + * vc/vc-cvs.el (vc-cvs-checkout): + * obsolete/vc-mcvs.el (vc-mcvs-update): + * ffap.el (ffap--toggle-read-only): Update callers. + +2012-08-29 Michael Albinus <michael.albinus@gmx.de> + + * eshell/esh-ext.el (eshell-external-command): Do not examine + remote shell scripts. See + <https://bugs.launchpad.net/ubuntu/+source/emacs23/+bug/1035790>. + + * net/tramp-sh.el (tramp-remote-path): Add "/sbin" and + "/usr/local/sbin". + +2012-08-28 Stefan Monnier <monnier@iro.umontreal.ca> + + * emacs-lisp/cl-lib.el (buffer-string): Fix setter macro (bug#12293). + +2012-08-28 Leo Liu <sdl.web@gmail.com> + + * progmodes/sh-script.el (sh-dynamic-complete-functions): Adapt to + completion-at-point. (Bug#12220) + + * skeleton.el (skeleton-untabify): Change to nil (bug#12223). + + * progmodes/sh-script.el (sh-indent-comment): Change to t (bug#12267). + +2012-08-28 Stefan Monnier <monnier@iro.umontreal.ca> + + * files.el (safe-local-eval-forms): Fix before-save-hook entry to + be buffer-local; add delete-trailing-whitespace (bug#12259). + +2012-08-28 Jeremy Moore <jmoore@ieee.org> (tiny change) + + * progmodes/hideif.el (hif-compress-define-list): + Fix typo. (Bug#11951) + +2012-08-28 Dan Nicolaescu <dann@gnu.org> + + * progmodes/hideshow.el (hs-block-end-regexp): Restore lost + buffer local setting. + + * net/rcirc.el (rcirc-split-message): Fix for buffer-local + rcirc-encode-coding-system. + +2012-08-28 Leo Liu <sdl.web@gmail.com> + + * net/rcirc.el (rcirc-split-message): New function. + (rcirc-send-message): Use it. (Bug#12051) + +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 optional argument MINIBUF to control whether these functions + should run on the minibuffer window. + (window-at-side-list): Don't operate on minibuffer window. + (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> + + * help-fns.el (help-fns--key-bindings): + Abbreviate non-symbol remap targets. (Bug#12174) + +2012-08-22 Martin Rudalics <rudalics@gmx.at> + + * dired.el (dired-mark-remembered): Don't clobber point. + (Bug#11795) + +2012-08-22 Glenn Morris <rgm@gnu.org> + + * progmodes/bug-reference.el (bug-reference): New custom group. + (bug-reference-bug-regexp): Make it a defcustom. + +2012-08-22 Daiki Ueno <ueno@unixuser.org> + + * progmodes/js.el (js-indent-level, js-expr-indent-offset) + (js-paren-indent-offset, js-square-indent-offset) + (js-curly-indent-offset): Add :safe (Bug#12257). + +2012-08-22 Edward O'Connor <hober0@gmail.com> + + * json.el (json-key-format): Add error properties. + (json-encode-key): New function. + (json-encode-hash-table, json-encode-alist, json-encode-plist): + Use json-encode-key. + +2012-08-22 Glenn Morris <rgm@gnu.org> + + * calendar/cal-tex.el (cal-tex-longday): New function, replacing... + (cal-tex-leftday, cal-tex-rightday): Remove functions. + (cal-tex-weekly-common, cal-tex-cursor-filofax-2week): + Update for above change. + +2012-08-21 Andreas Schwab <schwab@linux-m68k.org> + + * cus-face.el (custom-face-attributes): Fix customize type for the + :underline attribute. (Bug#11805) + +2012-08-21 Martin Rudalics <rudalics@gmx.at> + + * window.el (window-point-1, set-window-point-1): Remove. + (window-in-direction, record-window-buffer) + (set-window-buffer-start-and-point, split-window-below) + (window--state-get-1, display-buffer-record-window): + Replace calls to window-point-1 and set-window-point-1 by calls to + window-point and set-window-point respectively. + +2012-08-21 Glenn Morris <rgm@gnu.org> + + * calendar/cal-tex.el (cal-tex-weekly-common): New function. + (cal-tex-cursor-week-at-a-glance, cal-tex-cursor-filofax-week): + Use it. + + * calendar/cal-tex.el (cal-tex-rightday): Add optional funcname arg. + (cal-tex-shortday): New function. + (cal-tex-cursor-week-at-a-glance, cal-tex-cursor-filofax-week) + (cal-tex-cursor-filofax-daily): Use the above. + + * calendar/cal-tex.el (cal-tex-leftday, cal-tex-rightday): + New functions. + (cal-tex-cursor-week-at-a-glance, cal-tex-cursor-filofax-2week) + (cal-tex-cursor-filofax-week): Use them. + + * calendar/cal-tex.el (cal-tex-lefthead, cal-tex-righthead): + New constants. + (cal-tex-cursor-week-at-a-glance, cal-tex-cursor-filofax-2week) + (cal-tex-cursor-filofax-week, cal-tex-cursor-filofax-daily): Use them. + + * calendar/cal-tex.el (cal-tex-preamble): Generate new buffers. + (cal-tex-end-document): Don't rely on buffer name. + + * calendar/cal-tex.el (cal-tex-cursor-filofax-year): + Use cal-tex-vspace. + (cal-tex-vspace, cal-tex-hspace, cal-tex-em, cal-tex-bf) + (cal-tex-Huge-bf, cal-tex-large-bf): Use cal-tex-cmd. + (cal-tex-scriptsize, cal-tex-huge, cal-tex-Huge, cal-tex-large): + Use cal-tex-arg. + + * calendar/cal-tex.el (cal-tex-cursor-filofax-year) + (cal-tex-cursor-week, cal-tex-cursor-week2) + (cal-tex-cursor-week-iso, cal-tex-cursor-week-at-a-glance) + (cal-tex-cursor-filofax-2week, cal-tex-cursor-filofax-week) + (cal-tex-cursor-filofax-daily, cal-tex-cursor-day) + (cal-tex-insert-preamble, cal-tex-b-document) + (cal-tex-e-document, cal-tex-b-center, cal-tex-e-center): + Improve cal-tex-cmd usage. + + * calendar/cal-tex.el (cal-tex-filofax-paper): New function. + (cal-tex-cursor-filofax-year, cal-tex-cursor-filofax-2week) + (cal-tex-cursor-filofax-week, cal-tex-cursor-filofax-daily): Use it. + (cal-tex-weekly-paper): New function. + (cal-tex-cursor-week, cal-tex-cursor-week2) + (cal-tex-cursor-week-iso, cal-tex-cursor-week-monday) + (cal-tex-cursor-day): Use it. + + * calendar/cal-tex.el (cal-tex-cursor-week-at-a-glance) + (cal-tex-cursor-filofax-week): Remove leading blank page. + + * calendar/cal-tex.el (cal-tex-cursor-week-at-a-glance): + Add autoload cookie. For now at least, don't use color, since + no other cal-tex function does. + + * calendar/cal-tex.el (cal-tex-cursor-week-iso) + (cal-tex-cursor-filofax-2week, cal-tex-cursor-filofax-week) + (cal-tex-cursor-filofax-daily): Correct start date for diary entries. + +2012-08-21 Juri Linkov <juri@jurta.org> + + * info.el (Info-file-attributes): New variable. + (info-insert-file-contents): Add file attributes to + `Info-file-attributes'. Clear the caches `Info-index-nodes' and + `Info-toc-nodes' when previous modtime of the Info file is less + than new modtime. + (Info-toc-nodes, Info-index-nodes): Move definitions up to the top + of info.el. (Bug#12230) + +2012-08-20 Glenn Morris <rgm@gnu.org> + + * calendar/diary-lib.el (diary-include-files, diary-sexp-entry): + * calendar/holidays.el (calendar-holiday-list): + Report errors with display-warning rather than beep'n'sleep. + +2012-08-20 Michael Albinus <michael.albinus@gmx.de> + + * net/tramp.el (tramp-accept-process-output): Accept only output + from PROC. Otherwise, process filters and sentinels might be + confused. (Bug#12145) + 2012-08-20 Chong Yidong <cyd@gnu.org> * descr-text.el (describe-text-properties-1): Use overlays-in to @@ -32,8 +483,8 @@ (yank-excluded-properties): Add font-lock-face and category. (yank): Doc fix. - * subr.el (remove-yank-excluded-properties): Obey - yank-handled-properties. The special handling of font-lock-face + * subr.el (remove-yank-excluded-properties): + Obey yank-handled-properties. The special handling of font-lock-face and category is now done this way, instead of being hard-coded. (insert-for-yank-1): Remove font-lock-face handling. (yank-handle-font-lock-face-property) @@ -47,8 +498,8 @@ 2012-08-17 Michael Albinus <michael.albinus@gmx.de> - * net/tramp-sh.el (tramp-sh-handle-start-file-process): Eliminate - superfluous prompt. (Bug#12203) + * net/tramp-sh.el (tramp-sh-handle-start-file-process): + Eliminate superfluous prompt. (Bug#12203) 2012-08-17 Chong Yidong <cyd@gnu.org> @@ -75,8 +526,8 @@ (next-buffer, previous-buffer, split-window, balance-windows-2) (set-window-text-height, window-buffer-height) (fit-window-to-buffer, shrink-window-if-larger-than-buffer) - (truncated-partial-width-window-p): Minor code adjustments. In - doc-strings state whether the argument window has to denote a + (truncated-partial-width-window-p): Minor code adjustments. + In doc-strings state whether the argument window has to denote a live, valid or any window. 2012-08-16 Phil Sainty <psainty@orcon.net.nz> (tiny change) @@ -251,7 +702,7 @@ 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> @@ -319,6 +770,7 @@ * files.el (hack-local-variables-filter): If an eval: form is not known to be safe, and enable-local-variables is :safe, then ignore the form totally, as is done for non-eval forms. (Bug#12155) + This is CVE-2012-3479. 2012-08-10 Stefan Monnier <monnier@iro.umontreal.ca> diff --git a/lisp/allout-widgets.el b/lisp/allout-widgets.el index 962a8fb557a..c5790603d11 100644 --- a/lisp/allout-widgets.el +++ b/lisp/allout-widgets.el @@ -1374,7 +1374,6 @@ FROM and TO must be in increasing order, as must be the pairs in RANGES." ;; (time-trial ;; '(let ((size 10000) ;; doing) -;; (random t) ;; (dotimes (count size) ;; (setq doing (random size)) ;; (funcall try doing (+ doing (random 5))) diff --git a/lisp/calc/calc-comb.el b/lisp/calc/calc-comb.el index 199bbf0ae35..431ea18f580 100644 --- a/lisp/calc/calc-comb.el +++ b/lisp/calc/calc-comb.el @@ -77,7 +77,7 @@ 4877 4889 4903 4909 4919 4931 4933 4937 4943 4951 4957 4967 4969 4973 4987 4993 4999 5003]) -;; The variable math-prime-factors-finished is set by calcFunc-prfac to +;; The variable math-prime-factors-finished is set by calcFunc-prfac to ;; indicate whether factoring is complete, and used by calcFunc-factors, ;; calcFunc-totient and calcFunc-moebius. (defvar math-prime-factors-finished) @@ -510,8 +510,8 @@ (while (<= (length math-stirling-local-cache) n) (let ((i (1- (length math-stirling-local-cache))) row) - (setq math-stirling-local-cache - (vconcat math-stirling-local-cache + (setq math-stirling-local-cache + (vconcat math-stirling-local-cache (make-vector (length math-stirling-local-cache) nil))) (aset math-stirling-cache k math-stirling-local-cache) (while (< (setq i (1+ i)) (length math-stirling-local-cache)) @@ -572,7 +572,6 @@ (let ((i 200)) (while (> (setq i (1- i)) 0) (math-random-base)))) - (random t) (setq var-RandSeed nil math-random-cache nil math-random-shift -4) ; assume RAND_MAX >= 16383 @@ -629,7 +628,7 @@ (i (/ (+ n slop) 3)) (rnum 0)) (while (> i 0) - (setq rnum + (setq rnum (math-add (math-random-three-digit-number) (math-mul rnum 1000))) @@ -823,11 +822,11 @@ (setq sum (% (+ sum - (calcFunc-mod + (calcFunc-mod q 1000000)) 111111)) - (setq q - (math-quotient + (setq q + (math-quotient q 1000000))) (cond ((= (% sum 3) 0) '(nil 3)) ((= (% sum 7) 0) '(nil 7)) diff --git a/lisp/calc/calccomp.el b/lisp/calc/calccomp.el index 51ea8e7b7a3..2f1c95b7668 100644 --- a/lisp/calc/calccomp.el +++ b/lisp/calc/calccomp.el @@ -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) diff --git a/lisp/calendar/cal-tex.el b/lisp/calendar/cal-tex.el index c8c80370dfa..9c01ab40c0c 100644 --- a/lisp/calendar/cal-tex.el +++ b/lisp/calendar/cal-tex.el @@ -237,6 +237,14 @@ The names are taken from `calendar-day-name-array'.") "LaTeX code to insert one box with date info in calendar. This definition is the heart of the calendar!") +(defconst cal-tex-lefthead + "\\def\\lefthead#1{\\noindent {\\normalsize \\bf #1}\\hfill\\\\[-6pt]}\n" + "LaTeX code for left header.") + +(defconst cal-tex-righthead + "\\def\\righthead#1{\\hfill {\\normalsize \\bf #1}\\\\[-6pt]}\n" + "LaTeX code for right header.") + (autoload 'holiday-in-range "holidays") (define-obsolete-function-alias 'cal-tex-list-holidays 'holiday-in-range "24.3") @@ -253,14 +261,14 @@ This definition is the heart of the calendar!") "Insert the LaTeX calendar preamble into `cal-tex-buffer'. Preamble includes initial definitions for various LaTeX commands. Optional string ARGS are included as options for the article document class." - ;; FIXME use generate-new-buffer, and adjust cal-tex-end-document. - (set-buffer (get-buffer-create cal-tex-buffer)) + (set-buffer (generate-new-buffer cal-tex-buffer)) (insert (format "\\documentclass%s{article}\n" (if (stringp args) (format "[%s]" args) ""))) (if (stringp cal-tex-preamble-extra) (insert cal-tex-preamble-extra "\n")) + ;; FIXME boxwidth and boxheight unused? (insert "\\hbadness 20000 \\hfuzz=1000pt \\vbadness 20000 @@ -344,6 +352,54 @@ landscape mode with three rows of four months each." (run-hooks 'cal-tex-year-hook)) (run-hooks 'cal-tex-hook)) + +(defun cal-tex-filofax-paper (&optional year) + "Insert some page size settings for filofax layouts." + (insert "\\textwidth 3.25in +\\textheight 6.5in +\\headheight -0.875in +\\topmargin 0pt +") + (insert + ;; Why is this one subtly different? Who knows... + (if year "\\oddsidemargin 1.675in +\\evensidemargin 1.675in +" + "\\oddsidemargin 1.75in +\\evensidemargin 1.5in +\\headsep 0.125in +\\footskip 0.125in +"))) + +(defun cal-tex-longday (funcname height) + "Insert LaTeX code for a long day function." + (insert "\\long\\def\\" funcname "#1#2#3#4#5{% + \\rule{\\textwidth}{0.3pt}\\\\% + \\hbox to \\textwidth{% + \\vbox to " height "{% + \\vspace*{2pt}% + \\hbox to \\textwidth{" + (if (string-equal funcname "leftday") + "\\noindent {\\normalsize \\bf #2} \\small #1 \\hfill #5}%\n" + "\\small #5 \\hfill #1 {\\normalsize \\bf #2}}%\n") + " \\hbox to \\textwidth{\\vbox {\\" + (if (string-equal funcname "leftday") "noindent" "raggedleft") + " \\footnotesize \\em #4}}% + \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\}\n")) + +(defun cal-tex-shortday (funcname) + "Insert LaTeX code for a short day function." + (insert "\\long\\def\\" funcname "#1#2#3{% + \\rule{\\textwidth}{0.3pt}\\\\% + \\hbox to \\textwidth{% + \\vbox {% + \\vspace*{2pt}% + \\hbox to \\textwidth{\\hfill \\small #3 \\hfill}% + \\hbox to \\textwidth{\\vbox {\\" + (if (string-equal funcname "rightday") "raggedleft" "noindent") + " \\em #2}}% + \\hbox to \\textwidth{\\vbox {\\noindent \\footnotesize #1}}}}}\n")) + ;;;###cal-autoload (defun cal-tex-cursor-filofax-year (&optional n event) "Make a Filofax one page yearly calendar of year indicated by cursor. @@ -354,16 +410,11 @@ Optional EVENT indicates a buffer position to use instead of point." (or n (setq n 1)) (let ((year (calendar-extract-year (calendar-cursor-to-date t event)))) (cal-tex-preamble "twoside") - (cal-tex-cmd "\\textwidth 3.25in") - (cal-tex-cmd "\\textheight 6.5in") - (cal-tex-cmd "\\oddsidemargin 1.675in") - (cal-tex-cmd "\\evensidemargin 1.675in") - (cal-tex-cmd "\\topmargin 0pt") - (cal-tex-cmd "\\headheight -0.875in") + (cal-tex-filofax-paper 'year) (cal-tex-cmd "\\fboxsep 0.5mm") - (cal-tex-cmd "\\pagestyle{empty}") + (cal-tex-cmd "\\pagestyle" "empty") (cal-tex-b-document) - (cal-tex-cmd "\\vspace*{0.25in}") + (cal-tex-vspace "0.25in") (dotimes (j n) (insert (format "\\hfil \\textbf{\\Large %s} \\hfil\\\\\n" year)) (cal-tex-b-center) @@ -391,7 +442,7 @@ Optional EVENT indicates a buffer position to use instead of point." (if (= j (1- n)) (cal-tex-end-document) (cal-tex-newpage) - (cal-tex-cmd "\\vspace*{0.25in}")) + (cal-tex-vspace "0.25in")) (run-hooks 'cal-tex-year-hook)) (run-hooks 'cal-tex-hook))) @@ -653,6 +704,15 @@ this is only an upper bound." {\\makebox[2em]{\\rule{0cm}{#2ex}#1}\\rule{3in}{.15mm}}\n" "One hour and a line on the right.") +(defun cal-tex-weekly-paper (&optional nomargins) + "Insert some page size settings for weekly layouts." + (insert "\\textwidth 6.5in +\\textheight 10.5in +") + (or nomargins (insert "\\oddsidemargin 0in +\\evensidemargin 0in +"))) + ;; TODO cal-tex-diary-support. ;; TODO respect cal-tex-daily-start,end (see cal-tex-week-hours). ;;;###cal-autoload @@ -677,13 +737,10 @@ entries are not shown). The calendar shows the hours 8-12am, 1-5pm." (holidays (if cal-tex-holidays (holiday-in-range d1 d2)))) (cal-tex-preamble "11pt") - (cal-tex-cmd "\\textwidth 6.5in") - (cal-tex-cmd "\\textheight 10.5in") - (cal-tex-cmd "\\oddsidemargin 0in") - (cal-tex-cmd "\\evensidemargin 0in") + (cal-tex-weekly-paper) (insert cal-tex-LaTeX-hourbox) (cal-tex-b-document) - (cal-tex-cmd "\\pagestyle{empty}") + (cal-tex-cmd "\\pagestyle" "empty") (dotimes (i n) (cal-tex-vspace "-1.5in") (cal-tex-b-center) @@ -732,13 +789,10 @@ Optional EVENT indicates a buffer position to use instead of point." (holidays (if cal-tex-holidays (holiday-in-range d1 d2)))) (cal-tex-preamble "12pt") - (cal-tex-cmd "\\textwidth 6.5in") - (cal-tex-cmd "\\textheight 10.5in") - (cal-tex-cmd "\\oddsidemargin 0in") - (cal-tex-cmd "\\evensidemargin 0in") + (cal-tex-weekly-paper) (insert cal-tex-LaTeX-hourbox) (cal-tex-b-document) - (cal-tex-cmd "\\pagestyle{empty}") + (cal-tex-cmd "\\pagestyle" "empty") (dotimes (i n) (cal-tex-vspace "-1.5in") (cal-tex-b-center) @@ -816,18 +870,12 @@ position to use instead of point." (holidays (if cal-tex-holidays (holiday-in-range d1 d2))) (diary-list (if cal-tex-diary - (cal-tex-list-diary-entries - ;; FIXME d1? - (calendar-absolute-from-gregorian (list month 1 year)) - d2))) + (cal-tex-list-diary-entries d1 d2))) s) (cal-tex-preamble "11pt") - (cal-tex-cmd "\\textwidth 6.5in") - (cal-tex-cmd "\\textheight 10.5in") - (cal-tex-cmd "\\oddsidemargin 0in") - (cal-tex-cmd "\\evensidemargin 0in") + (cal-tex-weekly-paper) (cal-tex-b-document) - (cal-tex-cmd "\\pagestyle{empty}") + (cal-tex-cmd "\\pagestyle" "empty") (dotimes (i n) (cal-tex-vspace "-1.5in") (cal-tex-b-center) @@ -944,10 +992,7 @@ to use instead of point." (calendar-absolute-from-gregorian (calendar-cursor-to-date t event)))))) (cal-tex-preamble "11pt") - (cal-tex-cmd "\\textwidth 6.5in") - (cal-tex-cmd "\\textheight 10.5in") - (cal-tex-cmd "\\oddsidemargin 0in") - (cal-tex-cmd "\\evensidemargin 0in") + (cal-tex-weekly-paper) (cal-tex-b-document) (dotimes (i n) (cal-tex-vspace "-1cm") @@ -1009,15 +1054,8 @@ shown are hard-coded to 8-12, 13-17." (cal-tex-e-framebox) (cal-tex-hspace "1cm"))) -(defun cal-tex-cursor-week-at-a-glance (&optional n event) - "One-week-at-a-glance full page calendar for week indicated by cursor. -Optional prefix argument N specifies number of weeks (default 1), -starting on Mondays. The calendar shows holiday and diary entries -if `cal-tex-holidays' and `cal-tex-diary', respectively, are non-nil. -It does not show hours of the day. Optional EVENT indicates a buffer -position to use instead of point." - (interactive (list (prefix-numeric-value current-prefix-arg) - last-nonmenu-event)) +(defun cal-tex-weekly-common (n event &optional filofax) + "Common code for weekly calendars." (or n (setq n 1)) (let* ((date (calendar-gregorian-from-absolute (calendar-dayname-on-or-before @@ -1033,45 +1071,37 @@ position to use instead of point." (holiday-in-range d1 d2))) (diary-list (if cal-tex-diary (cal-tex-list-diary-entries d1 d2)))) - (cal-tex-preamble "twoside,12pt") - (cal-tex-cmd "\\usepackage{color}") - (cal-tex-cmd "\\textwidth 7in") - (cal-tex-cmd "\\textheight 10.5in") - (cal-tex-cmd "\\oddsidemargin 0in") - (cal-tex-cmd "\\evensidemargin 0in") - (cal-tex-cmd "\\topmargin 0pt") - (cal-tex-cmd "\\headheight -0.875in") - (cal-tex-cmd "\\headsep 0.125in") - (cal-tex-cmd "\\footskip .125in") - (insert "\\def\\righthead#1{\\hfill {\\normalsize \\bf #1}\\\\[-6pt]} -\\long\\def\\rightday#1#2#3#4#5{% - \\rule{\\textwidth}{0.3pt}\\\\% - \\hbox to \\textwidth{% - \\vbox to 2.75in{% - \\vspace*{2pt}% - \\hbox to \\textwidth{\\small #5 \\hfill #1 {\\normalsize \\bf #2}}% - \\hbox to \\textwidth{\\vbox {\\raggedleft \\footnotesize \\em \\textcolor{red}{#4}}}% - \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize \\textcolor{blue}{#3}}}}}\\\\} -\\long\\def\\weekend#1#2#3#4#5{% - \\rule{\\textwidth}{0.3pt}\\\\% - \\hbox to \\textwidth{% - \\vbox to 1.8in{% - \\vspace*{2pt}% - \\hbox to \\textwidth{\\small #5 \\hfill #1 {\\normalsize \\bf #2}}% - \\hbox to \\textwidth{\\vbox {\\raggedleft \\footnotesize \\em \\textcolor{red}{#4}}}% - \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize \\textcolor{blue}{#3}}}}}\\\\} -\\def\\lefthead#1{\\noindent {\\normalsize \\bf #1}\\hfill\\\\[-6pt]} -\\long\\def\\leftday#1#2#3#4#5{% - \\rule{\\textwidth}{0.3pt}\\\\% - \\hbox to \\textwidth{% - \\vbox to 2.75in{% - \\vspace*{2pt}% - \\hbox to \\textwidth{\\noindent {\\normalsize \\bf #2} \\small #1 \\hfill #5}% - \\hbox to \\textwidth{\\vbox {\\noindent \\footnotesize \\em \\textcolor{red}{#4}}}% - \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize \\textcolor{blue}{#3}}}}}\\\\} + (if filofax + (progn + (cal-tex-preamble "twoside") + (cal-tex-filofax-paper) + (insert cal-tex-righthead) + (cal-tex-longday "rightday" "1.85in") + (cal-tex-longday "weekend" "0.8in") + (insert cal-tex-lefthead) + (cal-tex-longday "leftday" "1.85in")) + (cal-tex-preamble "twoside,12pt") + (insert "\\textwidth 7in +\\textheight 10.5in +\\oddsidemargin 0in +\\evensidemargin 0in +\\topmargin 0pt +\\headheight -0.875in +\\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")) (cal-tex-b-document) - (cal-tex-cmd "\\pagestyle{empty}\\ ") + (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") @@ -1104,34 +1134,35 @@ position to use instead of point." (insert "%\n") (setq date (cal-tex-incr-date date))) (insert "\\noindent\\rule{\\textwidth}{0.3pt}\\\\%\n") - (cal-tex-nl) - (insert (cal-tex-mini-calendar - (calendar-extract-month (cal-tex-previous-month date)) - (calendar-extract-year (cal-tex-previous-month date)) - "lastmonth" "1.1in" "1in")) - (insert (cal-tex-mini-calendar - (calendar-extract-month date) - (calendar-extract-year date) - "thismonth" "1.1in" "1in")) - (insert (cal-tex-mini-calendar - (calendar-extract-month (cal-tex-next-month date)) - (calendar-extract-year (cal-tex-next-month date)) - "nextmonth" "1.1in" "1in")) - (insert "\\hbox to \\textwidth{") - (cal-tex-hfill) - (insert "\\lastmonth") - (cal-tex-hfill) - (insert "\\thismonth") - (cal-tex-hfill) - (insert "\\nextmonth") - (cal-tex-hfill) - (insert "}") + (unless filofax + (cal-tex-nl) + (insert (cal-tex-mini-calendar + (calendar-extract-month (cal-tex-previous-month date)) + (calendar-extract-year (cal-tex-previous-month date)) + "lastmonth" "1.1in" "1in")) + (insert (cal-tex-mini-calendar + (calendar-extract-month date) + (calendar-extract-year date) + "thismonth" "1.1in" "1in")) + (insert (cal-tex-mini-calendar + (calendar-extract-month (cal-tex-next-month date)) + (calendar-extract-year (cal-tex-next-month date)) + "nextmonth" "1.1in" "1in")) + (insert "\\hbox to \\textwidth{") + (cal-tex-hfill) + (insert "\\lastmonth") + (cal-tex-hfill) + (insert "\\thismonth") + (cal-tex-hfill) + (insert "\\nextmonth") + (cal-tex-hfill) + (insert "}")) (cal-tex-newpage) (insert "\\righthead") (cal-tex-arg (let ((d (cal-tex-incr-date date 3))) (if (= (calendar-extract-month date) - (calendar-extract-month d)) + (calendar-extract-month d)) (format "%s %s" (cal-tex-month-name (calendar-extract-month date)) (calendar-extract-year date)) @@ -1172,6 +1203,18 @@ position to use instead of point." (run-hooks 'cal-tex-hook))) ;;;###cal-autoload +(defun cal-tex-cursor-week-at-a-glance (&optional n event) + "One-week-at-a-glance full page calendar for week indicated by cursor. +Optional prefix argument N specifies number of weeks (default 1), +starting on Mondays. The calendar shows holiday and diary entries +if `cal-tex-holidays' and `cal-tex-diary', respectively, are non-nil. +It does not show hours of the day. Optional EVENT indicates a buffer +position to use instead of point." + (interactive (list (prefix-numeric-value current-prefix-arg) + last-nonmenu-event)) + (cal-tex-weekly-common n event)) + +;;;###cal-autoload (defun cal-tex-cursor-filofax-2week (&optional n event) "Two-weeks-at-a-glance Filofax style calendar for week cursor is in. Optional prefix argument N specifies number of weeks (default 1). @@ -1194,40 +1237,15 @@ Optional EVENT indicates a buffer position to use instead of point." (holidays (if cal-tex-holidays (holiday-in-range d1 d2))) (diary-list (if cal-tex-diary - (cal-tex-list-diary-entries - ;; FIXME d1? - (calendar-absolute-from-gregorian (list month 1 year)) - d2)))) + (cal-tex-list-diary-entries d1 d2)))) (cal-tex-preamble "twoside") - (cal-tex-cmd "\\textwidth 3.25in") - (cal-tex-cmd "\\textheight 6.5in") - (cal-tex-cmd "\\oddsidemargin 1.75in") - (cal-tex-cmd "\\evensidemargin 1.5in") - (cal-tex-cmd "\\topmargin 0pt") - (cal-tex-cmd "\\headheight -0.875in") - (cal-tex-cmd "\\headsep 0.125in") - (cal-tex-cmd "\\footskip .125in") - (insert "\\def\\righthead#1{\\hfill {\\normalsize \\bf #1}\\\\[-6pt]} -\\long\\def\\rightday#1#2#3#4#5{% - \\rule{\\textwidth}{0.3pt}\\\\% - \\hbox to \\textwidth{% - \\vbox to 0.7in{% - \\vspace*{2pt}% - \\hbox to \\textwidth{\\small #5 \\hfill #1 {\\normalsize \\bf #2}}% - \\hbox to \\textwidth{\\vbox {\\raggedleft \\footnotesize \\em #4}}% - \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\} -\\def\\lefthead#1{\\noindent {\\normalsize \\bf #1}\\hfill\\\\[-6pt]} -\\long\\def\\leftday#1#2#3#4#5{% - \\rule{\\textwidth}{0.3pt}\\\\% - \\hbox to \\textwidth{% - \\vbox to 0.7in{% - \\vspace*{2pt}% - \\hbox to \\textwidth{\\noindent {\\normalsize \\bf #2} \\small #1 \\hfill #5}% - \\hbox to \\textwidth{\\vbox {\\noindent \\footnotesize \\em #4}}% - \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\} -") + (cal-tex-filofax-paper) + (insert cal-tex-righthead) + (cal-tex-longday "rightday" "0.7in") + (insert cal-tex-lefthead) + (cal-tex-longday "leftday" "0.7in") (cal-tex-b-document) - (cal-tex-cmd "\\pagestyle{empty}") + (cal-tex-cmd "\\pagestyle" "empty") (dotimes (i n) (if (zerop (mod i 2)) (insert "\\righthead") @@ -1277,138 +1295,7 @@ if `cal-tex-holidays' and `cal-tex-diary', respectively, are non-nil. Optional EVENT indicates a buffer position to use instead of point." (interactive (list (prefix-numeric-value current-prefix-arg) last-nonmenu-event)) - (or n (setq n 1)) - (let* ((date (calendar-gregorian-from-absolute - (calendar-dayname-on-or-before - 1 - (calendar-absolute-from-gregorian - (calendar-cursor-to-date t event))))) - (month (calendar-extract-month date)) - (year (calendar-extract-year date)) - (day (calendar-extract-day date)) - (d1 (calendar-absolute-from-gregorian date)) - (d2 (+ (* 7 n) d1)) - (holidays (if cal-tex-holidays - (holiday-in-range d1 d2))) - (diary-list (if cal-tex-diary - (cal-tex-list-diary-entries - ;; FIXME d1? - (calendar-absolute-from-gregorian (list month 1 year)) - d2)))) - (cal-tex-preamble "twoside") - (cal-tex-cmd "\\textwidth 3.25in") - (cal-tex-cmd "\\textheight 6.5in") - (cal-tex-cmd "\\oddsidemargin 1.75in") - (cal-tex-cmd "\\evensidemargin 1.5in") - (cal-tex-cmd "\\topmargin 0pt") - (cal-tex-cmd "\\headheight -0.875in") - (cal-tex-cmd "\\headsep 0.125in") - (cal-tex-cmd "\\footskip .125in") - (insert "\\def\\righthead#1{\\hfill {\\normalsize \\bf #1}\\\\[-6pt]} -\\long\\def\\rightday#1#2#3#4#5{% - \\rule{\\textwidth}{0.3pt}\\\\% - \\hbox to \\textwidth{% - \\vbox to 1.85in{% - \\vspace*{2pt}% - \\hbox to \\textwidth{\\small #5 \\hfill #1 {\\normalsize \\bf #2}}% - \\hbox to \\textwidth{\\vbox {\\raggedleft \\footnotesize \\em #4}}% - \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\} -\\long\\def\\weekend#1#2#3#4#5{% - \\rule{\\textwidth}{0.3pt}\\\\% - \\hbox to \\textwidth{% - \\vbox to .8in{% - \\vspace*{2pt}% - \\hbox to \\textwidth{\\small #5 \\hfill #1 {\\normalsize \\bf #2}}% - \\hbox to \\textwidth{\\vbox {\\raggedleft \\footnotesize \\em #4}}% - \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\} -\\def\\lefthead#1{\\noindent {\\normalsize \\bf #1}\\hfill\\\\[-6pt]} -\\long\\def\\leftday#1#2#3#4#5{% - \\rule{\\textwidth}{0.3pt}\\\\% - \\hbox to \\textwidth{% - \\vbox to 1.85in{% - \\vspace*{2pt}% - \\hbox to \\textwidth{\\noindent {\\normalsize \\bf #2} \\small #1 \\hfill #5}% - \\hbox to \\textwidth{\\vbox {\\noindent \\footnotesize \\em #4}}% - \\hbox to \\textwidth{\\vbox to 0pt {\\noindent \\footnotesize #3}}}}\\\\} -") - (cal-tex-b-document) - (cal-tex-cmd "\\pagestyle{empty}\\ ") - (cal-tex-newpage) - (dotimes (i n) - (insert "\\lefthead") - (cal-tex-arg - (let ((d (cal-tex-incr-date date 2))) - (if (= (calendar-extract-month date) - (calendar-extract-month d)) - (format "%s %s" - (cal-tex-month-name (calendar-extract-month date)) - (calendar-extract-year date)) - (if (= (calendar-extract-year date) - (calendar-extract-year d)) - (format "%s---%s %s" - (cal-tex-month-name (calendar-extract-month date)) - (cal-tex-month-name (calendar-extract-month d)) - (calendar-extract-year date)) - (format "%s %s---%s %s" - (cal-tex-month-name (calendar-extract-month date)) - (calendar-extract-year date) - (cal-tex-month-name (calendar-extract-month d)) - (calendar-extract-year d)))))) - (insert "%\n") - (dotimes (_jdummy 3) - (insert "\\leftday") - (cal-tex-arg (cal-tex-LaTeXify-string (calendar-day-name date))) - (cal-tex-arg (number-to-string (calendar-extract-day date))) - (cal-tex-arg (cal-tex-latexify-list diary-list date)) - (cal-tex-arg (cal-tex-latexify-list holidays date)) - (cal-tex-arg (eval cal-tex-daily-string)) - (insert "%\n") - (setq date (cal-tex-incr-date date))) - (insert "\\noindent\\rule{\\textwidth}{0.3pt}\\\\%\n") - (cal-tex-newpage) - (insert "\\righthead") - (cal-tex-arg - (let ((d (cal-tex-incr-date date 3))) - (if (= (calendar-extract-month date) - (calendar-extract-month d)) - (format "%s %s" - (cal-tex-month-name (calendar-extract-month date)) - (calendar-extract-year date)) - (if (= (calendar-extract-year date) - (calendar-extract-year d)) - (format "%s---%s %s" - (cal-tex-month-name (calendar-extract-month date)) - (cal-tex-month-name (calendar-extract-month d)) - (calendar-extract-year date)) - (format "%s %s---%s %s" - (cal-tex-month-name (calendar-extract-month date)) - (calendar-extract-year date) - (cal-tex-month-name (calendar-extract-month d)) - (calendar-extract-year d)))))) - (insert "%\n") - (dotimes (_jdummy 2) - (insert "\\rightday") - (cal-tex-arg (cal-tex-LaTeXify-string (calendar-day-name date))) - (cal-tex-arg (number-to-string (calendar-extract-day date))) - (cal-tex-arg (cal-tex-latexify-list diary-list date)) - (cal-tex-arg (cal-tex-latexify-list holidays date)) - (cal-tex-arg (eval cal-tex-daily-string)) - (insert "%\n") - (setq date (cal-tex-incr-date date))) - (dotimes (_jdummy 2) - (insert "\\weekend") - (cal-tex-arg (cal-tex-LaTeXify-string (calendar-day-name date))) - (cal-tex-arg (number-to-string (calendar-extract-day date))) - (cal-tex-arg (cal-tex-latexify-list diary-list date)) - (cal-tex-arg (cal-tex-latexify-list holidays date)) - (cal-tex-arg (eval cal-tex-daily-string)) - (insert "%\n") - (setq date (cal-tex-incr-date date))) - (unless (= i (1- n)) - (run-hooks 'cal-tex-week-hook) - (cal-tex-newpage))) - (cal-tex-end-document) - (run-hooks 'cal-tex-hook))) + (cal-tex-weekly-common n event t)) ;;;###cal-autoload (defun cal-tex-cursor-filofax-daily (&optional n event) @@ -1434,52 +1321,21 @@ Optional EVENT indicates a buffer position to use instead of point." (holidays (if cal-tex-holidays (holiday-in-range d1 d2))) (diary-list (if cal-tex-diary - (cal-tex-list-diary-entries - ;; FIXME d1? - (calendar-absolute-from-gregorian (list month 1 year)) - d2)))) + (cal-tex-list-diary-entries d1 d2)))) (cal-tex-preamble "twoside") - (cal-tex-cmd "\\textwidth 3.25in") - (cal-tex-cmd "\\textheight 6.5in") - (cal-tex-cmd "\\oddsidemargin 1.75in") - (cal-tex-cmd "\\evensidemargin 1.5in") - (cal-tex-cmd "\\topmargin 0pt") - (cal-tex-cmd "\\headheight -0.875in") - (cal-tex-cmd "\\headsep 0.125in") - (cal-tex-cmd "\\footskip .125in") - (insert "\\def\\righthead#1{\\hfill {\\normalsize \\bf #1}\\\\[-6pt]} -\\long\\def\\rightday#1#2#3{% - \\rule{\\textwidth}{0.3pt}\\\\% - \\hbox to \\textwidth{% - \\vbox {% - \\vspace*{2pt}% - \\hbox to \\textwidth{\\hfill \\small #3 \\hfill}% - \\hbox to \\textwidth{\\vbox {\\raggedleft \\em #2}}% - \\hbox to \\textwidth{\\vbox {\\noindent \\footnotesize #1}}}}} -\\long\\def\\weekend#1#2#3{% - \\rule{\\textwidth}{0.3pt}\\\\% - \\hbox to \\textwidth{% - \\vbox {% - \\vspace*{2pt}% - \\hbox to \\textwidth{\\hfill \\small #3 \\hfill}% - \\hbox to \\textwidth{\\vbox {\\noindent \\em #2}}% - \\hbox to \\textwidth{\\vbox {\\noindent \\footnotesize #1}}}}} -\\def\\lefthead#1{\\noindent {\\normalsize \\bf #1}\\hfill\\\\[-6pt]} -\\long\\def\\leftday#1#2#3{% - \\rule{\\textwidth}{0.3pt}\\\\% - \\hbox to \\textwidth{% - \\vbox {% - \\vspace*{2pt}% - \\hbox to \\textwidth{\\hfill \\small #3 \\hfill}% - \\hbox to \\textwidth{\\vbox {\\noindent \\em #2}}% - \\hbox to \\textwidth{\\vbox {\\noindent \\footnotesize #1}}}}} -\\newbox\\LineBox + (cal-tex-filofax-paper) + (insert cal-tex-righthead) + (cal-tex-shortday "rightday") + (cal-tex-shortday "weekend") + (insert cal-tex-lefthead) + (cal-tex-shortday "leftday") + (insert "\\newbox\\LineBox \\setbox\\LineBox=\\hbox to\\textwidth{% \\vrule height.2in width0pt\\leaders\\hrule\\hfill} \\def\\linesfill{\\par\\leaders\\copy\\LineBox\\vfill} ") (cal-tex-b-document) - (cal-tex-cmd "\\pagestyle{empty}") + (cal-tex-cmd "\\pagestyle" "empty") (dotimes (i n) (dotimes (j 4) (let ((even (zerop (% j 2)))) @@ -1539,10 +1395,9 @@ a buffer position to use instead of point." (let ((date (calendar-absolute-from-gregorian (calendar-cursor-to-date t event)))) (cal-tex-preamble "12pt") - (cal-tex-cmd "\\textwidth 6.5in") - (cal-tex-cmd "\\textheight 10.5in") + (cal-tex-weekly-paper 'nomargins) (cal-tex-b-document) - (cal-tex-cmd "\\pagestyle{empty}") + (cal-tex-cmd "\\pagestyle" "empty") (dotimes (i n) (cal-tex-vspace "-1.7in") (cal-tex-daily-page (calendar-gregorian-from-absolute date)) @@ -1736,7 +1591,7 @@ informative header, and run HOOK." ;; FIXME latin1 might not always be right. (insert "\\usepackage[latin1]{inputenc}\n")))) (latex-mode) - (pop-to-buffer cal-tex-buffer) + (pop-to-buffer (current-buffer)) (goto-char (point-min)) ;; FIXME auctex equivalents? (cal-tex-comment @@ -1761,16 +1616,16 @@ non-nil, means add to end of buffer without erasing current contents." (if (not landscape) (progn (cal-tex-cmd "\\oddsidemargin -1.75cm") - (cal-tex-cmd "\\def\\holidaymult{.06}")) - (cal-tex-cmd "\\special{landscape}") + (cal-tex-cmd "\\def\\holidaymult" ".06")) + (cal-tex-cmd "\\special" "landscape") (cal-tex-cmd "\\textwidth 9.5in") (cal-tex-cmd "\\textheight 7in") (cal-tex-comment) - (cal-tex-cmd "\\def\\holidaymult{.08}")) + (cal-tex-cmd "\\def\\holidaymult" ".08")) (cal-tex-cmd cal-tex-caldate) (cal-tex-cmd cal-tex-myday) (cal-tex-b-document) - (cal-tex-cmd "\\pagestyle{empty}")) + (cal-tex-cmd "\\pagestyle" "empty")) (cal-tex-cmd "\\setlength{\\cellwidth}" width) (insert (format "\\setlength{\\cellwidth}{%f\\cellwidth}\n" (/ 1.1 (length cal-tex-which-days)))) @@ -1833,13 +1688,11 @@ non-nil, means add to end of buffer without erasing current contents." (defun cal-tex-vspace (space) "Insert vspace command to move SPACE vertically." - (insert "\\vspace*{" space "}") - (cal-tex-comment)) + (cal-tex-cmd "\\vspace*" space)) (defun cal-tex-hspace (space) "Insert hspace command to move SPACE horizontally." - (insert "\\hspace*{" space "}") - (cal-tex-comment)) + (cal-tex-cmd "\\hspace*" space)) (defun cal-tex-comment (&optional comment) "Insert `% ', followed by optional string COMMENT, followed by newline. @@ -1878,20 +1731,20 @@ Add trailing COMMENT if present." (defun cal-tex-b-document () "Insert beginning of document." - (cal-tex-cmd "\\begin{document}")) + (cal-tex-cmd "\\begin" "document")) (defun cal-tex-e-document () "Insert end of document." - (cal-tex-cmd "\\end{document}")) + (cal-tex-cmd "\\end" "document")) (defun cal-tex-b-center () "Insert beginning of centered block." - (cal-tex-cmd "\\begin{center}")) + (cal-tex-cmd "\\begin" "center")) (defun cal-tex-e-center () "Insert end of centered block." (cal-tex-comment) - (cal-tex-cmd "\\end{center}")) + (cal-tex-cmd "\\end" "center")) ;;; @@ -1946,35 +1799,35 @@ Add trailing COMMENT if present." (defun cal-tex-em (string) "Insert STRING in italic font." - (insert "\\textit{" string "}")) + (cal-tex-cmd "\\textit" string)) (defun cal-tex-bf (string) "Insert STRING in bf font." - (insert "\\textbf{ " string "}")) + (cal-tex-cmd "\\textbf" string)) (defun cal-tex-scriptsize (string) "Insert STRING in scriptsize font." - (insert "{\\scriptsize " string "}")) + (cal-tex-arg (concat "\\scriptsize " string))) (defun cal-tex-huge (string) "Insert STRING in huge font." - (insert "{\\huge " string "}")) + (cal-tex-arg (concat "\\huge " string))) (defun cal-tex-Huge (string) "Insert STRING in Huge font." - (insert "{\\Huge " string "}")) + (cal-tex-arg (concat "\\Huge " string))) (defun cal-tex-Huge-bf (string) "Insert STRING in Huge bf font." - (insert "\\textbf{\\Huge " string "}")) + (cal-tex-cmd "\\textbf" (concat "\\Huge " string))) (defun cal-tex-large (string) "Insert STRING in large font." - (insert "{\\large " string "}")) + (cal-tex-arg (concat "\\large " string))) (defun cal-tex-large-bf (string) "Insert STRING in large bf font." - (insert "\\textbf{\\large " string "}")) + (cal-tex-cmd "\\textbf" (concat "\\large " string))) (provide 'cal-tex) diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el index 2e073fd1267..8fa5b0ddb07 100644 --- a/lisp/calendar/diary-lib.el +++ b/lisp/calendar/diary-lib.el @@ -951,12 +951,12 @@ This is recursive; that is, included files may include other files." (setq diary-entries-list (append diary-entries-list (diary-list-entries original-date number t))))) - (beep) - (message "Can't read included diary file %s" diary-file) - (sleep-for 2)) - (beep) - (message "Can't find included diary file %s" diary-file) - (sleep-for 2)))) + (display-warning + :error + (format "Can't read included diary file %s\n" diary-file))) + (display-warning + :error + (format "Can't find included diary file %s\n" diary-file))))) (goto-char (point-min))) (defun diary-include-other-diary-files () @@ -1456,14 +1456,17 @@ marks. This is intended to deal with deleted diary entries." (let ((result (if calendar-debug-sexp (let ((debug-on-error t)) (eval (car (read-from-string sexp)))) - (condition-case nil - (eval (car (read-from-string sexp))) - (error - (beep) - (message "Bad sexp at line %d in %s: %s" - (count-lines (point-min) (point)) - diary-file sexp) - (sleep-for 2)))))) + (let (err) + (condition-case err + (eval (car (read-from-string sexp))) + (error + (display-warning + :error + (format "Bad diary sexp at line %d in %s:\n%s\n\ +Error: %s\n" + (count-lines (point-min) (point)) + diary-file sexp err)) + nil)))))) (cond ((stringp result) result) ((and (consp result) (stringp (cdr result))) result) diff --git a/lisp/calendar/holidays.el b/lisp/calendar/holidays.el index 0bb3c231840..043d402f612 100644 --- a/lisp/calendar/holidays.el +++ b/lisp/calendar/holidays.el @@ -458,17 +458,20 @@ with descriptive strings such as (defun calendar-holiday-list () "Form the list of holidays that occur on dates in the calendar window. The holidays are those in the list `calendar-holidays'." - (let (res h) + (let (res h err) (sort (dolist (p calendar-holidays res) (if (setq h (if calendar-debug-sexp (let ((debug-on-error t)) (eval p)) - (condition-case nil + (condition-case err (eval p) - (error (beep) - (message "Bad holiday list item: %s" p) - (sleep-for 2))))) + (error + (display-warning + :error + (format "Bad holiday list item: %s\nError: %s\n" + p err)) + nil)))) (setq res (append h res)))) 'calendar-date-compare))) diff --git a/lisp/cus-face.el b/lisp/cus-face.el index 3680a2648ce..06fd10149d3 100644 --- a/lisp/cus-face.el +++ b/lisp/cus-face.el @@ -136,12 +136,36 @@ :help-echo "Control text underlining." (const :tag "Off" nil) (list :tag "On" + :value (:color foreground-color :style line) (const :format "" :value :color) - (choice :tag "Color" (const :tag "Foreground Color" foreground-color) color) - (const :format "" :value :style) - (choice :tag "Style" - (const :tag "Line" line) - (const :tag "Wave" wave))))) + (choice :tag "Color" + (const :tag "Foreground Color" foreground-color) + color) + (const :format "" :value :style) + (choice :tag "Style" + (const :tag "Line" line) + (const :tag "Wave" wave)))) + ;; filter to make value suitable for customize + (lambda (real-value) + (and real-value + (let ((color + (or (and (consp real-value) (plist-get real-value :color)) + (and (stringp real-value) real-value) + 'foreground-color)) + (style + (or (and (consp real-value) (plist-get real-value :style)) + 'line))) + (list :color color :style style)))) + ;; filter to make customized-value suitable for storing + (lambda (cus-value) + (and cus-value + (let ((color (plist-get cus-value :color)) + (style (plist-get cus-value :style))) + (cond ((eq style 'line) + ;; Use simple value for default style + (if (eq color 'foreground-color) t color)) + (t + `(:color ,color :style ,style))))))) (:overline (choice :tag "Overline" diff --git a/lisp/dired.el b/lisp/dired.el index 6684be3356c..cd27b6b6404 100644 --- a/lisp/dired.el +++ b/lisp/dired.el @@ -1331,16 +1331,16 @@ DIRED-FILENAME WINDOW-POINT)." "Mark all files remembered in ALIST. Each element of ALIST looks like (FILE . MARKERCHAR)." (let (elt fil chr) - (while alist - (setq elt (car alist) - alist (cdr alist) - fil (car elt) - chr (cdr elt)) - (if (dired-goto-file fil) - (save-excursion - (beginning-of-line) - (delete-char 1) - (insert chr)))))) + (save-excursion + (while alist + (setq elt (car alist) + alist (cdr alist) + fil (car elt) + chr (cdr elt)) + (when (dired-goto-file fil) + (beginning-of-line) + (delete-char 1) + (insert chr)))))) (defun dired-remember-hidden () "Return a list of names of subdirs currently hidden." @@ -1739,7 +1739,7 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST." (define-key map [menu-bar operate epa-dired-do-decrypt] - '(menu-item "Decrypt" epa-dired-do-decrypt + '(menu-item "Decrypt..." epa-dired-do-decrypt :help "Decrypt file at cursor")) (define-key map @@ -1749,12 +1749,12 @@ Do so according to the former subdir alist OLD-SUBDIR-ALIST." (define-key map [menu-bar operate epa-dired-do-sign] - '(menu-item "Sign" epa-dired-do-sign + '(menu-item "Sign..." epa-dired-do-sign :help "Create digital signature of file at cursor")) (define-key map [menu-bar operate epa-dired-do-encrypt] - '(menu-item "Encrypt" epa-dired-do-encrypt + '(menu-item "Encrypt..." epa-dired-do-encrypt :help "Encrypt file at cursor")) (define-key map [menu-bar operate dashes-3] @@ -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 @@ -2971,36 +2973,43 @@ If t, confirmation is never needed." (const shell) (const symlink) (const touch) (const uncompress)))) -(defun dired-mark-pop-up (bufname op-symbol files function &rest args) +(defun dired-mark-pop-up (buffer-or-name op-symbol files function &rest args) "Return FUNCTION's result on ARGS after showing which files are marked. -Displays the file names in a buffer named BUFNAME; - nil gives \" *Marked Files*\". -This uses function `dired-pop-to-buffer' to do that. - -FUNCTION should not manipulate files, just read input - (an argument or confirmation). -The window is not shown if there is just one file or - OP-SYMBOL is a member of the list in `dired-no-confirm'. +Displays the file names in a window showing a buffer named +BUFFER-OR-NAME; the default name being \" *Marked Files*\". The +window is not shown if there is just one file, `dired-no-confirm' +is t, or OP-SYMBOL is a member of the list in `dired-no-confirm'. + FILES is the list of marked files. It can also be (t FILENAME) in the case of one marked file, to distinguish that from using -just the current file." - (or bufname (setq bufname " *Marked Files*")) +just the current file. + +FUNCTION should not manipulate files, just read input \(an +argument or confirmation)." (if (or (eq dired-no-confirm t) (memq op-symbol dired-no-confirm) ;; If FILES defaulted to the current line's file. (= (length files) 1)) (apply function args) - (with-current-buffer (get-buffer-create bufname) - (erase-buffer) - ;; Handle (t FILE) just like (FILE), here. - ;; That value is used (only in some cases), to mean - ;; just one file that was marked, rather than the current line file. - (dired-format-columns-of-files (if (eq (car files) t) (cdr files) files)) - (remove-text-properties (point-min) (point-max) - '(mouse-face nil help-echo nil))) - (save-window-excursion - (dired-pop-to-buffer bufname) - (apply function args)))) + (let ((buffer (get-buffer-create (or buffer-or-name " *Marked Files*")))) + (with-current-buffer buffer + (let ((split-height-threshold 0)) + (with-temp-buffer-window + buffer + (cons 'display-buffer-below-selected nil) + #'(lambda (window _value) + (with-selected-window window + (unwind-protect + (apply function args) + (when (window-live-p window) + (quit-restore-window window 'kill))))) + ;; Handle (t FILE) just like (FILE), here. That value is + ;; used (only in some cases), to mean just one file that was + ;; marked, rather than the current line file. + (dired-format-columns-of-files + (if (eq (car files) t) (cdr files) files)) + (remove-text-properties (point-min) (point-max) + '(mouse-face nil help-echo nil)))))))) (defun dired-format-columns-of-files (files) (let ((beg (point))) diff --git a/lisp/emacs-lisp/cl-lib.el b/lisp/emacs-lisp/cl-lib.el index 86497a3c73f..532c81c502c 100644 --- a/lisp/emacs-lisp/cl-lib.el +++ b/lisp/emacs-lisp/cl-lib.el @@ -635,7 +635,7 @@ If ALIST is non-nil, the new pairs are prepended to it." (set-buffer-modified-p ,flag))) (gv-define-simple-setter buffer-name rename-buffer t) (gv-define-setter buffer-string (store) - `(progn (erase-buffer) (insert ,store))) + `(insert (prog1 ,store (erase-buffer)))) (gv-define-simple-setter buffer-substring cl--set-buffer-substring) (gv-define-simple-setter current-buffer set-buffer) (gv-define-simple-setter current-case-table set-case-table) diff --git a/lisp/emacs-lisp/gv.el b/lisp/emacs-lisp/gv.el index d1f997c99c4..4caa0a73866 100644 --- a/lisp/emacs-lisp/gv.el +++ b/lisp/emacs-lisp/gv.el @@ -191,8 +191,9 @@ well for simple place forms. Assignments of VAL to (NAME ARGS...) are expanded by binding the argument forms (VAL ARGS...) according to ARGLIST, then executing BODY, which must return a Lisp form that does the assignment. -Actually, ARGLIST may be bound to temporary variables which are introduced -automatically to preserve proper execution order of the arguments. Example: +The first arg in ARLIST (the one that receives VAL) receives an expression +which can do arbitrary things, whereas the other arguments are all guaranteed +to be pure and copyable. Example use: (gv-define-setter aref (v a i) `(aset ,a ,i ,v))" (declare (indent 2) (debug (&define name sexp body))) `(gv-define-expander ,name diff --git a/lisp/erc/ChangeLog b/lisp/erc/ChangeLog index b87cfd41f61..37e755e7655 100644 --- a/lisp/erc/ChangeLog +++ b/lisp/erc/ChangeLog @@ -1,3 +1,29 @@ +2012-08-21 Josh Feinstein <jlf@foxtail.org> + + * erc-join.el (erc-autojoin-timing): Fix defcustom type. + +2012-08-21 Julien Danjou <julien@danjou.info> + + * erc-match.el (erc-match-message): Use + `erc-match-exclude-server-buffer' not + `erc-track-exclude-server-buffer'. + +2012-08-20 Josh Feinstein <jlf@foxtail.org> + + * erc.el (erc-display-message): Abstract message hiding decision + to new function erc-hide-current-message-p. + (erc-lurker): New customization group. + (erc-lurker-state, erc-lurker-trim-nicks, erc-lurker-ignore-chars) + (erc-lurker-hide-list, erc-lurker-cleanup-interval) + (erc-lurker-threshold-time): New variables. + (erc-lurker-maybe-trim, erc-lurker-initialize, erc-lurker-cleanup) + (erc-hide-current-message-p, erc-canonicalize-server-name) + (erc-lurker-update-status, erc-lurker-p): New functions. Together + they maintain state about which users have spoken in the last + erc-lurker-threshold-time, with all other users being considered + lurkers whose messages of types in erc-lurker-hide-list will not + be displayed by erc-display-message. + 2012-08-06 Julien Danjou <julien@danjou.info> * erc-match.el (erc-match-exclude-server-buffer) diff --git a/lisp/erc/erc-join.el b/lisp/erc/erc-join.el index 85d1edf6427..ae7f90003a6 100644 --- a/lisp/erc/erc-join.el +++ b/lisp/erc/erc-join.el @@ -84,8 +84,8 @@ identification, or after `erc-autojoin-delay' seconds. Any other value means the same as `connect'." :group 'erc-autojoin :version "24.1" - :type '(choice (const :tag "On Connection" 'connect) - (const :tag "When Identified" 'ident))) + :type '(choice (const :tag "On Connection" connect) + (const :tag "When Identified" ident))) (defcustom erc-autojoin-delay 30 "Number of seconds to wait before attempting to autojoin channels. diff --git a/lisp/erc/erc-match.el b/lisp/erc/erc-match.el index 8daf9be2b14..cac042c0298 100644 --- a/lisp/erc/erc-match.el +++ b/lisp/erc/erc-match.el @@ -458,7 +458,7 @@ Use this defun with `erc-insert-modify-hook'." (point-min)) (point-max)))) (when (and vector - (not (and erc-track-exclude-server-buffer + (not (and erc-match-exclude-server-buffer (erc-server-buffer-p)))) (mapc (lambda (match-type) diff --git a/lisp/erc/erc.el b/lisp/erc/erc.el index 0fc308621b1..feef75940f3 100644 --- a/lisp/erc/erc.el +++ b/lisp/erc/erc.el @@ -100,6 +100,10 @@ "Ignoring certain messages" :group 'erc) +(defgroup erc-lurker nil + "Hide specified message types sent by lurkers" + :group 'erc-ignore) + (defgroup erc-query nil "Using separate buffers for private discussions" :group 'erc) @@ -2455,6 +2459,174 @@ See also `erc-make-notice'." string) string))) +(defvar erc-lurker-state nil + "Track the time of the last PRIVMSG for each (server,nick) pair. + +This is implemented as a hash of hashes, where the outer key is +the canonicalized server name (as returned by +`erc-canonicalize-server-name') and the outer value is a hash +table mapping nicks (as returned by `erc-lurker-maybe-trim') to +the times of their most recently received PRIVMSG on any channel +on the given server.") + +(defcustom erc-lurker-trim-nicks t + "If t, trim trailing `erc-lurker-ignore-chars' from nicks. + +This causes e.g. nick and nick` to be considered as the same +individual for activity tracking and lurkiness detection +purposes." + :group 'erc-lurker + :type 'boolean) + +(defun erc-lurker-maybe-trim (nick) + "Maybe trim trailing `erc-lurker-ignore-chars' from NICK. + +Returns NICK unmodified unless `erc-lurker-trim-nicks' is +non-nil." + (if erc-lurker-trim-nicks + (replace-regexp-in-string + (format "[%s]" + (mapconcat (lambda (char) + (regexp-quote (char-to-string char))) + erc-lurker-ignore-chars "")) + "" nick) + nick)) + +(defcustom erc-lurker-ignore-chars "`_" + "Characters at the end of a nick to strip for activity tracking purposes. + +See also `erc-lurker-trim-nicks'." + :group 'erc-lurker + :type 'string) + +(defcustom erc-lurker-hide-list nil + "List of IRC type messages to hide when sent by lurkers. + +A typical value would be '(\"JOIN\" \"PART\" \"QUIT\"). +See also `erc-lurker-p' and `erc-hide-list'." + :group 'erc-lurker + :type 'erc-message-type) + +(defcustom erc-lurker-threshold-time (* 60 60 24) ; 24h by default + "Nicks from which no PRIVMSGs have been received within this +interval (in units of seconds) are considered lurkers by +`erc-lurker-p' and as a result their messages of types in +`erc-lurker-hide-list' will be hidden." + :group 'erc-lurker + :type 'integer) + +(defun erc-lurker-initialize () + "Initialize ERC lurker tracking functionality. + +This function adds `erc-lurker-update-status' to +`erc-insert-pre-hook' in order to record the time of each nick's +most recent PRIVMSG as well as initializing the state variable +storing this information." + (setq erc-lurker-state (make-hash-table :test 'equal)) + (add-hook 'erc-insert-pre-hook 'erc-lurker-update-status)) + +(defun erc-lurker-cleanup () + "Remove all last PRIVMSG state older than `erc-lurker-threshold-time'. + +This should be called regularly to avoid excessive resource +consumption for long-lived IRC or Emacs sessions." + (maphash + (lambda (server hash) + (maphash + (lambda (nick last-PRIVMSG-time) + (when + (> (time-to-seconds (time-subtract + (current-time) + last-PRIVMSG-time)) + erc-lurker-threshold-time) + (remhash nick hash))) + hash) + (if (zerop (hash-table-count hash)) + (remhash server erc-lurker-state))) + erc-lurker-state)) + +(defvar erc-lurker-cleanup-count 0 + "Internal counter variable for use with `erc-lurker-cleanup-interval'.") + +(defvar erc-lurker-cleanup-interval 100 + "Specifies frequency of cleaning up stale erc-lurker state. + +`erc-lurker-update-status' calls `erc-lurker-cleanup' once for +every `erc-lurker-cleanup-interval' updates to +`erc-lurker-state'. This is designed to limit the memory +consumption of lurker state during long Emacs sessions and/or ERC +sessions with large numbers of incoming PRIVMSGs.") + +(defun erc-lurker-update-status (message) + "Update `erc-lurker-state' if necessary. + +This function is called from `erc-insert-pre-hook'. If the +current message is a PRIVMSG, update `erc-lurker-state' to +reflect the fact that its sender has issued a PRIVMSG at the +current time. Otherwise, take no action. + +This function depends on the fact that `erc-display-message' +dynamically binds `parsed', which is used to check if the current +message is a PRIVMSG and to determine its sender. See also +`erc-lurker-trim-nicks' and `erc-lurker-ignore-chars'. + +In order to limit memory consumption, this function also calls +`erc-lurker-cleanup' once every `erc-lurker-cleanup-interval' +updates of `erc-lurker-state'." + (when (and (boundp 'parsed) (erc-response-p parsed)) + (let* ((command (erc-response.command parsed)) + (sender + (erc-lurker-maybe-trim + (car (erc-parse-user (erc-response.sender parsed))))) + (server + (erc-canonicalize-server-name erc-server-announced-name))) + (when (equal command "PRIVMSG") + (when (>= (incf erc-lurker-cleanup-count) erc-lurker-cleanup-interval) + (setq erc-lurker-cleanup-count 0) + (erc-lurker-cleanup)) + (unless (gethash server erc-lurker-state) + (puthash server (make-hash-table :test 'equal) erc-lurker-state)) + (puthash sender (current-time) + (gethash server erc-lurker-state)))))) + +(defun erc-lurker-p (nick) + "Predicate indicating NICK's lurking status on the current server. + +Lurking is the condition where NICK has issued no PRIVMSG on this +server within `erc-lurker-threshold-time'. See also +`erc-lurker-trim-nicks' and `erc-lurker-ignore-chars'." + (unless erc-lurker-state (erc-lurker-initialize)) + (let* ((server + (erc-canonicalize-server-name erc-server-announced-name)) + (last-PRIVMSG-time + (gethash (erc-lurker-maybe-trim nick) + (gethash server erc-lurker-state (make-hash-table))))) + (or (null last-PRIVMSG-time) + (> (time-to-seconds + (time-subtract (current-time) last-PRIVMSG-time)) + erc-lurker-threshold-time)))) + +(defun erc-canonicalize-server-name (server) + "Returns the canonical network name for SERVER if any, +otherwise `erc-server-announced-name'. SERVER is matched against +`erc-common-server-suffixes'." + (when server + (or (cdar (erc-remove-if-not + (lambda (net) (string-match (car net) server)) + erc-common-server-suffixes)) + erc-server-announced-name))) + +(defun erc-hide-current-message-p (parsed) + "Predicate indicating whether the parsed ERC response PARSED should be hidden. + +Messages are always hidden if the message type of PARSED appears in +`erc-hide-list'. In addition, messages whose type is a member of +`erc-lurker-hide-list' are hidden if `erc-lurker-p' returns true." + (let* ((command (erc-response.command parsed)) + (sender (car (erc-parse-user (erc-response.sender parsed))))) + (or (member command erc-hide-list) + (and (member command erc-lurker-hide-list) (erc-lurker-p sender))))) + (defun erc-display-message (parsed type buffer msg &rest args) "Display MSG in BUFFER. @@ -2479,7 +2651,7 @@ See also `erc-format-message' and `erc-display-line'." (if (not (erc-response-p parsed)) (erc-display-line string buffer) - (unless (member (erc-response.command parsed) erc-hide-list) + (unless (erc-hide-current-message-p parsed) (erc-put-text-property 0 (length string) 'erc-parsed parsed string) (erc-put-text-property 0 (length string) 'rear-sticky t string) (erc-display-line string buffer))))) diff --git a/lisp/eshell/em-unix.el b/lisp/eshell/em-unix.el index 35f7a0a9e3d..58402e37508 100644 --- a/lisp/eshell/em-unix.el +++ b/lisp/eshell/em-unix.el @@ -1110,6 +1110,8 @@ Execute a COMMAND as the superuser or another USER.") (format "%s|sudo:%s@%s:%s" (substring prefix 0 -1) user host dir) (format "/sudo:%s@%s:%s" user host dir)))) + ;; Ensure, that Tramp has connected to that construct already. + (file-exists-p default-directory) (eshell-named-command (car orig-args) (cdr orig-args)))))))) (put 'eshell/sudo 'eshell-no-numeric-conversions t) diff --git a/lisp/eshell/esh-ext.el b/lisp/eshell/esh-ext.el index 52df1587d5f..e48213c54d6 100644 --- a/lisp/eshell/esh-ext.el +++ b/lisp/eshell/esh-ext.el @@ -207,9 +207,14 @@ causing the user to wonder if anything's really going on..." (defun eshell-external-command (command args) "Insert output from an external COMMAND, using ARGS." (setq args (eshell-stringify-list (eshell-flatten-list args))) - ;; (if (file-remote-p default-directory) - ;; (eshell-remote-command command args)) - (let ((interp (eshell-find-interpreter command))) + (let ((interp (eshell-find-interpreter + command + ;; `eshell-find-interpreter' does not work correctly + ;; for Tramp file name syntax. But we don't need to + ;; know the interpreter in that case, therefore the + ;; check is suppressed. + (or (and (stringp command) (file-remote-p command)) + (file-remote-p default-directory))))) (cl-assert interp) (if (functionp (car interp)) (apply (car interp) (append (cdr interp) args)) diff --git a/lisp/faces.el b/lisp/faces.el index 2e1ba7798e9..6a477e172e1 100644 --- a/lisp/faces.el +++ b/lisp/faces.el @@ -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) diff --git a/lisp/ffap.el b/lisp/ffap.el index d0f3b639cf2..ebe8b6dee94 100644 --- a/lisp/ffap.el +++ b/lisp/ffap.el @@ -1703,7 +1703,7 @@ Only intended for interactive use." buffer-or-list (list buffer-or-list))) (with-current-buffer buffer - (toggle-read-only 1)))) + (read-only-mode 1)))) (defun ffap-read-only () "Like `ffap', but mark buffer as read-only. diff --git a/lisp/files.el b/lisp/files.el index 5caa4681884..6528632c841 100644 --- a/lisp/files.el +++ b/lisp/files.el @@ -1456,7 +1456,7 @@ file names with wildcards." (file-exists-p filename)) (error "%s does not exist" filename)) (let ((value (funcall fun filename wildcards))) - (mapc (lambda (b) (with-current-buffer b (toggle-read-only 1))) + (mapc (lambda (b) (with-current-buffer b (read-only-mode 1))) (if (listp value) value (list value))) value)) @@ -2837,7 +2837,8 @@ symbol and VAL is a value that is considered safe." ;; This should be here at least as long as Emacs supports write-file-hooks. '((add-hook 'write-file-hooks 'time-stamp) (add-hook 'write-file-functions 'time-stamp) - (add-hook 'before-save-hook 'time-stamp)) + (add-hook 'before-save-hook 'time-stamp nil t) + (add-hook 'before-save-hook 'delete-trailing-whitespace nil t)) "Expressions that are considered safe in an `eval:' local variable. Add expressions to this list if you want Emacs to evaluate them, when they appear in an `eval' local variable specification, without first @@ -4817,51 +4818,12 @@ prints a message in the minibuffer. Instead, use `set-buffer-modified-p'." "Modification-flag cleared")) (set-buffer-modified-p arg)) -(defun toggle-read-only (&optional arg message) - "Toggle the read-only state of the current buffer. -With prefix argument ARG, make the buffer read-only if ARG is -positive; otherwise make it writable. - -When making the buffer read-only, enable View mode if -`view-read-only' is non-nil. When making the buffer writable, -disable View mode if View mode is enabled. - -If called interactively, or if called from Lisp with MESSAGE -non-nil, print a message reporting the buffer's new read-only -status. - -Do not call this from a Lisp program unless you really intend to -do the same thing as the \\[toggle-read-only] command, including -possibly enabling or disabling View mode. Also, note that this -command works by setting the variable `buffer-read-only', which -does not affect read-only regions caused by text properties. To -ignore read-only status in a Lisp program (whether due to text -properties or buffer state), bind `inhibit-read-only' temporarily -to a non-nil value." - (interactive "P") - (cond - ;; Do nothing if `buffer-read-only' already matches the state - ;; specified by ARG. - ((and arg - (if (> (prefix-numeric-value arg) 0) - buffer-read-only - (not buffer-read-only)))) - ;; If View mode is enabled, exit it. - ((and buffer-read-only view-mode) - (View-exit-and-edit) - (set (make-local-variable 'view-read-only) t)) - ;; If `view-read-only' is non-nil, enable View mode. - ((and view-read-only - (not buffer-read-only) - (not view-mode) - (not (eq (get major-mode 'mode-class) 'special))) - (view-mode-enter)) - ;; The usual action: flip `buffer-read-only'. - (t (setq buffer-read-only (not buffer-read-only)) - (force-mode-line-update))) - (if (or message (called-interactively-p 'interactive)) - (message "Read-only %s for this buffer" - (if buffer-read-only "enabled" "disabled")))) +(defun toggle-read-only (&optional arg interactive) + (declare (obsolete read-only-mode "24.3")) + (interactive (list current-prefix-arg t)) + (if interactive + (call-interactively 'read-only-mode) + (read-only-mode (or arg 'toggle)))) (defun insert-file (filename) "Insert contents of file FILENAME into buffer after point. @@ -5388,23 +5350,26 @@ non-nil, it is called instead of rereading visited file contents." (not (file-exists-p file-name))) (error "Auto-save file %s not current" (abbreviate-file-name file-name))) - ((save-window-excursion - (with-output-to-temp-buffer "*Directory*" - (buffer-disable-undo standard-output) - (save-excursion - (let ((switches dired-listing-switches)) - (if (file-symlink-p file) - (setq switches (concat switches " -L"))) - (set-buffer standard-output) - ;; Use insert-directory-safely, not insert-directory, - ;; because these files might not exist. In particular, - ;; FILE might not exist if the auto-save file was for - ;; a buffer that didn't visit a file, such as "*mail*". - ;; The code in v20.x called `ls' directly, so we need - ;; to emulate what `ls' did in that case. - (insert-directory-safely file switches) - (insert-directory-safely file-name switches)))) - (yes-or-no-p (format "Recover auto save file %s? " file-name))) + ((with-temp-buffer-window + "*Directory*" nil + #'(lambda (window _value) + (with-selected-window window + (unwind-protect + (yes-or-no-p (format "Recover auto save file %s? " file-name)) + (when (window-live-p window) + (quit-restore-window window 'kill))))) + (with-current-buffer standard-output + (let ((switches dired-listing-switches)) + (if (file-symlink-p file) + (setq switches (concat switches " -L"))) + ;; Use insert-directory-safely, not insert-directory, + ;; because these files might not exist. In particular, + ;; FILE might not exist if the auto-save file was for + ;; a buffer that didn't visit a file, such as "*mail*". + ;; The code in v20.x called `ls' directly, so we need + ;; to emulate what `ls' did in that case. + (insert-directory-safely file switches) + (insert-directory-safely file-name switches)))) (switch-to-buffer (find-file-noselect file t)) (let ((inhibit-read-only t) ;; Keep the current buffer-file-coding-system. @@ -6365,8 +6330,15 @@ if any returns nil. If `confirm-kill-emacs' is non-nil, calls it." (setq active t)) (setq processes (cdr processes))) (or (not active) - (progn (list-processes t) - (yes-or-no-p "Active processes exist; kill them and exit anyway? "))))) + (with-temp-buffer-window + (get-buffer-create "*Process List*") nil + #'(lambda (window _value) + (with-selected-window window + (unwind-protect + (yes-or-no-p "Active processes exist; kill them and exit anyway? ") + (when (window-live-p window) + (quit-restore-window window 'kill))))) + (list-processes t))))) ;; Query the user for other things, perhaps. (run-hook-with-args-until-failure 'kill-emacs-query-functions) (or (null confirm-kill-emacs) diff --git a/lisp/gnus/ChangeLog b/lisp/gnus/ChangeLog index df35e998c31..37d89ba8cad 100644 --- a/lisp/gnus/ChangeLog +++ b/lisp/gnus/ChangeLog @@ -1,3 +1,82 @@ +2012-09-03 Lars Ingebrigtsen <larsi@gnus.org> + + * dgnushack.el: XEmacs 21.5 compilation fix. + + * gnus-notifications.el (gnus-notifications-notify): Use it. + + * gnus-fun.el (gnus-funcall-no-warning): New function to silence + warnings on XEmacs. + +2012-09-01 Paul Eggert <eggert@cs.ucla.edu> + + Better seeds for (random). + * gnus-sync.el (gnus-sync-lesync-setup): + * message.el (message-canlock-generate, message-unique-id): + Change (random t) to (random), now that the latter is more random. + +2012-08-31 Dave Abrahams <dave@boostpro.com> + + * auth-source.el (auth-sources): Fix macos keychain access. + + * gnus-int.el (gnus-request-head): When gnus-override-method is set, + allow the backend `request-head' function to determine the group + name on its own. + (gnus-request-expire-articles): Filter out negative article numbers + during expiry (Bug#11980). + + * gnus-range.el (gnus-set-difference): Change gnus-set-difference from + O(N^2) to O(N). This makes warping into huge groups tolerable. + + * gnus-registry.el (gnus-try-warping-via-registry): Don't act as though + you've found the article when you haven't. + +2012-08-31 Stefan Monnier <monnier@iro.umontreal.ca> + + * gnus-notifications.el (gnus-notifications-action): Avoid CL-ism. + +2012-08-30 Julien Danjou <julien@danjou.info> + + * gnus-notifications.el (gnus-notifications-notify): Use timeout from + `gnus-notifications-timeout'. + (gnus-notifications-timeout): Add. + (gnus-notifications-action): New function. + (gnus-notifications-notify): Add :action using + `gnus-notifications-action'. + (gnus-notifications-id-to-msg): New variable. + (gnus-notifications): Use `gnus-notifications-id-to-msg' to map + notifications id to messages. + +2012-08-30 Kenichi Handa <handa@gnu.org> + + * qp.el (quoted-printable-decode-region): Decode multiple bytes at + once. + +2012-08-29 Julien Danjou <julien@danjou.info> + + * gnus-notifications.el: New file. + (gnus-notifications-notify): New function. + (gnus-notifications): Use `gnus-notifications-notify'. + +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 + `name' and `address' in Resent-From header. + 2012-08-14 Chong Yidong <cyd@gnu.org> * gnus-art.el (article-display-face): Handle failure in diff --git a/lisp/gnus/auth-source.el b/lisp/gnus/auth-source.el index 262da447358..4c5e5ffadce 100644 --- a/lisp/gnus/auth-source.el +++ b/lisp/gnus/auth-source.el @@ -256,10 +256,10 @@ can get pretty complex." (const :tag "Temp Secrets API Collection" "secrets:session") (const :tag "Default internet Mac OS Keychain" - 'macos-keychain-internet) + macos-keychain-internet) (const :tag "Default generic Mac OS Keychain" - 'macos-keychain-generic) + macos-keychain-generic) (list :tag "Source definition" (const :format "" :value :source) diff --git a/lisp/gnus/gnus-cus.el b/lisp/gnus/gnus-cus.el index 234d0f7ae56..3440e6310af 100644 --- a/lisp/gnus/gnus-cus.el +++ b/lisp/gnus/gnus-cus.el @@ -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: diff --git a/lisp/gnus/gnus-fun.el b/lisp/gnus/gnus-fun.el index f33eb910c6a..f5e1c5ad691 100644 --- a/lisp/gnus/gnus-fun.el +++ b/lisp/gnus/gnus-fun.el @@ -278,6 +278,10 @@ colors of the displayed X-Faces." values)) (mapconcat 'identity values " "))) +(defun gnus-funcall-no-warning (function &rest args) + (when (fboundp function) + (apply function args))) + (provide 'gnus-fun) ;;; gnus-fun.el ends here diff --git a/lisp/gnus/gnus-int.el b/lisp/gnus/gnus-int.el index 339e3d951c2..bc3ba187dd4 100644 --- a/lisp/gnus/gnus-int.el +++ b/lisp/gnus/gnus-int.el @@ -599,7 +599,8 @@ real group. Does nothing on a real group." clean-up t)) ;; Use `head' function. ((fboundp head) - (setq res (funcall head article (gnus-group-real-name group) + (setq res (funcall head article + (and (not gnus-override-method) (gnus-group-real-name group)) (nth 1 gnus-command-method)))) ;; Use `article' function. (t @@ -706,6 +707,10 @@ If GROUP is nil, all groups on GNUS-COMMAND-METHOD are scanned." (defun gnus-request-expire-articles (articles group &optional force) (let* ((gnus-command-method (gnus-find-method-for-group group)) + ;; Filter out any negative article numbers; they can't be + ;; expired here. + (articles + (delq nil (mapcar (lambda (n) (and (>= n 0) n)) articles))) (gnus-inhibit-demon t) (not-deleted (funcall diff --git a/lisp/gnus/gnus-msg.el b/lisp/gnus/gnus-msg.el index 594f68bb86f..c2f79e70d1e 100644 --- a/lisp/gnus/gnus-msg.el +++ b/lisp/gnus/gnus-msg.el @@ -1369,7 +1369,24 @@ For the \"inline\" alternatives, also see the variable (nnmail-fetch-field "to")))) current-prefix-arg)) (let ((message-header-setup-hook (copy-sequence message-header-setup-hook)) - (message-sent-hook (copy-sequence message-sent-hook))) + (message-sent-hook (copy-sequence message-sent-hook)) + ;; Honor posting-style for `name' and `address' in Resent-From header. + (styles (gnus-group-find-parameter gnus-newsgroup-name + 'posting-style t)) + (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)) + (when (string-match (pop style) gnus-newsgroup-name) + (when (setq tem (cadr (assq 'name style))) + (setq user-full-name tem)) + (when (setq tem (cadr (assq 'address style))) + (setq user-mail-address tem)))) ;; `gnus-summary-resend-message-insert-gcc' must run last. (add-hook 'message-header-setup-hook 'gnus-summary-resend-message-insert-gcc t) @@ -1793,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) diff --git a/lisp/gnus/gnus-notifications.el b/lisp/gnus/gnus-notifications.el new file mode 100644 index 00000000000..f9c2d309a35 --- /dev/null +++ b/lisp/gnus/gnus-notifications.el @@ -0,0 +1,187 @@ +;; gnus-notifications.el -- Send notification on new message in Gnus + +;; Copyright (C) 2012 Free Software Foundation, Inc. + +;; Author: Julien Danjou <julien@danjou.info> +;; Keywords: news + +;; This file is part of GNU Emacs. + +;; GNU Emacs 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. + +;; GNU Emacs 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 GNU Emacs. If not, see <http://www.gnu.org/licenses/>. + +;;; Commentary: + +;; This implements notifications using `notifications-notify' on new +;; messages received. +;; Use (add-hook 'gnus-after-getting-new-news-hook 'gnus-notifications) +;; to get notifications just after getting the new news. + +;;; Code: + +(ignore-errors + (require 'notifications)) +(require 'gnus-sum) +(require 'gnus-group) +(require 'gnus-int) +(require 'gnus-art) +(require 'gnus-util) +(ignore-errors + (require 'google-contacts)) ; Optional +(require 'gnus-fun) + +(defgroup gnus-notifications nil + "Send notifications on new message in Gnus." + :group 'gnus) + +(defcustom gnus-notifications-use-google-contacts t + "Use Google Contacts to retrieve photo." + :type 'boolean + :group 'gnus-notifications) + +(defcustom gnus-notifications-use-gravatar t + "Use Gravatar to retrieve photo." + :type 'boolean + :group 'gnus-notifications) + +(defcustom gnus-notifications-minimum-level 1 + "Minimum group level the message should have to be notified. +Any message in a group that has a greater value than this will +not get notifications." + :type 'integer + :group 'gnus-notifications) + +(defcustom gnus-notifications-timeout nil + "Timeout used for notifications sent via `notifications-notify'." + :type 'integer + :group 'gnus-notifications) + +(defvar gnus-notifications-sent nil + "Notifications already sent.") + +(defvar gnus-notifications-id-to-msg nil + "Map notifications ids to messages.") + +(defun gnus-notifications-action (id key) + (when (string= key "read") + (let ((group-article (assoc id gnus-notifications-id-to-msg))) + (when group-article + (let ((group (cadr group-article)) + (article (nth 2 group-article))) + (gnus-fetch-group group (list article))))))) + +(defun gnus-notifications-notify (from subject photo-file) + "Send a notification about a new mail. +Return a notification id if any, or t on success." + (if (fboundp 'notifications-notify) + (gnus-funcall-no-warning + 'notifications-notify + :title from + :body subject + :actions '("read" "Read") + :on-action 'gnus-notifications-action + :app-icon (gnus-funcall-no-warning + 'image-search-load-path "gnus/gnus.png") + :app-name "Gnus" + :category "email.arrived" + :timeout gnus-notifications-timeout + :image-path photo-file) + (message "New message from %s: %s" from subject) + ;; Don't return an id + t)) + +(defun gnus-notifications-get-photo (mail-address) + "Get photo for mail address." + (let ((google-photo (when (and gnus-notifications-use-google-contacts + (fboundp 'google-contacts-get-photo)) + (ignore-errors + (gnus-funcall-no-warning + 'google-contacts-get-photo mail-address))))) + (if google-photo + google-photo + (when gnus-notifications-use-gravatar + (let ((gravatar (ignore-errors + (gravatar-retrieve-synchronously mail-address)))) + (if (eq gravatar 'error) + nil + (plist-get (cdr gravatar) :data))))))) + +(defun gnus-notifications-get-photo-file (mail-address) + "Get a temporary file with an image for MAIL-ADDRESS. +You have to delete the temporary image yourself using +`delete-image'. + +Returns nil if no image found." + (let ((photo (gnus-notifications-get-photo mail-address))) + (when photo + (let ((photo-file (make-temp-file "gnus-notifications-photo-")) + (coding-system-for-write 'binary)) + (with-temp-file photo-file + (insert photo)) + photo-file)))) + +;;;###autoload +(defun gnus-notifications () + "Send a notification on new message. +This check for new messages that are in group with a level lower +or equal to `gnus-notifications-minimum-level' and send a +notification using `notifications-notify' for it. + +This is typically a function to add in +`gnus-after-getting-new-news-hook'" + (dolist (entry gnus-newsrc-alist) + (let ((group (car entry))) + ;; Check that the group level is less than + ;; `gnus-notifications-minimum-level' and the the group has unread + ;; messages. + (when (and (<= (gnus-group-level group) gnus-notifications-minimum-level) + (let ((unread (gnus-group-unread group))) + (and (numberp unread) + (> unread 0)))) + ;; Each group should have an entry in the `gnus-notifications-sent' + ;; alist. If not, we add one at this time. + (let ((group-notifications (or (assoc group gnus-notifications-sent) + ;; Nothing, add one and return it. + (assoc group + (add-to-list + 'gnus-notifications-sent + (cons group nil)))))) + (dolist (article (gnus-list-of-unread-articles group)) + ;; Check if the article already has been notified + (unless (memq article (cdr group-notifications)) + (with-current-buffer nntp-server-buffer + (gnus-request-head article group) + (article-decode-encoded-words) ; to decode mail addresses, subjects, etc + (let* ((address-components (mail-extract-address-components + (or (mail-fetch-field "From") ""))) + (address (cadr address-components))) + ;; Ignore mails from ourselves + (unless (gnus-string-match-p gnus-ignored-from-addresses + address) + (let* ((photo-file (gnus-notifications-get-photo-file address)) + (notification-id (gnus-notifications-notify + (or (car address-components) address) + (mail-fetch-field "Subject") + photo-file))) + (when notification-id + ;; Register that we did notify this message + (setcdr group-notifications (cons article (cdr group-notifications))) + (unless (eq notification-id t) + ;; Register the notification id for later actions + (add-to-list 'gnus-notifications-id-to-msg (list notification-id group article)))) + (when photo-file + (delete-file photo-file))))))))))))) + +(provide 'gnus-notifications) + +;;; gnus-notifications.el ends here diff --git a/lisp/gnus/gnus-range.el b/lisp/gnus/gnus-range.el index 68729da0910..091276ee4f8 100644 --- a/lisp/gnus/gnus-range.el +++ b/lisp/gnus/gnus-range.el @@ -52,11 +52,13 @@ If RANGE is a single range, return (RANGE). Otherwise, return RANGE." (defun gnus-set-difference (list1 list2) "Return a list of elements of LIST1 that do not appear in LIST2." - (let ((list1 (copy-sequence list1))) - (while list2 - (setq list1 (delq (car list2) list1)) - (setq list2 (cdr list2))) - list1)) + (let ((hash2 (make-hash-table :test 'eq)) + (result nil)) + (dolist (elt list2) (puthash elt t hash2)) + (dolist (elt list1) + (unless (gethash elt hash2) + (setq result (cons elt result)))) + (nreverse result))) (defun gnus-range-nconcat (&rest ranges) "Return a range comprising all the RANGES, which are pre-sorted. diff --git a/lisp/gnus/gnus-registry.el b/lisp/gnus/gnus-registry.el index 8aecc98ee86..71e00967548 100644 --- a/lisp/gnus/gnus-registry.el +++ b/lisp/gnus/gnus-registry.el @@ -1169,9 +1169,10 @@ data stored in the registry." ;; Try to activate the group. If that fails, just move ;; along. We may have more groups to work with - (ignore-errors - (gnus-select-group-with-message-id group message-id)) - (throw 'found t))))))) + (when + (ignore-errors + (gnus-select-group-with-message-id group message-id) t) + (throw 'found t)))))))) ;; TODO: a few things diff --git a/lisp/gnus/gnus-sum.el b/lisp/gnus/gnus-sum.el index 06f17bcf646..b44b953bec6 100644 --- a/lisp/gnus/gnus-sum.el +++ b/lisp/gnus/gnus-sum.el @@ -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 diff --git a/lisp/gnus/gnus-sync.el b/lisp/gnus/gnus-sync.el index 15d94810c3a..ca8662ff936 100644 --- a/lisp/gnus/gnus-sync.el +++ b/lisp/gnus/gnus-sync.el @@ -225,7 +225,7 @@ When SALT is nil, a random one will be generated using `random'." (security-object (concat url "/_security")) (user-record `((names . [,user]) (roles . []))) (couch-user-name (format "org.couchdb.user:%s" user)) - (salt (or salt (sha1 (format "%s" (random t))))) + (salt (or salt (sha1 (format "%s" (random))))) (couch-user-record `((_id . ,couch-user-name) (type . user) diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el index 8fd89b1742c..18088423eb0 100644 --- a/lisp/gnus/message.el +++ b/lisp/gnus/message.el @@ -4820,9 +4820,7 @@ Do not use this for anything important, it is cryptographically weak." (require 'sha1) (let (sha1-maximum-internal-length) (sha1 (concat (message-unique-id) - (format "%x%x%x" (random) - (progn (random t) (random)) - (random)) + (format "%x%x%x" (random) (random) (random)) (prin1-to-string (recent-keys)) (prin1-to-string (garbage-collect)))))) @@ -5525,7 +5523,6 @@ In posting styles use `(\"Expires\" (make-expires-date 30))'." ;; You might for example insert a "." somewhere (not next to another dot ;; or string boundary), or modify the "fsf" string. (defun message-unique-id () - (random t) ;; Don't use microseconds from (current-time), they may be unsupported. ;; Instead we use this randomly inited counter. (setq message-unique-id-char diff --git a/lisp/gnus/qp.el b/lisp/gnus/qp.el index c8481aa9dee..87252684a48 100644 --- a/lisp/gnus/qp.el +++ b/lisp/gnus/qp.el @@ -53,7 +53,10 @@ them into characters should be done separately." ;; or both of which are lowercase letters in "abcdef", is ;; formally illegal. A robust implementation might choose to ;; recognize them as the corresponding uppercase letters.'' - (let ((case-fold-search t)) + (let ((case-fold-search t) + (decode-hex #'(lambda (n1 n2) + (+ (* (if (<= n1 ?9) (- n1 ?0) (+ (- n1 ?A) 10)) 16) + (if (<= n2 ?9) (- n2 ?0) (+ (- n2 ?A) 10)))))) (narrow-to-region from to) ;; Do this in case we're called from Gnus, say, in a buffer ;; which already contains non-ASCII characters which would @@ -65,12 +68,17 @@ them into characters should be done separately." (not (eobp))) (cond ((eq (char-after (1+ (point))) ?\n) (delete-char 2)) - ((looking-at "=[0-9A-F][0-9A-F]") - (let ((byte (string-to-number (buffer-substring (1+ (point)) - (+ 3 (point))) - 16))) - (mm-insert-byte byte 1) - (delete-char 3))) + ((looking-at "\\(=[0-9A-F][0-9A-F]\\)+") + ;; Decode this sequence at once; i.e. by a single + ;; deletion and insertion. + (let* ((n (/ (- (match-end 0) (point)) 3)) + (str (make-string n 0))) + (dotimes (i n) + (aset str i (funcall decode-hex (char-after (1+ (point))) + (char-after (+ 2 (point))))) + (forward-char 3)) + (delete-region (match-beginning 0) (match-end 0)) + (insert str))) (t (message "Malformed quoted-printable text") (forward-char))))) diff --git a/lisp/help-fns.el b/lisp/help-fns.el index 4b1480444c2..5791f1225c1 100644 --- a/lisp/help-fns.el +++ b/lisp/help-fns.el @@ -397,9 +397,11 @@ suitable file is found, return nil." (if (member (event-modifiers (aref key 0)) '(nil (shift))) (push key non-modified-keys))) (when remapped - (princ "Its keys are remapped to `") - (princ (symbol-name remapped)) - (princ "'.\n")) + (princ "Its keys are remapped to ") + (princ (if (symbolp remapped) + (concat "`" (symbol-name remapped) "'") + "an anonymous command")) + (princ ".\n")) (when keys (princ (if remapped diff --git a/lisp/help.el b/lisp/help.el index 19cb811bcf5..9740f8996c1 100644 --- a/lisp/help.el +++ b/lisp/help.el @@ -39,9 +39,10 @@ ;; `help-window-point-marker' is a marker you can move to a valid ;; position of the buffer shown in the help window in order to override ;; the standard positioning mechanism (`point-min') chosen by -;; `with-output-to-temp-buffer'. `with-help-window' has this point -;; nowhere before exiting. Currently used by `view-lossage' to assert -;; that the last keystrokes are always visible. +;; `with-output-to-temp-buffer' and `with-temp-buffer-window'. +;; `with-help-window' has this point nowhere before exiting. Currently +;; used by `view-lossage' to assert that the last keystrokes are always +;; visible. (defvar help-window-point-marker (make-marker) "Marker to override default `window-point' in help windows.") @@ -145,10 +146,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)) @@ -979,13 +976,13 @@ function is called, the window to be resized is selected." :version "20.4") (define-minor-mode temp-buffer-resize-mode - "Toggle auto-shrinking temp buffer windows (Temp Buffer Resize mode). + "Toggle auto-resizing temporary buffer windows (Temp Buffer Resize Mode). With a prefix argument ARG, enable Temp Buffer Resize mode if ARG is positive, and disable it otherwise. If called from Lisp, enable the mode if ARG is omitted or nil. When Temp Buffer Resize mode is enabled, the windows in which we -show a temporary buffer are automatically reduced in height to +show a temporary buffer are automatically resized in height to fit the buffer's contents, but never more than `temp-buffer-max-height' nor less than `window-min-height'. @@ -998,19 +995,22 @@ and some others." (add-hook 'temp-buffer-show-hook 'resize-temp-buffer-window 'append) (remove-hook 'temp-buffer-show-hook 'resize-temp-buffer-window))) -(defun resize-temp-buffer-window () - "Resize the selected window to fit its contents. -Will not make it higher than `temp-buffer-max-height' nor smaller -than `window-min-height'. Do nothing if the selected window is -not vertically combined or some of its contents are scrolled out -of view." - (when (and (pos-visible-in-window-p (point-min)) - (window-combined-p)) - (fit-window-to-buffer - nil - (if (functionp temp-buffer-max-height) - (funcall temp-buffer-max-height (window-buffer)) - temp-buffer-max-height)))) +(defun resize-temp-buffer-window (&optional window) + "Resize WINDOW to fit its contents. +WINDOW can be any live window and defaults to the selected one. + +Do not make WINDOW higher than `temp-buffer-max-height' nor +smaller than `window-min-height'. Do nothing if WINDOW is not +vertically combined or some of its contents are scrolled out of +view." + (setq window (window-normalize-window window t)) + (let ((height (if (functionp temp-buffer-max-height) + (with-selected-window window + (funcall temp-buffer-max-height (window-buffer))) + temp-buffer-max-height))) + (when (and (pos-visible-in-window-p (point-min) window) + (window-combined-p window)) + (fit-window-to-buffer window height)))) ;;; Help windows. (defcustom help-window-select 'other diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el index 648c4c3b0af..c6e799252a2 100644 --- a/lisp/ibuffer.el +++ b/lisp/ibuffer.el @@ -2401,7 +2401,7 @@ Operations on marked buffers: buffer's file as an argument. '\\[ibuffer-do-eval]' - Evaluate a form in each of the marked buffers. This is a very flexible command. For example, if you want to make all - of the marked buffers read only, try using (toggle-read-only 1) as + of the marked buffers read only, try using (read-only-mode 1) as the input form. '\\[ibuffer-do-view-and-eval]' - As above, but view each buffer while the form is evaluated. diff --git a/lisp/info.el b/lisp/info.el index 317cba86500..fe4afd72163 100644 --- a/lisp/info.el +++ b/lisp/info.el @@ -417,6 +417,21 @@ If number, the point is moved to the corresponding line.") (defvar Info-standalone nil "Non-nil if Emacs was started solely as an Info browser.") +(defvar Info-file-attributes nil + "Alist of file attributes of visited Info files. +Each element is a list (FILE-NAME FILE-ATTRIBUTES...).") + +(defvar Info-toc-nodes nil + "Alist of cached parent-children node information in visited Info files. +Each element is (FILE (NODE-NAME PARENT SECTION CHILDREN) ...) +where PARENT is the parent node extracted from the Up pointer, +SECTION is the section name in the Top node where this node is placed, +CHILDREN is a list of child nodes extracted from the node menu.") + +(defvar Info-index-nodes nil + "Alist of cached index node names of visited Info files. +Each element has the form (INFO-FILE INDEX-NODE-NAMES-LIST).") + (defvar Info-virtual-files nil "List of definitions of virtual Info files. Each element of the list has the format (FILENAME (OPERATION . HANDLER) ...) @@ -609,7 +624,26 @@ Do the right thing if the file has been compressed or zipped." (apply 'call-process-region (point-min) (point-max) (car decoder) t t nil (cdr decoder)))) (let ((inhibit-null-byte-detection t)) ; Index nodes include null bytes - (insert-file-contents fullname visit))))) + (insert-file-contents fullname visit))) + + ;; Clear the caches of modified Info files. + (let* ((attribs-old (cdr (assoc fullname Info-file-attributes))) + (modtime-old (and attribs-old (nth 5 attribs-old))) + (attribs-new (and (stringp fullname) (file-attributes fullname))) + (modtime-new (and attribs-new (nth 5 attribs-new)))) + (when (and modtime-old modtime-new + (> (float-time modtime-new) (float-time modtime-old))) + (setq Info-index-nodes (remove (assoc (or Info-current-file filename) + Info-index-nodes) + Info-index-nodes)) + (setq Info-toc-nodes (remove (assoc (or Info-current-file filename) + Info-toc-nodes) + Info-toc-nodes))) + ;; Add new modtime to `Info-file-attributes'. + (setq Info-file-attributes + (cons (cons fullname attribs-new) + (remove (assoc fullname Info-file-attributes) + Info-file-attributes)))))) (defun Info-file-supports-index-cookies (&optional file) "Return non-nil value if FILE supports Info index cookies. @@ -2394,13 +2428,6 @@ Table of contents is created from the tree structure of menus." (message "") (nreverse nodes)))) -(defvar Info-toc-nodes nil - "Alist of cached parent-children node information in visited Info files. -Each element is (FILE (NODE-NAME PARENT SECTION CHILDREN) ...) -where PARENT is the parent node extracted from the Up pointer, -SECTION is the section name in the Top node where this node is placed, -CHILDREN is a list of child nodes extracted from the node menu.") - (defun Info-toc-nodes (filename) "Return a node list of Info FILENAME with parent-children information. This information is cached in the variable `Info-toc-nodes' with the help @@ -3032,10 +3059,6 @@ See `Info-scroll-down'." (if (looking-at "^\\* ") (forward-char 2))))) -(defvar Info-index-nodes nil - "Alist of cached index node names of visited Info files. -Each element has the form (INFO-FILE INDEX-NODE-NAMES-LIST).") - (defun Info-index-nodes (&optional file) "Return a list of names of all index nodes in Info FILE. If FILE is omitted, it defaults to the current Info file. @@ -4504,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)) @@ -4792,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)))) ;;; Speedbar support: diff --git a/lisp/isearch.el b/lisp/isearch.el index 9271ce32484..e6e0a01566a 100644 --- a/lisp/isearch.el +++ b/lisp/isearch.el @@ -111,17 +111,24 @@ 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, or +`isearch-lax-whitespace' is nil for ordinary incremental search, or +`isearch-regexp-lax-whitespace' is nil for regexp incremental search, +then each space you type matches literally, against one space. + 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 "Match Spaces Literally" nil) regexp) - :group 'isearch) + :group 'isearch + :version "24.3") (defcustom search-invisible 'open "If t incremental search can match hidden text. @@ -499,6 +506,7 @@ This is like `describe-bindings', but displays only Isearch keys." (define-key map "\M-sr" 'isearch-toggle-regexp) (define-key map "\M-sw" 'isearch-toggle-word) (define-key map "\M-s_" 'isearch-toggle-symbol) + (define-key map "\M-s " 'isearch-toggle-lax-whitespace) (define-key map [?\M-%] 'isearch-query-replace) (define-key map [?\C-\M-%] 'isearch-query-replace-regexp) @@ -541,6 +549,22 @@ convert the search string to a regexp used by regexp search functions. The property `isearch-message-prefix' put on this function specifies the prefix string displayed in the search message.") +(defvar isearch-lax-whitespace t + "If non-nil, a space will match a sequence of whitespace chars. +When you enter a space or spaces in ordinary incremental search, it +will match any sequence matched by the regexp defined by the variable +`search-whitespace-regexp'. If the value is nil, each space you type +matches literally, against one space. You can toggle the value of this +variable by the command `isearch-toggle-lax-whitespace'.") + +(defvar isearch-regexp-lax-whitespace nil + "If non-nil, a space will match a sequence of whitespace chars. +When you enter a space or spaces in regexp incremental search, it +will match any sequence matched by the regexp defined by the variable +`search-whitespace-regexp'. If the value is nil, each space you type +matches literally, against one space. You can toggle the value of this +variable by the command `isearch-toggle-lax-whitespace'.") + (defvar isearch-cmds nil "Stack of search status sets. Each set is a vector of the form: @@ -666,6 +690,12 @@ Type \\[isearch-toggle-case-fold] to toggle search case-sensitivity. Type \\[isearch-toggle-regexp] to toggle regular-expression mode. Type \\[isearch-toggle-word] to toggle word mode. Type \\[isearch-toggle-symbol] to toggle symbol mode. + +Type \\[isearch-toggle-lax-whitespace] to toggle whitespace matching. +In incremental searches, a space or spaces normally matches any whitespace +defined by the variable `search-whitespace-regexp'; see also the variables +`isearch-lax-whitespace' and `isearch-regexp-lax-whitespace'. + Type \\[isearch-edit-string] to edit the search string in the minibuffer. Also supported is a search ring of the previous 16 search strings. @@ -710,22 +740,20 @@ 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 defined by the variable `search-whitespace-regexp'. +To search for a literal space and nothing else, enter C-q SPC. +To toggle whitespace matching, use `isearch-toggle-lax-whitespace'." (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 +762,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 +771,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 +920,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) @@ -1384,6 +1408,28 @@ Use `isearch-exit' to quit without signaling." (setq isearch-success t isearch-adjusted t) (isearch-update)) +(defun isearch-toggle-lax-whitespace () + "Toggle whitespace matching in searching on or off. +In ordinary search, toggles the value of the variable +`isearch-lax-whitespace'. In regexp search, toggles the +value of the variable `isearch-regexp-lax-whitespace'." + (interactive) + (if isearch-regexp + (setq isearch-regexp-lax-whitespace (not isearch-regexp-lax-whitespace)) + (setq isearch-lax-whitespace (not isearch-lax-whitespace))) + (let ((message-log-max nil)) + (message "%s%s [%s]" + (isearch-message-prefix nil isearch-nonincremental) + isearch-message + (if (if isearch-regexp + isearch-regexp-lax-whitespace + isearch-lax-whitespace) + "match spaces loosely" + "match spaces literally"))) + (setq isearch-success t isearch-adjusted t) + (sit-for 1) + (isearch-update)) + (defun isearch-toggle-case-fold () "Toggle case folding in searching on or off." (interactive) @@ -1495,6 +1541,28 @@ If LAX is non-nil, the end of the string need not match a symbol boundary." (put 'isearch-symbol-regexp 'isearch-message-prefix "symbol ") +;; Search with lax whitespace + +(defun search-forward-lax-whitespace (string &optional bound noerror count) + "Search forward for STRING, matching a sequence of whitespace chars." + (let ((search-spaces-regexp search-whitespace-regexp)) + (re-search-forward (regexp-quote string) bound noerror count))) + +(defun search-backward-lax-whitespace (string &optional bound noerror count) + "Search backward for STRING, matching a sequence of whitespace chars." + (let ((search-spaces-regexp search-whitespace-regexp)) + (re-search-backward (regexp-quote string) bound noerror count))) + +(defun re-search-forward-lax-whitespace (regexp &optional bound noerror count) + "Search forward for REGEXP, matching a sequence of whitespace chars." + (let ((search-spaces-regexp search-whitespace-regexp)) + (re-search-forward regexp bound noerror count))) + +(defun re-search-backward-lax-whitespace (regexp &optional bound noerror count) + "Search backward for REGEXP, matching a sequence of whitespace chars." + (let ((search-spaces-regexp search-whitespace-regexp)) + (re-search-backward regexp bound noerror count))) + (defun isearch-query-replace (&optional delimited regexp-flag) "Start `query-replace' with string to replace from last search string. @@ -1511,6 +1579,14 @@ way to run word replacements from Isearch is `M-s w ... M-%'." ;; set `search-upper-case' to nil to not call ;; `isearch-no-upper-case-p' in `perform-replace' (search-upper-case nil) + (replace-search-function + (if (and isearch-lax-whitespace (not regexp-flag)) + #'search-forward-lax-whitespace + replace-search-function)) + (replace-re-search-function + (if (and isearch-regexp-lax-whitespace regexp-flag) + #'re-search-forward-lax-whitespace + replace-re-search-function)) ;; Set `isearch-recursive-edit' to nil to prevent calling ;; `exit-recursive-edit' in `isearch-done' that terminates ;; the execution of this command when it is non-nil. @@ -1586,7 +1662,11 @@ 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 + (if (if isearch-regexp + isearch-regexp-lax-whitespace + isearch-lax-whitespace) + search-whitespace-regexp))) (occur regexp nlines))) (declare-function hi-lock-read-face-name "hi-lock" ()) @@ -2183,7 +2263,7 @@ Isearch mode." ;; Assume character codes 0200 - 0377 stand for characters in some ;; single-byte character set, and convert them to Emacs ;; characters. - (if (and isearch-regexp (= char ?\s)) + (if (and isearch-regexp isearch-regexp-lax-whitespace (= char ?\s)) (if (subregexp-context-p isearch-string (length isearch-string)) (isearch-process-search-string "[ ]" " ") (isearch-process-search-char char)) @@ -2423,8 +2503,17 @@ Can be changed via `isearch-search-fun-function' for special needs." (funcall isearch-word string lax) (word-search-regexp string lax)) bound noerror count)))) + ((and isearch-regexp isearch-regexp-lax-whitespace + search-whitespace-regexp) + (if isearch-forward + 're-search-forward-lax-whitespace + 're-search-backward-lax-whitespace)) (isearch-regexp (if isearch-forward 're-search-forward 're-search-backward)) + ((and isearch-lax-whitespace search-whitespace-regexp) + (if isearch-forward + 'search-forward-lax-whitespace + 'search-backward-lax-whitespace)) (t (if isearch-forward 'search-forward 'search-backward)))) @@ -2487,7 +2576,6 @@ 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) (retry t)) (setq isearch-error nil) (while retry @@ -2779,7 +2867,8 @@ since they have special meaning in a regexp." (defvar isearch-lazy-highlight-window-end nil) (defvar isearch-lazy-highlight-case-fold-search nil) (defvar isearch-lazy-highlight-regexp nil) -(defvar isearch-lazy-highlight-space-regexp nil) +(defvar isearch-lazy-highlight-lax-whitespace nil) +(defvar isearch-lazy-highlight-regexp-lax-whitespace nil) (defvar isearch-lazy-highlight-word nil) (defvar isearch-lazy-highlight-forward nil) (defvar isearch-lazy-highlight-error nil) @@ -2821,6 +2910,10 @@ by other Emacs features." isearch-regexp)) (not (eq isearch-lazy-highlight-word isearch-word)) + (not (eq isearch-lazy-highlight-lax-whitespace + isearch-lax-whitespace)) + (not (eq isearch-lazy-highlight-regexp-lax-whitespace + isearch-regexp-lax-whitespace)) (not (= (window-start) isearch-lazy-highlight-window-start)) (not (= (window-end) ; Window may have been split/joined. @@ -2847,7 +2940,8 @@ 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-lax-whitespace isearch-lax-whitespace + isearch-lazy-highlight-regexp-lax-whitespace isearch-regexp-lax-whitespace isearch-lazy-highlight-word isearch-word isearch-lazy-highlight-forward isearch-forward) (unless (equal isearch-string "") @@ -2861,7 +2955,6 @@ Attempt to do the search exactly the way the pending Isearch would." (condition-case nil (let ((case-fold-search isearch-lazy-highlight-case-fold-search) (isearch-regexp isearch-lazy-highlight-regexp) - (search-spaces-regexp isearch-lazy-highlight-space-regexp) (isearch-word isearch-lazy-highlight-word) (search-invisible nil) ; don't match invisible text (retry t) diff --git a/lisp/json.el b/lisp/json.el index 468358ccd1a..f1ee3a52032 100644 --- a/lisp/json.el +++ b/lisp/json.el @@ -174,6 +174,10 @@ this around your call to `json-read' instead of `setq'ing it.") (put 'json-string-format 'error-conditions '(json-string-format json-error error)) +(put 'json-key-format 'error-message "Bad JSON object key") +(put 'json-key-format 'error-conditions + '(json-key-format json-error error)) + (put 'json-object-format 'error-message "Bad JSON object") (put 'json-object-format 'error-conditions '(json-object-format json-error error)) @@ -321,6 +325,15 @@ representation will be parsed correctly." "Return a JSON representation of STRING." (format "\"%s\"" (mapconcat 'json-encode-char string ""))) +(defun json-encode-key (object) + "Return a JSON representation of OBJECT. +If the resulting JSON object isn't a valid JSON object key, +this signals `json-key-format'." + (let ((encoded (json-encode object))) + (unless (stringp (json-read-from-string encoded)) + (signal 'json-key-format (list object))) + encoded)) + ;;; JSON Objects (defun json-new-object () @@ -395,7 +408,7 @@ Please see the documentation of `json-object-type' and `json-key-type'." (maphash (lambda (k v) (push (format "%s:%s" - (json-encode k) + (json-encode-key k) (json-encode v)) r)) hash-table) @@ -409,7 +422,7 @@ Please see the documentation of `json-object-type' and `json-key-type'." (format "{%s}" (json-join (mapcar (lambda (cons) (format "%s:%s" - (json-encode (car cons)) + (json-encode-key (car cons)) (json-encode (cdr cons)))) alist) ", "))) @@ -418,7 +431,7 @@ Please see the documentation of `json-object-type' and `json-key-type'." "Return a JSON representation of PLIST." (let (result) (while plist - (push (concat (json-encode (car plist)) + (push (concat (json-encode-key (car plist)) ":" (json-encode (cadr plist))) result) diff --git a/lisp/ldefs-boot.el b/lisp/ldefs-boot.el index 8b7a0ab3e6f..7b515a69a1c 100644 --- a/lisp/ldefs-boot.el +++ b/lisp/ldefs-boot.el @@ -5,7 +5,7 @@ ;;;### (autoloads (5x5-crack 5x5-crack-xor-mutate 5x5-crack-mutating-best ;;;;;; 5x5-crack-mutating-current 5x5-crack-randomly 5x5) "5x5" -;;;;;; "play/5x5.el" (20478 3673 653810 0)) +;;;;;; "play/5x5.el" (20545 57511 257469 0)) ;;; Generated autoloads from play/5x5.el (autoload '5x5 "5x5" "\ @@ -114,7 +114,7 @@ Completion is available. ;;;;;; add-change-log-entry-other-window add-change-log-entry find-change-log ;;;;;; prompt-for-change-log-name add-log-mailing-address add-log-full-name ;;;;;; add-log-current-defun-function) "add-log" "vc/add-log.el" -;;;;;; (20495 51111 757560 0)) +;;;;;; (20523 62082 997685 0)) ;;; Generated autoloads from vc/add-log.el (put 'change-log-default-name 'safe-local-variable 'string-or-null-p) @@ -398,7 +398,7 @@ usage: (defadvice FUNCTION (CLASS NAME [POSITION] [ARGLIST] FLAG...) ;;;### (autoloads (align-newline-and-indent align-unhighlight-rule ;;;;;; align-highlight-rule align-current align-entire align-regexp -;;;;;; align) "align" "align.el" (20355 10021 546955 0)) +;;;;;; align) "align" "align.el" (20515 36389 544939 0)) ;;; Generated autoloads from align.el (autoload 'align "align" "\ @@ -489,7 +489,7 @@ A replacement function for `newline-and-indent', aligning as it goes. ;;;### (autoloads (outlineify-sticky allout-mode allout-mode-p allout-auto-activation ;;;;;; allout-setup allout-auto-activation-helper) "allout" "allout.el" -;;;;;; (20399 35365 4050 0)) +;;;;;; (20523 62082 997685 0)) ;;; Generated autoloads from allout.el (autoload 'allout-auto-activation-helper "allout" "\ @@ -850,7 +850,7 @@ for details on preparing Emacs for automatic allout activation. ;;;### (autoloads (allout-widgets-mode allout-widgets-auto-activation ;;;;;; allout-widgets-setup allout-widgets) "allout-widgets" "allout-widgets.el" -;;;;;; (20437 50597 545250 0)) +;;;;;; (20545 57511 257469 0)) ;;; Generated autoloads from allout-widgets.el (let ((loads (get 'allout-widgets 'custom-loads))) (if (member '"allout-widgets" loads) nil (put 'allout-widgets 'custom-loads (cons '"allout-widgets" loads)))) @@ -932,7 +932,7 @@ directory, so that Emacs will know its current contents. ;;;*** ;;;### (autoloads (animate-birthday-present animate-sequence animate-string) -;;;;;; "animate" "play/animate.el" (20355 10021 546955 0)) +;;;;;; "animate" "play/animate.el" (20545 57511 257469 0)) ;;; Generated autoloads from play/animate.el (autoload 'animate-string "animate" "\ @@ -965,7 +965,7 @@ the buffer *Birthday-Present-for-Name*. ;;;*** ;;;### (autoloads (ansi-color-process-output ansi-color-for-comint-mode-on) -;;;;;; "ansi-color" "ansi-color.el" (20453 38823 158957 0)) +;;;;;; "ansi-color" "ansi-color.el" (20523 30501 603360 0)) ;;; Generated autoloads from ansi-color.el (autoload 'ansi-color-for-comint-mode-on "ansi-color" "\ @@ -1051,8 +1051,8 @@ ARG is positive, otherwise off. ;;;### (autoloads (apropos-documentation apropos-value apropos-library ;;;;;; apropos apropos-documentation-property apropos-command apropos-variable -;;;;;; apropos-read-pattern) "apropos" "apropos.el" (20497 6436 -;;;;;; 957082 0)) +;;;;;; apropos-read-pattern) "apropos" "apropos.el" (20523 62082 +;;;;;; 997685 0)) ;;; Generated autoloads from apropos.el (autoload 'apropos-read-pattern "apropos" "\ @@ -1253,8 +1253,8 @@ Entering array mode calls the function `array-mode-hook'. ;;;*** -;;;### (autoloads (artist-mode) "artist" "textmodes/artist.el" (20357 -;;;;;; 58785 834364 0)) +;;;### (autoloads (artist-mode) "artist" "textmodes/artist.el" (20513 +;;;;;; 18948 537867 0)) ;;; Generated autoloads from textmodes/artist.el (autoload 'artist-mode "artist" "\ @@ -1488,7 +1488,7 @@ Special commands: ;;;*** ;;;### (autoloads (auth-source-cache-expiry) "auth-source" "gnus/auth-source.el" -;;;;;; (20502 24369 261101 0)) +;;;;;; (20544 36659 880486 0)) ;;; Generated autoloads from gnus/auth-source.el (defvar auth-source-cache-expiry 7200 "\ @@ -1562,7 +1562,7 @@ This is similar to `autoarg-mode' but rebinds the keypad keys ;;;*** ;;;### (autoloads (autoconf-mode) "autoconf" "progmodes/autoconf.el" -;;;;;; (20505 550 96420 0)) +;;;;;; (20513 18948 537867 0)) ;;; Generated autoloads from progmodes/autoconf.el (autoload 'autoconf-mode "autoconf" "\ @@ -1613,7 +1613,7 @@ insert a template for the file depending on the mode of the buffer. ;;;### (autoloads (batch-update-autoloads update-directory-autoloads ;;;;;; update-file-autoloads) "autoload" "emacs-lisp/autoload.el" -;;;;;; (20497 6436 957082 0)) +;;;;;; (20518 12580 46478 0)) ;;; Generated autoloads from emacs-lisp/autoload.el (put 'generated-autoload-file 'safe-local-variable 'stringp) @@ -1989,8 +1989,8 @@ Binhex decode region between START and END. ;;;*** -;;;### (autoloads (blackbox) "blackbox" "play/blackbox.el" (20355 -;;;;;; 10021 546955 0)) +;;;### (autoloads (blackbox) "blackbox" "play/blackbox.el" (20545 +;;;;;; 57511 257469 0)) ;;; Generated autoloads from play/blackbox.el (autoload 'blackbox "blackbox" "\ @@ -2113,7 +2113,7 @@ a reflection. ;;;;;; bookmark-save bookmark-write bookmark-delete bookmark-insert ;;;;;; bookmark-rename bookmark-insert-location bookmark-relocate ;;;;;; bookmark-jump-other-window bookmark-jump bookmark-set) "bookmark" -;;;;;; "bookmark.el" (20476 31768 298871 0)) +;;;;;; "bookmark.el" (20514 15527 107017 0)) ;;; Generated autoloads from bookmark.el (define-key ctl-x-r-map "b" 'bookmark-jump) (define-key ctl-x-r-map "m" 'bookmark-set) @@ -2630,7 +2630,7 @@ from `browse-url-elinks-wrapper'. ;;;*** ;;;### (autoloads (bs-show bs-customize bs-cycle-previous bs-cycle-next) -;;;;;; "bs" "bs.el" (20479 62884 77836 0)) +;;;;;; "bs" "bs.el" (20520 54308 826101 0)) ;;; Generated autoloads from bs.el (autoload 'bs-cycle-next "bs" "\ @@ -2693,7 +2693,7 @@ columns on its right towards the left. ;;;*** ;;;### (autoloads (bug-reference-prog-mode bug-reference-mode) "bug-reference" -;;;;;; "progmodes/bug-reference.el" (20490 33188 850375 0)) +;;;;;; "progmodes/bug-reference.el" (20532 45476 981297 0)) ;;; Generated autoloads from progmodes/bug-reference.el (put 'bug-reference-url-format 'safe-local-variable (lambda (s) (or (stringp s) (and (symbolp s) (get s 'bug-reference-url-format))))) @@ -2717,7 +2717,7 @@ Like `bug-reference-mode', but only buttonize in comments and strings. ;;;;;; batch-byte-compile-if-not-done display-call-tree byte-compile ;;;;;; compile-defun byte-compile-file byte-recompile-directory ;;;;;; byte-force-recompile byte-compile-enable-warning byte-compile-disable-warning) -;;;;;; "bytecomp" "emacs-lisp/bytecomp.el" (20497 6436 957082 0)) +;;;;;; "bytecomp" "emacs-lisp/bytecomp.el" (20522 38631 876994 556000)) ;;; Generated autoloads from emacs-lisp/bytecomp.el (put 'byte-compile-dynamic 'safe-local-variable 'booleanp) (put 'byte-compile-disable-print-circle 'safe-local-variable 'booleanp) @@ -4129,8 +4129,8 @@ For example, the function `case' has an indent property ;;;*** -;;;### (autoloads nil "cl-lib" "emacs-lisp/cl-lib.el" (20478 3673 -;;;;;; 653810 0)) +;;;### (autoloads nil "cl-lib" "emacs-lisp/cl-lib.el" (20541 60450 +;;;;;; 834170 0)) ;;; Generated autoloads from emacs-lisp/cl-lib.el (define-obsolete-variable-alias 'custom-print-functions 'cl-custom-print-functions "24.3") @@ -4199,8 +4199,8 @@ is run). ;;;*** -;;;### (autoloads (color-name-to-rgb) "color" "color.el" (20355 10021 -;;;;;; 546955 0)) +;;;### (autoloads (color-name-to-rgb) "color" "color.el" (20522 9637 +;;;;;; 465791 0)) ;;; Generated autoloads from color.el (autoload 'color-name-to-rgb "color" "\ @@ -4222,7 +4222,7 @@ If FRAME cannot display COLOR, return nil. ;;;### (autoloads (comint-redirect-results-list-from-process comint-redirect-results-list ;;;;;; comint-redirect-send-command-to-process comint-redirect-send-command ;;;;;; comint-run make-comint make-comint-in-buffer) "comint" "comint.el" -;;;;;; (20476 31768 298871 0)) +;;;;;; (20523 62082 997685 0)) ;;; Generated autoloads from comint.el (defvar comint-output-filter-functions '(ansi-color-process-output comint-postoutput-scroll-to-bottom comint-watch-for-password-prompt) "\ @@ -4359,8 +4359,8 @@ on third call it again advances points to the next difference and so on. ;;;;;; compilation-shell-minor-mode compilation-mode compilation-start ;;;;;; compile compilation-disable-input compile-command compilation-search-path ;;;;;; compilation-ask-about-save compilation-window-height compilation-start-hook -;;;;;; compilation-mode-hook) "compile" "progmodes/compile.el" (20478 -;;;;;; 3673 653810 0)) +;;;;;; compilation-mode-hook) "compile" "progmodes/compile.el" (20543 +;;;;;; 15782 195452 0)) ;;; Generated autoloads from progmodes/compile.el (defvar compilation-mode-hook nil "\ @@ -4723,7 +4723,7 @@ For details see `conf-mode'. Example: ;;;*** ;;;### (autoloads (shuffle-vector cookie-snarf cookie-insert cookie) -;;;;;; "cookie1" "play/cookie1.el" (20364 27900 192709 741000)) +;;;;;; "cookie1" "play/cookie1.el" (20545 57511 257469 0)) ;;; Generated autoloads from play/cookie1.el (autoload 'cookie "cookie1" "\ @@ -4755,8 +4755,8 @@ Randomly permute the elements of VECTOR (all permutations equally likely). ;;;*** ;;;### (autoloads (copyright-update-directory copyright copyright-fix-years -;;;;;; copyright-update) "copyright" "emacs-lisp/copyright.el" (20387 -;;;;;; 44199 24128 0)) +;;;;;; copyright-update) "copyright" "emacs-lisp/copyright.el" (20518 +;;;;;; 12580 46478 0)) ;;; Generated autoloads from emacs-lisp/copyright.el (put 'copyright-at-end-flag 'safe-local-variable 'booleanp) (put 'copyright-names-regexp 'safe-local-variable 'stringp) @@ -4795,7 +4795,7 @@ If FIX is non-nil, run `copyright-fix-years' instead. ;;;*** ;;;### (autoloads (cperl-perldoc-at-point cperl-perldoc cperl-mode) -;;;;;; "cperl-mode" "progmodes/cperl-mode.el" (20490 33188 850375 +;;;;;; "cperl-mode" "progmodes/cperl-mode.el" (20512 60198 306109 ;;;;;; 0)) ;;; Generated autoloads from progmodes/cperl-mode.el (put 'cperl-indent-level 'safe-local-variable 'integerp) @@ -5014,7 +5014,7 @@ Edit display information for cpp conditionals. ;;;*** ;;;### (autoloads (crisp-mode crisp-mode) "crisp" "emulation/crisp.el" -;;;;;; (20476 31768 298871 0)) +;;;;;; (20523 62082 997685 0)) ;;; Generated autoloads from emulation/crisp.el (defvar crisp-mode nil "\ @@ -5147,7 +5147,7 @@ Enable CUA selection mode without the C-z/C-x/C-c/C-v bindings. ;;;;;; customize-mode customize customize-push-and-save customize-save-variable ;;;;;; customize-set-variable customize-set-value custom-menu-sort-alphabetically ;;;;;; custom-buffer-sort-alphabetically custom-browse-sort-alphabetically) -;;;;;; "cus-edit" "cus-edit.el" (20437 50597 545250 0)) +;;;;;; "cus-edit" "cus-edit.el" (20523 62082 997685 0)) ;;; Generated autoloads from cus-edit.el (defvar custom-browse-sort-alphabetically nil "\ @@ -5642,8 +5642,8 @@ Create a new data-debug buffer with NAME. ;;;*** -;;;### (autoloads (dbus-handle-event) "dbus" "net/dbus.el" (20476 -;;;;;; 31768 298871 0)) +;;;### (autoloads (dbus-handle-event) "dbus" "net/dbus.el" (20523 +;;;;;; 62082 997685 0)) ;;; Generated autoloads from net/dbus.el (autoload 'dbus-handle-event "dbus" "\ @@ -5934,8 +5934,8 @@ with no args, if that value is non-nil. ;;;*** -;;;### (autoloads (delete-selection-mode) "delsel" "delsel.el" (20355 -;;;;;; 10021 546955 0)) +;;;### (autoloads (delete-selection-mode) "delsel" "delsel.el" (20515 +;;;;;; 36389 544939 0)) ;;; Generated autoloads from delsel.el (defalias 'pending-delete-mode 'delete-selection-mode) @@ -6032,7 +6032,7 @@ the first time the mode is used. ;;;*** ;;;### (autoloads (describe-char describe-text-properties) "descr-text" -;;;;;; "descr-text.el" (20486 36135 22104 0)) +;;;;;; "descr-text.el" (20530 32114 546307 0)) ;;; Generated autoloads from descr-text.el (autoload 'describe-text-properties "descr-text" "\ @@ -6289,7 +6289,7 @@ Deuglify broken Outlook (Express) articles and redisplay. ;;;*** ;;;### (autoloads (diary-mode diary-mail-entries diary) "diary-lib" -;;;;;; "calendar/diary-lib.el" (20355 10021 546955 0)) +;;;;;; "calendar/diary-lib.el" (20530 32124 97707 678000)) ;;; Generated autoloads from calendar/diary-lib.el (autoload 'diary "diary-lib" "\ @@ -6376,7 +6376,7 @@ This requires the external program `diff' to be in your `exec-path'. ;;;*** ;;;### (autoloads (diff-minor-mode diff-mode) "diff-mode" "vc/diff-mode.el" -;;;;;; (20476 31768 298871 0)) +;;;;;; (20523 62082 997685 0)) ;;; Generated autoloads from vc/diff-mode.el (autoload 'diff-mode "diff-mode" "\ @@ -6420,8 +6420,8 @@ Optional arguments are passed to `dig-invoke'. ;;;*** ;;;### (autoloads (dired-mode dired-noselect dired-other-frame dired-other-window -;;;;;; dired dired-listing-switches) "dired" "dired.el" (20486 36135 -;;;;;; 22104 0)) +;;;;;; dired dired-listing-switches) "dired" "dired.el" (20539 18737 +;;;;;; 159373 0)) ;;; Generated autoloads from dired.el (defvar dired-listing-switches (purecopy "-al") "\ @@ -6715,7 +6715,7 @@ in `.emacs'. ;;;*** ;;;### (autoloads (dissociated-press) "dissociate" "play/dissociate.el" -;;;;;; (20355 10021 546955 0)) +;;;;;; (20545 57511 257469 0)) ;;; Generated autoloads from play/dissociate.el (autoload 'dissociated-press "dissociate" "\ @@ -6824,8 +6824,8 @@ See the command `doc-view-mode' for more information on this mode. ;;;*** -;;;### (autoloads (doctor) "doctor" "play/doctor.el" (20443 2992 -;;;;;; 177196 0)) +;;;### (autoloads (doctor) "doctor" "play/doctor.el" (20545 57511 +;;;;;; 257469 0)) ;;; Generated autoloads from play/doctor.el (autoload 'doctor "doctor" "\ @@ -6852,8 +6852,8 @@ strings when pressed twice. See `double-map' for details. ;;;*** -;;;### (autoloads (dunnet) "dunnet" "play/dunnet.el" (20355 10021 -;;;;;; 546955 0)) +;;;### (autoloads (dunnet) "dunnet" "play/dunnet.el" (20545 57511 +;;;;;; 257469 0)) ;;; Generated autoloads from play/dunnet.el (autoload 'dunnet "dunnet" "\ @@ -7574,7 +7574,7 @@ Display statistics for a class tree. ;;;*** ;;;### (autoloads (electric-buffer-list) "ebuff-menu" "ebuff-menu.el" -;;;;;; (20436 29731 313079 0)) +;;;;;; (20523 62082 997685 0)) ;;; Generated autoloads from ebuff-menu.el (autoload 'electric-buffer-list "ebuff-menu" "\ @@ -7657,7 +7657,7 @@ an EDE controlled project. ;;;### (autoloads (edebug-all-forms edebug-all-defs edebug-eval-top-level-form ;;;;;; edebug-basic-spec edebug-all-forms edebug-all-defs) "edebug" -;;;;;; "emacs-lisp/edebug.el" (20497 6436 957082 0)) +;;;;;; "emacs-lisp/edebug.el" (20523 62082 997685 0)) ;;; Generated autoloads from emacs-lisp/edebug.el (defvar edebug-all-defs nil "\ @@ -8319,7 +8319,7 @@ displayed. ;;;*** ;;;### (autoloads (emacs-lock-mode) "emacs-lock" "emacs-lock.el" -;;;;;; (20399 35365 4050 0)) +;;;;;; (20523 62082 997685 0)) ;;; Generated autoloads from emacs-lock.el (autoload 'emacs-lock-mode "emacs-lock" "\ @@ -8347,7 +8347,7 @@ Other values are interpreted as usual. ;;;*** ;;;### (autoloads (report-emacs-bug-query-existing-bugs report-emacs-bug) -;;;;;; "emacsbug" "mail/emacsbug.el" (20495 51111 757560 0)) +;;;;;; "emacsbug" "mail/emacsbug.el" (20523 62082 997685 0)) ;;; Generated autoloads from mail/emacsbug.el (autoload 'report-emacs-bug "emacsbug" "\ @@ -8800,7 +8800,7 @@ Look at CONFIG and try to expand GROUP. ;;;*** ;;;### (autoloads (erc-handle-irc-url erc-tls erc erc-select-read-args) -;;;;;; "erc" "erc/erc.el" (20444 23842 968143 0)) +;;;;;; "erc" "erc/erc.el" (20530 32114 546307 0)) ;;; Generated autoloads from erc/erc.el (autoload 'erc-select-read-args "erc" "\ @@ -8877,7 +8877,7 @@ Otherwise, connect to HOST:PORT as USER and /join CHANNEL. ;;;*** ;;;### (autoloads (erc-ctcp-query-DCC pcomplete/erc-mode/DCC erc-cmd-DCC) -;;;;;; "erc-dcc" "erc/erc-dcc.el" (20439 5925 915283 0)) +;;;;;; "erc-dcc" "erc/erc-dcc.el" (20523 62082 997685 0)) ;;; Generated autoloads from erc/erc-dcc.el (autoload 'erc-dcc-mode "erc-dcc") @@ -9018,7 +9018,7 @@ system. ;;;*** -;;;### (autoloads nil "erc-join" "erc/erc-join.el" (20356 2211 532900 +;;;### (autoloads nil "erc-join" "erc/erc-join.el" (20532 45476 981297 ;;;;;; 0)) ;;; Generated autoloads from erc/erc-join.el (autoload 'erc-autojoin-mode "erc-join" nil t) @@ -9065,7 +9065,7 @@ You can save every individual message by putting this function on ;;;### (autoloads (erc-delete-dangerous-host erc-add-dangerous-host ;;;;;; erc-delete-keyword erc-add-keyword erc-delete-fool erc-add-fool ;;;;;; erc-delete-pal erc-add-pal) "erc-match" "erc/erc-match.el" -;;;;;; (20434 17809 692608 0)) +;;;;;; (20531 24613 995935 0)) ;;; Generated autoloads from erc/erc-match.el (autoload 'erc-match-mode "erc-match") @@ -9393,8 +9393,8 @@ Kill all test buffers that are still live. ;;;*** -;;;### (autoloads (eshell-mode) "esh-mode" "eshell/esh-mode.el" (20427 -;;;;;; 14766 970343 0)) +;;;### (autoloads (eshell-mode) "esh-mode" "eshell/esh-mode.el" (20523 +;;;;;; 62082 997685 0)) ;;; Generated autoloads from eshell/esh-mode.el (autoload 'eshell-mode "esh-mode" "\ @@ -9407,7 +9407,7 @@ Emacs shell interactive mode. ;;;*** ;;;### (autoloads (eshell-command-result eshell-command eshell) "eshell" -;;;;;; "eshell/eshell.el" (20478 3673 653810 0)) +;;;;;; "eshell/eshell.el" (20523 62082 997685 0)) ;;; Generated autoloads from eshell/eshell.el (autoload 'eshell "eshell" "\ @@ -10085,7 +10085,7 @@ fourth arg NOSEP non-nil inhibits this. ;;;### (autoloads (executable-make-buffer-file-executable-if-script-p ;;;;;; executable-self-display executable-set-magic executable-interpret ;;;;;; executable-command-find-posix-p) "executable" "progmodes/executable.el" -;;;;;; (20355 10021 546955 0)) +;;;;;; (20533 6181 437016 717000)) ;;; Generated autoloads from progmodes/executable.el (autoload 'executable-command-find-posix-p "executable" "\ @@ -10464,7 +10464,7 @@ you can set `feedmail-queue-reminder-alist' to nil. ;;;### (autoloads (ffap-bindings ffap-guess-file-name-at-point dired-at-point ;;;;;; ffap-at-mouse ffap-menu find-file-at-point ffap-next) "ffap" -;;;;;; "ffap.el" (20479 62884 77836 0)) +;;;;;; "ffap.el" (20542 46798 773957 0)) ;;; Generated autoloads from ffap.el (autoload 'ffap-next "ffap" "\ @@ -11422,7 +11422,7 @@ and choose the directory as the fortune-file. ;;;*** ;;;### (autoloads (gdb gdb-enable-debug) "gdb-mi" "progmodes/gdb-mi.el" -;;;;;; (20501 3499 284800 0)) +;;;;;; (20537 63402 936234 0)) ;;; Generated autoloads from progmodes/gdb-mi.el (defvar gdb-enable-debug nil "\ @@ -11705,7 +11705,7 @@ prompt the user for the name of an NNTP server to use. ;;;;;; gnus-agent-get-undownloaded-list gnus-agent-delete-group ;;;;;; gnus-agent-rename-group gnus-agent-possibly-save-gcc gnus-agentize ;;;;;; gnus-slave-unplugged gnus-plugged gnus-unplugged) "gnus-agent" -;;;;;; "gnus/gnus-agent.el" (20458 56750 651721 0)) +;;;;;; "gnus/gnus-agent.el" (20518 12580 46478 0)) ;;; Generated autoloads from gnus/gnus-agent.el (autoload 'gnus-unplugged "gnus-agent" "\ @@ -11796,7 +11796,7 @@ If CLEAN, obsolete (ignore). ;;;*** ;;;### (autoloads (gnus-article-prepare-display) "gnus-art" "gnus/gnus-art.el" -;;;;;; (20497 6436 957082 0)) +;;;;;; (20522 9637 465791 0)) ;;; Generated autoloads from gnus/gnus-art.el (autoload 'gnus-article-prepare-display "gnus-art" "\ @@ -12191,7 +12191,7 @@ Calling (gnus-group-split-fancy nil nil \"mail.others\") returns: ;;;*** ;;;### (autoloads (gnus-button-reply gnus-button-mailto gnus-msg-mail) -;;;;;; "gnus-msg" "gnus/gnus-msg.el" (20495 51111 757560 0)) +;;;;;; "gnus-msg" "gnus/gnus-msg.el" (20533 5993 500881 0)) ;;; Generated autoloads from gnus/gnus-msg.el (autoload 'gnus-msg-mail "gnus-msg" "\ @@ -12217,9 +12217,26 @@ Like `message-reply'. ;;;*** +;;;### (autoloads (gnus-notifications) "gnus-notifications" "gnus/gnus-notifications.el" +;;;;;; (20544 36659 880486 0)) +;;; Generated autoloads from gnus/gnus-notifications.el + +(autoload 'gnus-notifications "gnus-notifications" "\ +Send a notification on new message. +This check for new messages that are in group with a level lower +or equal to `gnus-notifications-minimum-level' and send a +notification using `notifications-notify' for it. + +This is typically a function to add in +`gnus-after-getting-new-news-hook' + +\(fn)" nil nil) + +;;;*** + ;;;### (autoloads (gnus-treat-newsgroups-picon gnus-treat-mail-picon ;;;;;; gnus-treat-from-picon) "gnus-picon" "gnus/gnus-picon.el" -;;;;;; (20458 56750 651721 0)) +;;;;;; (20523 62082 997685 0)) ;;; Generated autoloads from gnus/gnus-picon.el (autoload 'gnus-treat-from-picon "gnus-picon" "\ @@ -12246,7 +12263,7 @@ If picons are already displayed, remove them. ;;;;;; gnus-sorted-nintersection gnus-sorted-range-intersection ;;;;;; gnus-sorted-intersection gnus-intersection gnus-sorted-complement ;;;;;; gnus-sorted-ndifference gnus-sorted-difference) "gnus-range" -;;;;;; "gnus/gnus-range.el" (20495 51111 757560 0)) +;;;;;; "gnus/gnus-range.el" (20544 36659 880486 0)) ;;; Generated autoloads from gnus/gnus-range.el (autoload 'gnus-sorted-difference "gnus-range" "\ @@ -12314,7 +12331,7 @@ Add NUM into sorted LIST by side effect. ;;;*** ;;;### (autoloads (gnus-registry-install-hooks gnus-registry-initialize) -;;;;;; "gnus-registry" "gnus/gnus-registry.el" (20458 56750 651721 +;;;;;; "gnus-registry" "gnus/gnus-registry.el" (20544 36659 880486 ;;;;;; 0)) ;;; Generated autoloads from gnus/gnus-registry.el @@ -12382,7 +12399,7 @@ Declare back end NAME with ABILITIES as a Gnus back end. ;;;*** ;;;### (autoloads (gnus-summary-bookmark-jump) "gnus-sum" "gnus/gnus-sum.el" -;;;;;; (20495 51111 757560 0)) +;;;;;; (20540 39589 424586 0)) ;;; Generated autoloads from gnus/gnus-sum.el (autoload 'gnus-summary-bookmark-jump "gnus-sum" "\ @@ -12394,7 +12411,7 @@ BOOKMARK is a bookmark name or a bookmark record. ;;;*** ;;;### (autoloads (gnus-sync-install-hooks gnus-sync-initialize) -;;;;;; "gnus-sync" "gnus/gnus-sync.el" (20465 29989 57840 0)) +;;;;;; "gnus-sync" "gnus/gnus-sync.el" (20545 57511 257469 0)) ;;; Generated autoloads from gnus/gnus-sync.el (autoload 'gnus-sync-initialize "gnus-sync" "\ @@ -12437,8 +12454,8 @@ A value of nil says to use the default GnuTLS value.") ;;;*** -;;;### (autoloads (gomoku) "gomoku" "play/gomoku.el" (20355 10021 -;;;;;; 546955 0)) +;;;### (autoloads (gomoku) "gomoku" "play/gomoku.el" (20545 57511 +;;;;;; 257469 0)) ;;; Generated autoloads from play/gomoku.el (autoload 'gomoku "gomoku" "\ @@ -12705,8 +12722,8 @@ the form \"WINDOW-ID PIXMAP-ID\". Value is non-nil if successful. ;;;*** ;;;### (autoloads (gud-tooltip-mode gdb-script-mode jdb pdb perldb -;;;;;; xdb dbx sdb gud-gdb) "gud" "progmodes/gud.el" (20478 3673 -;;;;;; 653810 0)) +;;;;;; xdb dbx sdb gud-gdb) "gud" "progmodes/gud.el" (20537 63402 +;;;;;; 936234 0)) ;;; Generated autoloads from progmodes/gud.el (autoload 'gud-gdb "gud" "\ @@ -12796,7 +12813,7 @@ it if ARG is omitted or nil. ;;;### (autoloads (setf gv-define-simple-setter gv-define-setter ;;;;;; gv--defun-declaration gv-define-expander gv-letplace gv-get) -;;;;;; "gv" "emacs-lisp/gv.el" (20497 6436 957082 0)) +;;;;;; "gv" "emacs-lisp/gv.el" (20542 46798 773957 0)) ;;; Generated autoloads from emacs-lisp/gv.el (autoload 'gv-get "gv" "\ @@ -12852,8 +12869,9 @@ well for simple place forms. Assignments of VAL to (NAME ARGS...) are expanded by binding the argument forms (VAL ARGS...) according to ARGLIST, then executing BODY, which must return a Lisp form that does the assignment. -Actually, ARGLIST may be bound to temporary variables which are introduced -automatically to preserve proper execution order of the arguments. Example: +The first arg in ARLIST (the one that receives VAL) receives an expression +which can do arbitrary things, whereas the other arguments are all guaranteed +to be pure and copyable. Example use: (gv-define-setter aref (v a i) `(aset ,a ,i ,v)) \(fn NAME ARGLIST &rest BODY)" nil t) @@ -13108,7 +13126,7 @@ different regions. With numeric argument ARG, behaves like ;;;### (autoloads (doc-file-to-info doc-file-to-man describe-categories ;;;;;; describe-syntax describe-variable variable-at-point describe-function-1 ;;;;;; find-lisp-object-file-name help-C-file-name describe-function) -;;;;;; "help-fns" "help-fns.el" (20497 6436 957082 0)) +;;;;;; "help-fns" "help-fns.el" (20532 45476 981297 0)) ;;; Generated autoloads from help-fns.el (autoload 'describe-function "help-fns" "\ @@ -13205,7 +13223,7 @@ gives the window that lists the options.") ;;;### (autoloads (help-bookmark-jump help-xref-on-pp help-insert-xref-button ;;;;;; help-xref-button help-make-xrefs help-buffer help-setup-xref ;;;;;; help-mode-finish help-mode-setup help-mode) "help-mode" "help-mode.el" -;;;;;; (20479 62884 77836 0)) +;;;;;; (20510 18478 782378 0)) ;;; Generated autoloads from help-mode.el (autoload 'help-mode "help-mode" "\ @@ -13321,7 +13339,7 @@ Provide help for current mode. ;;;*** ;;;### (autoloads (hexlify-buffer hexl-find-file hexl-mode) "hexl" -;;;;;; "hexl.el" (20478 3673 653810 0)) +;;;;;; "hexl.el" (20523 62082 997685 0)) ;;; Generated autoloads from hexl.el (autoload 'hexl-mode "hexl" "\ @@ -13418,7 +13436,7 @@ This discards the buffer's undo information. ;;;### (autoloads (hi-lock-write-interactive-patterns hi-lock-unface-buffer ;;;;;; hi-lock-face-phrase-buffer hi-lock-face-buffer hi-lock-line-face-buffer ;;;;;; global-hi-lock-mode hi-lock-mode) "hi-lock" "hi-lock.el" -;;;;;; (20410 5673 834266 0)) +;;;;;; (20522 9637 465791 0)) ;;; Generated autoloads from hi-lock.el (autoload 'hi-lock-mode "hi-lock" "\ @@ -13427,12 +13445,19 @@ With a prefix argument ARG, enable Hi Lock mode if ARG is positive, and disable it otherwise. If called from Lisp, enable the mode if ARG is omitted or nil. -Issuing one the highlighting commands listed below will -automatically enable Hi Lock mode. To enable Hi Lock mode in all -buffers, use `global-hi-lock-mode' or add (global-hi-lock-mode 1) -to your init file. When Hi Lock mode is enabled, a \"Regexp -Highlighting\" submenu is added to the \"Edit\" menu. The -commands in the submenu, which can be called interactively, are: +Hi Lock mode is automatically enabled when you invoke any of the +highlighting commands listed below, such as \\[highlight-regexp]. +To enable Hi Lock mode in all buffers, use `global-hi-lock-mode' +or add (global-hi-lock-mode 1) to your init file. + +In buffers where Font Lock mode is enabled, patterns are +highlighted using font lock. In buffers where Font Lock mode is +disabled, patterns are applied using overlays; in this case, the +highlighting will not be updated as you type. + +When Hi Lock mode is enabled, a \"Regexp Highlighting\" submenu +is added to the \"Edit\" menu. The commands in the submenu, +which can be called interactively, are: \\[highlight-regexp] REGEXP FACE Highlight matches of pattern REGEXP in current buffer with FACE. @@ -13466,12 +13491,12 @@ When hi-lock is started and if the mode is not excluded or patterns rejected, the beginning of the buffer is searched for lines of the form: Hi-lock: FOO -where FOO is a list of patterns. These are added to the font lock -keywords already present. The patterns must start before position -\(number of characters into buffer) `hi-lock-file-patterns-range'. -Patterns will be read until - Hi-lock: end -is found. A mode is excluded if it's in the list `hi-lock-exclude-modes'. + +where FOO is a list of patterns. The patterns must start before +position (number of characters into buffer) +`hi-lock-file-patterns-range'. Patterns will be read until +Hi-lock: end is found. A mode is excluded if it's in the list +`hi-lock-exclude-modes'. \(fn &optional ARG)" t nil) @@ -13500,12 +13525,13 @@ See `hi-lock-mode' for more information on Hi-Lock mode. (autoload 'hi-lock-line-face-buffer "hi-lock" "\ Set face of all lines containing a match of REGEXP to FACE. +Interactively, prompt for REGEXP then FACE, using a buffer-local +history list for REGEXP and a global history list for FACE. -Interactively, prompt for REGEXP then FACE. Buffer-local history -list maintained for regexps, global history maintained for faces. -\\<minibuffer-local-map>Use \\[previous-history-element] to retrieve previous history items, -and \\[next-history-element] to retrieve default values. -\(See info node `Minibuffer History'.) +If Font Lock mode is enabled in the buffer, it is used to +highlight REGEXP. If Font Lock mode is disabled, overlays are +used for highlighting; in this case, the highlighting will not be +updated as you type. \(fn REGEXP &optional FACE)" t nil) @@ -13513,12 +13539,13 @@ and \\[next-history-element] to retrieve default values. (autoload 'hi-lock-face-buffer "hi-lock" "\ Set face of each match of REGEXP to FACE. +Interactively, prompt for REGEXP then FACE, using a buffer-local +history list for REGEXP and a global history list for FACE. -Interactively, prompt for REGEXP then FACE. Buffer-local history -list maintained for regexps, global history maintained for faces. -\\<minibuffer-local-map>Use \\[previous-history-element] to retrieve previous history items, -and \\[next-history-element] to retrieve default values. -\(See info node `Minibuffer History'.) +If Font Lock mode is enabled in the buffer, it is used to +highlight REGEXP. If Font Lock mode is disabled, overlays are +used for highlighting; in this case, the highlighting will not be +updated as you type. \(fn REGEXP &optional FACE)" t nil) @@ -13526,22 +13553,22 @@ and \\[next-history-element] to retrieve default values. (autoload 'hi-lock-face-phrase-buffer "hi-lock" "\ Set face of each match of phrase REGEXP to FACE. - Whitespace in REGEXP converted to arbitrary whitespace and initial lower-case letters made case insensitive. +If Font Lock mode is enabled in the buffer, it is used to +highlight REGEXP. If Font Lock mode is disabled, overlays are +used for highlighting; in this case, the highlighting will not be +updated as you type. + \(fn REGEXP &optional FACE)" t nil) (defalias 'unhighlight-regexp 'hi-lock-unface-buffer) (autoload 'hi-lock-unface-buffer "hi-lock" "\ Remove highlighting of each match to REGEXP set by hi-lock. - -Interactively, prompt for REGEXP. Buffer-local history of inserted -regexp's maintained. Will accept only regexps inserted by hi-lock -interactive functions. (See `hi-lock-interactive-patterns'.) -\\<minibuffer-local-must-match-map>Use \\[minibuffer-complete] to complete a partially typed regexp. -\(See info node `Minibuffer History'.) +Interactively, prompt for REGEXP, accepting only regexps +previously inserted by hi-lock interactive functions. \(fn REGEXP)" t nil) @@ -13557,7 +13584,7 @@ be found in variable `hi-lock-interactive-patterns'. ;;;*** ;;;### (autoloads (hide-ifdef-mode) "hideif" "progmodes/hideif.el" -;;;;;; (20355 10021 546955 0)) +;;;;;; (20541 6907 775259 0)) ;;; Generated autoloads from progmodes/hideif.el (autoload 'hide-ifdef-mode "hideif" "\ @@ -13601,7 +13628,7 @@ Several variables affect how the hiding is done: ;;;*** ;;;### (autoloads (turn-off-hideshow hs-minor-mode) "hideshow" "progmodes/hideshow.el" -;;;;;; (20356 55829 180242 0)) +;;;;;; (20541 6907 775259 0)) ;;; Generated autoloads from progmodes/hideshow.el (defvar hs-special-modes-alist (mapcar 'purecopy '((c-mode "{" "}" "/[*/]" nil nil) (c++-mode "{" "}" "/[*/]" nil nil) (bibtex-mode ("@\\S(*\\(\\s(\\)" 1)) (java-mode "{" "}" "/[*/]" nil nil) (js-mode "{" "}" "/[*/]" nil))) "\ @@ -13929,7 +13956,7 @@ Global-Hl-Line mode uses the functions `global-hl-line-unhighlight' and ;;;;;; holiday-bahai-holidays holiday-islamic-holidays holiday-christian-holidays ;;;;;; holiday-hebrew-holidays holiday-other-holidays holiday-local-holidays ;;;;;; holiday-oriental-holidays holiday-general-holidays) "holidays" -;;;;;; "calendar/holidays.el" (20390 20388 254308 0)) +;;;;;; "calendar/holidays.el" (20530 32124 107724 973000)) ;;; Generated autoloads from calendar/holidays.el (define-obsolete-variable-alias 'general-holidays 'holiday-general-holidays "23.1") @@ -14212,7 +14239,7 @@ bound to the current value of the filter. ;;;*** ;;;### (autoloads (ibuffer ibuffer-other-window ibuffer-list-buffers) -;;;;;; "ibuffer" "ibuffer.el" (20479 62884 77836 0)) +;;;;;; "ibuffer" "ibuffer.el" (20542 46798 773957 0)) ;;; Generated autoloads from ibuffer.el (autoload 'ibuffer-list-buffers "ibuffer" "\ @@ -14823,7 +14850,7 @@ the mode if ARG is omitted or nil, and toggle it if ARG is `toggle'. ;;;;;; create-image image-type-auto-detected-p image-type-available-p ;;;;;; image-type image-type-from-file-name image-type-from-file-header ;;;;;; image-type-from-buffer image-type-from-data) "image" "image.el" -;;;;;; (20437 50597 545250 0)) +;;;;;; (20523 62082 997685 0)) ;;; Generated autoloads from image.el (autoload 'image-type-from-data "image" "\ @@ -15270,7 +15297,7 @@ on these modes. ;;;*** ;;;### (autoloads (imenu imenu-add-menubar-index imenu-add-to-menubar -;;;;;; imenu-sort-function) "imenu" "imenu.el" (20476 31768 298871 +;;;;;; imenu-sort-function) "imenu" "imenu.el" (20511 39332 974340 ;;;;;; 0)) ;;; Generated autoloads from imenu.el @@ -15292,16 +15319,39 @@ element should come before the second. The arguments are cons cells; (custom-autoload 'imenu-sort-function "imenu" t) (defvar imenu-generic-expression nil "\ -The regex pattern to use for creating a buffer index. +List of definition matchers for creating an Imenu index. +Each element of this list should have the form + + (MENU-TITLE REGEXP INDEX [FUNCTION] [ARGUMENTS...]) + +MENU-TITLE should be nil (in which case the matches for this +element are put in the top level of the buffer index) or a +string (which specifies the title of a submenu into which the +matches are put). +REGEXP is a regular expression matching a definition construct +which is to be displayed in the menu. REGEXP may also be a +function, called without arguments. It is expected to search +backwards. It must return true and set `match-data' if it finds +another element. +INDEX is an integer specifying which subexpression of REGEXP +matches the definition's name; this subexpression is displayed as +the menu item. +FUNCTION, if present, specifies a function to call when the index +item is selected by the user. This function is called with +arguments consisting of the item name, the buffer position, and +the ARGUMENTS. + +The variable `imenu-case-fold-search' determines whether or not +the regexp matches are case sensitive, and `imenu-syntax-alist' +can be used to alter the syntax table for the search. If non-nil this pattern is passed to `imenu--generic-function' to -create a buffer index. Look there for the documentation of this -pattern's structure. +create a buffer index. -For example, see the value of `fortran-imenu-generic-expression' used by -`fortran-mode' with `imenu-syntax-alist' set locally to give the -characters which normally have \"symbol\" syntax \"word\" syntax -during matching.") +For example, see the value of `fortran-imenu-generic-expression' +used by `fortran-mode' with `imenu-syntax-alist' set locally to +give the characters which normally have \"symbol\" syntax +\"word\" syntax during matching.") (put 'imenu-generic-expression 'risky-local-variable t) (make-variable-buffer-local 'imenu-generic-expression) @@ -15487,7 +15537,7 @@ of `inferior-lisp-program'). Runs the hooks from ;;;;;; Info-goto-emacs-key-command-node Info-goto-emacs-command-node ;;;;;; Info-mode info-finder info-apropos Info-index Info-directory ;;;;;; Info-on-current-buffer info-standalone info-emacs-bug info-emacs-manual -;;;;;; info info-other-window) "info" "info.el" (20476 31768 298871 +;;;;;; info info-other-window) "info" "info.el" (20540 39589 424586 ;;;;;; 0)) ;;; Generated autoloads from info.el @@ -16375,7 +16425,7 @@ by `jka-compr-installed'. ;;;*** -;;;### (autoloads (js-mode) "js" "progmodes/js.el" (20478 3673 653810 +;;;### (autoloads (js-mode) "js" "progmodes/js.el" (20532 45476 981297 ;;;;;; 0)) ;;; Generated autoloads from progmodes/js.el @@ -16619,7 +16669,7 @@ The kind of Korean keyboard for Korean input method. ;;;*** ;;;### (autoloads (landmark landmark-test-run) "landmark" "play/landmark.el" -;;;;;; (20478 3673 653810 0)) +;;;;;; (20545 57511 257469 0)) ;;; Generated autoloads from play/landmark.el (defalias 'landmark-repeat 'landmark-test-run) @@ -16776,7 +16826,7 @@ A major mode to edit GNU ld script files ;;;*** -;;;### (autoloads (life) "life" "play/life.el" (20355 10021 546955 +;;;### (autoloads (life) "life" "play/life.el" (20545 57511 257469 ;;;;;; 0)) ;;; Generated autoloads from play/life.el @@ -16953,8 +17003,8 @@ done. Otherwise, it uses the current buffer. ;;;*** -;;;### (autoloads (log-view-mode) "log-view" "vc/log-view.el" (20477 -;;;;;; 21160 227853 0)) +;;;### (autoloads (log-view-mode) "log-view" "vc/log-view.el" (20515 +;;;;;; 36389 544939 0)) ;;; Generated autoloads from vc/log-view.el (autoload 'log-view-mode "log-view" "\ @@ -17618,7 +17668,7 @@ Previous contents of that buffer are killed first. ;;;*** ;;;### (autoloads (Man-bookmark-jump man-follow man) "man" "man.el" -;;;;;; (20504 6781 423358 0)) +;;;;;; (20523 62082 997685 0)) ;;; Generated autoloads from man.el (defalias 'manual-entry 'man) @@ -17729,7 +17779,7 @@ recursion depth in the minibuffer prompt. This is only useful if ;;;;;; message-forward-make-body message-forward message-recover ;;;;;; message-supersede message-cancel-news message-followup message-wide-reply ;;;;;; message-reply message-news message-mail message-mode) "message" -;;;;;; "gnus/message.el" (20501 3499 284800 0)) +;;;;;; "gnus/message.el" (20545 57511 257469 0)) ;;; Generated autoloads from gnus/message.el (define-mail-user-agent 'message-user-agent 'message-mail 'message-send-and-exit 'message-kill-buffer 'message-send-hook) @@ -18204,7 +18254,7 @@ is modified to remove the default indication. ;;;*** ;;;### (autoloads (list-dynamic-libraries butterfly) "misc" "misc.el" -;;;;;; (20356 27828 24951 0)) +;;;;;; (20533 5993 500881 0)) ;;; Generated autoloads from misc.el (autoload 'butterfly "misc" "\ @@ -18606,7 +18656,7 @@ To test this function, evaluate: ;;;*** -;;;### (autoloads (mpc) "mpc" "mpc.el" (20476 31768 298871 0)) +;;;### (autoloads (mpc) "mpc" "mpc.el" (20523 62082 997685 0)) ;;; Generated autoloads from mpc.el (autoload 'mpc "mpc" "\ @@ -18616,7 +18666,7 @@ Main entry point for MPC. ;;;*** -;;;### (autoloads (mpuz) "mpuz" "play/mpuz.el" (20434 17809 692608 +;;;### (autoloads (mpuz) "mpuz" "play/mpuz.el" (20545 57511 257469 ;;;;;; 0)) ;;; Generated autoloads from play/mpuz.el @@ -19309,7 +19359,7 @@ closing requests for requests that are used in matched pairs. ;;;*** ;;;### (autoloads (nxml-glyph-display-string) "nxml-glyph" "nxml/nxml-glyph.el" -;;;;;; (20439 5925 915283 0)) +;;;;;; (20523 62082 997685 0)) ;;; Generated autoloads from nxml/nxml-glyph.el (autoload 'nxml-glyph-display-string "nxml-glyph" "\ @@ -20901,7 +20951,7 @@ The file is stored under the name `org-combined-agenda-icalendar-file'. ;;;### (autoloads (org-id-store-link org-id-find-id-file org-id-find ;;;;;; org-id-goto org-id-get-with-outline-drilling org-id-get-with-outline-path-completion ;;;;;; org-id-get org-id-copy org-id-get-create) "org-id" "org/org-id.el" -;;;;;; (20355 10021 546955 0)) +;;;;;; (20545 57511 257469 0)) ;;; Generated autoloads from org/org-id.el (autoload 'org-id-get-create "org-id" "\ @@ -21620,8 +21670,8 @@ The list is displayed in a buffer named `*Packages*'. ;;;*** -;;;### (autoloads (show-paren-mode) "paren" "paren.el" (20355 10021 -;;;;;; 546955 0)) +;;;### (autoloads (show-paren-mode) "paren" "paren.el" (20542 50478 +;;;;;; 439878 507000)) ;;; Generated autoloads from paren.el (defvar show-paren-mode nil "\ @@ -21859,8 +21909,8 @@ Completion for GNU/Linux `mount'. ;;;*** -;;;### (autoloads (pcomplete/rpm) "pcmpl-rpm" "pcmpl-rpm.el" (20453 -;;;;;; 5408 87415 759000)) +;;;### (autoloads (pcomplete/rpm) "pcmpl-rpm" "pcmpl-rpm.el" (20523 +;;;;;; 62082 997685 0)) ;;; Generated autoloads from pcmpl-rpm.el (autoload 'pcomplete/rpm "pcmpl-rpm" "\ @@ -21930,8 +21980,8 @@ Includes files as well as host names followed by a colon. ;;;### (autoloads (pcomplete-shell-setup pcomplete-comint-setup pcomplete-list ;;;;;; pcomplete-help pcomplete-expand pcomplete-continue pcomplete-expand-and-complete -;;;;;; pcomplete-reverse pcomplete) "pcomplete" "pcomplete.el" (20476 -;;;;;; 31768 298871 0)) +;;;;;; pcomplete-reverse pcomplete) "pcomplete" "pcomplete.el" (20523 +;;;;;; 62082 997685 0)) ;;; Generated autoloads from pcomplete.el (autoload 'pcomplete "pcomplete" "\ @@ -22075,7 +22125,7 @@ Global menu used by PCL-CVS.") ;;;*** ;;;### (autoloads (perl-mode) "perl-mode" "progmodes/perl-mode.el" -;;;;;; (20478 3673 653810 0)) +;;;;;; (20523 62082 997685 0)) ;;; Generated autoloads from progmodes/perl-mode.el (put 'perl-indent-level 'safe-local-variable 'integerp) (put 'perl-continued-statement-offset 'safe-local-variable 'integerp) @@ -22931,17 +22981,20 @@ are both set to t. ;;;*** -;;;### (autoloads (proced) "proced" "proced.el" (20453 5437 764254 +;;;### (autoloads (proced) "proced" "proced.el" (20511 39332 974340 ;;;;;; 0)) ;;; Generated autoloads from proced.el (autoload 'proced "proced" "\ Generate a listing of UNIX system processes. -If invoked with optional ARG the window displaying the process -information will be displayed but not selected. -Runs the normal hook `proced-post-display-hook'. +\\<proced-mode-map> +If invoked with optional ARG, do not select the window displaying +the process information. + +This function runs the normal hook `proced-post-display-hook'. -See `proced-mode' for a description of features available in Proced buffers. +See `proced-mode' for a description of features available in +Proced buffers. \(fn &optional ARG)" t nil) @@ -23245,7 +23298,7 @@ If EXTENSION is any other symbol, it is ignored. ;;;*** ;;;### (autoloads (python-mode run-python) "python" "progmodes/python.el" -;;;;;; (20504 35072 130543 0)) +;;;;;; (20523 62082 997685 0)) ;;; Generated autoloads from progmodes/python.el (add-to-list 'auto-mode-alist (cons (purecopy "\\.py\\'") 'python-mode)) @@ -23281,7 +23334,7 @@ if that value is non-nil. ;;;*** ;;;### (autoloads (quoted-printable-decode-region) "qp" "gnus/qp.el" -;;;;;; (20355 10021 546955 0)) +;;;;;; (20544 36659 880486 0)) ;;; Generated autoloads from gnus/qp.el (autoload 'quoted-printable-decode-region "qp" "\ @@ -23304,7 +23357,7 @@ them into characters should be done separately. ;;;;;; quail-defrule quail-install-decode-map quail-install-map ;;;;;; quail-define-rules quail-show-keyboard-layout quail-set-keyboard-layout ;;;;;; quail-define-package quail-use-package quail-title) "quail" -;;;;;; "international/quail.el" (20501 3499 284800 0)) +;;;;;; "international/quail.el" (20523 62082 997685 0)) ;;; Generated autoloads from international/quail.el (autoload 'quail-title "quail" "\ @@ -23608,7 +23661,7 @@ Display `quickurl-list' as a formatted list using `quickurl-list-mode'. ;;;*** ;;;### (autoloads (rcirc-track-minor-mode rcirc-connect rcirc) "rcirc" -;;;;;; "net/rcirc.el" (20434 17809 692608 0)) +;;;;;; "net/rcirc.el" (20541 6907 775259 0)) ;;; Generated autoloads from net/rcirc.el (autoload 'rcirc "rcirc" "\ @@ -23864,8 +23917,8 @@ For true \"word wrap\" behavior, use `visual-line-mode' instead. ;;;*** ;;;### (autoloads (reftex-reset-scanning-information reftex-mode -;;;;;; turn-on-reftex) "reftex" "textmodes/reftex.el" (20499 48164 -;;;;;; 310488 0)) +;;;;;; turn-on-reftex) "reftex" "textmodes/reftex.el" (20507 42276 +;;;;;; 222255 0)) ;;; Generated autoloads from textmodes/reftex.el (autoload 'turn-on-reftex "reftex" "\ @@ -24013,8 +24066,8 @@ of master file. ;;;*** -;;;### (autoloads nil "reftex-vars" "textmodes/reftex-vars.el" (20498 -;;;;;; 27300 867875 0)) +;;;### (autoloads nil "reftex-vars" "textmodes/reftex-vars.el" (20507 +;;;;;; 42276 222255 0)) ;;; Generated autoloads from textmodes/reftex-vars.el (put 'reftex-vref-is-default 'safe-local-variable (lambda (x) (or (stringp x) (symbolp x)))) (put 'reftex-fref-is-default 'safe-local-variable (lambda (x) (or (stringp x) (symbolp x)))) @@ -24024,7 +24077,7 @@ of master file. ;;;*** ;;;### (autoloads (regexp-opt-depth regexp-opt) "regexp-opt" "emacs-lisp/regexp-opt.el" -;;;;;; (20363 61861 222722 0)) +;;;;;; (20522 38650 757441 0)) ;;; Generated autoloads from emacs-lisp/regexp-opt.el (autoload 'regexp-opt "regexp-opt" "\ @@ -24270,8 +24323,8 @@ variable. ;;;;;; rmail-secondary-file-directory rmail-primary-inbox-list rmail-highlighted-headers ;;;;;; rmail-retry-ignored-headers rmail-displayed-headers rmail-ignored-headers ;;;;;; rmail-user-mail-address-regexp rmail-movemail-variant-p rmail-spool-directory -;;;;;; rmail-file-name) "rmail" "mail/rmail.el" (20437 50597 545250 -;;;;;; 0)) +;;;;;; rmail-file-name) "rmail" "mail/rmail.el" (20526 43809 637014 +;;;;;; 858000)) ;;; Generated autoloads from mail/rmail.el (defvar rmail-file-name (purecopy "~/RMAIL") "\ @@ -24469,8 +24522,8 @@ Set PASSWORD to be used for retrieving mail from a POP or IMAP server. ;;;*** ;;;### (autoloads (rmail-output-body-to-file rmail-output-as-seen -;;;;;; rmail-output) "rmailout" "mail/rmailout.el" (20355 10021 -;;;;;; 546955 0)) +;;;;;; rmail-output) "rmailout" "mail/rmailout.el" (20530 3765 184907 +;;;;;; 0)) ;;; Generated autoloads from mail/rmailout.el (put 'rmail-output-file-alist 'risky-local-variable t) @@ -24619,7 +24672,7 @@ must be equal. ;;;*** ;;;### (autoloads (robin-use-package robin-modify-package robin-define-package) -;;;;;; "robin" "international/robin.el" (20501 3499 284800 0)) +;;;;;; "robin" "international/robin.el" (20523 62082 997685 0)) ;;; Generated autoloads from international/robin.el (autoload 'robin-define-package "robin" "\ @@ -24691,7 +24744,7 @@ Toggle the use of ROT13 encoding for the current window. ;;;*** ;;;### (autoloads (rst-minor-mode rst-mode) "rst" "textmodes/rst.el" -;;;;;; (20502 63903 34842 0)) +;;;;;; (20523 62082 997685 0)) ;;; Generated autoloads from textmodes/rst.el (add-to-list 'auto-mode-alist (purecopy '("\\.re?st\\'" . rst-mode))) @@ -24722,7 +24775,7 @@ for modes derived from Text mode, like Mail mode. ;;;*** ;;;### (autoloads (ruby-mode) "ruby-mode" "progmodes/ruby-mode.el" -;;;;;; (20490 33188 850375 0)) +;;;;;; (20522 38650 757441 0)) ;;; Generated autoloads from progmodes/ruby-mode.el (autoload 'ruby-mode "ruby-mode" "\ @@ -24761,8 +24814,8 @@ if ARG is omitted or nil. ;;;*** -;;;### (autoloads (rx rx-to-string) "rx" "emacs-lisp/rx.el" (20355 -;;;;;; 10021 546955 0)) +;;;### (autoloads (rx rx-to-string) "rx" "emacs-lisp/rx.el" (20518 +;;;;;; 12580 46478 0)) ;;; Generated autoloads from emacs-lisp/rx.el (autoload 'rx-to-string "rx" "\ @@ -25073,8 +25126,8 @@ enclosed in `(and ...)'. ;;;*** -;;;### (autoloads (savehist-mode) "savehist" "savehist.el" (20453 -;;;;;; 5437 764254 0)) +;;;### (autoloads (savehist-mode) "savehist" "savehist.el" (20523 +;;;;;; 62082 997685 0)) ;;; Generated autoloads from savehist.el (defvar savehist-mode nil "\ @@ -25549,8 +25602,8 @@ Like `mail' command, but display mail buffer in another frame. ;;;*** ;;;### (autoloads (server-save-buffers-kill-terminal server-mode -;;;;;; server-force-delete server-start) "server" "server.el" (20478 -;;;;;; 3673 653810 0)) +;;;;;; server-force-delete server-start) "server" "server.el" (20545 +;;;;;; 57511 257469 0)) ;;; Generated autoloads from server.el (put 'server-host 'risky-local-variable t) @@ -25702,7 +25755,7 @@ To work around that, do: ;;;*** ;;;### (autoloads (sh-mode) "sh-script" "progmodes/sh-script.el" -;;;;;; (20487 57003 603251 0)) +;;;;;; (20541 6907 775259 0)) ;;; Generated autoloads from progmodes/sh-script.el (put 'sh-shell 'safe-local-variable 'symbolp) @@ -26010,7 +26063,7 @@ with no arguments, if that value is non-nil. ;;;*** ;;;### (autoloads (skeleton-pair-insert-maybe skeleton-insert skeleton-proxy-new -;;;;;; define-skeleton) "skeleton" "skeleton.el" (20406 8611 875037 +;;;;;; define-skeleton) "skeleton" "skeleton.el" (20541 6907 775259 ;;;;;; 0)) ;;; Generated autoloads from skeleton.el @@ -26123,7 +26176,7 @@ symmetrical ones, and the same character twice for the others. ;;;*** ;;;### (autoloads (smerge-start-session smerge-mode smerge-ediff) -;;;;;; "smerge-mode" "vc/smerge-mode.el" (20476 31768 298871 0)) +;;;;;; "smerge-mode" "vc/smerge-mode.el" (20523 62082 997685 0)) ;;; Generated autoloads from vc/smerge-mode.el (autoload 'smerge-ediff "smerge-mode" "\ @@ -26332,7 +26385,7 @@ Pick your favorite shortcuts: ;;;### (autoloads (reverse-region sort-columns sort-regexp-fields ;;;;;; sort-fields sort-numeric-fields sort-pages sort-paragraphs -;;;;;; sort-lines sort-subr) "sort" "sort.el" (20355 10021 546955 +;;;;;; sort-lines sort-subr) "sort" "sort.el" (20507 42276 222255 ;;;;;; 0)) ;;; Generated autoloads from sort.el (put 'sort-fold-case 'safe-local-variable 'booleanp) @@ -26430,18 +26483,23 @@ the sort order. \(fn FIELD BEG END)" t nil) (autoload 'sort-regexp-fields "sort" "\ -Sort the region lexicographically as specified by RECORD-REGEXP and KEY. -RECORD-REGEXP specifies the textual units which should be sorted. - For example, to sort lines RECORD-REGEXP would be \"^.*$\" -KEY specifies the part of each record (ie each match for RECORD-REGEXP) - is to be used for sorting. - If it is \"\\\\digit\" then the digit'th \"\\\\(...\\\\)\" match field from - RECORD-REGEXP is used. - If it is \"\\\\&\" then the whole record is used. - Otherwise, it is a regular-expression for which to search within the record. -If a match for KEY is not found within a record then that record is ignored. - -With a negative prefix arg sorts in reverse order. +Sort the text in the region region lexicographically. +If called interactively, prompt for two regular expressions, +RECORD-REGEXP and KEY-REGEXP. + +RECORD-REGEXP specifies the textual units to be sorted. + For example, to sort lines, RECORD-REGEXP would be \"^.*$\". + +KEY-REGEXP specifies the part of each record (i.e. each match for + RECORD-REGEXP) to be used for sorting. + If it is \"\\\\digit\", use the digit'th \"\\\\(...\\\\)\" + match field specified by RECORD-REGEXP. + If it is \"\\\\&\", use the whole record. + Otherwise, KEY-REGEXP should be a regular expression with which + to search within the record. If a match for KEY-REGEXP is not + found within a record, that record is ignored. + +With a negative prefix arg, sort in reverse order. The variable `sort-fold-case' determines whether alphabetic case affects the sort order. @@ -27117,8 +27175,8 @@ GnuTLS requires a port number. ;;;;;; strokes-mode strokes-list-strokes strokes-load-user-strokes ;;;;;; strokes-help strokes-describe-stroke strokes-do-complex-stroke ;;;;;; strokes-do-stroke strokes-read-complex-stroke strokes-read-stroke -;;;;;; strokes-global-set-stroke) "strokes" "strokes.el" (20478 -;;;;;; 3673 653810 0)) +;;;;;; strokes-global-set-stroke) "strokes" "strokes.el" (20523 +;;;;;; 62082 997685 0)) ;;; Generated autoloads from strokes.el (autoload 'strokes-global-set-stroke "strokes" "\ @@ -27253,7 +27311,7 @@ Studlify-case the current buffer. ;;;*** ;;;### (autoloads (global-subword-mode subword-mode) "subword" "progmodes/subword.el" -;;;;;; (20355 10021 546955 0)) +;;;;;; (20524 51365 2559 0)) ;;; Generated autoloads from progmodes/subword.el (autoload 'subword-mode "subword" "\ @@ -28010,8 +28068,8 @@ Connect to the Emacs talk group from the current X display or tty frame. ;;;*** -;;;### (autoloads (tar-mode) "tar-mode" "tar-mode.el" (20478 3673 -;;;;;; 653810 0)) +;;;### (autoloads (tar-mode) "tar-mode" "tar-mode.el" (20522 9637 +;;;;;; 465791 0)) ;;; Generated autoloads from tar-mode.el (autoload 'tar-mode "tar-mode" "\ @@ -28200,8 +28258,8 @@ Start coverage on function under point. ;;;*** -;;;### (autoloads (tetris) "tetris" "play/tetris.el" (20478 3673 -;;;;;; 653810 0)) +;;;### (autoloads (tetris) "tetris" "play/tetris.el" (20545 57511 +;;;;;; 257469 0)) ;;; Generated autoloads from play/tetris.el (autoload 'tetris "tetris" "\ @@ -28232,7 +28290,7 @@ tetris-mode keybindings: ;;;;;; tex-start-commands tex-start-options slitex-run-command latex-run-command ;;;;;; tex-run-command tex-offer-save tex-main-file tex-first-line-header-regexp ;;;;;; tex-directory tex-shell-file-name) "tex-mode" "textmodes/tex-mode.el" -;;;;;; (20485 15269 390836 0)) +;;;;;; (20523 62082 997685 0)) ;;; Generated autoloads from textmodes/tex-mode.el (defvar tex-shell-file-name nil "\ @@ -29114,7 +29172,7 @@ With ARG, turn time stamping on if and only if arg is positive. ;;;;;; timeclock-workday-remaining-string timeclock-reread-log timeclock-query-out ;;;;;; timeclock-change timeclock-status-string timeclock-out timeclock-in ;;;;;; timeclock-mode-line-display) "timeclock" "calendar/timeclock.el" -;;;;;; (20427 14766 970343 0)) +;;;;;; (20523 62082 997685 0)) ;;; Generated autoloads from calendar/timeclock.el (autoload 'timeclock-mode-line-display "timeclock" "\ @@ -29524,7 +29582,7 @@ BUFFER defaults to `trace-buffer'. ;;;### (autoloads (tramp-unload-tramp tramp-completion-handle-file-name-completion ;;;;;; tramp-completion-handle-file-name-all-completions tramp-unload-file-name-handlers ;;;;;; tramp-file-name-handler tramp-syntax tramp-mode) "tramp" -;;;;;; "net/tramp.el" (20471 14012 248888 0)) +;;;;;; "net/tramp.el" (20530 32114 546307 0)) ;;; Generated autoloads from net/tramp.el (defvar tramp-mode t "\ @@ -29667,8 +29725,8 @@ Discard Tramp from loading remote files. ;;;*** -;;;### (autoloads (help-with-tutorial) "tutorial" "tutorial.el" (20369 -;;;;;; 14251 85829 0)) +;;;### (autoloads (help-with-tutorial) "tutorial" "tutorial.el" (20518 +;;;;;; 12580 46478 0)) ;;; Generated autoloads from tutorial.el (autoload 'help-with-tutorial "tutorial" "\ @@ -29755,7 +29813,7 @@ First column's text sSs Second column's text ;;;;;; type-break type-break-mode type-break-keystroke-threshold ;;;;;; type-break-good-break-interval type-break-good-rest-interval ;;;;;; type-break-interval type-break-mode) "type-break" "type-break.el" -;;;;;; (20355 10021 546955 0)) +;;;;;; (20545 57511 257469 0)) ;;; Generated autoloads from type-break.el (defvar type-break-mode nil "\ @@ -30320,7 +30378,7 @@ accessible. ;;;*** ;;;### (autoloads (url-http-options url-http-file-attributes url-http-file-exists-p -;;;;;; url-http) "url-http" "url/url-http.el" (20478 3673 653810 +;;;;;; url-http) "url-http" "url/url-http.el" (20522 38650 757441 ;;;;;; 0)) ;;; Generated autoloads from url/url-http.el @@ -30523,7 +30581,7 @@ Fetch a data URL (RFC 2397). ;;;*** ;;;### (autoloads (url-generic-parse-url url-recreate-url) "url-parse" -;;;;;; "url/url-parse.el" (20478 3673 653810 0)) +;;;;;; "url/url-parse.el" (20523 62082 997685 0)) ;;; Generated autoloads from url/url-parse.el (autoload 'url-recreate-url "url-parse" "\ @@ -30606,8 +30664,8 @@ The variable `url-queue-timeout' sets a timeout. ;;;;;; url-percentage url-display-percentage url-pretty-length url-strip-leading-spaces ;;;;;; url-eat-trailing-space url-get-normalized-date url-lazy-message ;;;;;; url-normalize-url url-insert-entities-in-string url-parse-args -;;;;;; url-debug url-debug) "url-util" "url/url-util.el" (20478 -;;;;;; 3673 653810 0)) +;;;;;; url-debug url-debug) "url-util" "url/url-util.el" (20520 +;;;;;; 54308 826101 0)) ;;; Generated autoloads from url/url-util.el (defvar url-debug nil "\ @@ -30867,8 +30925,8 @@ If FILE-NAME is non-nil, save the result to FILE-NAME. ;;;;;; vc-print-log vc-retrieve-tag vc-create-tag vc-merge vc-insert-headers ;;;;;; vc-revision-other-window vc-root-diff vc-ediff vc-version-ediff ;;;;;; vc-diff vc-version-diff vc-register vc-next-action vc-before-checkin-hook -;;;;;; vc-checkin-hook vc-checkout-hook) "vc" "vc/vc.el" (20501 -;;;;;; 3499 284800 0)) +;;;;;; vc-checkin-hook vc-checkout-hook) "vc" "vc/vc.el" (20542 +;;;;;; 46798 773957 0)) ;;; Generated autoloads from vc/vc.el (defvar vc-checkout-hook nil "\ @@ -31211,7 +31269,7 @@ Name of the format file in a .bzr directory.") ;;;*** -;;;### (autoloads nil "vc-cvs" "vc/vc-cvs.el" (20478 3673 653810 +;;;### (autoloads nil "vc-cvs" "vc/vc-cvs.el" (20542 46798 773957 ;;;;;; 0)) ;;; Generated autoloads from vc/vc-cvs.el (defun vc-cvs-registered (f) @@ -31223,7 +31281,7 @@ Name of the format file in a .bzr directory.") ;;;*** -;;;### (autoloads (vc-dir) "vc-dir" "vc/vc-dir.el" (20478 3673 653810 +;;;### (autoloads (vc-dir) "vc-dir" "vc/vc-dir.el" (20522 9637 465791 ;;;;;; 0)) ;;; Generated autoloads from vc/vc-dir.el @@ -31295,8 +31353,7 @@ case, and the process object in the asynchronous case. ;;;*** -;;;### (autoloads nil "vc-mtn" "vc/vc-mtn.el" (20478 3673 653810 -;;;;;; 0)) +;;;### (autoloads nil "vc-mtn" "vc/vc-mtn.el" (20524 51365 2559 0)) ;;; Generated autoloads from vc/vc-mtn.el (defconst vc-mtn-admin-dir "_MTN" "\ @@ -32468,8 +32525,8 @@ Exit View mode and make the current buffer editable. ;;;*** -;;;### (autoloads (vip-mode vip-setup) "vip" "emulation/vip.el" (20355 -;;;;;; 10021 546955 0)) +;;;### (autoloads (vip-mode vip-setup) "vip" "emulation/vip.el" (20513 +;;;;;; 18948 537867 0)) ;;; Generated autoloads from emulation/vip.el (autoload 'vip-setup "vip" "\ @@ -32592,15 +32649,16 @@ this is equivalent to `display-warning', using ;;;*** ;;;### (autoloads (wdired-change-to-wdired-mode) "wdired" "wdired.el" -;;;;;; (20478 3673 653810 0)) +;;;;;; (20510 18478 782378 0)) ;;; Generated autoloads from wdired.el (autoload 'wdired-change-to-wdired-mode "wdired" "\ -Put a dired buffer in a mode in which filenames are editable. +Put a Dired buffer in Writable Dired (WDired) mode. \\<wdired-mode-map> -This mode allows the user to change the names of the files, and after -typing \\[wdired-finish-edit] Emacs renames the files and directories -in disk. +In WDired mode, you can edit the names of the files in the +buffer, the target of the links, and the permission bits of the +files. After typing \\[wdired-finish-edit], Emacs modifies the files and +directories to reflect your edits. See `wdired-mode'. @@ -32626,7 +32684,7 @@ Please submit bug reports and other feedback to the author, Neil W. Van Dyke ;;;*** ;;;### (autoloads (which-function-mode which-func-mode) "which-func" -;;;;;; "progmodes/which-func.el" (20461 32935 300400 0)) +;;;;;; "progmodes/which-func.el" (20523 62082 997685 0)) ;;; Generated autoloads from progmodes/which-func.el (put 'which-func-format 'risky-local-variable t) (put 'which-func-current 'risky-local-variable t) @@ -32662,8 +32720,8 @@ in certain major modes. ;;;### (autoloads (whitespace-report-region whitespace-report whitespace-cleanup-region ;;;;;; whitespace-cleanup global-whitespace-toggle-options whitespace-toggle-options ;;;;;; global-whitespace-newline-mode global-whitespace-mode whitespace-newline-mode -;;;;;; whitespace-mode) "whitespace" "whitespace.el" (20495 51111 -;;;;;; 757560 0)) +;;;;;; whitespace-mode) "whitespace" "whitespace.el" (20508 13724 +;;;;;; 260761 0)) ;;; Generated autoloads from whitespace.el (autoload 'whitespace-mode "whitespace" "\ @@ -33209,7 +33267,7 @@ With arg, turn Winner mode on if and only if arg is positive. ;;;*** ;;;### (autoloads (woman-bookmark-jump woman-find-file woman-dired-find-file -;;;;;; woman woman-locale) "woman" "woman.el" (20504 6781 423358 +;;;;;; woman woman-locale) "woman" "woman.el" (20539 18737 159373 ;;;;;; 0)) ;;; Generated autoloads from woman.el @@ -33392,7 +33450,7 @@ Example: ;;;*** ;;;### (autoloads (xml-parse-region xml-parse-file) "xml" "xml.el" -;;;;;; (20499 48164 310488 0)) +;;;;;; (20528 48420 241677 0)) ;;; Generated autoloads from xml.el (autoload 'xml-parse-file "xml" "\ @@ -33540,7 +33598,7 @@ Zippy goes to the analyst. ;;;*** -;;;### (autoloads (zone) "zone" "play/zone.el" (20427 14766 970343 +;;;### (autoloads (zone) "zone" "play/zone.el" (20545 57511 257469 ;;;;;; 0)) ;;; Generated autoloads from play/zone.el @@ -33752,7 +33810,7 @@ Zone out, completely. ;;;;;; "vc/ediff-ptch.el" "vc/ediff-vers.el" "vc/ediff-wind.el" ;;;;;; "vc/pcvs-info.el" "vc/pcvs-parse.el" "vc/pcvs-util.el" "vc/vc-dav.el" ;;;;;; "vcursor.el" "vt-control.el" "vt100-led.el" "w32-fns.el" -;;;;;; "w32-vars.el" "x-dnd.el") (20505 765 716386 793000)) +;;;;;; "w32-vars.el" "x-dnd.el") (20545 57718 475744 538000)) ;;;*** diff --git a/lisp/minibuffer.el b/lisp/minibuffer.el index cc2638d58de..a696fff7dc7 100644 --- a/lisp/minibuffer.el +++ b/lisp/minibuffer.el @@ -1821,7 +1821,9 @@ Currently supported properties are all the properties that can appear in `:predicate' a predicate that completion candidates need to satisfy. `:exclusive' If `no', means that if the completion table fails to match the text at point, then instead of reporting a completion - failure, the completion should try the next completion function.") + failure, the completion should try the next completion function. +As is the case with most hooks, the functions are responsible to preserve +things like point and current buffer.") (defvar completion--capf-misbehave-funs nil "List of functions found on `completion-at-point-functions' that misbehave. diff --git a/lisp/misc.el b/lisp/misc.el index cb52ecbd36e..96b739dc2b7 100644 --- a/lisp/misc.el +++ b/lisp/misc.el @@ -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 diff --git a/lisp/net/rcirc.el b/lisp/net/rcirc.el index 27cf50f06ca..dd345630b9b 100644 --- a/lisp/net/rcirc.el +++ b/lisp/net/rcirc.el @@ -802,26 +802,36 @@ With no argument or nil as argument, use the current buffer." (defvar rcirc-max-message-length 420 "Messages longer than this value will be split.") +(defun rcirc-split-message (message) + "Split MESSAGE into chunks within `rcirc-max-message-length'." + ;; `rcirc-encode-coding-system' can have buffer-local value. + (let ((encoding rcirc-encode-coding-system)) + (with-temp-buffer + (insert message) + (goto-char (point-min)) + (let (result) + (while (not (eobp)) + (goto-char (or (byte-to-position rcirc-max-message-length) + (point-max))) + ;; max message length is 512 including CRLF + (while (and (not (bobp)) + (> (length (encode-coding-region + (point-min) (point) encoding t)) + rcirc-max-message-length)) + (forward-char -1)) + (push (delete-and-extract-region (point-min) (point)) result)) + (nreverse result))))) + (defun rcirc-send-message (process target message &optional noticep silent) "Send TARGET associated with PROCESS a privmsg with text MESSAGE. If NOTICEP is non-nil, send a notice instead of privmsg. If SILENT is non-nil, do not print the message in any irc buffer." - ;; max message length is 512 including CRLF - (let* ((response (if noticep "NOTICE" "PRIVMSG")) - (oversize (> (length message) rcirc-max-message-length)) - (text (if oversize - (substring message 0 rcirc-max-message-length) - message)) - (text (if (string= text "") - " " - text)) - (more (if oversize - (substring message rcirc-max-message-length)))) + (let ((response (if noticep "NOTICE" "PRIVMSG"))) (rcirc-get-buffer-create process target) - (rcirc-send-string process (concat response " " target " :" text)) - (unless silent - (rcirc-print process (rcirc-nick process) response target text)) - (when more (rcirc-send-message process target more noticep)))) + (dolist (msg (rcirc-split-message message)) + (rcirc-send-string process (concat response " " target " :" msg)) + (unless silent + (rcirc-print process (rcirc-nick process) response target msg))))) (defvar rcirc-input-ring nil) (defvar rcirc-input-ring-index 0) diff --git a/lisp/net/sasl.el b/lisp/net/sasl.el index c6e95970f3d..4e759a4e6b2 100644 --- a/lisp/net/sasl.el +++ b/lisp/net/sasl.el @@ -183,7 +183,7 @@ It contain at least 64 bits of entropy." ;; Don't use microseconds from (current-time), they may be unsupported. ;; Instead we use this randomly inited counter. (setq sasl-unique-id-char - (% (1+ (or sasl-unique-id-char (logand (random t) (1- (lsh 1 20))))) + (% (1+ (or sasl-unique-id-char (logand (random) (1- (lsh 1 20))))) ;; (current-time) returns 16-bit ints, ;; and 2^16*25 just fits into 4 digits i base 36. (* 25 25))) diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el index 6283188d46a..2c1af3e83fa 100644 --- a/lisp/net/tramp-sh.el +++ b/lisp/net/tramp-sh.el @@ -512,9 +512,9 @@ detected as prompt when being sent on echoing hosts, therefore.") ;; IRIX64: /usr/bin ;;;###tramp-autoload (defcustom tramp-remote-path - '(tramp-default-remote-path "/bin" "/usr/bin" "/usr/sbin" - "/usr/local/bin" "/local/bin" "/local/freeware/bin" "/local/gnu/bin" - "/usr/freeware/bin" "/usr/pkg/bin" "/usr/contrib/bin" + '(tramp-default-remote-path "/bin" "/usr/bin" "/sbin" "/usr/sbin" + "/usr/local/bin" "/usr/local/sbin" "/local/bin" "/local/freeware/bin" + "/local/gnu/bin" "/usr/freeware/bin" "/usr/pkg/bin" "/usr/contrib/bin" "/opt/bin" "/opt/sbin" "/opt/local/bin") "List of directories to search for executables on remote host. For every remote host, this variable will be set buffer local, diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el index 848599104c5..a17bbfa0d14 100644 --- a/lisp/net/tramp.el +++ b/lisp/net/tramp.el @@ -3293,7 +3293,7 @@ for process communication also." ;; Under Windows XP, accept-process-output doesn't return ;; sometimes. So we add an additional timeout. (with-timeout ((or timeout 1)) - (accept-process-output proc timeout timeout-msecs))) + (accept-process-output proc timeout timeout-msecs (and proc t)))) (tramp-message proc 10 "\n%s" (buffer-string)))) (defun tramp-check-for-regexp (proc regexp) diff --git a/lisp/obsolete/vc-mcvs.el b/lisp/obsolete/vc-mcvs.el index 94db90f1d6a..78221945073 100644 --- a/lisp/obsolete/vc-mcvs.el +++ b/lisp/obsolete/vc-mcvs.el @@ -329,7 +329,7 @@ This is only possible if Meta-CVS is responsible for FILE's directory.") (if vc-mcvs-use-edit (vc-mcvs-command nil 0 file "edit") (set-file-modes file (logior (file-modes file) 128)) - (if (equal file buffer-file-name) (toggle-read-only -1)))) + (if (equal file buffer-file-name) (read-only-mode -1)))) ;; Check out a particular revision (or recreate the file). (vc-file-setprop file 'vc-working-revision nil) (apply 'vc-mcvs-command nil 0 file diff --git a/lisp/org/ChangeLog b/lisp/org/ChangeLog index cf9c32006ac..152af5f43ed 100644 --- a/lisp/org/ChangeLog +++ b/lisp/org/ChangeLog @@ -1,3 +1,9 @@ +2012-09-01 Paul Eggert <eggert@cs.ucla.edu> + + Better seed support for (random). + * org-id.el (org-id-uuid): + Change (random t) to (random), now that the latter is more random. + 2012-07-29 Paul Eggert <eggert@cs.ucla.edu> Don't use the abbreviation "win" to refer to Windows (Bug#10421). diff --git a/lisp/org/org-id.el b/lisp/org/org-id.el index 55e826f3ae6..a93f804946f 100644 --- a/lisp/org/org-id.el +++ b/lisp/org/org-id.el @@ -318,7 +318,7 @@ So a typical ID could look like \"Org:4nd91V40HI\"." (defun org-id-uuid () "Return string with random (version 4) UUID." (let ((rnd (md5 (format "%s%s%s%s%s%s%s" - (random t) + (random) (current-time) (user-uid) (emacs-pid) diff --git a/lisp/paren.el b/lisp/paren.el index 2d6c42478e1..ab856380d3f 100644 --- a/lisp/paren.el +++ b/lisp/paren.el @@ -52,8 +52,17 @@ otherwise)." :group 'paren-showing) (defcustom show-paren-delay 0.125 - "Time in seconds to delay before showing a matching paren." + "Time in seconds to delay before showing a matching paren. +If you change this without using customize while `show-paren-mode' is +active, you must toggle the mode off and on again for this to take effect." :type '(number :tag "seconds") + :initialize 'custom-initialize-default + :set (lambda (sym val) + (if (not show-paren-mode) + (set sym val) + (show-paren-mode -1) + (set sym val) + (show-paren-mode 1))) :group 'paren-showing) (defcustom show-paren-priority 1000 diff --git a/lisp/play/5x5.el b/lisp/play/5x5.el index e6df0df8282..abc78cd495c 100644 --- a/lisp/play/5x5.el +++ b/lisp/play/5x5.el @@ -953,8 +953,6 @@ lest." (y-or-n-p prompt) t)) -(random t) - (provide '5x5) ;;; 5x5.el ends here diff --git a/lisp/play/animate.el b/lisp/play/animate.el index 9919600202f..2398a7b89c7 100644 --- a/lisp/play/animate.el +++ b/lisp/play/animate.el @@ -201,8 +201,6 @@ the buffer *Birthday-Present-for-Name*." (animate-string "my sunshine" 18 34) (animate-string "to stay!" 19 34)) -(random t) - (provide 'animate) ;;; animate.el ends here diff --git a/lisp/play/blackbox.el b/lisp/play/blackbox.el index eb2d784c8e5..db2e18188e5 100644 --- a/lisp/play/blackbox.el +++ b/lisp/play/blackbox.el @@ -93,7 +93,7 @@ (define-key map (vector 'remap oldfun) newfun)) -(defvar blackbox-mode-map +(defvar blackbox-mode-map (let ((map (make-keymap))) (suppress-keymap map t) (blackbox-redefine-key map 'backward-char 'bb-left) @@ -257,7 +257,6 @@ a reflection." (bb-goto (cons bb-x bb-y))) (defun bb-init-board (num-balls) - (random t) (let (board pos) (while (>= (setq num-balls (1- num-balls)) 0) (while diff --git a/lisp/play/cookie1.el b/lisp/play/cookie1.el index cbf29a26a71..dbd6e893473 100644 --- a/lisp/play/cookie1.el +++ b/lisp/play/cookie1.el @@ -53,9 +53,6 @@ ;;; Code: -; Randomize the seed in the random number generator. -(random t) - (defconst cookie-delimiter "\n%%\n\\|\n%\n\\|\0" "Delimiter used to separate cookie file entries.") diff --git a/lisp/play/dissociate.el b/lisp/play/dissociate.el index 8f9f8cea24f..238b2a86c17 100644 --- a/lisp/play/dissociate.el +++ b/lisp/play/dissociate.el @@ -94,8 +94,6 @@ Default is 2." (funcall search-function overlap opoint t)))))) (sit-for 0)))) -(random t) - (provide 'dissociate) ;;; dissociate.el ends here diff --git a/lisp/play/doctor.el b/lisp/play/doctor.el index fdae2ec9326..57dbb1452f3 100644 --- a/lisp/play/doctor.el +++ b/lisp/play/doctor.el @@ -1620,8 +1620,6 @@ Hack on previous word, setting global variable DOCTOR-OWNER to correct result." (defun doctor-chat () (doctor-type (doc$ doctor--chatlst))) -(random t) - (provide 'doctor) ;;; doctor.el ends here diff --git a/lisp/play/dunnet.el b/lisp/play/dunnet.el index 22a2642f751..2d62b800ef4 100644 --- a/lisp/play/dunnet.el +++ b/lisp/play/dunnet.el @@ -3010,7 +3010,6 @@ drwxr-xr-x 3 root staff 2048 Jan 1 1970 ..") (dun-uexit nil))) -(random t) (setq tloc (+ 60 (random 18))) (dun-replace dun-room-objects tloc (append (nth tloc dun-room-objects) (list 18))) diff --git a/lisp/play/gomoku.el b/lisp/play/gomoku.el index 6d73e2ccb65..3dba99d98d5 100644 --- a/lisp/play/gomoku.el +++ b/lisp/play/gomoku.el @@ -1197,8 +1197,6 @@ If the game is finished, this command requests for another game." (move-to-column (+ gomoku-x-offset (* gomoku-square-width (1- gomoku-board-width))))) -(random t) - (provide 'gomoku) ;;; gomoku.el ends here diff --git a/lisp/play/landmark.el b/lisp/play/landmark.el index e9f555093db..e103249da49 100644 --- a/lisp/play/landmark.el +++ b/lisp/play/landmark.el @@ -1683,8 +1683,6 @@ Use \\[describe-mode] for more info." ;;;allout-layout: (0 : -1 -1 0) ;;;End: -(random t) - (provide 'landmark) ;;; landmark.el ends here diff --git a/lisp/play/life.el b/lisp/play/life.el index e9133f84862..87ec0226af5 100644 --- a/lisp/play/life.el +++ b/lisp/play/life.el @@ -111,9 +111,6 @@ ;; Sadly, mode-line-format won't display numbers. (defvar life-generation-string nil) -(defvar life-initialized nil - "Non-nil if `life' has been run at least once.") - ;;;###autoload (defun life (&optional sleeptime) "Run Conway's Life simulation. @@ -121,9 +118,6 @@ The starting pattern is randomly selected. Prefix arg (optional first arg non-nil from a program) is the number of seconds to sleep between generations (this defaults to 1)." (interactive "p") - (or life-initialized - (random t)) - (setq life-initialized t) (or sleeptime (setq sleeptime 1)) (life-setup) (catch 'life-exit diff --git a/lisp/play/mpuz.el b/lisp/play/mpuz.el index c0c8803f896..e16bb2f1bde 100644 --- a/lisp/play/mpuz.el +++ b/lisp/play/mpuz.el @@ -35,8 +35,6 @@ :prefix "mpuz-" :group 'games) -(random t) ; randomize - (defcustom mpuz-silent 'error "Set this to nil if you want dings on inputs. The value t means never ding, and `error' means only ding on wrong input." diff --git a/lisp/play/tetris.el b/lisp/play/tetris.el index b811a21605b..9cc33304589 100644 --- a/lisp/play/tetris.el +++ b/lisp/play/tetris.el @@ -635,8 +635,6 @@ tetris-mode keybindings: (tetris-mode) (tetris-start-game)) -(random t) - (provide 'tetris) ;;; tetris.el ends here diff --git a/lisp/play/zone.el b/lisp/play/zone.el index 34e21193437..1cfc6c59987 100644 --- a/lisp/play/zone.el +++ b/lisp/play/zone.el @@ -675,8 +675,6 @@ If nil, `zone-pgm-random-life' chooses a value from 0-3 (inclusive).") (kill-buffer nil)))) -(random t) - ;;;;;;;;;;;;;;; (provide 'zone) diff --git a/lisp/progmodes/bug-reference.el b/lisp/progmodes/bug-reference.el index 0a7d65c1fa4..97fcb6874dd 100644 --- a/lisp/progmodes/bug-reference.el +++ b/lisp/progmodes/bug-reference.el @@ -32,6 +32,11 @@ ;;; Code: +(defgroup bug-reference nil + "Hyperlinking references to bug reports" + ;; Somewhat arbitrary, by analogy with eg goto-address. + :group 'comm) + (defvar bug-reference-map (let ((map (make-sparse-keymap))) (define-key map [mouse-2] 'bug-reference-push-button) @@ -63,9 +68,13 @@ so that it is considered safe, see `enable-local-variables'.") (and (symbolp s) (get s 'bug-reference-url-format))))) -(defconst bug-reference-bug-regexp +(defcustom bug-reference-bug-regexp "\\([Bb]ug ?#\\|[Pp]atch ?#\\|RFE ?#\\|PR [a-z-+]+/\\)\\([0-9]+\\(?:#[0-9]+\\)?\\)" - "Regular expression which matches bug references.") + "Regular expression matching bug references. +The second subexpression should match the bug reference (usually a number)." + :type 'string + :safe 'stringp + :group 'bug-reference) (defun bug-reference-set-overlay-properties () "Set properties of bug reference overlays." diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el index 21a323d8b45..fbb0c9e204a 100644 --- a/lisp/progmodes/compile.el +++ b/lisp/progmodes/compile.el @@ -1503,6 +1503,13 @@ Otherwise, construct a buffer name from NAME-OF-MODE." (compilation-start command nil name-function highlight-regexp))) (make-obsolete 'compile-internal 'compilation-start "22.1") +(defcustom compilation-always-kill nil + "If t, always kill a running compilation process before starting a new one. +If nil, ask to kill it." + :type 'boolean + :version "24.3" + :group 'compilation) + ;;;###autoload (defun compilation-start (command &optional mode name-function highlight-regexp) "Run compilation command COMMAND (low level interface). @@ -1537,6 +1544,7 @@ Returns the compilation buffer created." (let ((comp-proc (get-buffer-process (current-buffer)))) (if comp-proc (if (or (not (eq (process-status comp-proc) 'run)) + compilation-always-kill (yes-or-no-p (format "A %s process is running; kill it? " name-of-mode))) @@ -2461,10 +2469,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) diff --git a/lisp/progmodes/executable.el b/lisp/progmodes/executable.el index e5142571972..092e1a4d578 100644 --- a/lisp/progmodes/executable.el +++ b/lisp/progmodes/executable.el @@ -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) diff --git a/lisp/progmodes/gdb-mi.el b/lisp/progmodes/gdb-mi.el index 0a99c2f5c24..59c419abfc3 100644 --- a/lisp/progmodes/gdb-mi.el +++ b/lisp/progmodes/gdb-mi.el @@ -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)) ;;; 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)) ;; 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"))) ;;; 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))) diff --git a/lisp/progmodes/gud.el b/lisp/progmodes/gud.el index 5946e93f34d..2e3858b2cc5 100644 --- a/lisp/progmodes/gud.el +++ b/lisp/progmodes/gud.el @@ -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 diff --git a/lisp/progmodes/hideif.el b/lisp/progmodes/hideif.el index 3e3d7adc0b6..4b77c6dab1a 100644 --- a/lisp/progmodes/hideif.el +++ b/lisp/progmodes/hideif.el @@ -1003,7 +1003,7 @@ Return as (TOP . BOTTOM) the extent of ifdef block." "Compress the define list ENV into a list of defined symbols only." (let ((new-defs nil)) (dolist (def env new-defs) - (if (hif-lookup (car def)) (push (car env) new-defs))))) + (if (hif-lookup (car def)) (push (car def) new-defs))))) (defun hide-ifdef-set-define-alist (name) "Set the association for NAME to `hide-ifdef-env'." diff --git a/lisp/progmodes/hideshow.el b/lisp/progmodes/hideshow.el index b6d2b5e319c..233b9a5212e 100644 --- a/lisp/progmodes/hideshow.el +++ b/lisp/progmodes/hideshow.el @@ -408,6 +408,8 @@ element (using `match-beginning') before calling `hs-forward-sexp-func'.") (defvar hs-block-end-regexp nil "Regexp for end of block.") +(make-variable-buffer-local 'hs-block-end-regexp) + (defvar hs-forward-sexp-func 'forward-sexp "Function used to do a `forward-sexp'. diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el index 519e5aef2bc..d954cd53e0a 100644 --- a/lisp/progmodes/js.el +++ b/lisp/progmodes/js.el @@ -426,18 +426,21 @@ Match group 1 is the name of the macro.") (defcustom js-indent-level 4 "Number of spaces for each indentation step in `js-mode'." :type 'integer + :safe 'integerp :group 'js) (defcustom js-expr-indent-offset 0 "Number of additional spaces for indenting continued expressions. The value must be no less than minus `js-indent-level'." :type 'integer + :safe 'integerp :group 'js) (defcustom js-paren-indent-offset 0 "Number of additional spaces for indenting expressions in parentheses. The value must be no less than minus `js-indent-level'." :type 'integer + :safe 'integerp :group 'js :version "24.1") @@ -445,6 +448,7 @@ The value must be no less than minus `js-indent-level'." "Number of additional spaces for indenting expressions in square braces. The value must be no less than minus `js-indent-level'." :type 'integer + :safe 'integerp :group 'js :version "24.1") @@ -452,6 +456,7 @@ The value must be no less than minus `js-indent-level'." "Number of additional spaces for indenting expressions in curly braces. The value must be no less than minus `js-indent-level'." :type 'integer + :safe 'integerp :group 'js :version "24.1") diff --git a/lisp/progmodes/ruby-mode.el b/lisp/progmodes/ruby-mode.el index 457c7fee36c..3f93ffa84ba 100644 --- a/lisp/progmodes/ruby-mode.el +++ b/lisp/progmodes/ruby-mode.el @@ -138,18 +138,11 @@ This should only be called after matching against `ruby-here-doc-beg-re'." (defvar ruby-mode-map (let ((map (make-sparse-keymap))) - (define-key map "{" 'ruby-electric-brace) - (define-key map "}" 'ruby-electric-brace) - (define-key map (kbd "M-C-a") 'ruby-beginning-of-defun) - (define-key map (kbd "M-C-e") 'ruby-end-of-defun) (define-key map (kbd "M-C-b") 'ruby-backward-sexp) (define-key map (kbd "M-C-f") 'ruby-forward-sexp) (define-key map (kbd "M-C-p") 'ruby-beginning-of-block) (define-key map (kbd "M-C-n") 'ruby-end-of-block) - (define-key map (kbd "M-C-h") 'ruby-mark-defun) (define-key map (kbd "M-C-q") 'ruby-indent-exp) - (define-key map (kbd "C-M-h") 'backward-kill-word) - (define-key map (kbd "C-j") 'reindent-then-newline-and-indent) (define-key map (kbd "C-c {") 'ruby-toggle-block) map) "Keymap used in Ruby mode.") @@ -840,12 +833,6 @@ and `\\' when preceded by `?'." (+ indent ruby-indent-level) indent)))) -(defun ruby-electric-brace (arg) - "Insert a brace and re-indent the current line." - (interactive "P") - (self-insert-command (prefix-numeric-value arg)) - (ruby-indent-line t)) - ;; TODO: Why isn't one ruby-*-of-defun written in terms of the other? (defun ruby-beginning-of-defun (&optional arg) "Move backward to the beginning of the current top-level defun. @@ -1024,15 +1011,6 @@ With ARG, do it many times. Negative ARG means move forward." ((error))) i))) -(defun ruby-mark-defun () - "Put mark at end of this Ruby function, point at beginning." - (interactive) - (push-mark (point)) - (ruby-end-of-defun) - (push-mark (point) nil t) - (ruby-beginning-of-defun) - (re-search-backward "^\n" (- (point) 1) t)) - (defun ruby-indent-exp (&optional ignored) "Indent each line in the balanced expression following the point." (interactive "*P") @@ -1586,6 +1564,10 @@ The variable `ruby-indent-level' controls the amount of indentation. 'ruby-imenu-create-index) (set (make-local-variable 'add-log-current-defun-function) 'ruby-add-log-current-method) + (set (make-local-variable 'beginning-of-defun-function) + 'ruby-beginning-of-defun) + (set (make-local-variable 'end-of-defun-function) + 'ruby-end-of-defun) (add-hook (cond ((boundp 'before-save-hook) 'before-save-hook) diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el index a6089aabb04..a422462775d 100644 --- a/lisp/progmodes/sh-script.el +++ b/lisp/progmodes/sh-script.el @@ -202,6 +202,11 @@ (require 'comint)) (require 'executable) +(autoload 'comint-completion-at-point "comint") +(autoload 'comint-filename-completion "comint") +(autoload 'shell-command-completion "shell") +(autoload 'shell-environment-variable-completion "shell") + (defvar font-lock-comment-face) (defvar font-lock-set-defaults) (defvar font-lock-string-face) @@ -470,7 +475,6 @@ This is buffer-local in every such buffer.") (define-key map "\C-\M-x" 'sh-execute-region) (define-key map "\C-c\C-x" 'executable-interpret) - (define-key map [remap complete-tag] 'comint-dynamic-complete) (define-key map [remap delete-backward-char] 'backward-delete-char-untabify) (define-key map "\C-c:" 'sh-set-shell) @@ -553,9 +557,9 @@ This is buffer-local in every such buffer.") "Value to use for `skeleton-pair-default-alist' in Shell-Script mode.") (defcustom sh-dynamic-complete-functions - '(shell-dynamic-complete-environment-variable - shell-dynamic-complete-command - comint-dynamic-complete-filename) + '(shell-environment-variable-completion + shell-command-completion + comint-filename-completion) "Functions for doing TAB dynamic completion." :type '(repeat function) :group 'sh-script) @@ -1187,7 +1191,7 @@ This value is used for the `+' and `-' symbols in an indentation variable." :group 'sh-indentation) (put 'sh-basic-offset 'safe-local-variable 'integerp) -(defcustom sh-indent-comment nil +(defcustom sh-indent-comment t "How a comment line is to be indented. nil means leave it as it is; t means indent it as a normal line, aligning it to previous non-blank @@ -1198,6 +1202,7 @@ a number means align to that column, e.g. 0 means first column." (const :tag "Indent as a normal line." t) (integer :menu-tag "Indent to this col (0 means first col)." :tag "Indent to column number.") ) + :version "24.3" :group 'sh-indentation) @@ -1485,6 +1490,7 @@ with your script for an edit-interpret-debug cycle." (set (make-local-variable 'local-abbrev-table) sh-mode-abbrev-table) (set (make-local-variable 'comint-dynamic-complete-functions) sh-dynamic-complete-functions) + (add-hook 'completion-at-point-functions 'comint-completion-at-point nil t) ;; we can't look if previous line ended with `\' (set (make-local-variable 'comint-prompt-regexp) "^[ \t]*") (set (make-local-variable 'imenu-case-fold-search) nil) @@ -4109,20 +4115,6 @@ The document is bounded by `sh-here-document-word'." ;; various other commands -(autoload 'comint-dynamic-complete "comint" - "Dynamically perform completion at point." t) - -(autoload 'shell-dynamic-complete-command "shell" - "Dynamically complete the command at point." t) - -(autoload 'comint-dynamic-complete-filename "comint" - "Dynamically complete the filename at point." t) - -(autoload 'shell-dynamic-complete-environment-variable "shell" - "Dynamically complete the environment variable at point." t) - - - (defun sh-beginning-of-command () ;; FIXME: Redefine using SMIE. "Move point to successive beginnings of commands." diff --git a/lisp/server.el b/lisp/server.el index 6d34df351ca..4fd55bcf6d1 100644 --- a/lisp/server.el +++ b/lisp/server.el @@ -94,7 +94,6 @@ (setq val t) (unless load-in-progress (message "Local sockets unsupported, using TCP sockets"))) - (when val (random t)) (set-default sym val)) :group 'server :type 'boolean diff --git a/lisp/simple.el b/lisp/simple.el index 1080757f7d2..b7a24f4f970 100644 --- a/lisp/simple.el +++ b/lisp/simple.el @@ -365,7 +365,6 @@ Other major modes are defined by comparison with this one." (define-key map ">" 'end-of-buffer) (define-key map "<" 'beginning-of-buffer) (define-key map "g" 'revert-buffer) - (define-key map "z" 'kill-this-buffer) map)) (put 'special-mode 'mode-class 'special) @@ -1887,9 +1886,10 @@ as an argument limits undo to changes within the current region." ;; so, ask the user whether she wants to skip the redo/undo pair. (let ((equiv (gethash pending-undo-list undo-equiv-table))) (or (eq (selected-window) (minibuffer-window)) - (setq message (if undo-in-region - (if equiv "Redo in region!" "Undo in region!") - (if equiv "Redo!" "Undo!")))) + (setq message (format "%s%s!" + (if (or undo-no-redo (not equiv)) + "Undo" "Redo") + (if undo-in-region " in region" "")))) (when (and (consp equiv) undo-no-redo) ;; The equiv entry might point to another redo record if we have done ;; undo-redo-undo-redo-... so skip to the very last equiv. @@ -6961,6 +6961,32 @@ See also `normal-erase-is-backspace'." (defvar vis-mode-saved-buffer-invisibility-spec nil "Saved value of `buffer-invisibility-spec' when Visible mode is on.") +(define-minor-mode read-only-mode + "Change whether the current buffer is read-only. +With prefix argument ARG, make the buffer read-only if ARG is +positive, otherwise make it writable. If buffer is read-only +and `view-read-only' is non-nil, enter view mode. + +Do not call this from a Lisp program unless you really intend to +do the same thing as the \\[toggle-read-only] command, including +possibly enabling or disabling View mode. Also, note that this +command works by setting the variable `buffer-read-only', which +does not affect read-only regions caused by text properties. To +ignore read-only status in a Lisp program (whether due to text +properties or buffer state), bind `inhibit-read-only' temporarily +to a non-nil value." + :variable buffer-read-only + (cond + ((and (not buffer-read-only) view-mode) + (View-exit-and-edit) + (make-local-variable 'view-read-only) + (setq view-read-only t)) ; Must leave view mode. + ((and buffer-read-only view-read-only + ;; If view-mode is already active, `view-mode-enter' is a nop. + (not view-mode) + (not (eq (get major-mode 'mode-class) 'special))) + (view-mode-enter)))) + (define-minor-mode visible-mode "Toggle making all invisible text temporarily visible (Visible mode). With a prefix argument ARG, enable Visible mode if ARG is diff --git a/lisp/skeleton.el b/lisp/skeleton.el index 34d69a74369..b6e1d0a58f2 100644 --- a/lisp/skeleton.el +++ b/lisp/skeleton.el @@ -77,7 +77,7 @@ The variables `v1' and `v2' are still set when calling this.") "Function for transforming a skeleton proxy's aliases' variable value.") (defvaralias 'skeleton-filter 'skeleton-filter-function) -(defvar skeleton-untabify t +(defvar skeleton-untabify nil ; bug#12223 "When non-nil untabifies when deleting backwards with element -ARG.") (defvar skeleton-newline-indent-rigidly nil diff --git a/lisp/term.el b/lisp/term.el index 014adb610b4..d5f35006357 100644 --- a/lisp/term.el +++ b/lisp/term.el @@ -615,28 +615,6 @@ executed once when the buffer is created." :type 'hook :group 'term) -(defvar term-signals-menu - (let ((map (make-sparse-keymap "Signals"))) - (define-key map [eof] - '(menu-item "EOF" term-send-eof - :help "Send an EOF to the current buffer's process")) - (define-key map [kill] - '(menu-item "KILL" term-kill-subjob - :help "Send kill signal to the current subjob")) - (define-key map [quit] - '(menu-item "QUIT" term-quit-subjob - :help "Send quit signal to the current subjob.")) - (define-key map [cont] - '(menu-item "CONT" term-continue-subjob - :help "Send CONT signal to process buffer's process group")) - (define-key map [stop] - '(menu-item "STOP" term-stop-subjob - :help "Stop the current subjob")) - (define-key map [brk] - '(menu-item "BREAK" term-interrupt-subjob - :help "Interrupt the current subjob")) - (cons "Signals" map))) - (defvar term-mode-map (let ((map (make-sparse-keymap))) (define-key map "\ep" 'term-previous-input) @@ -667,69 +645,61 @@ executed once when the buffer is created." (define-key map "\C-c\C-k" 'term-char-mode) (define-key map "\C-c\C-j" 'term-line-mode) (define-key map "\C-c\C-q" 'term-pager-toggle) - - ;; completion: (line mode only) - (let ((completion-menu (make-sparse-keymap "Complete"))) - (define-key map [menu-bar completion] - (cons "Complete" completion-menu)) - (define-key completion-menu [complete-expand] - '("Expand File Name" . term-replace-by-expanded-filename)) - (define-key completion-menu [complete-listing] - '("File Completion Listing" . term-dynamic-list-filename-completions)) - (define-key completion-menu [complete-file] - '("Complete File Name" . term-dynamic-complete-filename)) - (define-key completion-menu [complete] - '("Complete Before Point" . term-dynamic-complete))) - + ;; completion: (line mode only) + (easy-menu-define nil map "Complete menu for Term mode." + '("Complete" + ["Complete Before Point" term-dynamic-complete t] + ["Complete File Name" term-dynamic-complete-filename t] + ["File Completion Listing" term-dynamic-list-filename-completions t] + ["Expand File Name" term-replace-by-expanded-filename t])) ;; Input history: (line mode only) - (let ((inout-menu (make-sparse-keymap "In/Out"))) - (define-key map [menu-bar inout] - (cons "In/Out" inout-menu)) - (define-key inout-menu [kill-output] - '("Kill Current Output Group" . term-kill-output)) - (define-key inout-menu [next-prompt] - '("Forward Output Group" . term-next-prompt)) - (define-key inout-menu [previous-prompt] - '("Backward Output Group" . term-previous-prompt)) - (define-key inout-menu [show-maximum-output] - '("Show Maximum Output" . term-show-maximum-output)) - (define-key inout-menu [show-output] - '("Show Current Output Group" . term-show-output)) - (define-key inout-menu [kill-input] - '("Kill Current Input" . term-kill-input)) - (define-key inout-menu [copy-input] - '("Copy Old Input" . term-copy-old-input)) - (define-key inout-menu [forward-matching-history] - '("Forward Matching Input..." . term-forward-matching-input)) - (define-key inout-menu [backward-matching-history] - '("Backward Matching Input..." . term-backward-matching-input)) - (define-key inout-menu [next-matching-history] - '("Next Matching Input..." . term-next-matching-input)) - (define-key inout-menu [previous-matching-history] - '("Previous Matching Input..." . term-previous-matching-input)) - (define-key inout-menu [next-matching-history-from-input] - '("Next Matching Current Input" . term-next-matching-input-from-input)) - (define-key inout-menu [previous-matching-history-from-input] - '("Previous Matching Current Input" . - term-previous-matching-input-from-input)) - (define-key inout-menu [next-history] - '("Next Input" . term-next-input)) - (define-key inout-menu [previous-history] - '("Previous Input" . term-previous-input)) - (define-key inout-menu [list-history] - '("List Input History" . term-dynamic-list-input-ring)) - (define-key inout-menu [expand-history] - '("Expand History Before Point" . term-replace-by-expanded-history))) - - (define-key map [menu-bar signals] term-signals-menu) - - map)) + (easy-menu-define nil map "In/Out menu for Term mode." + '("In/Out" + ["Expand History Before Point" term-replace-by-expanded-history + term-input-autoexpand] + ["List Input History" term-dynamic-list-input-ring t] + ["Previous Input" term-previous-input t] + ["Next Input" term-next-input t] + ["Previous Matching Current Input" + term-previous-matching-input-from-input t] + ["Next Matching Current Input" term-next-matching-input-from-input t] + ["Previous Matching Input..." term-previous-matching-input t] + ["Next Matching Input..." term-next-matching-input t] + ["Backward Matching Input..." term-backward-matching-input t] + ["Forward Matching Input..." term-forward-matching-input t] + ["Copy Old Input" term-copy-old-input t] + ["Kill Current Input" term-kill-input t] + ["Show Current Output Group" term-show-output t] + ["Show Maximum Output" term-show-maximum-output t] + ["Backward Output Group" term-previous-prompt t] + ["Forward Output Group" term-next-prompt t] + ["Kill Current Output Group" term-kill-output t])) + map) + "Keymap for Term mode.") (defvar term-escape-char nil "Escape character for char sub-mode of term mode. Do not change it directly; use `term-set-escape-char' instead.") -(defvar term-pager-break-map nil) +(defvar term-pager-break-map + (let ((map (make-keymap))) + ;; (dotimes (i 128) + ;; (define-key map (make-string 1 i) 'term-send-raw)) + (define-key map "\e" (lookup-key (current-global-map) "\e")) + (define-key map "\C-x" (lookup-key (current-global-map) "\C-x")) + (define-key map "\C-u" (lookup-key (current-global-map) "\C-u")) + (define-key map " " 'term-pager-page) + (define-key map "\r" 'term-pager-line) + (define-key map "?" 'term-pager-help) + (define-key map "h" 'term-pager-help) + (define-key map "b" 'term-pager-back-page) + (define-key map "\177" 'term-pager-back-line) + (define-key map "q" 'term-pager-discard) + (define-key map "D" 'term-pager-disable) + (define-key map "<" 'term-pager-bob) + (define-key map ">" 'term-pager-eob) + map) + "Keymap used in Term pager mode.") (defvar term-ptyp t "True if communications via pty; false if by pipe. Buffer local. @@ -750,7 +720,6 @@ Buffer local variable.") ; assuming this is Emacs 19.20 or newer. (defvar term-pager-filter t) -(put 'term-replace-by-expanded-history 'menu-enable 'term-input-autoexpand) (put 'term-input-ring 'permanent-local t) (put 'term-input-ring-index 'permanent-local t) (put 'term-input-autoexpand 'permanent-local t) @@ -879,28 +848,6 @@ is buffer-local." :group 'term :type 'integer) -(defvar term-terminal-menu - (if (featurep 'xemacs) - '("Terminal" - [ "Character mode" term-char-mode (term-in-line-mode)] - [ "Line mode" term-line-mode (term-in-char-mode)] - [ "Enable paging" term-pager-toggle (not term-pager-count)] - [ "Disable paging" term-pager-toggle term-pager-count]) - (let ((map (make-sparse-keymap "Terminal"))) - (define-key map [terminal-pager-enable] - '(menu-item "Enable paging" term-fake-pager-enable - :help "Enable paging feature")) - (define-key map [terminal-pager-disable] - '(menu-item "Disable paging" term-fake-pager-disable - :help "Disable paging feature")) - (define-key map [terminal-char-mode] - '(menu-item "Character mode" term-char-mode - :help "Switch to char (raw) sub-mode of term mode")) - (define-key map [terminal-line-mode] - '(menu-item "Line mode" term-line-mode - :help "Switch to line (cooked) sub-mode of term mode")) - (cons "Terminal" map)))) - ;; Set up term-raw-map, etc. (defvar term-raw-map @@ -920,9 +867,7 @@ is buffer-local." (if (featurep 'xemacs) (define-key map [button2] 'term-mouse-paste) - (define-key map [mouse-2] 'term-mouse-paste) - (define-key map [menu-bar terminal] term-terminal-menu) - (define-key map [menu-bar signals] term-signals-menu)) + (define-key map [mouse-2] 'term-mouse-paste)) (define-key map [up] 'term-send-up) (define-key map [down] 'term-send-down) (define-key map [right] 'term-send-right) @@ -941,6 +886,46 @@ is buffer-local." map) "Keyboard map for sending characters directly to the inferior process.") +(easy-menu-define term-terminal-menu + (list term-mode-map term-raw-map term-pager-break-map) + "Terminal menu for Term mode." + '("Terminal" + ["Line mode" term-line-mode :active (term-in-char-mode) + :help "Switch to line (cooked) sub-mode of term mode"] + ["Character mode" term-char-mode :active (term-in-line-mode) + :help "Switch to char (raw) sub-mode of term mode"] + ["Paging" term-pager-toggle :style toggle :selected term-pager-count + :help "Toggle paging feature"])) + +(easy-menu-define term-signals-menu + (list term-mode-map term-raw-map term-pager-break-map) + "Signals menu for Term mode." + '("Signals" + ["BREAK" term-interrupt-subjob :active t + :help "Interrupt the current subjob"] + ["STOP" term-stop-subjob :active t :help "Stop the current subjob"] + ["CONT" term-continue-subjob :active t + :help "Send CONT signal to process buffer's process group"] + ["QUIT" term-quit-subjob :active t + :help "Send quit signal to the current subjob"] + ["KILL" term-kill-subjob :active t + :help "Send kill signal to the current subjob"] + ["EOF" term-send-eof :active t + :help "Send an EOF to the current buffer's process"])) + +(easy-menu-define term-pager-menu term-pager-break-map + "Menu for Term pager mode." + '("More pages?" + ["1 page forwards" term-pager-page t] + ["1 page backwards" term-pager-back-page t] + ["1 line backwards" term-pager-back-line t] + ["1 line forwards" term-pager-line t] + ["Goto to beginning" term-pager-bob t] + ["Goto to end" term-pager-eob t] + ["Discard remaining output" term-pager-discard t] + ["Disable paging" term-pager-toggle t] + ["Help" term-pager-help t])) + (defvar term-raw-escape-map (let ((map (make-sparse-keymap))) (set-keymap-parent map 'Control-X-prefix) @@ -1151,9 +1136,8 @@ Entry to this mode runs the hooks on `term-mode-hook'." (set (make-local-variable 'font-lock-defaults) '(nil t)) - (when (featurep 'xemacs) - (set-buffer-menubar - (append current-menubar (list term-terminal-menu)))) + (easy-menu-add term-terminal-menu) + (easy-menu-add term-signals-menu) (or term-input-ring (setq term-input-ring (make-ring term-input-ring-size))) (term-update-mode-line)) @@ -1291,6 +1275,8 @@ intervention from Emacs, except for the escape character (usually C-c)." (when (term-in-line-mode) (setq term-old-mode-map (current-local-map)) (use-local-map term-raw-map) + (easy-menu-add term-terminal-menu) + (easy-menu-add term-signals-menu) ;; Send existing partial line to inferior (without newline). (let ((pmark (process-mark (get-buffer-process (current-buffer)))) @@ -1315,8 +1301,31 @@ you type \\[term-send-input] which sends the current line to the inferior." (term-update-mode-line))) (defun term-update-mode-line () - (let ((term-mode (if (term-in-char-mode) "char" "line")) - (term-page (when (term-pager-enabled) " page")) + (let ((term-mode + (if (term-in-char-mode) + (propertize "char" + 'help-echo "mouse-1: Switch to line mode" + 'mouse-face 'mode-line-highlight + 'local-map + '(keymap + (mode-line keymap (down-mouse-1 . term-line-mode)))) + (propertize "line" + 'help-echo "mouse-1: Switch to char mode" + 'mouse-face 'mode-line-highlight + 'local-map + '(keymap + (mode-line keymap (down-mouse-1 . term-char-mode)))))) + (term-page + (when (term-pager-enabled) + (concat " " + (propertize + "page" + 'help-echo "mouse-1: Disable paging" + 'mouse-face 'mode-line-highlight + 'local-map + '(keymap + (mode-line keymap (down-mouse-1 . + term-pager-toggle))))))) (serial-item-speed) (serial-item-config) (proc (get-buffer-process (current-buffer)))) @@ -3463,54 +3472,13 @@ The top-most line is line 0." ;; The page is full, so enter "pager" mode, and wait for input. (defun term-process-pager () - (when (not term-pager-break-map) - (let* ((map (make-keymap)) - ;; (i 0) - tmp) - ;; (while (< i 128) - ;; (define-key map (make-string 1 i) 'term-send-raw) - ;; (setq i (1+ i))) - (define-key map "\e" - (lookup-key (current-global-map) "\e")) - (define-key map "\C-x" - (lookup-key (current-global-map) "\C-x")) - (define-key map "\C-u" - (lookup-key (current-global-map) "\C-u")) - (define-key map " " 'term-pager-page) - (define-key map "\r" 'term-pager-line) - (define-key map "?" 'term-pager-help) - (define-key map "h" 'term-pager-help) - (define-key map "b" 'term-pager-back-page) - (define-key map "\177" 'term-pager-back-line) - (define-key map "q" 'term-pager-discard) - (define-key map "D" 'term-pager-disable) - (define-key map "<" 'term-pager-bob) - (define-key map ">" 'term-pager-eob) - - ;; Add menu bar. - (unless (featurep 'xemacs) - (define-key map [menu-bar terminal] term-terminal-menu) - (define-key map [menu-bar signals] term-signals-menu) - (setq tmp (make-sparse-keymap "More pages?")) - (define-key tmp [help] '("Help" . term-pager-help)) - (define-key tmp [disable] - '("Disable paging" . term-fake-pager-disable)) - (define-key tmp [discard] - '("Discard remaining output" . term-pager-discard)) - (define-key tmp [eob] '("Goto to end" . term-pager-eob)) - (define-key tmp [bob] '("Goto to beginning" . term-pager-bob)) - (define-key tmp [line] '("1 line forwards" . term-pager-line)) - (define-key tmp [bline] '("1 line backwards" . term-pager-back-line)) - (define-key tmp [back] '("1 page backwards" . term-pager-back-page)) - (define-key tmp [page] '("1 page forwards" . term-pager-page)) - (define-key map [menu-bar page] (cons "More pages?" tmp)) - ) - - (setq term-pager-break-map map))) ;; (let ((process (get-buffer-process (current-buffer)))) ;; (stop-process process)) (setq term-pager-old-local-map (current-local-map)) (use-local-map term-pager-break-map) + (easy-menu-add term-terminal-menu) + (easy-menu-add term-signals-menu) + (easy-menu-add term-pager-menu) (make-local-variable 'term-old-mode-line-format) (setq term-old-mode-line-format mode-line-format) (setq mode-line-format @@ -3591,14 +3559,6 @@ The top-most line is line 0." (interactive) (if (term-pager-enabled) (term-pager-disable) (term-pager-enable))) -(unless (featurep 'xemacs) - (defalias 'term-fake-pager-enable 'term-pager-toggle) - (defalias 'term-fake-pager-disable 'term-pager-toggle) - (put 'term-char-mode 'menu-enable '(term-in-line-mode)) - (put 'term-line-mode 'menu-enable '(term-in-char-mode)) - (put 'term-fake-pager-enable 'menu-enable '(not term-pager-count)) - (put 'term-fake-pager-disable 'menu-enable 'term-pager-count)) - (defun term-pager-help () "Provide help on commands available in a terminal-emulator **MORE** break." (interactive) diff --git a/lisp/type-break.el b/lisp/type-break.el index f0c81125f0c..8a95508d939 100644 --- a/lisp/type-break.el +++ b/lisp/type-break.el @@ -577,7 +577,6 @@ as per the function `type-break-schedule'." (unless type-break-terse-messages (message "Press any key to resume from typing break.")) - (random t) (let* ((len (length type-break-demo-functions)) (idx (random len)) (fn (nth idx type-break-demo-functions))) diff --git a/lisp/vc/vc-cvs.el b/lisp/vc/vc-cvs.el index 2a672623c01..ae1a3cf92f8 100644 --- a/lisp/vc/vc-cvs.el +++ b/lisp/vc/vc-cvs.el @@ -394,7 +394,7 @@ REV is the revision to check out." (if vc-cvs-use-edit (vc-cvs-command nil 0 file "edit") (set-file-modes file (logior (file-modes file) 128)) - (if (equal file buffer-file-name) (toggle-read-only -1)))) + (if (equal file buffer-file-name) (read-only-mode -1)))) ;; Check out a particular revision (or recreate the file). (vc-file-setprop file 'vc-working-revision nil) (apply 'vc-cvs-command nil 0 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 diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el index ddb9565544d..1ef4faaa008 100644 --- a/lisp/vc/vc.el +++ b/lisp/vc/vc.el @@ -1133,7 +1133,7 @@ For old-style locking-based version control systems, like RCS: (let ((visited (get-file-buffer file))) (when visited (with-current-buffer visited - (toggle-read-only -1)))))) + (read-only-mode -1)))))) ;; Allow user to revert files with no changes (save-excursion (dolist (file files) @@ -1344,7 +1344,7 @@ After check-out, runs the normal hook `vc-checkout-hook'." ;; Maybe the backend is not installed ;-( (when writable (let ((buf (get-file-buffer file))) - (when buf (with-current-buffer buf (toggle-read-only -1))))) + (when buf (with-current-buffer buf (read-only-mode -1))))) (signal (car err) (cdr err)))) `((vc-state . ,(if (or (eq (vc-checkout-model backend (list file)) 'implicit) (not writable)) diff --git a/lisp/window.el b/lisp/window.el index 142e80e1666..f73c85e991b 100644 --- a/lisp/window.el +++ b/lisp/window.el @@ -73,6 +73,108 @@ are not altered by this macro (unless they are altered in BODY)." (when (window-live-p save-selected-window-window) (select-window save-selected-window-window 'norecord)))))) +(defvar temp-buffer-window-setup-hook nil + "Normal hook run by `with-temp-buffer-window' before buffer display. +This hook is run by `with-temp-buffer-window' with the buffer to be +displayed current.") + +(defvar temp-buffer-window-show-hook nil + "Normal hook run by `with-temp-buffer-window' after buffer display. +This hook is run by `with-temp-buffer-window' with the buffer +displayed and current and its window selected.") + +(defun temp-buffer-window-setup (buffer-or-name) + "Set up temporary buffer specified by BUFFER-OR-NAME +Return the buffer." + (let ((old-dir default-directory) + (buffer (get-buffer-create buffer-or-name))) + (with-current-buffer buffer + (kill-all-local-variables) + (setq default-directory old-dir) + (delete-all-overlays) + (setq buffer-read-only nil) + (setq buffer-file-name nil) + (setq buffer-undo-list t) + (let ((inhibit-read-only t) + (inhibit-modification-hooks t)) + (erase-buffer) + (run-hooks 'temp-buffer-window-setup-hook)) + ;; Return the buffer. + buffer))) + +(defun temp-buffer-window-show (&optional buffer action) + "Show temporary buffer BUFFER in a window. +Return the window showing BUFFER. Pass ACTION as action argument +to `display-buffer'." + (let (window frame) + (with-current-buffer buffer + (set-buffer-modified-p nil) + (setq buffer-read-only t) + (goto-char (point-min)) + (when (setq window (display-buffer buffer action)) + (setq frame (window-frame window)) + (unless (eq frame (selected-frame)) + (raise-frame frame)) + (setq minibuffer-scroll-window window) + (set-window-hscroll window 0) + (with-selected-window window + (run-hooks 'temp-buffer-window-show-hook) + (when temp-buffer-resize-mode + (resize-temp-buffer-window window))) + ;; Return the window. + window)))) + +(defmacro with-temp-buffer-window (buffer-or-name action quit-function &rest body) + "Evaluate BODY and display buffer specified by BUFFER-OR-NAME. +BUFFER-OR-NAME must specify either a live buffer or the name of a +buffer. If no buffer with such a name exists, create one. + +Make sure the specified buffer is empty before evaluating BODY. +Do not make that buffer current for BODY. Instead, bind +`standard-output' to that buffer, so that output generated with +`prin1' and similar functions in BODY goes into that buffer. + +After evaluating BODY, mark the specified buffer unmodified and +read-only, and display it in a window via `display-buffer'. Pass +ACTION as action argument to `display-buffer'. Automatically +shrink the window used if `temp-buffer-resize-mode' is enabled. + +Return the value returned by BODY unless QUIT-FUNCTION specifies +a function. In that case, run the function with two arguments - +the window showing the specified buffer and the value returned by +BODY - and return the value returned by that function. + +If the buffer is displayed on a new frame, the window manager may +decide to select that frame. In that case, it's usually a good +strategy if the function specified by QUIT-FUNCTION selects the +window showing the buffer before reading a value from the +minibuffer, for example, when asking a `yes-or-no-p' question. + +This construct is similar to `with-output-to-temp-buffer' but +does neither put the buffer in help mode nor does it call +`temp-buffer-show-function'. It also runs different hooks, +namely `temp-buffer-window-setup-hook' (with the specified buffer +current) and `temp-buffer-window-show-hook' (with the specified +buffer current and the window showing it selected). + +Since this macro calls `display-buffer', the window displaying +the buffer is usually not selected and the specified buffer +usually not made current. QUIT-FUNCTION can override that." + (declare (debug t)) + (let ((buffer (make-symbol "buffer")) + (window (make-symbol "window")) + (value (make-symbol "value"))) + `(let* ((,buffer (temp-buffer-window-setup ,buffer-or-name)) + (standard-output ,buffer) + ,window ,value) + (with-current-buffer ,buffer + (setq ,value (progn ,@body)) + (setq ,window (temp-buffer-window-show ,buffer ,action))) + + (if (functionp ,quit-function) + (funcall ,quit-function ,window ,value) + ,value)))) + ;; The following two functions are like `window-next-sibling' and ;; `window-prev-sibling' but the WINDOW argument is _not_ optional (so ;; they don't substitute the selected window for nil), and they return @@ -271,19 +373,32 @@ windows horizontally arranged within WINDOW." (setq walk-window-tree-window (window-right walk-window-tree-window)))))) -(defun walk-window-tree (fun &optional frame any) +(defun walk-window-tree (fun &optional frame any minibuf) "Run function FUN on each live window of FRAME. FUN must be a function with one argument - a window. FRAME must be a live frame and defaults to the selected one. ANY, if -non-nil means to run FUN on all live and internal windows of +non-nil, means to run FUN on all live and internal windows of FRAME. +Optional argument MINIBUF t means run FUN on FRAME's minibuffer +window even if it isn't active. MINIBUF nil or omitted means run +FUN on FRAME's minibuffer window only if it's active. In both +cases the minibuffer window must be part of FRAME. MINIBUF +neither nil nor t means never run FUN on the minibuffer window. + This function performs a pre-order, depth-first traversal of the window tree. If FUN changes the window tree, the result is unpredictable." - (let ((walk-window-tree-frame (window-normalize-frame frame))) - (walk-window-tree-1 - fun (frame-root-window walk-window-tree-frame) any))) + (setq frame (window-normalize-frame frame)) + (walk-window-tree-1 fun (frame-root-window frame) any) + (when (memq minibuf '(nil t)) + ;; Run FUN on FRAME's minibuffer window if requested. + (let ((minibuffer-window (minibuffer-window frame))) + (when (and (window-live-p minibuffer-window) + (eq (window-frame minibuffer-window) frame) + (or (eq minibuf t) + (minibuffer-window-active-p minibuffer-window))) + (funcall fun minibuffer-window))))) (defun walk-window-subtree (fun &optional window any) "Run function FUN on the subtree of windows rooted at WINDOW. @@ -299,13 +414,19 @@ is unpredictable." (setq window (window-normalize-window window)) (walk-window-tree-1 fun window any t)) -(defun window-with-parameter (parameter &optional value frame any) +(defun window-with-parameter (parameter &optional value frame any minibuf) "Return first window on FRAME with PARAMETER non-nil. FRAME defaults to the selected frame. Optional argument VALUE non-nil means only return a window whose window-parameter value for PARAMETER equals VALUE (comparison is done with `equal'). Optional argument ANY non-nil means consider internal windows -too." +too. + +Optional argument MINIBUF t means consider FRAME's minibuffer +window even if it isn't active. MINIBUF nil or omitted means +consider FRAME's minibuffer window only if it's active. In both +cases the minibuffer window must be part of FRAME. MINIBUF +neither nil nor t means never consider the minibuffer window." (let (this-value) (catch 'found (walk-window-tree @@ -313,7 +434,7 @@ too." (when (and (setq this-value (window-parameter window parameter)) (or (not value) (equal value this-value))) (throw 'found window))) - frame any)))) + frame any minibuf)))) ;;; Atomic windows. (defun window-atom-root (&optional window) @@ -338,6 +459,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 @@ -427,23 +587,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) @@ -459,40 +869,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)) @@ -516,7 +920,7 @@ unless it has no other choice (like when deleting a neighboring window).") (make-variable-buffer-local 'window-size-fixed) -(defun window--size-ignore (window ignore) +(defun window--size-ignore-p (window ignore) "Return non-nil if IGNORE says to ignore size restrictions for WINDOW." (if (window-valid-p ignore) (eq window ignore) ignore)) @@ -559,7 +963,7 @@ means ignore all of the above restrictions for all windows." value) (with-current-buffer (window-buffer window) (cond - ((and (not (window--size-ignore window ignore)) + ((and (not (window--size-ignore-p window ignore)) (window-size-fixed-p window horizontal)) ;; The minimum size of a fixed size window is its size. (window-total-size window horizontal)) @@ -588,7 +992,7 @@ means ignore all of the above restrictions for all windows." (ceiling (or (frame-parameter frame 'scroll-bar-width) 14) (frame-char-width))) (t 0))) - (if (and (not (window--size-ignore window ignore)) + (if (and (not (window--size-ignore-p window ignore)) (numberp window-min-width)) window-min-width 0)))) @@ -598,7 +1002,7 @@ means ignore all of the above restrictions for all windows." (max (+ window-safe-min-height (if header-line-format 1 0) (if mode-line-format 1 0)) - (if (and (not (window--size-ignore window ignore)) + (if (and (not (window--size-ignore-p window ignore)) (numberp window-min-height)) window-min-height 0)))))))) @@ -637,7 +1041,7 @@ ignore all of the above restrictions for all windows." (max (- (window-min-size window horizontal ignore) (window-total-size window horizontal)) delta)) - ((window--size-ignore window ignore) + ((window--size-ignore-p window ignore) delta) ((> delta 0) (if (window-size-fixed-p window horizontal) @@ -719,7 +1123,7 @@ WINDOW can be resized in the desired direction. The function ((eq sub window) (setq skip (eq trail 'before))) (skip) - ((and (not (window--size-ignore window ignore)) + ((and (not (window--size-ignore-p window ignore)) (window-size-fixed-p sub horizontal))) (t ;; We found a non-fixed-size child window. @@ -809,7 +1213,7 @@ at least one other window can be enlarged appropriately." ;; child window is fixed-size. (while sub (when (and (not (eq sub window)) - (not (window--size-ignore sub ignore)) + (not (window--size-ignore-p sub ignore)) (window-size-fixed-p sub horizontal)) (throw 'fixed delta)) (setq sub (window-right sub)))) @@ -849,7 +1253,7 @@ Optional argument NODOWN non-nil means do not check whether WINDOW itself (and its child windows) can be enlarged; check only whether other windows can be shrunk appropriately." (setq window (window-normalize-window window)) - (if (and (not (window--size-ignore window ignore)) + (if (and (not (window--size-ignore-p window ignore)) (not nodown) (window-size-fixed-p window horizontal)) ;; With IGNORE and NOWDON nil return zero if WINDOW has fixed ;; size. @@ -1062,32 +1466,6 @@ windows nor the buffer list." (dolist (walk-windows-window (window-list-1 nil minibuf all-frames)) (funcall fun walk-windows-window)))) -(defun window-point-1 (&optional window) - "Return value of WINDOW's point. -WINDOW can be any live window and defaults to the selected one. - -This function is like `window-point' with one exception: If -WINDOW is selected, it returns the value of `point' of WINDOW's -buffer regardless of whether that buffer is current or not." - (setq window (window-normalize-window window t)) - (if (eq window (selected-window)) - (with-current-buffer (window-buffer window) - (point)) - (window-point window))) - -(defun set-window-point-1 (window pos) - "Set value of WINDOW's point to POS. -WINDOW can be any live window and defaults to the selected one. - -This function is like `set-window-point' with one exception: If -WINDOW is selected, it moves `point' of WINDOW's buffer to POS -regardless of whether that buffer is current or not." - (setq window (window-normalize-window window t)) - (if (eq window (selected-window)) - (with-current-buffer (window-buffer window) - (goto-char pos)) - (set-window-point window pos))) - (defun window-at-side-p (&optional window side) "Return t if WINDOW is at SIDE of its containing frame. WINDOW must be a valid window and defaults to the selected one. @@ -1114,7 +1492,7 @@ SIDE can be any of the symbols `left', `top', `right' or (lambda (window) (when (window-at-side-p window side) (setq windows (cons window windows)))) - frame) + frame nil 'nomini) (nreverse windows))) (defun window--in-direction-2 (window posn &optional horizontal) @@ -1129,12 +1507,25 @@ SIDE can be any of the symbols `left', `top', `right' or (- left posn) (- posn left (window-total-width window)))))) +;; Predecessors to the below have been devised by Julian Assange in +;; change-windows-intuitively.el and Hovav Shacham in windmove.el. +;; Neither of these allow to selectively ignore specific windows +;; (windows whose `no-other-window' parameter is non-nil) as targets of +;; the movement. (defun window-in-direction (direction &optional window ignore) "Return window in DIRECTION as seen from WINDOW. +More precisely, return the nearest window in direction DIRECTION +as seen from the position of `window-point' in window WINDOW. DIRECTION must be one of `above', `below', `left' or `right'. WINDOW must be a live window and defaults to the selected one. -IGNORE non-nil means a window can be returned even if its -`no-other-window' parameter is non-nil." + +Do not return a window whose `no-other-window' parameter is +non-nil. If the nearest window's `no-other-window' parameter is +non-nil, try to find another window in the indicated direction. +If, however, the optional argument IGNORE is non-nil, return that +window even if its `no-other-window' parameter is non-nil. + +Return nil if no suitable window can be found." (setq window (window-normalize-window window t)) (unless (memq direction '(above below left right)) (error "Wrong direction %s" direction)) @@ -1146,7 +1537,7 @@ IGNORE non-nil means a window can be returned even if its (last (+ first (if hor (window-total-width window) (window-total-height window)))) - (posn-cons (nth 6 (posn-at-point (window-point-1 window) window))) + (posn-cons (nth 6 (posn-at-point (window-point window) window))) ;; The column / row value of `posn-at-point' can be nil for the ;; mini-window, guard against that. (posn (if hor @@ -1221,7 +1612,7 @@ IGNORE non-nil means a window can be returned even if its (setq best-edge-2 w-top) (setq best-diff-2 best-diff-2-new) (setq best-2 w))))))) - (window-frame window)) + frame) (or best best-2))) (defun get-window-with-predicate (predicate &optional minibuf all-frames default) @@ -1865,7 +2256,7 @@ preferably only resize windows adjacent to EDGE." ;; Make sure this sibling is left alone when ;; resizing its siblings. (set-window-new-normal sub 'ignore)) - ((or (window--size-ignore sub ignore) + ((or (window--size-ignore-p sub ignore) (not (window-size-fixed-p sub horizontal))) ;; Set this-delta to t to signal that we found a sibling ;; of WINDOW whose size is not fixed. @@ -2387,8 +2778,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 @@ -2399,10 +2789,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) @@ -2453,13 +2842,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)) @@ -2533,13 +2922,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) @@ -2613,7 +3008,7 @@ WINDOW must be a live window and defaults to the selected one." ;; Add an entry for buffer to WINDOW's previous buffers. (with-current-buffer buffer (let ((start (window-start window)) - (point (window-point-1 window))) + (point (window-point window))) (setq entry (cons buffer (if entry @@ -2657,7 +3052,7 @@ before was current this also makes BUFFER the current buffer." ;; Don't force window-start here (even if POINT is nil). (set-window-start window start t)) (when point - (set-window-point-1 window point)))) + (set-window-point window point)))) (defcustom switch-to-visible-buffer t "If non-nil, allow switching to an already visible buffer. @@ -2679,32 +3074,47 @@ found. Optional argument BURY-OR-KILL non-nil means the buffer currently shown in WINDOW is about to be buried or killed and consequently -shall not be switched to in future invocations of this command." +shall not be switched to in future invocations of this command. + +As a special case, if BURY-OR-KILL equals `append', this means to +move the buffer to the end of WINDOW's previous buffers list so a +future invocation of `switch-to-prev-buffer' less likely switches +to it." (interactive) (let* ((window (window-normalize-window window t)) (frame (window-frame window)) (old-buffer (window-buffer window)) ;; Save this since it's destroyed by `set-window-buffer'. (next-buffers (window-next-buffers window)) - entry buffer new-buffer killed-buffers visible) + (pred (frame-parameter frame 'buffer-predicate)) + entry new-buffer killed-buffers visible) + (when (window-minibuffer-p window) + ;; Don't switch in minibuffer window. + (unless (setq window (minibuffer-selected-window)) + (error "Window %s is a minibuffer window" window))) + (when (window-dedicated-p window) + ;; Don't switch in dedicated window. (error "Window %s is dedicated to buffer %s" window old-buffer)) (catch 'found ;; Scan WINDOW's previous buffers first, skipping entries of next ;; buffers. (dolist (entry (window-prev-buffers window)) - (when (and (setq buffer (car entry)) - (or (buffer-live-p buffer) + (when (and (setq new-buffer (car entry)) + (or (buffer-live-p new-buffer) (not (setq killed-buffers - (cons buffer killed-buffers)))) - (not (eq buffer old-buffer)) - (or bury-or-kill (not (memq buffer next-buffers)))) + (cons new-buffer killed-buffers)))) + (not (eq new-buffer old-buffer)) + (or (null pred) (funcall pred new-buffer)) + ;; When BURY-OR-KILL is nil, avoid switching to a + ;; buffer in WINDOW's next buffers list. + (or bury-or-kill (not (memq new-buffer next-buffers)))) (if (and (not switch-to-visible-buffer) - (get-buffer-window buffer frame)) - ;; Try to avoid showing a buffer visible in some other window. - (setq visible buffer) - (setq new-buffer buffer) + (get-buffer-window new-buffer frame)) + ;; Try to avoid showing a buffer visible in some other + ;; window. + (setq visible new-buffer) (set-window-buffer-start-and-point window new-buffer (nth 1 entry) (nth 2 entry)) (throw 'found t)))) @@ -2719,6 +3129,7 @@ shall not be switched to in future invocations of this command." (nreverse (buffer-list frame)))) (when (and (buffer-live-p buffer) (not (eq buffer old-buffer)) + (or (null pred) (funcall pred buffer)) (not (eq (aref (buffer-name buffer) 0) ?\s)) (or bury-or-kill (not (memq buffer next-buffers)))) (if (get-buffer-window buffer frame) @@ -2738,6 +3149,7 @@ shall not be switched to in future invocations of this command." (not (setq killed-buffers (cons buffer killed-buffers)))) (not (eq buffer old-buffer)) + (or (null pred) (funcall pred buffer)) (setq entry (assq buffer (window-prev-buffers window)))) (setq new-buffer buffer) (set-window-buffer-start-and-point @@ -2750,12 +3162,20 @@ shall not be switched to in future invocations of this command." (set-window-buffer-start-and-point window new-buffer))) (if bury-or-kill - ;; Remove `old-buffer' from WINDOW's previous and (restored list - ;; of) next buffers. - (progn + (let ((entry (and (eq bury-or-kill 'append) + (assq old-buffer (window-prev-buffers window))))) + ;; Remove `old-buffer' from WINDOW's previous and (restored list + ;; of) next buffers. (set-window-prev-buffers window (assq-delete-all old-buffer (window-prev-buffers window))) - (set-window-next-buffers window (delq old-buffer next-buffers))) + (set-window-next-buffers window (delq old-buffer next-buffers)) + (when entry + ;; Append old-buffer's entry to list of WINDOW's previous + ;; buffers so it's less likely to get switched to soon but + ;; `display-buffer-in-previous-window' can nevertheless find + ;; it. + (set-window-prev-buffers + window (append (window-prev-buffers window) (list entry))))) ;; Move `old-buffer' to head of WINDOW's restored list of next ;; buffers. (set-window-next-buffers @@ -2782,8 +3202,15 @@ found." (frame (window-frame window)) (old-buffer (window-buffer window)) (next-buffers (window-next-buffers window)) - buffer new-buffer entry killed-buffers visible) + (pred (frame-parameter frame 'buffer-predicate)) + new-buffer entry killed-buffers visible) + (when (window-minibuffer-p window) + ;; Don't switch in minibuffer window. + (unless (setq window (minibuffer-selected-window)) + (error "Window %s is a minibuffer window" window))) + (when (window-dedicated-p window) + ;; Don't switch in dedicated window. (error "Window %s is dedicated to buffer %s" window old-buffer)) (catch 'found @@ -2793,6 +3220,7 @@ found." (not (setq killed-buffers (cons buffer killed-buffers)))) (not (eq buffer old-buffer)) + (or (null pred) (funcall pred buffer)) (setq entry (assq buffer (window-prev-buffers window)))) (setq new-buffer buffer) (set-window-buffer-start-and-point @@ -2801,7 +3229,9 @@ found." ;; Scan the buffer list of WINDOW's frame next, skipping previous ;; buffers entries. (dolist (buffer (buffer-list frame)) - (when (and (buffer-live-p buffer) (not (eq buffer old-buffer)) + (when (and (buffer-live-p buffer) + (not (eq buffer old-buffer)) + (or (null pred) (funcall pred buffer)) (not (eq (aref (buffer-name buffer) 0) ?\s)) (not (assq buffer (window-prev-buffers window)))) (if (get-buffer-window buffer frame) @@ -2813,17 +3243,17 @@ found." ;; Scan WINDOW's reverted previous buffers last (must not use ;; nreverse here!) (dolist (entry (reverse (window-prev-buffers window))) - (when (and (setq buffer (car entry)) - (or (buffer-live-p buffer) + (when (and (setq new-buffer (car entry)) + (or (buffer-live-p new-buffer) (not (setq killed-buffers - (cons buffer killed-buffers)))) - (not (eq buffer old-buffer))) + (cons new-buffer killed-buffers)))) + (not (eq new-buffer old-buffer)) + (or (null pred) (funcall pred new-buffer))) (if (and (not switch-to-visible-buffer) - (get-buffer-window buffer frame)) + (get-buffer-window new-buffer frame)) ;; Try to avoid showing a buffer visible in some other window. (unless visible - (setq visible buffer)) - (setq new-buffer buffer) + (setq visible new-buffer)) (set-window-buffer-start-and-point window new-buffer (nth 1 entry) (nth 2 entry)) (throw 'found t)))) @@ -3050,18 +3480,35 @@ all window-local buffer lists." ;; Unrecord BUFFER in WINDOW. (unrecord-window-buffer window buffer))))) -(defun quit-window (&optional kill window) - "Quit WINDOW and bury its buffer. +(defun quit-restore-window (&optional window bury-or-kill) + "Quit WINDOW and deal with its buffer. WINDOW must be a live window and defaults to the selected one. -With prefix argument KILL non-nil, kill the buffer instead of -burying it. According to information stored in WINDOW's `quit-restore' window parameter either (1) delete WINDOW and its frame, (2) delete WINDOW, (3) restore the buffer previously displayed in WINDOW, or (4) make WINDOW display some other buffer than the present -one. If non-nil, reset `quit-restore' parameter to nil." - (interactive "P") +one. If non-nil, reset `quit-restore' parameter to nil. + +Optional second argument BURY-OR-KILL tells how to proceed with +the buffer of WINDOW. The following values are handled: + +`nil' means to not handle the buffer in a particular way. This + means that if WINDOW is not deleted by this function, invoking + `switch-to-prev-buffer' will usually show the buffer again. + +`append' means that if WINDOW is not deleted, move its buffer to + the end of WINDOW's previous buffers so it's less likely that a + future invocation of `switch-to-prev-buffer' will switch to it. + Also, move the buffer to the end of the frame's buffer list. + +`bury' means that if WINDOW is not deleted, remove its buffer + from WINDOW'S list of previous buffers. Also, move the buffer + to the end of the frame's buffer list. This value provides the + most reliable remedy to not have `switch-to-prev-buffer' switch + to this buffer again without killing the buffer. + +`kill' means to kill WINDOW's buffer." (setq window (window-normalize-window window t)) (let* ((buffer (window-buffer window)) (quit-restore (window-parameter window 'quit-restore)) @@ -3073,13 +3520,13 @@ one. If non-nil, reset `quit-restore' parameter to nil." (not (eq (setq prev-buffer (cadr prev-buffers)) buffer)))) prev-buffer))) - quad resize) + quad entry) (cond ((and (not prev-buffer) (memq (nth 1 quit-restore) '(window frame)) (eq (nth 3 quit-restore) buffer) ;; Delete WINDOW if possible. - (window--delete window nil kill)) + (window--delete window nil (eq bury-or-kill 'kill))) ;; If the previously selected window is still alive, select it. (when (window-live-p (nth 2 quit-restore)) (select-window (nth 2 quit-restore)))) @@ -3087,21 +3534,32 @@ one. If non-nil, reset `quit-restore' parameter to nil." (buffer-live-p (car quad)) (eq (nth 3 quit-restore) buffer)) ;; Show another buffer stored in quit-restore parameter. - (setq resize (and (integerp (nth 3 quad)) - (/= (nth 3 quad) (window-total-size window)))) - (set-window-dedicated-p window nil) - (when resize + (when (and (integerp (nth 3 quad)) + (/= (nth 3 quad) (window-total-size window))) ;; Try to resize WINDOW to its old height but don't signal an ;; error. (condition-case nil (window-resize window (- (nth 3 quad) (window-total-size window))) (error nil))) + (set-window-dedicated-p window nil) ;; Restore WINDOW's previous buffer, start and point position. (set-window-buffer-start-and-point window (nth 0 quad) (nth 1 quad) (nth 2 quad)) - ;; Unrecord WINDOW's buffer here (Bug#9937) to make sure it's not - ;; re-recorded by `set-window-buffer'. - (unrecord-window-buffer window buffer) + ;; Deal with the buffer we just removed from WINDOW. + (setq entry (and (eq bury-or-kill 'append) + (assq buffer (window-prev-buffers window)))) + (when bury-or-kill + ;; Remove buffer from WINDOW's previous and next buffers. + (set-window-prev-buffers + window (assq-delete-all buffer (window-prev-buffers window))) + (set-window-next-buffers + window (delq buffer (window-next-buffers window)))) + (when entry + ;; Append old buffer's entry to list of WINDOW's previous + ;; buffers so it's less likely to get switched to soon but + ;; `display-buffer-in-previous-window' can nevertheless find it. + (set-window-prev-buffers + window (append (window-prev-buffers window) (list entry)))) ;; Reset the quit-restore parameter. (set-window-parameter window 'quit-restore nil) ;; Select old window. @@ -3113,12 +3571,29 @@ one. If non-nil, reset `quit-restore' parameter to nil." (set-window-parameter window 'quit-restore nil) ;; Make sure that WINDOW is no more dedicated. (set-window-dedicated-p window nil) - (switch-to-prev-buffer window 'bury-or-kill))) + (switch-to-prev-buffer window bury-or-kill))) - ;; Kill WINDOW's old-buffer if requested - (if kill - (kill-buffer buffer) - (bury-buffer-internal buffer)))) + ;; Deal with the buffer. + (cond + ((not (buffer-live-p buffer))) + ((eq bury-or-kill 'kill) + (kill-buffer buffer)) + (bury-or-kill + (bury-buffer-internal buffer))))) + +(defun quit-window (&optional kill window) + "Quit WINDOW and bury its buffer. +WINDOW must be a live window and defaults to the selected one. +With prefix argument KILL non-nil, kill the buffer instead of +burying it. + +According to information stored in WINDOW's `quit-restore' window +parameter either (1) delete WINDOW and its frame, (2) delete +WINDOW, (3) restore the buffer previously displayed in WINDOW, +or (4) make WINDOW display some other buffer than the present +one. If non-nil, reset `quit-restore' parameter to nil." + (interactive "P") + (quit-restore-window window (if kill 'kill 'bury))) (defun quit-windows-on (&optional buffer-or-name kill frame) "Quit all windows showing BUFFER-OR-NAME. @@ -3198,14 +3673,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) @@ -3223,20 +3700,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 @@ -3246,7 +3735,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. @@ -3357,10 +3849,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) @@ -3393,7 +3896,7 @@ Otherwise, the window starts are chosen so as to minimize the amount of redisplay; this is convenient on slow terminals." (interactive "P") (let ((old-window (selected-window)) - (old-point (window-point-1)) + (old-point (window-point)) (size (and size (prefix-numeric-value size))) moved-by-window-height moved new-window bottom) (when (and size (< size 0) (< (- size) window-min-height)) @@ -3418,7 +3921,7 @@ amount of redisplay; this is convenient on slow terminals." (setq bottom (point))) (and moved-by-window-height (<= bottom (point)) - (set-window-point-1 old-window (1- bottom))) + (set-window-point old-window (1- bottom))) (and moved-by-window-height (<= (window-start new-window) old-point) (set-window-point new-window old-point) @@ -3727,7 +4230,7 @@ specific buffers." `((parameters . ,list)))) ,@(when buffer ;; All buffer related things go in here. - (let ((point (window-point-1 window)) + (let ((point (window-point window)) (start (window-start window))) `((buffer ,(buffer-name buffer) @@ -4020,7 +4523,7 @@ element is BUFFER." (list 'other ;; A quadruple of WINDOW's buffer, start, point and height. (list (window-buffer window) (window-start window) - (window-point-1 window) (window-total-size window)) + (window-point window) (window-total-size window)) (selected-window) buffer)))) ((eq type 'window) ;; WINDOW has been created on an existing frame. @@ -4048,12 +4551,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. @@ -4140,8 +4642,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 @@ -4208,6 +4709,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. @@ -4249,6 +4752,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. @@ -4294,6 +4798,9 @@ and (cdr ARGS) as second." (make-frame (append args special-display-frame-alist)))) (window (frame-selected-window frame))) (display-buffer-record-window 'frame window buffer) + (unless (eq buffer (window-buffer window)) + (set-window-buffer window buffer) + (set-window-prev-buffers window nil)) (set-window-dedicated-p window t) window))))) @@ -4315,6 +4822,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. @@ -4388,6 +4896,11 @@ that frame." :version "21.1" :group 'windows) +(make-obsolete-variable + 'display-buffer-reuse-frames + "use a `reusable-frames' alist entry in `display-buffer-alist'." + "24.3") + (defcustom pop-up-windows t "Non-nil means `display-buffer' should make a new window." :type 'boolean @@ -4590,23 +5103,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. @@ -4615,9 +5124,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)) @@ -4791,6 +5300,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 @@ -4933,9 +5446,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))) @@ -4988,6 +5507,20 @@ again with `display-buffer-pop-up-window'." (and pop-up-windows (display-buffer-pop-up-window buffer alist)))) +(defun display-buffer-below-selected (buffer _alist) + "Try displaying BUFFER in a window below the selected window. +This either splits the selected window or reuses the window below +the selected one." + (let (window) + (or (and (not (frame-parameter nil 'unsplittable)) + (setq window (window--try-to-split-window (selected-window))) + (window--display-buffer + buffer window 'window display-buffer-mark-dedicated)) + (and (setq window (window-in-direction 'below)) + (not (window-dedicated-p window)) + (window--display-buffer + buffer window 'reuse display-buffer-mark-dedicated))))) + (defun display-buffer-use-some-window (buffer alist) "Display BUFFER in an existing window. Search for a usable window, set that window to the buffer, and @@ -5013,8 +5546,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))))))) @@ -5281,7 +5815,7 @@ WINDOW must be a live window and defaults to the selected one." window)))) ;;; Resizing buffers to fit their contents exactly. -(defun fit-window-to-buffer (&optional window max-height min-height override) +(defun fit-window-to-buffer (&optional window max-height min-height) "Adjust height of WINDOW to display its buffer's contents exactly. WINDOW must be a live window and defaults to the selected one. @@ -5292,10 +5826,6 @@ defaults to `window-min-height'. Both MAX-HEIGHT and MIN-HEIGHT are specified in lines and include the mode line and header line, if any. -Optional argument OVERRIDE non-nil means override restrictions -imposed by `window-min-height' and `window-min-width' on the size -of WINDOW. - Return the number of lines by which WINDOW was enlarged or shrunk. If an error occurs during resizing, return nil but don't signal an error. @@ -5304,28 +5834,27 @@ Note that even if this function makes WINDOW large enough to show _all_ lines of its buffer you might not see the first lines when WINDOW was scrolled." (interactive) - ;; Do all the work in WINDOW and its buffer and restore the selected - ;; window and the current buffer when we're done. (setq window (window-normalize-window window t)) ;; Can't resize a full height or fixed-size window. (unless (or (window-size-fixed-p window) (window-full-height-p window)) - ;; `with-selected-window' should orderly restore the current buffer. (with-selected-window window - ;; We are in WINDOW's buffer now. - (let* (;; Adjust MIN-HEIGHT. + (let* ((height (window-total-size)) (min-height - (if override - (window-min-size window nil window) - (max (or min-height window-min-height) - window-safe-min-height))) - (max-window-height - (window-total-size (frame-root-window window))) - ;; Adjust MAX-HEIGHT. + ;; Adjust MIN-HEIGHT. + (if (numberp min-height) + ;; Can't get smaller than `window-safe-min-height'. + (max min-height window-safe-min-height) + ;; Preserve header and mode line if present. + (window-min-size nil nil t))) (max-height - (if (or override (not max-height)) - max-window-height - (min max-height max-window-height))) + ;; Adjust MAX-HEIGHT. + (if (numberp max-height) + ;; Can't get larger than height of frame. + (min max-height + (window-total-size (frame-root-window window))) + ;, Don't delete other windows. + (+ height (window-max-delta nil nil window)))) ;; Make `desired-height' the height necessary to show ;; all of WINDOW's buffer, constrained by MIN-HEIGHT ;; and MAX-HEIGHT. @@ -5350,7 +5879,6 @@ WINDOW was scrolled." (window-max-delta window nil window)) (max desired-delta (- (window-min-delta window nil window)))))) - ;; This `condition-case' shouldn't be necessary, but who knows? (condition-case nil (if (zerop delta) ;; Return zero if DELTA became zero in the process. diff --git a/lisp/woman.el b/lisp/woman.el index 5933d593aa5..c8cc7ea6766 100644 --- a/lisp/woman.el +++ b/lisp/woman.el @@ -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 index 00000000000..f1f3cd91638 --- /dev/null +++ b/m4/execinfo.m4 @@ -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"]) +]) diff --git a/m4/extern-inline.m4 b/m4/extern-inline.m4 index 187a33599a3..12f24fab95f 100644 --- a/m4/extern-inline.m4 +++ b/m4/extern-inline.m4 @@ -21,20 +21,34 @@ AC_DEFUN([gl_EXTERN_INLINE], #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]) diff --git a/m4/gnulib-comp.m4 b/m4/gnulib-comp.m4 index 12c8ca8734b..0d73faee8d1 100644 --- a/m4/gnulib-comp.m4 +++ b/m4/gnulib-comp.m4 @@ -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 diff --git a/m4/manywarnings.m4 b/m4/manywarnings.m4 index 864fc851982..2760efb3f27 100644 --- a/m4/manywarnings.m4 +++ b/m4/manywarnings.m4 @@ -81,95 +81,118 @@ AC_DEFUN([gl_MANYWARN_ALL_GCC], gl_manywarn_set= for gl_manywarn_item in \ - -Wall \ -W \ - -Wformat-y2k \ - -Wformat-nonliteral \ - -Wformat-security \ - -Winit-self \ - -Wmissing-include-dirs \ - -Wswitch-default \ - -Wswitch-enum \ - -Wunused \ - -Wunknown-pragmas \ - -Wstrict-aliasing \ - -Wstrict-overflow \ - -Wsystem-headers \ - -Wfloat-equal \ - -Wtraditional \ - -Wtraditional-conversion \ - -Wdeclaration-after-statement \ - -Wundef \ - -Wshadow \ - -Wunsafe-loop-optimizations \ - -Wpointer-arith \ + -Wabi \ + -Waddress \ + -Wall \ + -Warray-bounds \ + -Wattributes \ -Wbad-function-cast \ - -Wc++-compat \ - -Wcast-qual \ - -Wcast-align \ - -Wwrite-strings \ - -Wconversion \ - -Wsign-conversion \ - -Wlogical-op \ - -Waggregate-return \ - -Wstrict-prototypes \ - -Wold-style-definition \ - -Wmissing-prototypes \ - -Wmissing-declarations \ - -Wmissing-noreturn \ - -Wmissing-format-attribute \ - -Wpacked \ - -Wpadded \ - -Wredundant-decls \ - -Wnested-externs \ - -Wunreachable-code \ - -Winline \ - -Winvalid-pch \ - -Wlong-long \ - -Wvla \ - -Wvolatile-register-var \ - -Wdisabled-optimization \ - -Wstack-protector \ - -Woverlength-strings \ -Wbuiltin-macro-redefined \ - -Wmudflap \ - -Wpacked-bitfield-compat \ - -Wsync-nand \ - ; do - gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item" - done - # The following are not documented in the manual but are included in - # output from gcc --help=warnings. - for gl_manywarn_item in \ - -Wattributes \ + -Wcast-align \ + -Wchar-subscripts \ + -Wclobbered \ + -Wcomment \ + -Wcomments \ -Wcoverage-mismatch \ - -Wunused-macros \ - ; do - gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item" - done - # More warnings from gcc 4.6.2 --help=warnings. - for gl_manywarn_item in \ - -Wabi \ -Wcpp \ -Wdeprecated \ -Wdeprecated-declarations \ + -Wdisabled-optimization \ -Wdiv-by-zero \ -Wdouble-promotion \ + -Wempty-body \ -Wendif-labels \ + -Wenum-compare \ -Wextra \ -Wformat-contains-nul \ -Wformat-extra-args \ + -Wformat-nonliteral \ + -Wformat-security \ + -Wformat-y2k \ -Wformat-zero-length \ -Wformat=2 \ + -Wfree-nonheap-object \ + -Wignored-qualifiers \ + -Wimplicit \ + -Wimplicit-function-declaration \ + -Wimplicit-int \ + -Winit-self \ + -Winline \ + -Wint-to-pointer-cast \ + -Winvalid-memory-model \ + -Winvalid-pch \ + -Wjump-misses-init \ + -Wlogical-op \ + -Wmain \ + -Wmaybe-uninitialized \ + -Wmissing-braces \ + -Wmissing-declarations \ + -Wmissing-field-initializers \ + -Wmissing-format-attribute \ + -Wmissing-include-dirs \ + -Wmissing-noreturn \ + -Wmissing-parameter-type \ + -Wmissing-prototypes \ + -Wmudflap \ -Wmultichar \ + -Wnarrowing \ + -Wnested-externs \ + -Wnonnull \ -Wnormalized=nfc \ + -Wold-style-declaration \ + -Wold-style-definition \ -Woverflow \ + -Woverlength-strings \ + -Woverride-init \ + -Wpacked \ + -Wpacked-bitfield-compat \ + -Wparentheses \ + -Wpointer-arith \ + -Wpointer-sign \ -Wpointer-to-int-cast \ -Wpragmas \ + -Wreturn-type \ + -Wsequence-point \ + -Wshadow \ + -Wsizeof-pointer-memaccess \ + -Wstack-protector \ + -Wstrict-aliasing \ + -Wstrict-overflow \ + -Wstrict-prototypes \ -Wsuggest-attribute=const \ + -Wsuggest-attribute=format \ -Wsuggest-attribute=noreturn \ -Wsuggest-attribute=pure \ + -Wswitch \ + -Wswitch-default \ + -Wsync-nand \ + -Wsystem-headers \ -Wtrampolines \ + -Wtrigraphs \ + -Wtype-limits \ + -Wuninitialized \ + -Wunknown-pragmas \ + -Wunreachable-code \ + -Wunsafe-loop-optimizations \ + -Wunused \ + -Wunused-but-set-parameter \ + -Wunused-but-set-variable \ + -Wunused-function \ + -Wunused-label \ + -Wunused-local-typedefs \ + -Wunused-macros \ + -Wunused-parameter \ + -Wunused-result \ + -Wunused-value \ + -Wunused-variable \ + -Wvarargs \ + -Wvariadic-macros \ + -Wvector-operation-performance \ + -Wvla \ + -Wvolatile-register-var \ + -Wwrite-strings \ + \ ; do gl_manywarn_set="$gl_manywarn_set $gl_manywarn_item" done diff --git a/nt/ChangeLog b/nt/ChangeLog index 12273ec7853..4ceb74ed0b5 100644 --- a/nt/ChangeLog +++ b/nt/ChangeLog @@ -1,3 +1,16 @@ +2012-09-02 Juanma Barranquero <lekktu@gmail.com> + + * config.nt: Sync with autogen/config.in. + (HAVE_EXECINFO_H, TERM_HEADER): New macros. + +2012-09-01 Daniel Colascione <dancol@dancol.org> + + * inc/ms-w32.h (TERM_HEADER): Add for refactoring + +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. diff --git a/nt/config.nt b/nt/config.nt index 5181e09e64e..7658275f2d6 100644 --- a/nt/config.nt +++ b/nt/config.nt @@ -364,6 +364,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. */ +#define HAVE_EXECINFO_H 1 + /* Define to 1 if you have the <fcntl.h> header file. */ #undef HAVE_FCNTL_H @@ -1352,6 +1355,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ /* Define to 1 if you use terminfo instead of termcap. */ #undef TERMINFO +/* Define to the header for the built-in window system. */ +#undef TERM_HEADER + /* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */ #define TIME_WITH_SYS_TIME 1 @@ -1563,20 +1569,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 diff --git a/nt/inc/ms-w32.h b/nt/inc/ms-w32.h index 022b168c0b8..8945fb7be4d 100644 --- a/nt/inc/ms-w32.h +++ b/nt/inc/ms-w32.h @@ -424,4 +424,7 @@ extern void _DebPrint (const char *fmt, ...); #define DebPrint(stuff) #endif +#define TERM_HEADER "w32term.h" + + /* ============================================================ */ diff --git a/src/.gdbinit b/src/.gdbinit index b703842f4cf..de980c6345f 100644 --- a/src/.gdbinit +++ b/src/.gdbinit @@ -18,9 +18,9 @@ # Boston, MA 02110-1301, USA. # Force loading of symbols, enough to give us VALBITS etc. -set main +set $dummy = main + 8 # With some compilers, we need this to give us struct Lisp_Symbol etc.: -set Fmake_symbol +set $dummy = Fmake_symbol + 8 # Find lwlib source files too. dir ../lwlib diff --git a/src/ChangeLog b/src/ChangeLog index 1e25015da20..a8d6a4026a0 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,738 @@ +2012-09-04 Paul Eggert <eggert@cs.ucla.edu> + + Be more systematic about _setjmp vs setjmp. + * alloc.c (test_setjmp, mark_stack): + * image.c (PNG_LONGJMP) [PNG_LIBPNG_VER < 10500]: + (PNG_JMPBUF) [! (PNG_LIBPNG_VER < 10500)]: + (png_load, my_error_exit, jpeg_load): + * process.c (send_process_trap, send_process): + Uniformly prefer _setjmp and _longjmp to setjmp and longjmp. + The underscored versions are up to 30x faster on some hosts. + Formerly, the code used setjmp+longjmp sometimes and + _setjmp+_longjmp at other times, with no particular reason to + prefer setjmp+longjmp. + +2012-09-03 Paul Eggert <eggert@cs.ucla.edu> + + Fix minor problem found by static checking. + * buffer.c (Fdelete_all_overlays): Return nil. + +2012-09-03 Martin Rudalics <rudalics@gmx.at> + + * buffer.c (Fdelete_all_overlays): New function. + +2012-09-03 Chong Yidong <cyd@gnu.org> + + * gtkutil.c: Add extern decl for Qxft. + +2012-09-02 Paul Eggert <eggert@cs.ucla.edu> + + * emacs.c, eval.c: Use bool for boolean. + * emacs.c (initialized, inhibit_window_system, running_asynch_code): + (malloc_using_checking) [DOUG_LEA_MALLOC]: + (display_arg) [HAVE_X_WINDOWS || HAVE_NS]: + (noninteractive, no_site_lisp, fatal_error_in_progress, argmatch) + (main, decode_env_path, Fdaemon_initialized): + * eval.c (call_debugger, Finteractive_p, interactive_p): + (unwind_to_catch, Fsignal, wants_debugger, skip_debugger) + (maybe_call_debugger, Fbacktrace): + * process.c (read_process_output, exec_sentinel): + Use bool for booleans. + * emacs.c (shut_down_emacs): Omit unused boolean argument NO_X. + All callers changed. + * eval.c (interactive_p): Omit always-true boolean argument + EXCLUDE_SUBRS_P. All callers changed. + * dispextern.h, lisp.h: Reflect above API changes. + * firstfile.c (dummy): Use the address of 'main', whose signature + won't change, instead of the address of 'initialize', whose + signature just changed from int to bool. + * lisp.h (fatal_error_in_progress): New decl of boolean, moved here ... + * msdos.c (fatal_error_in_progress): ... from here. + * xdisp.c (redisplaying_p): Now a boolean. Set it to 1 instead + of incrementing it. + (redisplay_internal, unwind_redisplay): Simply clear + REDISPLAYING_P when unwinding, instead of saving its previous, + always-false value and then restoring it. + + Clean up some extern decls. + Mostly, this hoists extern decls out of .c files and into .h files. + That way, we're more likely to catch errors if the interfaces change. + * alloc.c [USE_GTK]: Include "gtkutil.h" so that we need not + declare xg_mark_data. + * dispextern.h (x_frame_parm_handlers): + * font.h (Qxft): + * lisp.h (Qlexical_binding, Qinternal_interpreter_environment) + (Qextra_light, Qlight, Qsemi_light, Qsemi_bold, Qbold, Qextra_bold) + (Qultra_bold, Qoblique, Qitalic): + Move extern decl here from .c file. + * alloc.c (xg_mark_data) [USE_GTK]: + * doc.c (Qclosure): + * eval.c (Qlexical_binding): + * fns.c (time) [!HAVE_UNISTD_H]: + * gtkutil.c (Qxft, Qnormal, Qextra_light, Qlight, Qsemi_light) + (Qsemi_bold, Qbold, Qextra_bold, Qultra_bold, Qoblique, Qitalic): + * image.c (Vlibrary_cache, QCloaded_from) [HAVE_NTGUI]: + * lread.c (Qinternal_interpreter_environment): + * minibuf.c (Qbuffer): + * process.c (QCfamily, QCfilter): + * widget.c (free_frame_faces): + * xfaces.c (free_frame_menubar) [USE_X_TOOLKIT]: + * xfont.c (x_clear_errors): + * xterm.c (x_frame_parm_handlers): + Remove now-redundant extern decls. + * keyboard.c, keyboard.h (ignore_mouse_drag_p) [USE_GTK || HAVE_NS]: + * xfaces.c (Qultra_light, Qreverse_oblique, Qreverse_italic): + Now static. + * xfaces.c: Remove unnecessary static decls. + * xterm.c (updating_frame): Remove decl of nonexistent object. + + * Makefile.in (gl-stamp): Don't scan $(SOME_MACHINE_OBJECTS) + when building globals.h, as the objects that are not built on + this host are not needed to compile C files on this host. + +2012-09-02 Jan Djärv <jan.h.d@swipnet.se> + + * gtkutil.h: Remove prototype for x_wm_set_size_hint. + + * frame.h: Add missing prototype for x_wm_set_size_hint. + +2012-09-02 Paul Eggert <eggert@cs.ucla.edu> + + * doc.c, editfns.c, insdel.c, intervals.c: Use bool for boolean. + * doc.c (read_bytecode_char, get_doc_string, reread_doc_file) + (Fdocumentation, Fdocumentation_property, Fsnarf_documentation) + (Fsubstitute_command_keys): + * editfns.c (region_limit, find_field, Fconstrain_to_field) + (save_excursion_save, save_excursion_restore) + (disassemble_lisp_time, decode_time_components, emacs_nmemftime) + (format_time_string, general_insert_function) + (make_buffer_string, make_buffer_string_both) + (Fsubst_char_in_region, Ftranslate_region_internal, Fformat): + * insdel.c (check_markers, gap_left, adjust_markers_for_insert) + (copy_text, insert_1, insert_1_both, insert_from_string) + (insert_from_string_before_markers, insert_from_string_1) + (insert_from_buffer, insert_from_buffer_1, replace_range) + (replace_range_2, del_range_1, del_range_byte, del_range_both) + (del_range_2, modify_region): + * intervals.c (intervals_equal, balance_possible_root_interval) + (adjust_intervals_for_insertion, merge_properties_sticky) + (graft_intervals_into_buffer, lookup_char_property) + (adjust_for_invis_intang, set_point_both) + (get_property_and_range, compare_string_intervals) + (set_intervals_multibyte_1, set_intervals_multibyte): + * keyboard.c (decode_timer): + Use bool for boolean. + * intervals.h, lisp.h, systime.h: Reflect above API changes. + * editfns.c (struct info): Use 1-bit unsigned bitfields for booleans. + +2012-09-02 Chong Yidong <cyd@gnu.org> + + * keymap.c (push_key_description): Print M-TAB as C-M-i + (Bug#11758). + +2012-09-02 Juanma Barranquero <lekktu@gmail.com> + + * makefile.w32-in (CCL_H, W32FONT_H): New macros. + (ATIMER_H, FONT_H, $(BLD)/alloc.$(O), $(BLD)/callproc.$(O)) + ($(BLD)/editfns.$(O), $(BLD)/ccl.$(O), $(BLD)/chartab.$(O)) + ($(BLD)/coding.$(O), $(BLD)/sysdep.$(O), $(BLD)/fontset.$(O)) + ($(BLD)/sysdep.$(O), $(BLD)/w32fns.$(O), $(BLD)/keyboard.$(O)) + ($(BLD)/w32term.$(O), $(BLD)/w32menu.$(O), $(BLD)/process.$(O)) + ($(BLD)/w32font.$(O), $(BLD)/w32uniscribe.$(O)): Update dependencies. + +2012-09-01 Eli Zaretskii <eliz@gnu.org> + + * w32uniscribe.c (uniscribe_shape): Handle correctly the case of + more than one grapheme cluster passed to the shaper: compute the + offset adjustment values separately for each cluster. (Bug#11860) + + * image.c: Restore mistakenly removed inclusion of w32.h. Without + it, GCC doesn't see prototypes of w32_delayed_load, and complains + about implicit conversions from integer to pointer. + +2012-09-01 Daniel Colascione <dancol@dancol.org> + + * w32fns.c (x_display_info_for_name): Prevent crash if w32 window + system used too early. + +2012-09-01 Paul Eggert <eggert@cs.ucla.edu> + + Better seed support for (random). + * emacs.c (main): Call init_random. + * fns.c (Frandom): Set the seed from a string argument, if given. + Remove long-obsolete Gentzel cruft. + * lisp.h, sysdep.c (seed_random): Now takes address and size, not long. + (init_random): New function. + +2012-09-01 Daniel Colascione <dancol@dancol.org> + + * xterm.h: Add header guards. Declare x_menubar_window_to_frame. + Remove x_set_frame_alpha, x_bitmap_icon, x_make_frame_visible, + x_make_frame_invisible, x_iconify_frame, x_free_frame_resources, + x_wm_set_size_hint, x_query_colors, x_real_positions, + x_set_menu_bar_lines, x_char_width, x_char_height, x_sync, + x_set_tool_bar_lines, x_activate_menubar, and free_frame_menubar, + all of which have been moved to common code. + + * xfaces.c: Include TERM_HEADER instead of listing all possible + window-system headers. + + * w32xfns.c (x_sync): Correct definition of x_sync (a no-op here) + to match header. + + * w32term.h (FRAME_X_WINDOW): Use FRAME_W32_WINDOW instead of + directly accessing frame internals. + + * w32font.h: Include font.h. Define syms_of_w32font and + globals_of_w32font. + + * process.c: Include TERM_HEADER instead of listing all possible + window-system headers. + + * nsterm.h: Remove declarations now in frame.h. Define + FRAME_X_SCREEN, FRAME_X_VISUAL. + + * menu.c: Include TERM_HEADER instead of listing all possible + window-system headers. + + * keyboard.h: Declare ignore_mouse_drag_p whenever we have a + window system. + + * keyboard.c: Include TERM_HEADER instead of listing all possible + window-system headers. + + * image.c: Include TERM_HEADER instead of listing all possible + window-system headers. Declare Vlibrary_cache when compiling for + Windows. + + * gtkutil.h (xg_list_node_): Include xterm.h to pick up needed + window system declarations. + + * frame.h: Move common functions here: set_frame_menubar, + x_set_window_size, x_sync, x_get_focus_frame, + x_set_mouse_position, x_set_mouse_pixel_position, + x_make_frame_visible, x_make_frame_invisible, x_iconify_frame, + x_char_width, x_char_height, x_pixel_width, x_pixel_height, + x_set_frame_alpha, x_set_menu_bar_lines, x_set_tool_bar_lines, + x_activate_menubar, x_real_positions, x_bitmap_icon, + x_set_menu_bar_lines, free_frame_menubar, x_free_frame_resources, + and x_query_colors. + + * frame.c: Include TERM_HEADER instead of listing all possible + window-system headers. + + * font.c: Include TERM_HEADER instead of listing all possible + window-system headers. + + * emacs.c: Include TERM_HEADER. + + * dispnew.c: Include TERM_HEADER instead of listing all possible + window-system headers. + + * ccl.h: Include character.h. + + * Makefile.in: Define WINDOW_SYSTEM_OBJ to hold objects needed for + the current window system; include in list of objects to link into + Emacs. + +2012-08-31 Dmitry Antipov <dmantipov@yandex.ru> + + Remove mark_ttys function and fix tty_display_info initialization. + * lisp.h (mark_ttys): Remove prototype. + * alloc.c (Fgarbage_collect): Remove redundant (and the only) call + to mark_ttys because all possible values of 'top_frame' slot are + the frames which are reachable from Vframe_list. + * term.c (mark_ttys): Remove. + (init_tty): Safely initialize 'top_frame' slot with Qnil. + +2012-08-31 Dmitry Antipov <dmantipov@yandex.ru> + + Change struct frame bitfields from unsigned char to unsigned. + * frame.h (struct frame): Change type of 'display_preempted', + 'visible', 'iconified', 'has_minibuffer', 'wants_modeline', + 'auto_raise', 'auto_lower', 'no_split', 'explicit_name', + 'window_sizes_changed', 'mouse_moved' and 'pointer_invisible' + bitfields from unsigned char to unsigned. + +2012-08-31 Dmitry Antipov <dmantipov@yandex.ru> + + Remove unused member of struct x_output and struct w32_output. + * xterm.h (struct x_output): Remove unused field 'needs_exposure'. + * w32term.h (struct w32_output): Likewise. + +2012-08-30 Jan Djärv <jan.h.d@swipnet.se> + + * gtkutil.c (x_wm_set_size_hint): Use 1 col for base_width so it + does not become zero (Bug#12234). + +2012-08-30 Paul Eggert <eggert@cs.ucla.edu> + + * dispnew.c (update_frame_1): Pacify gcc -Wstrict-overflow + for GCC 4.7.1 x86-64. + +2012-08-30 Glenn Morris <rgm@gnu.org> + + * lread.c (init_lread): For out-of-tree builds, only add the + source directory's site-lisp dir to the load-path if it exists, + consistent with in-tree builds. (Bug#12302) + +2012-08-28 Jan Djärv <jan.h.d@swipnet.se> + + * nsmenu.m (initWithContentRect:styleMask:backing:defer:): Initialize + button_values to NULL. Call setStykeMask so dialogs get a close button. + (windowShouldClose:): Set window_closed. + (dealloc): New member, free button_values. + (process_dialog:): Make member function. Remove window argument, + replace window with self. Count buttons and allocate and store values + in button_values. + (addButton:value:row:): value is int with the name tag. Call setTag + with tag. Remove return self, declare return value as void. + (addString:row:): Remove return self, declare return value as void. + (addSplit): Remove return self, declare return value as void. + (clicked:): Remove return self, declare return value as void. + Set dialog_return to button_values[seltag]. Code formatting change. + (initFromContents:isQuestion:): Adjust call to process_dialog. + Code formatting change. + (timeout_handler:): Set timer_fired to YES. + (runDialogAt:): Set timer_fired to NO. + Handle click on close button as quit. + + * nsterm.h (EmacsDialogPanel): Make timer_fired BOOL. + Add window_closed and button_values. Add void as return value for + add(Button|String|Split). addButton takes int instead of Lisp_Object. + Add process_dialog as new member. + +2012-08-28 Eli Zaretskii <eliz@gnu.org> + + * ralloc.c (free_bloc): Don't dereference a 'heap' structure if it + is not one of the heaps we manage. (Bug#12242) + +2012-08-28 Glenn Morris <rgm@gnu.org> + + * eval.c (Fcalled_interactively_p): Doc fix. (Bug#11747) + +2012-08-28 Martin Rudalics <rudalics@gmx.at> + + * window.c (Fset_window_configuration): Remove handling of + auto-buffer-name window parameter. Install revision of reverted + fix. + +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. + Otherwise, the compiler complains about (A?B:C) where B is void + and C is Lisp_Object. This fixes an incompatibility with Sun C 5.12. + (fontset_add): Return void, for FONTSET_ADD. + +2012-08-21 Paul Eggert <eggert@cs.ucla.edu> + + * alloc.c: Use bool for booleans. + (gc_in_progress, abort_on_gc) + (setjmp_tested_p) [!GC_SAVE_REGISTERS_ON_STACK && !GC_SETJMP_WORKS]: + (dont_register_blocks) [GC_MALLOC_CHECK]: + (suppress_checking) [ENABLE_CHECKING]: Now bool, not int. + (check_string_bytes, make_specified_string, memory_full) + (live_string_p, live_cons_p, live_symbol_p, live_float_p) + (live_misc_p, live_vector_p, live_buffer_p, mark_maybe_object) + (mark_stack, valid_pointer_p, make_pure_string) + (Fgarbage_collect, survives_gc_p, gc_sweep): + Use bool for booleans, instead of int. + (test_setjmp) [!GC_SAVE_REGISTERS_ON_STACK && !GC_SETJMP_WORKS]: + Remove unused local. + * alloc.c (PURE_POINTER_P): + * lisp.h (STRING_MULTIBYTE): Document that it returns a boolean. + * editfns.c (Fformat): + * fileio.c (Fexpand_file_name, Fsubstitute_in_file_name) + (Fdo_auto_save): + * fns.c (sweep_weak_table): + * lisp.h (suppress_checking, push_message, survives_gc_p) + (make_pure_string, gc_in_progress, abort_on_gc): + * lread.c (readchar, read1): + * print.c (Fprin1_to_string): + * xdisp.c (push_message): + Use bool for booleans affected directly or indirectly by + alloc.c's changes. + + Make recently-introduced setters macros. + * fontset.c (set_fontset_id, set_fontset_name, set_fontset_ascii) + (set_fontset_base, set_fontset_frame, set_fontset_nofont_face) + (set_fontset_default, set_fontset_fallback): Rename from their + upper-case counterparts, and make them functions rather than macros. + This is more consistent with the other recently-introduced setters. + These don't need to be inline, since they're local. + +2012-08-21 Jan Djärv <jan.h.d@swipnet.se> + + * nsterm.m (fd_handler:): Alloc and release a NSAutoreleasePool in + the loop (Bug#12247). + +2012-08-21 Paul Eggert <eggert@cs.ucla.edu> + + * lisp.h (vcopy): Use memcpy rather than our own loop. + This fixes a performance regression introduced by the recent + addition of vcopy. This means 'vcopy' will need to be modified + for a copying collector, but that's OK. Also, tighten the + checking in the assertion. + +2012-08-21 Eli Zaretskii <eliz@gnu.org> + + * 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 + expectations, to produce correct width of the composed character. + Reverse the sign of the DU offset produced by ScriptPlace. + +2012-08-21 Paul Eggert <eggert@cs.ucla.edu> + + * dbusbind.c (xd_remove_watch): Do not assume C99 comments. + +2012-08-21 Dmitry Antipov <dmantipov@yandex.ru> + + Avoid direct writes to contents member of struct Lisp_Vector. + * lisp.h (vcopy): New function to copy data into vector. + * dispnew.c (Fframe_or_buffer_changed_p): Use AREF and ASET. + * fns.c (Ffillarray): Use ASET. + * keyboard.c (timer_check_2): Use AREF and ASET. + (append_tool_bar_item, Frecent_keys): Use vcopy. + * lread.c (read_vector): Use ASET. + * msdos.c (Frecent_doskeys): Use vcopy. + * xface.c (Finternal_copy_lisp_face): Use vcopy. + (Finternal_merge_in_global_face): Use ASET and vcopy. + * xfont.c (xfont_list_pattern): Likewise. + +2012-08-21 Martin Rudalics <rudalics@gmx.at> + + * window.c (Fwindow_point): For the selected window always return + the position of its buffer's point. + (Fset_window_point): For the selected window always go in its + buffer to the specified position. + +2012-08-21 Dmitry Antipov <dmantipov@yandex.ru> + + Setter macros for fontsets. + * fontset.c (SET_FONTSET_ID, SET_FONTSET_NAME, SET_FONTSET_ASCII) + (SET_FONTSET_BASE, SET_FONTSET_FRAME, SET_FONTSET_NOFONT_FACE) + (SET_FONTSET_DEFAULT, SET_FONTSET_FALLBACK): New macros. + Adjust users. + +2012-08-20 Glenn Morris <rgm@gnu.org> + + * Makefile.in (emacs$(EXEEXT), bootstrap-emacs$(EXEEXT)): + Don't assume that `ln -f' works. + +2012-08-20 Eli Zaretskii <eliz@gnu.org> + + * .gdbinit: Use "set $dummy = ..." to avoid warnings from GDB 7.5 + and later about non-assignments with no effect. See discussion at + http://sourceware.org/ml/gdb-patches/2012-08/msg00518.html for + details. + 2012-08-20 Dmitry Antipov <dmantipov@yandex.ru> Inline setter functions for Lisp_Objects slots of struct specbinding. @@ -42,6 +777,8 @@ Rely on <config.h> + <unistd.h> to declare 'environ', as gnulib does this if the system doesn't. * callproc.c, editfns.c, process.c (environ) [!USE_CRT_DLL]: + Remove declaration. MS-Windows declares it on stdlib.h which is + included by conf_post.h. * emacs.c (environ) [DOUG_LEA_MALLOC]: * vm-limit.c (environ) [ORDINARY_LINK]: Remove decl. * vm-limit.c: Include <unistd.h>, for 'environ'. diff --git a/src/Makefile.in b/src/Makefile.in index 01034ca98d5..24c8b94b590 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -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@ @@ -209,8 +211,8 @@ LIBXMENU=@LIBXMENU@ ## xmenu.o if HAVE_X_WINDOWS, else empty. XMENU_OBJ=@XMENU_OBJ@ -## xterm.o xfns.o xselect.o xrdb.o fontset.o xsmfns.o fringe.o image.o -## xsettings.o xgselect.o if HAVE_X_WINDOWS, else empty. +## xterm.o xfns.o xselect.o xrdb.o xsmfns.o xsettings.o xgselect.o if +## HAVE_X_WINDOWS, else empty. XOBJ=@XOBJ@ TOOLKIT_LIBW=@TOOLKIT_LIBW@ @@ -245,6 +247,9 @@ WIDGET_OBJ=@WIDGET_OBJ@ ## sheap.o if CYGWIN, otherwise empty. CYGWIN_OBJ=@CYGWIN_OBJ@ +## fontset.o fringe.o image.o if we have any window system +WINDOW_SYSTEM_OBJ=@WINDOW_SYSTEM_OBJ@ + ## dosfns.o msdos.o w16select.o if MSDOS. MSDOS_OBJ = ## w16select.o termcap.o if MSDOS && HAVE_X_WINDOWS. @@ -253,7 +258,6 @@ MSDOS_X_OBJ = ns_appdir=@ns_appdir@ ns_appbindir=@ns_appbindir@ ns_appsrc=@ns_appsrc@ -## fontset.o fringe.o image.o if HAVE_NS, else empty. NS_OBJ=@NS_OBJ@ ## nsterm.o nsfns.o nsmenu.o nsselect.o nsimage.o nsfont.o if HAVE_NS. NS_OBJC_OBJ=@NS_OBJC_OBJ@ @@ -338,7 +342,8 @@ base_obj = dispnew.o frame.o scroll.o xdisp.o menu.o $(XMENU_OBJ) window.o \ process.o gnutls.o callproc.o \ region-cache.o sound.o atimer.o thread.o systhread.o \ doprnt.o intervals.o textprop.o composite.o xml.o \ - $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ) + $(MSDOS_OBJ) $(MSDOS_X_OBJ) $(NS_OBJ) $(CYGWIN_OBJ) $(FONT_OBJ) \ + $(WINDOW_SYSTEM_OBJ) obj = $(base_obj) $(NS_OBJC_OBJ) ## Object files used on some machine or other. @@ -383,6 +388,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) \ @@ -402,11 +408,13 @@ $(leimdir)/leim-list.el: bootstrap-emacs$(EXEEXT) ## on all of $lisp, and emacs depends on DOC, so it is ok to use $lisp here. emacs$(EXEEXT): temacs$(EXEEXT) $(etc)/DOC $(lisp) $(leimdir)/leim-list.el if test "$(CANNOT_DUMP)" = "yes"; then \ - ln -f temacs$(EXEEXT) emacs$(EXEEXT); \ + rm -f emacs$(EXEEXT); \ + ln temacs$(EXEEXT) emacs$(EXEEXT); \ else \ LC_ALL=C $(RUN_TEMACS) -batch -l loadup dump || exit 1; \ test "X$(PAXCTL)" = X || $(PAXCTL) -zex emacs$(EXEEXT); \ - ln -f emacs$(EXEEXT) bootstrap-emacs$(EXEEXT); \ + rm -f bootstrap-emacs$(EXEEXT); \ + ln emacs$(EXEEXT) bootstrap-emacs$(EXEEXT); \ fi ## We run make-docfile twice because the command line may get too long @@ -440,7 +448,7 @@ GLOBAL_SOURCES = $(base_obj:.o=.c) $(NS_OBJC_OBJ:.o=.m) gl-stamp: $(libsrc)/make-docfile$(EXEEXT) $(GLOBAL_SOURCES) @rm -f gl-tmp - $(libsrc)/make-docfile -d $(srcdir) -g $(SOME_MACHINE_OBJECTS) $(obj) > gl-tmp + $(libsrc)/make-docfile -d $(srcdir) -g $(obj) > gl-tmp $(srcdir)/../build-aux/move-if-change gl-tmp globals.h echo timestamp > $@ @@ -497,7 +505,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 @@ -600,7 +608,8 @@ $(lispsource)/loaddefs.el: $(BOOTSTRAPEMACS) $(VCSWITNESS) bootstrap-emacs$(EXEEXT): temacs$(EXEEXT) cd ../lisp; $(MAKE) $(MFLAGS) update-subdirs if test "$(CANNOT_DUMP)" = "yes"; then \ - ln -f temacs$(EXEEXT) bootstrap-emacs$(EXEEXT); \ + rm -f bootstrap-emacs$(EXEEXT); \ + ln temacs$(EXEEXT) bootstrap-emacs$(EXEEXT); \ else \ $(RUN_TEMACS) --batch --load loadup bootstrap || exit 1; \ test "X$(PAXCTL)" = X || $(PAXCTL) -zex emacs$(EXEEXT); \ diff --git a/src/alloc.c b/src/alloc.c index a8830684580..859961781e0 100644 --- a/src/alloc.c +++ b/src/alloc.c @@ -69,6 +69,9 @@ extern void *sbrk (); #include <fcntl.h> +#ifdef USE_GTK +# include "gtkutil.h" +#endif #ifdef WINDOWSNT #include "w32.h" #endif @@ -173,15 +176,15 @@ EMACS_INT gc_relative_threshold; EMACS_INT memory_full_cons_threshold; -/* Nonzero during GC. */ +/* True during GC. */ -int gc_in_progress; +bool gc_in_progress; -/* Nonzero means abort if try to GC. +/* True means abort if try to GC. This is for code which is written on the assumption that no GC will happen, so as to verify that assumption. */ -int abort_on_gc; +bool abort_on_gc; /* Number of live and free conses etc. */ @@ -223,7 +226,7 @@ static ptrdiff_t pure_size; static ptrdiff_t pure_bytes_used_before_overflow; -/* Value is non-zero if P points into pure space. */ +/* True if P points into pure space. */ #define PURE_POINTER_P(P) \ ((uintptr_t) (P) - (uintptr_t) purebeg <= pure_size) @@ -305,7 +308,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); @@ -387,13 +392,13 @@ static struct mem_node mem_z; static struct Lisp_Vector *allocate_vectorlike (ptrdiff_t); static void lisp_free (void *); -static int live_vector_p (struct mem_node *, void *); -static int live_buffer_p (struct mem_node *, void *); -static int live_string_p (struct mem_node *, void *); -static int live_cons_p (struct mem_node *, void *); -static int live_symbol_p (struct mem_node *, void *); -static int live_float_p (struct mem_node *, void *); -static int live_misc_p (struct mem_node *, void *); +static bool live_vector_p (struct mem_node *, void *); +static bool live_buffer_p (struct mem_node *, void *); +static bool live_string_p (struct mem_node *, void *); +static bool live_cons_p (struct mem_node *, void *); +static bool live_symbol_p (struct mem_node *, void *); +static bool live_float_p (struct mem_node *, void *); +static bool live_misc_p (struct mem_node *, void *); static void mark_maybe_object (Lisp_Object); static void mark_memory (void *, void *); #if GC_MARK_STACK || defined GC_MALLOC_CHECK @@ -1232,7 +1237,7 @@ static void (*old_free_hook) (void*, const void*); #endif #ifdef GC_MALLOC_CHECK -static int dont_register_blocks; +static bool dont_register_blocks; #endif static size_t bytes_used_when_reconsidered; @@ -1819,11 +1824,11 @@ check_sblock (struct sblock *b) /* Check validity of Lisp strings' string_bytes member. ALL_P - non-zero means check all strings, otherwise check only most + means check all strings, otherwise check only most recently allocated strings. Used for hunting a bug. */ static void -check_string_bytes (int all_p) +check_string_bytes (bool all_p) { if (all_p) { @@ -2428,9 +2433,9 @@ make_string_from_bytes (const char *contents, Lisp_Object make_specified_string (const char *contents, - ptrdiff_t nchars, ptrdiff_t nbytes, int multibyte) + ptrdiff_t nchars, ptrdiff_t nbytes, bool multibyte) { - register Lisp_Object val; + Lisp_Object val; if (nchars < 0) { @@ -3085,7 +3090,7 @@ sweep_vectors (void) for (block = vector_blocks; block; block = *bprev) { - int free_this_block = 0; + bool free_this_block = 0; for (vector = (struct Lisp_Vector *) block->data; VECTOR_IN_BLOCK (vector, block); vector = next) @@ -3751,7 +3756,7 @@ void memory_full (size_t nbytes) { /* Do not go into hysterics merely because a large request failed. */ - int enough_free_memory = 0; + bool enough_free_memory = 0; if (SPARE_MEMORY < nbytes) { void *p; @@ -3814,22 +3819,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 @@ -4244,7 +4249,7 @@ mem_delete_fixup (struct mem_node *x) /* Value is non-zero if P is a pointer to a live Lisp string on the heap. M is a pointer to the mem_block for P. */ -static inline int +static inline bool live_string_p (struct mem_node *m, void *p) { if (m->type == MEM_TYPE_STRING) @@ -4267,7 +4272,7 @@ live_string_p (struct mem_node *m, void *p) /* Value is non-zero if P is a pointer to a live Lisp cons on the heap. M is a pointer to the mem_block for P. */ -static inline int +static inline bool live_cons_p (struct mem_node *m, void *p) { if (m->type == MEM_TYPE_CONS) @@ -4293,7 +4298,7 @@ live_cons_p (struct mem_node *m, void *p) /* Value is non-zero if P is a pointer to a live Lisp symbol on the heap. M is a pointer to the mem_block for P. */ -static inline int +static inline bool live_symbol_p (struct mem_node *m, void *p) { if (m->type == MEM_TYPE_SYMBOL) @@ -4319,7 +4324,7 @@ live_symbol_p (struct mem_node *m, void *p) /* Value is non-zero if P is a pointer to a live Lisp float on the heap. M is a pointer to the mem_block for P. */ -static inline int +static inline bool live_float_p (struct mem_node *m, void *p) { if (m->type == MEM_TYPE_FLOAT) @@ -4343,7 +4348,7 @@ live_float_p (struct mem_node *m, void *p) /* Value is non-zero if P is a pointer to a live Lisp Misc on the heap. M is a pointer to the mem_block for P. */ -static inline int +static inline bool live_misc_p (struct mem_node *m, void *p) { if (m->type == MEM_TYPE_MISC) @@ -4369,7 +4374,7 @@ live_misc_p (struct mem_node *m, void *p) /* Value is non-zero if P is a pointer to a live vector-like object. M is a pointer to the mem_block for P. */ -static inline int +static inline bool live_vector_p (struct mem_node *m, void *p) { if (m->type == MEM_TYPE_VECTOR_BLOCK) @@ -4405,7 +4410,7 @@ live_vector_p (struct mem_node *m, void *p) /* Value is non-zero if P is a pointer to a live buffer. M is a pointer to the mem_block for P. */ -static inline int +static inline bool live_buffer_p (struct mem_node *m, void *p) { /* P must point to the start of the block, and the buffer @@ -4485,7 +4490,7 @@ mark_maybe_object (Lisp_Object obj) if (m != MEM_NIL) { - int mark_p = 0; + bool mark_p = 0; switch (XTYPE (obj)) { @@ -4559,6 +4564,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; @@ -4705,7 +4711,8 @@ mark_memory (void *start, void *end) #if !defined GC_SAVE_REGISTERS_ON_STACK && !defined GC_SETJMP_WORKS -static int setjmp_tested_p, longjmps_done; +static bool setjmp_tested_p; +static int longjmps_done; #define SETJMP_WILL_LIKELY_WORK "\ \n\ @@ -4749,14 +4756,13 @@ test_setjmp (void) char buf[10]; register int x; jmp_buf jbuf; - int result = 0; /* Arrange for X to be put in a register. */ sprintf (buf, "1"); x = strlen (buf); x = 2 * x - 1; - setjmp (jbuf); + _setjmp (jbuf); if (longjmps_done == 1) { /* Came here after the longjmp at the end of the function. @@ -4781,7 +4787,7 @@ test_setjmp (void) ++longjmps_done; x = 2; if (longjmps_done == 1) - longjmp (jbuf, 1); + _longjmp (jbuf, 1); } #endif /* not GC_SAVE_REGISTERS_ON_STACK && not GC_SETJMP_WORKS */ @@ -4908,7 +4914,7 @@ flush_stack_call_func (void (*func) (void *arg), void *arg) Lisp_Object o; jmp_buf j; } j; - volatile int stack_grows_down_p = (char *) &j > (char *) stack_bottom; + volatile bool stack_grows_down_p = (char *) &j > (char *) stack_bottom; #endif /* This trick flushes the register windows so that all the state of the process is contained in the stack. */ @@ -4942,7 +4948,7 @@ flush_stack_call_func (void (*func) (void *arg), void *arg) } #endif /* GC_SETJMP_WORKS */ - setjmp (j.j); + _setjmp (j.j); end = stack_grows_down_p ? (char *) &j + sizeof j : (char *) &j; #endif /* not GC_SAVE_REGISTERS_ON_STACK */ #endif /* not HAVE___BUILTIN_UNWIND_INIT */ @@ -4970,7 +4976,7 @@ valid_pointer_p (void *p) if (pipe (fd) == 0) { - int valid = (emacs_write (fd[1], (char *) p, 16) == 16); + bool valid = emacs_write (fd[1], (char *) p, 16) == 16; emacs_close (fd[1]); emacs_close (fd[0]); return valid; @@ -5022,6 +5028,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: @@ -5191,7 +5198,7 @@ find_string_data_in_pure (const char *data, ptrdiff_t nbytes) /* Return a string allocated in pure space. DATA is a buffer holding NCHARS characters, and NBYTES bytes of string data. MULTIBYTE - non-zero means make the result string multibyte. + means make the result string multibyte. Must get an error if pure storage is full, since if it cannot hold a large string it may be able to hold conses that point to that @@ -5199,7 +5206,7 @@ find_string_data_in_pure (const char *data, ptrdiff_t nbytes) Lisp_Object make_pure_string (const char *data, - ptrdiff_t nchars, ptrdiff_t nbytes, int multibyte) + ptrdiff_t nchars, ptrdiff_t nbytes, bool multibyte) { Lisp_Object string; struct Lisp_String *s = pure_alloc (sizeof *s, Lisp_String); @@ -5394,11 +5401,11 @@ returns nil, because real GC can't be done. See Info node `(elisp)Garbage Collection'. */) (void) { - register struct specbinding *bind; - register struct buffer *nextb; + struct specbinding *bind; + struct buffer *nextb; char stack_top_variable; ptrdiff_t i; - int message_p; + bool message_p; ptrdiff_t count = SPECPDL_INDEX (); EMACS_TIME start; Lisp_Object retval = Qnil; @@ -5473,13 +5480,9 @@ See Info node `(elisp)Garbage Collection'. */) mark_threads (); mark_terminals (); mark_kboards (); - mark_ttys (); #ifdef USE_GTK - { - extern void xg_mark_data (void); - xg_mark_data (); - } + xg_mark_data (); #endif #ifdef HAVE_WINDOW_SYSTEM @@ -6181,10 +6184,10 @@ mark_terminals (void) /* Value is non-zero if OBJ will survive the current GC because it's either marked or does not need to be marked to survive. */ -int +bool survives_gc_p (Lisp_Object obj) { - int survives_p; + bool survives_p; switch (XTYPE (obj)) { @@ -6429,7 +6432,7 @@ gc_sweep (void) /* Check if the symbol was created during loadup. In such a case it might be pointed to by pure bytecode which we don't trace, so we conservatively assume that it is live. */ - int pure_p = PURE_POINTER_P (XSTRING (sym->s.name)); + bool pure_p = PURE_POINTER_P (XSTRING (sym->s.name)); if (!sym->s.gcmarkbit && !pure_p) { @@ -6654,13 +6657,21 @@ which_symbols (Lisp_Object obj, EMACS_INT find_max) } #ifdef ENABLE_CHECKING -int suppress_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 diff --git a/src/atimer.c b/src/atimer.c index d67e1375f9a..eb3136ae55d 100644 --- a/src/atimer.c +++ b/src/atimer.c @@ -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) { diff --git a/src/atimer.h b/src/atimer.h index 4282bab49ba..6d441d71641 100644 --- a/src/atimer.h +++ b/src/atimer.h @@ -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); diff --git a/src/bidi.c b/src/bidi.c index 4df585d4f48..6b3ac53d318 100644 --- a/src/bidi.c +++ b/src/bidi.c @@ -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; diff --git a/src/buffer.c b/src/buffer.c index 6f748158e21..ef87f40e81a 100644 --- a/src/buffer.c +++ b/src/buffer.c @@ -108,10 +108,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, @@ -153,7 +153,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 @@ -977,15 +977,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. @@ -1251,14 +1249,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; @@ -1349,11 +1347,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. @@ -1363,7 +1359,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)) @@ -1430,7 +1426,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)) @@ -1555,7 +1551,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; @@ -1626,7 +1621,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; @@ -1674,7 +1668,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. */ @@ -1716,9 +1710,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: ", @@ -2068,8 +2060,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 { @@ -2103,22 +2097,6 @@ DEFUN ("current-buffer", Fcurrent_buffer, Scurrent_buffer, 0, 0, 0, XSETBUFFER (buf, current_buffer); return buf; } - -/* 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. */ @@ -2224,13 +2202,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; } @@ -2469,8 +2447,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; @@ -2819,19 +2797,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; @@ -2840,7 +2818,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) { @@ -2957,13 +2935,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) { @@ -2974,8 +2952,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) { @@ -3076,10 +3054,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)); @@ -3108,7 +3086,7 @@ mouse_face_overlay_overlaps (Lisp_Object overlay) /* Fast function to just test if we're at an overlay boundary. */ -int +bool overlay_touches_p (ptrdiff_t pos) { Lisp_Object overlay; @@ -3325,7 +3303,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; @@ -4093,6 +4071,26 @@ DEFUN ("delete-overlay", Fdelete_overlay, Sdelete_overlay, 1, 1, 0, return unbind_to (count, Qnil); } + +DEFUN ("delete-all-overlays", Fdelete_all_overlays, Sdelete_all_overlays, 0, 1, 0, + doc: /* Delete all overlays of BUFFER. +BUFFER omitted or nil means delete all overlays of the current +buffer. */) + (Lisp_Object buffer) +{ + register struct buffer *buf; + + if (NILP (buffer)) + buf = current_buffer; + else + { + CHECK_BUFFER (buffer); + buf = XBUFFER (buffer); + } + + delete_all_overlays (buf); + return Qnil; +} /* Overlay dissection functions. */ @@ -4319,7 +4317,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); @@ -4394,7 +4392,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, @@ -4402,13 +4400,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; @@ -4528,7 +4526,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; @@ -4687,7 +4685,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. */ @@ -4783,9 +4781,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) @@ -4796,24 +4794,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) { @@ -4863,17 +4856,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; @@ -6312,6 +6304,7 @@ and `bury-buffer-internal'. */); defsubr (&Soverlayp); defsubr (&Smake_overlay); defsubr (&Sdelete_overlay); + defsubr (&Sdelete_all_overlays); defsubr (&Smove_overlay); defsubr (&Soverlay_start); defsubr (&Soverlay_end); diff --git a/src/buffer.h b/src/buffer.h index de7ca7eb2e7..e603486418b 100644 --- a/src/buffer.h +++ b/src/buffer.h @@ -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. */ @@ -1002,23 +1002,46 @@ extern struct buffer buffer_local_symbols; 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. @@ -1063,7 +1086,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; @@ -1239,7 +1262,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 @@ -1251,8 +1274,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); } diff --git a/src/bytecode.c b/src/bytecode.c index d61e37d7886..be5b7ea6137 100644 --- a/src/bytecode.c +++ b/src/bytecode.c @@ -550,7 +550,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); @@ -1048,7 +1048,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. */ diff --git a/src/callint.c b/src/callint.c index 36a59e812f2..b11545ddea2 100644 --- a/src/callint.c +++ b/src/callint.c @@ -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; diff --git a/src/callproc.c b/src/callproc.c index 4bf1da04e1a..2e9a8950700 100644 --- a/src/callproc.c +++ b/src/callproc.c @@ -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) { diff --git a/src/casefiddle.c b/src/casefiddle.c index 81e84252b72..1102054b153 100644 --- a/src/casefiddle.c +++ b/src/casefiddle.c @@ -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; diff --git a/src/casetab.c b/src/casetab.c index a163d5204f8..3e22d0d0b77 100644 --- a/src/casetab.c +++ b/src/casetab.c @@ -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; diff --git a/src/category.c b/src/category.c index 1c9085fd558..80dc6938d8b 100644 --- a/src/category.c +++ b/src/category.c @@ -406,17 +406,17 @@ then delete CATEGORY from the category set instead of adding it. */) return Qnil; } -/* 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))) diff --git a/src/category.h b/src/category.h index 9fb981ed383..17cd203db45 100644 --- a/src/category.h +++ b/src/category.h @@ -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 diff --git a/src/ccl.h b/src/ccl.h index 71139175be5..cc5daf11e1c 100644 --- a/src/ccl.h +++ b/src/ccl.h @@ -26,6 +26,8 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #ifndef EMACS_CCL_H #define EMACS_CCL_H +#include "character.h" /* For MAX_MULTIBYTE_LENGTH */ + /* Macros for exit status of CCL program. */ #define CCL_STAT_SUCCESS 0 /* Terminated successfully. */ #define CCL_STAT_SUSPEND_BY_SRC 1 /* Terminated by empty input. */ diff --git a/src/character.c b/src/character.c index b2acf36ec15..cfaaf8eeca9 100644 --- a/src/character.c +++ b/src/character.c @@ -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; diff --git a/src/character.h b/src/character.h index 332dfee373a..70d4e67a978 100644 --- a/src/character.h +++ b/src/character.h @@ -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 *); diff --git a/src/charset.c b/src/charset.c index 3e286fa947d..0673790e91c 100644 --- a/src/charset.c +++ b/src/charset.c @@ -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; diff --git a/src/charset.h b/src/charset.h index 4ef8ddc2c33..50d230489fe 100644 --- a/src/charset.h +++ b/src/charset.h @@ -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) \ diff --git a/src/chartab.c b/src/chartab.c index 711a49ed397..c14df0ebac6 100644 --- a/src/chartab.c +++ b/src/chartab.c @@ -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)) { diff --git a/src/cmds.c b/src/cmds.c index b416135ee9e..90d3cd6dced 100644 --- a/src/cmds.c +++ b/src/cmds.c @@ -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); diff --git a/src/coding.c b/src/coding.c index 971686dc180..02e7b34695e 100644 --- a/src/coding.c +++ b/src/coding.c @@ -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; } - /*** 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'. */) /* 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); diff --git a/src/coding.h b/src/coding.h index 2987f19607b..c45d2ef86e2 100644 --- a/src/coding.h +++ b/src/coding.h @@ -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 */ diff --git a/src/composite.c b/src/composite.c index 4e90e9bb914..eddabb66d33 100644 --- a/src/composite.c +++ b/src/composite.c @@ -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)) diff --git a/src/composite.h b/src/composite.h index 6a7e0a5e2c7..68f5b27ee42 100644 --- a/src/composite.h +++ b/src/composite.h @@ -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); diff --git a/src/conf_post.h b/src/conf_post.h index ead7298e98d..f90ef90fb83 100644 --- a/src/conf_post.h +++ b/src/conf_post.h @@ -178,6 +178,9 @@ You lose; /* Emacs for DOS must be compiled with DJGPP */ #endif #include <string.h> +/* If you think about removing the line below, note that the + MS-Windows build relies on it for declaration of 'environ' needed + by a few source files. */ #include <stdlib.h> #if __GNUC__ >= 3 /* On GCC 3.0 we might get a warning. */ diff --git a/src/data.c b/src/data.c index ac6c7af9d3c..a93cd169bf5 100644 --- a/src/data.c +++ b/src/data.c @@ -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; @@ -1117,10 +1117,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; @@ -1139,7 +1139,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; @@ -1155,14 +1155,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; @@ -1501,7 +1502,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; @@ -1545,7 +1547,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); @@ -1617,10 +1619,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; @@ -1804,9 +1806,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; @@ -2262,7 +2264,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); @@ -2379,7 +2381,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)) { @@ -2432,7 +2434,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)) { @@ -2550,14 +2552,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) { @@ -3130,8 +3129,6 @@ syms_of_data (void) DEFSYM (Qthread, "thread"); DEFSYM (Qmutex, "mutex"); DEFSYM (Qcondition_variable, "condition-variable"); - /* Used by Fgarbage_collect. */ - DEFSYM (Qinterval, "interval"); DEFSYM (Qmisc, "misc"); DEFSYM (Qdefun, "defun"); diff --git a/src/dbusbind.c b/src/dbusbind.c index c1b1310454c..901820648cb 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c @@ -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; /* 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 @@ -1039,11 +1038,13 @@ xd_remove_watch (DBusWatch *watch, void *data) return; /* Unset session environment. */ +#if 0 if (XSYMBOL (QCdbus_session_bus) == data) { - // XD_DEBUG_MESSAGE ("unsetenv DBUS_SESSION_BUS_ADDRESS"); - // unsetenv ("DBUS_SESSION_BUS_ADDRESS"); + XD_DEBUG_MESSAGE ("unsetenv DBUS_SESSION_BUS_ADDRESS"); + unsetenv ("DBUS_SESSION_BUS_ADDRESS"); } +#endif if (flags & DBUS_WATCH_WRITABLE) delete_write_fd (fd); @@ -1684,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; diff --git a/src/dired.c b/src/dired.c index 771230717e3..fa293258107 100644 --- a/src/dired.c +++ b/src/dired.c @@ -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. */) } -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, diff --git a/src/dispextern.h b/src/dispextern.h index a25aac96df9..73f3350713f 100644 --- a/src/dispextern.h +++ b/src/dispextern.h @@ -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; @@ -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 */ @@ -3055,7 +3055,7 @@ void move_it_in_display_line (struct it *it, int in_display_vector_p (struct it *); int frame_mode_line_height (struct frame *); extern Lisp_Object Qtool_bar; -extern int redisplaying_p; +extern bool redisplaying_p; extern int help_echo_showing_p; extern int current_mode_line_height, current_header_line_height; extern Lisp_Object help_echo_string, help_echo_window; @@ -3251,9 +3251,12 @@ void x_implicitly_set_name (struct frame *, Lisp_Object, Lisp_Object); extern Lisp_Object tip_frame; extern Window tip_window; +extern frame_parm_handler x_frame_parm_handlers[]; + extern void start_hourglass (void); extern void cancel_hourglass (void); extern int hourglass_shown_p; + struct atimer; /* Defined in atimer.h. */ /* If non-null, an asynchronous timer that, when it expires, displays an hourglass cursor on all frames. */ @@ -3304,7 +3307,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 +3323,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; diff --git a/src/dispnew.c b/src/dispnew.c index 8db4f93dc70..cac4c2da4c4 100644 --- a/src/dispnew.c +++ b/src/dispnew.c @@ -47,17 +47,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include "syssignal.h" -#ifdef HAVE_X_WINDOWS -#include "xterm.h" -#endif /* HAVE_X_WINDOWS */ - -#ifdef HAVE_NTGUI -#include "w32term.h" -#endif /* HAVE_NTGUI */ - -#ifdef HAVE_NS -#include "nsterm.h" -#endif +#ifdef HAVE_WINDOW_SYSTEM +#include TERM_HEADER +#endif /* HAVE_WINDOW_SYSTEM */ /* Include systime.h after xterm.h to avoid double inclusion of time.h. */ @@ -88,7 +80,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 +90,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 +114,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 +138,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 +170,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 +214,14 @@ static int history_idx; history. */ static uprintmax_t history_tick; - -static void add_frame_display_history (struct frame *, int); /* 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 +244,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 +385,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 +421,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 +726,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 +755,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 +841,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 +1097,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 +1149,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 +1248,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 +1367,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 +1548,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 +1625,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 +1633,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 +1691,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 +1906,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 +2039,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 +2455,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 +2506,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 +2679,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 +2776,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 +2884,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 +2907,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 +3140,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 +3267,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 +3291,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 +3444,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 +3460,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 +3490,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 +3678,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 +3736,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 +3758,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 +3832,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 +3923,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 +4079,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 +4182,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 +4208,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 +4221,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 +4480,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 +4543,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 +4578,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 +4682,8 @@ update_frame_1 (struct frame *f, int force_p, int inhibit_id_p) } } - pause_p = (i < FRAME_LINES (f) - 1) ? i : 0; + lint_assume (0 <= FRAME_LINES (f)); + pause_p = 0 < i && i < FRAME_LINES (f) - 1; /* Now just clean up termcap drivers and set cursor, etc. */ if (!pause_p) @@ -4809,7 +4793,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 +4936,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 +5273,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 +5597,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 +5629,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 +5658,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 +5755,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 +5915,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; @@ -6044,8 +6030,7 @@ pass nil for VARIABLE. */) (Lisp_Object variable) { Lisp_Object state, tail, frame, buf; - Lisp_Object *vecp, *end; - ptrdiff_t n; + ptrdiff_t n, idx; if (! NILP (variable)) { @@ -6057,18 +6042,16 @@ pass nil for VARIABLE. */) else state = frame_and_buffer_state; - vecp = XVECTOR (state)->contents; - end = vecp + ASIZE (state); - + idx = 0; FOR_EACH_FRAME (tail, frame) { - if (vecp == end) + if (idx == ASIZE (state)) goto changed; - if (!EQ (*vecp++, frame)) + if (!EQ (AREF (state, idx++), frame)) goto changed; - if (vecp == end) + if (idx == ASIZE (state)) goto changed; - if (!EQ (*vecp++, XFRAME (frame)->name)) + if (!EQ (AREF (state, idx++), XFRAME (frame)->name)) goto changed; } /* Check that the buffer info matches. */ @@ -6078,23 +6061,23 @@ pass nil for VARIABLE. */) /* Ignore buffers that aren't included in buffer lists. */ if (SREF (BVAR (XBUFFER (buf), name), 0) == ' ') continue; - if (vecp == end) + if (idx == ASIZE (state)) goto changed; - if (!EQ (*vecp++, buf)) + if (!EQ (AREF (state, idx++), buf)) goto changed; - if (vecp == end) + if (idx == ASIZE (state)) goto changed; - if (!EQ (*vecp++, BVAR (XBUFFER (buf), read_only))) + if (!EQ (AREF (state, idx++), BVAR (XBUFFER (buf), read_only))) goto changed; - if (vecp == end) + if (idx == ASIZE (state)) goto changed; - if (!EQ (*vecp++, Fbuffer_modified_p (buf))) + if (!EQ (AREF (state, idx++), Fbuffer_modified_p (buf))) goto changed; } - if (vecp == end) + if (idx == ASIZE (state)) goto changed; /* Detect deletion of a buffer at the end of the list. */ - if (EQ (*vecp, Qlambda)) + if (EQ (AREF (state, idx), Qlambda)) return Qnil; /* Come here if we decide the data has changed. */ @@ -6121,11 +6104,13 @@ pass nil for VARIABLE. */) } /* Record the new data in the (possibly reallocated) vector. */ - vecp = XVECTOR (state)->contents; + idx = 0; FOR_EACH_FRAME (tail, frame) { - *vecp++ = frame; - *vecp++ = XFRAME (frame)->name; + ASET (state, idx, frame); + idx++; + ASET (state, idx, XFRAME (frame)->name); + idx++; } for (tail = Vbuffer_alist; CONSP (tail); tail = XCDR (tail)) { @@ -6133,19 +6118,23 @@ pass nil for VARIABLE. */) /* Ignore buffers that aren't included in buffer lists. */ if (SREF (BVAR (XBUFFER (buf), name), 0) == ' ') continue; - *vecp++ = buf; - *vecp++ = BVAR (XBUFFER (buf), read_only); - *vecp++ = Fbuffer_modified_p (buf); + ASET (state, idx, buf); + idx++; + ASET (state, idx, BVAR (XBUFFER (buf), read_only)); + idx++; + ASET (state, idx, Fbuffer_modified_p (buf)); + idx++; } /* Fill up the vector with lambdas (always at least one). */ - *vecp++ = Qlambda; - while (vecp - XVECTOR (state)->contents - < ASIZE (state)) - *vecp++ = Qlambda; + ASET (state, idx, Qlambda); + idx++; + while (idx < ASIZE (state)) + { + ASET (state, idx, Qlambda); + idx++; + } /* Make sure we didn't overflow the vector. */ - if (vecp - XVECTOR (state)->contents - > ASIZE (state)) - abort (); + eassert (idx <= ASIZE (state)); return Qt; } diff --git a/src/doc.c b/src/doc.c index ed311d918d7..02a5b4b8143 100644 --- a/src/doc.c +++ b/src/doc.c @@ -37,7 +37,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ Lisp_Object Qfunction_documentation; -extern Lisp_Object Qclosure; /* Buffer used for reading from documentation file. */ static char *get_doc_string_buffer; static ptrdiff_t get_doc_string_buffer_size; @@ -48,7 +47,7 @@ static unsigned char *read_bytecode_pointer; If UNREADFLAG is 1, we unread a byte. */ int -read_bytecode_char (int unreadflag) +read_bytecode_char (bool unreadflag) { if (unreadflag) { @@ -70,20 +69,18 @@ read_bytecode_char (int unreadflag) (e.g. because the file has been modified and the location is stale), return nil. - If UNIBYTE is nonzero, always make a unibyte string. + If UNIBYTE, always make a unibyte string. - If DEFINITION is nonzero, assume this is for reading + If DEFINITION, assume this is for reading a dynamic function definition; convert the bytestring and the constants vector with appropriate byte handling, and return a cons cell. */ Lisp_Object -get_doc_string (Lisp_Object filepos, int unibyte, int definition) +get_doc_string (Lisp_Object filepos, bool unibyte, bool definition) { - char *from, *to; - register int fd; - register char *name; - register char *p, *p1; + char *from, *to, *name, *p, *p1; + int fd; ptrdiff_t minsize; int offset; EMACS_INT position; @@ -302,7 +299,7 @@ read_doc_string (Lisp_Object filepos) return get_doc_string (filepos, 0, 1); } -static int +static bool reread_doc_file (Lisp_Object file) { #if 0 @@ -335,7 +332,7 @@ string is passed through `substitute-command-keys'. */) Lisp_Object fun; Lisp_Object funcar; Lisp_Object doc; - int try_reload = 1; + bool try_reload = 1; documentation: @@ -467,7 +464,7 @@ This differs from `get' in that it can refer to strings stored in the aren't strings. */) (Lisp_Object symbol, Lisp_Object prop, Lisp_Object raw) { - int try_reload = 1; + bool try_reload = 1; Lisp_Object tem; documentation_property: @@ -562,12 +559,11 @@ the same file name is found in the `doc-directory'. */) { int fd; char buf[1024 + 1]; - register int filled; - register EMACS_INT pos; - register char *p; + int filled; + EMACS_INT pos; Lisp_Object sym; - char *name; - int skip_file = 0; + char *p, *name; + bool skip_file = 0; CHECK_STRING (filename); @@ -722,9 +718,9 @@ Otherwise, return a new string, without any text properties. */) (Lisp_Object string) { char *buf; - int changed = 0; - register unsigned char *strp; - register char *bufp; + bool changed = 0; + unsigned char *strp; + char *bufp; ptrdiff_t idx; ptrdiff_t bsize; Lisp_Object tem; @@ -733,7 +729,7 @@ Otherwise, return a new string, without any text properties. */) ptrdiff_t length, length_byte; Lisp_Object name; struct gcpro gcpro1, gcpro2, gcpro3, gcpro4; - int multibyte; + bool multibyte; ptrdiff_t nchars; if (NILP (string)) @@ -787,7 +783,7 @@ Otherwise, return a new string, without any text properties. */) else if (strp[0] == '\\' && strp[1] == '[') { ptrdiff_t start_idx; - int follow_remap = 1; + bool follow_remap = 1; changed = 1; strp += 2; /* skip \[ */ diff --git a/src/editfns.c b/src/editfns.c index fa57edead28..a14e043c1bf 100644 --- a/src/editfns.c +++ b/src/editfns.c @@ -65,7 +65,7 @@ extern Lisp_Object w32_get_internal_run_time (void); #endif static Lisp_Object format_time_string (char const *, ptrdiff_t, EMACS_TIME, - int, struct tm *); + bool, struct tm *); static int tm_diff (struct tm *, struct tm *); static void update_buffer_properties (ptrdiff_t, ptrdiff_t); @@ -246,11 +246,11 @@ The return value is POSITION. */) /* Return the start or end position of the region. - BEGINNINGP non-zero means return the start. + BEGINNINGP means return the start. If there is no region active, signal an error. */ static Lisp_Object -region_limit (int beginningp) +region_limit (bool beginningp) { Lisp_Object m; @@ -264,7 +264,7 @@ region_limit (int beginningp) error ("The mark is not set now, so there is no region"); /* Clip to the current narrowing (bug#11770). */ - return make_number ((PT < XFASTINT (m)) == (beginningp != 0) + return make_number ((PT < XFASTINT (m)) == beginningp ? PT : clip_to_bounds (BEGV, XFASTINT (m), ZV)); } @@ -435,12 +435,12 @@ get_pos_property (Lisp_Object position, register Lisp_Object prop, Lisp_Object o BEG_LIMIT and END_LIMIT serve to limit the ranged of the returned results; they do not effect boundary behavior. - If MERGE_AT_BOUNDARY is nonzero, then if POS is at the very first + If MERGE_AT_BOUNDARY is non-nil, then if POS is at the very first position of a field, then the beginning of the previous field is returned instead of the beginning of POS's field (since the end of a field is actually also the beginning of the next input field, this behavior is sometimes useful). Additionally in the MERGE_AT_BOUNDARY - true case, if two fields are separated by a field with the special + non-nil case, if two fields are separated by a field with the special value `boundary', and POS lies within it, then the two separated fields are considered to be adjacent, and POS between them, when finding the beginning and ending of the "merged" field. @@ -455,10 +455,10 @@ find_field (Lisp_Object pos, Lisp_Object merge_at_boundary, { /* Fields right before and after the point. */ Lisp_Object before_field, after_field; - /* 1 if POS counts as the start of a field. */ - int at_field_start = 0; - /* 1 if POS counts as the end of a field. */ - int at_field_end = 0; + /* True if POS counts as the start of a field. */ + bool at_field_start = 0; + /* True if POS counts as the end of a field. */ + bool at_field_end = 0; if (NILP (pos)) XSETFASTINT (pos, PT); @@ -502,19 +502,19 @@ find_field (Lisp_Object pos, Lisp_Object merge_at_boundary, xxxx.yyyy - In this situation, if merge_at_boundary is true, we consider the + In this situation, if merge_at_boundary is non-nil, consider the `x' and `y' fields as forming one big merged field, and so the end of the field is the end of `y'. However, if `x' and `y' are separated by a special `boundary' field - (a field with a `field' char-property of 'boundary), then we ignore + (a field with a `field' char-property of 'boundary), then ignore this special field when merging adjacent fields. Here's the same situation, but with a `boundary' field between the `x' and `y' fields: xxx.BBBByyyy Here, if point is at the end of `x', the beginning of `y', or - anywhere in-between (within the `boundary' field), we merge all + anywhere in-between (within the `boundary' field), merge all three fields and consider the beginning as being the beginning of the `x' field, and the end as being the end of the `y' field. */ @@ -658,7 +658,7 @@ Field boundaries are not noticed if `inhibit-field-text-motion' is non-nil. */) { /* If non-zero, then the original point, before re-positioning. */ ptrdiff_t orig_point = 0; - int fwd; + bool fwd; Lisp_Object prev_old, prev_new; if (NILP (new_pos)) @@ -816,8 +816,8 @@ This function does not move point. */) Lisp_Object save_excursion_save (void) { - int visible = (XBUFFER (XWINDOW (selected_window)->buffer) - == current_buffer); + bool visible = (XBUFFER (XWINDOW (selected_window)->buffer) + == current_buffer); return Fcons (Fpoint_marker (), Fcons (Fcopy_marker (BVAR (current_buffer, mark), Qnil), @@ -831,7 +831,7 @@ save_excursion_restore (Lisp_Object info) { Lisp_Object tem, tem1, omark, nmark; struct gcpro gcpro1, gcpro2, gcpro3; - int visible_p; + bool visible_p; tem = Fmarker_buffer (XCAR (info)); /* If buffer being returned to is now deleted, avoid error */ @@ -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)); } DEFUN ("buffer-size", Fbufsize, Sbufsize, 0, 1, 0, @@ -1470,8 +1467,8 @@ make_lisp_time (EMACS_TIME t) /* Decode a Lisp list SPECIFIED_TIME that represents a time. Set *PHIGH, *PLOW, *PUSEC, *PPSEC to its parts; do not check their values. - Return nonzero if successful. */ -static int + Return true if successful. */ +static bool disassemble_lisp_time (Lisp_Object specified_time, Lisp_Object *phigh, Lisp_Object *plow, Lisp_Object *pusec, Lisp_Object *ppsec) @@ -1514,8 +1511,8 @@ disassemble_lisp_time (Lisp_Object specified_time, Lisp_Object *phigh, If *DRESULT is not null, store into *DRESULT the number of seconds since the start of the POSIX Epoch. - Return nonzero if successful. */ -int + Return true if successful. */ +bool decode_time_components (Lisp_Object high, Lisp_Object low, Lisp_Object usec, Lisp_Object psec, EMACS_TIME *result, double *dresult) @@ -1635,7 +1632,7 @@ or (if you need time as a string) `format-time-string'. */) /* Write information into buffer S of size MAXSIZE, according to the FORMAT of length FORMAT_LEN, using time information taken from *TP. - Default to Universal Time if UT is nonzero, local time otherwise. + Default to Universal Time if UT, local time otherwise. Use NS as the number of nanoseconds in the %N directive. Return the number of bytes written, not including the terminating '\0'. If S is NULL, nothing will be written anywhere; so to @@ -1646,7 +1643,7 @@ or (if you need time as a string) `format-time-string'. */) bytes in FORMAT and it does not support nanoseconds. */ static size_t emacs_nmemftime (char *s, size_t maxsize, const char *format, - size_t format_len, const struct tm *tp, int ut, int ns) + size_t format_len, const struct tm *tp, bool ut, int ns) { size_t total = 0; @@ -1751,7 +1748,7 @@ usage: (format-time-string FORMAT-STRING &optional TIME UNIVERSAL) */) static Lisp_Object format_time_string (char const *format, ptrdiff_t formatlen, - EMACS_TIME t, int ut, struct tm *tmp) + EMACS_TIME t, bool ut, struct tm *tmp) { char buffer[4000]; char *buf = buffer; @@ -2231,11 +2228,11 @@ general_insert_function (void (*insert_func) (const char *, ptrdiff_t), void (*insert_from_string_func) (Lisp_Object, ptrdiff_t, ptrdiff_t, - ptrdiff_t, ptrdiff_t, int), - int inherit, ptrdiff_t nargs, Lisp_Object *args) + ptrdiff_t, ptrdiff_t, bool), + bool inherit, ptrdiff_t nargs, Lisp_Object *args) { ptrdiff_t argnum; - register Lisp_Object val; + Lisp_Object val; for (argnum = 0; argnum < nargs; argnum++) { @@ -2458,7 +2455,7 @@ from adjoining text, if those properties are sticky. */) /* Return a Lisp_String containing the text of the current buffer from START to END. If text properties are in use and the current buffer has properties in the range specified, the resulting string will also - have them, if PROPS is nonzero. + have them, if PROPS is true. We don't want to use plain old make_string here, because it calls make_uninit_string, which can cause the buffer arena to be @@ -2469,7 +2466,7 @@ from adjoining text, if those properties are sticky. */) buffer substrings. */ Lisp_Object -make_buffer_string (ptrdiff_t start, ptrdiff_t end, int props) +make_buffer_string (ptrdiff_t start, ptrdiff_t end, bool props) { ptrdiff_t start_byte = CHAR_TO_BYTE (start); ptrdiff_t end_byte = CHAR_TO_BYTE (end); @@ -2482,7 +2479,7 @@ make_buffer_string (ptrdiff_t start, ptrdiff_t end, int props) If text properties are in use and the current buffer has properties in the range specified, the resulting string will also - have them, if PROPS is nonzero. + have them, if PROPS is true. We don't want to use plain old make_string here, because it calls make_uninit_string, which can cause the buffer arena to be @@ -2494,7 +2491,7 @@ make_buffer_string (ptrdiff_t start, ptrdiff_t end, int props) Lisp_Object make_buffer_string_both (ptrdiff_t start, ptrdiff_t start_byte, - ptrdiff_t end, ptrdiff_t end_byte, int props) + ptrdiff_t end, ptrdiff_t end_byte, bool props) { Lisp_Object result, tem, tem1; @@ -2845,7 +2842,8 @@ Both characters must have the same length of multi-byte form. */) #define COMBINING_BOTH (COMBINING_BEFORE | COMBINING_AFTER) int maybe_byte_combining = COMBINING_NO; ptrdiff_t last_changed = 0; - int multibyte_p = !NILP (BVAR (current_buffer, enable_multibyte_characters)); + bool multibyte_p + = !NILP (BVAR (current_buffer, enable_multibyte_characters)); int fromc, toc; restart: @@ -3081,8 +3079,8 @@ It returns the number of characters changed. */) int cnt; /* Number of changes made. */ ptrdiff_t size; /* Size of translate table. */ ptrdiff_t pos, pos_byte, end_pos; - int multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); - int string_multibyte IF_LINT (= 0); + bool multibyte = !NILP (BVAR (current_buffer, enable_multibyte_characters)); + bool string_multibyte IF_LINT (= 0); validate_region (&start, &end); if (CHAR_TABLE_P (table)) @@ -3642,20 +3640,20 @@ usage: (format STRING &rest OBJECTS) */) ptrdiff_t max_bufsize = STRING_BYTES_BOUND + 1; char *p; Lisp_Object buf_save_value IF_LINT (= {0}); - register char *format, *end, *format_start; + char *format, *end, *format_start; ptrdiff_t formatlen, nchars; - /* Nonzero if the format is multibyte. */ - int multibyte_format = 0; - /* Nonzero if the output should be a multibyte string, + /* True if the format is multibyte. */ + bool multibyte_format = 0; + /* True if the output should be a multibyte string, which is true if any of the inputs is one. */ - int multibyte = 0; + bool multibyte = 0; /* When we make a multibyte string, we must pay attention to the byte combining problem, i.e., a byte may be combined with a multibyte character of the previous string. This flag tells if we must consider such a situation or not. */ - int maybe_combine_byte; + bool maybe_combine_byte; Lisp_Object val; - int arg_intervals = 0; + bool arg_intervals = 0; USE_SAFE_ALLOCA; /* discarded[I] is 1 if byte I of the format @@ -3671,8 +3669,8 @@ usage: (format STRING &rest OBJECTS) */) struct info { ptrdiff_t start, end; - int converted_to_string; - int intervals; + unsigned converted_to_string : 1; + unsigned intervals : 1; } *info = 0; /* It should not be necessary to GCPRO ARGS, because @@ -3749,13 +3747,13 @@ usage: (format STRING &rest OBJECTS) */) digits to print after the '.' for floats, or the max. number of chars to print from a string. */ - int minus_flag = 0; - int plus_flag = 0; - int space_flag = 0; - int sharp_flag = 0; - int zero_flag = 0; + bool minus_flag = 0; + bool plus_flag = 0; + bool space_flag = 0; + bool sharp_flag = 0; + bool zero_flag = 0; ptrdiff_t field_width; - int precision_given; + bool precision_given; uintmax_t precision = UINTMAX_MAX; char *num_end; char conversion; @@ -4135,7 +4133,7 @@ usage: (format STRING &rest OBJECTS) */) char *src = sprintf_buf; char src0 = src[0]; int exponent_bytes = 0; - int signedp = src0 == '-' || src0 == '+' || src0 == ' '; + bool signedp = src0 == '-' || src0 == '+' || src0 == ' '; int significand_bytes; if (zero_flag && ((src[signedp] >= '0' && src[signedp] <= '9') diff --git a/src/emacs.c b/src/emacs.c index a039e89d48f..3c814a36043 100644 --- a/src/emacs.c +++ b/src/emacs.c @@ -31,6 +31,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include "lisp.h" +#ifdef HAVE_WINDOW_SYSTEM +#include TERM_HEADER +#endif /* HAVE_WINDOW_SYSTEM */ + #ifdef WINDOWSNT #include <fcntl.h> #include <windows.h> /* just for w32.h */ @@ -62,20 +66,12 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include "gnutls.h" #endif -#ifdef HAVE_NS -#include "nsterm.h" -#endif - #if (defined PROFILING \ && (defined __FreeBSD__ || defined GNU_LINUX || defined __MINGW32__)) # include <sys/gmon.h> extern void moncontrol (int mode); #endif -#ifdef HAVE_X_WINDOWS -#include "xterm.h" -#endif - #ifdef HAVE_SETLOCALE #include <locale.h> #endif @@ -99,10 +95,10 @@ static const char emacs_copyright[] = "Copyright (C) 2012 Free Software Foundati /* Empty lisp strings. To avoid having to build any others. */ Lisp_Object empty_unibyte_string, empty_multibyte_string; -/* Set nonzero after Emacs has started up the first time. - Prevents reinitialization of the Lisp world and keymaps - on subsequent starts. */ -int initialized; +/* Set after Emacs has started up the first time. + Prevents reinitialization of the Lisp world and keymaps + on subsequent starts. */ +bool initialized; #ifdef DARWIN_OS extern void unexec_init_emacs_zone (void); @@ -116,9 +112,9 @@ static void *malloc_state_ptr; extern void *malloc_get_state (void); /* From glibc, a routine that overwrites the malloc internal state. */ extern int malloc_set_state (void*); -/* Non-zero if the MALLOC_CHECK_ environment variable was set while +/* True if the MALLOC_CHECK_ environment variable was set while dumping. Used to work around a bug in glibc's malloc. */ -static int malloc_using_checking; +static bool malloc_using_checking; #endif Lisp_Object Qfile_name_handler_alist; @@ -127,17 +123,17 @@ Lisp_Object Qrisky_local_variable; Lisp_Object Qkill_emacs; -/* If non-zero, Emacs should not attempt to use a window-specific code, +/* If true, Emacs should not attempt to use a window-specific code, but instead should use the virtual terminal under which it was started. */ -int inhibit_window_system; +bool inhibit_window_system; -/* If non-zero, a filter or a sentinel is running. Tested to save the match +/* If true, a filter or a sentinel is running. Tested to save the match data on the first attempt to change it inside asynchronous code. */ -int running_asynch_code; +bool running_asynch_code; #if defined (HAVE_X_WINDOWS) || defined (HAVE_NS) -/* If non-zero, -d was specified, meaning we're using some window system. */ -int display_arg; +/* If true, -d was specified, meaning we're using some window system. */ +bool display_arg; #endif #if defined (DOUG_LEA_MALLOC) || defined (GNU_LINUX) @@ -150,11 +146,11 @@ static void *my_heap_start; static uprintmax_t heap_bss_diff; #endif -/* Nonzero means running Emacs without interactive terminal. */ -int noninteractive; +/* True means running Emacs without interactive terminal. */ +bool noninteractive; -/* Nonzero means remove site-lisp directories from load-path. */ -int no_site_lisp; +/* True means remove site-lisp directories from load-path. */ +bool no_site_lisp; /* Name for the server started by the daemon.*/ static char *daemon_name; @@ -272,13 +268,8 @@ section of the Emacs manual or the file BUGS.\n" /* Signal code for the fatal signal that was received. */ 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); +/* True if handling a fatal error already. */ +bool fatal_error_in_progress; #ifdef FORWARD_SIGNAL_TO_MAIN_THREAD /* When compiled with GTK and running under Gnome, @@ -316,7 +307,7 @@ fatal_error_signal (int sig) if (sig == SIGTERM || sig == SIGHUP || sig == SIGINT) Fkill_emacs (make_number (sig)); - shut_down_emacs (sig, 0, Qnil); + shut_down_emacs (sig, Qnil); } /* Signal the same code; this time it will really be fatal. @@ -327,9 +318,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); } @@ -576,7 +564,7 @@ DEFINE_DUMMY_FUNCTION (__main) Too bad we can't just use getopt for all of this, but we don't have enough information to do it right. */ -static int +static bool argmatch (char **argv, int argc, const char *sstr, const char *lstr, int minlen, char **valptr, int *skipptr) { @@ -680,12 +668,12 @@ int main (int argc, char **argv) { char stack_bottom_variable; - int do_initial_setlocale; + bool do_initial_setlocale; int skip_args = 0; #ifdef HAVE_SETRLIMIT struct rlimit rlim; #endif - int no_loadup = 0; + bool no_loadup = 0; char *junk = 0; char *dname_arg = 0; #ifdef NS_IMPL_COCOA @@ -1280,6 +1268,7 @@ Using an Emacs configured with --with-x-toolkit=lucid does not have this problem init_data (); init_atimer (); running_asynch_code = 0; + init_random (); no_loadup = argmatch (argv, argc, "-nl", "--no-loadup", 6, NULL, &skip_args); @@ -1959,7 +1948,7 @@ all of which are called before Emacs is actually killed. */) x_clipboard_manager_save_all (); #endif - shut_down_emacs (0, 0, STRINGP (arg) ? arg : Qnil); + shut_down_emacs (0, STRINGP (arg) ? arg : Qnil); #ifdef HAVE_NS ns_release_autorelease_pool (ns_pool); @@ -1995,7 +1984,7 @@ all of which are called before Emacs is actually killed. */) and Fkill_emacs. */ void -shut_down_emacs (int sig, int no_x, Lisp_Object stuff) +shut_down_emacs (int sig, Lisp_Object stuff) { /* Prevent running of hooks from now on. */ Vrun_hooks = Qnil; @@ -2030,17 +2019,6 @@ shut_down_emacs (int sig, int no_x, Lisp_Object stuff) unlock_all_files (); #endif -#if 0 /* This triggers a bug in XCloseDisplay and is not needed. */ -#ifdef HAVE_X_WINDOWS - /* It's not safe to call intern here. Maybe we are crashing. */ - if (!noninteractive && SYMBOLP (Vinitial_window_system) - && SCHARS (SYMBOL_NAME (Vinitial_window_system)) == 1 - && SREF (SYMBOL_NAME (Vinitial_window_system), 0) == 'x' - && ! no_x) - Fx_close_current_connection (); -#endif /* HAVE_X_WINDOWS */ -#endif - #ifdef SIGIO /* There is a tendency for a SIGIO signal to arrive within exit, and cause a SIGHUP because the input descriptor is already closed. */ @@ -2232,7 +2210,7 @@ decode_env_path (const char *evarname, const char *defalt) const char *path, *p; Lisp_Object lpath, element, tem; #ifdef WINDOWSNT - int defaulted = 0; + bool defaulted = 0; const char *emacs_dir = egetenv ("emacs_dir"); static const char *emacs_dir_env = "%emacs_dir%/"; const size_t emacs_dir_len = strlen (emacs_dir_env); @@ -2328,7 +2306,7 @@ from the parent process and its tty file descriptors. */) (void) { int nfd; - int err = 0; + bool err = 0; if (!IS_DAEMON) error ("This function can only be called if emacs is run as a daemon"); diff --git a/src/eval.c b/src/eval.c index c7a35fc91af..ecdbe960a8a 100644 --- a/src/eval.c +++ b/src/eval.c @@ -131,7 +131,7 @@ int handling_signal; Lisp_Object inhibit_lisp_code; static Lisp_Object funcall_lambda (Lisp_Object, ptrdiff_t, Lisp_Object *); -static int interactive_p (int); +static bool interactive_p (void); static Lisp_Object apply_lambda (Lisp_Object fun, Lisp_Object args); /* Functions to set Lisp_Object slots of struct specbinding. */ @@ -213,7 +213,7 @@ restore_stack_limits (Lisp_Object data) static Lisp_Object call_debugger (Lisp_Object arg) { - int debug_while_redisplaying; + bool debug_while_redisplaying; ptrdiff_t count = SPECPDL_INDEX (); Lisp_Object val; EMACS_INT old_max = max_specpdl_size; @@ -544,7 +544,7 @@ spec that specifies non-nil unconditionally (such as \"p\"); or (ii) use `called-interactively-p'. */) (void) { - return interactive_p (1) ? Qt : Qnil; + return interactive_p () ? Qt : Qnil; } @@ -563,26 +563,23 @@ thinking of using it for any other purpose, it is quite likely that you're making a mistake. Think: what do you want to do when the command is called from a keyboard macro? -This function is meant for implementing advice and other -function-modifying features. Instead of using this, it is sometimes -cleaner to give your function an extra optional argument whose -`interactive' spec specifies non-nil unconditionally (\"p\" is a good -way to do this), or via (not (or executing-kbd-macro noninteractive)). */) +Instead of using this function, it is sometimes cleaner to give your +function an extra optional argument whose `interactive' spec specifies +non-nil unconditionally (\"p\" is a good way to do this), or via +\(not (or executing-kbd-macro noninteractive)). */) (Lisp_Object kind) { - return ((INTERACTIVE || !EQ (kind, intern ("interactive"))) - && interactive_p (1)) ? Qt : Qnil; + return (((INTERACTIVE || !EQ (kind, intern ("interactive"))) + && interactive_p ()) + ? Qt : Qnil); } -/* Return 1 if function in which this appears was called using - call-interactively. +/* Return true if function in which this appears was called using + call-interactively and is not a built-in. */ - EXCLUDE_SUBRS_P non-zero means always return 0 if the function - called is a built-in. */ - -static int -interactive_p (int exclude_subrs_p) +static bool +interactive_p (void) { struct backtrace *btp; Lisp_Object fun; @@ -611,9 +608,9 @@ interactive_p (int exclude_subrs_p) /* `btp' now points at the frame of the innermost function that isn't a special form, ignoring frames for Finteractive_p and/or Fbytecode at the top. If this frame is for a built-in function - (such as load or eval-region) return nil. */ + (such as load or eval-region) return false. */ fun = Findirect_function (*btp->function, Qnil); - if (exclude_subrs_p && SUBRP (fun)) + if (SUBRP (fun)) return 0; /* `btp' points to the frame of a Lisp function that called interactive-p. @@ -1121,7 +1118,7 @@ internal_catch (Lisp_Object tag, Lisp_Object (*func) (Lisp_Object), Lisp_Object static _Noreturn void unwind_to_catch (struct catchtag *catch, Lisp_Object value) { - int last_time; + bool last_time; /* Save the value in the tag. */ catch->val = value; @@ -1470,8 +1467,8 @@ internal_condition_case_n (Lisp_Object (*bfun) (ptrdiff_t, Lisp_Object *), static Lisp_Object find_handler_clause (Lisp_Object, Lisp_Object); -static int maybe_call_debugger (Lisp_Object conditions, Lisp_Object sig, - Lisp_Object data); +static bool maybe_call_debugger (Lisp_Object conditions, Lisp_Object sig, + Lisp_Object data); void process_quit_flag (void) @@ -1576,7 +1573,7 @@ See also the function `condition-case'. */) if requested". */ || EQ (h->handler, Qerror))) { - int debugger_called + bool debugger_called = maybe_call_debugger (conditions, error_symbol, data); /* We can't return values to code which signaled an error, but we can continue code which has signaled a quit. */ @@ -1670,10 +1667,10 @@ signal_error (const char *s, Lisp_Object arg) } -/* Return nonzero if LIST is a non-nil atom or +/* Return true if LIST is a non-nil atom or a list containing one of CONDITIONS. */ -static int +static bool wants_debugger (Lisp_Object list, Lisp_Object conditions) { if (NILP (list)) @@ -1693,15 +1690,15 @@ wants_debugger (Lisp_Object list, Lisp_Object conditions) return 0; } -/* Return 1 if an error with condition-symbols CONDITIONS, +/* Return true if an error with condition-symbols CONDITIONS, and described by SIGNAL-DATA, should skip the debugger according to debugger-ignored-errors. */ -static int +static bool skip_debugger (Lisp_Object conditions, Lisp_Object data) { Lisp_Object tail; - int first_string = 1; + bool first_string = 1; Lisp_Object error_message; error_message = Qnil; @@ -1736,7 +1733,7 @@ skip_debugger (Lisp_Object conditions, Lisp_Object data) = SIG is the error symbol, and DATA is the rest of the data. = SIG is nil, and DATA is (SYMBOL . REST-OF-DATA). This is for memory-full errors only. */ -static int +static bool maybe_call_debugger (Lisp_Object conditions, Lisp_Object sig, Lisp_Object data) { Lisp_Object combined_data; @@ -2252,7 +2249,6 @@ eval_sub (Lisp_Object form) if (EQ (funcar, Qmacro)) { ptrdiff_t count = SPECPDL_INDEX (); - extern Lisp_Object Qlexical_binding; Lisp_Object exp; /* Bind lexical-binding during expansion of the macro, so the macro can know reliably if the code it outputs will be @@ -2741,33 +2737,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, @@ -2984,7 +2956,7 @@ funcall_lambda (Lisp_Object fun, ptrdiff_t nargs, Lisp_Object val, syms_left, next, lexenv; ptrdiff_t count = SPECPDL_INDEX (); ptrdiff_t i; - int optional, rest; + bool optional, rest; if (CONSP (fun)) { @@ -3470,13 +3442,13 @@ Output stream used is value of `standard-output'. */) write_string ("(", -1); if (backlist->nargs == MANY) { /* FIXME: Can this happen? */ - int i; - for (tail = *backlist->args, i = 0; - !NILP (tail); - tail = Fcdr (tail), i = 1) + bool later_arg = 0; + for (tail = *backlist->args; !NILP (tail); tail = Fcdr (tail)) { - if (i) write_string (" ", -1); + if (later_arg) + write_string (" ", -1); Fprin1 (Fcar (tail), Qnil); + later_arg = 1; } } else diff --git a/src/fileio.c b/src/fileio.c index 2f4a2ad2314..7466914af1c 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -766,7 +766,7 @@ filesystem tree, not (expand-file-name ".." dirname). */) #endif /* DOS_NT */ ptrdiff_t length; Lisp_Object handler, result, handled_name; - int multibyte; + bool multibyte; Lisp_Object hdir; CHECK_STRING (name); @@ -1566,7 +1566,7 @@ those `/' is discarded. */) char *target = NULL; int total = 0; int substituted = 0; - int multibyte; + bool multibyte; char *xnm; Lisp_Object handler; @@ -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; @@ -5306,7 +5306,7 @@ A non-nil CURRENT-ONLY argument means save only current buffer. */) FILE *stream = NULL; ptrdiff_t count = SPECPDL_INDEX (); int orig_minibuffer_auto_raise = minibuffer_auto_raise; - int old_message_p = 0; + bool old_message_p = 0; struct gcpro gcpro1, gcpro2; if (max_specpdl_size < specpdl_size + 40) diff --git a/src/firstfile.c b/src/firstfile.c index 84511cfe0ad..444fb71b55d 100644 --- a/src/firstfile.c +++ b/src/firstfile.c @@ -27,7 +27,6 @@ static char _my_begbss[1]; char * my_begbss_static = _my_begbss; /* Add a dummy reference to ensure emacs.obj is linked in. */ -extern int initialized; -static int * dummy = &initialized; +extern int main (int, char **); +static int (*dummy) (int, char **) = main; #endif - diff --git a/src/fns.c b/src/fns.c index 79f8e233fb5..4d82e4e6e1d 100644 --- a/src/fns.c +++ b/src/fns.c @@ -52,10 +52,6 @@ static Lisp_Object Qcodeset, Qdays, Qmonths, Qpaper; static Lisp_Object Qmd5, Qsha1, Qsha224, Qsha256, Qsha384, Qsha512; static int internal_equal (Lisp_Object , Lisp_Object, int, int); - -#ifndef HAVE_UNISTD_H -extern long time (); -#endif DEFUN ("identity", Fidentity, Sidentity, 1, 1, 0, doc: /* Return the argument unchanged. */) @@ -74,32 +70,16 @@ Other values of LIMIT are ignored. */) (Lisp_Object limit) { EMACS_INT val; - Lisp_Object lispy_val; if (EQ (limit, Qt)) - { - EMACS_TIME t = current_emacs_time (); - seed_random (getpid () ^ EMACS_SECS (t) ^ EMACS_NSECS (t)); - } + init_random (); + else if (STRINGP (limit)) + seed_random (SSDATA (limit), SBYTES (limit)); + val = get_random (); if (NATNUMP (limit) && XFASTINT (limit) != 0) - { - /* Try to take our random number from the higher bits of VAL, - not the lower, since (says Gentzel) the low bits of `random' - are less random than the higher ones. We do this by using the - quotient rather than the remainder. At the high end of the RNG - it's possible to get a quotient larger than n; discarding - these values eliminates the bias that would otherwise appear - when using a large n. */ - EMACS_INT denominator = (INTMASK + 1) / XFASTINT (limit); - do - val = get_random () / denominator; - while (val >= XFASTINT (limit)); - } - else - val = get_random (); - XSETINT (lispy_val, val); - return lispy_val; + val %= XFASTINT (limit); + return make_number (val); } /* Heuristic on how many iterations of a tight loop can be safely done @@ -1100,7 +1080,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); @@ -2139,12 +2119,8 @@ ARRAY is a vector, string, char-table, or bool-vector. */) register ptrdiff_t size, idx; if (VECTORP (array)) - { - register Lisp_Object *p = XVECTOR (array)->contents; - size = ASIZE (array); - for (idx = 0; idx < size; idx++) - p[idx] = item; - } + for (idx = 0, size = ASIZE (array); idx < size; idx++) + ASET (array, idx, item); else if (CHAR_TABLE_P (array)) { int i; @@ -3971,8 +3947,8 @@ sweep_weak_table (struct Lisp_Hash_Table *h, int remove_entries_p) for (idx = HASH_INDEX (h, bucket); !NILP (idx); idx = next) { ptrdiff_t i = XFASTINT (idx); - int key_known_to_survive_p = survives_gc_p (HASH_KEY (h, i)); - int value_known_to_survive_p = survives_gc_p (HASH_VALUE (h, i)); + bool key_known_to_survive_p = survives_gc_p (HASH_KEY (h, i)); + bool value_known_to_survive_p = survives_gc_p (HASH_VALUE (h, i)); int remove_p; if (EQ (h->weak, Qkey)) @@ -4660,13 +4636,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; @@ -4753,8 +4728,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--; diff --git a/src/font.c b/src/font.c index 5b9e4f1cfcf..cf9964f08f3 100644 --- a/src/font.c +++ b/src/font.c @@ -38,17 +38,9 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include "fontset.h" #include "font.h" -#ifdef HAVE_X_WINDOWS -#include "xterm.h" -#endif /* HAVE_X_WINDOWS */ - -#ifdef HAVE_NTGUI -#include "w32term.h" -#endif /* HAVE_NTGUI */ - -#ifdef HAVE_NS -#include "nsterm.h" -#endif /* HAVE_NS */ +#ifdef HAVE_WINDOW_SYSTEM +#include TERM_HEADER +#endif /* HAVE_WINDOW_SYSTEM */ Lisp_Object Qopentype; diff --git a/src/font.h b/src/font.h index 6e9387f7632..3b90bc2ab8a 100644 --- a/src/font.h +++ b/src/font.h @@ -817,6 +817,7 @@ extern struct font_driver xfont_driver; extern void syms_of_xfont (void); extern void syms_of_ftxfont (void); #ifdef HAVE_XFT +extern Lisp_Object Qxft; extern struct font_driver xftfont_driver; extern void syms_of_xftfont (void); #elif defined HAVE_FREETYPE diff --git a/src/fontset.c b/src/fontset.c index c39d68a8ecf..01e38fe45e5 100644 --- a/src/fontset.c +++ b/src/fontset.c @@ -185,8 +185,7 @@ void (*check_window_system_func) (void); /* Prototype declarations for static functions. */ -static Lisp_Object fontset_add (Lisp_Object, Lisp_Object, Lisp_Object, - Lisp_Object); +static void fontset_add (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object); static Lisp_Object fontset_find_font (Lisp_Object, int, struct face *, int, int); static void reorder_font_vector (Lisp_Object, struct font *); @@ -213,27 +212,71 @@ fontset_id_valid_p (int id) /* Return the fontset with ID. No check of ID's validness. */ #define FONTSET_FROM_ID(id) AREF (Vfontset_table, id) -/* Macros to access special values of FONTSET. */ -#define FONTSET_ID(fontset) XCHAR_TABLE (fontset)->extras[0] +/* Access special values of FONTSET. */ -/* Macros to access special values of (base) FONTSET. */ -#define FONTSET_NAME(fontset) XCHAR_TABLE (fontset)->extras[1] -#define FONTSET_ASCII(fontset) XCHAR_TABLE (fontset)->extras[4] -/* #define FONTSET_SPEC(fontset) XCHAR_TABLE (fontset)->extras[5] */ +#define FONTSET_ID(fontset) XCHAR_TABLE (fontset)->extras[0] +static void +set_fontset_id (Lisp_Object fontset, Lisp_Object id) +{ + set_char_table_extras (fontset, 0, id); +} + +/* Access special values of (base) FONTSET. */ + +#define FONTSET_NAME(fontset) XCHAR_TABLE (fontset)->extras[1] +static void +set_fontset_name (Lisp_Object fontset, Lisp_Object name) +{ + set_char_table_extras (fontset, 1, name); +} + +#define FONTSET_ASCII(fontset) XCHAR_TABLE (fontset)->extras[4] +static void +set_fontset_ascii (Lisp_Object fontset, Lisp_Object ascii) +{ + set_char_table_extras (fontset, 4, ascii); +} + +/* Access special values of (realized) FONTSET. */ + +#define FONTSET_BASE(fontset) XCHAR_TABLE (fontset)->extras[2] +static void +set_fontset_base (Lisp_Object fontset, Lisp_Object base) +{ + set_char_table_extras (fontset, 2, base); +} + +#define FONTSET_FRAME(fontset) XCHAR_TABLE (fontset)->extras[3] +static void +set_fontset_frame (Lisp_Object fontset, Lisp_Object frame) +{ + set_char_table_extras (fontset, 3, frame); +} -/* Macros to access special values of (realized) FONTSET. */ -#define FONTSET_BASE(fontset) XCHAR_TABLE (fontset)->extras[2] -#define FONTSET_FRAME(fontset) XCHAR_TABLE (fontset)->extras[3] -/* #define FONTSET_OBJLIST(fontset) XCHAR_TABLE (fontset)->extras[4] */ -#define FONTSET_NOFONT_FACE(fontset) XCHAR_TABLE (fontset)->extras[5] -/* #define FONTSET_REPERTORY(fontset) XCHAR_TABLE (fontset)->extras[6] */ -#define FONTSET_DEFAULT(fontset) XCHAR_TABLE (fontset)->extras[7] +#define FONTSET_NOFONT_FACE(fontset) XCHAR_TABLE (fontset)->extras[5] +static void +set_fontset_nofont_face (Lisp_Object fontset, Lisp_Object face) +{ + set_char_table_extras (fontset, 5, face); +} + +#define FONTSET_DEFAULT(fontset) XCHAR_TABLE (fontset)->extras[7] +static void +set_fontset_default (Lisp_Object fontset, Lisp_Object def) +{ + set_char_table_extras (fontset, 7, def); +} /* For both base and realized fontset. */ -#define FONTSET_FALLBACK(fontset) XCHAR_TABLE (fontset)->extras[8] -#define BASE_FONTSET_P(fontset) (NILP (FONTSET_BASE (fontset))) +#define FONTSET_FALLBACK(fontset) XCHAR_TABLE (fontset)->extras[8] +static void +set_fontset_fallback (Lisp_Object fontset, Lisp_Object fallback) +{ + set_char_table_extras (fontset, 8, fallback); +} +#define BASE_FONTSET_P(fontset) (NILP (FONTSET_BASE (fontset))) /* Macros for FONT-DEF and RFONT-DEF of fontset. */ #define FONT_DEF_NEW(font_def, font_spec, encoding, repertory) \ @@ -265,7 +308,7 @@ fontset_id_valid_p (int id) #define RFONT_DEF_NEW(rfont_def, font_def) \ do { \ (rfont_def) = Fmake_vector (make_number (4), Qnil); \ - ASET ((rfont_def), 1, (font_def)); \ + ASET ((rfont_def), 1, (font_def)); \ RFONT_DEF_SET_SCORE ((rfont_def), 0); \ } while (0) @@ -307,15 +350,17 @@ fontset_ref (Lisp_Object fontset, int c) replace with ELT, if ADD is `prepend', prepend ELT, otherwise, append ELT. */ -#define FONTSET_ADD(fontset, range, elt, add) \ - (NILP (add) \ - ? (NILP (range) \ - ? (FONTSET_FALLBACK (fontset) = Fmake_vector (make_number (1), (elt))) \ - : Fset_char_table_range ((fontset), (range), \ - Fmake_vector (make_number (1), (elt)))) \ +#define FONTSET_ADD(fontset, range, elt, add) \ + (NILP (add) \ + ? (NILP (range) \ + ? (set_fontset_fallback \ + (fontset, Fmake_vector (make_number (1), (elt)))) \ + : ((void) \ + Fset_char_table_range (fontset, range, \ + Fmake_vector (make_number (1), elt)))) \ : fontset_add ((fontset), (range), (elt), (add))) -static Lisp_Object +static void fontset_add (Lisp_Object fontset, Lisp_Object range, Lisp_Object elt, Lisp_Object add) { Lisp_Object args[2]; @@ -341,10 +386,9 @@ fontset_add (Lisp_Object fontset, Lisp_Object range, Lisp_Object elt, Lisp_Objec else { args[idx] = FONTSET_FALLBACK (fontset); - FONTSET_FALLBACK (fontset) - = NILP (args[idx]) ? args[1 - idx] : Fvconcat (2, args); + set_fontset_fallback + (fontset, NILP (args[idx]) ? args[1 - idx] : Fvconcat (2, args)); } - return Qnil; } static int @@ -485,7 +529,7 @@ fontset_get_font_group (Lisp_Object fontset, int c) if (c >= 0) char_table_set_range (fontset, from, to, font_group); else - FONTSET_FALLBACK (fontset) = font_group; + set_fontset_fallback (fontset, font_group); return font_group; } @@ -720,8 +764,9 @@ fontset_font (Lisp_Object fontset, int c, struct face *face, int id) if (! EQ (base_fontset, Vdefault_fontset)) { if (NILP (FONTSET_DEFAULT (fontset))) - FONTSET_DEFAULT (fontset) - = make_fontset (FONTSET_FRAME (fontset), Qnil, Vdefault_fontset); + set_fontset_default + (fontset, + make_fontset (FONTSET_FRAME (fontset), Qnil, Vdefault_fontset)); FONT_DEFERRED_LOG ("default fontset: font for", make_number (c), Qnil); default_rfont_def = fontset_find_font (FONTSET_DEFAULT (fontset), c, face, id, 0); @@ -781,16 +826,14 @@ make_fontset (Lisp_Object frame, Lisp_Object name, Lisp_Object base) fontset = Fmake_char_table (Qfontset, Qnil); - FONTSET_ID (fontset) = make_number (id); + set_fontset_id (fontset, make_number (id)); if (NILP (base)) - { - FONTSET_NAME (fontset) = name; - } + set_fontset_name (fontset, name); else { - FONTSET_NAME (fontset) = Qnil; - FONTSET_FRAME (fontset) = frame; - FONTSET_BASE (fontset) = base; + set_fontset_name (fontset, Qnil); + set_fontset_frame (fontset, frame); + set_fontset_base (fontset, base); } ASET (Vfontset_table, id, fontset); @@ -958,7 +1001,7 @@ face_for_char (FRAME_PTR f, struct face *face, int c, int pos, Lisp_Object objec else { face_id = face_for_font (f, Qnil, face); - FONTSET_NOFONT_FACE (fontset) = make_number (face_id); + set_fontset_nofont_face (fontset, make_number (face_id)); } } eassert (face_id >= 0); @@ -1580,7 +1623,7 @@ appended. By default, FONT-SPEC overrides the previous settings. */) Lisp_Object tail, fr, alist; int fontset_id = XINT (FONTSET_ID (fontset)); - FONTSET_ASCII (fontset) = fontname; + set_fontset_ascii (fontset, fontname); name = FONTSET_NAME (fontset); FOR_EACH_FRAME (tail, fr) { @@ -1658,7 +1701,7 @@ FONT-SPEC is a vector, a cons, or a string. See the documentation of len = font_unparse_xlfd (font_spec, 0, xlfd, 256); if (len < 0) error ("Invalid fontset name (perhaps too long): %s", SDATA (name)); - FONTSET_ASCII (fontset) = make_unibyte_string (xlfd, len); + set_fontset_ascii (fontset, make_unibyte_string (xlfd, len)); } else { @@ -1744,7 +1787,7 @@ fontset_from_font (Lisp_Object font_object) Fset_fontset_font (name, Qnil, font_spec, Qnil, Qnil); } - FONTSET_ASCII (fontset) = font_name; + set_fontset_ascii (fontset, font_name); return XINT (FONTSET_ID (fontset)); } @@ -2161,9 +2204,10 @@ syms_of_fontset (void) Vdefault_fontset = Fmake_char_table (Qfontset, Qnil); staticpro (&Vdefault_fontset); - FONTSET_ID (Vdefault_fontset) = make_number (0); - FONTSET_NAME (Vdefault_fontset) - = build_pure_c_string ("-*-*-*-*-*-*-*-*-*-*-*-*-fontset-default"); + set_fontset_id (Vdefault_fontset, make_number (0)); + set_fontset_name + (Vdefault_fontset, + build_pure_c_string ("-*-*-*-*-*-*-*-*-*-*-*-*-fontset-default")); ASET (Vfontset_table, 0, Vdefault_fontset); next_fontset_id = 1; diff --git a/src/frame.c b/src/frame.c index a00f44a1e5a..968cb4905a2 100644 --- a/src/frame.c +++ b/src/frame.c @@ -30,15 +30,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include "lisp.h" #include "character.h" -#ifdef HAVE_X_WINDOWS -#include "xterm.h" -#endif -#ifdef WINDOWSNT -#include "w32term.h" -#endif -#ifdef HAVE_NS -#include "nsterm.h" -#endif + +#ifdef HAVE_WINDOW_SYSTEM +#include TERM_HEADER +#endif /* HAVE_WINDOW_SYSTEM */ + #include "buffer.h" /* These help us bind and responding to switch-frame events. */ #include "commands.h" @@ -58,11 +54,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include "dosfns.h" #endif - -#ifdef HAVE_WINDOW_SYSTEM - -#endif - #ifdef HAVE_NS Lisp_Object Qns_parse_geometry; #endif @@ -4247,7 +4238,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"); diff --git a/src/frame.h b/src/frame.h index 92fbda42c70..1fe3ebd9182 100644 --- a/src/frame.h +++ b/src/frame.h @@ -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; /* The structure representing a frame. */ @@ -361,7 +361,7 @@ struct frame #endif /* Nonzero if last attempt at redisplay on this frame was preempted. */ - unsigned char display_preempted : 1; + unsigned display_preempted : 1; /* visible is nonzero if the frame is currently displayed; we check it to see if we should bother updating the frame's contents. @@ -391,8 +391,8 @@ struct frame These two are mutually exclusive. They might both be zero, if the frame has been made invisible without an icon. */ - unsigned char visible : 2; - unsigned char iconified : 1; + unsigned visible : 2; + unsigned iconified : 1; /* Let's not use bitfields for volatile variables. */ @@ -406,40 +406,40 @@ struct frame /* True if frame actually has a minibuffer window on it. 0 if using a minibuffer window that isn't on this frame. */ - unsigned char has_minibuffer : 1; + unsigned has_minibuffer : 1; /* 0 means, if this frame has just one window, show no modeline for that window. */ - unsigned char wants_modeline : 1; + unsigned wants_modeline : 1; /* Non-zero if the hardware device this frame is displaying on can support scroll bars. */ char can_have_scroll_bars; /* Non-0 means raise this frame to the top of the heap when selected. */ - unsigned char auto_raise : 1; + unsigned auto_raise : 1; /* Non-0 means lower this frame to the bottom of the stack when left. */ - unsigned char auto_lower : 1; + unsigned auto_lower : 1; /* True if frame's root window can't be split. */ - unsigned char no_split : 1; + unsigned no_split : 1; /* If this is set, then Emacs won't change the frame name to indicate the current buffer, etcetera. If the user explicitly sets the frame name, this gets set. If the user sets the name to Qnil, this is cleared. */ - unsigned char explicit_name : 1; + unsigned explicit_name : 1; /* Nonzero if size of some window on this frame has changed. */ - unsigned char window_sizes_changed : 1; + unsigned window_sizes_changed : 1; /* Nonzero if the mouse has moved on this display device since the last time we checked. */ - unsigned char mouse_moved :1; + unsigned mouse_moved :1; /* Nonzero means that the pointer is invisible. */ - unsigned char pointer_invisible :1; + unsigned pointer_invisible :1; /* If can_have_scroll_bars is non-zero, this is non-zero if we should actually display them on this 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. */ @@ -1196,6 +1206,7 @@ extern Lisp_Object Qrun_hook_with_args; extern void x_set_scroll_bar_default_width (struct frame *); extern void x_set_offset (struct frame *, int, int, int); extern void x_wm_set_icon_position (struct frame *, int, int); +extern void x_wm_set_size_hint (FRAME_PTR f, long flags, int user_position); extern Lisp_Object x_new_font (struct frame *, Lisp_Object, int); @@ -1241,10 +1252,40 @@ extern Lisp_Object display_x_get_resource (Display_Info *, Lisp_Object component, Lisp_Object subclass); +extern void set_frame_menubar (struct frame *f, int first_time, int deep_p); +extern void x_set_window_size (struct frame *f, int change_grav, + int cols, int rows); +extern void x_sync (struct frame *); +extern Lisp_Object x_get_focus_frame (struct frame *); +extern void x_set_mouse_position (struct frame *f, int h, int v); +extern void x_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y); +extern void x_make_frame_visible (struct frame *f); +extern void x_make_frame_invisible (struct frame *f); +extern void x_iconify_frame (struct frame *f); +extern int x_char_width (struct frame *f); +extern int x_char_height (struct frame *f); +extern int x_pixel_width (struct frame *f); +extern int x_pixel_height (struct frame *f); +extern void x_set_frame_alpha (struct frame *f); +extern void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object); +extern void x_set_tool_bar_lines (struct frame *f, + Lisp_Object value, + Lisp_Object oldval); +extern void x_activate_menubar (struct frame *); +extern void x_real_positions (struct frame *, int *, int *); +extern int x_bitmap_icon (struct frame *, Lisp_Object); +extern void x_set_menu_bar_lines (struct frame *, + Lisp_Object, + Lisp_Object); +extern void free_frame_menubar (struct frame *); +extern void x_free_frame_resources (struct frame *); + #if defined HAVE_X_WINDOWS && !defined USE_X_TOOLKIT extern char *x_get_resource_string (const char *, const char *); #endif +extern void x_query_colors (struct frame *f, XColor *, int); + /* In xmenu.c */ extern void set_frame_menubar (FRAME_PTR, int, int); diff --git a/src/gtkutil.c b/src/gtkutil.c index 2941605d448..f0d2c022f0c 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -1348,13 +1348,14 @@ x_wm_set_size_hint (FRAME_PTR f, long int flags, int user_position) size_hints.height_inc = FRAME_LINE_HEIGHT (f); hint_flags |= GDK_HINT_BASE_SIZE; - base_width = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, 0) + FRAME_TOOLBAR_WIDTH (f); - /* Use one row here so base_height does not become zero. + /* Use one row/col here so base_height/width does not become zero. Gtk+ and/or Unity on Ubuntu 12.04 can't handle it. */ + base_width = FRAME_TEXT_COLS_TO_PIXEL_WIDTH (f, 1) + FRAME_TOOLBAR_WIDTH (f); base_height = FRAME_TEXT_LINES_TO_PIXEL_HEIGHT (f, 1) + FRAME_MENUBAR_HEIGHT (f) + FRAME_TOOLBAR_HEIGHT (f); check_frame_size (f, &min_rows, &min_cols); + if (min_cols > 0) --min_cols; /* We used one col in base_width = ... 1); */ if (min_rows > 0) --min_rows; /* We used one row in base_height = ... 1); */ size_hints.base_width = base_width; @@ -2018,11 +2019,6 @@ xg_get_file_name (FRAME_PTR f, #if USE_NEW_GTK_FONT_CHOOSER -extern Lisp_Object Qxft, Qnormal; -extern Lisp_Object Qextra_light, Qlight, Qsemi_light, Qsemi_bold; -extern Lisp_Object Qbold, Qextra_bold, Qultra_bold; -extern Lisp_Object Qoblique, Qitalic; - #define XG_WEIGHT_TO_SYMBOL(w) \ (w <= PANGO_WEIGHT_THIN ? Qextra_light \ : w <= PANGO_WEIGHT_ULTRALIGHT ? Qlight \ @@ -2042,6 +2038,7 @@ extern Lisp_Object Qoblique, Qitalic; static char *x_last_font_name; +extern Lisp_Object Qxft; /* Pop up a GTK font selector and return the name of the font the user selects, as a C string. The returned font name follows GTK's own diff --git a/src/gtkutil.h b/src/gtkutil.h index 462e879d3e7..926478dd728 100644 --- a/src/gtkutil.h +++ b/src/gtkutil.h @@ -25,6 +25,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <gtk/gtk.h> #include "frame.h" +#include "xterm.h" /* Minimum and maximum values used for GTK scroll bars */ @@ -149,9 +150,6 @@ extern GdkCursor * xg_create_default_cursor (Display *dpy); extern int xg_create_frame_widgets (FRAME_PTR f); extern void xg_free_frame_widgets (FRAME_PTR f); -extern void x_wm_set_size_hint (FRAME_PTR f, - long flags, - int user_position); extern void xg_set_background_color (FRAME_PTR f, unsigned long bg); extern int xg_check_special_colors (struct frame *f, const char *color_name, diff --git a/src/image.c b/src/image.c index f2778165ece..3e021677e09 100644 --- a/src/image.c +++ b/src/image.c @@ -50,11 +50,19 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include "termhooks.h" #include "font.h" -#ifdef HAVE_X_WINDOWS -#include "xterm.h" -#include <sys/types.h> +#ifdef HAVE_SYS_STAT_H #include <sys/stat.h> +#endif /* HAVE_SYS_STAT_H */ + +#ifdef HAVE_SYS_TYPES_H +#include <sys/types.h> +#endif /* HAVE_SYS_TYPES_H */ + +#ifdef HAVE_WINDOW_SYSTEM +#include TERM_HEADER +#endif /* HAVE_WINDOW_SYSTEM */ +#ifdef HAVE_X_WINDOWS #define COLOR_TABLE_SUPPORT 1 typedef struct x_bitmap_record Bitmap_Record; @@ -67,11 +75,8 @@ typedef struct x_bitmap_record Bitmap_Record; #define PIX_MASK_DRAW 1 #endif /* HAVE_X_WINDOWS */ - #ifdef HAVE_NTGUI #include "w32.h" -#include "w32term.h" - /* W32_TODO : Color tables on W32. */ #undef COLOR_TABLE_SUPPORT @@ -84,15 +89,9 @@ typedef struct w32_bitmap_record Bitmap_Record; #define PIX_MASK_RETAIN 0 #define PIX_MASK_DRAW 1 -#define FRAME_X_VISUAL(f) FRAME_X_DISPLAY_INFO (f)->visual #define x_defined_color w32_defined_color #define DefaultDepthOfScreen(screen) (one_w32_display_info.n_cbits) -/* Functions from w32term.c that depend on XColor (so can't go in w32term.h - without modifying lots of files). */ -extern void x_query_colors (struct frame *f, XColor *colors, int ncolors); -extern void x_query_color (struct frame *f, XColor *color); - /* Version of libpng that we were compiled with, or -1 if no PNG support was compiled in. This is tested by w32-win.el to correctly set up the alist used to search for PNG libraries. */ @@ -100,10 +99,6 @@ Lisp_Object Qlibpng_version; #endif /* HAVE_NTGUI */ #ifdef HAVE_NS -#include "nsterm.h" -#include <sys/types.h> -#include <sys/stat.h> - #undef COLOR_TABLE_SUPPORT typedef struct ns_bitmap_record Bitmap_Record; @@ -117,10 +112,8 @@ typedef struct ns_bitmap_record Bitmap_Record; #define PIX_MASK_RETAIN 0 #define PIX_MASK_DRAW 1 -#define FRAME_X_VISUAL FRAME_NS_DISPLAY_INFO (f)->visual #define x_defined_color(f, name, color_def, alloc) \ ns_defined_color (f, name, color_def, alloc, 0) -#define FRAME_X_SCREEN(f) 0 #define DefaultDepthOfScreen(screen) x_display_list->n_planes #endif /* HAVE_NS */ @@ -5524,13 +5517,13 @@ init_png_functions (Lisp_Object libraries) #if (PNG_LIBPNG_VER < 10500) -#define PNG_LONGJMP(ptr) (longjmp ((ptr)->jmpbuf, 1)) +#define PNG_LONGJMP(ptr) (_longjmp ((ptr)->jmpbuf, 1)) #define PNG_JMPBUF(ptr) ((ptr)->jmpbuf) #else /* In libpng version 1.5, the jmpbuf member is hidden. (Bug#7908) */ #define PNG_LONGJMP(ptr) (fn_png_longjmp ((ptr), 1)) #define PNG_JMPBUF(ptr) \ - (*fn_png_set_longjmp_fn ((ptr), longjmp, sizeof (jmp_buf))) + (*fn_png_set_longjmp_fn ((ptr), _longjmp, sizeof (jmp_buf))) #endif /* Error and warning handlers installed when the PNG library @@ -5703,7 +5696,7 @@ png_load (struct frame *f, struct image *img) /* Set error jump-back. We come back here when the PNG library detects an error. */ - if (setjmp (PNG_JMPBUF (png_ptr))) + if (_setjmp (PNG_JMPBUF (png_ptr))) { error: if (png_ptr) @@ -6121,7 +6114,7 @@ static _Noreturn void my_error_exit (j_common_ptr cinfo) { struct my_jpeg_error_mgr *mgr = (struct my_jpeg_error_mgr *) cinfo->err; - longjmp (mgr->setjmp_buffer, 1); + _longjmp (mgr->setjmp_buffer, 1); } @@ -6372,7 +6365,7 @@ jpeg_load (struct frame *f, struct image *img) cinfo.err = fn_jpeg_std_error (&mgr.pub); mgr.pub.error_exit = my_error_exit; - if ((rc = setjmp (mgr.setjmp_buffer)) != 0) + if ((rc = _setjmp (mgr.setjmp_buffer)) != 0) { if (rc == 1) { @@ -6418,12 +6411,12 @@ jpeg_load (struct frame *f, struct image *img) if (!check_image_size (f, width, height)) { image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil); - longjmp (mgr.setjmp_buffer, 2); + _longjmp (mgr.setjmp_buffer, 2); } /* Create X image and pixmap. */ if (!x_create_x_image_and_pixmap (f, width, height, 0, &ximg, &img->pixmap)) - longjmp (mgr.setjmp_buffer, 2); + _longjmp (mgr.setjmp_buffer, 2); /* Allocate colors. When color quantization is used, cinfo.actual_number_of_colors has been set with the number of diff --git a/src/insdel.c b/src/insdel.c index 1dceb67bffa..da258c19a1e 100644 --- a/src/insdel.c +++ b/src/insdel.c @@ -31,19 +31,15 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include "blockinput.h" #include "region-cache.h" -static void insert_from_string_1 (Lisp_Object string, - ptrdiff_t pos, ptrdiff_t pos_byte, - ptrdiff_t nchars, ptrdiff_t nbytes, - int inherit, int before_markers); -static void insert_from_buffer_1 (struct buffer *buf, - ptrdiff_t from, ptrdiff_t nchars, - int inherit); -static void gap_left (ptrdiff_t charpos, ptrdiff_t bytepos, int newgap); -static void gap_right (ptrdiff_t charpos, ptrdiff_t bytepos); +static void insert_from_string_1 (Lisp_Object, ptrdiff_t, ptrdiff_t, ptrdiff_t, + ptrdiff_t, bool, bool); +static void insert_from_buffer_1 (struct buffer *, ptrdiff_t, ptrdiff_t, bool); +static void gap_left (ptrdiff_t, ptrdiff_t, bool); +static void gap_right (ptrdiff_t, ptrdiff_t); /* List of elements of the form (BEG-UNCHANGED END-UNCHANGED CHANGE-AMOUNT) describing changes which happened while combine_after_change_calls - was nonzero. We use this to decide how to call them + was non-nil. We use this to decide how to call them once the deferral ends. In each element. @@ -67,8 +63,8 @@ static void signal_before_change (ptrdiff_t, ptrdiff_t, ptrdiff_t *); static void check_markers (void) { - register struct Lisp_Marker *tail; - int multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); + struct Lisp_Marker *tail; + bool multibyte = ! NILP (BVAR (current_buffer, enable_multibyte_characters)); for (tail = BUF_MARKERS (current_buffer); tail; tail = tail->next) { @@ -113,13 +109,13 @@ move_gap_both (ptrdiff_t charpos, ptrdiff_t bytepos) /* Move the gap to a position less than the current GPT. BYTEPOS describes the new position as a byte position, and CHARPOS is the corresponding char position. - If NEWGAP is nonzero, then don't update beg_unchanged and end_unchanged. */ + If NEWGAP, then don't update beg_unchanged and end_unchanged. */ static void -gap_left (ptrdiff_t charpos, ptrdiff_t bytepos, int newgap) +gap_left (ptrdiff_t charpos, ptrdiff_t bytepos, bool newgap) { - register unsigned char *to, *from; - register ptrdiff_t i; + unsigned char *to, *from; + ptrdiff_t i; ptrdiff_t new_s1; if (!newgap) @@ -287,10 +283,10 @@ adjust_markers_for_delete (ptrdiff_t from, ptrdiff_t from_byte, static void adjust_markers_for_insert (ptrdiff_t from, ptrdiff_t from_byte, - ptrdiff_t to, ptrdiff_t to_byte, int before_markers) + ptrdiff_t to, ptrdiff_t to_byte, bool before_markers) { struct Lisp_Marker *m; - int adjusted = 0; + bool adjusted = 0; ptrdiff_t nchars = to - from; ptrdiff_t nbytes = to_byte - from_byte; @@ -515,7 +511,7 @@ make_gap (ptrdiff_t nbytes_added) ptrdiff_t copy_text (const unsigned char *from_addr, unsigned char *to_addr, - ptrdiff_t nbytes, int from_multibyte, int to_multibyte) + ptrdiff_t nbytes, bool from_multibyte, bool to_multibyte) { if (from_multibyte == to_multibyte) { @@ -664,7 +660,7 @@ insert_before_markers_and_inherit (const char *string, void insert_1 (const char *string, ptrdiff_t nbytes, - int inherit, int prepare, int before_markers) + bool inherit, bool prepare, bool before_markers) { insert_1_both (string, chars_in_text ((unsigned char *) string, nbytes), nbytes, inherit, prepare, before_markers); @@ -790,7 +786,7 @@ count_combining_after (const unsigned char *string, void insert_1_both (const char *string, ptrdiff_t nchars, ptrdiff_t nbytes, - int inherit, int prepare, int before_markers) + bool inherit, bool prepare, bool before_markers) { if (nchars == 0) return; @@ -867,7 +863,7 @@ insert_1_both (const char *string, void insert_from_string (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte, - ptrdiff_t length, ptrdiff_t length_byte, int inherit) + ptrdiff_t length, ptrdiff_t length_byte, bool inherit) { ptrdiff_t opoint = PT; @@ -887,7 +883,7 @@ void insert_from_string_before_markers (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte, ptrdiff_t length, ptrdiff_t length_byte, - int inherit) + bool inherit) { ptrdiff_t opoint = PT; @@ -905,7 +901,7 @@ insert_from_string_before_markers (Lisp_Object string, static void insert_from_string_1 (Lisp_Object string, ptrdiff_t pos, ptrdiff_t pos_byte, ptrdiff_t nchars, ptrdiff_t nbytes, - int inherit, int before_markers) + bool inherit, bool before_markers) { struct gcpro gcpro1; ptrdiff_t outgoing_nbytes = nbytes; @@ -1039,7 +1035,7 @@ insert_from_gap (ptrdiff_t nchars, ptrdiff_t nbytes) void insert_from_buffer (struct buffer *buf, - ptrdiff_t charpos, ptrdiff_t nchars, int inherit) + ptrdiff_t charpos, ptrdiff_t nchars, bool inherit) { ptrdiff_t opoint = PT; @@ -1050,7 +1046,7 @@ insert_from_buffer (struct buffer *buf, static void insert_from_buffer_1 (struct buffer *buf, - ptrdiff_t from, ptrdiff_t nchars, int inherit) + ptrdiff_t from, ptrdiff_t nchars, bool inherit) { ptrdiff_t chunk, chunk_expanded; ptrdiff_t from_byte = buf_charpos_to_bytepos (buf, from); @@ -1265,7 +1261,7 @@ adjust_after_insert (ptrdiff_t from, ptrdiff_t from_byte, } /* Replace the text from character positions FROM to TO with NEW, - If PREPARE is nonzero, call prepare_to_modify_buffer. + If PREPARE, call prepare_to_modify_buffer. If INHERIT, the newly inserted text should inherit text properties from the surrounding non-deleted text. */ @@ -1278,7 +1274,7 @@ adjust_after_insert (ptrdiff_t from, ptrdiff_t from_byte, void replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object new, - int prepare, int inherit, int markers) + bool prepare, bool inherit, bool markers) { ptrdiff_t inschars = SCHARS (new); ptrdiff_t insbytes = SBYTES (new); @@ -1443,7 +1439,7 @@ replace_range (ptrdiff_t from, ptrdiff_t to, Lisp_Object new, Note that this does not yet handle markers quite right. - If MARKERS is nonzero, relocate markers. + If MARKERS, relocate markers. Unlike most functions at this level, never call prepare_to_modify_buffer and never call signal_after_change. */ @@ -1452,7 +1448,7 @@ void replace_range_2 (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t to, ptrdiff_t to_byte, const char *ins, ptrdiff_t inschars, ptrdiff_t insbytes, - int markers) + bool markers) { ptrdiff_t nbytes_del, nchars_del; @@ -1563,7 +1559,7 @@ del_range (ptrdiff_t from, ptrdiff_t to) RET_STRING says to return the deleted text. */ Lisp_Object -del_range_1 (ptrdiff_t from, ptrdiff_t to, int prepare, int ret_string) +del_range_1 (ptrdiff_t from, ptrdiff_t to, bool prepare, bool ret_string) { ptrdiff_t from_byte, to_byte; Lisp_Object deletion; @@ -1599,7 +1595,7 @@ del_range_1 (ptrdiff_t from, ptrdiff_t to, int prepare, int ret_string) /* Like del_range_1 but args are byte positions, not char positions. */ void -del_range_byte (ptrdiff_t from_byte, ptrdiff_t to_byte, int prepare) +del_range_byte (ptrdiff_t from_byte, ptrdiff_t to_byte, bool prepare) { ptrdiff_t from, to; @@ -1643,7 +1639,7 @@ del_range_byte (ptrdiff_t from_byte, ptrdiff_t to_byte, int prepare) void del_range_both (ptrdiff_t from, ptrdiff_t from_byte, - ptrdiff_t to, ptrdiff_t to_byte, int prepare) + ptrdiff_t to, ptrdiff_t to_byte, bool prepare) { /* Make args be valid */ if (from_byte < BEGV_BYTE) @@ -1685,13 +1681,13 @@ del_range_both (ptrdiff_t from, ptrdiff_t from_byte, /* Delete a range of text, specified both as character positions and byte positions. FROM and TO are character positions, while FROM_BYTE and TO_BYTE are byte positions. - If RET_STRING is true, the deleted area is returned as a string. */ + If RET_STRING, the deleted area is returned as a string. */ Lisp_Object del_range_2 (ptrdiff_t from, ptrdiff_t from_byte, - ptrdiff_t to, ptrdiff_t to_byte, int ret_string) + ptrdiff_t to, ptrdiff_t to_byte, bool ret_string) { - register ptrdiff_t nbytes_del, nchars_del; + ptrdiff_t nbytes_del, nchars_del; Lisp_Object deletion; check_markers (); @@ -1770,17 +1766,16 @@ del_range_2 (ptrdiff_t from, ptrdiff_t from_byte, and warns the next redisplay that it should pay attention to that area. - If PRESERVE_CHARS_MODIFF is non-zero, do not update CHARS_MODIFF. + If PRESERVE_CHARS_MODIFF, do not update CHARS_MODIFF. Otherwise set CHARS_MODIFF to the new value of MODIFF. */ void modify_region (struct buffer *buffer, ptrdiff_t start, ptrdiff_t end, - int preserve_chars_modiff) + bool preserve_chars_modiff) { 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 +1789,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); } /* Check that it is okay to modify the buffer between START and END, @@ -2119,7 +2113,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); diff --git a/src/intervals.c b/src/intervals.c index 0a85e20e5d9..49d61b2f9b0 100644 --- a/src/intervals.c +++ b/src/intervals.c @@ -178,14 +178,13 @@ merge_properties (register INTERVAL source, register INTERVAL target) } } -/* Return 1 if the two intervals have the same properties, - 0 otherwise. */ +/* Return true if the two intervals have the same properties. */ -int +bool intervals_equal (INTERVAL i0, INTERVAL i1) { - register Lisp_Object i0_cdr, i0_sym; - register Lisp_Object i1_cdr, i1_val; + Lisp_Object i0_cdr, i0_sym; + Lisp_Object i1_cdr, i1_val; if (DEFAULT_INTERVAL_P (i0) && DEFAULT_INTERVAL_P (i1)) return 1; @@ -469,10 +468,10 @@ balance_an_interval (INTERVAL i) Lisp Object. */ static inline INTERVAL -balance_possible_root_interval (register INTERVAL interval) +balance_possible_root_interval (INTERVAL interval) { Lisp_Object parent; - int have_parent = 0; + bool have_parent = 0; if (!INTERVAL_HAS_OBJECT (interval) && !INTERVAL_HAS_PARENT (interval)) return interval; @@ -845,9 +844,9 @@ static INTERVAL adjust_intervals_for_insertion (INTERVAL tree, ptrdiff_t position, ptrdiff_t length) { - register INTERVAL i; - register INTERVAL temp; - int eobp = 0; + INTERVAL i; + INTERVAL temp; + bool eobp = 0; Lisp_Object parent; ptrdiff_t offset; @@ -1068,11 +1067,10 @@ FR 8 9 A B static Lisp_Object merge_properties_sticky (Lisp_Object pleft, Lisp_Object pright) { - register Lisp_Object props, front, rear; + Lisp_Object props, front, rear; Lisp_Object lfront, lrear, rfront, rrear; - register Lisp_Object tail1, tail2, sym, lval, rval, cat; - int use_left, use_right; - int lpresent; + Lisp_Object tail1, tail2, sym, lval, rval, cat; + bool use_left, use_right, lpresent; props = Qnil; front = Qnil; @@ -1610,7 +1608,7 @@ reproduce_tree_obj (INTERVAL source, Lisp_Object parent) void graft_intervals_into_buffer (INTERVAL source, ptrdiff_t position, ptrdiff_t length, struct buffer *buffer, - int inherit) + bool inherit) { INTERVAL tree = buffer_intervals (buffer); INTERVAL under, over, this; @@ -1753,9 +1751,9 @@ textget (Lisp_Object plist, register Lisp_Object prop) } Lisp_Object -lookup_char_property (Lisp_Object plist, register Lisp_Object prop, int textprop) +lookup_char_property (Lisp_Object plist, Lisp_Object prop, bool textprop) { - register Lisp_Object tail, fallback = Qnil; + Lisp_Object tail, fallback = Qnil; for (tail = plist; CONSP (tail); tail = Fcdr (XCDR (tail))) { @@ -1826,8 +1824,8 @@ set_point (ptrdiff_t charpos) /* If there's an invisible character at position POS + TEST_OFFS in the current buffer, and the invisible property has a `stickiness' such that inserting a character at position POS would inherit the property it, - return POS + ADJ, otherwise return POS. If TEST_INTANG is non-zero, - then intangibility is required as well as invisibility. + return POS + ADJ, otherwise return POS. If TEST_INTANG, intangibility + is required as well as invisibility. TEST_OFFS should be either 0 or -1, and ADJ should be either 1 or -1. @@ -1836,7 +1834,7 @@ set_point (ptrdiff_t charpos) static ptrdiff_t adjust_for_invis_intang (ptrdiff_t pos, ptrdiff_t test_offs, ptrdiff_t adj, - int test_intang) + bool test_intang) { Lisp_Object invis_propval, invis_overlay; Lisp_Object test_pos; @@ -1883,8 +1881,8 @@ set_point_both (ptrdiff_t charpos, ptrdiff_t bytepos) initial position is the same as the destination, in the rare instances where this is important, e.g. in line-move-finish (simple.el). */ - int backwards = (charpos < old_position ? 1 : 0); - int have_overlays; + bool backwards = charpos < old_position; + bool have_overlays; ptrdiff_t original_position; bset_point_before_scroll (current_buffer, Qnil); @@ -2154,12 +2152,12 @@ move_if_not_intangible (ptrdiff_t position) /* If text at position POS has property PROP, set *VAL to the property value, *START and *END to the beginning and end of a region that - has the same property, and return 1. Otherwise return 0. + has the same property, and return true. Otherwise return false. OBJECT is the string or buffer to look for the property in; nil means the current buffer. */ -int +bool get_property_and_range (ptrdiff_t pos, Lisp_Object prop, Lisp_Object *val, ptrdiff_t *start, ptrdiff_t *end, Lisp_Object object) { @@ -2306,10 +2304,10 @@ copy_intervals_to_string (Lisp_Object string, struct buffer *buffer, set_string_intervals (string, interval_copy); } -/* Return 1 if strings S1 and S2 have identical properties; 0 otherwise. +/* Return true if strings S1 and S2 have identical properties. Assume they have identical characters. */ -int +bool compare_string_intervals (Lisp_Object s1, Lisp_Object s2) { INTERVAL i1, i2; @@ -2348,7 +2346,7 @@ compare_string_intervals (Lisp_Object s1, Lisp_Object s2) START_BYTE ... END_BYTE in bytes. */ static void -set_intervals_multibyte_1 (INTERVAL i, int multi_flag, +set_intervals_multibyte_1 (INTERVAL i, bool multi_flag, ptrdiff_t start, ptrdiff_t start_byte, ptrdiff_t end, ptrdiff_t end_byte) { @@ -2456,11 +2454,11 @@ set_intervals_multibyte_1 (INTERVAL i, int multi_flag, } /* Update the intervals of the current buffer - to fit the contents as multibyte (if MULTI_FLAG is 1) - or to fit them as non-multibyte (if MULTI_FLAG is 0). */ + to fit the contents as multibyte (if MULTI_FLAG) + or to fit them as non-multibyte (if not MULTI_FLAG). */ void -set_intervals_multibyte (int multi_flag) +set_intervals_multibyte (bool multi_flag) { INTERVAL i = buffer_intervals (current_buffer); diff --git a/src/intervals.h b/src/intervals.h index 01e72d7c9db..2b30101d0fa 100644 --- a/src/intervals.h +++ b/src/intervals.h @@ -227,7 +227,7 @@ extern INTERVAL make_interval (void); extern INTERVAL create_root_interval (Lisp_Object); extern void copy_properties (INTERVAL, INTERVAL); -extern int intervals_equal (INTERVAL, INTERVAL); +extern bool intervals_equal (INTERVAL, INTERVAL); extern void traverse_intervals (INTERVAL, ptrdiff_t, void (*) (INTERVAL, Lisp_Object), Lisp_Object); @@ -242,22 +242,22 @@ extern INTERVAL previous_interval (INTERVAL); extern INTERVAL merge_interval_left (INTERVAL); extern void offset_intervals (struct buffer *, ptrdiff_t, ptrdiff_t); extern void graft_intervals_into_buffer (INTERVAL, ptrdiff_t, ptrdiff_t, - struct buffer *, int); + struct buffer *, bool); extern void verify_interval_modification (struct buffer *, ptrdiff_t, ptrdiff_t); extern INTERVAL balance_intervals (INTERVAL); extern void copy_intervals_to_string (Lisp_Object, struct buffer *, ptrdiff_t, ptrdiff_t); extern INTERVAL copy_intervals (INTERVAL, ptrdiff_t, ptrdiff_t); -extern int compare_string_intervals (Lisp_Object, Lisp_Object); +extern bool compare_string_intervals (Lisp_Object, Lisp_Object); extern Lisp_Object textget (Lisp_Object, Lisp_Object); -extern Lisp_Object lookup_char_property (Lisp_Object, Lisp_Object, int); +extern Lisp_Object lookup_char_property (Lisp_Object, Lisp_Object, bool); extern void move_if_not_intangible (ptrdiff_t); -extern int get_property_and_range (ptrdiff_t, Lisp_Object, Lisp_Object *, - ptrdiff_t *, ptrdiff_t *, Lisp_Object); +extern bool get_property_and_range (ptrdiff_t, Lisp_Object, Lisp_Object *, + ptrdiff_t *, ptrdiff_t *, Lisp_Object); extern Lisp_Object get_local_map (ptrdiff_t, struct buffer *, Lisp_Object); extern INTERVAL update_interval (INTERVAL, ptrdiff_t); -extern void set_intervals_multibyte (int); +extern void set_intervals_multibyte (bool); extern INTERVAL validate_interval_range (Lisp_Object, Lisp_Object *, Lisp_Object *, int); extern INTERVAL interval_of (ptrdiff_t, Lisp_Object); diff --git a/src/keyboard.c b/src/keyboard.c index 868d0c8d2c1..464c3ae0d66 100644 --- a/src/keyboard.c +++ b/src/keyboard.c @@ -63,20 +63,11 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include <unistd.h> #include <fcntl.h> -/* This is to get the definitions of the XK_ symbols. */ -#ifdef HAVE_X_WINDOWS -#include "xterm.h" -#endif - -#ifdef HAVE_NTGUI -#include "w32term.h" -#endif /* HAVE_NTGUI */ - -#ifdef HAVE_NS -#include "nsterm.h" -#endif +#ifdef HAVE_WINDOW_SYSTEM +#include TERM_HEADER +#endif /* HAVE_WINDOW_SYSTEM */ -/* Variables for blockinput.h: */ +/* Variables for blockinput.h: */ /* Non-zero if interrupt input is blocked right now. */ volatile int interrupt_input_blocked; @@ -1434,8 +1425,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 +1503,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; @@ -4350,9 +4339,8 @@ struct input_event last_timer_event EXTERNALLY_VISIBLE; ...). Each element has the form (FUN . ARGS). */ Lisp_Object pending_funcalls; -/* If TIMER is a valid timer, return nonzero and place its value into - *RESULT. Otherwise return zero. */ -static int +/* Return true if TIMER is a valid timer, placing its value into *RESULT. */ +static bool decode_timer (Lisp_Object timer, EMACS_TIME *result) { Lisp_Object *vector; @@ -4419,7 +4407,6 @@ timer_check_2 (void) while (CONSP (timers) || CONSP (idle_timers)) { - Lisp_Object *vector; Lisp_Object timer = Qnil, idle_timer = Qnil; EMACS_TIME timer_time, idle_timer_time; EMACS_TIME difference; @@ -4495,15 +4482,14 @@ timer_check_2 (void) /* If timer is ripe, run it if it hasn't been run. */ if (ripe) { - vector = XVECTOR (chosen_timer)->contents; - if (NILP (vector[0])) + if (NILP (AREF (chosen_timer, 0))) { ptrdiff_t count = SPECPDL_INDEX (); Lisp_Object old_deactivate_mark = Vdeactivate_mark; /* Mark the timer as triggered to prevent problems if the lisp code fails to reschedule it right. */ - vector[0] = Qt; + ASET (chosen_timer, 0, Qt); specbind (Qinhibit_quit, Qt); @@ -8447,7 +8433,6 @@ init_tool_bar_items (Lisp_Object reuse) static void append_tool_bar_item (void) { - Lisp_Object *to, *from; ptrdiff_t incr = (ntool_bar_items - (ASIZE (tool_bar_items_vector) - TOOL_BAR_ITEM_NSLOTS)); @@ -8459,9 +8444,8 @@ append_tool_bar_item (void) /* Append entries from tool_bar_item_properties to the end of tool_bar_items_vector. */ - to = XVECTOR (tool_bar_items_vector)->contents + ntool_bar_items; - from = XVECTOR (tool_bar_item_properties)->contents; - memcpy (to, from, TOOL_BAR_ITEM_NSLOTS * sizeof *to); + vcopy (tool_bar_items_vector, ntool_bar_items, + XVECTOR (tool_bar_item_properties)->contents, TOOL_BAR_ITEM_NSLOTS); ntool_bar_items += TOOL_BAR_ITEM_NSLOTS; } @@ -9578,7 +9562,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); @@ -10490,10 +10474,10 @@ DEFUN ("recent-keys", Frecent_keys, Srecent_keys, 0, 0, 0, else { val = Fvector (NUM_RECENT_KEYS, keys); - memcpy (XVECTOR (val)->contents, keys + recent_keys_index, - (NUM_RECENT_KEYS - recent_keys_index) * word_size); - memcpy (XVECTOR (val)->contents + NUM_RECENT_KEYS - recent_keys_index, - keys, recent_keys_index * word_size); + vcopy (val, 0, keys + recent_keys_index, + NUM_RECENT_KEYS - recent_keys_index); + vcopy (val, NUM_RECENT_KEYS - recent_keys_index, + keys, recent_keys_index); return val; } } @@ -11255,7 +11239,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) diff --git a/src/keymap.c b/src/keymap.c index 21f7dcb5d37..85c384b8180 100644 --- a/src/keymap.c +++ b/src/keymap.c @@ -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)); } } @@ -2159,7 +2157,7 @@ The `kbd' macro is an approximate inverse of this. */) char * push_key_description (EMACS_INT ch, char *p, int force_multibyte) { - int c, c2; + int c, c2, tab_as_ci; /* Clear all the meaningless bits above the meta bit. */ c = ch & (meta_modifier | ~ - meta_modifier); @@ -2173,6 +2171,8 @@ push_key_description (EMACS_INT ch, char *p, int force_multibyte) return p; } + tab_as_ci = (c2 == '\t' && (c & meta_modifier)); + if (c & alt_modifier) { *p++ = 'A'; @@ -2180,7 +2180,8 @@ push_key_description (EMACS_INT ch, char *p, int force_multibyte) c -= alt_modifier; } if ((c & ctrl_modifier) != 0 - || (c2 < ' ' && c2 != 27 && c2 != '\t' && c2 != Ctl ('M'))) + || (c2 < ' ' && c2 != 27 && c2 != '\t' && c2 != Ctl ('M')) + || tab_as_ci) { *p++ = 'C'; *p++ = '-'; @@ -2218,6 +2219,10 @@ push_key_description (EMACS_INT ch, char *p, int force_multibyte) *p++ = 'S'; *p++ = 'C'; } + else if (tab_as_ci) + { + *p++ = 'i'; + } else if (c == '\t') { *p++ = 'T'; diff --git a/src/lisp.h b/src/lisp.h index 5c7e8dc2f82..07a3ae17469 100644 --- a/src/lisp.h +++ b/src/lisp.h @@ -126,7 +126,7 @@ extern _Noreturn void die (const char *, const char *, int); eassert macro altogether, e.g., if XSTRING (x) uses eassert to test STRINGP (x), but a particular use of XSTRING is invoked only after testing that STRINGP (x) is true, making the test redundant. */ -extern int suppress_checking EXTERNALLY_VISIBLE; +extern bool suppress_checking EXTERNALLY_VISIBLE; # define eassert(cond) \ ((cond) || suppress_checking \ @@ -617,10 +617,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. */ @@ -713,7 +711,7 @@ struct Lisp_Cons #define CDR_SAFE(c) \ (CONSP ((c)) ? XCDR ((c)) : Qnil) -/* Nonzero if STR is a multibyte string. */ +/* True if STR is a multibyte string. */ #define STRING_MULTIBYTE(STR) \ (XSTRING (STR)->size_byte >= 0) @@ -1929,11 +1927,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. */ @@ -2357,6 +2351,17 @@ gc_aset (Lisp_Object array, ptrdiff_t idx, Lisp_Object val) XVECTOR (array)->contents[idx] = val; } +/* Copy COUNT Lisp_Objects from ARGS to contents of V starting from OFFSET. */ + +LISP_INLINE void +vcopy (Lisp_Object v, ptrdiff_t offset, Lisp_Object *args, ptrdiff_t count) +{ + eassert (0 <= offset && 0 <= count && offset + count <= ASIZE (v)); + memcpy (XVECTOR (v)->contents + offset, args, count * sizeof *args); +} + +/* Functions to modify hash tables. */ + LISP_INLINE void set_hash_key_and_value (struct Lisp_Hash_Table *h, Lisp_Object key_and_value) { @@ -2582,8 +2587,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; @@ -2630,7 +2634,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 *); @@ -2642,7 +2646,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); @@ -2730,43 +2734,43 @@ extern void move_gap_both (ptrdiff_t, ptrdiff_t); extern _Noreturn void buffer_overflow (void); extern void make_gap (ptrdiff_t); extern ptrdiff_t copy_text (const unsigned char *, unsigned char *, - ptrdiff_t, int, int); + ptrdiff_t, bool, bool); extern int count_combining_before (const unsigned char *, ptrdiff_t, ptrdiff_t, ptrdiff_t); extern int count_combining_after (const unsigned char *, ptrdiff_t, ptrdiff_t, ptrdiff_t); extern void insert (const char *, ptrdiff_t); extern void insert_and_inherit (const char *, ptrdiff_t); -extern void insert_1 (const char *, ptrdiff_t, int, int, int); +extern void insert_1 (const char *, ptrdiff_t, bool, bool, bool); extern void insert_1_both (const char *, ptrdiff_t, ptrdiff_t, - int, int, int); + bool, bool, bool); extern void insert_from_gap (ptrdiff_t, ptrdiff_t); extern void insert_from_string (Lisp_Object, ptrdiff_t, ptrdiff_t, - ptrdiff_t, ptrdiff_t, int); -extern void insert_from_buffer (struct buffer *, ptrdiff_t, ptrdiff_t, int); + ptrdiff_t, ptrdiff_t, bool); +extern void insert_from_buffer (struct buffer *, ptrdiff_t, ptrdiff_t, bool); extern void insert_char (int); extern void insert_string (const char *); extern void insert_before_markers (const char *, ptrdiff_t); extern void insert_before_markers_and_inherit (const char *, ptrdiff_t); extern void insert_from_string_before_markers (Lisp_Object, ptrdiff_t, ptrdiff_t, ptrdiff_t, - ptrdiff_t, int); + ptrdiff_t, bool); extern void del_range (ptrdiff_t, ptrdiff_t); -extern Lisp_Object del_range_1 (ptrdiff_t, ptrdiff_t, int, int); -extern void del_range_byte (ptrdiff_t, ptrdiff_t, int); -extern void del_range_both (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t, int); +extern Lisp_Object del_range_1 (ptrdiff_t, ptrdiff_t, bool, bool); +extern void del_range_byte (ptrdiff_t, ptrdiff_t, bool); +extern void del_range_both (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t, bool); extern Lisp_Object del_range_2 (ptrdiff_t, ptrdiff_t, - ptrdiff_t, ptrdiff_t, int); -extern void modify_region (struct buffer *, ptrdiff_t, ptrdiff_t, int); + ptrdiff_t, ptrdiff_t, bool); +extern void modify_region (struct buffer *, ptrdiff_t, ptrdiff_t, bool); extern void prepare_to_modify_buffer (ptrdiff_t, ptrdiff_t, ptrdiff_t *); extern void signal_after_change (ptrdiff_t, ptrdiff_t, ptrdiff_t); extern void adjust_after_insert (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t); extern void adjust_markers_for_delete (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t); -extern void replace_range (ptrdiff_t, ptrdiff_t, Lisp_Object, int, int, int); +extern void replace_range (ptrdiff_t, ptrdiff_t, Lisp_Object, bool, bool, bool); extern void replace_range_2 (ptrdiff_t, ptrdiff_t, ptrdiff_t, ptrdiff_t, - const char *, ptrdiff_t, ptrdiff_t, int); + const char *, ptrdiff_t, ptrdiff_t, bool); extern void syms_of_insdel (void); /* Defined in dispnew.c */ @@ -2776,7 +2780,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); @@ -2802,7 +2806,7 @@ extern Lisp_Object echo_area_buffer[2]; extern void add_to_log (const char *, Lisp_Object, Lisp_Object); extern void check_message_stack (void); extern void setup_echo_area_for_printing (int); -extern int push_message (void); +extern bool push_message (void); extern Lisp_Object pop_message_unwind (Lisp_Object); extern Lisp_Object restore_message_unwind (Lisp_Object); extern void restore_message (void); @@ -2845,7 +2849,7 @@ extern void uninterrupt_malloc (void); extern void malloc_warning (const char *); extern _Noreturn void memory_full (size_t); extern _Noreturn void buffer_memory_full (ptrdiff_t); -extern int survives_gc_p (Lisp_Object); +extern bool survives_gc_p (Lisp_Object); extern void mark_object (Lisp_Object); #if defined REL_ALLOC && !defined SYSTEM_MALLOC extern void refill_memory_reserve (void); @@ -2887,8 +2891,8 @@ extern Lisp_Object make_uninit_string (EMACS_INT); extern Lisp_Object make_uninit_multibyte_string (EMACS_INT, EMACS_INT); extern Lisp_Object make_string_from_bytes (const char *, ptrdiff_t, ptrdiff_t); extern Lisp_Object make_specified_string (const char *, - ptrdiff_t, ptrdiff_t, int); -extern Lisp_Object make_pure_string (const char *, ptrdiff_t, ptrdiff_t, int); + ptrdiff_t, ptrdiff_t, bool); +extern Lisp_Object make_pure_string (const char *, ptrdiff_t, ptrdiff_t, bool); extern Lisp_Object make_pure_c_string (const char *, ptrdiff_t); /* Make a string allocated in pure space, use STR as string data. */ @@ -2922,8 +2926,8 @@ extern struct window *allocate_window (void); extern struct frame *allocate_frame (void); extern struct Lisp_Process *allocate_process (void); extern struct terminal *allocate_terminal (void); -extern int gc_in_progress; -extern int abort_on_gc; +extern bool gc_in_progress; +extern bool abort_on_gc; extern Lisp_Object make_float (double); extern void display_malloc_warning (void); extern ptrdiff_t inhibit_garbage_collection (void); @@ -3001,6 +3005,7 @@ extern ptrdiff_t evxprintf (char **, ptrdiff_t *, char const *, ptrdiff_t, /* Defined in lread.c. */ extern Lisp_Object Qvariable_documentation, Qstandard_input; extern Lisp_Object Qbackquote, Qcomma, Qcomma_at, Qcomma_dot, Qfunction; +extern Lisp_Object Qlexical_binding; extern Lisp_Object check_obarray (Lisp_Object); extern Lisp_Object intern_1 (const char *, ptrdiff_t); extern Lisp_Object intern_c_string_1 (const char *, ptrdiff_t); @@ -3034,7 +3039,7 @@ intern_c_string (const char *str) /* Defined in eval.c. */ extern Lisp_Object Qautoload, Qexit, Qinteractive, Qcommandp, Qmacro; -extern Lisp_Object Qinhibit_quit, Qclosure; +extern Lisp_Object Qinhibit_quit, Qinternal_interpreter_environment, Qclosure; extern Lisp_Object Qand_rest; extern Lisp_Object Vautoload_queue; extern Lisp_Object Vsignaling_function; @@ -3109,23 +3114,23 @@ extern Lisp_Object save_restriction_save (void); extern Lisp_Object save_excursion_restore (Lisp_Object); extern Lisp_Object save_restriction_restore (Lisp_Object); extern _Noreturn void time_overflow (void); -extern Lisp_Object make_buffer_string (ptrdiff_t, ptrdiff_t, int); +extern Lisp_Object make_buffer_string (ptrdiff_t, ptrdiff_t, bool); extern Lisp_Object make_buffer_string_both (ptrdiff_t, ptrdiff_t, ptrdiff_t, - ptrdiff_t, int); + ptrdiff_t, bool); extern void init_editfns (void); const char *get_system_name (void); 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); @@ -3272,7 +3277,7 @@ extern void syms_of_frame (void); extern char **initial_argv; extern int initial_argc; #if defined (HAVE_X_WINDOWS) || defined (HAVE_NS) -extern int display_arg; +extern bool display_arg; #endif extern Lisp_Object decode_env_path (const char *, const char *); extern Lisp_Object empty_unibyte_string, empty_multibyte_string; @@ -3291,22 +3296,26 @@ void synchronize_system_time_locale (void); #define synchronize_system_messages_locale() #define synchronize_system_time_locale() #endif -void shut_down_emacs (int, int, Lisp_Object); -/* Nonzero means don't do interactive redisplay and don't change tty modes. */ -extern int noninteractive; +extern void shut_down_emacs (int, Lisp_Object); + +/* True means don't do interactive redisplay and don't change tty modes. */ +extern bool noninteractive; -/* Nonzero means remove site-lisp directories from load-path. */ -extern int no_site_lisp; +/* True means remove site-lisp directories from load-path. */ +extern bool no_site_lisp; /* Pipe used to send exit notification to the daemon parent at startup. */ extern int daemon_pipe[2]; #define IS_DAEMON (daemon_pipe[1] != 0) -/* Nonzero means don't do use window-system-specific display code. */ -extern int inhibit_window_system; -/* Nonzero means that a filter or a sentinel is running. */ -extern int running_asynch_code; +/* True if handling a fatal error already. */ +extern bool fatal_error_in_progress; + +/* True means don't do use window-system-specific display code. */ +extern bool inhibit_window_system; +/* True means that a filter or a sentinel is running. */ +extern bool running_asynch_code; /* Defined in process.c. */ extern Lisp_Object QCtype, Qlocal; @@ -3338,7 +3347,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); @@ -3347,9 +3356,9 @@ extern void syms_of_callproc (void); /* Defined in doc.c */ extern Lisp_Object Qfunction_documentation; extern Lisp_Object read_doc_string (Lisp_Object); -extern Lisp_Object get_doc_string (Lisp_Object, int, int); +extern Lisp_Object get_doc_string (Lisp_Object, bool, bool); extern void syms_of_doc (void); -extern int read_bytecode_char (int); +extern int read_bytecode_char (bool); /* Defined in bytecode.c */ extern Lisp_Object Qbytecode; @@ -3419,7 +3428,8 @@ extern void child_setup_tty (int); extern void setup_pty (int); extern int set_window_size (int, int, int); extern EMACS_INT get_random (void); -extern void seed_random (long); +extern void seed_random (void *, ptrdiff_t); +extern void init_random (void); extern int emacs_open (const char *, int, int); extern int emacs_close (int); extern ptrdiff_t emacs_read (int, char *, ptrdiff_t); @@ -3448,11 +3458,10 @@ 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; -extern void mark_ttys (void); extern void syms_of_term (void); extern _Noreturn void fatal (const char *msgid, ...) ATTRIBUTE_FORMAT_PRINTF (1, 2); @@ -3480,6 +3489,9 @@ extern Lisp_Object Qface; extern Lisp_Object Qnormal; extern Lisp_Object QCfamily, QCweight, QCslant; extern Lisp_Object QCheight, QCname, QCwidth, QCforeground, QCbackground; +extern Lisp_Object Qextra_light, Qlight, Qsemi_light, Qsemi_bold; +extern Lisp_Object Qbold, Qextra_bold, Qultra_bold; +extern Lisp_Object Qoblique, Qitalic; extern Lisp_Object Vface_alternative_font_family_alist; extern Lisp_Object Vface_alternative_font_registry_alist; extern void syms_of_xfaces (void); @@ -3524,9 +3536,9 @@ void syms_of_dbusbind (void); extern char *emacs_root_dir (void); #endif /* DOS_NT */ -/* Nonzero means Emacs has already been initialized. +/* True means Emacs has already been initialized. Used during startup to detect startup of dumped Emacs. */ -extern int initialized; +extern bool initialized; extern int immediate_quit; /* Nonzero means ^G can quit instantly */ @@ -3593,7 +3605,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. */ @@ -3664,6 +3676,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 */ diff --git a/src/lread.c b/src/lread.c index e2ad03b349f..1dd6275684b 100644 --- a/src/lread.c +++ b/src/lread.c @@ -89,8 +89,6 @@ static Lisp_Object Qget_emacs_mule_file_char; static Lisp_Object Qload_force_doc_strings; -extern Lisp_Object Qinternal_interpreter_environment; - static Lisp_Object Qload_in_progress; /* The association list of objects read with the #n=object form. @@ -189,7 +187,7 @@ static int readbyte_from_string (int, Lisp_Object); static int unread_char; static int -readchar (Lisp_Object readcharfun, int *multibyte) +readchar (Lisp_Object readcharfun, bool *multibyte) { Lisp_Object tem; register int c; @@ -2354,9 +2352,9 @@ read_integer (Lisp_Object readcharfun, EMACS_INT radix) static Lisp_Object read1 (register Lisp_Object readcharfun, int *pch, int first_in_list) { - register int c; - unsigned uninterned_symbol = 0; - int multibyte; + int c; + bool uninterned_symbol = 0; + bool multibyte; *pch = 0; load_each_byte = 0; @@ -3406,7 +3404,7 @@ read_vector (Lisp_Object readcharfun, int bytecodeflag) /* Delay handling the bytecode slot until we know whether it is lazily-loaded (we can tell by whether the constants slot is nil). */ - ptr[COMPILED_CONSTANTS] = item; + ASET (vector, COMPILED_CONSTANTS, item); item = Qnil; } else if (i == COMPILED_CONSTANTS) @@ -3432,7 +3430,7 @@ read_vector (Lisp_Object readcharfun, int bytecodeflag) } /* Now handle the bytecode slot. */ - ptr[COMPILED_BYTECODE] = bytestr; + ASET (vector, COMPILED_BYTECODE, bytestr); } else if (i == COMPILED_DOC_STRING && STRINGP (item) @@ -3444,7 +3442,7 @@ read_vector (Lisp_Object readcharfun, int bytecodeflag) item = Fstring_as_multibyte (item); } } - ptr[i] = item; + ASET (vector, i, item); otem = XCONS (tem); tem = Fcdr (tem); free_cons (otem); @@ -4253,9 +4251,12 @@ init_lread (void) { tem = Fexpand_file_name (build_string ("site-lisp"), Vsource_directory); - - if (NILP (Fmember (tem, Vload_path))) - Vload_path = Fcons (tem, Vload_path); + tem1 = Ffile_exists_p (tem); + if (!NILP (tem1)) + { + if (NILP (Fmember (tem, Vload_path))) + Vload_path = Fcons (tem, Vload_path); + } } } } /* Vinstallation_directory != Vsource_directory */ diff --git a/src/makefile.w32-in b/src/makefile.w32-in index bdb292099bc..a8dcf5f2ae8 100644 --- a/src/makefile.w32-in +++ b/src/makefile.w32-in @@ -390,6 +390,7 @@ SYSTIME_H = $(SRC)/systime.h \ $(NT_INC)/sys/time.h \ $(GNU_LIB)/timespec.h ATIMER_H = $(SRC)/atimer.h \ + $(NT_INC)/stdbool.h \ $(SYSTIME_H) BLOCKINPUT_H = $(SRC)/blockinput.h \ $(ATIMER_H) @@ -401,6 +402,8 @@ CAREADLINKAT_H = $(GNU_LIB)/careadlinkat.h \ $(NT_INC)/unistd.h CHARACTER_H = $(SRC)/character.h \ $(GNU_LIB)/verify.h +CCL_H = $(SRC)/ccl.h \ + $(CHARACTER_H) CHARSET_H = $(SRC)/charset.h \ $(GNU_LIB)/verify.h CODING_H = $(SRC)/coding.h \ @@ -422,7 +425,7 @@ DISPEXTERN_H = $(SRC)/dispextern.h \ FILEMODE_H = $(GNU_LIB)/filemode.h \ $(NT_INC)/sys/stat.h FONT_H = $(SRC)/font.h \ - $(SRC)/ccl.h + $(CCL_H) FRAME_H = $(SRC)/frame.h \ $(DISPEXTERN_H) FTOASTR_H = $(GNU_LIB)/ftoastr.h \ @@ -469,6 +472,8 @@ SYSTTY_H = $(SRC)/systty.h \ $(NT_INC)/unistd.h TERMHOOKS_H = $(SRC)/termhooks.h \ $(SYSTIME_H) +W32FONT_H = $(SRC)/w32font.h \ + $(FONT_H) W32TERM_H = $(SRC)/w32term.h \ $(W32GUI_H) WINDOW_H = $(SRC)/window.h \ @@ -553,7 +558,6 @@ $(BLD)/callint.$(O) : \ $(BLD)/callproc.$(O) : \ $(SRC)/callproc.c \ - $(SRC)/ccl.h \ $(SRC)/commands.h \ $(SRC)/composite.h \ $(SRC)/epaths.h \ @@ -563,6 +567,7 @@ $(BLD)/callproc.$(O) : \ $(NT_INC)/unistd.h \ $(BLOCKINPUT_H) \ $(BUFFER_H) \ + $(CCL_H) \ $(CHARACTER_H) \ $(CODING_H) \ $(CONFIG_H) \ @@ -602,7 +607,7 @@ $(BLD)/category.$(O) : \ $(BLD)/ccl.$(O) : \ $(SRC)/ccl.c \ - $(SRC)/ccl.h \ + $(CCL_H) \ $(CHARACTER_H) \ $(CHARSET_H) \ $(CODING_H) \ @@ -634,7 +639,7 @@ $(BLD)/charset.$(O) : \ $(BLD)/chartab.$(O) : \ $(SRC)/chartab.c \ - $(SRC)/ccl.h \ + $(CCL_H) \ $(CHARACTER_H) \ $(CHARSET_H) \ $(CONFIG_H) \ @@ -656,9 +661,9 @@ $(BLD)/cmds.$(O) : \ $(BLD)/coding.$(O) : \ $(SRC)/coding.c \ - $(SRC)/ccl.h \ $(SRC)/composite.h \ $(BUFFER_H) \ + $(CCL_H) \ $(CHARACTER_H) \ $(CHARSET_H) \ $(CODING_H) \ @@ -802,6 +807,7 @@ $(BLD)/emacs.$(O) : \ $(PROCESS_H) \ $(SYSTTY_H) \ $(TERMHOOKS_H) \ + $(W32TERM_H) \ $(WINDOW_H) $(BLD)/eval.$(O) : \ @@ -897,10 +903,10 @@ $(BLD)/font.$(O) : \ $(BLD)/fontset.$(O) : \ $(SRC)/fontset.c \ - $(SRC)/ccl.h \ $(SRC)/fontset.h \ $(BLOCKINPUT_H) \ $(BUFFER_H) \ + $(CCL_H) \ $(CHARACTER_H) \ $(CHARSET_H) \ $(CONFIG_H) \ @@ -1268,6 +1274,7 @@ $(BLD)/process.$(O) : \ $(SYSTIME_H) \ $(SYSTTY_H) \ $(TERMHOOKS_H) \ + $(W32TERM_H) \ $(WINDOW_H) $(BLD)/ralloc.$(O) : \ @@ -1523,14 +1530,13 @@ $(BLD)/xfaces.$(O) : \ $(BLD)/w32fns.$(O) : \ $(SRC)/w32fns.c \ - $(SRC)/ccl.h \ $(SRC)/epaths.h \ $(SRC)/fontset.h \ $(SRC)/w32.h \ - $(SRC)/w32font.h \ $(SRC)/w32heap.h \ $(BLOCKINPUT_H) \ $(BUFFER_H) \ + $(CCL_H) \ $(CHARACTER_H) \ $(CHARSET_H) \ $(CODING_H) \ @@ -1543,6 +1549,7 @@ $(BLD)/w32fns.$(O) : \ $(LISP_H) \ $(SYSTIME_H) \ $(TERMHOOKS_H) \ + $(W32FONT_H) \ $(W32TERM_H) \ $(WINDOW_H) @@ -1567,18 +1574,17 @@ $(BLD)/w32menu.$(O) : \ $(BLD)/w32term.$(O) : \ $(SRC)/w32term.c \ - $(SRC)/ccl.h \ $(SRC)/disptab.h \ $(SRC)/fontset.h \ $(SRC)/keymap.h \ $(SRC)/termchar.h \ $(SRC)/termopts.h \ - $(SRC)/w32font.h \ $(SRC)/w32heap.h \ $(NT_INC)/sys/stat.h \ $(ATIMER_H) \ $(BLOCKINPUT_H) \ $(BUFFER_H) \ + $(CCL_H) \ $(CHARACTER_H) \ $(CHARSET_H) \ $(CODING_H) \ @@ -1593,6 +1599,7 @@ $(BLD)/w32term.$(O) : \ $(SYSTIME_H) \ $(SYSTTY_H) \ $(TERMHOOKS_H) \ + $(W32FONT_H) \ $(W32TERM_H) \ $(WINDOW_H) @@ -1628,7 +1635,6 @@ $(BLD)/w32xfns.$(O) : \ $(BLD)/w32font.$(O) : \ $(SRC)/w32font.c \ $(SRC)/fontset.h \ - $(SRC)/w32font.h \ $(CHARACTER_H) \ $(CHARSET_H) \ $(CODING_H) \ @@ -1637,13 +1643,13 @@ $(BLD)/w32font.$(O) : \ $(FONT_H) \ $(FRAME_H) \ $(LISP_H) \ + $(W32FONT_H) \ $(W32TERM_H) $(BLD)/w32uniscribe.$(O) : \ $(SRC)/w32uniscribe.c \ $(SRC)/composite.h \ $(SRC)/fontset.h \ - $(SRC)/w32font.h \ $(CHARACTER_H) \ $(CHARSET_H) \ $(CONFIG_H) \ @@ -1651,6 +1657,7 @@ $(BLD)/w32uniscribe.$(O) : \ $(FONT_H) \ $(FRAME_H) \ $(LISP_H) \ + $(W32FONT_H) \ $(W32TERM_H) # Each object file depends on stamp_BLD, because in parallel builds we must diff --git a/src/menu.c b/src/menu.c index 3e466b46aa3..20770537326 100644 --- a/src/menu.c +++ b/src/menu.c @@ -36,24 +36,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include "../lwlib/lwlib.h" #endif -#ifdef HAVE_X_WINDOWS -#include "xterm.h" -#endif - -#ifdef HAVE_NS -#include "nsterm.h" -#endif - -#ifdef USE_GTK -#include "gtkutil.h" -#endif +#ifdef HAVE_WINDOW_SYSTEM +#include TERM_HEADER +#endif /* HAVE_WINDOW_SYSTEM */ #ifdef HAVE_NTGUI -#include "w32term.h" - extern AppendMenuW_Proc unicode_append_menu; extern HMENU current_popup_menu; - #endif /* HAVE_NTGUI */ #include "menu.h" diff --git a/src/minibuf.c b/src/minibuf.c index 2154d1654df..2035a3e3985 100644 --- a/src/minibuf.c +++ b/src/minibuf.c @@ -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")); @@ -1860,7 +1860,6 @@ the values STRING, PREDICATE and `lambda'. */) } static Lisp_Object Qmetadata; -extern Lisp_Object Qbuffer; DEFUN ("internal-complete-buffer", Finternal_complete_buffer, Sinternal_complete_buffer, 3, 3, 0, doc: /* Perform completion on buffer names. diff --git a/src/msdos.c b/src/msdos.c index 30435820d9e..ac348e94375 100644 --- a/src/msdos.c +++ b/src/msdos.c @@ -1029,7 +1029,6 @@ IT_clear_end_of_line (struct frame *f, int first_unused) { char *spaces, *sp; int i, j, offset = 2 * (new_pos_X + screen_size_X * new_pos_Y); - extern int fatal_error_in_progress; struct tty_display_info *tty = FRAME_TTY (f); if (new_pos_X >= first_unused || fatal_error_in_progress) @@ -2434,10 +2433,10 @@ and then the scan code. */) else { val = Fvector (NUM_RECENT_DOSKEYS, keys); - memcpy (XVECTOR (val)->contents, keys + recent_doskeys_index, - (NUM_RECENT_DOSKEYS - recent_doskeys_index) * word_size); - memcpy (XVECTOR (val)->contents + NUM_RECENT_DOSKEYS - recent_doskeys_index, - keys, recent_doskeys_index * word_size); + vcopy (val, 0, keys + recent_doskeys_index, + NUM_RECENT_DOSKEYS - recent_doskeys_index); + vcopy (val, NUM_RECENT_DOSKEYS - recent_doskeys_index, + keys, recent_doskeys_index); return val; } } diff --git a/src/nsmenu.m b/src/nsmenu.m index e8a0b43a01b..9e290486213 100644 --- a/src/nsmenu.m +++ b/src/nsmenu.m @@ -1497,6 +1497,8 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header) FlippedView *contentView; NSImage *img; + dialog_return = Qundefined; + button_values = NULL; area.origin.x = 3*SPACER; area.origin.y = 2*SPACER; area.size.width = ICONSIZE; @@ -1578,44 +1580,65 @@ ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header) [self setOneShot: YES]; [self setReleasedWhenClosed: YES]; [self setHidesOnDeactivate: YES]; + [self setStyleMask: + NSTitledWindowMask|NSClosableWindowMask|NSUtilityWindowMask]; + return self; } - (BOOL)windowShouldClose: (id)sender { - [NSApp stopModalWithCode: XHASH (Qnil)]; // FIXME: BIG UGLY HACK!! + window_closed = YES; + [NSApp stop:self]; return NO; } +- (void)dealloc +{ + xfree (button_values); + [super dealloc]; +} -void process_dialog (id window, Lisp_Object list) +- (void)process_dialog: (Lisp_Object) list { - Lisp_Object item; + Lisp_Object item, lst = list; int row = 0; + int buttons = 0, btnnr = 0; + + for (; XTYPE (lst) == Lisp_Cons; lst = XCDR (lst)) + { + item = XCAR (list); + if (XTYPE (item) == Lisp_Cons) + ++buttons; + } + + if (buttons > 0) + button_values = (Lisp_Object *) xmalloc (buttons * sizeof (*button_values)); for (; XTYPE (list) == Lisp_Cons; list = XCDR (list)) { item = XCAR (list); if (XTYPE (item) == Lisp_String) { - [window addString: SSDATA (item) row: row++]; + [self addString: SSDATA (item) row: row++]; } else if (XTYPE (item) == Lisp_Cons) { - [window addButton: SSDATA (XCAR (item)) - value: XCDR (item) row: row++]; + button_values[btnnr] = XCDR (item); + [self addButton: SSDATA (XCAR (item)) value: btnnr row: row++]; + ++btnnr; } else if (NILP (item)) { - [window addSplit]; + [self addSplit]; row = 0; } } } -- addButton: (char *)str value: (Lisp_Object)val row: (int)row +- (void)addButton: (char *)str value: (int)tag row: (int)row { id cell; @@ -1628,15 +1651,13 @@ void process_dialog (id window, Lisp_Object list) [cell setTarget: self]; [cell setAction: @selector (clicked: )]; [cell setTitle: [NSString stringWithUTF8String: str]]; - [cell setTag: XHASH (val)]; // FIXME: BIG UGLY HACK!! + [cell setTag: tag]; [cell setBordered: YES]; [cell setEnabled: YES]; - - return self; } -- addString: (char *)str row: (int)row +- (void)addString: (char *)str row: (int)row { id cell; @@ -1649,32 +1670,28 @@ void process_dialog (id window, Lisp_Object list) [cell setTitle: [NSString stringWithUTF8String: str]]; [cell setBordered: YES]; [cell setEnabled: NO]; - - return self; } -- addSplit +- (void)addSplit { [matrix addColumn]; cols++; - return self; } -- clicked: sender +- (void)clicked: sender { NSArray *sellist = nil; EMACS_INT seltag; sellist = [sender selectedCells]; - if ([sellist count]<1) - return self; + if ([sellist count] < 1) + return; seltag = [[sellist objectAtIndex: 0] tag]; - if (seltag != XHASH (Qundefined)) // FIXME: BIG UGLY HACK!! - [NSApp stopModalWithCode: seltag]; - return self; + dialog_return = button_values[seltag]; + [NSApp stop:self]; } @@ -1686,7 +1703,7 @@ void process_dialog (id window, Lisp_Object list) if (XTYPE (contents) == Lisp_Cons) { head = Fcar (contents); - process_dialog (self, Fcdr (contents)); + [self process_dialog: Fcdr (contents)]; } else head = contents; @@ -1706,7 +1723,7 @@ void process_dialog (id window, Lisp_Object list) if (cols == 1 && rows > 1) /* Never told where to split */ { [matrix addColumn]; - for (i = 0; i<rows/2; i++) + for (i = 0; i < rows/2; i++) { [matrix putCell: [matrix cellAtRow: (rows+1)/2 column: 0] atRow: i column: 1]; @@ -1756,13 +1773,27 @@ void process_dialog (id window, Lisp_Object list) - (void)timeout_handler: (NSTimer *)timedEntry { - timer_fired = 1; - [NSApp abortModal]; + 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 = YES; + /* 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) { @@ -1780,8 +1811,10 @@ void process_dialog (id window, Lisp_Object list) [[NSRunLoop currentRunLoop] addTimer: tmo forMode: NSModalPanelRunLoopMode]; } - timer_fired = 0; - ret = [NSApp runModalForWindow: self]; + timer_fired = NO; + dialog_return = Qundefined; + [NSApp runModalForWindow: self]; + ret = dialog_return; if (! timer_fired) { if (tmo != nil) [tmo invalidate]; /* Cancels timer */ @@ -1789,11 +1822,11 @@ void process_dialog (id window, Lisp_Object list) } } - { /* FIXME: BIG UGLY HACK!!! */ - Lisp_Object tmp; - *(EMACS_INT*)(&tmp) = ret; - return tmp; - } + if (EQ (ret, Qundefined) && window_closed) + /* Make close button pressed equivalent to C-g. */ + Fsignal (Qquit, Qnil); + + return ret; } @end diff --git a/src/nsterm.h b/src/nsterm.h index 54f4a4ec89e..f0cae193005 100644 --- a/src/nsterm.h +++ b/src/nsterm.h @@ -195,12 +195,15 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ NSTextField *title; NSMatrix *matrix; int rows, cols; - int timer_fired; + BOOL timer_fired, window_closed; + Lisp_Object dialog_return; + Lisp_Object *button_values; } - initFromContents: (Lisp_Object)menu isQuestion: (BOOL)isQ; -- addButton: (char *)str value: (Lisp_Object)val row: (int)row; -- addString: (char *)str row: (int)row; -- addSplit; +- (void)process_dialog: (Lisp_Object)list; +- (void)addButton: (char *)str value: (int)tag row: (int)row; +- (void)addString: (char *)str row: (int)row; +- (void)addSplit; - (Lisp_Object)runDialogAt: (NSPoint)p; - (void)timeout_handler: (NSTimer *)timedEntry; @end @@ -628,6 +631,8 @@ struct x_output /* This is the `Display *' which frame F is on. */ #define FRAME_NS_DISPLAY(f) (0) #define FRAME_X_DISPLAY(f) (0) +#define FRAME_X_SCREEN(f) (0) +#define FRAME_X_VISUAL(f) FRAME_NS_DISPLAY_INFO(f)->visual #define FRAME_FOREGROUND_COLOR(f) ((f)->output_data.ns->foreground_color) #define FRAME_BACKGROUND_COLOR(f) ((f)->output_data.ns->background_color) @@ -777,31 +782,6 @@ extern Lisp_Object find_and_return_menu_selection (FRAME_PTR f, extern Lisp_Object ns_popup_dialog (Lisp_Object position, Lisp_Object contents, Lisp_Object header); -/* More prototypes that should be moved to a more general include file */ -extern void set_frame_menubar (struct frame *f, int first_time, int deep_p); -extern void x_set_window_size (struct frame *f, int change_grav, - int cols, int rows); -extern void x_sync (struct frame *); -extern Lisp_Object x_get_focus_frame (struct frame *); -extern void x_set_mouse_position (struct frame *f, int h, int v); -extern void x_set_mouse_pixel_position (struct frame *f, int pix_x, int pix_y); -extern void x_make_frame_visible (struct frame *f); -extern void x_make_frame_invisible (struct frame *f); -extern void x_iconify_frame (struct frame *f); -extern int x_char_width (struct frame *f); -extern int x_char_height (struct frame *f); -extern int x_pixel_width (struct frame *f); -extern int x_pixel_height (struct frame *f); -extern void x_set_frame_alpha (struct frame *f); -extern void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object); -extern void x_set_tool_bar_lines (struct frame *f, - Lisp_Object value, - Lisp_Object oldval); -extern void x_activate_menubar (struct frame *); -extern void free_frame_menubar (struct frame *); -extern void x_free_frame_resources (struct frame *); -extern void x_destroy_window (struct frame *); - #define NSAPP_DATA2_RUNASSCRIPT 10 extern void ns_run_ascript (void); diff --git a/src/nsterm.m b/src/nsterm.m index 3ab9358467a..c892a5486a7 100644 --- a/src/nsterm.m +++ b/src/nsterm.m @@ -4600,11 +4600,15 @@ not_in_argv (NSString *arg) SELECT_TYPE readfds, writefds, *wfds; EMACS_TIME timeout, *tmo; + NSAutoreleasePool *pool = nil; /* NSTRACE (fd_handler); */ for (;;) { + [pool release]; + pool = [[NSAutoreleasePool alloc] init]; + if (waiting) { SELECT_TYPE fds; @@ -5087,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; diff --git a/src/print.c b/src/print.c index e8309109f1d..3cf5fc7348d 100644 --- a/src/print.c +++ b/src/print.c @@ -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))); @@ -586,6 +585,7 @@ A printed representation of an object is text which describes that object. */) (Lisp_Object object, Lisp_Object noescape) { Lisp_Object printcharfun; + bool prev_abort_on_gc; /* struct gcpro gcpro1, gcpro2; */ Lisp_Object save_deactivate_mark; ptrdiff_t count = SPECPDL_INDEX (); @@ -601,7 +601,8 @@ A printed representation of an object is text which describes that object. */) No need for specbind, since errors deactivate the mark. */ save_deactivate_mark = Vdeactivate_mark; /* GCPRO2 (object, save_deactivate_mark); */ - abort_on_gc++; + prev_abort_on_gc = abort_on_gc; + abort_on_gc = 1; printcharfun = Vprin1_to_string_buffer; PRINTPREPARE; @@ -625,7 +626,7 @@ A printed representation of an object is text which describes that object. */) Vdeactivate_mark = save_deactivate_mark; /* UNGCPRO; */ - abort_on_gc--; + abort_on_gc = prev_abort_on_gc; return unbind_to (count, object); } diff --git a/src/process.c b/src/process.c index fa138027ec1..dbbb23b8627 100644 --- a/src/process.c +++ b/src/process.c @@ -116,12 +116,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include "gnutls.h" #endif +#ifdef HAVE_WINDOW_SYSTEM +#include TERM_HEADER +#endif /* HAVE_WINDOW_SYSTEM */ + #if defined (USE_GTK) || defined (HAVE_GCONF) || defined (HAVE_GSETTINGS) #include "xgselect.h" #endif -#ifdef HAVE_NS -#include "nsterm.h" -#endif /* Work around GCC 4.7.0 bug with strict overflow checking; see <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52904>. @@ -164,16 +165,6 @@ static Lisp_Object QClocal, QCremote, QCcoding; static Lisp_Object QCserver, QCnowait, QCnoquery, QCstop; static Lisp_Object QCsentinel, QClog, QCoptions, QCplist; static Lisp_Object Qlast_nonmenu_event; -/* QCfamily is declared and initialized in xfaces.c, - QCfilter in keyboard.c. */ -extern Lisp_Object QCfamily, QCfilter; - -/* Qexit is declared and initialized in eval.c. */ - -/* QCfamily is defined in xfaces.c. */ -extern Lisp_Object QCfamily; -/* QCfilter is defined in keyboard.c. */ -extern Lisp_Object QCfilter; #define NETCONN_P(p) (EQ (XPROCESS (p)->type, Qnetwork)) #define NETCONN1_P(p) (EQ (p->type, Qnetwork)) @@ -5039,15 +5030,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->flags & FOR_READ) != 0) - d->func (channel, d->data, 1); - if (FD_ISSET (channel, &Writeok) - && d->func != 0 - && (d->flags & FOR_WRITE) != 0) - d->func (channel, d->data, 0); - } + if (d->func + && ((d->flags & FOR_READ + && FD_ISSET (channel, &Available)) + || (d->flags & FOR_WRITE + && FD_ISSET (channel, &Writeok)))) + d->func (channel, d->data); + } for (channel = 0; channel <= max_process_desc; channel++) { @@ -5361,14 +5350,14 @@ 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; if (!NILP (outstream)) { Lisp_Object text; - int outer_running_asynch_code = running_asynch_code; + bool outer_running_asynch_code = running_asynch_code; int waiting = waiting_for_user_input_p; /* No need to gcpro these, because all we do with them later @@ -5605,7 +5594,7 @@ send_process_trap (int ignore) { SIGNAL_THREAD_CHECK (SIGPIPE); sigunblock (sigmask (SIGPIPE)); - longjmp (send_process_frame, 1); + _longjmp (send_process_frame, 1); } /* In send_process, when a write fails temporarily, @@ -5808,7 +5797,7 @@ send_process (volatile Lisp_Object proc, const char *volatile buf, /* 2000-09-21: Emacs 20.7, sparc-sun-solaris-2.6, GCC 2.95.2, CFLAGS="-g -O": The value of the parameter `proc' is clobbered when returning with longjmp despite being declared volatile. */ - if (!setjmp (send_process_frame)) + if (!_setjmp (send_process_frame)) { p = XPROCESS (proc); /* Repair any setjmp clobbering. */ process_sent_to = proc; @@ -6725,9 +6714,9 @@ static void exec_sentinel (Lisp_Object proc, Lisp_Object reason) { Lisp_Object sentinel, odeactivate; - register struct Lisp_Process *p = XPROCESS (proc); + struct Lisp_Process *p = XPROCESS (proc); ptrdiff_t count = SPECPDL_INDEX (); - int outer_running_asynch_code = running_asynch_code; + bool outer_running_asynch_code = running_asynch_code; int waiting = waiting_for_user_input_p; if (inhibit_sentinels) @@ -6745,7 +6734,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)) diff --git a/src/process.h b/src/process.h index db000464cb5..e89ba478187 100644 --- a/src/process.h +++ b/src/process.h @@ -187,7 +187,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. */ @@ -222,7 +222,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); diff --git a/src/ralloc.c b/src/ralloc.c index c40258693f5..3877e21d4f6 100644 --- a/src/ralloc.c +++ b/src/ralloc.c @@ -670,6 +670,7 @@ static void free_bloc (bloc_ptr bloc) { heap_ptr heap = bloc->heap; + heap_ptr h; if (r_alloc_freeze_level) { @@ -699,20 +700,38 @@ free_bloc (bloc_ptr bloc) bloc->prev->next = bloc->next; } - /* Update the records of which blocs are in HEAP. */ - if (heap->first_bloc == bloc) + /* Sometimes, 'heap' obtained from bloc->heap above is not really a + 'heap' structure. It can even be beyond the current break point, + which will cause crashes when we dereference it below (see + bug#12242). Evidently, the reason is bloc allocations done while + use_relocatable_buffers was non-positive, because additional + memory we get then is not recorded in the heaps we manage. If + bloc->heap records such a "heap", we cannot (and don't need to) + update its records. So we validate the 'heap' value by making + sure it is one of the heaps we manage via the heaps linked list, + and don't touch a 'heap' that isn't found there. This avoids + accessing memory we know nothing about. */ + for (h = first_heap; h != NIL_HEAP; h = h->next) + if (heap == h) + break; + + if (h) { - if (bloc->next != 0 && bloc->next->heap == heap) - heap->first_bloc = bloc->next; - else - heap->first_bloc = heap->last_bloc = NIL_BLOC; - } - if (heap->last_bloc == bloc) - { - if (bloc->prev != 0 && bloc->prev->heap == heap) - heap->last_bloc = bloc->prev; - else - heap->first_bloc = heap->last_bloc = NIL_BLOC; + /* Update the records of which blocs are in HEAP. */ + if (heap->first_bloc == bloc) + { + if (bloc->next != 0 && bloc->next->heap == heap) + heap->first_bloc = bloc->next; + else + heap->first_bloc = heap->last_bloc = NIL_BLOC; + } + if (heap->last_bloc == bloc) + { + if (bloc->prev != 0 && bloc->prev->heap == heap) + heap->last_bloc = bloc->prev; + else + heap->first_bloc = heap->last_bloc = NIL_BLOC; + } } relinquish (); diff --git a/src/sysdep.c b/src/sysdep.c index 183ee005227..b84e6a4ea3a 100644 --- a/src/sysdep.c +++ b/src/sysdep.c @@ -1765,19 +1765,37 @@ init_signals (void) #endif /* !RAND_BITS */ void -seed_random (long int arg) +seed_random (void *seed, ptrdiff_t seed_size) { +#if defined HAVE_RANDOM || ! defined HAVE_LRAND48 + unsigned int arg = 0; +#else + long int arg = 0; +#endif + unsigned char *argp = (unsigned char *) &arg; + unsigned char *seedp = seed; + ptrdiff_t i; + for (i = 0; i < seed_size; i++) + argp[i % sizeof arg] ^= seedp[i]; #ifdef HAVE_RANDOM - srandom ((unsigned int)arg); + srandom (arg); #else # ifdef HAVE_LRAND48 srand48 (arg); # else - srand ((unsigned int)arg); + srand (arg); # endif #endif } +void +init_random (void) +{ + EMACS_TIME t = current_emacs_time (); + uintmax_t v = getpid () ^ EMACS_SECS (t) ^ EMACS_NSECS (t); + seed_random (&v, sizeof v); +} + /* * Return a nonnegative random integer out of whatever we've got. * It contains enough bits to make a random (signed) Emacs fixnum. diff --git a/src/systime.h b/src/systime.h index d3bdeb83019..9ce7ce646fb 100644 --- a/src/systime.h +++ b/src/systime.h @@ -154,8 +154,8 @@ extern void set_waiting_for_input (EMACS_TIME *); #ifdef GCPRO1 /* defined in editfns.c */ extern Lisp_Object make_lisp_time (EMACS_TIME); -extern int decode_time_components (Lisp_Object, Lisp_Object, Lisp_Object, - Lisp_Object, EMACS_TIME *, double *); +extern bool decode_time_components (Lisp_Object, Lisp_Object, Lisp_Object, + Lisp_Object, EMACS_TIME *, double *); extern EMACS_TIME lisp_time_argument (Lisp_Object); #endif diff --git a/src/term.c b/src/term.c index 23e074287c1..f1a09b39cf9 100644 --- a/src/term.c +++ b/src/term.c @@ -3001,6 +3001,7 @@ init_tty (const char *name, const char *terminal_type, int must_succeed) #else tty = xzalloc (sizeof *tty); #endif + tty->top_frame = Qnil; tty->next = tty_list; tty_list = tty; @@ -3541,22 +3542,6 @@ delete_tty (struct terminal *terminal) xfree (tty); } - - -/* Mark the pointers in the tty_display_info objects. - Called by Fgarbage_collect. */ - -void -mark_ttys (void) -{ - struct tty_display_info *tty; - - for (tty = tty_list; tty; tty = tty->next) - mark_object (tty->top_frame); -} - - - void syms_of_term (void) { diff --git a/src/textprop.c b/src/textprop.c index 20d98b0e6f3..b6895fc426a 100644 --- a/src/textprop.c +++ b/src/textprop.c @@ -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); } diff --git a/src/undo.c b/src/undo.c index 777e3291806..9cd1d5f9f67 100644 --- a/src/undo.c +++ b/src/undo.c @@ -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); diff --git a/src/w32.c b/src/w32.c index b460660cb8c..fe612687f48 100644 --- 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 @@ -6773,7 +6773,7 @@ shutdown_handler (DWORD type) || type == CTRL_SHUTDOWN_EVENT) /* User shutsdown. */ { /* Shut down cleanly, making sure autosave files are up to date. */ - shut_down_emacs (0, 0, Qnil); + shut_down_emacs (0, Qnil); } /* Allow other handlers to handle this signal. */ diff --git a/src/w32fns.c b/src/w32fns.c index 9c5231f9d93..5a1b6dfabab 100644 --- a/src/w32fns.c +++ b/src/w32fns.c @@ -4735,7 +4735,7 @@ x_display_info_for_name (Lisp_Object name) CHECK_STRING (name); for (dpyinfo = &one_w32_display_info, names = w32_display_name_list; - dpyinfo; + dpyinfo && !NILP (w32_display_name_list); dpyinfo = dpyinfo->next, names = XCDR (names)) { Lisp_Object tem; diff --git a/src/w32font.h b/src/w32font.h index b08d48a3d36..a29ddbe778c 100644 --- a/src/w32font.h +++ b/src/w32font.h @@ -19,6 +19,7 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #ifndef EMACS_W32FONT_H #define EMACS_W32FONT_H +#include "font.h" /* Bit 17 of ntmFlags in NEWTEXTMETRIC is set for PostScript OpenType fonts, bit 18 for TrueType OpenType fonts, bit 20 for Type1 fonts. */ @@ -83,4 +84,7 @@ int uniscribe_check_otf (LOGFONT *font, Lisp_Object otf_spec); Lisp_Object intern_font_name (char *); +extern void syms_of_w32font (void); +extern void globals_of_w32font (void); + #endif diff --git a/src/w32term.h b/src/w32term.h index ccbf3c42c0e..5d756f435e4 100644 --- a/src/w32term.h +++ b/src/w32term.h @@ -302,9 +302,6 @@ struct w32_output /* Non-hourglass cursor that is currently active. */ Cursor current_cursor; - /* Flag to set when the window needs to be completely repainted. */ - int needs_exposure; - DWORD dwStyle; /* This is the Emacs structure for the display this frame is on. */ @@ -345,7 +342,7 @@ extern struct w32_output w32term_display; /* Return the window associated with the frame F. */ #define FRAME_W32_WINDOW(f) ((f)->output_data.w32->window_desc) -#define FRAME_X_WINDOW(f) ((f)->output_data.w32->window_desc) +#define FRAME_X_WINDOW(f) FRAME_W32_WINDOW (f) #define FRAME_FONT(f) ((f)->output_data.w32->font) #define FRAME_FONTSET(f) ((f)->output_data.w32->fontset) diff --git a/src/w32uniscribe.c b/src/w32uniscribe.c index 06f7b1bd192..bc45e2c648c 100644 --- a/src/w32uniscribe.c +++ b/src/w32uniscribe.c @@ -320,7 +320,7 @@ uniscribe_shape (Lisp_Object lgstring) } if (SUCCEEDED (result)) { - int j, from, to; + int j, from, to, adj_offset = 0; from = 0; to = from; @@ -364,6 +364,32 @@ uniscribe_shape (Lisp_Object lgstring) } } } + + /* For RTL text, the Uniscribe shaper prepares + the values in ADVANCES array for layout in + reverse order, whereby "advance width" is + applied to move the pen in reverse direction + and _before_ drawing the glyph. Since we + draw glyphs in their normal left-to-right + order, we need to adjust the coordinates of + each non-base glyph in a grapheme cluster via + X-OFF component of the gstring's ADJUSTMENT + sub-vector. This loop computes, for each + grapheme cluster, the initial value of the + adjustment for the base character, which is + then updated for each successive glyph in the + grapheme cluster. */ + if (items[i].a.fRTL) + { + int j1 = j; + + adj_offset = 0; + while (j1 < nglyphs && !attributes[j1].fClusterStart) + { + adj_offset += advances[j1]; + j1++; + } + } } LGLYPH_SET_CHAR (lglyph, chars[items[i].iCharPos @@ -392,9 +418,11 @@ uniscribe_shape (Lisp_Object lgstring) if (SUCCEEDED (result)) { - LGLYPH_SET_LBEARING (lglyph, char_metric.abcA); - LGLYPH_SET_RBEARING (lglyph, (char_metric.abcA - + char_metric.abcB)); + int lbearing = char_metric.abcA; + int rbearing = char_metric.abcA + char_metric.abcB; + + LGLYPH_SET_LBEARING (lglyph, lbearing); + LGLYPH_SET_RBEARING (lglyph, rbearing); } else { @@ -402,18 +430,43 @@ uniscribe_shape (Lisp_Object lgstring) LGLYPH_SET_RBEARING (lglyph, advances[j]); } - if (offsets[j].du || offsets[j].dv) + if (offsets[j].du || offsets[j].dv + /* For non-base glyphs of RTL grapheme clusters, + adjust the X offset even if both DU and DV + are zero. */ + || (!attributes[j].fClusterStart && items[i].a.fRTL)) { Lisp_Object vec; vec = Fmake_vector (make_number (3), Qnil); - ASET (vec, 0, make_number (offsets[j].du)); + if (items[i].a.fRTL) + { + /* Empirically, it looks like Uniscribe + interprets DU in reverse direction for + RTL clusters. E.g., if we don't reverse + the direction, the Hebrew point HOLAM is + drawn above the right edge of the base + consonant, instead of above the left edge. */ + ASET (vec, 0, make_number (-offsets[j].du + + adj_offset)); + /* Update the adjustment value for the width + advance of the glyph we just emitted. */ + adj_offset -= 2 * advances[j]; + } + else + ASET (vec, 0, make_number (offsets[j].du + adj_offset)); ASET (vec, 1, make_number (offsets[j].dv)); /* Based on what ftfont.c does... */ ASET (vec, 2, make_number (advances[j])); LGLYPH_SET_ADJUSTMENT (lglyph, vec); } else - LGLYPH_SET_ADJUSTMENT (lglyph, Qnil); + { + LGLYPH_SET_ADJUSTMENT (lglyph, Qnil); + /* Update the adjustment value to compensate for + the width of the base character. */ + if (items[i].a.fRTL) + adj_offset -= advances[j]; + } } } } diff --git a/src/w32xfns.c b/src/w32xfns.c index 745a5cfe3e7..62e45dd987b 100644 --- a/src/w32xfns.c +++ b/src/w32xfns.c @@ -438,6 +438,6 @@ XParseGeometry (char *string, /* x_sync is a no-op on W32. */ void -x_sync (void *f) +x_sync (struct frame *f) { } diff --git a/src/widget.c b/src/widget.c index b94c30f4e9c..ea9bdb61b13 100644 --- a/src/widget.c +++ b/src/widget.c @@ -671,8 +671,6 @@ EmacsFrameRealize (Widget widget, XtValueMask *mask, XSetWindowAttributes *attrs update_wm_hints (ew); } -extern void free_frame_faces (struct frame *); - static void EmacsFrameDestroy (Widget widget) { diff --git a/src/window.c b/src/window.c index 20325711e73..732d5060d29 100644 --- a/src/window.c +++ b/src/window.c @@ -54,14 +54,15 @@ 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; static Lisp_Object Qwindow_resize_root_window, Qwindow_resize_root_window_vertically; static Lisp_Object Qscroll_up, Qscroll_down, Qscroll_command; static Lisp_Object Qsafe, Qabove, Qbelow; -static Lisp_Object Qauto_buffer_name, Qclone_of; +static Lisp_Object Qclone_of; static int displayed_window_lines (struct window *); static int count_windows (struct 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; @@ -1407,22 +1408,21 @@ DEFUN ("window-point", Fwindow_point, Swindow_point, 0, 1, 0, doc: /* Return current value of point in WINDOW. WINDOW must be a live window and defaults to the selected one. -For a nonselected window, this is the value point would have -if that window were selected. +For a nonselected window, this is the value point would have if that +window were selected. -Note that, when WINDOW is the selected window and its buffer -is also currently selected, the value returned is the same as (point). -It would be more strictly correct to return the `top-level' value -of point, outside of any save-excursion forms. -But that is hard to define. */) +Note that, when WINDOW is selected, the value returned is the same as +that returned by `point' for WINDOW's buffer. It would be more strictly +correct to return the `top-level' value of `point', outside of any +`save-excursion' forms. But that is hard to define. */) (Lisp_Object window) { register struct window *w = decode_live_window (window); - if (w == XWINDOW (selected_window) - && current_buffer == XBUFFER (w->buffer)) - return Fpoint (); - return Fmarker_position (w->pointm); + if (w == XWINDOW (selected_window)) + return make_number (BUF_PT (XBUFFER (w->buffer))); + else + return Fmarker_position (w->pointm); } DEFUN ("window-start", Fwindow_start, Swindow_start, 0, 1, 0, @@ -1532,16 +1532,27 @@ Return POS. */) register struct window *w = decode_live_window (window); CHECK_NUMBER_COERCE_MARKER (pos); - if (w == XWINDOW (selected_window) - && XBUFFER (w->buffer) == current_buffer) - Fgoto_char (pos); - else - set_marker_restricted (w->pointm, pos, w->buffer); - /* We have to make sure that redisplay updates the window to show - the new value of point. */ - if (!EQ (window, selected_window)) - ++windows_or_buffers_changed; + if (w == XWINDOW (selected_window)) + { + if (XBUFFER (w->buffer) == current_buffer) + Fgoto_char (pos); + else + { + struct buffer *old_buffer = current_buffer; + + set_buffer_internal (XBUFFER (w->buffer)); + Fgoto_char (pos); + set_buffer_internal (old_buffer); + } + } + else + { + set_marker_restricted (w->pointm, pos, w->buffer); + /* We have to make sure that redisplay updates the window to show + the new value of point. */ + ++windows_or_buffers_changed; + } return pos; } @@ -1958,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)) @@ -3087,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)); } @@ -3124,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)); @@ -3191,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); } @@ -5526,7 +5540,6 @@ the return value is nil. Otherwise the value is t. */) struct Lisp_Vector *saved_windows; Lisp_Object new_current_buffer; Lisp_Object frame; - Lisp_Object auto_buffer_name; FRAME_PTR f; ptrdiff_t old_point = -1; @@ -5602,6 +5615,21 @@ the return value is nil. Otherwise the value is t. */) int previous_frame_menu_bar_lines = FRAME_MENU_BAR_LINES (f); int previous_frame_tool_bar_lines = FRAME_TOOL_BAR_LINES (f); + /* Don't do this within the main loop below: This may call Lisp + code and is thus potentially unsafe while input is blocked. */ + for (k = 0; k < saved_windows->header.size; k++) + { + p = SAVED_WINDOW_N (saved_windows, k); + window = p->window; + w = XWINDOW (window); + if (!NILP (w->buffer) + && !EQ (w->buffer, p->buffer) + && !NILP (BVAR (XBUFFER (p->buffer), name))) + /* If a window we restore gets another buffer, record the + window's old buffer. */ + call1 (Qrecord_window_buffer, window); + } + /* The mouse highlighting code could get screwed up if it runs during this. */ BLOCK_INPUT; @@ -5780,18 +5808,6 @@ the return value is nil. Otherwise the value is t. */) BUF_PT_BYTE (XBUFFER (w->buffer))); w->start_at_line_beg = 1; } - else if (STRINGP (auto_buffer_name = - Fwindow_parameter (window, Qauto_buffer_name)) - && SCHARS (auto_buffer_name) != 0 - && (wset_buffer (w, Fget_buffer_create (auto_buffer_name)), - !NILP (w->buffer))) - { - set_marker_restricted (w->start, - make_number (0), w->buffer); - set_marker_restricted (w->pointm, - make_number (0), w->buffer); - w->start_at_line_beg = 1; - } else /* Window has no live buffer, get one. */ { @@ -5889,7 +5905,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; @@ -6691,7 +6713,6 @@ syms_of_window (void) DEFSYM (Qtemp_buffer_show_hook, "temp-buffer-show-hook"); DEFSYM (Qabove, "above"); DEFSYM (Qbelow, "below"); - DEFSYM (Qauto_buffer_name, "auto-buffer-name"); DEFSYM (Qclone_of, "clone-of"); staticpro (&Vwindow_list); diff --git a/src/window.h b/src/window.h index 28b9678b667..dfb88b2cf3c 100644 --- a/src/window.h +++ b/src/window.h @@ -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 *); diff --git a/src/xdisp.c b/src/xdisp.c index e41783d03c1..86f041dea4d 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -768,9 +768,9 @@ static int clear_image_cache_count; static struct glyph_slice null_glyph_slice = { 0, 0, 0, 0 }; #endif -/* Non-zero while redisplay_internal is in progress. */ +/* True while redisplay_internal is in progress. */ -int redisplaying_p; +bool redisplaying_p; static Lisp_Object Qinhibit_free_realized_faces; static Lisp_Object Qmode_line_default_help_echo; @@ -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; } @@ -10480,11 +10480,10 @@ current_message_1 (ptrdiff_t a1, Lisp_Object a2, ptrdiff_t a3, ptrdiff_t a4) empty. This is a relatively infrequent operation, so it's not worth optimizing. */ -int +bool push_message (void) { - Lisp_Object msg; - msg = current_message (); + Lisp_Object msg = current_message (); Vmessage_stack = Fcons (msg, Vmessage_stack); return STRINGP (msg); } @@ -12967,12 +12966,11 @@ redisplay_internal (void) if (redisplaying_p) return; - /* Record a function that resets redisplaying_p to its old value + /* Record a function that clears redisplaying_p when we leave this function. */ count = SPECPDL_INDEX (); - record_unwind_protect (unwind_redisplay, - Fcons (make_number (redisplaying_p), selected_frame)); - ++redisplaying_p; + record_unwind_protect (unwind_redisplay, selected_frame); + redisplaying_p = 1; specbind (Qinhibit_free_realized_faces, Qnil); { @@ -13710,21 +13708,15 @@ redisplay_preserve_echo_area (int from_where) } -/* Function registered with record_unwind_protect in - redisplay_internal. Reset redisplaying_p to the value it had - before redisplay_internal was called, and clear - prevent_freeing_realized_faces_p. It also selects the previously +/* Function registered with record_unwind_protect in redisplay_internal. + Clear redisplaying_p. Also, select the previously selected frame, unless it has been deleted (by an X connection failure during redisplay, for example). */ static Lisp_Object -unwind_redisplay (Lisp_Object val) +unwind_redisplay (Lisp_Object old_frame) { - Lisp_Object old_redisplaying_p, old_frame; - - old_redisplaying_p = XCAR (val); - redisplaying_p = XFASTINT (old_redisplaying_p); - old_frame = XCDR (val); + redisplaying_p = 0; if (! EQ (old_frame, selected_frame) && FRAME_LIVE_P (XFRAME (old_frame))) select_frame_for_redisplay (old_frame); @@ -14552,8 +14544,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; @@ -15381,7 +15372,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 @@ -16225,7 +16216,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. */ @@ -17706,15 +17697,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 diff --git a/src/xfaces.c b/src/xfaces.c index 46121d66606..4df5caf6f2a 100644 --- a/src/xfaces.c +++ b/src/xfaces.c @@ -225,11 +225,10 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include "dosfns.h" #endif -#ifdef WINDOWSNT -#include "w32term.h" +#ifdef HAVE_WINDOW_SYSTEM +#include TERM_HEADER #include "fontset.h" -/* Redefine X specifics to W32 equivalents to avoid cluttering the - code with #ifdef blocks. */ +#ifdef WINDOWSNT #undef FRAME_X_DISPLAY_INFO #define FRAME_X_DISPLAY_INFO FRAME_W32_DISPLAY_INFO #define x_display_info w32_display_info @@ -238,13 +237,13 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #endif /* WINDOWSNT */ #ifdef HAVE_NS -#include "nsterm.h" #undef FRAME_X_DISPLAY_INFO #define FRAME_X_DISPLAY_INFO FRAME_NS_DISPLAY_INFO #define x_display_info ns_display_info #define check_x check_ns #define GCGraphicsExposures 0 #endif /* HAVE_NS */ +#endif /* HAVE_WINDOW_SYSTEM */ #include "buffer.h" #include "dispextern.h" @@ -254,9 +253,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ #include "termchar.h" #include "font.h" -#ifdef HAVE_WINDOW_SYSTEM -#include "fontset.h" -#endif /* HAVE_WINDOW_SYSTEM */ #ifdef HAVE_X_WINDOWS @@ -319,9 +315,10 @@ static Lisp_Object QCfontset; Lisp_Object Qnormal; Lisp_Object Qbold; static Lisp_Object Qline, Qwave; -Lisp_Object Qultra_light, Qextra_light, Qlight; +static Lisp_Object Qultra_light, Qreverse_oblique, Qreverse_italic; +Lisp_Object Qextra_light, Qlight; Lisp_Object Qsemi_light, Qsemi_bold, Qextra_bold, Qultra_bold; -Lisp_Object Qoblique, Qreverse_oblique, Qreverse_italic; +Lisp_Object Qoblique; Lisp_Object Qitalic; static Lisp_Object Qultra_condensed, Qextra_condensed; Lisp_Object Qcondensed; @@ -456,18 +453,7 @@ static int menu_face_changed_default; struct table_entry; struct named_merge_point; -static void map_tty_color (struct frame *, struct face *, - enum lface_attribute_index, int *); -static Lisp_Object resolve_face_name (Lisp_Object, int); static void set_font_frame_param (Lisp_Object, Lisp_Object); -static int get_lface_attributes (struct frame *, Lisp_Object, Lisp_Object *, - int, struct named_merge_point *); -static ptrdiff_t load_pixmap (struct frame *, Lisp_Object, - unsigned *, unsigned *); -static struct frame *frame_or_selected_frame (Lisp_Object, int); -static void load_face_colors (struct frame *, struct face *, Lisp_Object *); -static void free_face_colors (struct frame *, struct face *); -static int face_color_gray_p (struct frame *, const char *); static struct face *realize_face (struct face_cache *, Lisp_Object *, int); static struct face *realize_non_ascii_face (struct frame *, Lisp_Object, @@ -477,38 +463,11 @@ static struct face *realize_tty_face (struct face_cache *, Lisp_Object *); static int realize_basic_faces (struct frame *); static int realize_default_face (struct frame *); static void realize_named_face (struct frame *, Lisp_Object, int); -static int lface_fully_specified_p (Lisp_Object *); -static int lface_equal_p (Lisp_Object *, Lisp_Object *); -static unsigned hash_string_case_insensitive (Lisp_Object); -static unsigned lface_hash (Lisp_Object *); -static int lface_same_font_attributes_p (Lisp_Object *, Lisp_Object *); static struct face_cache *make_face_cache (struct frame *); static void clear_face_gcs (struct face_cache *); static void free_face_cache (struct face_cache *); -static int face_fontset (Lisp_Object *); -static void merge_face_vectors (struct frame *, Lisp_Object *, Lisp_Object*, - struct named_merge_point *); static int merge_face_ref (struct frame *, Lisp_Object, Lisp_Object *, int, struct named_merge_point *); -static int set_lface_from_font (struct frame *, Lisp_Object, Lisp_Object, - int); -static Lisp_Object lface_from_face_name (struct frame *, Lisp_Object, int); -static struct face *make_realized_face (Lisp_Object *); -static void cache_face (struct face_cache *, struct face *, unsigned); -static void uncache_face (struct face_cache *, struct face *); - -#ifdef HAVE_WINDOW_SYSTEM - -static GC x_create_gc (struct frame *, unsigned long, XGCValues *); -static void x_free_gc (struct frame *, GC); - -#ifdef USE_X_TOOLKIT -static void x_update_menu_appearance (struct frame *); - -extern void free_frame_menubar (struct frame *); -#endif /* USE_X_TOOLKIT */ - -#endif /* HAVE_WINDOW_SYSTEM */ /*********************************************************************** @@ -2565,13 +2524,13 @@ merge_face_ref (struct frame *f, Lisp_Object face_ref, Lisp_Object *to, } else if (EQ (keyword, QCstipple)) { -#if defined (HAVE_X_WINDOWS) || defined (HAVE_NS) +#if defined (HAVE_WINDOW_SYSTEM) Lisp_Object pixmap_p = Fbitmap_spec_p (value); if (!NILP (pixmap_p)) to[LFACE_STIPPLE_INDEX] = value; else err = 1; -#endif +#endif /* HAVE_WINDOW_SYSTEM */ } else if (EQ (keyword, QCwidth)) { @@ -2781,8 +2740,7 @@ The value is TO. */) copy = Finternal_make_lisp_face (to, new_frame); } - memcpy (XVECTOR (copy)->contents, XVECTOR (lface)->contents, - LFACE_VECTOR_SIZE * word_size); + vcopy (copy, 0, XVECTOR (lface)->contents, LFACE_VECTOR_SIZE); /* Changing a named face means that all realized faces depending on that face are invalid. Since we cannot tell which realized faces @@ -3126,14 +3084,14 @@ FRAME 0 means change the face on all frames, and change the default } else if (EQ (attr, QCstipple)) { -#if defined (HAVE_X_WINDOWS) || defined (HAVE_NS) +#if defined (HAVE_WINDOW_SYSTEM) if (!UNSPECIFIEDP (value) && !IGNORE_DEFFACE_P (value) && !NILP (value) && NILP (Fbitmap_spec_p (value))) signal_error ("Invalid stipple attribute", value); old_value = LFACE_STIPPLE (lface); ASET (lface, LFACE_STIPPLE_INDEX, value); -#endif /* HAVE_X_WINDOWS || HAVE_NS */ +#endif /* HAVE_WINDOW_SYSTEM */ } else if (EQ (attr, QCwidth)) { @@ -3831,9 +3789,9 @@ Default face attributes override any local face attributes. */) gvec = XVECTOR (global_lface)->contents; for (i = 1; i < LFACE_VECTOR_SIZE; ++i) if (IGNORE_DEFFACE_P (gvec[i])) - lvec[i] = Qunspecified; + ASET (local_lface, i, Qunspecified); else if (! UNSPECIFIEDP (gvec[i])) - lvec[i] = gvec[i]; + ASET (local_lface, i, AREF (global_lface, i)); /* If the default face was changed, update the face cache and the `font' frame parameter. */ @@ -3850,7 +3808,7 @@ Default face attributes override any local face attributes. */) the previously-cached vector. */ memcpy (attrs, oldface->lface, sizeof attrs); merge_face_vectors (f, lvec, attrs, 0); - memcpy (lvec, attrs, sizeof attrs); + vcopy (local_lface, 0, attrs, LFACE_VECTOR_SIZE); newface = realize_face (c, lvec, DEFAULT_FACE_ID); if ((! UNSPECIFIEDP (gvec[LFACE_FAMILY_INDEX]) diff --git a/src/xfont.c b/src/xfont.c index 072bce7bb0a..be9556d585a 100644 --- a/src/xfont.c +++ b/src/xfont.c @@ -46,7 +46,6 @@ struct xfont_info }; /* Prototypes of support functions. */ -extern void x_clear_errors (Display *); static XCharStruct *xfont_get_pcm (XFontStruct *, XChar2b *); @@ -390,7 +389,7 @@ xfont_list_pattern (Display *display, const char *pattern, Lisp_Object scripts = Qnil; for (i = 0; i < ASIZE (xfont_scratch_props); i++) - props[i] = Qnil; + ASET (xfont_scratch_props, i, Qnil); for (i = 0; i < num_fonts; i++) indices[i] = names[i]; qsort (indices, num_fonts, sizeof (char *), compare_font_names); @@ -467,9 +466,9 @@ xfont_list_pattern (Display *display, const char *pattern, word_size * 7) || ! EQ (AREF (entity, FONT_SPACING_INDEX), props[7])) { - memcpy (props, aref_addr (entity, FONT_FOUNDRY_INDEX), - word_size * 7); - props[7] = AREF (entity, FONT_SPACING_INDEX); + vcopy (xfont_scratch_props, 0, + aref_addr (entity, FONT_FOUNDRY_INDEX), 7); + ASET (xfont_scratch_props, 7, AREF (entity, FONT_SPACING_INDEX)); scripts = xfont_supported_scripts (display, indices[i], xfont_scratch_props, encoding); } diff --git a/src/xgselect.c b/src/xgselect.c index 04ca00274e8..0c00d815820 100644 --- a/src/xgselect.c +++ b/src/xgselect.c @@ -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 -} diff --git a/src/xgselect.h b/src/xgselect.h index 8e5614ea972..5509e23c5c0 100644 --- a/src/xgselect.h +++ b/src/xgselect.h @@ -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 */ diff --git a/src/xsmfns.c b/src/xsmfns.c index 1f6eb84260e..cddbb2aae86 100644 --- a/src/xsmfns.c +++ b/src/xsmfns.c @@ -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; diff --git a/src/xterm.c b/src/xterm.c index 118c8767c23..f497b5322bf 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -165,13 +165,6 @@ struct x_display_info *x_display_list; Lisp_Object x_display_name_list; -/* Frame being updated by update_frame. This is declared in term.c. - This is set by update_begin and looked at by all the XT functions. - It is zero while not inside an update. In that case, the XT - functions assume that `selected_frame' is the frame to apply to. */ - -extern struct frame *updating_frame; - /* This is a frame waiting to be auto-raised, within XTread_socket. */ static struct frame *pending_autoraise_frame; @@ -7850,7 +7843,7 @@ x_connection_closed (Display *dpy, const char *error_message) (https://bugzilla.gnome.org/show_bug.cgi?id=85715). Once, the resulting Glib error message loop filled a user's disk. To avoid this, kill Emacs unconditionally on disconnect. */ - shut_down_emacs (0, 0, Qnil); + shut_down_emacs (0, Qnil); fprintf (stderr, "%s\n\ When compiled with GTK, Emacs cannot recover from X disconnects.\n\ This is a GTK bug: https://bugzilla.gnome.org/show_bug.cgi?id=85715\n\ @@ -10609,8 +10602,6 @@ x_activate_timeout_atimer (void) /* Set up use of X before we make the first connection. */ -extern frame_parm_handler x_frame_parm_handlers[]; - static struct redisplay_interface x_redisplay_interface = { x_frame_parm_handlers, @@ -10815,8 +10806,6 @@ x_initialize (void) XSetIOErrorHandler (x_io_error_quitter); signal (SIGPIPE, x_connection_signal); - - xgselect_initialize (); } diff --git a/src/xterm.h b/src/xterm.h index 86a76fd81a9..2d718f49118 100644 --- a/src/xterm.h +++ b/src/xterm.h @@ -16,6 +16,9 @@ GNU General Public License for more details. You should have received a copy of the GNU General Public License along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */ +#ifndef XTERM_H +#define XTERM_H + #include <X11/Xlib.h> #include <X11/cursorfont.h> @@ -367,13 +370,14 @@ extern int use_xim; extern void check_x (void); extern struct frame *x_window_to_frame (struct x_display_info *, int); - extern struct frame *x_any_window_to_frame (struct x_display_info *, int); extern struct frame *x_menubar_window_to_frame (struct x_display_info *, XEvent *); - extern struct frame *x_top_window_to_frame (struct x_display_info *, int); +extern struct frame *x_menubar_window_to_frame (struct x_display_info *, + XEvent *); + #if ! defined (USE_X_TOOLKIT) && ! defined (USE_GTK) #define x_any_window_to_frame x_window_to_frame #define x_top_window_to_frame x_window_to_frame @@ -389,7 +393,6 @@ extern struct x_display_info *x_display_list; extern Lisp_Object x_display_name_list; extern struct x_display_info *x_display_info_for_display (Display *); -extern void x_set_frame_alpha (struct frame *); extern struct x_display_info *x_term_init (Lisp_Object, char *, char *); extern int x_display_ok (const char *); @@ -544,9 +547,6 @@ struct x_output /* Non-zero means hourglass cursor is currently displayed. */ unsigned hourglass_p : 1; - /* Flag to set when the X window needs to be completely repainted. */ - int needs_exposure; - /* These are the current window manager hints. It seems that XSetWMHints, when presented with an unset bit in the `flags' member of the hints structure, does not leave the corresponding @@ -944,7 +944,6 @@ XrmDatabase x_load_resources (Display *, const char *, const char *, /* Defined in xterm.c */ extern int x_text_icon (struct frame *, const char *); -extern int x_bitmap_icon (struct frame *, Lisp_Object); extern void x_catch_errors (Display *); extern void x_check_errors (Display *, const char *) ATTRIBUTE_FORMAT_PRINTF (2, 0); @@ -956,11 +955,6 @@ extern void x_set_mouse_position (struct frame *, int, int); extern void x_set_mouse_pixel_position (struct frame *, int, int); extern void xembed_request_focus (struct frame *); extern void x_ewmh_activate_frame (struct frame *); -extern void x_make_frame_visible (struct frame *); -extern void x_make_frame_invisible (struct frame *); -extern void x_iconify_frame (struct frame *); -extern void x_free_frame_resources (struct frame *); -extern void x_wm_set_size_hint (struct frame *, long, int); extern void x_delete_terminal (struct terminal *terminal); extern unsigned long x_copy_color (struct frame *, unsigned long); #ifdef USE_X_TOOLKIT @@ -973,7 +967,6 @@ extern int x_alloc_lighter_color_for_widget (Widget, Display *, Colormap, double, int); #endif extern int x_alloc_nearest_color (struct frame *, Colormap, XColor *); -extern void x_query_colors (struct frame *f, XColor *, int); extern void x_query_color (struct frame *f, XColor *); extern void x_clear_area (Display *, Window, int, int, int, int, int); #if defined HAVE_MENUS && !defined USE_X_TOOLKIT && !defined USE_GTK @@ -1032,8 +1025,6 @@ extern int xg_set_icon (struct frame *, Lisp_Object); extern int xg_set_icon_from_xpm_data (struct frame *, const char**); #endif /* USE_GTK */ -extern void x_real_positions (struct frame *, int *, int *); -extern void x_set_menu_bar_lines (struct frame *, Lisp_Object, Lisp_Object); extern void x_implicitly_set_name (struct frame *, Lisp_Object, Lisp_Object); extern void xic_free_xfontset (struct frame *); extern void create_frame_xic (struct frame *); @@ -1043,9 +1034,6 @@ extern void xic_set_statusarea (struct frame *); extern void xic_set_xfontset (struct frame *, const char *); extern int x_pixel_width (struct frame *); extern int x_pixel_height (struct frame *); -extern int x_char_width (struct frame *); -extern int x_char_height (struct frame *); -extern void x_sync (struct frame *); extern int x_defined_color (struct frame *, const char *, XColor *, int); #ifdef HAVE_X_I18N extern void free_frame_xic (struct frame *); @@ -1053,7 +1041,6 @@ extern void free_frame_xic (struct frame *); extern char * xic_create_fontsetname (const char *base_fontname, int motif); # endif #endif -extern void x_set_tool_bar_lines (struct frame *, Lisp_Object, Lisp_Object); /* Defined in xfaces.c */ @@ -1070,10 +1057,8 @@ extern void x_menu_set_in_use (int); #ifdef USE_MOTIF extern void x_menu_wait_for_event (void *data); #endif -extern void x_activate_menubar (struct frame *); extern int popup_activated (void); extern void initialize_frame_menubar (struct frame *); -extern void free_frame_menubar (struct frame *); /* Defined in widget.c */ @@ -1115,3 +1100,5 @@ extern Lisp_Object Qx_gtk_map_stock; (nr).y = (ry), \ (nr).width = (rwidth), \ (nr).height = (rheight)) + +#endif /* XTERM_H */ diff --git a/test/ChangeLog b/test/ChangeLog index c3183406ea2..f523f6f59a9 100644 --- a/test/ChangeLog +++ b/test/ChangeLog @@ -1,3 +1,8 @@ +2012-08-28 Chong Yidong <cyd@gnu.org> + + * automated/files.el: Test every combination of values for + enable-local-variables and enable-local-eval. + 2012-08-19 Chong Yidong <cyd@gnu.org> * redisplay-testsuite.el (test-redisplay): Use switch-to-buffer. diff --git a/test/automated/files.el b/test/automated/files.el index e43d8c32f85..b6011395bfd 100644 --- a/test/automated/files.el +++ b/test/automated/files.el @@ -21,32 +21,129 @@ (require 'ert) -(defvar files-test-var1 nil) +;; Set to t if the local variable was set, `query' if the query was +;; triggered. +(defvar files-test-result) + +(defvar files-test-safe-result) +(put 'files-test-safe-result 'safe-local-variable 'booleanp) (defun files-test-fun1 () - (setq files-test-var1 t)) + (setq files-test-result t)) -(ert-deftest files-test-bug12155 () - "Test for http://debbugs.gnu.org/12155 ." - (with-temp-buffer - (insert "text\n" - ";; Local Variables:\n" - ";; eval: (files-test-fun1)\n" - ";; End:\n") - (let ((enable-local-variables :safe) - (enable-local-eval 'maybe)) - (hack-local-variables) - (should (eq files-test-var1 nil))))) +;; Test combinations: +;; `enable-local-variables' t, nil, :safe, :all, or something else. +;; `enable-local-eval' t, nil, or something else. + +(defvar files-test-local-variable-data + ;; Unsafe eval form + '((("eval: (files-test-fun1)") + (t t (eq files-test-result t)) + (t nil (eq files-test-result nil)) + (t maybe (eq files-test-result 'query)) + (nil t (eq files-test-result nil)) + (nil nil (eq files-test-result nil)) + (nil maybe (eq files-test-result nil)) + (:safe t (eq files-test-result nil)) + (:safe nil (eq files-test-result nil)) + (:safe maybe (eq files-test-result nil)) + (:all t (eq files-test-result t)) + (:all nil (eq files-test-result nil)) + (:all maybe (eq files-test-result t)) ; This combination is ambiguous. + (maybe t (eq files-test-result 'query)) + (maybe nil (eq files-test-result 'query)) + (maybe maybe (eq files-test-result 'query))) + ;; Unsafe local variable value + (("files-test-result: t") + (t t (eq files-test-result 'query)) + (t nil (eq files-test-result 'query)) + (t maybe (eq files-test-result 'query)) + (nil t (eq files-test-result nil)) + (nil nil (eq files-test-result nil)) + (nil maybe (eq files-test-result nil)) + (:safe t (eq files-test-result nil)) + (:safe nil (eq files-test-result nil)) + (:safe maybe (eq files-test-result nil)) + (:all t (eq files-test-result t)) + (:all nil (eq files-test-result t)) + (:all maybe (eq files-test-result t)) + (maybe t (eq files-test-result 'query)) + (maybe nil (eq files-test-result 'query)) + (maybe maybe (eq files-test-result 'query))) + ;; Safe local variable + (("files-test-safe-result: t") + (t t (eq files-test-safe-result t)) + (t nil (eq files-test-safe-result t)) + (t maybe (eq files-test-safe-result t)) + (nil t (eq files-test-safe-result nil)) + (nil nil (eq files-test-safe-result nil)) + (nil maybe (eq files-test-safe-result nil)) + (:safe t (eq files-test-safe-result t)) + (:safe nil (eq files-test-safe-result t)) + (:safe maybe (eq files-test-safe-result t)) + (:all t (eq files-test-safe-result t)) + (:all nil (eq files-test-safe-result t)) + (:all maybe (eq files-test-safe-result t)) + (maybe t (eq files-test-result 'query)) + (maybe nil (eq files-test-result 'query)) + (maybe maybe (eq files-test-result 'query))) + ;; Safe local variable with unsafe value + (("files-test-safe-result: 1") + (t t (eq files-test-result 'query)) + (t nil (eq files-test-result 'query)) + (t maybe (eq files-test-result 'query)) + (nil t (eq files-test-safe-result nil)) + (nil nil (eq files-test-safe-result nil)) + (nil maybe (eq files-test-safe-result nil)) + (:safe t (eq files-test-safe-result nil)) + (:safe nil (eq files-test-safe-result nil)) + (:safe maybe (eq files-test-safe-result nil)) + (:all t (eq files-test-safe-result 1)) + (:all nil (eq files-test-safe-result 1)) + (:all maybe (eq files-test-safe-result 1)) + (maybe t (eq files-test-result 'query)) + (maybe nil (eq files-test-result 'query)) + (maybe maybe (eq files-test-result 'query)))) + "List of file-local variable tests. +Each list element should have the form + + (LOCAL-VARS-LIST . TEST-LIST) -(ert-deftest files-test-disable-local-variables () - "Test that setting enable-local-variables to nil works." +where LOCAL-VARS-LISTS should be a list of local variable +definitions (strings) and TEST-LIST is a list of tests to +perform. Each entry of TEST-LIST should have the form + + (ENABLE-LOCAL-VARIABLES ENABLE-LOCAL-EVAL FORM) + +where ENABLE-LOCAL-VARIABLES is the value to assign to +`enable-local-variables', ENABLE-LOCAL-EVAL is the value to +assign to `enable-local-eval', and FORM is a desired `should' +form.") + +(defun file-test--do-local-variables-test (str test-settings) (with-temp-buffer - (insert "text\n" - ";; Local Variables:\n" - ";; files-test-var1: t\n" - ";; End:\n") - (let ((enable-local-variables nil)) + (insert str) + (let ((enable-local-variables (nth 0 test-settings)) + (enable-local-eval (nth 1 test-settings)) + (files-test-result nil) + (files-test-queried nil) + (files-test-safe-result nil)) (hack-local-variables) - (should (eq files-test-var1 nil))))) + (eval (nth 2 test-settings))))) + +(ert-deftest files-test-local-variables () + "Test the file-local variables implementation." + (unwind-protect + (progn + (defadvice hack-local-variables-confirm (around files-test activate) + (setq files-test-result 'query) + nil) + (dolist (test files-test-local-variable-data) + (let ((str (concat "text\n\n;; Local Variables:\n;; " + (mapconcat 'identity (car test) "\n;; ") + "\n;; End:\n"))) + (dolist (subtest (cdr test)) + (should (file-test--do-local-variables-test str subtest)))))) + (ad-disable-advice 'hack-local-variables-confirm 'around 'files-test))) ;;; files.el ends here |