emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master 77083e2 2/7: Merge branch 'master' of git.sv.gnu.or


From: Michael Mauger
Subject: [Emacs-diffs] master 77083e2 2/7: Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
Date: Sun, 6 Aug 2017 20:59:15 -0400 (EDT)

branch: master
commit 77083e2d34ba5559ae2899d3b03cf08c2e6c5ad4
Merge: c5a31f8 8e394a7
Author: Michael R. Mauger <address@hidden>
Commit: Michael R. Mauger <address@hidden>

    Merge branch 'master' of git.sv.gnu.org:/srv/git/emacs
---
 .gitignore                              |   1 -
 ChangeLog.3                             |   2 +-
 Makefile.in                             |  26 +-
 admin/MAINTAINERS                       |  12 +-
 admin/gitmerge.el                       |   2 +-
 build-aux/config.sub                    |   7 +-
 configure.ac                            |  51 ++--
 doc/lispref/os.texi                     |   5 +-
 doc/lispref/windows.texi                | 108 ++++----
 doc/misc/cc-mode.texi                   |  60 ++++-
 doc/misc/dired-x.texi                   |  18 +-
 doc/misc/org.texi                       |   9 +-
 doc/misc/tramp.texi                     |  50 +++-
 etc/NEWS                                |   7 +-
 etc/TODO                                |   2 +-
 lib-src/Makefile.in                     |  24 +-
 lib/Makefile.in                         |  10 +-
 lib/getopt.c                            |  70 ++---
 lib/getopt.in.h                         |  41 ++-
 lib/getopt1.c                           |  22 +-
 lib/getopt_int.h                        |  22 +-
 lib/gnulib.mk.in                        |   1 -
 lisp/Makefile.in                        |   8 +-
 lisp/cedet/semantic/wisent/wisent.el    |   2 +-
 lisp/dired-x.el                         |  85 ++++---
 lisp/emacs-lisp/bytecomp.el             |   2 +-
 lisp/emacs-lisp/edebug.el               |   4 +-
 lisp/emacs-lisp/ert.el                  |  22 +-
 lisp/emacs-lisp/lisp-mode.el            |  35 ++-
 lisp/emacs-lisp/pcase.el                |   4 +-
 lisp/emacs-lisp/seq.el                  |   2 +-
 lisp/emacs-lisp/thunk.el                |   2 -
 lisp/ffap.el                            |  41 ++-
 lisp/filenotify.el                      | 437 +++++++++++++++-----------------
 lisp/files-x.el                         |  14 +-
 lisp/files.el                           |   7 +-
 lisp/gnus/gnus-start.el                 |   2 +-
 lisp/gnus/gnus-util.el                  |   5 -
 lisp/help.el                            |   2 +-
 lisp/ibuffer.el                         |   2 +-
 lisp/info.el                            |  24 +-
 lisp/ldefs-boot.el                      | 206 +++++++--------
 lisp/man.el                             |   5 +-
 lisp/net/shr.el                         |  24 +-
 lisp/net/tramp-adb.el                   |  14 +-
 lisp/net/tramp-cache.el                 |   2 +-
 lisp/net/tramp-cmds.el                  |   2 +-
 lisp/net/tramp-compat.el                |   2 +-
 lisp/net/tramp-ftp.el                   |   2 +-
 lisp/net/tramp-gvfs.el                  |  12 +-
 lisp/net/tramp-sh.el                    |  21 +-
 lisp/net/tramp-smb.el                   |   9 +-
 lisp/net/tramp-uu.el                    |   2 +-
 lisp/net/tramp.el                       | 115 ++++-----
 lisp/net/trampver.el                    |   2 +-
 lisp/play/dunnet.el                     |  39 ++-
 lisp/progmodes/cc-defs.el               |   2 +-
 lisp/progmodes/cc-engine.el             |  32 ++-
 lisp/progmodes/cc-fonts.el              | 216 +++++++++-------
 lisp/progmodes/cc-mode.el               |   1 +
 lisp/progmodes/cc-vars.el               |  12 +
 lisp/progmodes/js.el                    |  13 +-
 lisp/progmodes/perl-mode.el             |   8 +-
 lisp/progmodes/python.el                |  16 +-
 lisp/replace.el                         |   3 -
 lisp/ses.el                             |  11 +-
 lisp/shell.el                           |  67 ++---
 lisp/simple.el                          |   2 +-
 lisp/textmodes/css-mode.el              |  12 +-
 lisp/textmodes/ispell.el                |  32 ++-
 lisp/url/url-auth.el                    | 403 +++++++++++++++++++++--------
 lisp/url/url-domsuf.el                  |   2 +-
 lisp/vc/diff-mode.el                    |   2 +-
 lisp/vc/ediff-ptch.el                   |  13 +-
 lwlib/Makefile.in                       |  28 +-
 make-dist                               |   9 +-
 modules/mod-test/test.el                |  16 +-
 oldXMenu/Makefile.in                    |  22 +-
 src/Makefile.in                         |  25 +-
 src/editfns.c                           |   2 +-
 src/fns.c                               | 121 ++++++---
 src/gtkutil.c                           |  83 ++++--
 src/inotify.c                           | 432 ++++++++++++++++++++-----------
 src/lisp.h                              |   1 +
 src/xdisp.c                             |  20 +-
 src/xterm.c                             |  22 ++
 test/Makefile.in                        |  64 ++---
 test/file-organization.org              |   6 +-
 test/lisp/dired-x-tests.el              |  53 ++++
 test/lisp/emacs-lisp/cl-lib-tests.el    |  26 ++
 test/lisp/emacs-lisp/lisp-mode-tests.el |   4 +
 test/lisp/filenotify-tests.el           |  65 ++++-
 test/lisp/net/tramp-tests.el            |  18 +-
 test/lisp/progmodes/js-tests.el         |  37 +++
 test/lisp/progmodes/python-tests.el     |  19 ++
 test/lisp/url/url-auth-tests.el         |  51 +++-
 test/lisp/vc/ediff-ptch-tests.el        |  69 ++++-
 test/make-test-deps.emacs-lisp          |  98 -------
 test/src/inotify-tests.el               |   9 +
 99 files changed, 2369 insertions(+), 1485 deletions(-)

diff --git a/.gitignore b/.gitignore
index ce1866d..aa9e1ff 100644
--- a/.gitignore
+++ b/.gitignore
@@ -141,7 +141,6 @@ src/*.map
 
 # Tests.
 test/indent/*.new
-test/make-test-deps.mk
 test/manual/biditest.txt
 test/manual/etags/srclist
 test/manual/etags/regexfile
diff --git a/ChangeLog.3 b/ChangeLog.3
index 1c2f5b1..f187c28 100644
--- a/ChangeLog.3
+++ b/ChangeLog.3
@@ -1015,7 +1015,7 @@
        Upcase Path and ComSpec in process-environment
 
        Since 2016-07-18 "Keep w32 environment settings internal only", the
-       upcasing of environment variables "Path" and "ComSpec" occured after
+       upcasing of environment variables "Path" and "ComSpec" occurred after
        initializing process-environment.  This meant that Lisp code trying to
        override "PATH" environment had no effect (Bug #24956).
 
diff --git a/Makefile.in b/Makefile.in
index cf8ff84..06909c3 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -821,9 +821,7 @@ mostlyclean_dirs = src oldXMenu lwlib lib lib-src nt 
doc/emacs doc/misc \
 $(foreach dir,$(mostlyclean_dirs),$(eval $(call 
submake_template,$(dir),mostlyclean)))
 
 mostlyclean: $(mostlyclean_dirs:=_mostlyclean)
-       for dir in test/automated; do \
-         [ ! -d $$dir ] || $(MAKE) -C $$dir mostlyclean; \
-       done
+       [ ! -d test ] || $(MAKE) -C test $@
 
 ### 'clean'
 ###      Delete all files from the current directory that are normally
@@ -838,9 +836,8 @@ clean_dirs = $(mostlyclean_dirs) nextstep
 $(foreach dir,$(clean_dirs),$(eval $(call submake_template,$(dir),clean)))
 
 clean: $(clean_dirs:=_clean)
-       for dir in test/automated admin/charsets; do \
-         [ ! -d $$dir ] || $(MAKE) -C $$dir clean; \
-       done
+       $(MAKE) -C admin/charsets $@
+       [ ! -d test ] || $(MAKE) -C test $@
        -rm -f *.tmp etc/*.tmp*
        -rm -rf info-dir.*
 
@@ -864,12 +861,13 @@ distclean_dirs = $(clean_dirs) leim lisp
 
 $(foreach dir,$(distclean_dirs),$(eval $(call 
submake_template,$(dir),distclean)))
 
-maybeclean_dirs = test/automated admin/grammars admin/unidata admin/charsets
+maybeclean_dirs = test admin/grammars admin/unidata admin/charsets
 
 distclean: $(distclean_dirs:=_distclean)
-       for dir in ${maybeclean_dirs}; do \
-         [ ! -d $$dir ] || $(MAKE) -C $$dir distclean; \
+       for dir in $(filter-out test,$(maybeclean_dirs)); do \
+         $(MAKE) -C $$dir $@ || exit; \
        done
+       [ ! -d test ] || $(MAKE) -C test $@
        ${top_distclean}
 
 ### 'bootstrap-clean'
@@ -878,9 +876,10 @@ distclean: $(distclean_dirs:=_distclean)
 $(foreach dir,$(distclean_dirs),$(eval $(call 
submake_template,$(dir),bootstrap-clean)))
 
 bootstrap-clean: $(distclean_dirs:=_bootstrap-clean)
-       for dir in ${maybeclean_dirs}; do \
-         [ ! -d $$dir ] || $(MAKE) -C $$dir bootstrap-clean; \
+       for dir in $(filter-out test,$(maybeclean_dirs)); do \
+         $(MAKE) -C $$dir $@ || exit; \
        done
+       [ ! -d test ] || $(MAKE) -C test $@
        [ ! -f config.log ] || mv -f config.log config.log~
        rm -rf ${srcdir}/info
        rm -f ${srcdir}/etc/refcards/emacsver.tex
@@ -906,9 +905,10 @@ maintainer_clean_dirs = src leim lisp
 $(foreach dir,$(maintainer_clean_dirs),$(eval $(call 
submake_template,$(dir),maintainer-clean)))
 
 maintainer-clean: bootstrap-clean $(maintainer_clean_dirs:=_maintainer-clean)
-       for dir in ${maybeclean_dirs}; do \
-         [ ! -d $$dir ] || $(MAKE) -C $$dir maintainer-clean; \
+       for dir in $(filter-out test,$(maybeclean_dirs)); do \
+         $(MAKE) -C $$dir $@ || exit; \
        done
+       [ ! -d test ] || $(MAKE) -C test $@
        ${top_maintainer_clean}
 
 ### This doesn't actually appear in the coding standards, but Karl
diff --git a/admin/MAINTAINERS b/admin/MAINTAINERS
index 5aff824..c13cb55 100644
--- a/admin/MAINTAINERS
+++ b/admin/MAINTAINERS
@@ -82,11 +82,11 @@ Simen Heggestøyl
 
 Nicolas Petton
        lisp/emacs-lisp/map.el
-       test/automated/map-tests.el
+       test/lisp/emac-lisp/map-tests.el
        lisp/emacs-lisp/seq.el
-       test/automated/seq-tests.el
+       test/lisp/emac-lisp/seq-tests.el
        lisp/emacs-lisp/thunk.el
-       test/automated/thunk-tests.el
+       test/lisp/emac-lisp/thunk-tests.el
 
 The GNU AUCTeX maintainers (address@hidden)
        RefTeX
@@ -104,7 +104,7 @@ The GNU AUCTeX maintainers (address@hidden)
 
 Dmitry Gutov
        lisp/progmodes/ruby-mode.el
-       test/automated/ruby-mode-tests.el
+       test/lisp/progmodes/ruby-mode-tests.el
        test/indent/ruby.rb
        lisp/progmodes/xref.el
        lisp/progmodes/project.el
@@ -119,11 +119,11 @@ Ulf Jasper
            lisp/net/newst-ticker.el
            lisp/net/newst-treeview.el
            lisp/net/newsticker.el
-           test/automated/newsticker-tests.el
+           test/lisp/net/newsticker-tests.el
 
        Icalendar
            lisp/calendar/icalendar.el
-           test/automated/icalendar-tests.el
+           test/lisp/calendar/icalendar-tests.el
 
 ==============================================================================
 2. Areas that someone is willing to maintain, although he would not
diff --git a/admin/gitmerge.el b/admin/gitmerge.el
index c3981dd..a0efce5 100644
--- a/admin/gitmerge.el
+++ b/admin/gitmerge.el
@@ -50,7 +50,7 @@
 (defvar gitmerge-skip-regexp
   ;; We used to include "sync" in there, but in my experience it only
   ;; caused false positives.  --Stef
-  "back[- ]?port\\|cherry picked from commit\\|\\(do not\\|no need to\\) 
merge\\|\
+  "back[- ]?port\\|cherry picked from commit\\|\\(do\\( no\\|n['’]\\)t\\|no 
need to\\) merge\\|\
 re-?generate\\|bump version\\|from trunk\\|Auto-commit"
   "Regexp matching logs of revisions that might be skipped.
 `gitmerge-missing' will ask you if it should skip any matches.")
diff --git a/build-aux/config.sub b/build-aux/config.sub
index 87abeab..7203bf1 100755
--- a/build-aux/config.sub
+++ b/build-aux/config.sub
@@ -2,7 +2,7 @@
 # Configuration validation subroutine script.
 #   Copyright 1992-2017 Free Software Foundation, Inc.
 
-timestamp='2017-02-07'
+timestamp='2017-03-21'
 
 # This file is free software; you can redistribute it and/or modify it
 # under the terms of the GNU General Public License as published by
@@ -315,6 +315,7 @@ case $basic_machine in
        | ubicom32 \
        | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
        | visium \
+       | wasm32 \
        | we32k \
        | x86 | xc16x | xstormy16 | xtensa \
        | z8k | z80)
@@ -446,6 +447,7 @@ case $basic_machine in
        | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
        | vax-* \
        | visium-* \
+       | wasm32-* \
        | we32k-* \
        | x86-* | x86_64-* | xc16x-* | xps100-* \
        | xstormy16-* | xtensa*-* \
@@ -1246,6 +1248,9 @@ case $basic_machine in
                basic_machine=a29k-wrs
                os=-vxworks
                ;;
+       wasm32)
+               basic_machine=wasm32-unknown
+               ;;
        w65*)
                basic_machine=w65-wdc
                os=-none
diff --git a/configure.ac b/configure.ac
index b922dc4..bd8f765 100644
--- a/configure.ac
+++ b/configure.ac
@@ -234,14 +234,16 @@ AC_DEFUN([OPTION_DEFAULT_ON], [dnl
 # connections.  Encrypted connections should be the default.
 
 OPTION_DEFAULT_OFF([mailutils],
-  [rely on GNU Mailutils being installed; this makes the options
-   --without-pop through --with-mailhost irrelevant])
+  [rely on GNU Mailutils, so that the --without-pop through --with-mailhost
+   options are irrelevant])
 if test "$with_mailutils" = no; then
   with_mailutils=
 fi
 AC_SUBST([with_mailutils])
 
-OPTION_DEFAULT_ON([pop],[don't support POP mail retrieval with movemail])
+OPTION_DEFAULT_ON([pop],
+  [don't support POP mail retrieval with movemail (--without-pop or
+   --with-mailutils is recommended, as movemail POP is insecure)])
 if test "$with_pop" = yes; then
    AC_DEFINE(MAIL_USE_POP)
 fi
@@ -1176,6 +1178,16 @@ AC_PATH_PROG(GZIP_PROG, gzip)
 test $with_compress_install != yes && test -n "$GZIP_PROG" && \
    GZIP_PROG=" # $GZIP_PROG # (disabled by configure 
--without-compress-install)"
 
+AC_CACHE_CHECK([for 'find' args to delete a file],
+  [emacs_cv_find_delete],
+  [if touch conftest.tmp && find conftest.tmp -delete 2>/dev/null &&
+      test ! -f conftest.tmp
+   then emacs_cv_find_delete="-delete"
+   else emacs_cv_find_delete="-exec rm -f {} ';'"
+   fi])
+FIND_DELETE=$emacs_cv_find_delete
+AC_SUBST([FIND_DELETE])
+
 PAXCTL_dumped=
 PAXCTL_notdumped=
 if test $opsys = gnu-linux; then
@@ -1730,6 +1742,7 @@ dnl AC_C_BIGENDIAN is done by gnulib.
 dnl check for Make feature
 
 AUTO_DEPEND=no
+AUTODEPEND_PARENTS='lib src'
 dnl check if we have GCC and autodepend is on.
 if test "$GCC" = yes && test "$ac_enable_autodepend" = yes; then
    AC_MSG_CHECKING([whether gcc understands -MMD -MF])
@@ -5013,8 +5026,10 @@ if test "$HAVE_GTK" = yes || test "$HAVE_X11" != yes; 
then
   LIBXMENU=
 elif test "$USE_X_TOOLKIT" = none; then
   LIBXMENU='$(oldXMenudir)/libXMenu11.a'
+  AUTODEPEND_PARENTS="$AUTODEPEND_PARENTS oldXMenu"
 else
   LIBXMENU='$(lwlibdir)/liblw.a'
+  AUTODEPEND_PARENTS="$AUTODEPEND_PARENTS lwlib"
 fi
 AC_SUBST(LIBXMENU)
 
@@ -5470,34 +5485,34 @@ ${MAKE-make} -s MAKEFILE_NAME=do-not-make-Makefile 
etc-emacsver || \
 AC_MSG_ERROR(['etc/refcards/emacsver.tex' could not be made.])
 ])
 
+if test $AUTO_DEPEND = yes; then
+   for dir in $AUTODEPEND_PARENTS; do
+     AS_MKDIR_P([$dir/deps])
+   done
+fi
+
 AC_OUTPUT
 
 if test ! "$with_mailutils"; then
+  if test "$with_pop" = yes; then
+    AC_MSG_WARN([This configuration installs a 'movemail' program
+that retrieves POP3 email via only insecure channels.
+To omit insecure POP3, you can use '$0 --without-pop'.])
+  fi
+
   case $opsys in
     cygwin | mingw32)
       # Don't suggest GNU Mailutils, as it hasn't been ported.
-      if test "$with_pop" = yes; then
-       emacs_fix_movemail="use '$0 --without-pop'"
-      else
-       emacs_fix_movemail=
-      fi;;
+      ;;
     *)
       emacs_fix_movemail="use '$0 --with-mailutils'"
       case `(movemail --version) 2>/dev/null` in
        *Mailutils*) ;;
        *) emacs_fix_movemail="install GNU Mailutils
 <http://mailutils.org> and $emacs_fix_movemail";;
-      esac;;
+      esac
+      AC_MSG_NOTICE([You might want to $emacs_fix_movemail.]);;
   esac
-
-  if test "$with_pop" = yes; then
-    AC_MSG_WARN([This configuration installs a 'movemail' program
-that retrieves POP3 email via only insecure channels.
-To fix this you can $emacs_fix_movemail.])
-  elif test "$emacs_fix_movemail"; then
-    AC_MSG_NOTICE([This configuration installs a 'movemail' program that cannot
-retrieve POP3 email.  You might want to $emacs_fix_movemail.])
-  fi
 fi
 
 test "$MAKE" = make || AC_MSG_NOTICE([Now you can run '$MAKE'.])
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi
index 9b6752c..438f48c 100644
--- a/doc/lispref/os.texi
+++ b/doc/lispref/os.texi
@@ -2707,7 +2707,10 @@ This does not depend on one of the libraries linked to 
Emacs.
 
 Since all these libraries emit different events on notified file
 changes, there is the Emacs library @code{filenotify} which provides a
-unique interface.
+unified interface.  Lisp programs that want to receive file
+notifications should always use this library in preference to the
+native ones.
+
 
 @defun file-notify-add-watch file flags callback
 Add a watch for filesystem events pertaining to @var{file}.  This
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi
index a4f8400..6aa9591 100644
--- a/doc/lispref/windows.texi
+++ b/doc/lispref/windows.texi
@@ -2803,12 +2803,13 @@ put it in the selected window.
 @section Window History
 @cindex window history
 
-Each window remembers in a list the buffers it has previously displayed,
-and the order in which these buffers were removed from it.  This history
-is used, for example, by @code{replace-buffer-in-windows}
-(@pxref{Buffers and Windows}).  The list is automatically maintained by
-Emacs, but you can use the following functions to explicitly inspect or
-alter it:
+Each window remembers in a list the buffers it has previously
+displayed, and the order in which these buffers were removed from it.
+This history is used, for example, by @code{replace-buffer-in-windows}
+(@pxref{Buffers and Windows}), and when quitting windows
+(@pxref{Quitting Windows}).  The list is automatically maintained by
+Emacs, but you can use the following functions to explicitly inspect
+or alter it:
 
 @defun window-prev-buffers &optional window
 This function returns a list specifying the previous contents of
@@ -2994,33 +2995,35 @@ described next to deal with the window and its buffer.
 @end deffn
 
 @defun quit-restore-window &optional window bury-or-kill
-This function tries to restore the state of @var{window} that existed
-before its buffer was displayed in it.  The optional argument
address@hidden must be a live window and defaults to the selected one.
+This function handles @var{window} and its buffer after quitting.  The
+optional argument @var{window} must be a live window and defaults to
+the selected one. The function's behavior is determined by the four
+elements of the @code{quit-restore} window parameter (@pxref{Window
+Parameters}), which is set to nil afterwards.
+
+The window is deleted entirely if: 1) the first element of the
address@hidden parameter is one of 'window or 'frame, 2) the
+window has no history of previously-displayed buffers, and 3) the
+displayed buffer matches the one in the fourth element of the
address@hidden parameter.  If @var{window} is the
+only window on its frame and there are other frames on the frame's
+terminal, the value of the optional argument @var{bury-or-kill}
+determines how to proceed with the window.  If @var{bury-or-kill}
+equals @code{kill}, the frame is deleted unconditionally.  Otherwise,
+the fate of the frame is determined by calling
address@hidden (see below) with that frame as sole
+argument.
 
-If @var{window} was created specially for displaying its buffer, this
-function deletes @var{window} provided its frame contains at least one
-other live window.  If @var{window} is the only window on its frame and
-there are other frames on the frame's terminal, the value of the
-optional argument @var{bury-or-kill} determines how to proceed with the
-window.  If @var{bury-or-kill} equals @code{kill}, the frame is deleted
-unconditionally.  Otherwise, the fate of the frame is determined by
-calling @code{frame-auto-hide-function} (see below) with that frame as
-sole argument.
-
-Otherwise, this function tries to redisplay the buffer previously shown
-in @var{window}.  It also tries to restore the window start
-(@pxref{Window Start and End}) and point (@pxref{Window Point})
-positions of the previously shown buffer.  If, in addition,
+If the third element of the @code{quit-restore} parameter is a list of
+buffer, window start (@pxref{Window Start and End}), and point
+(@pxref{Window Point}), and that buffer is still live, the buffer will
+be displayed, and start and point set accordingly.  If, in addition,
 @var{window}'s buffer was temporarily resized, this function will also
 try to restore the original height of @var{window}.
 
-The cases described so far require that the buffer shown in @var{window}
-is still the buffer displayed by the last buffer display function for
-this window.  If another buffer has been shown in the meantime, or the
-buffer previously shown no longer exists, this function calls
address@hidden (@pxref{Window History}) to show some other
-buffer instead.
+Otherwise, if @var{window} was previously used for displaying other
+buffers (@pxref{Window History}), the most recent buffer in that
+history will be displayed.
 
 The optional argument @var{bury-or-kill} specifies how to deal with
 @var{window}'s buffer.  The following values are handled:
@@ -3048,9 +3051,24 @@ buffer again without killing the buffer.
 This means to kill @var{window}'s buffer.
 @end table
 
address@hidden bases its decisions on information stored in
address@hidden's @code{quit-restore} window parameter (@pxref{Window
-Parameters}), and resets that parameter to @code{nil} after it's done.
+Typically, the display routines run by @code{display-buffer} will set
+the @code{quit-restore} window parameter correctly.  It's also
+possible to set it manually, using the following code for displaying
address@hidden in @var{window}:
+
address@hidden
address@hidden
+(display-buffer-record-window type window buffer)
+
+(set-window-buffer window buffer)
+
+(set-window-prev-buffers window nil)
address@hidden group
address@hidden example
+
+Setting the window history to nil ensures that a future call to
address@hidden can delete the window altogether.
+
 @end defun
 
 The following option specifies how to deal with a frame containing just
@@ -4845,25 +4863,32 @@ This parameter is installed by the buffer display 
functions
 (@pxref{Choosing Window}) and consulted by @code{quit-restore-window}
 (@pxref{Quitting Windows}).  It contains four elements:
 
-The first element is one of the symbols @code{window}, meaning that the
-window has been specially created by @code{display-buffer}; @code{frame},
-a separate frame has been created; @code{same}, the window has
-displayed the same buffer before; or @code{other}, the window showed
-another buffer before.
+The first element is one of the symbols @code{window}, meaning that
+the window has been specially created by @code{display-buffer};
address@hidden, a separate frame has been created; @code{same}, the
+window has only ever displayed this buffer; or @code{other}, the
+window showed another buffer before.  @code{frame} and @code{window}
+affect how the window is quit, while @code{same} and @code{other}
+affect the redisplay of buffers previously shown in this window.
 
 The second element is either one of the symbols @code{window} or
 @code{frame}, or a list whose elements are the buffer shown in the
 window before, that buffer's window start and window point positions,
-and the window's height at that time.
+and the window's height at that time.  If that buffer is still live
+when the window is quit, then the function @code{quit-restore-window}
+reuses the window to display the buffer.
 
 The third element is the window selected at the time the parameter was
-created.  The function @code{quit-restore-window} tries to reselect that
-window when it deletes the window passed to it as argument.
+created.  If @code{quit-restore-window} deletes the window passed to
+it as argument, it then tries to reselect this window.
 
 The fourth element is the buffer whose display caused the creation of
 this parameter.  @code{quit-restore-window} deletes the specified window
 only if it still shows that buffer.
 
+See the description of @code{quit-restore-window} in @ref{Quitting
+Windows} for details.
+
 @item @code{window-side} @code{window-slot}
 These parameters are used for implementing side windows (@pxref{Side
 Windows}).
@@ -4894,9 +4919,6 @@ applications.  It might be replaced by an improved 
solution in future
 versions of Emacs.
 @end table
 
-The @code{window-atom} parameter is used for implementing atomic windows.
-
-
 @node Window Hooks
 @section Hooks for Window Scrolling and Changes
 @cindex hooks for window operations
diff --git a/doc/misc/cc-mode.texi b/doc/misc/cc-mode.texi
index a29873b..91e20fa 100644
--- a/doc/misc/cc-mode.texi
+++ b/doc/misc/cc-mode.texi
@@ -274,6 +274,7 @@ Font Locking
 * Font Locking Preliminaries::
 * Faces::
 * Doc Comments::
+* Misc Font Locking::
 * AWK Mode Font Locking::
 
 Configuration Basics
@@ -1821,6 +1822,7 @@ sections apply to the other languages.
 * Font Locking Preliminaries::
 * Faces::
 * Doc Comments::
+* Misc Font Locking::
 * AWK Mode Font Locking::
 @end menu
 
@@ -2023,7 +2025,7 @@ since those aren't syntactic errors in themselves.
 
 
 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
address@hidden    Doc Comments, AWK Mode Font Locking, Faces, Font Locking
address@hidden    Doc Comments, Misc Font Locking, Faces, Font Locking
 @comment node-name, next, previous, up
 @section Documentation Comments
 @cindex documentation comments
@@ -2099,9 +2101,63 @@ initialization and the result is prepended.  For an 
example, see
 If you add support for another doc comment style, please consider
 contributing it: send a note to @email{bug-cc-mode@@gnu.org}.
 
address@hidden !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
address@hidden    Misc Font Locking, AWK Mode Font Locking, Doc Comments, Font 
Locking
address@hidden  node-name,  next,  previous,  up
address@hidden Miscellaneous Font Locking
address@hidden !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
+
+In some languages, particularly in C++, there are constructs which are
+syntactically ambiguous---they could be either declarations or
+expressions, and @ccmode{} cannot tell for sure which.  Often such a
+construct is one of the operators @samp{*} or @samp{&} surrounded by
+two identifiers.
+
+Experience shows that very often when such a construct is a
+declaration it will be written with the operator touching exactly one
+of the identifiers, like:
+
address@hidden
+foo *bar
address@hidden example
+or
address@hidden
+foo& bar
address@hidden example
+
+.  Whether such code is fontified depends on the setting of
address@hidden
+
address@hidden c-asymmetry-fontification-flag
address@hidden asymmetry-fontification-flag (c-)
+When @code{c-asymmetry-fontification-flag} is non-nil (which it is by
+default), code like the above, with white space either before or after
+the operator, but not both, is fontified as a declaration.  When the
+variable is nil, such a construct gets the default face.
address@hidden defvar
+
+When the construct is an expression there will often be white space
+both before and after the operator or there will be no white space
+around it at all, like:
+
address@hidden
+foo * bar
address@hidden example
+or
address@hidden
+foo&bar
address@hidden example
+.
+
+Such code is not fontified as a declaration.  (Typically, the
+identifiers don't get a non-default face.)
+
+For clarity's sake, we emphasize that the ``asymmetry'' rule in this
+section only applies when CC Mode cannot disambiguate a construct in
+any other way.
 
 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
address@hidden    AWK Mode Font Locking,  , Doc Comments, Font Locking
address@hidden    AWK Mode Font Locking,  , Misc Font Locking, Font Locking
 @comment  node-name,  next,  previous,  up
 @section AWK Mode Font Locking
 @comment !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
diff --git a/doc/misc/dired-x.texi b/doc/misc/dired-x.texi
index 1e6f4b0..bf10325 100644
--- a/doc/misc/dired-x.texi
+++ b/doc/misc/dired-x.texi
@@ -721,15 +721,27 @@ variable @code{window-min-height}.
 @item dired-mark-extension
 @findex dired-mark-extension
 Mark all files with a certain extension for use in later commands.  A @samp{.}
-is not automatically prepended to the string entered, you must type it
-explicitly.
-If invoked with prefix argument @kbd{C-u}, this command unmark files instead.
+is automatically prepended to the string entered when not present.
+If invoked with prefix argument @kbd{C-u}, this command unmarks files instead.
 If called with the @kbd{C-u C-u} prefix, asks for a character to use
 as the marker, and marks files with it.
 
 When called from Lisp, @var{extension} may also be a list of extensions
 and an optional argument @var{marker-char} specifies the marker used.
 
address@hidden dired-mark-suffix
address@hidden dired-mark-suffix
+Mark all files with a certain suffix for use in later commands.  A @samp{.}
+is not automatically prepended to the string entered, you must type it
+explicitly.  This is different from @var{dired-mark-extension} which prepends
+a @samp{.} if not present.
+If invoked with prefix argument @kbd{C-u}, this command unmarks files instead.
+If called with the @kbd{C-u C-u} prefix, asks for a character to use
+as the marker, and marks files with it.
+
+When called from Lisp, @var{suffix} may also be a list of suffixes
+and an optional argument @var{marker-char} specifies the marker used.
+
 @item dired-flag-extension
 @findex dired-flag-extension
 Flag all files with a certain extension for deletion.  A @samp{.} is
diff --git a/doc/misc/org.texi b/doc/misc/org.texi
index 21c8758..fca5185 100644
--- a/doc/misc/org.texi
+++ b/doc/misc/org.texi
@@ -15327,14 +15327,9 @@ inheritance}).}.
    |sed '1d' \
  #+END_SRC
 
- ** sort by the percent full
+ ** output mount point of fullest disk
  #+BEGIN_SRC sh
-   |awk '@{print $5 " " address@hidden'|sort -n |tail -1 \
- #+END_SRC
-
- ** extract the mount point
- #+BEGIN_SRC sh
-   |awk '@{print address@hidden'
+   |awk '@{if (u < +$5) @{u = +$5; m = address@hidden@} END @{print 
address@hidden'
  #+END_SRC
 @end example
 
diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi
index e1d8445..8e04d69 100644
--- a/doc/misc/tramp.texi
+++ b/doc/misc/tramp.texi
@@ -2499,6 +2499,42 @@ Starting with Emacs 24, when 
@option{explicit-shell-file-name} is
 equal to @code{nil}, calling @code{shell} interactively will prompt
 for a shell name.
 
+Starting with Emacs 26, you could use connection-local variables for
+setting different values of @option{explicit-shell-file-name} for
+different remote hosts.
address@hidden
address@hidden Local Variables, , , elisp}
address@hidden ifinfo
+
address@hidden
address@hidden
+(connection-local-set-profile-variables
+  'remote-bash
+  '((explicit-shell-file-name . "/bin/bash")
+    (explicit-bash-args . ("-i"))))
address@hidden group
+
address@hidden
+(connection-local-set-profile-variables
+  'remote-ksh
+  '((explicit-shell-file-name . "/bin/ksh")
+    (explicit-ksh-args . ("-i"))))
address@hidden group
+
address@hidden
+(connection-local-set-profiles
+  '(:application 'tramp :protocol "ssh" :machine "localhost")
+  'remote-bash)
address@hidden group
+
address@hidden
+(connection-local-set-profiles
+  `(:application 'tramp :protocol "sudo"
+    :user "root" :machine ,(system-name))
+  'remote-ksh)
address@hidden group
address@hidden lisp
+
 
 @subsection Running @code{shell-command} on a remote host
 @cindex shell-command
@@ -2542,11 +2578,10 @@ uid=0(root) gid=0(root) groups=0(root)
 @end group
 @end example
 
address@hidden in Emacs 23.2 added custom @code{su} and @code{sudo}
-commands that set the default directory correctly for the
address@hidden buffer.  @value{tramp} silently updates
address@hidden with an entry for this directory
-(@pxref{Multi-hops}):
address@hidden added custom @code{su} and @code{sudo} commands that set
+the default directory correctly for the @file{*eshell*} buffer.
address@hidden silently updates @option{tramp-default-proxies-alist}
+with an entry for this directory (@pxref{Multi-hops}):
 
 @example
 @group
@@ -2763,11 +2798,12 @@ Where is the latest @value{tramp}?
 @item
 Which systems does it work on?
 
-The package works successfully on Emacs 23, Emacs 24, and Emacs 25.
+The package works successfully on Emacs 23, Emacs 24, Emacs 25, and
+Emacs 26.
 
 While Unix and Unix-like systems are the primary remote targets,
 @value{tramp} has equal success connecting to other platforms, such as
-MS Windows XP/Vista/7.
+MS Windows 7/8/10.
 
 
 @item
diff --git a/etc/NEWS b/etc/NEWS
index cd98f53..bfd7d2b 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -471,8 +471,6 @@ where to place point after C-c M-r and C-c M-s.
 ---
 *** Messages from CMake are now recognized.
 
-** Dired
-
 +++
 *** A new option 'dired-always-read-filesystem' default to nil.
 If non-nil, buffers visiting files are reverted before search them;
@@ -759,6 +757,11 @@ processes on exit.
 * Incompatible Lisp Changes in Emacs 26.1
 
 +++
+*** Command 'dired-mark-extension' now automatically prepends a '.' to the
+extension when not present.  The new command 'dired-mark-suffix' behaves
+similarly but it doesn't prepend a '.'.
+
++++
 ** Certain cond/pcase/cl-case forms are now compiled using a faster jump
 table implementation. This uses a new bytecode op `switch', which isn't
 compatible with previous Emacs versions. This functionality can be disabled
diff --git a/etc/TODO b/etc/TODO
index 71704f0..af2f41b 100644
--- a/etc/TODO
+++ b/etc/TODO
@@ -139,7 +139,7 @@ things in their .emacs.
 case to make sure it stays fixed.  Or pick your favorite programming
 major-mode, and write a test for its indentation.  Or a version
 control backend, and write a test for its status parser.  Etc.
-See test/automated for examples.
+See the 'test' directory for examples.
 
 * Small but important fixes needed in existing features:
 
diff --git a/lib-src/Makefile.in b/lib-src/Makefile.in
index b2cd66c..fa8de0b 100644
--- a/lib-src/Makefile.in
+++ b/lib-src/Makefile.in
@@ -266,7 +266,9 @@ need-blessmail: blessmail
 maybe-blessmail: $(BLESSMAIL_TARGET)
 
 ## Install the internal utilities.  Until they are installed, we can
-## just run them directly from lib-src.
+## just run them directly from lib-src.  When installing, do not give
+## up if chown or chgrp fails, as the package responsible for
+## installing Emacs can fix this problem later.
 $(DESTDIR)${archlibdir}: all
        @echo
        @echo "Installing utilities run internally by Emacs."
@@ -283,15 +285,19 @@ $(DESTDIR)${archlibdir}: all
        touch "$(DESTDIR)${gamedir}/snake-scores" \
              "$(DESTDIR)${gamedir}/tetris-scores"
     ifneq (,$(gameuser))
-       chown ${gameuser} "$(DESTDIR)${archlibdir}/update-game-score${EXEEXT}"
-       chmod u+s,go-r "$(DESTDIR)${archlibdir}/update-game-score${EXEEXT}"
-       chown ${gameuser} "$(DESTDIR)${gamedir}"
-       chmod u=rwx,g=rx,o=rx "$(DESTDIR)${gamedir}"
+       -chown ${gameuser} \
+          "$(DESTDIR)${archlibdir}/update-game-score${EXEEXT}" \
+          "$(DESTDIR)${gamedir}" && \
+        chmod u+s,go-r \
+          "$(DESTDIR)${archlibdir}/update-game-score${EXEEXT}" && \
+        chmod u=rwx,g=rx,o=rx "$(DESTDIR)${gamedir}"
     else
-       chgrp ${gamegroup} "$(DESTDIR)${archlibdir}/update-game-score${EXEEXT}"
-       chmod g+s,o-r "$(DESTDIR)${archlibdir}/update-game-score${EXEEXT}"
-       chgrp ${gamegroup} "$(DESTDIR)${gamedir}"
-       chmod u=rwx,g=rwx,o=rx "$(DESTDIR)${gamedir}"
+       -chgrp ${gamegroup} \
+          "$(DESTDIR)${archlibdir}/update-game-score${EXEEXT}" \
+          "$(DESTDIR)${gamedir}" && \
+        chmod g+s,o-r \
+          "$(DESTDIR)${archlibdir}/update-game-score${EXEEXT}" && \
+        chmod u=rwx,g=rwx,o=rx "$(DESTDIR)${gamedir}"
     endif
   endif
        exp_archlibdir=`cd "$(DESTDIR)${archlibdir}" && /bin/pwd` && \
diff --git a/lib/Makefile.in b/lib/Makefile.in
index 4e51ac6..832704f 100644
--- a/lib/Makefile.in
+++ b/lib/Makefile.in
@@ -65,16 +65,12 @@ ifneq ($(SYSTEM_TYPE),windows-nt)
   libgnu_a_SOURCES += openat-die.c save-cwd.c
 endif
 
-# Dependencies.  When !AUTO_DEPEND, don't bother with a dependencies file,
-# as the default dependencies are often adequate.
 DEPDIR = deps
 ifeq ($(AUTO_DEPEND),yes)
   DEPFLAGS = -MMD -MF $(DEPDIR)/$*.d -MP
-  MKDEPDIR = $(MKDIR_P) $(DEPDIR)
   -include $(ALLOBJS:%.o=$(DEPDIR)/%.d)
 else
   DEPFLAGS =
-  MKDEPDIR = :
 endif
 
 .PRECIOUS: ../config.status Makefile
@@ -90,10 +86,8 @@ libegnu_a_OBJECTS = $(patsubst %.o,e-%.o,$(libgnu_a_OBJECTS))
 $(libegnu_a_OBJECTS) $(libgnu_a_OBJECTS): $(BUILT_SOURCES)
 
 .c.o:
-       @$(MKDEPDIR)
        $(AM_V_CC)$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $<
 e-%.o: %.c
-       @$(MKDEPDIR)
        $(AM_V_CC)$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) -Demacs -o $@ $<
 
 all: libgnu.a $(if $(HYBRID_MALLOC),libegnu.a)
@@ -118,10 +112,10 @@ TAGS: $(ETAGS) $(tagsfiles)
 .PHONY: $(ETAGS) tags
 
 clean mostlyclean:
-       rm -f *.[ao] \#*
-       -rm -rf $(DEPDIR)
+       rm -f *.[ao] \#* $(DEPDIR)/*
 distclean: clean
        rm -f Makefile $(BUILT_SOURCES)
+       rm -fr $(DEPDIR)
 bootstrap-clean: distclean
        rm -f TAGS
 maintainer-clean: bootstrap-clean
diff --git a/lib/getopt.c b/lib/getopt.c
index e40ea8d..7afd0dc 100644
--- a/lib/getopt.c
+++ b/lib/getopt.c
@@ -2,22 +2,22 @@
    NOTE: getopt is part of the C library, so if you don't know what
    "Keep this file name-space clean" means, talk to address@hidden
    before changing it!
-   Copyright (C) 1987-1996, 1998-2004, 2006, 2008-2017 Free Software
-   Foundation, Inc.
+   Copyright (C) 1987-2017 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
-   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.
+   The GNU C Library 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,
+   The GNU C Library 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.
+   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/>.  */
+   You should have received a copy of the GNU General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
 
 #ifndef _LIBC
 # include <config.h>
@@ -27,8 +27,8 @@
 
 #include <stdio.h>
 #include <stdlib.h>
-#include <string.h>
 #include <unistd.h>
+#include <string.h>
 
 #ifdef _LIBC
 # include <libintl.h>
@@ -37,7 +37,7 @@
 # define _(msgid) gettext (msgid)
 #endif
 
-#if defined _LIBC && defined USE_IN_LIBIO
+#if defined _LIBC
 # include <wchar.h>
 #endif
 
@@ -181,7 +181,7 @@ exchange (char **argv, struct _getopt_data *d)
         {
           /* Bottom segment is the short one.  */
           int len = middle - bottom;
-          register int i;
+          int i;
 
           /* Swap it with the top part of the top segment.  */
           for (i = 0; i < len; i++)
@@ -198,7 +198,7 @@ exchange (char **argv, struct _getopt_data *d)
         {
           /* Top segment is the short one.  */
           int len = top - middle;
-          register int i;
+          int i;
 
           /* Swap it with the bottom part of the bottom segment.  */
           for (i = 0; i < len; i++)
@@ -564,11 +564,11 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
               first.next = ambig_list;
               ambig_list = &first;
 
-#if defined _LIBC && defined USE_IN_LIBIO
+#if defined _LIBC
               char *buf = NULL;
               size_t buflen = 0;
 
-              FILE *fp = open_memstream (&buf, &buflen);
+              FILE *fp = __open_memstream (&buf, &buflen);
               if (fp != NULL)
                 {
                   fprintf (fp,
@@ -584,7 +584,7 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
 
                   fputc_unlocked ('\n', fp);
 
-                  if (__builtin_expect (fclose (fp) != EOF, 1))
+                  if (__glibc_likely (fclose (fp) != EOF))
                     {
                       _IO_flockfile (stderr);
 
@@ -642,7 +642,7 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
                 {
                   if (print_errors)
                     {
-#if defined _LIBC && defined USE_IN_LIBIO
+#if defined _LIBC
                       char *buf;
                       int n;
 #endif
@@ -650,7 +650,7 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
                       if (argv[d->optind - 1][1] == '-')
                         {
                           /* --option */
-#if defined _LIBC && defined USE_IN_LIBIO
+#if defined _LIBC
                           n = __asprintf (&buf, _("\
 %s: option '--%s' doesn't allow an argument\n"),
                                           argv[0], pfound->name);
@@ -663,7 +663,7 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
                       else
                         {
                           /* +option or -option */
-#if defined _LIBC && defined USE_IN_LIBIO
+#if defined _LIBC
                           n = __asprintf (&buf, _("\
 %s: option '%c%s' doesn't allow an argument\n"),
                                           argv[0], argv[d->optind - 1][0],
@@ -676,7 +676,7 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
 #endif
                         }
 
-#if defined _LIBC && defined USE_IN_LIBIO
+#if defined _LIBC
                       if (n >= 0)
                         {
                           _IO_flockfile (stderr);
@@ -709,7 +709,7 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
                 {
                   if (print_errors)
                     {
-#if defined _LIBC && defined USE_IN_LIBIO
+#if defined _LIBC
                       char *buf;
 
                       if (__asprintf (&buf, _("\
@@ -760,7 +760,7 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
         {
           if (print_errors)
             {
-#if defined _LIBC && defined USE_IN_LIBIO
+#if defined _LIBC
               char *buf;
               int n;
 #endif
@@ -768,7 +768,7 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
               if (argv[d->optind][1] == '-')
                 {
                   /* --option */
-#if defined _LIBC && defined USE_IN_LIBIO
+#if defined _LIBC
                   n = __asprintf (&buf, _("%s: unrecognized option '--%s'\n"),
                                   argv[0], d->__nextchar);
 #else
@@ -779,7 +779,7 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
               else
                 {
                   /* +option or -option */
-#if defined _LIBC && defined USE_IN_LIBIO
+#if defined _LIBC
                   n = __asprintf (&buf, _("%s: unrecognized option '%c%s'\n"),
                                   argv[0], argv[d->optind][0], d->__nextchar);
 #else
@@ -788,7 +788,7 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
 #endif
                 }
 
-#if defined _LIBC && defined USE_IN_LIBIO
+#if defined _LIBC
               if (n >= 0)
                 {
                   _IO_flockfile (stderr);
@@ -826,19 +826,19 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
       {
         if (print_errors)
           {
-#if defined _LIBC && defined USE_IN_LIBIO
+#if defined _LIBC
               char *buf;
               int n;
 #endif
 
-#if defined _LIBC && defined USE_IN_LIBIO
+#if defined _LIBC
               n = __asprintf (&buf, _("%s: invalid option -- '%c'\n"),
                               argv[0], c);
 #else
               fprintf (stderr, _("%s: invalid option -- '%c'\n"), argv[0], c);
 #endif
 
-#if defined _LIBC && defined USE_IN_LIBIO
+#if defined _LIBC
             if (n >= 0)
               {
                 _IO_flockfile (stderr);
@@ -884,7 +884,7 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
           {
             if (print_errors)
               {
-#if defined _LIBC && defined USE_IN_LIBIO
+#if defined _LIBC
                 char *buf;
 
                 if (__asprintf (&buf,
@@ -958,7 +958,7 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
           {
             if (print_errors)
               {
-#if defined _LIBC && defined USE_IN_LIBIO
+#if defined _LIBC
                 char *buf;
 
                 if (__asprintf (&buf, _("%s: option '-W %s' is ambiguous\n"),
@@ -998,7 +998,7 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
                   {
                     if (print_errors)
                       {
-#if defined _LIBC && defined USE_IN_LIBIO
+#if defined _LIBC
                         char *buf;
 
                         if (__asprintf (&buf, _("\
@@ -1037,7 +1037,7 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
                   {
                     if (print_errors)
                       {
-#if defined _LIBC && defined USE_IN_LIBIO
+#if defined _LIBC
                         char *buf;
 
                         if (__asprintf (&buf, _("\
@@ -1112,7 +1112,7 @@ _getopt_internal_r (int argc, char **argv, const char 
*optstring,
               {
                 if (print_errors)
                   {
-#if defined _LIBC && defined USE_IN_LIBIO
+#if defined _LIBC
                     char *buf;
 
                     if (__asprintf (&buf, _("\
diff --git a/lib/getopt.in.h b/lib/getopt.in.h
index 6cbad8e..3f57c68 100644
--- a/lib/getopt.in.h
+++ b/lib/getopt.in.h
@@ -1,20 +1,20 @@
 /* Declarations for getopt.
-   Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2007, 2009-2017 Free Software
-   Foundation, Inc.
+   Copyright (C) 1989-2017 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
-   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.
+   The GNU C Library 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,
+   The GNU C Library 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.
+   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/>.  */
+   You should have received a copy of the GNU General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
 
 #ifndef address@hidden@_GETOPT_H
 
@@ -238,6 +238,25 @@ struct option
 extern int getopt (int ___argc, char *const *___argv, const char *__shortopts)
        __THROW _GL_ARG_NONNULL ((2, 3));
 
+#ifndef __GETOPT_PREFIX
+# if defined __need_getopt && defined __USE_POSIX2 \
+  && !defined __USE_POSIX_IMPLICITLY && !defined __USE_GNU
+/* The GNU getopt has more functionality than the standard version.  The
+   additional functionality can be disable at runtime.  This redirection
+   helps to also do this at runtime.  */
+#  ifdef __REDIRECT
+  extern int __REDIRECT_NTH (getopt, (int ___argc, char *const *___argv,
+                                     const char *__shortopts),
+                            __posix_getopt);
+#  else
+extern int __posix_getopt (int ___argc, char *const *___argv,
+                          const char *__shortopts)
+  __THROW _GL_ARG_NONNULL ((2, 3));
+#   define getopt __posix_getopt
+#  endif
+# endif
+#endif
+
 #ifndef __need_getopt
 extern int getopt_long (int ___argc, char *__getopt_argv_const *___argv,
                         const char *__shortopts,
diff --git a/lib/getopt1.c b/lib/getopt1.c
index 4d2e8cb..166b129 100644
--- a/lib/getopt1.c
+++ b/lib/getopt1.c
@@ -1,20 +1,20 @@
 /* getopt_long and getopt_long_only entry points for GNU getopt.
-   Copyright (C) 1987-1994, 1996-1998, 2004, 2006, 2009-2017 Free Software
-   Foundation, Inc.
+   Copyright (C) 1987-2017 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
-   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.
+   The GNU C Library 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,
+   The GNU C Library 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.
+   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/>.  */
+   You should have received a copy of the GNU General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
 
 #ifdef _LIBC
 # include <getopt.h>
diff --git a/lib/getopt_int.h b/lib/getopt_int.h
index a7ce0e9..c614fcb 100644
--- a/lib/getopt_int.h
+++ b/lib/getopt_int.h
@@ -1,20 +1,20 @@
 /* Internal declarations for getopt.
-   Copyright (C) 1989-1994, 1996-1999, 2001, 2003-2004, 2009-2017 Free Software
-   Foundation, Inc.
+   Copyright (C) 1989-2017 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
-   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.
+   The GNU C Library 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,
+   The GNU C Library 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.
+   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/>.  */
+   You should have received a copy of the GNU General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
 
 #ifndef _GETOPT_INT_H
 #define _GETOPT_INT_H   1
diff --git a/lib/gnulib.mk.in b/lib/gnulib.mk.in
index 2c0b689..ca95ed7 100644
--- a/lib/gnulib.mk.in
+++ b/lib/gnulib.mk.in
@@ -558,7 +558,6 @@ LIBS_GNUSTEP = @LIBS_GNUSTEP@
 LIBS_MAIL = @LIBS_MAIL@
 LIBS_SYSTEM = @LIBS_SYSTEM@
 LIBS_TERMCAP = @LIBS_TERMCAP@
-LIBTESTS_LIBDEPS = @LIBTESTS_LIBDEPS@
 LIBTIFF = @LIBTIFF@
 LIBXMENU = @LIBXMENU@
 LIBXML2_CFLAGS = @LIBXML2_CFLAGS@
diff --git a/lisp/Makefile.in b/lisp/Makefile.in
index cbe7718..185554c 100644
--- a/lisp/Makefile.in
+++ b/lisp/Makefile.in
@@ -47,6 +47,9 @@ am__v_at_ = $(address@hidden@)
 am__v_at_0 = @
 am__v_at_1 =
 
+
+FIND_DELETE = @FIND_DELETE@
+
 # You can specify a different executable on the make command line,
 # e.g. "make EMACS=../src/emacs ...".
 
@@ -343,7 +346,7 @@ compile: $(LOADDEFS) autoloads compile-first
 # unconditionally.  Some files don't actually get compiled because they
 # set the local variable no-byte-compile.
 compile-always:
-       cd $(lisp) && rm -f *.elc */*.elc */*/*.elc */*/*/*.elc
+       find $(lisp) -name '*.elc' $(FIND_DELETE)
        $(MAKE) compile
 
 .PHONY: backup-compiled-files compile-after-backup
@@ -433,7 +436,8 @@ $(CAL_DIR)/hol-loaddefs.el: $(CAL_SRC) 
$(CAL_DIR)/diary-loaddefs.el
 .PHONY: bootstrap-clean distclean maintainer-clean
 
 bootstrap-clean:
-       -cd $(lisp) && rm -f *.elc */*.elc */*/*.elc */*/*/*.elc $(AUTOGENEL)
+       find $(lisp) -name '*.elc' $(FIND_DELETE)
+       -cd $(lisp) && rm -f $(AUTOGENEL)
 
 distclean:
        -rm -f ./Makefile $(lisp)/loaddefs.el~
diff --git a/lisp/cedet/semantic/wisent/wisent.el 
b/lisp/cedet/semantic/wisent/wisent.el
index 36dff01..08cad52 100644
--- a/lisp/cedet/semantic/wisent/wisent.el
+++ b/lisp/cedet/semantic/wisent/wisent.el
@@ -114,7 +114,7 @@ If OBJ is a symbol check its value."
   (and (vectorp obj) (= 4 (length obj))
        (vectorp (aref obj 0)) (vectorp (aref obj 1))
        (= (length (aref obj 0)) (length (aref obj 1)))
-       (listp (aref obj 2)) (vectorp (aref obj 3))))
+       (listp (aref obj 2)) (obarrayp (aref obj 3))))
 
 (defsubst wisent-region (&rest positions)
   "Return the start/end positions of the region including POSITIONS.
diff --git a/lisp/dired-x.el b/lisp/dired-x.el
index 6c8fb0e..527685a 100644
--- a/lisp/dired-x.el
+++ b/lisp/dired-x.el
@@ -332,46 +332,73 @@ See also the functions:
 
 ;;; EXTENSION MARKING FUNCTIONS.
 
+(defun dired--mark-suffix-interactive-spec ()
+  (let* ((default
+           (let ((file (dired-get-filename nil t)))
+             (when file
+               (file-name-extension file))))
+         (suffix
+          (read-string (format "%s extension%s: "
+                               (if (equal current-prefix-arg '(4))
+                                   "UNmarking"
+                                 "Marking")
+                               (if default
+                                   (format " (default %s)" default)
+                                 "")) nil nil default))
+         (marker
+          (pcase current-prefix-arg
+            ('(4) ?\s)
+            ('(16)
+             (let* ((dflt (char-to-string dired-marker-char))
+                    (input (read-string
+                            (format
+                             "Marker character to use (default %s): " dflt)
+                            nil nil dflt)))
+               (aref input 0)))
+            (_ dired-marker-char))))
+    (list suffix marker)))
+
 ;; Mark files with some extension.
 (defun dired-mark-extension (extension &optional marker-char)
   "Mark all files with a certain EXTENSION for use in later commands.
-A `.' is *not* automatically prepended to the string entered.
+A `.' is automatically prepended to EXTENSION when not present.
 EXTENSION may also be a list of extensions instead of a single one.
 Optional MARKER-CHAR is marker to use.
 Interactively, ask for EXTENSION.
 Prefixed with one C-u, unmark files instead.
 Prefixed with two C-u's, prompt for MARKER-CHAR and mark files with it."
-  (interactive
-   (let* ((default
-            (let ((file (dired-get-filename nil t)))
-              (when file
-                (file-name-extension file))))
-          (suffix
-           (read-string (format "%s extension%s: "
-                                (if (equal current-prefix-arg '(4))
-                                    "UNmarking"
-                                  "Marking")
-                                (if default
-                                    (format " (default %s)" default)
-                                  "")) nil nil default))
-          (marker
-           (pcase current-prefix-arg
-             ('(4) ?\s)
-             ('(16)
-              (let* ((dflt (char-to-string dired-marker-char))
-                     (input (read-string
-                             (format
-                              "Marker character to use (default %s): " dflt)
-                             nil nil dflt)))
-                (aref input 0)))
-             (_ dired-marker-char))))
-     (list suffix marker)))
-  (or (listp extension)
-      (setq extension (list extension)))
+  (interactive (dired--mark-suffix-interactive-spec))
+  (unless (listp extension)
+    (setq extension (list extension)))
+  (dired-mark-files-regexp
+   (concat ".";; don't match names with nothing but an extension
+           "\\("
+           (mapconcat
+            (lambda (x)
+              (regexp-quote
+               (if (string-prefix-p "." x) x (concat "." x))))
+            extension "\\|")
+           "\\)$")
+   marker-char))
+
+;; Mark files ending with some suffix.
+(defun dired-mark-suffix (suffix &optional marker-char)
+  "Mark all files with a certain SUFFIX for use in later commands.
+A `.' is *not* automatically prepended to the string entered;  see
+also `dired-mark-extension', which is similar but automatically
+prepends `.' when not present.
+SUFFIX may also be a list of suffixes instead of a single one.
+Optional MARKER-CHAR is marker to use.
+Interactively, ask for SUFFIX.
+Prefixed with one C-u, unmark files instead.
+Prefixed with two C-u's, prompt for MARKER-CHAR and mark files with it."
+  (interactive (dired--mark-suffix-interactive-spec))
+  (unless (listp suffix)
+    (setq suffix (list suffix)))
   (dired-mark-files-regexp
    (concat ".";; don't match names with nothing but an extension
            "\\("
-           (mapconcat 'regexp-quote extension "\\|")
+           (mapconcat 'regexp-quote suffix "\\|")
            "\\)$")
    marker-char))
 
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index f45ae35..2c2996e 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -443,7 +443,7 @@ Return the compile-time value of FORM."
   ;; Macroexpand (not macroexpand-all!) form at toplevel in case it
   ;; expands into a toplevel-equivalent `progn'.  See CLHS section
   ;; 3.2.3.1, "Processing of Top Level Forms".  The semantics are very
-  ;; subtle: see test/automated/bytecomp-tests.el for interesting
+  ;; subtle: see test/lisp/emacs-lisp/bytecomp-tests.el for interesting
   ;; cases.
   (setf form (macroexp-macroexpand form byte-compile-macro-environment))
   (if (eq (car-safe form) 'progn)
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el
index 6013305..4116e31 100644
--- a/lisp/emacs-lisp/edebug.el
+++ b/lisp/emacs-lisp/edebug.el
@@ -733,9 +733,9 @@ Maybe clear the markers and delete the symbol's edebug 
property?"
      ((eq class 'string) (read (current-buffer)))
      ((eq class 'quote) (forward-char 1)
       (list 'quote (edebug-read-sexp)))
-     ((eq class 'backquote)
+     ((eq class 'backquote) (forward-char 1)
       (list '\` (edebug-read-sexp)))
-     ((eq class 'comma)
+     ((eq class 'comma) (forward-char 1)
       (list '\, (edebug-read-sexp)))
      (t ; anything else, just read it.
       (read (current-buffer))))))
diff --git a/lisp/emacs-lisp/ert.el b/lisp/emacs-lisp/ert.el
index cadd66c..e7387e4 100644
--- a/lisp/emacs-lisp/ert.el
+++ b/lisp/emacs-lisp/ert.el
@@ -1236,7 +1236,7 @@ SELECTOR is the selector that was used to select TESTS."
         (funcall listener 'test-ended stats test result))
       (setf (ert--stats-current-test stats) nil))))
 
-(defun ert-run-tests (selector listener)
+(defun ert-run-tests (selector listener &optional interactively)
   "Run the tests specified by SELECTOR, sending progress updates to LISTENER."
   (let* ((tests (ert-select-tests selector t))
          (stats (ert--make-stats tests selector)))
@@ -1247,10 +1247,14 @@ SELECTOR is the selector that was used to select TESTS."
           (let ((ert--current-run-stats stats))
             (force-mode-line-update)
             (unwind-protect
-                (progn
-                  (cl-loop for test in tests do
-                           (ert-run-or-rerun-test stats test listener))
-                  (setq abortedp nil))
+               (cl-loop for test in tests do
+                        (ert-run-or-rerun-test stats test listener)
+                        (when (and interactively
+                                   (ert-test-quit-p
+                                    (ert-test-most-recent-result test))
+                                   (y-or-n-p "Abort testing? "))
+                          (cl-return))
+                        finally (setq abortedp nil))
               (setf (ert--stats-aborted-p stats) abortedp)
               (setf (ert--stats-end-time stats) (current-time))
               (funcall listener 'run-ended stats abortedp)))
@@ -1442,7 +1446,8 @@ Returns the stats object."
                                                  (ert-test-result-expected-p
                                                   test result))
                      (1+ (ert--stats-test-pos stats test))
-                     (ert-test-name test)))))))))
+                     (ert-test-name test)))))))
+   nil))
 
 ;;;###autoload
 (defun ert-run-tests-batch-and-exit (&optional selector)
@@ -2033,9 +2038,8 @@ and how to display message."
                                                       test result)))
                      (ert--results-update-stats-display-maybe ewoc stats)
                      (ewoc-invalidate ewoc node))))))))
-    (ert-run-tests
-     selector
-     listener)))
+    (ert-run-tests selector listener t)))
+
 ;;;###autoload
 (defalias 'ert 'ert-run-tests-interactively)
 
diff --git a/lisp/emacs-lisp/lisp-mode.el b/lisp/emacs-lisp/lisp-mode.el
index eb07c18..b7a5eb7 100644
--- a/lisp/emacs-lisp/lisp-mode.el
+++ b/lisp/emacs-lisp/lisp-mode.el
@@ -259,6 +259,24 @@ This will generate compile-time constants from BINDINGS."
                     (funcall loop bindings)))))))
     (funcall loop bindings)))
 
+(defun elisp--font-lock-backslash ()
+  (let* ((beg0 (match-beginning 0))
+         (end0 (match-end 0))
+         (ppss (save-excursion (syntax-ppss beg0))))
+    (and (nth 3 ppss)                  ;Inside a string.
+         (not (nth 5 ppss))            ;The \ is not itself \-escaped.
+         ;; Don't highlight the \( introduced because of
+         ;; `open-paren-in-column-0-is-defun-start'.
+         (not (eq ?\n (char-before beg0)))
+         (equal (ignore-errors
+                  (car (read-from-string
+                        (format "\"%s\""
+                                (buffer-substring-no-properties
+                                 beg0 end0)))))
+                (buffer-substring-no-properties (1+ beg0) end0))
+         `(face ,font-lock-warning-face
+                help-echo "This \\ has no effect"))))
+
 (let-when-compile
     ((lisp-fdefs '("defmacro" "defun"))
      (lisp-vdefs '("defvar"))
@@ -413,17 +431,7 @@ This will generate compile-time constants from BINDINGS."
           (1 font-lock-constant-face prepend))
          ;; Ineffective backslashes (typically in need of doubling).
          ("\\(\\\\\\)\\([^\"\\]\\)"
-          (1 (let ((ppss (save-excursion (syntax-ppss (match-beginning 0)))))
-               (and (nth 3 ppss)        ;Inside a string.
-                    (not (nth 5 ppss))  ;The \ is not itself \-escaped.
-                    (equal (ignore-errors
-                             (car (read-from-string
-                                   (format "\"%s\""
-                                           (match-string-no-properties 0)))))
-                           (match-string-no-properties 2))
-                    `(face ,font-lock-warning-face
-                           help-echo "This \\ has no effect")))
-             prepend))
+          (1 (elisp--font-lock-backslash) prepend))
          ;; Words inside ‘’ and `' tend to be symbol names.
          (,(concat "[`‘]\\(\\(?:\\sw\\|\\s_\\|\\\\.\\)"
                    lisp-mode-symbol-regexp "\\)['’]")
@@ -1083,7 +1091,8 @@ ENDPOS is encountered."
          (init-depth (car state))
          (next-depth init-depth)
          (last-depth init-depth)
-         (last-syntax-point (point)))
+         (last-syntax-point (point))
+         (real-endpos endpos))
     (unless endpos
       ;; Get error now if we don't have a complete sexp after point.
       (save-excursion (forward-sexp 1)
@@ -1116,6 +1125,8 @@ ENDPOS is encountered."
                 last-depth (- last-depth next-depth)
                 next-depth init-depth))
         (forward-line 1)
+        (when (and (not real-endpos) (<= next-depth init-depth))
+          (goto-char endpos))
         (when (< (point) endpos)
           (let ((depth-delta (- next-depth last-depth)))
             (cond ((< depth-delta 0)
diff --git a/lisp/emacs-lisp/pcase.el b/lisp/emacs-lisp/pcase.el
index 289265a..fc5474e 100644
--- a/lisp/emacs-lisp/pcase.el
+++ b/lisp/emacs-lisp/pcase.el
@@ -175,8 +175,8 @@ Emacs Lisp manual for more information and examples."
       ;; (when (gethash (car cases) pcase--memoize-2)
       ;;   (message "pcase-memoize failed because of eq test on %S"
       ;;            (car cases)))
-      (when data
-        (message "pcase-memoize: equal first branch, yet different"))
+      ;; (when data
+      ;;   (message "pcase-memoize: equal first branch, yet different"))
       (let ((expansion (pcase--expand exp cases)))
         (puthash (car cases) `(,exp ,cases ,@expansion) pcase--memoize)
         ;; (puthash (car cases) `(,exp ,cases ,@expansion) pcase--memoize-1)
diff --git a/lisp/emacs-lisp/seq.el b/lisp/emacs-lisp/seq.el
index 4118764..10de248 100644
--- a/lisp/emacs-lisp/seq.el
+++ b/lisp/emacs-lisp/seq.el
@@ -52,7 +52,7 @@
 ;; - `seq-copy'
 ;; - `seq-into'
 ;;
-;; All functions are tested in test/automated/seq-tests.el
+;; All functions are tested in test/lisp/emacs-lisp/seq-tests.el
 
 ;;; Code:
 
diff --git a/lisp/emacs-lisp/thunk.el b/lisp/emacs-lisp/thunk.el
index be0a90f..f4c075d 100644
--- a/lisp/emacs-lisp/thunk.el
+++ b/lisp/emacs-lisp/thunk.el
@@ -42,8 +42,6 @@
 ;;
 ;;    (thunk-force delayed)
 
-;; Tests are located at test/automated/thunk-tests.el
-
 ;;; Code:
 
 (defmacro thunk-delay (&rest body)
diff --git a/lisp/ffap.el b/lisp/ffap.el
index d7222bf..1ea32b7 100644
--- a/lisp/ffap.el
+++ b/lisp/ffap.el
@@ -1110,32 +1110,67 @@ The arguments CHARS, BEG and END are handled as 
described in
 
 (defun ffap-string-at-point (&optional mode)
   "Return a string of characters from around point.
+
 MODE (defaults to value of `major-mode') is a symbol used to look up
 string syntax parameters in `ffap-string-at-point-mode-alist'.
+
 If MODE is not found, we use `file' instead of MODE.
+
 If the region is active, return a string from the region.
-Set the variable `ffap-string-at-point' and the variable
+
+If the point is in a comment, ensure that the returned string does not
+contain the comment start characters (especially for major modes that
+have '//' as comment start characters).
+
+Set the variables `ffap-string-at-point' and
 `ffap-string-at-point-region'.
+
 When the region is active and larger than `ffap-max-region-length',
 return an empty string, and set `ffap-string-at-point-region' to '(1 1)."
   (let* ((args
          (cdr
           (or (assq (or mode major-mode) ffap-string-at-point-mode-alist)
               (assq 'file ffap-string-at-point-mode-alist))))
+         (region-selected (use-region-p))
         (pt (point))
-        (beg (if (use-region-p)
+         (beg (if region-selected
                  (region-beginning)
                (save-excursion
                  (skip-chars-backward (car args))
                  (skip-chars-forward (nth 1 args) pt)
                  (point))))
-        (end (if (use-region-p)
+         (end (if region-selected
                  (region-end)
                (save-excursion
                  (skip-chars-forward (car args))
                  (skip-chars-backward (nth 2 args) pt)
                  (point))))
          (region-len (- (max beg end) (min beg end))))
+
+    ;; If the initial characters of the to-be-returned string are the
+    ;; current major mode's comment starter characters, *and* are
+    ;; not part of a comment, remove those from the returned string
+    ;; (Bug#24057).
+    ;; Example comments in `c-mode' (which considers lines beginning
+    ;; with "//" as comments):
+    ;;  //tmp - This is a comment. It does not contain any path reference.
+    ;;  ///tmp - This is a comment. The "/tmp" portion in that is a path.
+    ;;  ////tmp - This is a comment. The "//tmp" portion in that is a path.
+    (when (and
+           ;; Proceed if no region is selected by the user.
+           (null region-selected)
+           ;; Check if END character is part of a comment.
+           (save-excursion
+             (nth 4 (syntax-ppss end))))
+      ;; Move BEG to beginning of comment (after the comment start
+      ;; characters), or END, whichever comes first.
+      (save-excursion
+        (let ((state (syntax-ppss beg)))
+          ;; (nth 4 (syntax-ppss)) will be nil for comment start chars.
+          (unless (nth 4 state)
+            (parse-partial-sexp beg end nil nil state :commentstop)
+            (setq beg (point))))))
+
     (if (and (natnump ffap-max-region-length)
              (< region-len ffap-max-region-length)) ; Bug#25243.
         (setf ffap-string-at-point-region (list beg end)
diff --git a/lisp/filenotify.el b/lisp/filenotify.el
index 7eb6229..8bbe348 100644
--- a/lisp/filenotify.el
+++ b/lisp/filenotify.el
@@ -28,6 +28,7 @@
 ;;; Code:
 
 (require 'cl-lib)
+(require 'subr-x)
 
 (defconst file-notify--library
   (cond
@@ -40,41 +41,43 @@ The value is the name of the low-level file notification 
package
 to be used for local file systems.  Remote file notifications
 could use another implementation.")
 
+(cl-defstruct (file-notify--watch
+               (:constructor nil)
+               (:constructor
+                file-notify--watch-make (directory filename callback)))
+  ;; Watched directory
+  directory
+  ;; Watched relative filename, nil if watching the directory.
+  filename
+  ;; Function to propagate events to
+  callback)
+
+(defun file-notify--watch-absolute-filename (watch)
+  "Return the absolute filename observed by WATCH."
+  (if (file-notify--watch-filename watch)
+      (expand-file-name
+       (file-notify--watch-filename watch)
+       (file-notify--watch-directory watch))
+    (file-notify--watch-directory watch)))
+
 (defvar file-notify-descriptors (make-hash-table :test 'equal)
   "Hash table for registered file notification descriptors.
 A key in this hash table is the descriptor as returned from
 `inotify', `kqueue', `gfilenotify', `w32notify' or a file name
-handler.  The value in the hash table is a list
-
-  (DIR (FILE . CALLBACK) (FILE . CALLBACK) ...)
-
-Several values for a given DIR happen only for `inotify', when
-different files from the same directory are watched.")
+handler.  The value in the hash table is `file-notify--watch'
+struct.")
 
 (defun file-notify--rm-descriptor (descriptor)
   "Remove DESCRIPTOR from `file-notify-descriptors'.
 DESCRIPTOR should be an object returned by `file-notify-add-watch'.
 If it is registered in `file-notify-descriptors', a stopped event is sent."
-  (let* ((desc (if (consp descriptor) (car descriptor) descriptor))
-         (registered (gethash desc file-notify-descriptors))
-        (file (if (consp descriptor) (cdr descriptor) (cl-caadr registered)))
-        (dir (car registered)))
-
-    (when (consp registered)
-      ;; Send `stopped' event.
-      (when (consp (assoc file (cdr registered)))
+  (when-let (watch (gethash descriptor file-notify-descriptors))
+    ;; Send `stopped' event.
+    (unwind-protect
         (funcall
-         (cdr (assoc file (cdr registered)))
-         `(,descriptor stopped ,(if file (expand-file-name file dir) dir))))
-
-      ;; Modify `file-notify-descriptors'.
-      (if (not file)
-         (remhash desc file-notify-descriptors)
-       (setcdr registered
-               (delete (assoc file (cdr registered)) (cdr registered)))
-       (if (null (cdr registered))
-           (remhash desc file-notify-descriptors)
-         (puthash desc registered file-notify-descriptors))))))
+         (file-notify--watch-callback watch)
+         `(,descriptor stopped ,(file-notify--watch-absolute-filename watch)))
+      (remhash descriptor file-notify-descriptors))))
 
 ;; This function is used by `inotify', `kqueue', `gfilenotify' and
 ;; `w32notify' events.
@@ -88,7 +91,8 @@ If EVENT is a filewatch event, call its callback.  It has the 
format
 Otherwise, signal a `file-notify-error'."
   (interactive "e")
   ;;(message "file-notify-handle-event %S" event)
-  (if (and (eq (car event) 'file-notify)
+  (if (and (consp event)
+           (eq (car event) 'file-notify)
           (>= (length event) 3))
       (funcall (nth 2 event) (nth 1 event))
     (signal 'file-notify-error
@@ -96,33 +100,32 @@ Otherwise, signal a `file-notify-error'."
 
 ;; Needed for `inotify' and `w32notify'.  In the latter case, COOKIE is nil.
 (defvar file-notify--pending-event nil
-  "A pending file notification events for a future `renamed' action.
+  "A pending file notification event for a future `renamed' action.
 It is a form ((DESCRIPTOR ACTION FILE [FILE1-OR-COOKIE]) CALLBACK).")
 
 (defun file-notify--event-watched-file (event)
   "Return file or directory being watched.
 Could be different from the directory watched by the backend library."
-  (let* ((desc (if (consp (car event)) (caar event) (car event)))
-         (registered (gethash desc file-notify-descriptors))
-        (file (if (consp (car event)) (cdar event) (cl-caadr registered)))
-        (dir (car registered)))
-    (if file (expand-file-name file dir) dir)))
+  (when-let (watch (gethash (car event) file-notify-descriptors))
+    (file-notify--watch-absolute-filename watch)))
 
 (defun file-notify--event-file-name (event)
   "Return file name of file notification event, or nil."
-  (directory-file-name
-   (expand-file-name
-    (or  (and (stringp (nth 2 event)) (nth 2 event)) "")
-    (car (gethash (car event) file-notify-descriptors)))))
+  (when-let (watch (gethash (car event) file-notify-descriptors))
+    (directory-file-name
+     (expand-file-name
+      (or  (and (stringp (nth 2 event)) (nth 2 event)) "")
+      (file-notify--watch-directory watch)))))
 
 ;; Only `gfilenotify' could return two file names.
 (defun file-notify--event-file1-name (event)
   "Return second file name of file notification event, or nil.
 This is available in case a file has been moved."
-  (and (stringp (nth 3 event))
-       (directory-file-name
-        (expand-file-name
-         (nth 3 event) (car (gethash (car event) file-notify-descriptors))))))
+  (when-let (watch (gethash (car event) file-notify-descriptors))
+    (and (stringp (nth 3 event))
+         (directory-file-name
+          (expand-file-name
+           (nth 3 event) (file-notify--watch-directory watch))))))
 
 ;; Cookies are offered by `inotify' only.
 (defun file-notify--event-cookie (event)
@@ -130,21 +133,6 @@ This is available in case a file has been moved."
 This is available in case a file has been moved."
   (nth 3 event))
 
-;; `inotify' returns the same descriptor when the file (directory)
-;; uses the same inode.  We want to distinguish, and apply a virtual
-;; descriptor which make the difference.
-(defun file-notify--descriptor (desc file)
-  "Return the descriptor to be used in `file-notify-*-watch'.
-For `gfilenotify' and `w32notify' it is the same descriptor as
-used in the low-level file notification package."
-  (if (and (natnump desc) (eq file-notify--library 'inotify))
-      (cons desc
-            (and (stringp file)
-                 (car (assoc
-                       (file-name-nondirectory file)
-                       (gethash desc file-notify-descriptors)))))
-    desc))
-
 ;; The callback function used to map between specific flags of the
 ;; respective file notifications, and the ones we return.
 (defun file-notify-callback (event)
@@ -152,138 +140,123 @@ used in the low-level file notification package."
 EVENT is the cadr of the event in `file-notify-handle-event'
 \(DESCRIPTOR ACTIONS FILE [FILE1-OR-COOKIE])."
   (let* ((desc (car event))
-        (registered (gethash desc file-notify-descriptors))
+        (watch (gethash desc file-notify-descriptors))
         (actions (nth 1 event))
         (file (file-notify--event-file-name event))
-        file1 callback pending-event stopped)
+        file1 pending-event stopped)
 
     ;; Make actions a list.
     (unless (consp actions) (setq actions (cons actions nil)))
 
-    ;; Loop over registered entries.  In fact, more than one entry
-    ;; happens only for `inotify'.
-    (dolist (entry (cdr registered))
-
-      ;; Check, that event is meant for us.
-      (unless (setq callback (cdr entry))
-       (setq actions nil))
-
+    (when watch
       ;; Loop over actions.  In fact, more than one action happens only
       ;; for `inotify' and `kqueue'.
-      (dolist (action actions)
-
-       ;; Send pending event, if it doesn't match.
-       (when (and file-notify--pending-event
-                  ;; The cookie doesn't match.
-                  (not (eq (file-notify--event-cookie
-                             (car file-notify--pending-event))
-                           (file-notify--event-cookie event)))
-                  (or
-                   ;; inotify.
-                   (and (eq (nth 1 (car file-notify--pending-event))
-                             'moved-from)
-                        (not (eq action 'moved-to)))
-                   ;; w32notify.
-                   (and (eq (nth 1 (car file-notify--pending-event))
-                             'renamed-from)
-                        (not (eq action 'renamed-to)))))
-          (setq pending-event file-notify--pending-event
-                file-notify--pending-event nil)
-          (setcar (cdar pending-event) 'deleted))
-
-       ;; Map action.  We ignore all events which cannot be mapped.
-       (setq action
-             (cond
-              ((memq action
-                      '(attribute-changed changed created deleted renamed))
-               action)
-              ((memq action '(moved rename))
-               ;; The kqueue rename event does not return file1 in
-               ;; case a file monitor is established.
-               (if (setq file1 (file-notify--event-file1-name event))
-                   'renamed 'deleted))
-              ((eq action 'ignored)
-                (setq stopped t actions nil))
-              ((memq action '(attrib link)) 'attribute-changed)
-              ((memq action '(create added)) 'created)
-              ((memq action '(modify modified write)) 'changed)
-              ((memq action '(delete delete-self move-self removed)) 'deleted)
-              ;; Make the event pending.
-              ((memq action '(moved-from renamed-from))
-               (setq file-notify--pending-event
-                      `((,desc ,action ,file ,(file-notify--event-cookie 
event))
-                        ,callback))
-               nil)
-              ;; Look for pending event.
-              ((memq action '(moved-to renamed-to))
-               (if (null file-notify--pending-event)
-                   'created
-                 (setq file1 file
-                       file (file-notify--event-file-name
-                              (car file-notify--pending-event)))
-                  ;; If the source is handled by another watch, we
-                  ;; must fire the rename event there as well.
-                  (when (not (equal (file-notify--descriptor desc file1)
-                                    (file-notify--descriptor
-                                     (caar file-notify--pending-event)
-                                     (file-notify--event-file-name
-                                      file-notify--pending-event))))
-                    (setq pending-event
-                          `((,(caar file-notify--pending-event)
-                             renamed ,file ,file1)
-                            ,(cadr file-notify--pending-event))))
-                  (setq file-notify--pending-event nil)
-                  'renamed))))
-
-        ;; Apply pending callback.
-        (when pending-event
-          (setcar
-           (car pending-event)
-           (file-notify--descriptor
-            (caar pending-event)
-            (file-notify--event-file-name file-notify--pending-event)))
-          (funcall (cadr pending-event) (car pending-event))
-          (setq pending-event nil))
-
-       ;; Apply callback.
-       (when (and action
-                  (or
-                   ;; If there is no relative file name for that watch,
-                   ;; we watch the whole directory.
-                   (null (nth 0 entry))
-                   ;; File matches.
-                   (string-equal
-                    (nth 0 entry) (file-name-nondirectory file))
-                   ;; Directory matches.
-                   (string-equal
-                    (file-name-nondirectory file)
-                    (file-name-nondirectory (car registered)))
-                   ;; File1 matches.
-                   (and (stringp file1)
-                        (string-equal
-                         (nth 0 entry) (file-name-nondirectory file1)))))
-          ;;(message
-           ;;"file-notify-callback %S %S %S %S %S"
-           ;;(file-notify--descriptor desc (car entry))
-           ;;action file file1 registered)
-         (if file1
-             (funcall
-              callback
-              `(,(file-notify--descriptor desc (car entry))
-                 ,action ,file ,file1))
-           (funcall
-            callback
-            `(,(file-notify--descriptor desc (car entry)) ,action ,file))))
-
-        ;; Send `stopped' event.
-        (when (or stopped
-                  (and (memq action '(deleted renamed))
-                       ;; Not, when a file is backed up.
-                       (not (and (stringp file1) (backup-file-name-p file1)))
-                       ;; Watched file or directory is concerned.
-                       (string-equal
-                        file (file-notify--event-watched-file event))))
-          (file-notify-rm-watch (file-notify--descriptor desc (car 
entry))))))))
+      (while actions
+        (let ((action (pop actions)))
+          ;; Send pending event, if it doesn't match.
+          (when (and file-notify--pending-event
+                     ;; The cookie doesn't match.
+                     (not (equal (file-notify--event-cookie
+                                  (car file-notify--pending-event))
+                                 (file-notify--event-cookie event)))
+                     (or
+                      ;; inotify.
+                      (and (eq (nth 1 (car file-notify--pending-event))
+                               'moved-from)
+                           (not (eq action 'moved-to)))
+                      ;; w32notify.
+                      (and (eq (nth 1 (car file-notify--pending-event))
+                               'renamed-from)
+                           (not (eq action 'renamed-to)))))
+            (setq pending-event file-notify--pending-event
+                  file-notify--pending-event nil)
+            (setcar (cdar pending-event) 'deleted))
+
+          ;; Map action.  We ignore all events which cannot be mapped.
+          (setq action
+                (cond
+                 ((memq action
+                        '(attribute-changed changed created deleted renamed))
+                  action)
+                 ((memq action '(moved rename))
+                  ;; The kqueue rename event does not return file1 in
+                  ;; case a file monitor is established.
+                  (if (setq file1 (file-notify--event-file1-name event))
+                      'renamed 'deleted))
+                 ((eq action 'ignored)
+                  (setq stopped t actions nil))
+                 ((memq action '(attrib link)) 'attribute-changed)
+                 ((memq action '(create added)) 'created)
+                 ((memq action '(modify modified write)) 'changed)
+                 ((memq action
+                        '(delete delete-self move-self removed)) 'deleted)
+                 ;; Make the event pending.
+                 ((memq action '(moved-from renamed-from))
+                  (setq file-notify--pending-event
+                        `((,desc ,action ,file
+                           ,(file-notify--event-cookie event))
+                          ,(file-notify--watch-callback watch)))
+                  nil)
+                 ;; Look for pending event.
+                 ((memq action '(moved-to renamed-to))
+                  (if (null file-notify--pending-event)
+                      'created
+                    (setq file1 file
+                          file (file-notify--event-file-name
+                                (car file-notify--pending-event)))
+                    ;; If the source is handled by another watch, we
+                    ;; must fire the rename event there as well.
+                    (unless (equal desc (caar file-notify--pending-event))
+                      (setq pending-event
+                            `((,(caar file-notify--pending-event)
+                               renamed ,file ,file1)
+                              ,(cadr file-notify--pending-event))))
+                    (setq file-notify--pending-event nil)
+                    'renamed))))
+
+          ;; Apply pending callback.
+          (when pending-event
+            (funcall (cadr pending-event) (car pending-event))
+            (setq pending-event nil))
+
+          ;; Apply callback.
+          (when (and action
+                     (or
+                      ;; If there is no relative file name for that
+                      ;; watch, we watch the whole directory.
+                      (null (file-notify--watch-filename watch))
+                      ;; File matches.
+                      (string-equal
+                       (file-notify--watch-filename watch)
+                       (file-name-nondirectory file))
+                      ;; Directory matches.
+                      (string-equal
+                       (file-name-nondirectory file)
+                       (file-name-nondirectory
+                        (file-notify--watch-directory watch)))
+                      ;; File1 matches.
+                      (and (stringp file1)
+                           (string-equal
+                            (file-notify--watch-filename watch)
+                            (file-name-nondirectory file1)))))
+            ;;(message
+            ;;"file-notify-callback %S %S %S %S %S"
+            ;;desc action file file1 watch)
+            (if file1
+                (funcall (file-notify--watch-callback watch)
+                         `(,desc ,action ,file ,file1))
+              (funcall (file-notify--watch-callback watch)
+                       `(,desc  ,action ,file))))
+
+          ;; Send `stopped' event.
+          (when (or stopped
+                    (and (memq action '(deleted renamed))
+                         ;; Not, when a file is backed up.
+                         (not (and (stringp file1) (backup-file-name-p file1)))
+                         ;; Watched file or directory is concerned.
+                         (string-equal
+                          file (file-notify--event-watched-file event))))
+            (file-notify-rm-watch desc)))))))
 
 ;; `kqueue', `gfilenotify' and `w32notify' return a unique descriptor
 ;; for every `file-notify-add-watch', while `inotify' returns a unique
@@ -339,7 +312,7 @@ FILE is the name of the file whose event is being reported."
               (if (file-directory-p file)
                   file
                 (file-name-directory file))))
-       desc func l-flags registered entry)
+         desc func l-flags)
 
     (unless (file-directory-p dir)
       (signal 'file-notify-error `("Directory does not exist" ,dir)))
@@ -347,13 +320,7 @@ FILE is the name of the file whose event is being 
reported."
     (if handler
        ;; A file name handler could exist even if there is no local
        ;; file notification support.
-       (setq desc (funcall
-                   handler 'file-notify-add-watch
-                    ;; kqueue does not report file changes in
-                    ;; directory monitor.  So we must watch the file
-                    ;; itself.
-                    (if (eq file-notify--library 'kqueue) file dir)
-                    flags callback))
+       (setq desc (funcall handler 'file-notify-add-watch dir flags callback))
 
       ;; Check, whether Emacs has been compiled with file notification
       ;; support.
@@ -391,70 +358,52 @@ FILE is the name of the file whose event is being 
reported."
 
       ;; Call low-level function.
       (setq desc (funcall
+                  ;; kqueue does not report file changes in directory
+                  ;; monitor.  So we must watch the file itself.
                   func (if (eq file-notify--library 'kqueue) file dir)
                   l-flags 'file-notify-callback)))
 
     ;; Modify `file-notify-descriptors'.
-    (setq file (unless (file-directory-p file) (file-name-nondirectory file))
-         desc (if (consp desc) (car desc) desc)
-         registered (gethash desc file-notify-descriptors)
-         entry `(,file . ,callback))
-    (unless (member entry (cdr registered))
-      (puthash desc `(,dir ,entry . ,(cdr registered)) 
file-notify-descriptors))
-
+    (let ((watch (file-notify--watch-make
+                  dir
+                  (unless (file-directory-p file) (file-name-nondirectory 
file))
+                  callback)))
+      (puthash desc watch file-notify-descriptors))
     ;; Return descriptor.
-    (file-notify--descriptor desc file)))
+    desc))
 
 (defun file-notify-rm-watch (descriptor)
   "Remove an existing watch specified by its DESCRIPTOR.
 DESCRIPTOR should be an object returned by `file-notify-add-watch'."
-  (let* ((desc (if (consp descriptor) (car descriptor) descriptor))
-        (file (if (consp descriptor) (cdr descriptor)))
-         (registered (gethash desc file-notify-descriptors))
-        (dir (car registered))
-        (handler (and (stringp dir)
-                       (find-file-name-handler dir 'file-notify-rm-watch))))
-
-    (when (stringp dir)
-      ;; Call low-level function.
-      (when (or (not file)
-                (and (= (length (cdr registered)) 1)
-                     (assoc file (cdr registered))))
-        (condition-case nil
-            (if handler
-                ;; A file name handler could exist even if there is no local
-                ;; file notification support.
-                (funcall handler 'file-notify-rm-watch descriptor)
-
-              (funcall
-               (cond
-                ((eq file-notify--library 'inotify) 'inotify-rm-watch)
-                ((eq file-notify--library 'kqueue) 'kqueue-rm-watch)
-                ((eq file-notify--library 'gfilenotify) 'gfile-rm-watch)
-                ((eq file-notify--library 'w32notify) 'w32notify-rm-watch))
-               desc))
-          (file-notify-error nil)))
-
-      ;; Modify `file-notify-descriptors'.
-      (file-notify--rm-descriptor descriptor))))
+  (when-let (watch (gethash descriptor file-notify-descriptors))
+    (let ((handler (find-file-name-handler
+                    (file-notify--watch-directory watch)
+                    'file-notify-rm-watch)))
+      (condition-case nil
+          (if handler
+              ;; A file name handler could exist even if there is no
+              ;; local file notification support.
+              (funcall handler 'file-notify-rm-watch descriptor)
+
+            (funcall
+             (cond
+              ((eq file-notify--library 'inotify) 'inotify-rm-watch)
+              ((eq file-notify--library 'kqueue) 'kqueue-rm-watch)
+              ((eq file-notify--library 'gfilenotify) 'gfile-rm-watch)
+              ((eq file-notify--library 'w32notify) 'w32notify-rm-watch))
+             descriptor))
+        (file-notify-error nil)))
+    ;; Modify `file-notify-descriptors'.
+    (file-notify--rm-descriptor descriptor)))
 
 (defun file-notify-valid-p (descriptor)
   "Check a watch specified by its DESCRIPTOR.
 DESCRIPTOR should be an object returned by `file-notify-add-watch'."
-  (let* ((desc (if (consp descriptor) (car descriptor) descriptor))
-        (file (if (consp descriptor) (cdr descriptor)))
-         (registered (gethash desc file-notify-descriptors))
-        (dir (car registered))
-        handler)
-
-    (when (stringp dir)
-      (setq handler (find-file-name-handler dir 'file-notify-valid-p))
-
-      (and (or ;; It is a directory.
-               (not file)
-               ;; The file is registered.
-               (assoc file (cdr registered)))
-           (if handler
+  (when-let (watch (gethash descriptor file-notify-descriptors))
+    (let ((handler (find-file-name-handler
+                    (file-notify--watch-directory watch)
+                    'file-notify-valid-p)))
+      (and (if handler
                ;; A file name handler could exist even if there is no
                ;; local file notification support.
                (funcall handler 'file-notify-valid-p descriptor)
@@ -464,9 +413,19 @@ DESCRIPTOR should be an object returned by 
`file-notify-add-watch'."
                ((eq file-notify--library 'kqueue) 'kqueue-valid-p)
                ((eq file-notify--library 'gfilenotify) 'gfile-valid-p)
                ((eq file-notify--library 'w32notify) 'w32notify-valid-p))
-              desc))
+              descriptor))
            t))))
 
+
+;; TODO:
+;; * Watching a /dir/file may receive events for dir.
+;;   (This may be the desired behaviour.)
+;; * Watching a file in a already watched directory
+;;   If the file is created and *then* a watch is added to that file, the
+;;   watch might receive events which occurred prior to it being created,
+;;   due to the way events are propagated during idle time.  Note: This
+;;   may be perfectly acceptable.
+
 ;; The end:
 (provide 'filenotify)
 
diff --git a/lisp/files-x.el b/lisp/files-x.el
index a0cad70..b7c6f51 100644
--- a/lisp/files-x.el
+++ b/lisp/files-x.el
@@ -585,7 +585,7 @@ Return a new ordered plist list containing only property 
names from PROPERTIES."
    nil
    (mapcar
     (lambda (property)
-      (when (plist-member criteria property)
+      (when (and (plist-member criteria property) (plist-get criteria 
property))
         (list property (plist-get criteria property))))
     properties)))
 
@@ -606,12 +606,10 @@ using this connection, see 
`connection-local-criteria-alist'."
 
 ;;;###autoload
 (defun connection-local-set-profiles (criteria &rest profiles)
-  "Add PROFILES for remote servers.
-CRITERIA is either a regular expression identifying a remote
-server, or a function with one argument IDENTIFICATION, which
-returns non-nil when a remote server shall apply PROFILE's
-variables.  If CRITERIA is nil, it always applies.
-PROFILES are the names of a connection profile (a symbol).
+  "Add PROFILES for CRITERIA.
+CRITERIA is a plist identifying a connection and the application
+using this connection, see `connection-local-criteria-alist'.
+PROFILES are the names of connection profiles (a symbol).
 
 When a connection to a remote server is opened and CRITERIA
 matches to that server, the connection-local variables from
@@ -678,7 +676,7 @@ will not be changed."
 ;;;###autoload
 (defmacro with-connection-local-profiles (profiles &rest body)
   "Apply connection-local variables according to PROFILES in current buffer.
-Execute BODY, and unwind connection local variables."
+Execute BODY, and unwind connection-local variables."
   (declare (indent 1) (debug t))
   `(let ((enable-connection-local-variables t)
          (old-buffer-local-variables (buffer-local-variables))
diff --git a/lisp/files.el b/lisp/files.el
index 0a023a8..b4872e4 100644
--- a/lisp/files.el
+++ b/lisp/files.el
@@ -279,8 +279,13 @@ The value `never' means do not make them."
                 (const :tag "If existing" nil)
                 (other :tag "Always" t))
   :group 'backup)
+
+(defun version-control-safe-local-p (x)
+  "Return whether X is safe as local value for `version-control'."
+  (or (booleanp x) (equal x 'never)))
+
 (put 'version-control 'safe-local-variable
-     (lambda (x) (or (booleanp x) (equal x 'never))))
+     #'version-control-safe-local-p)
 
 (defcustom dired-kept-versions 2
   "When cleaning directory, number of versions to keep."
diff --git a/lisp/gnus/gnus-start.el b/lisp/gnus/gnus-start.el
index be46339..90f3cb4 100644
--- a/lisp/gnus/gnus-start.el
+++ b/lisp/gnus/gnus-start.el
@@ -3196,7 +3196,7 @@ If this variable is nil, don't do anything."
 
 (defun gnus-display-time-event-handler ()
   (if (and (fboundp 'display-time-event-handler)
-          (gnus-boundp 'display-time-timer))
+          (bound-and-true-p display-time-timer))
       (display-time-event-handler)))
 
 (defun gnus-check-reasonable-setup ()
diff --git a/lisp/gnus/gnus-util.el b/lisp/gnus/gnus-util.el
index 20eceb5..b509d8a 100644
--- a/lisp/gnus/gnus-util.el
+++ b/lisp/gnus/gnus-util.el
@@ -84,11 +84,6 @@ This is a compatibility function for different Emacsen."
   (declare (obsolete replace-regexp-in-string "26.1"))
   (replace-regexp-in-string regexp newtext string nil literal))
 
-(defun gnus-boundp (variable)
-  "Return non-nil if VARIABLE is bound and non-nil."
-  (and (boundp variable)
-       (symbol-value variable)))
-
 (defmacro gnus-eval-in-buffer-window (buffer &rest forms)
   "Pop to BUFFER, evaluate FORMS, and then return to the original window."
   (let ((tempvar (make-symbol "GnusStartBufferWindow"))
diff --git a/lisp/help.el b/lisp/help.el
index d3aaa1e..26be3b0 100644
--- a/lisp/help.el
+++ b/lisp/help.el
@@ -1419,7 +1419,7 @@ ARGLIST can also be t or a string of the form \"(FUN ARG1 
ARG2 ...)\"."
 
 (defun help-function-arglist (def &optional preserve-names)
   "Return a formal argument list for the function DEF.
-IF PRESERVE-NAMES is non-nil, return a formal arglist that uses
+If PRESERVE-NAMES is non-nil, return a formal arglist that uses
 the same names as used in the original source code, when possible."
   ;; Handle symbols aliased to other symbols.
   (if (and (symbolp def) (fboundp def)) (setq def (indirect-function def)))
diff --git a/lisp/ibuffer.el b/lisp/ibuffer.el
index 66916b2..c83c213 100644
--- a/lisp/ibuffer.el
+++ b/lisp/ibuffer.el
@@ -1689,7 +1689,7 @@ If point is on a group name, this function operates on 
that group."
                    ;; generate a call to the column function.
                    (ibuffer-aif (assq sym ibuffer-inline-columns)
                        (nth 1 it)
-                     `(,sym buffer mark)))
+                     `(or (,sym buffer mark) "")))
                   ;; You're not expected to understand this.  Hell, I
                   ;; don't even understand it, and I wrote it five
                   ;; minutes ago.
diff --git a/lisp/info.el b/lisp/info.el
index 8dc85f4..a6bab29 100644
--- a/lisp/info.el
+++ b/lisp/info.el
@@ -1998,19 +1998,20 @@ If DIRECTION is `backward', search in the reverse 
direction."
                   Info-isearch-initial-node
                   bound
                   (and found (> found opoint-min) (< found opoint-max)))
-       (signal 'search-failed (list regexp "end of node")))
+       (user-error "Search failed: `%s' (end of node)" regexp))
 
       ;; If no subfiles, give error now.
       (unless (or found Info-current-subfile)
         (if isearch-mode
-            (signal 'search-failed (list regexp "end of manual"))
+            (user-error "Search failed: `%s' (end of manual)" regexp)
           (let ((search-spaces-regexp Info-search-whitespace-regexp))
-            (if backward
-                (re-search-backward regexp)
-              (re-search-forward regexp)))))
+            (unless (if backward
+                        (re-search-backward regexp nil t)
+                      (re-search-forward regexp nil t))
+              (user-error "Search failed: `%s'" regexp)))))
 
       (if (and bound (not found))
-         (signal 'search-failed (list regexp)))
+          (user-error "Search failed: `%s'" regexp))
 
       (unless (or found bound)
        (unwind-protect
@@ -2054,9 +2055,8 @@ If DIRECTION is `backward', search in the reverse 
direction."
                    (setq list nil)))
              (if found
                  (message "")
-               (signal 'search-failed (if isearch-mode
-                                          (list regexp "end of manual")
-                                        (list regexp)))))
+                (user-error "Search failed: `%s'%s"
+                            regexp (if isearch-mode " (end of manual)" ""))))
          (if (not found)
              (progn (Info-read-subfile osubfile)
                     (goto-char opoint)
@@ -2699,7 +2699,8 @@ Because of ambiguities, this should be concatenated with 
something like
             (orignode Info-current-node)
             nextnode)
         (goto-char (point-min))
-        (search-forward "\n* Menu:")
+        (unless (search-forward "\n* Menu:" nil t)
+          (user-error "No menu in this node"))
         (cond
          ((eq (car-safe action) 'boundaries) nil)
          ((eq action 'lambda)
@@ -5237,9 +5238,6 @@ BUFFER is the buffer speedbar is requesting buttons for."
       (erase-buffer))
   (Info-speedbar-hierarchy-buttons nil 0))
 
-;; FIXME: Really?  Why here?
-(add-to-list 'debug-ignored-errors 'search-failed)
-
 ;;;;  Desktop support
 
 (defun Info-desktop-buffer-misc-data (_desktop-dirname)
diff --git a/lisp/ldefs-boot.el b/lisp/ldefs-boot.el
index 01a3e5d..411969a 100644
--- a/lisp/ldefs-boot.el
+++ b/lisp/ldefs-boot.el
@@ -5224,7 +5224,9 @@ You might also use mode hooks to specify it in certain 
modes, like this:
                (concat \"make -k \"
                        (if buffer-file-name
                          (shell-quote-argument
-                           (file-name-sans-extension buffer-file-name))))))))")
+                           (file-name-sans-extension buffer-file-name))))))))
+
+It's often useful to leave a space at the end of the value.")
 
 (custom-autoload 'compile-command "compile" t)
 (put 'compile-command 'safe-local-variable (lambda (a) (and (stringp a) (or 
(not (boundp 'compilation-read-command)) compilation-read-command))))
@@ -12465,12 +12467,10 @@ Copy directory-local variables to the -*- line.
 Non-nil means enable use of connection-local variables.")
 
 (autoload 'connection-local-set-profiles "files-x" "\
-Add PROFILES for remote servers.
-CRITERIA is either a regular expression identifying a remote
-server, or a function with one argument IDENTIFICATION, which
-returns non-nil when a remote server shall apply PROFILE's
-variables.  If CRITERIA is nil, it always applies.
-PROFILES are the names of a connection profile (a symbol).
+Add PROFILES for CRITERIA.
+CRITERIA is a plist identifying a connection and the application
+using this connection, see `connection-local-criteria-alist'.
+PROFILES are the names of connection profiles (a symbol).
 
 When a connection to a remote server is opened and CRITERIA
 matches to that server, the connection-local variables from
@@ -12504,7 +12504,7 @@ will not be changed.
 
 (autoload 'with-connection-local-profiles "files-x" "\
 Apply connection-local variables according to PROFILES in current buffer.
-Execute BODY, and unwind connection local variables.
+Execute BODY, and unwind connection-local variables.
 
 \(fn PROFILES &rest BODY)" nil t)
 
@@ -15857,14 +15857,6 @@ This discards the buffer's undo information.
 
 ;;;***
 
-;;;### (autoloads "actual autoloads are elsewhere" "hfy-cmap" "hfy-cmap.el"
-;;;;;;  (0 0 0 0))
-;;; Generated autoloads from hfy-cmap.el
-
-(if (fboundp 'register-definition-prefixes) (register-definition-prefixes 
"hfy-cmap" '("hfy-" "htmlfontify-unload-rgb-file")))
-
-;;;***
-
 ;;;### (autoloads nil "hi-lock" "hi-lock.el" (0 0 0 0))
 ;;; Generated autoloads from hi-lock.el
 
@@ -21868,7 +21860,7 @@ QUALITY can be:
   `approximate', in which case we may cut some corners to avoid
     excessive work.
   `exact', in which case we may end up re-(en/de)coding a large
-    part of the file/buffer.
+    part of the file/buffer, this can be expensive and slow.
   nil, in which case we may return nil rather than an approximation.
 
 \(fn BYTE &optional QUALITY CODING-SYSTEM)" nil nil)
@@ -21882,7 +21874,7 @@ QUALITY can be:
   `approximate', in which case we may cut some corners to avoid
     excessive work.
   `exact', in which case we may end up re-(en/de)coding a large
-    part of the file/buffer.
+    part of the file/buffer, this can be expensive and slow.
   nil, in which case we may return nil rather than an approximation.
 
 \(fn POSITION &optional QUALITY CODING-SYSTEM)" nil nil)
@@ -33879,7 +33871,7 @@ It can have the following values:
 
 (custom-autoload 'tramp-syntax "tramp" t)
 
-(defconst tramp-file-name-regexp-unified (if (memq system-type '(cygwin 
windows-nt)) "\\`/\\(\\[.*\\]\\|[^/|:]\\{2,\\}[^/|]*\\):" "\\`/[^/|:][^/|]*:") 
"\
+(defconst tramp-file-name-regexp-unified "\\`/.+:.*:" "\
 Value for `tramp-file-name-regexp' for unified remoting.
 See `tramp-file-name-structure' for more explanations.
 
@@ -33889,23 +33881,23 @@ On W32 systems, the volume letter must be ignored.")
 Value for `tramp-file-name-regexp' for separate remoting.
 See `tramp-file-name-structure' for more explanations.")
 
-(defvar tramp-file-name-regexp (cond ((equal tramp-syntax 'ftp) 
tramp-file-name-regexp-unified) ((equal tramp-syntax 'sep) 
tramp-file-name-regexp-separate) (t (error "Wrong `tramp-syntax' defined"))) "\
+(defvar tramp-file-name-regexp (cond ((eq tramp-syntax 'ftp) 
tramp-file-name-regexp-unified) ((eq tramp-syntax 'sep) 
tramp-file-name-regexp-separate) (t (error "Wrong `tramp-syntax' defined"))) "\
 Regular expression matching file names handled by Tramp.
 This regexp should match Tramp file names but no other file
 names.  When calling `tramp-register-file-name-handlers', the
 initial value is overwritten by the car of `tramp-file-name-structure'.")
 
-(defconst tramp-completion-file-name-regexp-unified (if (memq system-type 
'(cygwin windows-nt)) "\\`/[^/]\\{2,\\}\\'" "\\`/[^/]*\\'") "\
+(defconst tramp-completion-file-name-regexp-unified (concat "\\`/\\(" 
"\\([^/|:]+:[^/|:]*|\\)*" (if (memq system-type '(cygwin windows-nt)) 
"\\(-\\|[^/|:]\\{2,\\}\\)" "[^/|:]+") "\\(:[^/|:]*\\)?" "\\)?\\'") "\
 Value for `tramp-completion-file-name-regexp' for unified remoting.
 See `tramp-file-name-structure' for more explanations.
 
 On W32 systems, the volume letter must be ignored.")
 
-(defconst tramp-completion-file-name-regexp-separate "\\`/\\([[][^]]*\\)?\\'" 
"\
+(defconst tramp-completion-file-name-regexp-separate "\\`/\\[\\([^]]*\\)?\\'" 
"\
 Value for `tramp-completion-file-name-regexp' for separate remoting.
 See `tramp-file-name-structure' for more explanations.")
 
-(defconst tramp-completion-file-name-regexp (cond ((equal tramp-syntax 'ftp) 
tramp-completion-file-name-regexp-unified) ((equal tramp-syntax 'sep) 
tramp-completion-file-name-regexp-separate) (t (error "Wrong `tramp-syntax' 
defined"))) "\
+(defconst tramp-completion-file-name-regexp (cond ((eq tramp-syntax 'ftp) 
tramp-completion-file-name-regexp-unified) ((eq tramp-syntax 'sep) 
tramp-completion-file-name-regexp-separate) (t (error "Wrong `tramp-syntax' 
defined"))) "\
 Regular expression matching file names handled by Tramp completion.
 This regexp should match partial Tramp file names only.
 
@@ -33916,20 +33908,31 @@ updated after changing this variable.
 
 Also see `tramp-file-name-structure'.")
 
-(defun tramp-completion-run-real-handler (operation args) "\
-Invoke `tramp-file-name-handler' for OPERATION.
+(defconst tramp-completion-file-name-handler-alist 
'((file-name-all-completions . 
tramp-completion-handle-file-name-all-completions) (file-name-completion . 
tramp-completion-handle-file-name-completion)) "\
+Alist of completion handler functions.
+Used for file names matching `tramp-completion-file-name-regexp'.
+Operations not mentioned here will be handled by Tramp's file
+name handler functions, or the normal Emacs functions.")
+
+(defun tramp-run-real-handler (operation args) "\
+Invoke normal file name handler for OPERATION.
 First arg specifies the OPERATION, second arg is a list of arguments to
-pass to the OPERATION." (let* ((inhibit-file-name-handlers (\` 
(tramp-completion-file-name-handler cygwin-mount-name-hook-function 
cygwin-mount-map-drive-hook-function \, (and (eq inhibit-file-name-operation 
operation) inhibit-file-name-handlers)))) (inhibit-file-name-operation 
operation)) (apply operation args)))
-(defun tramp-completion-file-name-handler (operation &rest args)
- (if (tramp-completion-mode-p)
-     (apply 'tramp-autoload-file-name-handler operation args)
-   (tramp-completion-run-real-handler operation args)))
+pass to the OPERATION." (let* ((inhibit-file-name-handlers (\` 
(tramp-file-name-handler tramp-vc-file-name-handler 
tramp-completion-file-name-handler cygwin-mount-name-hook-function 
cygwin-mount-map-drive-hook-function \, (and (eq inhibit-file-name-operation 
operation) inhibit-file-name-handlers)))) (inhibit-file-name-operation 
operation)) (apply operation args)))
 
-(defun tramp-autoload-file-name-handler (operation &rest args) "\
-Load Tramp file name handler, and perform OPERATION." (if (and (not (and 
(stringp (car args)) (string-equal (car args) "/"))) (let ((default-directory 
temporary-file-directory)) (and (null load-in-progress) (load "tramp" (quote 
noerror) (quote nomessage))))) (apply operation args) 
(tramp-completion-run-real-handler operation args)))
+(autoload 'tramp-file-name-handler "tramp" "\
+Invoke Tramp file name handler.
+Falls back to normal file name handler if no Tramp file name handler exists.
+
+\(fn OPERATION &rest ARGS)" nil nil)
+
+(autoload 'tramp-completion-file-name-handler "tramp" "\
+Invoke Tramp file name completion handler.
+Falls back to normal file name handler if no Tramp file name handler exists.
+
+\(fn OPERATION &rest ARGS)" nil nil)
 
 (defun tramp-register-autoload-file-name-handlers nil "\
-Add Tramp file name handlers to `file-name-handler-alist' during autoload." 
(add-to-list (quote file-name-handler-alist) (cons tramp-file-name-regexp 
(quote tramp-autoload-file-name-handler))) (put (quote 
tramp-autoload-file-name-handler) (quote safe-magic) t) (add-to-list (quote 
file-name-handler-alist) (cons tramp-completion-file-name-regexp (quote 
tramp-completion-file-name-handler))) (put (quote 
tramp-completion-file-name-handler) (quote safe-magic) t))
+Add Tramp file name handlers to `file-name-handler-alist' during autoload." 
(add-to-list (quote file-name-handler-alist) (cons tramp-file-name-regexp 
(quote tramp-file-name-handler))) (put (quote tramp-file-name-handler) (quote 
safe-magic) t) (put (quote tramp-file-name-handler) (quote operations) (quote 
(file-name-all-completions file-name-completion file-remote-p))) (add-to-list 
(quote file-name-handler-alist) (cons tramp-completion-file-name-regexp (quote 
tramp-completion-file-name-ha [...]
 
 (tramp-register-autoload-file-name-handlers)
 
@@ -33939,15 +33942,7 @@ Unload Tramp file name handlers from 
`file-name-handler-alist'.
 \(fn)" nil nil)
 
 (defvar tramp-completion-mode nil "\
-If non-nil, external packages signal that they are in file name completion.
-
-This is necessary, because Tramp uses a heuristic depending on last
-input event.  This fails when external packages use other characters
-but <TAB>, <SPACE> or ?\\? for file name completion.  This variable
-should never be set globally, the intention is to let-bind it.")
-
-(defun tramp-completion-mode-p nil "\
-Check, whether method / user name / host name completion is active." (or (and 
(boundp (quote non-essential)) (symbol-value (quote non-essential))) 
tramp-completion-mode (equal last-input-event (quote tab))))
+If non-nil, external packages signal that they are in file name completion.")
 
 (autoload 'tramp-unload-tramp "tramp" "\
 Discard Tramp from loading remote files.
@@ -37759,7 +37754,7 @@ The major browsing mode used is essentially the 
standard Man mode.
 Choose the filename for the man page using completion, based on the
 topic selected from the directories specified in `woman-manpath' and
 `woman-path'.  The directory expansions and topics are cached for
-speed, but a non-nil interactive argument forces the caches to be
+speed.  With a prefix argument, force the caches to be
 updated (e.g. to re-interpret the current directory).
 
 Used non-interactively, arguments are optional: if given then TOPIC
@@ -38050,17 +38045,16 @@ Zone out, completely.
 ;;;***
 
 ;;;### (autoloads nil nil ("abbrev.el" "bindings.el" "buff-menu.el"
-;;;;;;  "button.el" "calc/calc-aent.el" "calc/calc-embed.el" 
"calc/calc-loaddefs.el"
-;;;;;;  "calc/calc-misc.el" "calc/calc-yank.el" "calendar/cal-loaddefs.el"
-;;;;;;  "calendar/diary-loaddefs.el" "calendar/hol-loaddefs.el" "case-table.el"
-;;;;;;  "cedet/ede/base.el" "cedet/ede/config.el" "cedet/ede/cpp-root.el"
-;;;;;;  "cedet/ede/custom.el" "cedet/ede/dired.el" "cedet/ede/emacs.el"
-;;;;;;  "cedet/ede/files.el" "cedet/ede/generic.el" "cedet/ede/linux.el"
-;;;;;;  "cedet/ede/loaddefs.el" "cedet/ede/locate.el" "cedet/ede/make.el"
-;;;;;;  "cedet/ede/shell.el" "cedet/ede/speedbar.el" "cedet/ede/system.el"
-;;;;;;  "cedet/ede/util.el" "cedet/semantic/analyze.el" 
"cedet/semantic/analyze/complete.el"
-;;;;;;  "cedet/semantic/analyze/refs.el" "cedet/semantic/bovine.el"
-;;;;;;  "cedet/semantic/bovine/c.el" "cedet/semantic/bovine/el.el"
+;;;;;;  "button.el" "calc/calc-aent.el" "calc/calc-embed.el" 
"calc/calc-misc.el"
+;;;;;;  "calc/calc-yank.el" "calendar/cal-loaddefs.el" 
"calendar/diary-loaddefs.el"
+;;;;;;  "calendar/hol-loaddefs.el" "case-table.el" "cedet/ede/base.el"
+;;;;;;  "cedet/ede/config.el" "cedet/ede/cpp-root.el" "cedet/ede/custom.el"
+;;;;;;  "cedet/ede/dired.el" "cedet/ede/emacs.el" "cedet/ede/files.el"
+;;;;;;  "cedet/ede/generic.el" "cedet/ede/linux.el" "cedet/ede/locate.el"
+;;;;;;  "cedet/ede/make.el" "cedet/ede/shell.el" "cedet/ede/speedbar.el"
+;;;;;;  "cedet/ede/system.el" "cedet/ede/util.el" "cedet/semantic/analyze.el"
+;;;;;;  "cedet/semantic/analyze/complete.el" "cedet/semantic/analyze/refs.el"
+;;;;;;  "cedet/semantic/bovine.el" "cedet/semantic/bovine/c.el" 
"cedet/semantic/bovine/el.el"
 ;;;;;;  "cedet/semantic/bovine/gcc.el" "cedet/semantic/bovine/make.el"
 ;;;;;;  "cedet/semantic/bovine/scm.el" "cedet/semantic/complete.el"
 ;;;;;;  "cedet/semantic/ctxt.el" "cedet/semantic/db-file.el" 
"cedet/semantic/db-find.el"
@@ -38071,40 +38065,38 @@ Zone out, completely.
 ;;;;;;  "cedet/semantic/find.el" "cedet/semantic/format.el" 
"cedet/semantic/html.el"
 ;;;;;;  "cedet/semantic/ia-sb.el" "cedet/semantic/ia.el" 
"cedet/semantic/idle.el"
 ;;;;;;  "cedet/semantic/imenu.el" "cedet/semantic/lex-spp.el" 
"cedet/semantic/lex.el"
-;;;;;;  "cedet/semantic/loaddefs.el" "cedet/semantic/mru-bookmark.el"
-;;;;;;  "cedet/semantic/scope.el" "cedet/semantic/senator.el" 
"cedet/semantic/sort.el"
-;;;;;;  "cedet/semantic/symref.el" "cedet/semantic/symref/cscope.el"
-;;;;;;  "cedet/semantic/symref/global.el" "cedet/semantic/symref/grep.el"
-;;;;;;  "cedet/semantic/symref/idutils.el" "cedet/semantic/symref/list.el"
-;;;;;;  "cedet/semantic/tag-file.el" "cedet/semantic/tag-ls.el" 
"cedet/semantic/tag-write.el"
+;;;;;;  "cedet/semantic/mru-bookmark.el" "cedet/semantic/scope.el"
+;;;;;;  "cedet/semantic/senator.el" "cedet/semantic/sort.el" 
"cedet/semantic/symref.el"
+;;;;;;  "cedet/semantic/symref/cscope.el" "cedet/semantic/symref/global.el"
+;;;;;;  "cedet/semantic/symref/grep.el" "cedet/semantic/symref/idutils.el"
+;;;;;;  "cedet/semantic/symref/list.el" "cedet/semantic/tag-file.el"
+;;;;;;  "cedet/semantic/tag-ls.el" "cedet/semantic/tag-write.el"
 ;;;;;;  "cedet/semantic/tag.el" "cedet/semantic/texi.el" 
"cedet/semantic/util-modes.el"
 ;;;;;;  "cedet/semantic/wisent/java-tags.el" 
"cedet/semantic/wisent/javascript.el"
 ;;;;;;  "cedet/semantic/wisent/python.el" "cedet/srecode/compile.el"
 ;;;;;;  "cedet/srecode/cpp.el" "cedet/srecode/document.el" 
"cedet/srecode/el.el"
 ;;;;;;  "cedet/srecode/expandproto.el" "cedet/srecode/getset.el"
-;;;;;;  "cedet/srecode/insert.el" "cedet/srecode/java.el" 
"cedet/srecode/loaddefs.el"
-;;;;;;  "cedet/srecode/map.el" "cedet/srecode/mode.el" "cedet/srecode/srt.el"
-;;;;;;  "cedet/srecode/template.el" "cedet/srecode/texi.el" "composite.el"
-;;;;;;  "cus-face.el" "cus-start.el" "custom.el" "dired-aux.el" 
"dired-loaddefs.el"
-;;;;;;  "dired-x.el" "electric.el" "emacs-lisp/backquote.el" 
"emacs-lisp/byte-run.el"
-;;;;;;  "emacs-lisp/cl-extra.el" "emacs-lisp/cl-loaddefs.el" 
"emacs-lisp/cl-macs.el"
+;;;;;;  "cedet/srecode/insert.el" "cedet/srecode/java.el" 
"cedet/srecode/map.el"
+;;;;;;  "cedet/srecode/mode.el" "cedet/srecode/srt.el" 
"cedet/srecode/template.el"
+;;;;;;  "cedet/srecode/texi.el" "composite.el" "cus-face.el" "cus-start.el"
+;;;;;;  "custom.el" "dired-aux.el" "dired-x.el" "electric.el" 
"emacs-lisp/backquote.el"
+;;;;;;  "emacs-lisp/byte-run.el" "emacs-lisp/cl-extra.el" 
"emacs-lisp/cl-macs.el"
 ;;;;;;  "emacs-lisp/cl-preloaded.el" "emacs-lisp/cl-seq.el" 
"emacs-lisp/eieio-compat.el"
-;;;;;;  "emacs-lisp/eieio-custom.el" "emacs-lisp/eieio-loaddefs.el"
-;;;;;;  "emacs-lisp/eieio-opt.el" "emacs-lisp/eldoc.el" 
"emacs-lisp/float-sup.el"
-;;;;;;  "emacs-lisp/lisp-mode.el" "emacs-lisp/lisp.el" "emacs-lisp/macroexp.el"
-;;;;;;  "emacs-lisp/map-ynp.el" "emacs-lisp/nadvice.el" "emacs-lisp/syntax.el"
-;;;;;;  "emacs-lisp/timer.el" "env.el" "epa-hook.el" "eshell/em-alias.el"
-;;;;;;  "eshell/em-banner.el" "eshell/em-basic.el" "eshell/em-cmpl.el"
-;;;;;;  "eshell/em-dirs.el" "eshell/em-glob.el" "eshell/em-hist.el"
-;;;;;;  "eshell/em-ls.el" "eshell/em-pred.el" "eshell/em-prompt.el"
-;;;;;;  "eshell/em-rebind.el" "eshell/em-script.el" "eshell/em-smart.el"
-;;;;;;  "eshell/em-term.el" "eshell/em-tramp.el" "eshell/em-unix.el"
-;;;;;;  "eshell/em-xtra.el" "eshell/esh-groups.el" "facemenu.el"
-;;;;;;  "faces.el" "files.el" "font-core.el" "font-lock.el" "format.el"
-;;;;;;  "frame.el" "help.el" "hfy-cmap.el" "htmlfontify-loaddefs.el"
-;;;;;;  "ibuf-ext.el" "ibuffer-loaddefs.el" "indent.el" 
"international/characters.el"
-;;;;;;  "international/charprop.el" "international/charscript.el"
-;;;;;;  "international/cp51932.el" "international/eucjp-ms.el" 
"international/mule-cmds.el"
+;;;;;;  "emacs-lisp/eieio-custom.el" "emacs-lisp/eieio-opt.el" 
"emacs-lisp/eldoc.el"
+;;;;;;  "emacs-lisp/float-sup.el" "emacs-lisp/lisp-mode.el" 
"emacs-lisp/lisp.el"
+;;;;;;  "emacs-lisp/macroexp.el" "emacs-lisp/map-ynp.el" 
"emacs-lisp/nadvice.el"
+;;;;;;  "emacs-lisp/syntax.el" "emacs-lisp/timer.el" "env.el" "epa-hook.el"
+;;;;;;  "eshell/em-alias.el" "eshell/em-banner.el" "eshell/em-basic.el"
+;;;;;;  "eshell/em-cmpl.el" "eshell/em-dirs.el" "eshell/em-glob.el"
+;;;;;;  "eshell/em-hist.el" "eshell/em-ls.el" "eshell/em-pred.el"
+;;;;;;  "eshell/em-prompt.el" "eshell/em-rebind.el" "eshell/em-script.el"
+;;;;;;  "eshell/em-smart.el" "eshell/em-term.el" "eshell/em-tramp.el"
+;;;;;;  "eshell/em-unix.el" "eshell/em-xtra.el" "facemenu.el" "faces.el"
+;;;;;;  "files.el" "font-core.el" "font-lock.el" "format.el" "frame.el"
+;;;;;;  "help.el" "hfy-cmap.el" "htmlfontify-loaddefs.el" "ibuf-ext.el"
+;;;;;;  "indent.el" "international/characters.el" "international/charprop.el"
+;;;;;;  "international/charscript.el" "international/cp51932.el"
+;;;;;;  "international/eucjp-ms.el" "international/mule-cmds.el"
 ;;;;;;  "international/mule-conf.el" "international/mule.el" 
"international/uni-bidi.el"
 ;;;;;;  "international/uni-brackets.el" "international/uni-category.el"
 ;;;;;;  "international/uni-combining.el" "international/uni-comment.el"
@@ -38132,32 +38124,30 @@ Zone out, completely.
 ;;;;;;  "leim/quail/pypunct-b5.el" "leim/quail/rfc1345.el" 
"leim/quail/sgml-input.el"
 ;;;;;;  "leim/quail/slovak.el" "leim/quail/symbol-ksc.el" 
"leim/quail/tamil-dvorak.el"
 ;;;;;;  "leim/quail/vntelex.el" "leim/quail/vnvni.el" "leim/quail/welsh.el"
-;;;;;;  "loadup.el" "mail/blessmail.el" "mail/rmail-loaddefs.el"
-;;;;;;  "mail/rmailedit.el" "mail/rmailkwd.el" "mail/rmailmm.el"
-;;;;;;  "mail/rmailmsc.el" "mail/rmailsort.el" "mail/rmailsum.el"
-;;;;;;  "mail/undigest.el" "menu-bar.el" "mh-e/mh-gnus.el" 
"mh-e/mh-loaddefs.el"
-;;;;;;  "minibuffer.el" "mouse.el" "net/tramp-loaddefs.el" "newcomment.el"
-;;;;;;  "obarray.el" "org/ob-core.el" "org/ob-keys.el" "org/ob-lob.el"
-;;;;;;  "org/ob-matlab.el" "org/ob-tangle.el" "org/ob.el" "org/org-archive.el"
-;;;;;;  "org/org-attach.el" "org/org-bbdb.el" "org/org-clock.el"
-;;;;;;  "org/org-datetree.el" "org/org-element.el" "org/org-feed.el"
-;;;;;;  "org/org-footnote.el" "org/org-id.el" "org/org-indent.el"
-;;;;;;  "org/org-install.el" "org/org-irc.el" "org/org-loaddefs.el"
-;;;;;;  "org/org-mobile.el" "org/org-plot.el" "org/org-table.el"
-;;;;;;  "org/org-timer.el" "org/ox-ascii.el" "org/ox-beamer.el" 
"org/ox-html.el"
-;;;;;;  "org/ox-icalendar.el" "org/ox-latex.el" "org/ox-man.el" "org/ox-md.el"
-;;;;;;  "org/ox-odt.el" "org/ox-org.el" "org/ox-publish.el" "org/ox-texinfo.el"
-;;;;;;  "org/ox.el" "progmodes/elisp-mode.el" "progmodes/prog-mode.el"
-;;;;;;  "ps-def.el" "ps-mule.el" "ps-print-loaddefs.el" "register.el"
-;;;;;;  "replace.el" "rfn-eshadow.el" "select.el" "simple.el" "startup.el"
-;;;;;;  "subdirs.el" "subr.el" "textmodes/fill.el" "textmodes/page.el"
-;;;;;;  "textmodes/paragraphs.el" "textmodes/reftex-auc.el" 
"textmodes/reftex-cite.el"
-;;;;;;  "textmodes/reftex-dcr.el" "textmodes/reftex-global.el" 
"textmodes/reftex-index.el"
-;;;;;;  "textmodes/reftex-loaddefs.el" "textmodes/reftex-parse.el"
-;;;;;;  "textmodes/reftex-ref.el" "textmodes/reftex-sel.el" 
"textmodes/reftex-toc.el"
-;;;;;;  "textmodes/text-mode.el" "uniquify.el" "vc/ediff-hook.el"
-;;;;;;  "vc/vc-hooks.el" "version.el" "widget.el" "window.el") (0
-;;;;;;  0 0 0))
+;;;;;;  "loadup.el" "mail/blessmail.el" "mail/rmailedit.el" "mail/rmailkwd.el"
+;;;;;;  "mail/rmailmm.el" "mail/rmailmsc.el" "mail/rmailsort.el"
+;;;;;;  "mail/rmailsum.el" "mail/undigest.el" "menu-bar.el" "mh-e/mh-gnus.el"
+;;;;;;  "mh-e/mh-loaddefs.el" "minibuffer.el" "mouse.el" 
"net/tramp-loaddefs.el"
+;;;;;;  "newcomment.el" "obarray.el" "org/ob-core.el" "org/ob-keys.el"
+;;;;;;  "org/ob-lob.el" "org/ob-matlab.el" "org/ob-tangle.el" "org/ob.el"
+;;;;;;  "org/org-archive.el" "org/org-attach.el" "org/org-bbdb.el"
+;;;;;;  "org/org-clock.el" "org/org-datetree.el" "org/org-element.el"
+;;;;;;  "org/org-feed.el" "org/org-footnote.el" "org/org-id.el" 
"org/org-indent.el"
+;;;;;;  "org/org-install.el" "org/org-irc.el" "org/org-mobile.el"
+;;;;;;  "org/org-plot.el" "org/org-table.el" "org/org-timer.el" 
"org/ox-ascii.el"
+;;;;;;  "org/ox-beamer.el" "org/ox-html.el" "org/ox-icalendar.el"
+;;;;;;  "org/ox-latex.el" "org/ox-man.el" "org/ox-md.el" "org/ox-odt.el"
+;;;;;;  "org/ox-org.el" "org/ox-publish.el" "org/ox-texinfo.el" "org/ox.el"
+;;;;;;  "progmodes/elisp-mode.el" "progmodes/prog-mode.el" "ps-def.el"
+;;;;;;  "ps-mule.el" "register.el" "replace.el" "rfn-eshadow.el"
+;;;;;;  "select.el" "simple.el" "startup.el" "subdirs.el" "subr.el"
+;;;;;;  "textmodes/fill.el" "textmodes/page.el" "textmodes/paragraphs.el"
+;;;;;;  "textmodes/reftex-auc.el" "textmodes/reftex-cite.el" 
"textmodes/reftex-dcr.el"
+;;;;;;  "textmodes/reftex-global.el" "textmodes/reftex-index.el"
+;;;;;;  "textmodes/reftex-parse.el" "textmodes/reftex-ref.el" 
"textmodes/reftex-sel.el"
+;;;;;;  "textmodes/reftex-toc.el" "textmodes/text-mode.el" "uniquify.el"
+;;;;;;  "vc/ediff-hook.el" "vc/vc-hooks.el" "version.el" "widget.el"
+;;;;;;  "window.el") (0 0 0 0))
 
 ;;;***
 
diff --git a/lisp/man.el b/lisp/man.el
index 4f6e118..0e1c929 100644
--- a/lisp/man.el
+++ b/lisp/man.el
@@ -832,10 +832,7 @@ indicating optional parts and whitespace being interpreted
 somewhat loosely.
 
 foo[, bar [, ...]] [other stuff] (sec) - description
-foo(sec)[, bar(sec) [, ...]] [other stuff] - description
-
-For more details and some regression tests, please see
-test/automated/man-tests.el in the emacs repository."
+foo(sec)[, bar(sec) [, ...]] [other stuff] - description"
   (goto-char (point-min))
   ;; See man-tests for data about which systems use which format (hopefully we
   ;; will be able to simplify the code if/when some of those formats aren't
diff --git a/lisp/net/shr.el b/lisp/net/shr.el
index 6ec647e..7472c41 100644
--- a/lisp/net/shr.el
+++ b/lisp/net/shr.el
@@ -933,17 +933,19 @@ If EXTERNAL, browse the URL using `shr-external-browser'."
        (let ((data (shr-parse-image-data)))
          (with-current-buffer buffer
            (save-excursion
-             (let ((alt (buffer-substring start end))
-                   (properties (text-properties-at start))
-                   (inhibit-read-only t))
-               (delete-region start end)
-               (goto-char start)
-               (funcall shr-put-image-function data alt flags)
-               (while properties
-                 (let ((type (pop properties))
-                       (value (pop properties)))
-                   (unless (memq type '(display image-size))
-                     (put-text-property start (point) type value))))))))))
+             (save-restriction
+               (widen)
+               (let ((alt (buffer-substring start end))
+                     (properties (text-properties-at start))
+                     (inhibit-read-only t))
+                 (delete-region start end)
+                 (goto-char start)
+                 (funcall shr-put-image-function data alt flags)
+                 (while properties
+                   (let ((type (pop properties))
+                         (value (pop properties)))
+                     (unless (memq type '(display image-size))
+                       (put-text-property start (point) type value)))))))))))
     (kill-buffer image-buffer)))
 
 (defun shr-image-from-data (data)
diff --git a/lisp/net/tramp-adb.el b/lisp/net/tramp-adb.el
index bf89ab3..240e017 100644
--- a/lisp/net/tramp-adb.el
+++ b/lisp/net/tramp-adb.el
@@ -1,4 +1,4 @@
-;;; tramp-adb.el --- Functions for calling Android Debug Bridge from Tramp
+;;; tramp-adb.el --- Functions for calling Android Debug Bridge from Tramp  
-*- lexical-binding:t -*-
 
 ;; Copyright (C) 2011-2017 Free Software Foundation, Inc.
 
@@ -94,9 +94,6 @@ It is used for TCP/IP devices."
     tramp-adb-method '((tramp-adb-parse-device-names ""))))
 
 ;;;###tramp-autoload
-(add-to-list 'tramp-foreign-file-name-handler-alist
-            (cons 'tramp-adb-file-name-p 'tramp-adb-file-name-handler))
-
 (defconst tramp-adb-file-name-handler-alist
   '((access-file . ignore)
     (add-name-to-file . tramp-adb-handle-copy-file)
@@ -190,6 +187,10 @@ pass to the OPERATION."
       (tramp-run-real-handler operation args))))
 
 ;;;###tramp-autoload
+(tramp-register-foreign-file-name-handler
+ 'tramp-adb-file-name-p 'tramp-adb-file-name-handler)
+
+;;;###tramp-autoload
 (defun tramp-adb-parse-device-names (_ignore)
   "Return a list of (nil host) tuples allowed to access."
   (with-timeout (10)
@@ -209,7 +210,7 @@ pass to the OPERATION."
        (tramp-message v 6 "\n%s" (buffer-string))
        (goto-char (point-min))
        (while (search-forward-regexp "^\\(\\S-+\\)[[:space:]]+device$" nil t)
-         (add-to-list 'result (list nil (match-string 1))))
+         (push (list nil (match-string 1)) result))
 
        ;; Replace ":" by "#".
        (mapc
@@ -1060,8 +1061,7 @@ E.g. a host name \"192.168.1.1#5555\" returns 
\"192.168.1.1:5555\"
   ;; unwanted entries first.
   (tramp-flush-connection-property nil)
   (with-tramp-connection-property (tramp-get-connection-process vec) "device"
-    (let* ((method (tramp-file-name-method vec))
-          (host (tramp-file-name-host vec))
+    (let* ((host (tramp-file-name-host vec))
           (port (tramp-file-name-port vec))
           (devices (mapcar 'cadr (tramp-adb-parse-device-names nil))))
       (replace-regexp-in-string
diff --git a/lisp/net/tramp-cache.el b/lisp/net/tramp-cache.el
index ce7df02..64268cf 100644
--- a/lisp/net/tramp-cache.el
+++ b/lisp/net/tramp-cache.el
@@ -1,4 +1,4 @@
-;;; tramp-cache.el --- file information caching for Tramp
+;;; tramp-cache.el --- file information caching for Tramp  -*- 
lexical-binding:t -*-
 
 ;; Copyright (C) 2000, 2005-2017 Free Software Foundation, Inc.
 
diff --git a/lisp/net/tramp-cmds.el b/lisp/net/tramp-cmds.el
index 576f9b1..c41b5b5 100644
--- a/lisp/net/tramp-cmds.el
+++ b/lisp/net/tramp-cmds.el
@@ -1,4 +1,4 @@
-;;; tramp-cmds.el --- Interactive commands for Tramp
+;;; tramp-cmds.el --- Interactive commands for Tramp  -*- lexical-binding:t -*-
 
 ;; Copyright (C) 2007-2017 Free Software Foundation, Inc.
 
diff --git a/lisp/net/tramp-compat.el b/lisp/net/tramp-compat.el
index 8e5b3e4..8f346eb 100644
--- a/lisp/net/tramp-compat.el
+++ b/lisp/net/tramp-compat.el
@@ -1,4 +1,4 @@
-;;; tramp-compat.el --- Tramp compatibility functions
+;;; tramp-compat.el --- Tramp compatibility functions  -*- lexical-binding:t 
-*-
 
 ;; Copyright (C) 2007-2017 Free Software Foundation, Inc.
 
diff --git a/lisp/net/tramp-ftp.el b/lisp/net/tramp-ftp.el
index 85e4f2b..231383f 100644
--- a/lisp/net/tramp-ftp.el
+++ b/lisp/net/tramp-ftp.el
@@ -1,4 +1,4 @@
-;;; tramp-ftp.el --- Tramp convenience functions for Ange-FTP
+;;; tramp-ftp.el --- Tramp convenience functions for Ange-FTP  -*- 
lexical-binding:t -*-
 
 ;; Copyright (C) 2002-2017 Free Software Foundation, Inc.
 
diff --git a/lisp/net/tramp-gvfs.el b/lisp/net/tramp-gvfs.el
index 7725d40..59d8771 100644
--- a/lisp/net/tramp-gvfs.el
+++ b/lisp/net/tramp-gvfs.el
@@ -1,4 +1,4 @@
-;;; tramp-gvfs.el --- Tramp access functions for GVFS daemon
+;;; tramp-gvfs.el --- Tramp access functions for GVFS daemon  -*- 
lexical-binding:t -*-
 
 ;; Copyright (C) 2009-2017 Free Software Foundation, Inc.
 
@@ -452,6 +452,7 @@ Every entry is a list (NAME ADDRESS).")
 
 
 ;; New handlers should be added here.
+;;;###tramp-autoload
 (defconst tramp-gvfs-file-name-handler-alist
   '((access-file . ignore)
     (add-name-to-file . tramp-gvfs-handle-copy-file)
@@ -548,12 +549,10 @@ pass to the OPERATION."
        (save-match-data (apply (cdr fn) args))
       (tramp-run-real-handler operation args))))
 
-;; This might be moved to tramp.el.  It shall be the first file name
-;; handler.
 ;;;###tramp-autoload
 (when (featurep 'dbusbind)
-  (add-to-list 'tramp-foreign-file-name-handler-alist
-              (cons 'tramp-gvfs-file-name-p 'tramp-gvfs-file-name-handler)))
+  (tramp-register-foreign-file-name-handler
+   'tramp-gvfs-file-name-p 'tramp-gvfs-file-name-handler))
 
 
 ;; D-Bus helper function.
@@ -1874,12 +1873,9 @@ This uses \"avahi-browse\" in case D-Bus is not enabled 
in Avahi."
       (lambda (x)
        (let* ((list (split-string x ";"))
               (host (nth 6 list))
-              (port (nth 8 list))
               (text (tramp-compat-funcall
                      'split-string (nth 9 list) "\" \"" 'omit "\""))
               user)
-;        (when (and port (not (string-equal port "0")))
-;          (setq host (format "%s%s%s" host tramp-prefix-port-regexp port)))
          ;; A user is marked in a TXT field like "u=guest".
          (while text
            (when (string-match "u=\\(.+\\)$" (car text))
diff --git a/lisp/net/tramp-sh.el b/lisp/net/tramp-sh.el
index af27d3e..e4a48b7 100644
--- a/lisp/net/tramp-sh.el
+++ b/lisp/net/tramp-sh.el
@@ -1,4 +1,4 @@
-;;; tramp-sh.el --- Tramp access functions for (s)sh-like connections
+;;; tramp-sh.el --- Tramp access functions for (s)sh-like connections  -*- 
lexical-binding:t -*-
 
 ;; Copyright (C) 1998-2017 Free Software Foundation, Inc.
 
@@ -33,6 +33,9 @@
 (eval-when-compile
   (require 'cl)
   (require 'dired))
+
+(declare-function dired-remove-file "dired-aux")
+(defvar dired-compress-file-suffixes)
 (defvar vc-handled-backends)
 (defvar vc-bzr-program)
 (defvar vc-git-program)
@@ -978,6 +981,7 @@ here-document, otherwise the command could exceed maximum 
length
 of command line.")
 
 ;; New handlers should be added here.
+;;;###tramp-autoload
 (defconst tramp-sh-file-name-handler-alist
   '(;; `access-file' performed by default handler.
     (add-name-to-file . tramp-sh-handle-add-name-to-file)
@@ -1051,11 +1055,6 @@ of command line.")
   "Alist of handler functions.
 Operations not mentioned here will be handled by the normal Emacs functions.")
 
-;; This must be the last entry, because `identity' always matches.
-;;;###tramp-autoload
-(add-to-list 'tramp-foreign-file-name-handler-alist
-            '(identity . tramp-sh-file-name-handler) 'append)
-
 ;;; File Name Handler Functions:
 
 (defun tramp-sh-handle-make-symbolic-link
@@ -2593,9 +2592,6 @@ The method used must be an out-of-band method."
 
 ;; Dired.
 
-(defvar dired-compress-file-suffixes)
-(declare-function dired-remove-file "dired-aux")
-
 (defun tramp-sh-handle-dired-compress-file (file)
   "Like `dired-compress-file' for Tramp files."
   ;; Code stolen mainly from dired-aux.el.
@@ -3536,6 +3532,11 @@ Fall back to normal file name handler if no Tramp 
handler exists."
                (tramp-run-real-handler operation args)))))
       (setq tramp-locked tl))))
 
+;; This must be the last entry, because `identity' always matches.
+;;;###tramp-autoload
+(tramp-register-foreign-file-name-handler
+ 'identity 'tramp-sh-file-name-handler 'append)
+
 (defun tramp-vc-file-name-handler (operation &rest args)
   "Invoke special file name handler, which collects files to be handled."
   (save-match-data
@@ -5221,7 +5222,7 @@ Nonexistent directories are removed from spec."
   "Determine remote locale, supporting UTF8 if possible."
   (with-tramp-connection-property vec "locale"
     (tramp-send-command vec "locale -a")
-    (let ((candidates '("en_US.utf8" "C.utf8" "en_US.UTF-8"))
+    (let ((candidates '("en_US.utf8" "C.utf8" "en_US.UTF-8" "C.UTF-8"))
          locale)
       (with-current-buffer (tramp-get-connection-buffer vec)
        (while candidates
diff --git a/lisp/net/tramp-smb.el b/lisp/net/tramp-smb.el
index 91f6956..4205376 100644
--- a/lisp/net/tramp-smb.el
+++ b/lisp/net/tramp-smb.el
@@ -1,4 +1,4 @@
-;;; tramp-smb.el --- Tramp access functions for SMB servers
+;;; tramp-smb.el --- Tramp access functions for SMB servers  -*- 
lexical-binding:t -*-
 
 ;; Copyright (C) 2002-2017 Free Software Foundation, Inc.
 
@@ -157,6 +157,7 @@ call, letting the SMB client use the default one."
         "NT_STATUS_OBJECT_NAME_COLLISION"
         "NT_STATUS_OBJECT_NAME_INVALID"
         "NT_STATUS_OBJECT_NAME_NOT_FOUND"
+        "NT_STATUS_PASSWORD_MUST_CHANGE"
         "NT_STATUS_SHARING_VIOLATION"
         "NT_STATUS_TRUSTED_RELATIONSHIP_FAILURE"
         "NT_STATUS_UNSUCCESSFUL"
@@ -217,6 +218,7 @@ This list is used for smbcacls actions.
 See `tramp-actions-before-shell' for more info.")
 
 ;; New handlers should be added here.
+;;;###tramp-autoload
 (defconst tramp-smb-file-name-handler-alist
   '(;; `access-file' performed by default handler.
     (add-name-to-file . tramp-smb-handle-add-name-to-file)
@@ -340,9 +342,8 @@ pass to the OPERATION."
 
 ;;;###tramp-autoload
 (unless (memq system-type '(cygwin windows-nt))
-  (add-to-list 'tramp-foreign-file-name-handler-alist
-              (cons 'tramp-smb-file-name-p 'tramp-smb-file-name-handler)))
-
+  (tramp-register-foreign-file-name-handler
+   'tramp-smb-file-name-p 'tramp-smb-file-name-handler))
 
 ;; File name primitives.
 
diff --git a/lisp/net/tramp-uu.el b/lisp/net/tramp-uu.el
index 0aa2cc0..5e5f05d 100644
--- a/lisp/net/tramp-uu.el
+++ b/lisp/net/tramp-uu.el
@@ -1,4 +1,4 @@
-;;; tramp-uu.el --- uuencode in Lisp
+;;; tramp-uu.el --- uuencode in Lisp  -*- lexical-binding:t -*-
 
 ;; Copyright (C) 2002-2017 Free Software Foundation, Inc.
 
diff --git a/lisp/net/tramp.el b/lisp/net/tramp.el
index fdd4661..0ca5a6d 100644
--- a/lisp/net/tramp.el
+++ b/lisp/net/tramp.el
@@ -1,4 +1,4 @@
-;;; tramp.el --- Transparent Remote Access, Multiple Protocol
+;;; tramp.el --- Transparent Remote Access, Multiple Protocol  -*- 
lexical-binding:t -*-
 
 ;; Copyright (C) 1998-2017 Free Software Foundation, Inc.
 
@@ -60,7 +60,10 @@
 ;; Pacify byte-compiler.
 (eval-when-compile
   (require 'cl))
+(defvar auto-save-file-name-transforms)
 (defvar eshell-path-env)
+(defvar ls-lisp-use-insert-directory-program)
+(defvar outline-regexp)
 
 ;;; User Customizable Internal Variables:
 
@@ -1052,8 +1055,7 @@ means to use always cached values for the directory 
contents."
 
 ;;;###autoload
 (defconst tramp-completion-file-name-handler-alist
-  '(;(expand-file-name . tramp-completion-handle-expand-file-name)
-    (file-name-all-completions
+  '((file-name-all-completions
      . tramp-completion-handle-file-name-all-completions)
     (file-name-completion . tramp-completion-handle-file-name-completion))
   "Alist of completion handler functions.
@@ -1374,8 +1376,6 @@ Point must be at the beginning of a header line.
 The outline level is equal to the verbosity of the Tramp message."
   (1+ (string-to-number (match-string 1))))
 
-(defvar outline-regexp)
-
 (defun tramp-get-debug-buffer (vec)
   "Get the debug buffer for VEC."
   (with-current-buffer
@@ -1871,13 +1871,12 @@ temporary file names.  If `file-coding-system-alist' 
contains an
 expression, which matches more than the file name suffix, the
 coding system might not be determined.  This function repairs it."
   (let (result)
-    (dolist (elt file-coding-system-alist result)
+    (dolist (elt file-coding-system-alist (nreverse result))
       (when (and (consp elt) (string-match (car elt) filename))
        ;; We found a matching entry in `file-coding-system-alist'.
        ;; So we add a similar entry, but with the temporary file name
        ;; as regexp.
-       (add-to-list
-        'result (cons (regexp-quote tmpname) (cdr elt)) 'append)))))
+       (push (cons (regexp-quote tmpname) (cdr elt)) result)))))
 
 ;;;###autoload
 (progn (defun tramp-run-real-handler (operation args)
@@ -1995,6 +1994,7 @@ ARGS are the arguments OPERATION has been called with."
      (tramp-compat-condition-case-unless-debug ,var ,bodyform ,@handlers)))
 
 ;; Main function.
+;;;###autoload
 (defun tramp-file-name-handler (operation &rest args)
   "Invoke Tramp file name handler.
 Falls back to normal file name handler if no Tramp file name handler exists."
@@ -2113,20 +2113,7 @@ preventing reentrant calls of Tramp.")
 Together with `tramp-locked', this implements a locking mechanism
 preventing reentrant calls of Tramp.")
 
-;; Avoid recursive loading of tramp.el.
-;; FIXME: This must go better.  Checking for `operation' is wrong.
-;;;###autoload(defun tramp-completion-file-name-handler (operation &rest args)
-;;;###autoload  (let ((fn
-;;;###autoload         (assoc
-;;;###autoload          operation tramp-completion-file-name-handler-alist)))
-;;;###autoload    (if (and
-;;;###autoload         tramp-mode fn (null load-in-progress)
-;;;###autoload         (member
-;;;###autoload          operation
-;;;###autoload          '(file-name-all-completions file-name-completion)))
-;;;###autoload        (apply 'tramp-autoload-file-name-handler operation args)
-;;;###autoload      (tramp-run-real-handler operation args))))
-
+;;;###autoload
 (defun tramp-completion-file-name-handler (operation &rest args)
   "Invoke Tramp file name completion handler.
 Falls back to normal file name handler if no Tramp file name handler exists."
@@ -2135,36 +2122,26 @@ Falls back to normal file name handler if no Tramp file 
name handler exists."
        (save-match-data (apply (cdr fn) args))
       (tramp-run-real-handler operation args))))
 
-;;;###autoload
-(progn (defun tramp-autoload-file-name-handler (operation &rest args)
-  "Load Tramp file name handler, and perform OPERATION."
-  (if (and
-       ;; Do not load tramp.el just for "/".
-       (not (and (stringp (car args)) (string-equal (car args) "/")))
-       ;; Avoid recursive loading of tramp.el.
-       (let ((default-directory temporary-file-directory))
-        (and (null load-in-progress) (load "tramp" 'noerror 'nomessage))))
-      (apply operation args)
-    ;; tramp.el not needed or not available for loading, fall back.
-    (tramp-run-real-handler operation args))))
-
-;; `tramp-autoload-file-name-handler' must be registered before
-;; evaluation of site-start and init files, because there might exist
-;; remote files already, f.e. files kept via recentf-mode.  We cannot
-;; autoload `tramp-file-name-handler', because it would result in
-;; recursive loading of tramp.el when `default-directory' is set to
-;; remote.
+;; `tramp-file-name-handler' must be registered before evaluation of
+;; site-start and init files, because there might exist remote files
+;; already, f.e. files kept via recentf-mode.
 ;;;###autoload
 (progn (defun tramp-register-autoload-file-name-handlers ()
   "Add Tramp file name handlers to `file-name-handler-alist' during autoload."
   (add-to-list 'file-name-handler-alist
-              (cons tramp-file-name-regexp
-                    'tramp-autoload-file-name-handler))
-  (put 'tramp-autoload-file-name-handler 'safe-magic t)
+              (cons tramp-file-name-regexp 'tramp-file-name-handler))
+  (put 'tramp-file-name-handler 'safe-magic t)
+  ;; Mark `operations' the handler is responsible for.  It's a short list ...
+  (put 'tramp-file-name-handler 'operations
+       '(file-name-all-completions file-name-completion file-remote-p))
+
   (add-to-list 'file-name-handler-alist
               (cons tramp-completion-file-name-regexp
                     'tramp-completion-file-name-handler))
-  (put 'tramp-completion-file-name-handler 'safe-magic t)))
+  (put 'tramp-completion-file-name-handler 'safe-magic t)
+  ;; Mark `operations' the handler is responsible for.
+  (put 'tramp-completion-file-name-handler 'operations
+       (mapcar 'car tramp-completion-file-name-handler-alist))))
 
 ;;;###autoload
 (tramp-register-autoload-file-name-handlers)
@@ -2174,22 +2151,29 @@ Falls back to normal file name handler if no Tramp file 
name handler exists."
   ;; Remove autoloaded handlers from file name handler alist.  Useful,
   ;; if `tramp-syntax' has been changed.
   (dolist (fnh '(tramp-file-name-handler
-                tramp-completion-file-name-handler
-                tramp-autoload-file-name-handler))
+                tramp-completion-file-name-handler))
     (let ((a1 (rassq fnh file-name-handler-alist)))
       (setq file-name-handler-alist (delq a1 file-name-handler-alist))))
+
   ;; The initial value of `tramp-file-name-regexp' is too simple
   ;; minded, but we cannot give it the real value in the autoload
   ;; pattern.  See Bug#24889.
   (setq tramp-file-name-regexp (car tramp-file-name-structure))
-  ;; Add the handlers.
+  ;; Add the handlers.  We do not add anything to the `operations'
+  ;; property of `tramp-file-name-handler', this shall be done by the
+  ;; respective foreign handlers.
   (add-to-list 'file-name-handler-alist
               (cons tramp-file-name-regexp 'tramp-file-name-handler))
   (put 'tramp-file-name-handler 'safe-magic t)
+
   (add-to-list 'file-name-handler-alist
               (cons tramp-completion-file-name-regexp
                     'tramp-completion-file-name-handler))
   (put 'tramp-completion-file-name-handler 'safe-magic t)
+  ;; Mark `operations' the handler is responsible for.
+  (put 'tramp-completion-file-name-handler 'operations
+       (mapcar 'car tramp-completion-file-name-handler-alist))
+
   ;; If jka-compr or epa-file are already loaded, move them to the
   ;; front of `file-name-handler-alist'.
   (dolist (fnh '(epa-file-handler jka-compr-handler))
@@ -2200,6 +2184,24 @@ Falls back to normal file name handler if no Tramp file 
name handler exists."
 
 (eval-after-load 'tramp (tramp-register-file-name-handlers))
 
+;;;###tramp-autoload
+(progn (defun tramp-register-foreign-file-name-handler
+    (func handler &optional append)
+  "Register (FUNC . HANDLER) in `tramp-foreign-file-name-handler-alist'.
+FUNC is the function, which determines whether HANDLER is to be called.
+Add operations defined in `HANDLER-alist' to `tramp-file-name-handler'."
+  (add-to-list
+   'tramp-foreign-file-name-handler-alist `(,func . ,handler) append)
+  ;; Mark `operations' the handler is responsible for.
+  (put 'tramp-file-name-handler
+       'operations
+       (cl-delete-duplicates
+        (append
+         (get 'tramp-file-name-handler 'operations)
+         (mapcar
+          'car
+          (symbol-value (intern (concat (symbol-name handler) "-alist")))))))))
+
 (defun tramp-exists-file-name-handler (operation &rest args)
   "Check, whether OPERATION runs a file name handler."
   ;; The file name handler is determined on base of either an
@@ -2258,15 +2260,6 @@ not in completion mode."
              (tramp-get-connection-process
               (tramp-dissect-file-name filename)))))))
 
-(defun tramp-completion-handle-expand-file-name (name &optional dir)
-  "Like `expand-file-name' for Tramp files."
-  ;; If DIR is not given, use `default-directory' or "/".
-  (setq dir (or dir default-directory "/"))
-  (cond
-   ((file-name-absolute-p name) name)
-   ((zerop (length name)) dir)
-   (t (concat (file-name-as-directory dir) name))))
-
 ;; Method, host name and user name completion.
 ;; `tramp-completion-dissect-file-name' returns a list of
 ;; tramp-file-name structures. For all of them we return possible completions.
@@ -2328,9 +2321,9 @@ not in completion mode."
       (when elt
        (string-match tramp-prefix-regexp elt)
        (setq elt (replace-match (concat tramp-prefix-format hop) nil nil elt))
-       (add-to-list
-        'result1
-        (substring elt (length (tramp-drop-volume-letter directory))))))
+       (push
+        (substring elt (length (tramp-drop-volume-letter directory)))
+        result1)))
 
     ;; Complete local parts.
     (append
@@ -2955,8 +2948,6 @@ User is always nil."
             backup-directory-alist)))
       (tramp-run-real-handler 'find-backup-file-name (list filename)))))
 
-(defvar ls-lisp-use-insert-directory-program)
-
 (defun tramp-handle-insert-directory
   (filename switches &optional wildcard full-directory-p)
   "Like `insert-directory' for Tramp files."
diff --git a/lisp/net/trampver.el b/lisp/net/trampver.el
index 35ad2f0..35b5eb6 100644
--- a/lisp/net/trampver.el
+++ b/lisp/net/trampver.el
@@ -1,4 +1,4 @@
-;;; trampver.el --- Transparent Remote Access, Multiple Protocol
+;;; trampver.el --- Transparent Remote Access, Multiple Protocol  -*- 
lexical-binding:t -*-
 ;;; lisp/trampver.el.  Generated from trampver.el.in by configure.
 
 ;; Copyright (C) 2003-2017 Free Software Foundation, Inc.
diff --git a/lisp/play/dunnet.el b/lisp/play/dunnet.el
index 6779462..8f013bb 100644
--- a/lisp/play/dunnet.el
+++ b/lisp/play/dunnet.el
@@ -2106,28 +2106,23 @@ for a moment, then straighten yourself up.\n")
        (dun-mprincl "That answer is incorrect.")))))
 
 (defun dun-endgame-question ()
-(if (not dun-endgame-questions)
-    (progn
-      (dun-mprincl "Your question is:")
-      (dun-mprincl "No more questions, just do ‘answer foo’.")
-      (setq dun-correct-answer '("foo")))
-  (let (which i newques)
-    (setq i 0)
-    (setq newques nil)
-    (setq which (random (length dun-endgame-questions)))
-    (dun-mprincl "Your question is:")
-    (dun-mprincl (setq dun-endgame-question (car
-                                            (nth which
-                                                 dun-endgame-questions))))
-    (setq dun-correct-answer (cdr (nth which dun-endgame-questions)))
-    (while (< i which)
-      (setq newques (append newques (list (nth i dun-endgame-questions))))
-      (setq i (1+ i)))
-    (setq i (1+ which))
-    (while (< i (length dun-endgame-questions))
-      (setq newques (append newques (list (nth i dun-endgame-questions))))
-      (setq i (1+ i)))
-    (setq dun-endgame-questions newques))))
+  (let ((questions dun-endgame-questions))
+    (if (null questions)
+        (progn
+          (dun-mprincl "Your question is:")
+          (dun-mprincl "No more questions, just do ‘answer foo’.")
+          (setq dun-correct-answer '("foo")))
+      (let* ((which (random (length questions)))
+             (question (nth which questions)))
+        (dun-mprincl "Your question is:")
+        (dun-mprincl (setq dun-endgame-question (car question)))
+        (setq dun-correct-answer (cdr question))
+        (let ((i 0) res)
+          (dolist (q questions)
+            (when (/= i which)
+              (push q res))
+            (setq i (1+ i)))
+          (setq dun-endgame-questions (nreverse res)))))))
 
 (defun dun-power (_args)
   (if (not (= dun-current-room pc-area))
diff --git a/lisp/progmodes/cc-defs.el b/lisp/progmodes/cc-defs.el
index 3fdd561..8dd5610 100644
--- a/lisp/progmodes/cc-defs.el
+++ b/lisp/progmodes/cc-defs.el
@@ -94,7 +94,7 @@
 
 ;;; Variables also used at compile time.
 
-(defconst c-version "5.32.99"
+(defconst c-version "5.33"
   "CC Mode version number.")
 
 (defconst c-version-sym (intern c-version))
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index bdc77dc..de15d1d 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -6243,9 +6243,9 @@ comment at the start of cc-engine.el for more info."
                    (eq (char-before) ?<))
        (c-backward-token-2)
        (when (eq (char-after) ?<)
-         (c-clear-<-pair-props-if-match-after beg)))
+         (c-clear-<-pair-props-if-match-after beg)
+         (setq new-beg (point))))
       (c-forward-syntactic-ws)
-      (setq new-beg (point))
 
       ;; ...Then the ones with < before end and > after end.
       (goto-char (if end-lit-limits (cdr end-lit-limits) end))
@@ -6254,9 +6254,9 @@ comment at the start of cc-engine.el for more info."
                  (eq (char-before) ?>))
        (c-end-of-current-token)
        (when (eq (char-before) ?>)
-         (c-clear->-pair-props-if-match-before end (1- (point)))))
+         (c-clear->-pair-props-if-match-before end (1- (point)))
+         (setq new-end (point))))
       (c-backward-syntactic-ws)
-      (setq new-end (point))
 
       ;; Extend the fontification region, if needed.
       (and new-beg
@@ -8863,7 +8863,29 @@ comment at the start of cc-engine.el for more info."
                 ;; it as a declaration if "a" has been used as a type
                 ;; somewhere else (if it's a known type we won't get here).
                 (setq maybe-expression t)
-                (throw 'at-decl-or-cast t)))
+                (throw 'at-decl-or-cast t))
+
+              ;; CASE 17.5
+              (when (and c-asymmetry-fontification-flag
+                         got-prefix-before-parens
+                         at-type
+                         (or (not got-suffix)
+                             at-decl-start))
+                (let ((space-before-id
+                       (save-excursion
+                         (goto-char name-start)
+                         (or (bolp) (memq (char-before) '(?\  ?\t)))))
+                      (space-after-type
+                       (save-excursion
+                         (goto-char type-start)
+                         (and (c-forward-type)
+                              (progn (c-backward-syntactic-ws) t)
+                              (or (eolp)
+                                  (memq (char-after) '(?\  ?\t)))))))
+                  (when (not (eq (not space-before-id)
+                                 (not space-after-type)))
+                    (setq maybe-expression t)
+                    (throw 'at-decl-or-cast t)))))
 
           ;; CASE 18
           (when (and (not (memq context '(nil top)))
diff --git a/lisp/progmodes/cc-fonts.el b/lisp/progmodes/cc-fonts.el
index f623b9f..923f077 100644
--- a/lisp/progmodes/cc-fonts.el
+++ b/lisp/progmodes/cc-fonts.el
@@ -1117,6 +1117,124 @@ casts and declarations are fontified.  Used on level 2 
and higher."
          (setq pos (point))))))     ; acts to make the `while' form continue.
   nil)
 
+(defun c-get-fontification-context (match-pos not-front-decl &optional toplev)
+  ;; Return a cons (CONTEXT . RESTRICTED-<>-ARGLISTS) for MATCH-POS.
+  ;; NOT-FRONT-DECL is non-nil when a declaration later in the buffer than
+  ;; MATCH-POS has already been parsed.  TOPLEV is non-nil when MATCH-POS is
+  ;; known to be at "top level", i.e. outside any braces, or directly inside a
+  ;; namespace, class, etc.
+  ;;
+  ;; CONTEXT is the fontification context of MATCH-POS, and is one of the
+  ;; following:
+  ;; 'decl     In a comma-separated declaration context (typically
+  ;;           inside a function declaration arglist).
+  ;; '<>       In an angle bracket arglist.
+  ;; 'arglist  Some other type of arglist.
+  ;; 'top      Some other context and point is at the top-level (either
+  ;;           outside any braces or directly inside a class or namespace,
+  ;;           etc.)
+  ;; nil       Some other context or unknown context.  Includes
+  ;;           within the parens of an if, for, ... construct.
+  ;; 'not-decl Definitely not in a declaration.
+  ;;
+  ;; RESTRICTED-<>-ARGLISTS is non-nil when a scan of template/generic
+  ;; arguments lists (i.e. lists enclosed by <...>) is more strict about what
+  ;; characters it allows within the list.
+  (let ((type (and (> match-pos (point-min))
+                  (c-get-char-property (1- match-pos) 'c-type))))
+    (cond ((not (memq (char-before match-pos) '(?\( ?, ?\[ ?< ?{)))
+          (cons (and toplev 'top) nil))
+         ;; A control flow expression or a decltype
+         ((and (eq (char-before match-pos) ?\()
+               (save-excursion
+                 (goto-char match-pos)
+                 (backward-char)
+                 (c-backward-token-2)
+                 (or (looking-at c-block-stmt-2-key)
+                     (looking-at c-block-stmt-1-2-key)
+                     (looking-at c-typeof-key))))
+          (cons nil t))
+         ;; Near BOB.
+         ((<= match-pos (point-min))
+          (cons 'arglist t))
+         ;; Got a cached hit in a declaration arglist.
+         ((eq type 'c-decl-arg-start)
+          (cons 'decl nil))
+         ;; We're inside (probably) a brace list.
+         ((eq type 'c-not-decl)
+          (cons 'not-decl nil))
+         ;; Inside a C++11 lambda function arglist.
+         ((and (c-major-mode-is 'c++-mode)
+               (eq (char-before match-pos) ?\()
+               (save-excursion
+                 (goto-char match-pos)
+                 (c-backward-token-2)
+                 (and
+                  (c-safe (goto-char (scan-sexps (point) -1)))
+                  (c-looking-at-c++-lambda-capture-list))))
+          (c-put-char-property (1- match-pos) 'c-type
+                               'c-decl-arg-start)
+          (cons 'decl nil))
+         ;; We're inside a brace list.
+         ((and (eq (char-before match-pos) ?{)
+               (save-excursion
+                 (goto-char (1- match-pos))
+                 (consp
+                  (c-looking-at-or-maybe-in-bracelist))))
+          (c-put-char-property (1- match-pos) 'c-type
+                               'c-not-decl)
+          (cons 'not-decl nil))
+         ;; We're inside an "ordinary" open brace.
+         ((eq (char-before match-pos) ?{)
+          (cons (and toplev 'top) nil))
+         ;; Inside an angle bracket arglist.
+         ((or (eq type 'c-<>-arg-sep)
+              (eq (char-before match-pos) ?<))
+          (cons '<> nil))
+         ;; Got a cached hit in some other type of arglist.
+         (type
+          (cons 'arglist t))
+         (not-front-decl
+          ;; The point is within the range of a previously
+          ;; encountered type decl expression, so the arglist
+          ;; is probably one that contains declarations.
+          ;; However, if `c-recognize-paren-inits' is set it
+          ;; might also be an initializer arglist.
+          ;;
+          ;; The result of this check is cached with a char
+          ;; property on the match token, so that we can look
+          ;; it up again when refontifying single lines in a
+          ;; multiline declaration.
+          (c-put-char-property (1- match-pos)
+                               'c-type 'c-decl-arg-start)
+          (cons 'decl nil))
+         ;; Got an open paren preceded by an arith operator.
+         ((and (eq (char-before match-pos) ?\()
+               (save-excursion
+                 (and (zerop (c-backward-token-2 2))
+                      (looking-at c-arithmetic-op-regexp))))
+          (cons nil nil))
+         ;; At start of a declaration inside a declaration paren.
+         ((save-excursion
+            (and (memq (char-before match-pos) '(?\( ?\,))
+                 (c-go-up-list-backward match-pos)
+                 (eq (char-after) ?\()
+                 (let ((type (c-get-char-property (point) 'c-type)))
+                   (or (memq type '(c-decl-arg-start c-decl-type-start))
+                       (and
+                        (progn (c-backward-syntactic-ws) t)
+                        (c-back-over-compound-identifier)
+                        (progn
+                          (c-backward-syntactic-ws)
+                          (or (bobp)
+                              (progn
+                                (setq type (c-get-char-property (1- (point))
+                                                                'c-type))
+                                (memq type '(c-decl-arg-start
+                                             c-decl-type-start))))))))))
+          (cons 'decl nil))
+         (t (cons 'arglist t)))))
+
 (defun c-font-lock-declarations (limit)
   ;; Fontify all the declarations, casts and labels from the point to LIMIT.
   ;; Assumes that strings and comments have been fontified already.
@@ -1231,95 +1349,15 @@ casts and declarations are fontified.  Used on level 2 
and higher."
            ;; "<" for the sake of C++-style template arglists.
            ;; Ignore "(" when it's part of a control flow construct
            ;; (e.g. "for (").
-           (let ((type (and (> match-pos (point-min))
-                            (c-get-char-property (1- match-pos) 'c-type))))
-             (cond ((not (memq (char-before match-pos) '(?\( ?, ?\[ ?< ?{)))
-                    (setq context (and toplev 'top)
-                          c-restricted-<>-arglists nil))
-                   ;; A control flow expression or a decltype
-                   ((and (eq (char-before match-pos) ?\()
-                         (save-excursion
-                           (goto-char match-pos)
-                           (backward-char)
-                           (c-backward-token-2)
-                           (or (looking-at c-block-stmt-2-key)
-                               (looking-at c-block-stmt-1-2-key)
-                               (looking-at c-typeof-key))))
-                    (setq context nil
-                          c-restricted-<>-arglists t))
-                   ;; Near BOB.
-                   ((<= match-pos (point-min))
-                    (setq context 'arglist
-                          c-restricted-<>-arglists t))
-                   ;; Got a cached hit in a declaration arglist.
-                   ((eq type 'c-decl-arg-start)
-                    (setq context 'decl
-                          c-restricted-<>-arglists nil))
-                   ;; We're inside (probably) a brace list.
-                   ((eq type 'c-not-decl)
-                    (setq context 'not-decl
-                          c-restricted-<>-arglists nil))
-                   ;; Inside a C++11 lambda function arglist.
-                   ((and (c-major-mode-is 'c++-mode)
-                         (eq (char-before match-pos) ?\()
-                         (save-excursion
-                           (goto-char match-pos)
-                           (c-backward-token-2)
-                           (and
-                            (c-safe (goto-char (scan-sexps (point) -1)))
-                            (c-looking-at-c++-lambda-capture-list))))
-                    (setq context 'decl
-                          c-restricted-<>-arglists nil)
-                    (c-put-char-property (1- match-pos) 'c-type
-                                         'c-decl-arg-start))
-                   ;; We're inside a brace list.
-                   ((and (eq (char-before match-pos) ?{)
-                         (save-excursion
-                           (goto-char (1- match-pos))
-                           (consp
-                            (c-looking-at-or-maybe-in-bracelist))))
-                    (setq context 'not-decl
-                          c-restricted-<>-arglists nil)
-                    (c-put-char-property (1- match-pos) 'c-type
-                                         'c-not-decl))
-                   ;; We're inside an "ordinary" open brace.
-                   ((eq (char-before match-pos) ?{)
-                    (setq context (and toplev 'top)
-                          c-restricted-<>-arglists nil))
-                   ;; Inside an angle bracket arglist.
-                   ((or (eq type 'c-<>-arg-sep)
-                        (eq (char-before match-pos) ?<))
-                    (setq context '<>
-                          c-restricted-<>-arglists nil))
-                   ;; Got a cached hit in some other type of arglist.
-                   (type
-                    (setq context 'arglist
-                          c-restricted-<>-arglists t))
-                   ((if inside-macro
-                        (< match-pos max-type-decl-end-before-token)
-                      (< match-pos max-type-decl-end))
-                    ;; The point is within the range of a previously
-                    ;; encountered type decl expression, so the arglist
-                    ;; is probably one that contains declarations.
-                    ;; However, if `c-recognize-paren-inits' is set it
-                    ;; might also be an initializer arglist.
-                    (setq context 'decl
-                          c-restricted-<>-arglists nil)
-                    ;; The result of this check is cached with a char
-                    ;; property on the match token, so that we can look
-                    ;; it up again when refontifying single lines in a
-                    ;; multiline declaration.
-                    (c-put-char-property (1- match-pos)
-                                         'c-type 'c-decl-arg-start))
-                   ;; Got an open paren preceded by an arith operator.
-                   ((and (eq (char-before match-pos) ?\()
-                         (save-excursion
-                           (and (zerop (c-backward-token-2 2))
-                                (looking-at c-arithmetic-op-regexp))))
-                    (setq context nil
-                          c-restricted-<>-arglists nil))
-                   (t (setq context 'arglist
-                            c-restricted-<>-arglists t))))
+           (let ((got-context
+                  (c-get-fontification-context
+                   match-pos
+                   (< match-pos (if inside-macro
+                                    max-type-decl-end-before-token
+                                  max-type-decl-end))
+                   toplev)))
+             (setq context (car got-context)
+                   c-restricted-<>-arglists (cdr got-context)))
 
            ;; Check we haven't missed a preceding "typedef".
            (when (not (looking-at c-typedef-key))
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index 8326e6a..20c63d4 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -1363,6 +1363,7 @@ Note that the style variables are always made local to 
the buffer."
   ;; This function is called indirectly from font locking stuff - either from
   ;; c-after-change (to prepare for after-change font-locking) or from font
   ;; lock context (etc.) fontification.
+  (goto-char pos)
   (let ((lit-start (c-literal-start))
        (new-pos pos)
        capture-opener
diff --git a/lisp/progmodes/cc-vars.el b/lisp/progmodes/cc-vars.el
index 1114b21..ccd4fd2 100644
--- a/lisp/progmodes/cc-vars.el
+++ b/lisp/progmodes/cc-vars.el
@@ -1634,6 +1634,18 @@ names)."))
   :type 'c-extra-types-widget
   :group 'c)
 
+(defcustom c-asymmetry-fontification-flag t
+  "Whether to fontify certain ambiguous constructs by white space asymmetry.
+
+In the fontification engine, it is sometimes impossible to determine
+whether a construct is a declaration or an expression.  This happens
+particularly in C++, due to ambiguities in the language.  When such a
+construct is like \"foo * bar\" or \"foo &bar\", and this variable is non-nil
+(the default), the construct will be fontified as a declaration if there is
+white space either before or after the operator, but not both."
+  :type 'boolean
+  :group 'c)
+
 (defvar c-noise-macro-with-parens-name-re "\\<\\>")
 (defvar c-noise-macro-name-re "\\<\\>")
 
diff --git a/lisp/progmodes/js.el b/lisp/progmodes/js.el
index aed42a8..3c720c0 100644
--- a/lisp/progmodes/js.el
+++ b/lisp/progmodes/js.el
@@ -1713,7 +1713,7 @@ This performs fontification according to 
`js--class-styles'."
               (not (any ?\] ?\\))
               (and "\\" not-newline)))
          "]")))
-   (group "/"))
+   (group (zero-or-one "/")))
   "Regular expression matching a JavaScript regexp literal.")
 
 (defun js-syntax-propertize-regexp (end)
@@ -1721,12 +1721,13 @@ This performs fontification according to 
`js--class-styles'."
     (when (eq (nth 3 ppss) ?/)
       ;; A /.../ regexp.
       (goto-char (nth 8 ppss))
-      (when (and (looking-at js--syntax-propertize-regexp-regexp)
-                 ;; Don't touch text after END.
-                 (<= (match-end 1) end))
-        (put-text-property (match-beginning 1) (match-end 1)
+      (when (looking-at js--syntax-propertize-regexp-regexp)
+        ;; Don't touch text after END.
+        (when (> end (match-end 1))
+          (setq end (match-end 1)))
+        (put-text-property (match-beginning 1) end
                            'syntax-table (string-to-syntax "\"/"))
-        (goto-char (match-end 0))))))
+        (goto-char end)))))
 
 (defun js-syntax-propertize (start end)
   ;; JavaScript allows immediate regular expression objects, written /.../.
diff --git a/lisp/progmodes/perl-mode.el b/lisp/progmodes/perl-mode.el
index a516f07..b75f32e 100644
--- a/lisp/progmodes/perl-mode.el
+++ b/lisp/progmodes/perl-mode.el
@@ -255,9 +255,11 @@
       ;; format statements
       ("^[ \t]*format.*=[ \t]*\\(\n\\)"
        (1 (prog1 "\"" (perl-syntax-propertize-special-constructs end))))
-      ;; Funny things in `sub' arg-specs like `sub myfun ($)' or `sub ($)'.
-      ;; Be careful not to match "sub { (...) ... }".
-      ("\\<sub\\(?:[\s\t\n]+\\(?:\\sw\\|\\s_\\)+\\)?[\s\t\n]*(\\([^)]+\\))"
+      ;; Propertize perl prototype chars `$%&*;address@hidden' as punctuation
+      ;; in `sub' arg-specs like `sub myfun ($)' and `sub ($)'.  But
+      ;; don't match subroutine signatures like `sub add ($a, $b)', or
+      ;; anonymous subs like "sub { (...) ... }".
+      
("\\<sub\\(?:[\s\t\n]+\\(?:\\sw\\|\\s_\\)+\\)?[\s\t\n]*(\\([][$%&*;address@hidden))"
        (1 "."))
       ;; Turn __DATA__ trailer into a comment.
       ("^\\(_\\)_\\(?:DATA\\|END\\)__[ 
\t]*\\(?:\\(\n\\)#.-\\*-.*perl.*-\\*-\\|\n.*\\)"
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index 228a448..2697f1a 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -1491,10 +1491,18 @@ Optional argument NOEND is internal and makes the logic 
to not
 jump to the end of line when moving forward searching for the end
 of the statement."
   (interactive "^")
-  (let (string-start bs-pos)
+  (let (string-start bs-pos (last-string-end 0))
     (while (and (or noend (goto-char (line-end-position)))
                 (not (eobp))
                 (cond ((setq string-start (python-syntax-context 'string))
+                       ;; The assertion can only fail if syntax table
+                       ;; text properties and the `syntax-ppss' cache
+                       ;; are somehow out of whack.  This has been
+                       ;; observed when using `syntax-ppss' during
+                       ;; narrowing.
+                       (cl-assert (> string-start last-string-end)
+                                  :show-args
+                                  "Overlapping strings detected")
                        (goto-char string-start)
                        (if (python-syntax-context 'paren)
                            ;; Ended up inside a paren, roll again.
@@ -1504,8 +1512,10 @@ of the statement."
                          (goto-char (+ (point)
                                        (python-syntax-count-quotes
                                         (char-after (point)) (point))))
-                         (or (re-search-forward (rx (syntax string-delimiter)) 
nil t)
-                             (goto-char (point-max)))))
+                         (setq last-string-end
+                               (or (re-search-forward
+                                    (rx (syntax string-delimiter)) nil t)
+                                   (goto-char (point-max))))))
                       ((python-syntax-context 'paren)
                        ;; The statement won't end before we've escaped
                        ;; at least one level of parenthesis.
diff --git a/lisp/replace.el b/lisp/replace.el
index 0841ba1..a7b8ae6 100644
--- a/lisp/replace.el
+++ b/lisp/replace.el
@@ -848,7 +848,6 @@ called interactively by passing a non-nil INTERACTIVE 
argument.
 This function starts looking for the next match from the end of
 the previous match.  Hence, it ignores matches that overlap
 a previously found match."
-
   (interactive
    (progn
      (barf-if-buffer-read-only)
@@ -923,7 +922,6 @@ a non-nil INTERACTIVE argument.
 If a match is split across lines, all the lines it lies in are deleted.
 They are deleted _before_ looking for the next match.  Hence, a match
 starting on the same line at which another match ended is ignored."
-
   (interactive
    (progn
      (barf-if-buffer-read-only)
@@ -971,7 +969,6 @@ end of (the accessible portion of) the buffer.
 This function starts looking for the next match from the end of
 the previous match.  Hence, it ignores matches that overlap
 a previously found match."
-
   (interactive
    (keep-lines-read-args "How many matches for regexp"))
   (save-excursion
diff --git a/lisp/ses.el b/lisp/ses.el
index 76d4ca5..66fc0c5 100644
--- a/lisp/ses.el
+++ b/lisp/ses.el
@@ -1,4 +1,3 @@
-
 ;;; ses.el -- Simple Emacs Spreadsheet  -*- lexical-binding:t -*-
 
 ;; Copyright (C) 2002-2017 Free Software Foundation, Inc.
@@ -2273,15 +2272,19 @@ print area if NONARROW is nil."
 ;; (defvar maxrow)
 ;; (defvar maxcol)
 
-(defun ses-recalculate-cell ()
+(defun ses-recalculate-cell (&optional ses--curcell)
   "Recalculate and reprint the current cell or range.
 
+If SES--CURCELL is non nil use it as current cell or range
+without any check, otherwise function (ses-check-curcell 'range)
+is called.
+
 For an individual cell, shows the error if the formula or printer
 signals one, or otherwise shows the cell's complete value.  For a range, the
 cells are recalculated in \"natural\" order, so cells that other cells refer
 to are recalculated first."
   (interactive "*")
-  (ses-check-curcell 'range)
+  (or ses--curcell (ses-check-curcell 'range))
   (ses-begin-change)
   (ses-initialize-Dijkstra-attempt)
   (let (sig cur-rowcol)
@@ -2334,7 +2337,7 @@ to are recalculated first."
   (let ((startcell    (ses--cell-at-pos (point)))
        (ses--curcell (cons 'A1 (ses-cell-symbol (1- ses--numrows)
                                                 (1- ses--numcols)))))
-    (ses-recalculate-cell)
+    (ses-recalculate-cell ses--curcell)
     (ses-jump-safe startcell)))
 
 (defun ses-truncate-cell ()
diff --git a/lisp/shell.el b/lisp/shell.el
index c8a8555..55a0532 100644
--- a/lisp/shell.el
+++ b/lisp/shell.el
@@ -711,36 +711,43 @@ Otherwise, one argument `-i' is passed to the shell.
                  ;; If the current buffer is a dead shell buffer, use it.
                  (current-buffer)))
 
-  ;; On remote hosts, the local `shell-file-name' might be useless.
-  (if (and (called-interactively-p 'any)
-          (file-remote-p default-directory)
-          (null explicit-shell-file-name)
-          (null (getenv "ESHELL")))
-      (with-current-buffer buffer
-       (set (make-local-variable 'explicit-shell-file-name)
-             (expand-file-name
-              (file-local-name
-              (read-file-name
-               "Remote shell path: " default-directory shell-file-name
-               t shell-file-name))))))
-
-  ;; The buffer's window must be correctly set when we call comint (so
-  ;; that comint sets the COLUMNS env var properly).
-  (pop-to-buffer buffer)
-  (unless (comint-check-proc buffer)
-    (let* ((prog (or explicit-shell-file-name
-                    (getenv "ESHELL") shell-file-name))
-          (name (file-name-nondirectory prog))
-          (startfile (concat "~/.emacs_" name))
-          (xargs-name (intern-soft (concat "explicit-" name "-args"))))
-      (unless (file-exists-p startfile)
-       (setq startfile (concat user-emacs-directory "init_" name ".sh")))
-      (apply 'make-comint-in-buffer "shell" buffer prog
-            (if (file-exists-p startfile) startfile)
-            (if (and xargs-name (boundp xargs-name))
-                (symbol-value xargs-name)
-              '("-i")))
-      (shell-mode)))
+  (with-current-buffer buffer
+    (when (file-remote-p default-directory)
+      ;; Apply connection-local variables.
+      (hack-connection-local-variables-apply
+       `(:application 'tramp
+         :protocol ,(file-remote-p default-directory 'method)
+         :user ,(file-remote-p default-directory 'user)
+         :machine ,(file-remote-p default-directory 'host)))
+
+      ;; On remote hosts, the local `shell-file-name' might be useless.
+      (if (and (called-interactively-p 'any)
+               (null explicit-shell-file-name)
+               (null (getenv "ESHELL")))
+          (set (make-local-variable 'explicit-shell-file-name)
+               (expand-file-name
+                (file-local-name
+                 (read-file-name
+                  "Remote shell path: " default-directory shell-file-name
+                  t shell-file-name))))))
+
+    ;; The buffer's window must be correctly set when we call comint
+    ;; (so that comint sets the COLUMNS env var properly).
+    (pop-to-buffer buffer)
+    (unless (comint-check-proc buffer)
+      (let* ((prog (or explicit-shell-file-name
+                       (getenv "ESHELL") shell-file-name))
+             (name (file-name-nondirectory prog))
+             (startfile (concat "~/.emacs_" name))
+             (xargs-name (intern-soft (concat "explicit-" name "-args"))))
+        (unless (file-exists-p startfile)
+          (setq startfile (concat user-emacs-directory "init_" name ".sh")))
+        (apply 'make-comint-in-buffer "shell" buffer prog
+               (if (file-exists-p startfile) startfile)
+               (if (and xargs-name (boundp xargs-name))
+                   (symbol-value xargs-name)
+                 '("-i")))
+        (shell-mode))))
   buffer)
 
 ;;; Directory tracking
diff --git a/lisp/simple.el b/lisp/simple.el
index 369fbf7..48c1a9b 100644
--- a/lisp/simple.el
+++ b/lisp/simple.el
@@ -833,7 +833,7 @@ Leave one space or none, according to the context."
   (interactive "*")
   (save-excursion
     (delete-horizontal-space)
-    (if (or (looking-at "^\\|\\s)")
+    (if (or (looking-at "^\\|$\\|\\s)")
            (save-excursion (forward-char -1)
                            (looking-at "$\\|\\s(\\|\\s'")))
        nil
diff --git a/lisp/textmodes/css-mode.el b/lisp/textmodes/css-mode.el
index 91ebbf6..b1feca7 100644
--- a/lisp/textmodes/css-mode.el
+++ b/lisp/textmodes/css-mode.el
@@ -43,11 +43,13 @@
   :group 'languages)
 
 (defconst css-pseudo-class-ids
-  '("active" "checked" "disabled" "empty" "enabled" "first"
-    "first-child" "first-of-type" "focus" "hover" "indeterminate" "lang"
-    "last-child" "last-of-type" "left" "link" "not" "nth-child"
-    "nth-last-child" "nth-last-of-type" "nth-of-type" "only-child"
-    "only-of-type" "right" "root" "target" "visited")
+  '("active" "checked" "default" "disabled" "empty" "enabled" "first"
+    "first-child" "first-of-type" "focus" "focus-within" "hover"
+    "in-range" "indeterminate" "invalid" "lang" "last-child"
+    "last-of-type" "left" "link" "not" "nth-child" "nth-last-child"
+    "nth-last-of-type" "nth-of-type" "only-child" "only-of-type"
+    "optional" "out-of-range" "read-only" "read-write" "required"
+    "right" "root" "scope" "target" "valid" "visited")
   "Identifiers for pseudo-classes.")
 
 (defconst css-pseudo-element-ids
diff --git a/lisp/textmodes/ispell.el b/lisp/textmodes/ispell.el
index 9747bd6..db733fe 100644
--- a/lisp/textmodes/ispell.el
+++ b/lisp/textmodes/ispell.el
@@ -1094,10 +1094,10 @@ in the list must have an affix file where Hunspell 
affix files are kept."
 
 (defun ispell-find-hunspell-dictionaries ()
   "Look for installed Hunspell dictionaries.
-Will initialize `ispell-hunspell-dictionary-alist' and
-`ispell-hunspell-dictionary-alist' after values found
-and remove `ispell-dicts-name2locale-equivs-alist'
-entries if a specific dictionary was found."
+Will initialize `ispell-hunspell-dictionary-alist' according
+to dictionaries found, and will remove aliases from the list
+in `ispell-dicts-name2locale-equivs-alist' if an explicit
+dictionary from that list was found."
   (let ((hunspell-found-dicts
         (split-string
          (with-temp-buffer
@@ -1110,18 +1110,27 @@ entries if a specific dictionary was found."
          "[\n\r]+"
          t))
        hunspell-default-dict
-       hunspell-default-dict-entry)
+       hunspell-default-dict-entry
+       hunspell-multi-dict)
     (dolist (dict hunspell-found-dicts)
       (let* ((full-name (file-name-nondirectory dict))
             (basename  (file-name-sans-extension full-name))
             (affix-file (concat dict ".aff")))
        (if (string-match "\\.aff$" dict)
            ;; Found default dictionary
-           (if hunspell-default-dict
-               (error "ispell-fhd: Default dict already defined as %s.  Not 
using %s.\n"
-                      hunspell-default-dict dict)
-             (setq affix-file dict)
-             (setq hunspell-default-dict (list basename affix-file)))
+           (progn
+             (if hunspell-default-dict
+                 (setq hunspell-multi-dict
+                       (concat (or hunspell-multi-dict
+                                   (car hunspell-default-dict))
+                               "," basename))
+               (setq affix-file dict)
+               ;; FIXME: The cdr of the list we cons below is never
+               ;; used.  Why do we need a list?
+               (setq hunspell-default-dict (list basename affix-file)))
+             (ispell-print-if-debug
+              "++ ispell-fhd: default dict-entry:%s name:%s basename:%s\n"
+              dict full-name basename))
          (if (and (not (assoc basename ispell-hunspell-dict-paths-alist))
                   (file-exists-p affix-file))
              ;; Entry has an associated .aff file and no previous value.
@@ -1161,7 +1170,8 @@ entries if a specific dictionary was found."
              (cl-pushnew (list dict-equiv-key affix-file)
                           ispell-hunspell-dict-paths-alist :test #'equal)))))
     ;; Parse and set values for default dictionary.
-    (setq hunspell-default-dict (car hunspell-default-dict))
+    (setq hunspell-default-dict (or hunspell-multi-dict
+                                   (car hunspell-default-dict)))
     (setq hunspell-default-dict-entry
          (ispell-parse-hunspell-affix-file hunspell-default-dict))
     ;; Create an alist of found dicts with only names, except for default dict.
diff --git a/lisp/url/url-auth.el b/lisp/url/url-auth.el
index 7b6cdd5..2885d4e 100644
--- a/lisp/url/url-auth.el
+++ b/lisp/url/url-auth.el
@@ -131,8 +131,8 @@ instead of the filename inheritance method."
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;; Digest authorization code
 ;;; ------------------------
-;;; This implements the DIGEST authorization type.  See the internet draft
-;;; ftp://ds.internic.net/internet-drafts/draft-ietf-http-digest-aa-01.txt
+;;; This implements the DIGEST authorization type.  See RFC 2617
+;;; https://www.ietf.org/rfc/rfc2617.txt
 ;;; for the complete documentation on this type.
 ;;;
 ;;; This is very secure
@@ -143,107 +143,306 @@ Its value is an assoc list of assoc lists.  The first 
assoc list is
 keyed by the server name.  The cdr of this is an assoc list based
 on the \"directory\" specified by the url we are looking up.")
 
+(defsubst url-digest-auth-colonjoin (&rest args)
+  "Concatenate ARGS as strings with colon as a separator."
+  (mapconcat 'identity args ":"))
+
+(defsubst url-digest-auth-kd (data secret)
+  "Apply digest algorithm to DATA using SECRET and return the result."
+  (md5 (url-digest-auth-colonjoin secret data)))
+
+(defsubst url-digest-auth-make-ha1 (user realm password)
+  "Compute checksum out of strings USER, REALM, and PASSWORD."
+  (md5 (url-digest-auth-colonjoin user realm password)))
+
+(defsubst url-digest-auth-make-ha2 (method digest-uri)
+  "Compute checksum out of strings METHOD and DIGEST-URI."
+  (md5 (url-digest-auth-colonjoin method digest-uri)))
+
+(defsubst url-digest-auth-make-request-digest (ha1 ha2 nonce)
+  "Construct the request-digest from hash strings HA1, HA2, and NONCE.
+This is the value that server receives as a proof that user knows
+a password."
+  (url-digest-auth-kd (url-digest-auth-colonjoin nonce ha2) ha1))
+
+(defsubst url-digest-auth-make-request-digest-qop (qop ha1 ha2 nonce nc cnonce)
+  "Construct the request-digest with qop.
+QOP describes the \"quality of protection\" and algorithm to use.
+All of the strings QOP, HA1, HA2, NONCE, NC, and CNONCE are
+combined into a single hash value that proves to a server the
+user knows a password.  It's worth noting that HA2 already
+depends on value of QOP."
+  (url-digest-auth-kd (url-digest-auth-colonjoin
+                       nonce nc cnonce qop ha2) ha1))
+
+(defsubst url-digest-auth-directory-id (url realm)
+  "Make an identifier for selecting a key in key cache.
+The identifier is made either from URL or REALM.  It represents a
+protection space within a server so that one server can have
+multiple authorizations."
+  (or realm (or (url-file-directory (url-filename url)) "/")))
+
+(defsubst url-digest-auth-server-id (url)
+  "Make an identifier for selecting a server in key cache.
+The identifier is made from URL's host and port.  Together with
+`url-digest-auth-directory-id' these identify a single key in the
+key cache `url-digest-auth-storage'."
+  (format "%s:%d" (url-host url) (url-port url)))
+
+(defun url-digest-auth-make-cnonce ()
+  "Compute a new unique client nonce value."
+  (base64-encode-string
+   (apply 'format "%016x%04x%04x%05x%05x" (random) (current-time)) t))
+
+(defun url-digest-auth-nonce-count (nonce)
+  "The number requests sent to server with the given NONCE.
+This count includes the request we're preparing here.
+
+Currently, this is not implemented and will always return 1.
+
+Value returned is in string format with leading zeroes, such as
+\"00000001\"."
+  (format "%08x" 1))
+
+(defun url-digest-auth-name-value-string (pairs)
+  "Concatenate name-value pairs in association list PAIRS.
+
+Output is formatted as \"name1=\\\"value1\\\", name2=\\\"value2\\\", ...\""
+  (mapconcat (lambda (pair)
+               (format "%s=\"%s\""
+                       (symbol-name (car pair))
+                       (cdr pair)))
+             pairs ", "))
+
+(defun url-digest-auth-source-creds (url)
+  "Find credentials for URL object from the Emacs auth-source.
+Return value is a plist that has `:user' and `:secret' properties
+if credentials were found.  Otherwise nil."
+  (let ((server (url-digest-auth-server-id url))
+        (type (url-type url)))
+    (list :user (url-do-auth-source-search server type :user)
+          :secret (url-do-auth-source-search server type :secret))))
+
+(defun url-digest-prompt-creds (url realm &optional creds)
+  "Prompt credentials for URL and REALM, defaulting to CREDS.
+CREDS is a plist that may have properties `:user' and `:secret'."
+  ;; Set explicitly in case creds were nil.  This makes the second
+  ;; plist-put modify the same plist.
+  (setq creds
+        (plist-put creds :user
+                   (read-string (url-auth-user-prompt url realm)
+                                (or (plist-get creds :user)
+                                    (user-real-login-name)))))
+  (plist-put creds :secret
+             (read-passwd "Password: " nil (plist-get creds :secret))))
+
+(defun url-digest-auth-directory-id-assoc (dirkey keylist)
+  "Find the best match for DIRKEY in key alist KEYLIST.
+
+The string DIRKEY should be obtained using
+`url-digest-auth-directory-id'.  The key list to search through
+is the alist KEYLIST where car of each element may match DIRKEY.
+If DIRKEY represents a realm, the list is searched only for an
+exact match.  For directory names, an ancestor is sufficient for
+a match."
+  (or
+   ;; Check exact match first.
+   (assoc dirkey keylist)
+   ;; No exact match found.  Continue to look for partial match if
+   ;; dirkey is not a realm.
+   (and (string-match "/" dirkey)
+        (let (match)
+          (while (and (null match) keylist)
+            (if (or
+                 ;; Any realm candidate matches.  Why?
+                 (not (string-match "/" (caar keylist)))
+                 ;; Parent directory matches.
+                 (string-prefix-p (caar keylist) dirkey))
+                (setq match (car keylist))
+              (setq keylist (cdr keylist))))
+          match))))
+
+(defun url-digest-cached-key (url realm)
+  "Find best match for URL and REALM from `url-digest-auth-storage'.
+The return value is a list consisting of a realm (or a directory)
+a user name, and hashed authentication tokens HA1 and HA2.
+Modifying the contents of the returned list will modify the cache
+variable `url-digest-auth-storage' itself."
+  (url-digest-auth-directory-id-assoc
+   (url-digest-auth-directory-id url realm)
+   (cdr (assoc (url-digest-auth-server-id url) url-digest-auth-storage))))
+
+(defun url-digest-cache-key (key url)
+  "Add key to `url-digest-auth-storage'.
+KEY has the same format as returned by `url-digest-cached-key'.
+The key is added to cache hierarchy under server id, deduced from
+URL."
+  (let ((serverid (url-digest-auth-server-id url)))
+    (push (list serverid key) url-digest-auth-storage)))
+
 (defun url-digest-auth-create-key (username password realm method uri)
-  "Create a key for digest authentication method"
-  (let* ((info (if (stringp uri)
-                  (url-generic-parse-url uri)
-                uri))
-        (a1 (md5 (concat username ":" realm ":" password)))
-        (a2 (md5 (concat method ":" (url-filename info)))))
-    (list a1 a2)))
-
-(defun url-digest-auth (url &optional prompt overwrite realm args)
-  "Get the username/password for the specified URL.
-If optional argument PROMPT is non-nil, ask for the username/password
-to use for the URL and its descendants.  If optional third argument
-OVERWRITE is non-nil, overwrite the old username/password pair if it
-is found in the assoc list.  If REALM is specified, use that as the realm
-instead of hostname:portnum."
-  (if args
-      (let* ((href (if (stringp url)
-                      (url-generic-parse-url url)
-                    url))
-            (server (url-host href))
-            (type (url-type href))
-            (port (url-port href))
-            (file (url-filename href))
-            (enable-recursive-minibuffers t)
-            user pass byserv retval data)
-       (setq file (cond
-                   (realm realm)
-                   ((string-match "/$" file) file)
-                   (t (url-file-directory file)))
-             server (format "%s:%d" server port)
-             byserv (cdr-safe (assoc server url-digest-auth-storage)))
-       (cond
-        ((and prompt (not byserv))
-         (setq user (or
-                     (url-do-auth-source-search server type :user)
-                     (read-string (url-auth-user-prompt url realm)
-                                  (user-real-login-name)))
-               pass (or
-                     (url-do-auth-source-search server type :secret)
-                     (read-passwd "Password: "))
-               url-digest-auth-storage
-               (cons (list server
-                           (cons file
-                                 (setq retval
-                                       (cons user
-                                             (url-digest-auth-create-key
-                                              user pass realm
-                                              (or url-request-method "GET")
-                                              url)))))
-                     url-digest-auth-storage)))
-        (byserv
-         (setq retval (cdr-safe (assoc file byserv)))
-         (if (and (not retval)         ; no exact match, check directories
-                  (string-match "/" file)) ; not looking for a realm
-             (while (and byserv (not retval))
-               (setq data (car (car byserv)))
-               (if (or (not (string-match "/" data))
-                       (and
-                        (>= (length file) (length data))
-                        (string= data (substring file 0 (length data)))))
-                   (setq retval (cdr (car byserv))))
-               (setq byserv (cdr byserv))))
-         (if overwrite
-             (if (and (not retval) prompt)
-                 (setq user (or
-                             (url-do-auth-source-search server type :user)
-                             (read-string (url-auth-user-prompt url realm)
-                                          (user-real-login-name)))
-                       pass (or
-                             (url-do-auth-source-search server type :secret)
-                             (read-passwd "Password: "))
-                       retval (setq retval
-                                    (cons user
-                                          (url-digest-auth-create-key
-                                           user pass realm
-                                           (or url-request-method "GET")
-                                           url)))
-                       byserv (assoc server url-digest-auth-storage))
-               (setcdr byserv
-                       (cons (cons file retval) (cdr byserv))))))
-        (t (setq retval nil)))
-       (if retval
-           (if (cdr-safe (assoc "opaque" args))
-               (let ((nonce (or (cdr-safe (assoc "nonce" args)) "nonegiven"))
-                     (opaque (cdr-safe (assoc "opaque" args))))
-                 (format
-                  (concat "Digest username=\"%s\", realm=\"%s\","
-                          "nonce=\"%s\", uri=\"%s\","
-                          "response=\"%s\", opaque=\"%s\"")
-                  (nth 0 retval) realm nonce (url-filename href)
-                  (md5 (concat (nth 1 retval) ":" nonce ":"
-                               (nth 2 retval))) opaque))
-             (let ((nonce (or (cdr-safe (assoc "nonce" args)) "nonegiven")))
-               (format
-                (concat "Digest username=\"%s\", realm=\"%s\","
-                        "nonce=\"%s\", uri=\"%s\","
-                        "response=\"%s\"")
-                (nth 0 retval) realm nonce (url-filename href)
-                (md5 (concat (nth 1 retval) ":" nonce ":"
-                             (nth 2 retval))))))))))
+  "Create a key for digest authentication method.
+The USERNAME and PASSWORD are the credentials for REALM and are
+used in making a hashed value named HA1.  The HTTP METHOD and URI
+makes a second hashed value HA2.  These hashes are used in making
+the authentication key that can be stored without saving the
+password in plain text.  The return value is a list (HA1 HA2).
+
+For backward compatibility, URI is allowed to be a URL cl-struct
+object."
+  (and username password realm
+       (list (url-digest-auth-make-ha1 username realm password)
+             (url-digest-auth-make-ha2 method (cond ((stringp uri) uri)
+                                                    (t (url-filename uri)))))))
+
+(defun url-digest-auth-build-response (key url realm attrs)
+  "Compute authorization string for the given challenge using KEY.
+
+The string looks like 'Digest username=\"John\", realm=\"The
+Realm\", ...'
+
+Part of the challenge is already solved in a pre-computed KEY
+which is list of a realm (or a directory), user name, and hash
+tokens HA1 and HA2.
+
+Some fields are filled as is from the given URL, REALM, and
+using the contents of alist ATTRS.
+
+ATTRS is expected to contain at least the server's \"nonce\"
+value.  It also might contain the optional \"opaque\" value.
+Newer implementations conforming to RFC 2617 should also contain
+qop (Quality Of Protection) and related attributes.
+
+Restrictions on Quality of Protection scheme: The qop value
+\"auth-int\" or algorithm any other than \"MD5\" are not
+implemented."
+
+  (when key
+    (let ((user (nth 1 key))
+          (ha1 (nth 2 key))
+          (ha2 (nth 3 key))
+          (digest-uri (url-filename url))
+          (qop (cdr-safe (assoc "qop" attrs)))
+          (nonce (cdr-safe (assoc "nonce" attrs)))
+          (opaque (cdr-safe (assoc "opaque" attrs))))
+
+      (concat
+       "Digest "
+       (url-digest-auth-name-value-string
+        (append (list (cons 'username user)
+                      (cons 'realm realm)
+                      (cons 'nonce nonce)
+                      (cons 'uri digest-uri))
+
+                (cond
+                 ((null qop)
+                  (list (cons 'response (url-digest-auth-make-request-digest
+                                         ha1 ha2 nonce))))
+                 ((string= qop "auth")
+                  (let ((nc (url-digest-auth-nonce-count nonce))
+                        (cnonce (url-digest-auth-make-cnonce)))
+                    (list (cons 'qop qop)
+                          (cons 'nc nc)
+                          (cons 'cnonce cnonce)
+                          (cons 'response
+                                (url-digest-auth-make-request-digest-qop
+                                 qop ha1 ha2 nonce nc cnonce)))))
+                 (t (message "Quality of protection \"%s\" is not 
implemented." qop)
+                    nil))
+
+
+                (if opaque (list (cons 'opaque opaque)))))))))
+
+(defun url-digest-find-creds (url prompt &optional realm)
+  "Find or ask credentials for URL.
+
+Primary method for finding credentials is from Emacs auth-source.
+If password isn't found, and PROMPT is non-nil, query credentials
+via minibuffer.  Optional REALM may be used when prompting as a
+hint to the user.
+
+Return value is nil in case either user name or password wasn't
+found.  Otherwise, it's a plist containing `:user' and `:secret'.
+Additional `:source' property denotes the origin of the
+credentials and its value can be either symbol `authsource' or
+`interactive'."
+  (let ((creds (url-digest-auth-source-creds url)))
+
+    ;; If credentials weren't found and prompting is allowed, prompt
+    ;; the user.
+    (if (and prompt
+             (or (null creds)
+                 (null (plist-get creds :secret))))
+        (progn
+          (setq creds (url-digest-prompt-creds url realm creds))
+          (plist-put creds :source 'interactive))
+      (plist-put creds :source 'authsource))
+
+    (and (plist-get creds :user)
+         (plist-get creds :secret)
+         creds)))
+
+(defun url-digest-find-new-key (url realm prompt)
+  "Find credentials and create a new authorization key for given URL and REALM.
+
+Return value is the new key, or nil if credentials weren't found.
+\"New\" in this context means a key that's not yet found in cache
+variable `url-digest-auth-storage'.  You may use `url-digest-cache-key'
+to put it there.
+
+This function uses `url-digest-find-creds' to find the
+credentials.  It first looks in auth-source.  If not found, and
+PROMPT is non-nil, user is asked for credentials interactively
+via minibuffer."
+  (let (creds)
+    (unwind-protect
+        (if (setq creds (url-digest-find-creds url prompt realm))
+            (cons (url-digest-auth-directory-id url realm)
+                  (cons (plist-get creds :user)
+                        (url-digest-auth-create-key
+                         (plist-get creds :user)
+                         (plist-get creds :secret)
+                         realm
+                         (or url-request-method "GET")
+                         (url-filename url)))))
+      (if (and creds
+               ;; Don't clear secret for `authsource' since it will
+               ;; corrupt any future fetches for it.
+               (not (eq (plist-get creds :source) 'authsource)))
+          (clear-string (plist-get creds :secret))))))
+
+(defun url-digest-auth (url &optional prompt overwrite realm attrs)
+  "Get the HTTP Digest response string for the specified URL.
+
+If optional argument PROMPT is non-nil, ask for the username and
+password to use for the URL and its descendants but only if one
+cannot be found from cache.  Look also in Emacs auth-source.
+
+If optional third argument OVERWRITE is non-nil, overwrite the
+old credentials, if they're found in cache, with new ones from
+user prompt or from Emacs auth-source.
+
+If REALM is specified, use that instead of the URL descendant
+method to match cached credentials.
+
+Alist ATTRS contains additional attributes for the authentication
+challenge such as nonce and opaque."
+  (if attrs
+      (let* ((href (if (stringp url) (url-generic-parse-url url) url))
+             (enable-recursive-minibuffers t)
+             (key (url-digest-cached-key href realm)))
+
+        (if (or (null key) overwrite)
+            (let ((newkey (url-digest-find-new-key href realm (cond
+                                                               (key nil)
+                                                               (t prompt)))))
+              (if (and newkey key overwrite)
+                  (setcdr key (cdr newkey))
+                (if (and newkey (null key))
+                    (url-digest-cache-key (setq key newkey) href)))))
+
+        (if key
+            (url-digest-auth-build-response key href realm attrs)))))
 
 (defvar url-registered-auth-schemes nil
   "A list of the registered authorization schemes and various and sundry
diff --git a/lisp/url/url-domsuf.el b/lisp/url/url-domsuf.el
index 25a6a42..b24f245 100644
--- a/lisp/url/url-domsuf.el
+++ b/lisp/url/url-domsuf.el
@@ -89,7 +89,7 @@
 
 ;; Tests:
 
-;; TODO convert to a proper test/automated test.
+;; TODO convert to a proper test.
 ;; (url-domsuf-cookie-allowed-p "com") => nil
 ;; (url-domsuf-cookie-allowed-p "foo.bar.bd") => t
 ;; (url-domsuf-cookie-allowed-p "bar.bd") => nil
diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index 31c33e6..aa8d778 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -504,7 +504,7 @@ See 
http://lists.gnu.org/archive/html/emacs-devel/2007-11/msg01990.html";)
 ;; "index ", "old mode", "new mode", "new file mode" and
 ;; "deleted file mode" are output by git-diff.
 (defconst diff-file-junk-re
-  (concat "Index: \\|=\\{20,\\}\\|" ; SVN
+  (concat "Index: \\|Prereq: \\|=\\{20,\\}\\|" ; SVN
           "diff \\|index \\|\\(?:deleted file\\|new\\(?: file\\)?\\|old\\) 
mode\\|=== modified file"))
 
 ;; If point is in a diff header, then return beginning
diff --git a/lisp/vc/ediff-ptch.el b/lisp/vc/ediff-ptch.el
index 9d2ec51..36aebf4 100644
--- a/lisp/vc/ediff-ptch.el
+++ b/lisp/vc/ediff-ptch.el
@@ -25,6 +25,8 @@
 ;;; Code:
 
 
+(require 'diff-mode) ; For `diff-file-junk-re'.
+
 (provide 'ediff-ptch)
 
 (defgroup ediff-ptch nil
@@ -225,14 +227,11 @@ program."
                        (if (and beg2 end2)
                            (buffer-substring beg2 end2)
                          "/dev/null")))
-           ;; check for any `Index:' or `Prereq:' lines, but don't use them
-           (if (re-search-backward "^Index:" mark1-end 'noerror)
-               (move-marker mark2 (match-beginning 0)))
-           (if (re-search-backward "^Prereq:" mark1-end 'noerror)
-               (move-marker mark2 (match-beginning 0)))
-
+            ;; Remove file junk (Bug#26084).
+            (while (re-search-backward
+                    (concat "^" diff-file-junk-re) mark1-end t)
+                (move-marker mark2 (match-beginning 0)))
            (goto-char mark2-end)
-
            (if filenames
                (setq patch-map
                      (cons (ediff-make-new-meta-list-element
diff --git a/lwlib/Makefile.in b/lwlib/Makefile.in
index d6a8f50..ee7a204 100644
--- a/lwlib/Makefile.in
+++ b/lwlib/Makefile.in
@@ -22,6 +22,9 @@
 # This was taken from the output of Imake using Lucid's Imakefile.
 # and set up to be configured by ../configure.
 
+all: liblw.a
+.PHONY: all
+
 address@hidden@
 # MinGW CPPFLAGS may use this.
 address@hidden@
@@ -71,15 +74,14 @@ am__v_at_ = $(address@hidden@)
 am__v_at_0 = @
 am__v_at_1 =
 
-DEPDIR = deps
 AUTO_DEPEND = @AUTO_DEPEND@
-
+DEPDIR = deps
 ifeq ($(AUTO_DEPEND),yes)
-DEPFLAGS = -MMD -MF ${DEPDIR}/$*.d -MP
-MKDEPDIR = ${MKDIR_P} ${DEPDIR}
+  DEPFLAGS = -MMD -MF $(DEPDIR)/$*.d -MP
+  -include $(ALLOBJS:%.o=$(DEPDIR)/%.d)
 else
-DEPFLAGS =
-MKDEPDIR = :
+  DEPFLAGS =
+  include $(srcdir)/deps.mk
 endif
 
 ## ../src is where the generated file (config.h, globals.h) are.
@@ -94,11 +96,7 @@ ALL_CFLAGS= $(C_SWITCH_SYSTEM) $(C_SWITCH_X_SITE) \
   -Demacs -I../src \
   -I$(srcdir) -I$(srcdir)/../src -I../lib -I$(srcdir)/../lib
 
-all: liblw.a
-.PHONY: all
-
 .c.o:
-       @$(MKDEPDIR)
        $(AM_V_CC)$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $<
 
 liblw.a: $(OBJS)
@@ -110,20 +108,14 @@ globals_h = ../src/globals.h
 $(globals_h):
        $(MAKE) -C ../src globals.h
 
-ifeq ($(AUTO_DEPEND),yes)
--include $(ALLOBJS:%.o=${DEPDIR}/%.d)
-else
-include $(srcdir)/deps.mk
-endif
-
 .PHONY: mostlyclean clean distclean bootstrap-clean maintainer-clean
 
 clean mostlyclean:
-       rm -f *.o liblw.a \#*
-       -rm -rf ${DEPDIR}
+       rm -f *.o liblw.a \#* $(DEPDIR)/*
 
 distclean: clean
        rm -f Makefile
+       rm -fr $(DEPDIR)
 
 bootstrap-clean maintainer-clean: distclean
        rm -f TAGS
diff --git a/make-dist b/make-dist
index 96e0a73..7e1f0df 100755
--- a/make-dist
+++ b/make-dist
@@ -538,12 +538,9 @@ done
 
 if [ "$with_tests" = "yes" ]; then
   echo "Making links to 'test' and its subdirectories"
-  for f in `find test -type f`; do
-    case $f in
-      test/automated/*.log) continue ;;
-      test/automated/flymake/warnpred/a.out) continue ;;
-      test/automated/Makefile) continue ;;
-    esac
+  for f in `find test -type f ! -name '*.log' ! -name a.out \
+             ! -path test/Makefile
+  `; do
     ln $f $tempdir/$f
   done
 fi
diff --git a/modules/mod-test/test.el b/modules/mod-test/test.el
index 181f132..caa807d 100644
--- a/modules/mod-test/test.el
+++ b/modules/mod-test/test.el
@@ -64,7 +64,21 @@
 ;;
 
 (ert-deftest mod-test-non-local-exit-signal-test ()
-  (should-error (mod-test-signal)))
+  (should-error (mod-test-signal))
+  (let (debugger-args backtrace)
+    (should-error
+     (let ((debugger (lambda (&rest args)
+                       (setq debugger-args args
+                             backtrace (with-output-to-string (backtrace)))
+                       (cl-incf num-nonmacro-input-events)))
+           (debug-on-signal t))
+       (mod-test-signal)))
+    (should (equal debugger-args '(error (error . 56))))
+    (should (string-match-p
+             (rx bol "  internal--module-call(" (+ nonl) ?\) ?\n
+                 "  apply(internal--module-call " (+ nonl) ?\) ?\n
+                 "  mod-test-signal()" eol)
+             backtrace))))
 
 (ert-deftest mod-test-non-local-exit-throw-test ()
   (should (equal
diff --git a/oldXMenu/Makefile.in b/oldXMenu/Makefile.in
index 46061ab..7a5c998 100644
--- a/oldXMenu/Makefile.in
+++ b/oldXMenu/Makefile.in
@@ -111,15 +111,14 @@ am__v_at_ = $(address@hidden@)
 am__v_at_0 = @
 am__v_at_1 =
 
-DEPDIR = deps
 AUTO_DEPEND = @AUTO_DEPEND@
-
+DEPDIR = deps
 ifeq ($(AUTO_DEPEND),yes)
-DEPFLAGS = -MMD -MF ${DEPDIR}/$*.d -MP
-MKDEPDIR = ${MKDIR_P} ${DEPDIR}
+  DEPFLAGS = -MMD -MF $(DEPDIR)/$*.d -MP
+  -include $(ALLOBJS:%.o=$(DEPDIR)/%.d)
 else
-DEPFLAGS =
-MKDEPDIR = :
+  DEPFLAGS =
+  include $(srcdir)/deps.mk
 endif
 
 ALL_CFLAGS=$(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) \
@@ -129,7 +128,6 @@ ALL_CFLAGS=$(C_SWITCH_SYSTEM) $(C_SWITCH_MACHINE) \
   -I../src -I../lib -I${srcdir} -I${srcdir}/../src -I${srcdir}/../lib
 
 .c.o:
-       @$(MKDEPDIR)
        $(AM_V_CC)$(CC) -c ${ALL_CFLAGS} $<
 
 libXMenu11.a: $(OBJS) $(EXTRA)
@@ -137,20 +135,14 @@ libXMenu11.a: $(OBJS) $(EXTRA)
        $(AM_V_at)$(AR) $(ARFLAGS) $@ $(OBJS) $(EXTRA)
        $(AM_V_at)$(RANLIB) $@
 
-ifeq ($(AUTO_DEPEND),yes)
--include $(ALLOBJS:%.o=${DEPDIR}/%.d)
-else
-include $(srcdir)/deps.mk
-endif
-
 .PHONY: mostlyclean clean distclean bootstrap-clean maintainer-clean
 
 clean mostlyclean:
-       rm -f libXMenu11.a *.o
-       -rm -rf ${DEPDIR}
+       rm -f libXMenu11.a *.o $(DEPDIR)/*
 
 bootstrap-clean maintainer-clean distclean: clean
        rm -f Makefile
+       rm -fr $(DEPDIR)
 
 ETAGS = ../lib-src/etags${EXEEXT}
 
diff --git a/src/Makefile.in b/src/Makefile.in
index 60aa686..5a3d0bd 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -347,15 +347,14 @@ am__v_at_ = $(address@hidden@)
 am__v_at_0 = @
 am__v_at_1 =
 
-DEPDIR=deps
 AUTO_DEPEND = @AUTO_DEPEND@
-
+DEPDIR = deps
 ifeq ($(AUTO_DEPEND),yes)
-DEPFLAGS = -MMD -MF ${DEPDIR}/$*.d -MP
-MKDEPDIR = ${MKDIR_P} ${DEPDIR}
+  DEPFLAGS = -MMD -MF $(DEPDIR)/$*.d -MP
+  -include $(ALLOBJS:%.o=$(DEPDIR)/%.d)
 else
-DEPFLAGS =
-MKDEPDIR = :
+  DEPFLAGS =
+  include $(srcdir)/deps.mk
 endif
 
 # Flags that might be in WARN_CFLAGS but are not valid for Objective C.
@@ -383,10 +382,8 @@ ALL_OBJC_CFLAGS = $(EMACS_CFLAGS) \
 
 .SUFFIXES: .m
 .c.o:
-       @$(MKDEPDIR)
        $(AM_V_CC)$(CC) -c $(CPPFLAGS) $(ALL_CFLAGS) $(PROFILING_CFLAGS) $<
 .m.o:
-       @$(MKDEPDIR)
        $(AM_V_CC)$(CC) -c $(CPPFLAGS) $(ALL_OBJC_CFLAGS) $(PROFILING_CFLAGS) $<
 
 ## lastfile must follow all files whose initialized data areas should
@@ -650,8 +647,7 @@ mostlyclean:
        rm -f globals.h gl-stamp
        rm -f *.res *.tmp
 clean: mostlyclean
-       rm -f emacs-*.*.*$(EXEEXT) emacs$(EXEEXT)
-       -rm -rf $(DEPDIR)
+       rm -f emacs-*.*.*$(EXEEXT) emacs$(EXEEXT) $(DEPDIR)/*
 
 ## bootstrap-clean is used to clean up just before a bootstrap.
 ## It should remove all files generated during a compilation/bootstrap,
@@ -666,6 +662,7 @@ bootstrap-clean: clean
 
 distclean: bootstrap-clean
        rm -f Makefile lisp.mk
+       rm -fr $(DEPDIR)
 
 maintainer-clean: distclean
        rm -f TAGS
@@ -755,11 +752,3 @@ else
 endif
        @: Compile some files earlier to speed up further compilation.
        $(MAKE) -C ../lisp compile-first EMACS="$(bootstrap_exe)"
-
-ifeq ($(AUTO_DEPEND),yes)
--include $(ALLOBJS:%.o=${DEPDIR}/%.d)
-else
-include $(srcdir)/deps.mk
-endif
-
-### Makefile.in ends here
diff --git a/src/editfns.c b/src/editfns.c
index 65c0c72..2dafd8e 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -4356,7 +4356,7 @@ styled_format (ptrdiff_t nargs, Lisp_Object *args, bool 
message)
                  sprintf_buf[0] = XINT (args[n]);
                  sprintf_bytes = prec != 0;
                }
-             else if (conversion == 'd')
+             else if (conversion == 'd' || conversion == 'i')
                {
                  /* For float, maybe we should use "%1.0f"
                     instead so it also works for values outside
diff --git a/src/fns.c b/src/fns.c
index 1065355..de7fc1b 100644
--- a/src/fns.c
+++ b/src/fns.c
@@ -38,7 +38,9 @@ along with GNU Emacs.  If not, see 
<http://www.gnu.org/licenses/>.  */
 
 static void sort_vector_copy (Lisp_Object, ptrdiff_t,
                              Lisp_Object *restrict, Lisp_Object *restrict);
-static bool internal_equal (Lisp_Object, Lisp_Object, int, bool, Lisp_Object);
+enum equal_kind { EQUAL_NO_QUIT, EQUAL_PLAIN, EQUAL_INCLUDING_PROPERTIES };
+static bool internal_equal (Lisp_Object, Lisp_Object,
+                           enum equal_kind, int, Lisp_Object);
 
 DEFUN ("identity", Fidentity, Sidentity, 1, 1, 0,
        doc: /* Return the argument unchanged.  */
@@ -1377,7 +1379,7 @@ The value is actually the tail of LIST whose car is ELT.  
*/)
   FOR_EACH_TAIL (tail)
     {
       Lisp_Object tem = XCAR (tail);
-      if (FLOATP (tem) && internal_equal (elt, tem, 0, 0, Qnil))
+      if (FLOATP (tem) && equal_no_quit (elt, tem))
        return tail;
     }
   CHECK_LIST_END (tail, list);
@@ -1428,7 +1430,8 @@ The value is actually the first element of LIST whose car 
equals KEY.  */)
 }
 
 /* Like Fassoc but never report an error and do not allow quits.
-   Use only on objects known to be non-circular lists.  */
+   Use only on keys and lists known to be non-circular, and on keys
+   that are not too deep and are not window configurations.  */
 
 Lisp_Object
 assoc_no_quit (Lisp_Object key, Lisp_Object list)
@@ -1437,7 +1440,7 @@ assoc_no_quit (Lisp_Object key, Lisp_Object list)
     {
       Lisp_Object car = XCAR (list);
       if (CONSP (car)
-         && (EQ (XCAR (car), key) || !NILP (Fequal (XCAR (car), key))))
+         && (EQ (XCAR (car), key) || equal_no_quit (XCAR (car), key)))
        return car;
     }
   return Qnil;
@@ -2085,7 +2088,7 @@ Floating-point numbers of equal value are `eql', but they 
may not be `eq'.  */)
   (Lisp_Object obj1, Lisp_Object obj2)
 {
   if (FLOATP (obj1))
-    return internal_equal (obj1, obj2, 0, 0, Qnil) ? Qt : Qnil;
+    return equal_no_quit (obj1, obj2) ? Qt : Qnil;
   else
     return EQ (obj1, obj2) ? Qt : Qnil;
 }
@@ -2098,31 +2101,50 @@ Vectors and strings are compared element by element.
 Numbers are compared by value, but integers cannot equal floats.
  (Use `=' if you want integers and floats to be able to be equal.)
 Symbols must match exactly.  */)
-  (register Lisp_Object o1, Lisp_Object o2)
+  (Lisp_Object o1, Lisp_Object o2)
 {
-  return internal_equal (o1, o2, 0, 0, Qnil) ? Qt : Qnil;
+  return internal_equal (o1, o2, EQUAL_PLAIN, 0, Qnil) ? Qt : Qnil;
 }
 
 DEFUN ("equal-including-properties", Fequal_including_properties, 
Sequal_including_properties, 2, 2, 0,
        doc: /* Return t if two Lisp objects have similar structure and 
contents.
 This is like `equal' except that it compares the text properties
 of strings.  (`equal' ignores text properties.)  */)
-  (register Lisp_Object o1, Lisp_Object o2)
+  (Lisp_Object o1, Lisp_Object o2)
 {
-  return internal_equal (o1, o2, 0, 1, Qnil) ? Qt : Qnil;
+  return (internal_equal (o1, o2, EQUAL_INCLUDING_PROPERTIES, 0, Qnil)
+         ? Qt : Qnil);
 }
 
-/* DEPTH is current depth of recursion.  Signal an error if it
-   gets too deep.
-   PROPS means compare string text properties too.  */
+/* Return true if O1 and O2 are equal.  Do not quit or check for cycles.
+   Use this only on arguments that are cycle-free and not too large and
+   are not window configurations.  */
+
+bool
+equal_no_quit (Lisp_Object o1, Lisp_Object o2)
+{
+  return internal_equal (o1, o2, EQUAL_NO_QUIT, 0, Qnil);
+}
+
+/* Return true if O1 and O2 are equal.  EQUAL_KIND specifies what kind
+   of equality test to use: if it is EQUAL_NO_QUIT, do not check for
+   cycles or large arguments or quits; if EQUAL_PLAIN, do ordinary
+   Lisp equality; and if EQUAL_INCLUDING_PROPERTIES, do
+   equal-including-properties.
+
+   If DEPTH is the current depth of recursion; signal an error if it
+   gets too deep.  HT is a hash table used to detect cycles; if nil,
+   it has not been allocated yet.  But ignore the last two arguments
+   if EQUAL_KIND == EQUAL_NO_QUIT.  */
 
 static bool
-internal_equal (Lisp_Object o1, Lisp_Object o2, int depth, bool props,
-               Lisp_Object ht)
+internal_equal (Lisp_Object o1, Lisp_Object o2, enum equal_kind equal_kind,
+               int depth, Lisp_Object ht)
 {
  tail_recurse:
   if (depth > 10)
     {
+      eassert (equal_kind != EQUAL_NO_QUIT);
       if (depth > 200)
        error ("Stack overflow in equal");
       if (NILP (ht))
@@ -2138,7 +2160,7 @@ internal_equal (Lisp_Object o1, Lisp_Object o2, int 
depth, bool props,
              { /* `o1' was seen already.  */
                Lisp_Object o2s = HASH_VALUE (h, i);
                if (!NILP (Fmemq (o2, o2s)))
-                 return 1;
+                 return true;
                else
                  set_hash_value_slot (h, i, Fcons (o2, o2s));
              }
@@ -2150,9 +2172,9 @@ internal_equal (Lisp_Object o1, Lisp_Object o2, int 
depth, bool props,
     }
 
   if (EQ (o1, o2))
-    return 1;
+    return true;
   if (XTYPE (o1) != XTYPE (o2))
-    return 0;
+    return false;
 
   switch (XTYPE (o1))
     {
@@ -2166,31 +2188,42 @@ internal_equal (Lisp_Object o1, Lisp_Object o2, int 
depth, bool props,
       }
 
     case Lisp_Cons:
-      {
+      if (equal_kind == EQUAL_NO_QUIT)
+       for (; CONSP (o1); o1 = XCDR (o1))
+         {
+           if (! CONSP (o2))
+             return false;
+           if (! equal_no_quit (XCAR (o1), XCAR (o2)))
+             return false;
+           o2 = XCDR (o2);
+           if (EQ (XCDR (o1), o2))
+             return true;
+         }
+      else
        FOR_EACH_TAIL (o1)
          {
            if (! CONSP (o2))
              return false;
-           if (! internal_equal (XCAR (o1), XCAR (o2), depth + 1, props, ht))
+           if (! internal_equal (XCAR (o1), XCAR (o2),
+                                 equal_kind, depth + 1, ht))
              return false;
            o2 = XCDR (o2);
            if (EQ (XCDR (o1), o2))
              return true;
          }
-       depth++;
-       goto tail_recurse;
-      }
+      depth++;
+      goto tail_recurse;
 
     case Lisp_Misc:
       if (XMISCTYPE (o1) != XMISCTYPE (o2))
-       return 0;
+       return false;
       if (OVERLAYP (o1))
        {
          if (!internal_equal (OVERLAY_START (o1), OVERLAY_START (o2),
-                              depth + 1, props, ht)
+                              equal_kind, depth + 1, ht)
              || !internal_equal (OVERLAY_END (o1), OVERLAY_END (o2),
-                                 depth + 1, props, ht))
-           return 0;
+                                 equal_kind, depth + 1, ht))
+           return false;
          o1 = XOVERLAY (o1)->plist;
          o2 = XOVERLAY (o2)->plist;
          depth++;
@@ -2212,20 +2245,23 @@ internal_equal (Lisp_Object o1, Lisp_Object o2, int 
depth, bool props,
           actually checks that the objects have the same type as well as the
           same size.  */
        if (ASIZE (o2) != size)
-         return 0;
+         return false;
        /* Boolvectors are compared much like strings.  */
        if (BOOL_VECTOR_P (o1))
          {
            EMACS_INT size = bool_vector_size (o1);
            if (size != bool_vector_size (o2))
-             return 0;
+             return false;
            if (memcmp (bool_vector_data (o1), bool_vector_data (o2),
                        bool_vector_bytes (size)))
-             return 0;
-           return 1;
+             return false;
+           return true;
          }
        if (WINDOW_CONFIGURATIONP (o1))
-         return compare_window_configurations (o1, o2, 0);
+         {
+           eassert (equal_kind != EQUAL_NO_QUIT);
+           return compare_window_configurations (o1, o2, false);
+         }
 
        /* Aside from them, only true vectors, char-tables, compiled
           functions, and fonts (font-spec, font-entity, font-object)
@@ -2234,7 +2270,7 @@ internal_equal (Lisp_Object o1, Lisp_Object o2, int 
depth, bool props,
          {
            if (((size & PVEC_TYPE_MASK) >> PSEUDOVECTOR_AREA_BITS)
                < PVEC_COMPILED)
-             return 0;
+             return false;
            size &= PSEUDOVECTOR_SIZE_MASK;
          }
        for (i = 0; i < size; i++)
@@ -2242,29 +2278,30 @@ internal_equal (Lisp_Object o1, Lisp_Object o2, int 
depth, bool props,
            Lisp_Object v1, v2;
            v1 = AREF (o1, i);
            v2 = AREF (o2, i);
-           if (!internal_equal (v1, v2, depth + 1, props, ht))
-             return 0;
+           if (!internal_equal (v1, v2, equal_kind, depth + 1, ht))
+             return false;
          }
-       return 1;
+       return true;
       }
       break;
 
     case Lisp_String:
       if (SCHARS (o1) != SCHARS (o2))
-       return 0;
+       return false;
       if (SBYTES (o1) != SBYTES (o2))
-       return 0;
+       return false;
       if (memcmp (SDATA (o1), SDATA (o2), SBYTES (o1)))
-       return 0;
-      if (props && !compare_string_intervals (o1, o2))
-       return 0;
-      return 1;
+       return false;
+      if (equal_kind == EQUAL_INCLUDING_PROPERTIES
+         && !compare_string_intervals (o1, o2))
+       return false;
+      return true;
 
     default:
       break;
     }
 
-  return 0;
+  return false;
 }
 
 
diff --git a/src/gtkutil.c b/src/gtkutil.c
index 3a00e36..63f0143 100644
--- a/src/gtkutil.c
+++ b/src/gtkutil.c
@@ -783,33 +783,55 @@ xg_set_geometry (struct frame *f)
 {
   if (f->size_hint_flags & (USPosition | PPosition))
     {
-      int left = f->left_pos;
-      int xneg = f->size_hint_flags & XNegative;
-      int top = f->top_pos;
-      int yneg = f->size_hint_flags & YNegative;
-      char geom_str[sizeof "=x--" + 4 * INT_STRLEN_BOUND (int)];
-      guint id;
-
-      if (xneg)
-        left = -left;
-      if (yneg)
-        top = -top;
-
-      sprintf (geom_str, "=%dx%d%c%d%c%d",
-               FRAME_PIXEL_WIDTH (f),
-               FRAME_PIXEL_HEIGHT (f),
-               (xneg ? '-' : '+'), left,
-               (yneg ? '-' : '+'), top);
-
-      /* Silence warning about visible children.  */
-      id = g_log_set_handler ("Gtk", G_LOG_LEVEL_WARNING | G_LOG_FLAG_FATAL
-                              | G_LOG_FLAG_RECURSION, my_log_handler, NULL);
-
-      if (!gtk_window_parse_geometry (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
-                                      geom_str))
-        fprintf (stderr, "Failed to parse: '%s'\n", geom_str);
-
-      g_log_remove_handler ("Gtk", id);
+      if (x_gtk_use_window_move)
+       {
+         /* Handle negative positions without consulting
+            gtk_window_parse_geometry (Bug#25851).  The position will
+            be off by scrollbar width + window manager decorations.  */
+         if (f->size_hint_flags & XNegative)
+           f->left_pos = (x_display_pixel_width (FRAME_DISPLAY_INFO (f))
+                          - FRAME_PIXEL_WIDTH (f) + f->left_pos);
+
+         if (f->size_hint_flags & YNegative)
+           f->top_pos = (x_display_pixel_height (FRAME_DISPLAY_INFO (f))
+                         - FRAME_PIXEL_HEIGHT (f) + f->top_pos);
+
+         gtk_window_move (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+                          f->left_pos, f->top_pos);
+
+         /* Reset size hint flags.  */
+         f->size_hint_flags &= ~ (XNegative | YNegative);
+       }
+      else
+       {
+         int left = f->left_pos;
+         int xneg = f->size_hint_flags & XNegative;
+         int top = f->top_pos;
+         int yneg = f->size_hint_flags & YNegative;
+         char geom_str[sizeof "=x--" + 4 * INT_STRLEN_BOUND (int)];
+         guint id;
+
+         if (xneg)
+           left = -left;
+         if (yneg)
+           top = -top;
+
+         sprintf (geom_str, "=%dx%d%c%d%c%d",
+                  FRAME_PIXEL_WIDTH (f),
+                  FRAME_PIXEL_HEIGHT (f),
+                  (xneg ? '-' : '+'), left,
+                  (yneg ? '-' : '+'), top);
+
+         /* Silence warning about visible children.  */
+         id = g_log_set_handler ("Gtk", G_LOG_LEVEL_WARNING | G_LOG_FLAG_FATAL
+                                 | G_LOG_FLAG_RECURSION, my_log_handler, NULL);
+
+         if (!gtk_window_parse_geometry (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET 
(f)),
+                                         geom_str))
+           fprintf (stderr, "Failed to parse: '%s'\n", geom_str);
+
+         g_log_remove_handler ("Gtk", id);
+       }
     }
 }
 
@@ -1406,6 +1428,13 @@ x_wm_set_size_hint (struct frame *f, long int flags, 
bool user_position)
   else if (win_gravity == StaticGravity)
     size_hints.win_gravity = GDK_GRAVITY_STATIC;
 
+  if (x_gtk_use_window_move)
+    {
+      if (flags & PPosition) hint_flags |= GDK_HINT_POS;
+      if (flags & USPosition) hint_flags |= GDK_HINT_USER_POS;
+      if (flags & USSize) hint_flags |= GDK_HINT_USER_SIZE;
+    }
+
   if (user_position)
     {
       hint_flags &= ~GDK_HINT_POS;
diff --git a/src/inotify.c b/src/inotify.c
index 61ef615..2907013 100644
--- a/src/inotify.c
+++ b/src/inotify.c
@@ -41,24 +41,40 @@ along with GNU Emacs.  If not, see 
<http://www.gnu.org/licenses/>.  */
 #ifndef IN_ONLYDIR
 # define IN_ONLYDIR 0
 #endif
+#define INOTIFY_DEFAULT_MASK (IN_ALL_EVENTS | IN_EXCL_UNLINK)
 
 /* File handle for inotify.  */
 static int inotifyfd = -1;
 
-/* Assoc list of files being watched.
-   Format: (watch-descriptor name callback)
- */
+/* Alist of files being watched.  We want the returned descriptor to
+   be unique for every watch, but inotify returns the same descriptor
+   WD for multiple calls to inotify_add_watch with the same file.
+   Supply a nonnegative integer ID, so that WD and ID together
+   uniquely identify a watch/file combination.
+
+   For the same reason, we also need to store the watch's mask and we
+   can't allow the following flags to be used.
+
+   IN_EXCL_UNLINK
+   IN_MASK_ADD
+   IN_ONESHOT
+   IN_ONLYDIR
+
+   Each element of this list is of the form (DESCRIPTOR . WATCHES)
+   where no two DESCRIPTOR values are the same.  DESCRIPTOR represents
+   the inotify watch descriptor and WATCHES is a list with elements of
+   the form (ID FILENAME CALLBACK MASK), where ID is the integer
+   described above, FILENAME names the file being watched, CALLBACK is
+   invoked when the event occurs, and MASK represents the aspects
+   being watched.  The WATCHES list is sorted by ID.  Although
+   DESCRIPTOR and MASK are ordinarily integers, they are conses when
+   representing integers outside of fixnum range.  */
+
 static Lisp_Object watch_list;
 
 static Lisp_Object
-make_watch_descriptor (int wd)
+mask_to_aspects (uint32_t mask)
 {
-  /* TODO replace this with a Misc Object! */
-  return make_number (wd);
-}
-
-static Lisp_Object
-mask_to_aspects (uint32_t mask) {
   Lisp_Object aspects = Qnil;
   if (mask & IN_ACCESS)
     aspects = Fcons (Qaccess, aspects);
@@ -95,77 +111,6 @@ mask_to_aspects (uint32_t mask) {
   return aspects;
 }
 
-static Lisp_Object
-inotifyevent_to_event (Lisp_Object watch_object, struct inotify_event const 
*ev)
-{
-  Lisp_Object name = Qnil;
-  if (ev->len > 0)
-    {
-      size_t const len = strlen (ev->name);
-      name = make_unibyte_string (ev->name, min (len, ev->len));
-      name = DECODE_FILE (name);
-    }
-  else
-    name = XCAR (XCDR (watch_object));
-
-  return list2 (list4 (make_watch_descriptor (ev->wd),
-                       mask_to_aspects (ev->mask),
-                       name,
-                       make_number (ev->cookie)),
-               Fnth (make_number (2), watch_object));
-}
-
-/* This callback is called when the FD is available for read.  The inotify
-   events are read from FD and converted into input_events.  */
-static void
-inotify_callback (int fd, void *_)
-{
-  struct input_event event;
-  Lisp_Object watch_object;
-  int to_read;
-  char *buffer;
-  ssize_t n;
-  size_t i;
-
-  to_read = 0;
-  if (ioctl (fd, FIONREAD, &to_read) == -1)
-    report_file_notify_error ("Error while retrieving file system events",
-                             Qnil);
-  buffer = xmalloc (to_read);
-  n = read (fd, buffer, to_read);
-  if (n < 0)
-    {
-      xfree (buffer);
-      report_file_notify_error ("Error while reading file system events", 
Qnil);
-    }
-
-  EVENT_INIT (event);
-  event.kind = FILE_NOTIFY_EVENT;
-
-  i = 0;
-  while (i < (size_t)n)
-    {
-      struct inotify_event *ev = (struct inotify_event *) &buffer[i];
-
-      watch_object = Fassoc (make_watch_descriptor (ev->wd), watch_list);
-      if (!NILP (watch_object))
-        {
-          event.arg = inotifyevent_to_event (watch_object, ev);
-
-          /* If event was removed automatically: Drop it from watch list.  */
-          if (ev->mask & IN_IGNORED)
-            watch_list = Fdelete (watch_object, watch_list);
-
-         if (!NILP (event.arg))
-           kbd_buffer_store_event (&event);
-        }
-
-      i += sizeof (*ev) + ev->len;
-    }
-
-  xfree (buffer);
-}
-
 static uint32_t
 symbol_to_inotifymask (Lisp_Object symb)
 {
@@ -200,14 +145,6 @@ symbol_to_inotifymask (Lisp_Object symb)
 
   else if (EQ (symb, Qdont_follow))
     return IN_DONT_FOLLOW;
-  else if (EQ (symb, Qexcl_unlink))
-    return IN_EXCL_UNLINK;
-  else if (EQ (symb, Qmask_add))
-    return IN_MASK_ADD;
-  else if (EQ (symb, Qoneshot))
-    return IN_ONESHOT;
-  else if (EQ (symb, Qonlydir))
-    return IN_ONLYDIR;
 
   else if (EQ (symb, Qt) || EQ (symb, Qall_events))
     return IN_ALL_EVENTS;
@@ -221,21 +158,204 @@ symbol_to_inotifymask (Lisp_Object symb)
 static uint32_t
 aspect_to_inotifymask (Lisp_Object aspect)
 {
-  if (CONSP (aspect))
+  if (CONSP (aspect) || NILP (aspect))
     {
       Lisp_Object x = aspect;
       uint32_t mask = 0;
-      while (CONSP (x))
-        {
-          mask |= symbol_to_inotifymask (XCAR (x));
-          x = XCDR (x);
-        }
+      FOR_EACH_TAIL (x)
+       mask |= symbol_to_inotifymask (XCAR (x));
+      CHECK_LIST_END (x, aspect);
       return mask;
     }
   else
     return symbol_to_inotifymask (aspect);
 }
 
+static Lisp_Object
+inotifyevent_to_event (Lisp_Object watch, struct inotify_event const *ev)
+{
+  Lisp_Object name;
+  uint32_t mask;
+  CONS_TO_INTEGER (Fnth (make_number (3), watch), uint32_t, mask);
+
+  if (! (mask & ev->mask))
+    return Qnil;
+
+  if (ev->len > 0)
+    {
+      size_t const len = strlen (ev->name);
+      name = make_unibyte_string (ev->name, min (len, ev->len));
+      name = DECODE_FILE (name);
+    }
+  else
+    name = XCAR (XCDR (watch));
+
+  return list2 (list4 (Fcons (INTEGER_TO_CONS (ev->wd), XCAR (watch)),
+                       mask_to_aspects (ev->mask),
+                       name,
+                      INTEGER_TO_CONS (ev->cookie)),
+               Fnth (make_number (2), watch));
+}
+
+/* Add a new watch to watch-descriptor WD watching FILENAME and using
+   CALLBACK.  Returns a cons (DESCRIPTOR . ID) uniquely identifying the
+   new watch.  */
+static Lisp_Object
+add_watch (int wd, Lisp_Object filename,
+          Lisp_Object aspect, Lisp_Object callback)
+{
+  Lisp_Object descriptor = INTEGER_TO_CONS (wd);
+  Lisp_Object tail = assoc_no_quit (descriptor, watch_list);
+  Lisp_Object watch, watch_id;
+  uint32_t imask = aspect_to_inotifymask (aspect);
+  Lisp_Object mask = INTEGER_TO_CONS (imask);
+
+  EMACS_INT id = 0;
+  if (NILP (tail))
+    {
+      tail = list1 (descriptor);
+      watch_list = Fcons (tail, watch_list);
+    }
+  else
+    {
+      /* Assign a watch ID that is not already in use, by looking
+        for a gap in the existing sorted list.  */
+      for (; ! NILP (XCDR (tail)); tail = XCDR (tail), id++)
+       if (!EQ (XCAR (XCAR (XCDR (tail))), make_number (id)))
+         break;
+      if (MOST_POSITIVE_FIXNUM < id)
+       emacs_abort ();
+    }
+
+  /* Insert the newly-assigned ID into the previously-discovered gap,
+     which is possibly at the end of the list.  Inserting it there
+     keeps the list sorted.  */
+  watch_id = make_number (id);
+  watch = list4 (watch_id, filename, callback, mask);
+  XSETCDR (tail, Fcons (watch, XCDR (tail)));
+
+  return Fcons (descriptor, watch_id);
+}
+
+/* Find the watch list element (if any) matching DESCRIPTOR.  Return
+   nil if not found.  If found, return t if the first element matches
+   DESCRIPTOR; otherwise, return the cons whose cdr matches
+   DESCRIPTOR.  This lets the caller easily remove the element
+   matching DESCRIPTOR without having to search for it again, and
+   without calling Fdelete (which might quit).  */
+
+static Lisp_Object
+find_descriptor (Lisp_Object descriptor)
+{
+  Lisp_Object tail, prevtail = Qt;
+  for (tail = watch_list; !NILP (tail); prevtail = tail, tail = XCDR (tail))
+    if (equal_no_quit (XCAR (XCAR (tail)), descriptor))
+      return prevtail;
+  return Qnil;
+}
+
+/*  Remove all watches associated with the watch list element after
+    PREVTAIL, or after the first element if PREVTAIL is t.  If INVALID_P
+    is true, the descriptor is already invalid, i.e., it received a
+    IN_IGNORED event.  In this case skip calling inotify_rm_watch.  */
+static void
+remove_descriptor (Lisp_Object prevtail, bool invalid_p)
+{
+  Lisp_Object tail = CONSP (prevtail) ? XCDR (prevtail) : watch_list;
+
+  int inotify_errno = 0;
+  if (! invalid_p)
+    {
+      int wd;
+      CONS_TO_INTEGER (XCAR (XCAR (tail)), int, wd);
+      if (inotify_rm_watch (inotifyfd, wd) != 0)
+       inotify_errno = errno;
+    }
+
+  if (CONSP (prevtail))
+    XSETCDR (prevtail, XCDR (tail));
+  else
+    {
+      watch_list = XCDR (tail);
+      if (NILP (watch_list))
+       {
+         delete_read_fd (inotifyfd);
+         emacs_close (inotifyfd);
+         inotifyfd = -1;
+       }
+    }
+
+  if (inotify_errno != 0)
+    {
+      errno = inotify_errno;
+      report_file_notify_error ("Could not rm watch", XCAR (tail));
+    }
+}
+
+/*  Remove watch associated with (descriptor, id).  */
+static void
+remove_watch (Lisp_Object descriptor, Lisp_Object id)
+{
+  Lisp_Object prevtail = find_descriptor (descriptor);
+  if (NILP (prevtail))
+    return;
+
+  Lisp_Object elt = XCAR (CONSP (prevtail) ? XCDR (prevtail) : watch_list);
+  for (Lisp_Object prev = elt; !NILP (XCDR (prev)); prev = XCDR (prev))
+    if (EQ (id, XCAR (XCAR (XCDR (prev)))))
+      {
+       XSETCDR (prev, XCDR (XCDR (prev)));
+       if (NILP (XCDR (elt)))
+         remove_descriptor (prevtail, false);
+       break;
+      }
+}
+
+/* This callback is called when the FD is available for read.  The inotify
+   events are read from FD and converted into input_events.  */
+static void
+inotify_callback (int fd, void *_)
+{
+  int to_read;
+  if (ioctl (fd, FIONREAD, &to_read) < 0)
+    report_file_notify_error ("Error while retrieving file system events",
+                             Qnil);
+  USE_SAFE_ALLOCA;
+  char *buffer = SAFE_ALLOCA (to_read);
+  ssize_t n = read (fd, buffer, to_read);
+  if (n < 0)
+    report_file_notify_error ("Error while reading file system events", Qnil);
+
+  struct input_event event;
+  EVENT_INIT (event);
+  event.kind = FILE_NOTIFY_EVENT;
+
+  for (ssize_t i = 0; i < n; )
+    {
+      struct inotify_event *ev = (struct inotify_event *) &buffer[i];
+      Lisp_Object descriptor = INTEGER_TO_CONS (ev->wd);
+      Lisp_Object prevtail = find_descriptor (descriptor);
+
+      if (! NILP (prevtail))
+        {
+         Lisp_Object tail = CONSP (prevtail) ? XCDR (prevtail) : watch_list;
+         for (Lisp_Object watches = XCDR (XCAR (tail)); ! NILP (watches);
+              watches = XCDR (watches))
+            {
+              event.arg = inotifyevent_to_event (XCAR (watches), ev);
+              if (!NILP (event.arg))
+                kbd_buffer_store_event (&event);
+            }
+          /* If event was removed automatically: Drop it from watch list.  */
+          if (ev->mask & IN_IGNORED)
+           remove_descriptor (prevtail, true);
+        }
+      i += sizeof (*ev) + ev->len;
+    }
+
+  SAFE_FREE ();
+}
+
 DEFUN ("inotify-add-watch", Finotify_add_watch, Sinotify_add_watch, 3, 3, 0,
        doc: /* Add a watch for FILE-NAME to inotify.
 
@@ -264,10 +384,6 @@ close
 The following symbols can also be added to a list of aspects:
 
 dont-follow
-excl-unlink
-mask-add
-oneshot
-onlydir
 
 Watching a directory is not recursive.  CALLBACK is passed a single argument
 EVENT which contains an event structure of the format
@@ -289,47 +405,56 @@ If a directory is watched then NAME is the name of file 
that caused the event.
 COOKIE is an object that can be compared using `equal' to identify two matching
 renames (moved-from and moved-to).
 
-See inotify(7) and inotify_add_watch(2) for further information.  The inotify 
fd
-is managed internally and there is no corresponding inotify_init.  Use
-`inotify-rm-watch' to remove a watch.
-             */)
-     (Lisp_Object file_name, Lisp_Object aspect, Lisp_Object callback)
+See inotify(7) and inotify_add_watch(2) for further information.  The
+inotify fd is managed internally and there is no corresponding
+inotify_init.  Use `inotify-rm-watch' to remove a watch.
+
+Also note, that the following inotify bit-masks can not be used, due
+to the fact that descriptors are shared across different callers.
+
+IN_EXCL_UNLINK
+IN_MASK_ADD
+IN_ONESHOT
+IN_ONLYDIR  */)
+     (Lisp_Object filename, Lisp_Object aspect, Lisp_Object callback)
 {
-  uint32_t mask;
-  Lisp_Object watch_object;
   Lisp_Object encoded_file_name;
-  Lisp_Object watch_descriptor;
-  int watchdesc = -1;
+  bool dont_follow = (CONSP (aspect)
+                     ? ! NILP (Fmemq (Qdont_follow, aspect))
+                     : EQ (Qdont_follow, aspect));
+  int wd = -1;
+  uint32_t mask = (INOTIFY_DEFAULT_MASK
+                   | (dont_follow ? IN_DONT_FOLLOW : 0));
 
-  CHECK_STRING (file_name);
+  CHECK_STRING (filename);
 
   if (inotifyfd < 0)
     {
-      inotifyfd = inotify_init1 (IN_NONBLOCK|IN_CLOEXEC);
+      inotifyfd = inotify_init1 (IN_NONBLOCK | IN_CLOEXEC);
       if (inotifyfd < 0)
        report_file_notify_error ("File watching is not available", Qnil);
       watch_list = Qnil;
       add_read_fd (inotifyfd, &inotify_callback, NULL);
     }
 
-  mask = aspect_to_inotifymask (aspect);
-  encoded_file_name = ENCODE_FILE (file_name);
-  watchdesc = inotify_add_watch (inotifyfd, SSDATA (encoded_file_name), mask);
-  if (watchdesc == -1)
-    report_file_notify_error ("Could not add watch for file", file_name);
-
-  watch_descriptor = make_watch_descriptor (watchdesc);
+  encoded_file_name = ENCODE_FILE (filename);
+  wd = inotify_add_watch (inotifyfd, SSDATA (encoded_file_name), mask);
+  if (wd < 0)
+    report_file_notify_error ("Could not add watch for file", filename);
 
-  /* Delete existing watch object.  */
-  watch_object = Fassoc (watch_descriptor, watch_list);
-  if (!NILP (watch_object))
-      watch_list = Fdelete (watch_object, watch_list);
-
-  /* Store watch object in watch list.  */
-  watch_object = list3 (watch_descriptor, encoded_file_name, callback);
-  watch_list = Fcons (watch_object, watch_list);
+  return add_watch (wd, filename, aspect, callback);
+}
 
-  return watch_descriptor;
+static bool
+valid_watch_descriptor (Lisp_Object wd)
+{
+  return (CONSP (wd)
+         && (RANGED_INTEGERP (0, XCAR (wd), INT_MAX)
+             || (CONSP (XCAR (wd))
+                 && RANGED_INTEGERP ((MOST_POSITIVE_FIXNUM >> 16) + 1,
+                                     XCAR (XCAR (wd)), INT_MAX >> 16)
+                 && RANGED_INTEGERP (0, XCDR (XCAR (wd)), (1 << 16) - 1)))
+         && NATNUMP (XCDR (wd)));
 }
 
 DEFUN ("inotify-rm-watch", Finotify_rm_watch, Sinotify_rm_watch, 1, 1, 0,
@@ -337,28 +462,18 @@ DEFUN ("inotify-rm-watch", Finotify_rm_watch, 
Sinotify_rm_watch, 1, 1, 0,
 
 WATCH-DESCRIPTOR should be an object returned by `inotify-add-watch'.
 
-See inotify_rm_watch(2) for more information.
-             */)
+See inotify_rm_watch(2) for more information.  */)
      (Lisp_Object watch_descriptor)
 {
-  Lisp_Object watch_object;
-  int wd = XINT (watch_descriptor);
 
-  if (inotify_rm_watch (inotifyfd, wd) == -1)
-    report_file_notify_error ("Could not rm watch", watch_descriptor);
+  Lisp_Object descriptor, id;
 
-  /* Remove watch descriptor from watch list.  */
-  watch_object = Fassoc (watch_descriptor, watch_list);
-  if (!NILP (watch_object))
-    watch_list = Fdelete (watch_object, watch_list);
+  if (! valid_watch_descriptor (watch_descriptor))
+    report_file_notify_error ("Invalid descriptor ", watch_descriptor);
 
-  /* Cleanup if no more files are watched.  */
-  if (NILP (watch_list))
-    {
-      emacs_close (inotifyfd);
-      delete_read_fd (inotifyfd);
-      inotifyfd = -1;
-    }
+  descriptor = XCAR (watch_descriptor);
+  id = XCDR (watch_descriptor);
+  remove_watch (descriptor, id);
 
   return Qt;
 }
@@ -374,10 +489,29 @@ reason.  Removing the watch by calling `inotify-rm-watch' 
also makes
 it invalid.  */)
      (Lisp_Object watch_descriptor)
 {
-  Lisp_Object watch_object = Fassoc (watch_descriptor, watch_list);
-  return NILP (watch_object) ? Qnil : Qt;
+  if (! valid_watch_descriptor (watch_descriptor))
+    return Qnil;
+  Lisp_Object tail = assoc_no_quit (XCAR (watch_descriptor), watch_list);
+  if (NILP (tail))
+    return Qnil;
+  Lisp_Object watch = assq_no_quit (XCDR (watch_descriptor), XCDR (tail));
+  return ! NILP (watch) ? Qt : Qnil;
 }
 
+#ifdef INOTIFY_DEBUG
+DEFUN ("inotify-watch-list", Finotify_watch_list, Sinotify_watch_list, 0, 0, 0,
+       doc: /* Return a copy of the internal watch_list.  */)
+{
+  return Fcopy_sequence (watch_list);
+}
+
+DEFUN ("inotify-allocated-p", Finotify_allocated_p, Sinotify_allocated_p, 0, 
0, 0,
+       doc: /* Return non-nil, if a inotify instance is allocated.  */)
+{
+  return inotifyfd < 0 ? Qnil : Qt;
+}
+#endif
+
 void
 syms_of_inotify (void)
 {
@@ -400,10 +534,6 @@ syms_of_inotify (void)
   DEFSYM (Qclose, "close");            /* IN_CLOSE */
 
   DEFSYM (Qdont_follow, "dont-follow");        /* IN_DONT_FOLLOW */
-  DEFSYM (Qexcl_unlink, "excl-unlink");        /* IN_EXCL_UNLINK */
-  DEFSYM (Qmask_add, "mask-add");      /* IN_MASK_ADD */
-  DEFSYM (Qoneshot, "oneshot");                /* IN_ONESHOT */
-  DEFSYM (Qonlydir, "onlydir");                /* IN_ONLYDIR */
 
   DEFSYM (Qignored, "ignored");                /* IN_IGNORED */
   DEFSYM (Qisdir, "isdir");            /* IN_ISDIR */
@@ -414,6 +544,10 @@ syms_of_inotify (void)
   defsubr (&Sinotify_rm_watch);
   defsubr (&Sinotify_valid_p);
 
+#ifdef INOTIFY_DEBUG
+  defsubr (&Sinotify_watch_list);
+  defsubr (&Sinotify_allocated_p);
+#endif
   staticpro (&watch_list);
 
   Fprovide (intern_c_string ("inotify"), Qnil);
diff --git a/src/lisp.h b/src/lisp.h
index 4b9cd3c..3125bd2 100644
--- a/src/lisp.h
+++ b/src/lisp.h
@@ -3376,6 +3376,7 @@ extern Lisp_Object merge (Lisp_Object, Lisp_Object, 
Lisp_Object);
 extern Lisp_Object do_yes_or_no_p (Lisp_Object);
 extern Lisp_Object concat2 (Lisp_Object, Lisp_Object);
 extern Lisp_Object concat3 (Lisp_Object, Lisp_Object, Lisp_Object);
+extern bool equal_no_quit (Lisp_Object, Lisp_Object);
 extern Lisp_Object nconc2 (Lisp_Object, Lisp_Object);
 extern Lisp_Object assq_no_quit (Lisp_Object, Lisp_Object);
 extern Lisp_Object assoc_no_quit (Lisp_Object, Lisp_Object);
diff --git a/src/xdisp.c b/src/xdisp.c
index 8266849..af086d1 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -2716,6 +2716,7 @@ init_iterator (struct it *it, struct window *w,
       if (face_change)
        {
          face_change = false;
+         XFRAME (w->frame)->face_change = 0;
          free_all_realized_faces (Qnil);
        }
       else if (XFRAME (w->frame)->face_change)
@@ -14132,21 +14133,16 @@ redisplay_internal (void)
                     Therefore, we must redisplay this frame.  */
                  if (!f_redisplay_flag && f->redisplay)
                     goto retry_frame;
-
                   /* In some case (e.g., window resize), we notice
                      only during window updating that the window
                      content changed unpredictably (e.g., a GTK
-                     scrollbar moved) and that our previous estimation
-                     of the frame content was garbage.  We have to
-                     start over.  These cases should be rare, so going
-                     all the way back to the top of redisplay should
-                     be good enough.
-
-                     Why FRAME_WINDOW_P? See
-                     
https://lists.gnu.org/archive/html/emacs-devel/2016-10/msg00957.html
-
-                     */
-                  if (FRAME_GARBAGED_P (f) && FRAME_WINDOW_P (f))
+                     scrollbar moved, or some Lisp hook that winds up
+                     calling adjust_frame_glyphs) and that our
+                     previous estimation of the frame content was
+                     garbage.  We have to start over.  These cases
+                     should be rare, so going all the way back to the
+                     top of redisplay should be good enough.  */
+                  if (FRAME_GARBAGED_P (f))
                     goto retry;
 
                  /* Prevent various kinds of signals during display
diff --git a/src/xterm.c b/src/xterm.c
index 7856793..4f9eff6 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -10056,11 +10056,26 @@ x_set_offset (struct frame *f, register int xoff, 
register int yoff, int change_
        f->size_hint_flags |= YNegative;
       f->win_gravity = NorthWestGravity;
     }
+
   x_calc_absolute_position (f);
 
   block_input ();
   x_wm_set_size_hint (f, 0, false);
 
+#ifdef USE_GTK
+  if (x_gtk_use_window_move)
+    {
+      /* When a position change was requested and the outer GTK widget
+        has been realized already, leave it to gtk_window_move to DTRT
+        and return.  Used for Bug#25851 and Bug#25943.  */
+      if (change_gravity != 0 && FRAME_GTK_OUTER_WIDGET (f))
+       gtk_window_move (GTK_WINDOW (FRAME_GTK_OUTER_WIDGET (f)),
+                        f->left_pos, f->top_pos);
+      unblock_input ();
+      return;
+    }
+#endif /* USE_GTK */
+
   modified_left = f->left_pos;
   modified_top = f->top_pos;
 
@@ -12905,4 +12920,11 @@ state.
 Set this variable only if your window manager cannot handle the
 transition between the various maximization states.  */);
   x_frame_normalize_before_maximize = false;
+
+  DEFVAR_BOOL ("x-gtk-use-window-move", x_gtk_use_window_move,
+    doc: /* Non-nil means rely on gtk_window_move to set frame positions.
+If this variable is t, the GTK build uses the function gtk_window_move
+to set or store frame positions and disables some time consuming frame
+position adjustments.  */);
+  x_gtk_use_window_move = false;
 }
diff --git a/test/Makefile.in b/test/Makefile.in
index 5849e9c..a1b772d 100644
--- a/test/Makefile.in
+++ b/test/Makefile.in
@@ -33,6 +33,7 @@ SHELL = @SHELL@
 srcdir = @srcdir@
 VPATH = $(srcdir)
 
+FIND_DELETE = @FIND_DELETE@
 MKDIR_P = @MKDIR_P@
 
 SEPCHAR = @SEPCHAR@
@@ -123,14 +124,12 @@ endif
        $(emacs) -l ert -l $$loadfile \
          --eval "(ert-run-tests-batch-and-exit ${SELECTOR_ACTUAL})" 
${WRITE_LOG}
 
-ELFILES = $(shell find ${srcdir} -path "${srcdir}/manual" -prune -o \
-               -path "*resources" -prune -o -name "*el" -print)
-## .elc files may be in a different directory for out of source builds
-ELCFILES = $(patsubst %.el,%.elc, \
-               $(patsubst $(srcdir)%,.%,$(ELFILES)))
-LOGFILES = $(patsubst %.elc,%.log,${ELCFILES})
-LOGSAVEFILES  = $(patsubst %.elc,%.log~,${ELCFILES})
-TESTS = $(subst ${srcdir}/,,$(LOGFILES:.log=))
+ELFILES := $(shell find ${srcdir} -path "${srcdir}/manual" -prune -o \
+               -name "*resources" -prune -o -name "*.el" -print)
+## .log files may be in a different directory for out of source builds
+LOGFILES := $(patsubst %.el,%.log, \
+               $(patsubst $(srcdir)/%,%,$(ELFILES)))
+TESTS := $(LOGFILES:.log=)
 
 ## If we have to interrupt a hanging test, preserve the log so we can
 ## see what the problem was.
@@ -138,15 +137,24 @@ TESTS = $(subst ${srcdir}/,,$(LOGFILES:.log=))
 
 .PHONY: ${TESTS}
 
-## The short aliases that always re-run the tests, with no logging.
-## Define an alias both with and without the directory name for ease
-## of use.
 define test_template
-$(1):
-       @test ! -f ./$(1).log || mv ./$(1).log ./$(1).log~
-       @${MAKE} ./$(1).log WRITE_LOG=
-
-$(notdir $(1)): $(1)
+  ## A test FOO-tests depends on the source file with the similar
+  ## name, unless FOO itself contains the string '-tests/'.
+  ## The similar name is FOO.c if FOO begins with 'src/', FOO.el
+  ## otherwise.  Although this heuristic does not identify all the
+  ## dependencies, it is better than nothing.
+  ifeq (,$(patsubst %-tests,,$(1))$(findstring -tests/,$(1)))
+    $(1).log: $(patsubst %-tests,$(srcdir)/../%,$(1))$(if \
+                                       $(patsubst src/%,,$(1)),.el,.c)
+  endif
+
+  ## Short aliases that always re-run the tests, with no logging.
+  ## Define both with and without the directory name for ease of use.
+  .PHONY: $(1) $(notdir $(1))
+  $(1):
+       @test ! -f $(1).log || mv $(1).log $(1).log~
+       @$(MAKE) $(1).log WRITE_LOG=
+  $(notdir $(1)): $(1)
 endef
 
 $(foreach test,${TESTS},$(eval $(call test_template,${test})))
@@ -158,11 +166,6 @@ $(foreach test,${TESTS},$(eval $(call 
test_template,${test})))
 check-no-automated-subdir:
        test ! -d $(srcdir)/automated
 
-## Include dependencies between test files and the files they test.
-## We could do this without the file and eval directly, but then we
-## would have to run Emacs for every make invocation, and it might not
-## be available during clean.
--include make-test-deps.mk
 ## Rerun all default tests.
 check: mostlyclean check-no-automated-subdir
        @${MAKE} check-doit SELECTOR="${SELECTOR_ACTUAL}"
@@ -174,9 +177,7 @@ check-expensive: mostlyclean check-no-automated-subdir
 
 ## Re-run all tests which are outdated. A test is outdated if its
 ## logfile is out-of-date with either the test file, or the source
-## files that the tests depend on. The source file dependencies are
-## determined by a heuristic and does not identify the full dependency
-## graph. See make-test-deps.emacs-lisp for details.
+## files that the tests depend on.  See test_template.
 .PHONY: check-maybe
 check-maybe: check-no-automated-subdir
        @${MAKE} check-doit SELECTOR="${SELECTOR_ACTUAL}"
@@ -184,7 +185,7 @@ check-maybe: check-no-automated-subdir
 ## Run the tests.
 .PHONY: check-doit
 check-doit: ${LOGFILES}
-       $(emacs) -l ert -f ert-summarize-tests-batch-and-exit $^
+       @$(emacs) -l ert -f ert-summarize-tests-batch-and-exit $^
 
 .PHONY: mostlyclean clean bootstrap-clean distclean maintainer-clean
 
@@ -193,21 +194,12 @@ mostlyclean:
        rm -f *.tmp
 
 clean:
-       -rm -f ${LOGFILES} ${LOGSAVEFILES}
-       -rm make-test-deps.mk
+       find . '(' -name '*.log' -o -name '*.log~' ')' $(FIND_DELETE)
 
 bootstrap-clean: clean
-       -rm -f ${ELCFILES}
+       find $(srcdir) -name '*.elc' $(FIND_DELETE)
 
 distclean: clean
        rm -f Makefile
 
 maintainer-clean: distclean bootstrap-clean
-
-make-test-deps.mk: $(ELFILES) make-test-deps.emacs-lisp
-       $(EMACS) --batch -l $(srcdir)/make-test-deps.emacs-lisp \
-       --eval "(make-test-deps \"$(srcdir)\")" \
-       2> address@hidden
-       # Hack to elide any CANNOT_DUMP=yes chatter.
-       sed '/\.log: /!d' address@hidden >$@
-       rm -f address@hidden
diff --git a/test/file-organization.org b/test/file-organization.org
index 8d9c671..4d76c00 100644
--- a/test/file-organization.org
+++ b/test/file-organization.org
@@ -50,9 +50,9 @@ not run by the "make check" command and its derivatives.
 Resource files for tests (containing test data) should reside in a
 directory named after the feature with a ~-resources~ suffix, and
 located in the same directory as the feature.  Hence, the lisp file
-~flymake.el~ should have test files in
-~/test/automated/lisp/progmodes/flymake-tests.el~ should reside in a
-directory called ~/test/automated/lisp/progmodes/flymake-resources~.
+~lisp/progmodes/flymake.el~, with tests in
+~test/lisp/progmodes/flymake-tests.el~, should have resources in a
+directory called ~test/lisp/progmodes/flymake-resources~.
 
 No guidance is given for the organization of resource files inside the
 ~-resource~ directory; files can be organized at the author's
diff --git a/test/lisp/dired-x-tests.el b/test/lisp/dired-x-tests.el
new file mode 100644
index 0000000..e8352a4
--- /dev/null
+++ b/test/lisp/dired-x-tests.el
@@ -0,0 +1,53 @@
+;;; dired-x-tests.el --- Test suite for dired-x. -*- lexical-binding: t -*-
+
+;; Copyright (C) 2017 Free Software Foundation, Inc.
+
+;; 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/>.
+
+;;; Code:
+(require 'ert)
+(require 'dired-x)
+
+
+(ert-deftest dired-test-bug25942 ()
+  "Test for http://debbugs.gnu.org/25942 ."
+  (let* ((dirs (list "Public" "Music"))
+         (files (list ".bashrc" "bar.c" "foo.c" "c" ".c"))
+         (all-but-c
+          (sort
+           (append (copy-sequence dirs)
+                   (delete "c" (copy-sequence files)))
+           #'string<))
+         (dir (make-temp-file "Bug25942" 'dir))
+         (extension "c"))
+    (unwind-protect
+        (progn
+          (dolist (d dirs)
+            (make-directory (expand-file-name d dir)))
+          (dolist (f files)
+            (write-region nil nil (expand-file-name f dir)))
+          (dired dir)
+          (dired-mark-extension extension)
+          (should (equal '("bar.c" "foo.c")
+                         (sort (dired-get-marked-files 'local) #'string<)))
+          (dired-unmark-all-marks)
+          (dired-mark-suffix extension)
+          (should (equal all-but-c
+                         (sort (dired-get-marked-files 'local) #'string<))))
+      (delete-directory dir 'recursive))))
+
+(provide 'dired-x-tests)
+;; dired-x-tests.el ends here
diff --git a/test/lisp/emacs-lisp/cl-lib-tests.el 
b/test/lisp/emacs-lisp/cl-lib-tests.el
index 5edc3e7..093cb34 100644
--- a/test/lisp/emacs-lisp/cl-lib-tests.el
+++ b/test/lisp/emacs-lisp/cl-lib-tests.el
@@ -493,4 +493,30 @@
   (should (cl-typep '* 'cl-lib-test-type))
   (should-not (cl-typep 1 'cl-lib-test-type)))
 
+(ert-deftest cl-lib-symbol-macrolet ()
+  ;; bug#26325
+  :expected-result :failed
+  (should (equal (cl-flet ((f (x) (+ x 5)))
+                   (let ((x 5))
+                     (f (+ x 6))))
+                 ;; Go through `eval', otherwise the macro-expansion
+                 ;; error prevents running the whole test suite :-(
+                 (eval '(cl-symbol-macrolet ((f (+ x 6)))
+                          (cl-flet ((f (x) (+ x 5)))
+                            (let ((x 5))
+                              (f f))))
+                       t))))
+
+(defmacro cl-lib-symbol-macrolet-4+5 ()
+  ;; bug#26068
+  (let* ((sname "x")
+         (s1 (make-symbol sname))
+         (s2 (make-symbol sname)))
+    `(cl-symbol-macrolet ((,s1 4)
+                          (,s2 5))
+       (+ ,s1 ,s2))))
+
+(ert-deftest cl-lib-symbol-macrolet-2 ()
+  (should (equal (cl-lib-symbol-macrolet-4+5) (+ 4 5))))
+
 ;;; cl-lib.el ends here
diff --git a/test/lisp/emacs-lisp/lisp-mode-tests.el 
b/test/lisp/emacs-lisp/lisp-mode-tests.el
index 2801f23..8e3f2e1 100644
--- a/test/lisp/emacs-lisp/lisp-mode-tests.el
+++ b/test/lisp/emacs-lisp/lisp-mode-tests.el
@@ -77,6 +77,10 @@ noindent\" 3
       (search-backward "d2")
       (up-list -1)
       (indent-sexp)
+      (should (equal (buffer-string) correct))
+      (backward-sexp)
+      (end-of-line)
+      (indent-sexp)
       (should (equal (buffer-string) correct)))))
 
 (ert-deftest indent-sexp-in-string ()
diff --git a/test/lisp/filenotify-tests.el b/test/lisp/filenotify-tests.el
index 7208032..54e7ebf 100644
--- a/test/lisp/filenotify-tests.el
+++ b/test/lisp/filenotify-tests.el
@@ -294,13 +294,20 @@ This returns only for the local case and gfilenotify; 
otherwise it is nil.
                (file-notify-add-watch
                 temporary-file-directory '(change attribute-change) #'ignore)))
         (file-notify-rm-watch file-notify--test-desc)
-        (write-region "any text" nil file-notify--test-tmpfile nil 'no-message)
+
+        ;; File monitors like kqueue insist, that the watched file
+        ;; exists.  Directory monitors are not bound to this
+        ;; restriction.
+        (when (string-equal (file-notify--test-library) "kqueue")
+          (write-region
+           "any text" nil file-notify--test-tmpfile nil 'no-message))
         (should
          (setq file-notify--test-desc
                (file-notify-add-watch
                 file-notify--test-tmpfile '(change attribute-change) 
#'ignore)))
         (file-notify-rm-watch file-notify--test-desc)
-        (delete-file file-notify--test-tmpfile)
+        (when (string-equal (file-notify--test-library) "kqueue")
+          (delete-file file-notify--test-tmpfile))
 
         ;; Check error handling.
         (should-error (file-notify-add-watch 1 2 3 4)
@@ -340,20 +347,19 @@ This returns only for the local case and gfilenotify; 
otherwise it is nil.
   (expand-file-name
    (make-temp-name "file-notify-test") temporary-file-directory))
 
-;; This test is inspired by Bug#26127.
+;; This test is inspired by Bug#26126 and Bug#26127.
 (ert-deftest file-notify-test02-rm-watch ()
   "Check `file-notify-rm-watch'."
   (skip-unless (file-notify--test-local-enabled))
 
   (unwind-protect
+      ;; Check, that `file-notify-rm-watch' works.
       (progn
-        ;; Check, that `file-notify-rm-watch' works.
         (should
          (setq file-notify--test-desc
                (file-notify-add-watch
                 temporary-file-directory '(change) #'ignore)))
         (file-notify-rm-watch file-notify--test-desc)
-
         ;; Check, that any parameter is accepted.
         (condition-case err
             (progn
@@ -363,9 +369,19 @@ This returns only for the local case and gfilenotify; 
otherwise it is nil.
               (file-notify-rm-watch 'foo))
           (error (ert-fail err)))
 
-        ;; Check, that no error is returned removing a watch descriptor twice.
+        ;; The environment shall be cleaned up.
+        (file-notify--test-cleanup-p))
+
+    ;; Cleanup.
+    (file-notify--test-cleanup))
+
+  (unwind-protect
+      ;; Check, that no error is returned removing a watch descriptor twice.
+      (progn
         (setq file-notify--test-tmpfile (file-notify--test-make-temp-name)
               file-notify--test-tmpfile1 (file-notify--test-make-temp-name))
+        (write-region "any text" nil file-notify--test-tmpfile nil 'no-message)
+        (write-region "any text" nil file-notify--test-tmpfile1 nil 
'no-message)
         (should
          (setq file-notify--test-desc
                (file-notify-add-watch
@@ -374,14 +390,51 @@ This returns only for the local case and gfilenotify; 
otherwise it is nil.
          (setq file-notify--test-desc1
                (file-notify-add-watch
                 file-notify--test-tmpfile1 '(change) #'ignore)))
+        ;; Remove `file-notify--test-desc' twice.
         (file-notify-rm-watch file-notify--test-desc)
         (file-notify-rm-watch file-notify--test-desc)
         (file-notify-rm-watch file-notify--test-desc1)
+        (delete-file file-notify--test-tmpfile)
+        (delete-file file-notify--test-tmpfile1)
 
         ;; The environment shall be cleaned up.
         (file-notify--test-cleanup-p))
 
     ;; Cleanup.
+    (file-notify--test-cleanup))
+
+  (unwind-protect
+      ;; Check, that removing watch descriptors out of order do not harm.
+      (let (results)
+        (cl-flet ((first-callback (event)
+                   (when (eq (nth 1 event) 'deleted) (push 1 results)))
+                  (second-callback (event)
+                   (when (eq (nth 1 event) 'deleted) (push 2 results))))
+          (setq file-notify--test-tmpfile (file-notify--test-make-temp-name))
+          (write-region
+           "any text" nil file-notify--test-tmpfile nil 'no-message)
+          (should
+           (setq file-notify--test-desc
+                 (file-notify-add-watch
+                  file-notify--test-tmpfile
+                  '(change) #'first-callback)))
+          (should
+           (setq file-notify--test-desc1
+                 (file-notify-add-watch
+                  file-notify--test-tmpfile
+                  '(change) #'second-callback)))
+          ;; Remove first watch.
+          (file-notify-rm-watch file-notify--test-desc)
+          ;; Only the second callback shall run.
+          (delete-file file-notify--test-tmpfile)
+          (file-notify--wait-for-events
+           (file-notify--test-timeout) results)
+          (should (equal results (list 2)))
+
+          ;; The environment shall be cleaned up.
+          (file-notify--test-cleanup-p)))
+
+    ;; Cleanup.
     (file-notify--test-cleanup)))
 
 (file-notify--deftest-remote file-notify-test02-rm-watch
diff --git a/test/lisp/net/tramp-tests.el b/test/lisp/net/tramp-tests.el
index 45b4ff2..2a4ef74 100644
--- a/test/lisp/net/tramp-tests.el
+++ b/test/lisp/net/tramp-tests.el
@@ -1,4 +1,4 @@
-;;; tramp-tests.el --- Tests of remote file access
+;;; tramp-tests.el --- Tests of remote file access  -*- lexical-binding:t -*-
 
 ;; Copyright (C) 2013-2017 Free Software Foundation, Inc.
 
@@ -37,6 +37,7 @@
 
 ;;; Code:
 
+(require 'dired)
 (require 'ert)
 (require 'tramp)
 (require 'vc)
@@ -44,11 +45,11 @@
 (require 'vc-git)
 (require 'vc-hg)
 
-(autoload 'dired-uncache "dired")
 (declare-function tramp-find-executable "tramp-sh")
 (declare-function tramp-get-remote-path "tramp-sh")
 (declare-function tramp-get-remote-stat "tramp-sh")
 (declare-function tramp-get-remote-perl "tramp-sh")
+(defvar auto-save-file-name-transforms)
 (defvar tramp-copy-size-limit)
 (defvar tramp-persistency-file-name)
 (defvar tramp-remote-process-environment)
@@ -2083,17 +2084,20 @@ This tests also `make-symbolic-link', `file-truename' 
and `add-name-to-file'."
   (skip-unless
    (and (fboundp 'make-nearby-temp-file) (fboundp 'temporary-file-directory)))
 
+  ;; `make-nearby-temp-file' and `temporary-file-directory' exists
+  ;; since Emacs 26.  We don't want to see compiler warnings for older
+  ;; Emacsen."
   (let ((default-directory tramp-test-temporary-file-directory)
        tmp-file)
     ;; The remote host shall know a temporary file directory.
-    (should (stringp (temporary-file-directory)))
+    (should (stringp (with-no-warnings (temporary-file-directory))))
     (should
      (string-equal
       (file-remote-p default-directory)
-      (file-remote-p (temporary-file-directory))))
+      (file-remote-p (with-no-warnings (temporary-file-directory)))))
 
     ;; The temporary file shall be located on the remote host.
-    (setq tmp-file (make-nearby-temp-file "tramp-test"))
+    (setq tmp-file (with-no-warnings (make-nearby-temp-file "tramp-test")))
     (should (file-exists-p tmp-file))
     (should (file-regular-p tmp-file))
     (should
@@ -2103,7 +2107,7 @@ This tests also `make-symbolic-link', `file-truename' and 
`add-name-to-file'."
     (delete-file tmp-file)
     (should-not (file-exists-p tmp-file))
 
-    (setq tmp-file (make-nearby-temp-file "tramp-test" 'dir))
+    (setq tmp-file (with-no-warnings (make-nearby-temp-file "tramp-test" 
'dir)))
     (should (file-exists-p tmp-file))
     (should (file-directory-p tmp-file))
     (delete-directory tmp-file)
@@ -2582,7 +2586,7 @@ process sentinels.  They shall not disturb each other."
            ;; Create temporary buffers.  The number of buffers
            ;; corresponds to the number of processes; it could be
            ;; increased in order to make pressure on Tramp.
-           (dotimes (i 5)
+           (dotimes (_i 5)
              (add-to-list 'buffers (generate-new-buffer "*temp*")))
 
            ;; Open asynchronous processes.  Set process sentinel.
diff --git a/test/lisp/progmodes/js-tests.el b/test/lisp/progmodes/js-tests.el
index e030675..8e1bac1 100644
--- a/test/lisp/progmodes/js-tests.el
+++ b/test/lisp/progmodes/js-tests.el
@@ -140,6 +140,43 @@ if (!/[ (:,='\"]/.test(value)) {
       (font-lock-ensure)
       (should (eq (get-text-property (point) 'face) (caddr test))))))
 
+(ert-deftest js-mode-propertize-bug-1 ()
+  (with-temp-buffer
+    (js-mode)
+    (save-excursion (insert "x"))
+    (insert "/")
+    ;; The bug was a hang.
+    (should t)))
+
+(ert-deftest js-mode-propertize-bug-2 ()
+  (with-temp-buffer
+    (js-mode)
+    (insert "function f() {
+    function g()
+    {
+        1 / 2;
+    }
+
+    function h() {
+")
+    (save-excursion
+      (insert "
+        00000000000000000000000000000000000000000000000000;
+        00000000000000000000000000000000000000000000000000;
+        00000000000000000000000000000000000000000000000000;
+        00000000000000000000000000000000000000000000000000;
+        00000000000000000000000000000000000000000000000000;
+        00000000000000000000000000000000000000000000000000;
+        00000000000000000000000000000000000000000000000000;
+        00000000000000000000000000000000000000000000000000;
+        00;
+    }
+}
+"))
+    (insert "/")
+    ;; The bug was a hang.
+    (should t)))
+
 (provide 'js-tests)
 
 ;;; js-tests.el ends here
diff --git a/test/lisp/progmodes/python-tests.el 
b/test/lisp/progmodes/python-tests.el
index 1e6b867..2f4c2fb 100644
--- a/test/lisp/progmodes/python-tests.el
+++ b/test/lisp/progmodes/python-tests.el
@@ -5314,6 +5314,25 @@ class SomeClass:
       (or enabled (hs-minor-mode -1)))))
 
 
+(ert-deftest python-tests--python-nav-end-of-statement--infloop ()
+  "Checks that `python-nav-end-of-statement' doesn't infloop in a
+buffer with overlapping strings."
+  (python-tests-with-temp-buffer "''' '\n''' ' '\n"
+    (syntax-propertize (point-max))
+    ;; Create a situation where strings nominally overlap.  This
+    ;; shouldn't happen in practice, but apparently it can happen when
+    ;; a package calls `syntax-ppss' in a narrowed buffer during JIT
+    ;; lock.
+    (put-text-property 4 5 'syntax-table (string-to-syntax "|"))
+    (remove-text-properties 8 9 '(syntax-table nil))
+    (goto-char 4)
+    (setq-local syntax-propertize-function nil)
+    ;; The next form should not infloop.  We have to disable
+    ;; ‘debug-on-error’ so that ‘cl-assert’ doesn’t call the debugger.
+    (should-error (let ((debug-on-error nil))
+                    (python-nav-end-of-statement)))
+    (should (eolp))))
+
 
 (provide 'python-tests)
 
diff --git a/test/lisp/url/url-auth-tests.el b/test/lisp/url/url-auth-tests.el
index 11e5a47..30636db 100644
--- a/test/lisp/url/url-auth-tests.el
+++ b/test/lisp/url/url-auth-tests.el
@@ -77,6 +77,49 @@ server's WWW-Authenticate header field.")
              :expected-ha2 "b44272ea65ee4af7fb26c5dba58f6863"
              :expected-response "0d84884d967e04440efc77e9e2b5b561")))
 
+(ert-deftest url-auth-test-colonjoin ()
+  "Check joining strings with `:'."
+  (should (string= (url-digest-auth-colonjoin) ""))
+  (should (string= (url-digest-auth-colonjoin nil) ""))
+  (should (string= (url-digest-auth-colonjoin nil nil nil) "::"))
+  (should (string= (url-digest-auth-colonjoin "") ""))
+  (should (string= (url-digest-auth-colonjoin "" "") ":"))
+  (should (string= (url-digest-auth-colonjoin "one") "one"))
+  (should (string= (url-digest-auth-colonjoin "one" "two" "three") 
"one:two:three")))
+
+(ert-deftest url-auth-test-digest-ha1 ()
+  "Check HA1 computation."
+  (dolist (row url-auth-test-challenges)
+    (should (string= (url-digest-auth-make-ha1 (plist-get row :username)
+                                               (plist-get row :realm)
+                                               (plist-get row :password))
+                     (plist-get row :expected-ha1)
+                     ))))
+
+(ert-deftest url-auth-test-digest-ha2 ()
+  "Check HA2 computation."
+  (dolist (row url-auth-test-challenges)
+    (should (string= (url-digest-auth-make-ha2 (plist-get row :method)
+                                               (plist-get row :uri))
+                     (plist-get row :expected-ha2)))))
+
+(ert-deftest url-auth-test-digest-request-digest ()
+  "Check digest response value."
+  (dolist (row url-auth-test-challenges)
+    (should (string= (plist-get row :expected-response)
+                     (if (plist-member row :qop)
+                         (url-digest-auth-make-request-digest-qop
+                          (plist-get row :qop)
+                          (plist-get row :expected-ha1)
+                          (plist-get row :expected-ha2)
+                          (plist-get row :nonce)
+                          (plist-get row :nc)
+                          (plist-get row :cnonce))
+                       (url-digest-auth-make-request-digest
+                        (plist-get row :expected-ha1)
+                        (plist-get row :expected-ha2)
+                        (plist-get row :nonce)))))))
+
 (ert-deftest url-auth-test-digest-create-key ()
   "Check user credentials in their hashed form."
   (dolist (challenge url-auth-test-challenges)
@@ -223,14 +266,12 @@ test and cannot be passed by arguments to 
`url-digest-auth'."
           (progn
             ;; We don't know these, just check that they exists.
             (should (string-match-p ".*response=\".*?\".*" auth))
-            ;; url-digest-auth doesn't return these AFAICS.
-;;;            (should (string-match-p ".*nc=\".*?\".*" auth))
-;;;            (should (string-match-p ".*cnonce=\".*?\".*" auth))
-            )
+            (should (string-match-p ".*nc=\".*?\".*" auth))
+            (should (string-match-p ".*cnonce=\".*?\".*" auth)))
         (should (string-match ".*response=\"\\(.*?\\)\".*" auth))
         (should (string= (match-string 1 auth)
                          (plist-get challenge :expected-response))))
-      )))
+        )))
 
 (ert-deftest url-auth-test-digest-auth-opaque ()
   "Check that `opaque' value is added to result when presented by
diff --git a/test/lisp/vc/ediff-ptch-tests.el b/test/lisp/vc/ediff-ptch-tests.el
index 912c6b1..387786c 100644
--- a/test/lisp/vc/ediff-ptch-tests.el
+++ b/test/lisp/vc/ediff-ptch-tests.el
@@ -22,7 +22,7 @@
 (require 'ert)
 (require 'ediff-ptch)
 
-(ert-deftest ibuffer-test-bug25010 ()
+(ert-deftest ediff-ptch-test-bug25010 ()
   "Test for http://debbugs.gnu.org/25010 ."
   (with-temp-buffer
     (insert "diff --git a/lisp/vc/ediff-ptch.el b/lisp/vc/ediff-ptch.el
@@ -38,5 +38,72 @@ index 6a07f80..6e8e947 100644
              (match-string 1))))
       (should-not (string-suffix-p "@@" filename)))))
 
+
+(ert-deftest ediff-ptch-test-bug26084 ()
+  "Test for http://debbugs.gnu.org/26084 ."
+  (skip-unless (executable-find "git"))
+  (skip-unless (executable-find ediff-patch-program))
+  (let* ((tmpdir (make-temp-file "ediff-ptch-test" t))
+         (default-directory (file-name-as-directory tmpdir))
+         (patch (make-temp-file "ediff-ptch-test"))
+         (qux (expand-file-name "qux.txt" tmpdir))
+         (bar (expand-file-name "bar.txt" tmpdir))
+         (git-program (executable-find "git")))
+    ;; Create repository.
+    (with-temp-buffer
+      (insert "qux here\n")
+      (write-region nil nil qux nil 'silent)
+      (erase-buffer)
+      (insert "bar here\n")
+      (write-region nil nil bar nil 'silent))
+    (call-process git-program nil nil nil "init")
+    (call-process git-program nil nil nil "add" ".")
+    (call-process git-program nil nil nil "commit" "-m" "Test repository.")
+    ;; Update repo., save the diff and reset to initial state.
+    (with-temp-buffer
+      (insert "foo here\n")
+      (write-region nil nil qux nil 'silent)
+      (write-region nil nil bar nil 'silent))
+    (call-process git-program nil `(:file ,patch) nil "diff")
+    (call-process git-program nil nil nil "reset" "--hard" "HEAD")
+    (find-file patch)
+    (unwind-protect
+        (let* ((info
+                (progn (ediff-map-patch-buffer (current-buffer)) 
ediff-patch-map))
+               (patch1
+                (buffer-substring-no-properties
+                 (car (nth 3 (car info)))
+                 (car (nth 4 (car info)))))
+               (patch2
+                (buffer-substring-no-properties
+                 (car (nth 3 (cadr info)))
+                 (car (nth 4 (cadr info))))))
+          ;; Apply both patches.
+          (dolist (x (list (cons patch1 bar) (cons patch2 qux)))
+            (with-temp-buffer
+              (insert (car x))
+              (call-process-region (point-min)
+                                   (point-max)
+                                   ediff-patch-program
+                                   nil nil nil
+                                   "-b" (cdr x))))
+          ;; Check backup files were saved correctly.
+          (dolist (x (list qux bar))
+            (let ((backup
+                   (car
+                    (directory-files
+                     tmpdir 'full
+                     (concat (file-name-nondirectory x) ".")))))
+              (should-not
+               (string= (with-temp-buffer
+                          (insert-file-contents x)
+                          (buffer-string))
+                        (with-temp-buffer
+                          (insert-file-contents backup)
+                          (buffer-string))))))
+          (delete-directory tmpdir 'recursive)
+          (delete-file patch)))))
+
+
 (provide 'ediff-ptch-tests)
 ;;; ediff-ptch-tests.el ends here
diff --git a/test/make-test-deps.emacs-lisp b/test/make-test-deps.emacs-lisp
deleted file mode 100644
index 609e927..0000000
--- a/test/make-test-deps.emacs-lisp
+++ /dev/null
@@ -1,98 +0,0 @@
-;; -*- emacs-lisp -*-
-
-;; Copyright (C) 2015-2017 Free Software Foundation, Inc.
-
-;; 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 file generates dependencies between test files and the files
-;; that they test.
-
-;; It has an .emacs-lisp extension because it makes the Makefile easier!
-
-(require 'seq)
-
-(defun make-test-deps (src-dir)
-  (let ((src-dir (file-truename src-dir)))
-    (message
-     "%s"
-     (concat
-      (make-test-deps-lisp src-dir)
-      (make-test-deps-src src-dir)))))
-
-(defun make-test-deps-lisp (src-dir)
-  (mapconcat
-   (lambda (file-without-suffix)
-     (format "./%s-tests.log: %s/../%s.el\n"
-             file-without-suffix
-             src-dir
-             file-without-suffix))
-   (make-test-test-files src-dir "lisp") ""))
-
-(defun make-test-deps-src (src-dir)
-  (mapconcat
-   (lambda (file-without-suffix)
-     (format "./%s-tests.log: %s/../%s.c\n"
-             file-without-suffix
-             src-dir
-             file-without-suffix))
-   (make-test-test-files src-dir "src") ""))
-
-(defun make-test-test-files (src-dir sub-src-dir)
-  (make-test-munge-files
-   src-dir
-   (directory-files-recursively
-    (concat src-dir "/"  sub-src-dir)
-    ".*-tests.el$")))
-
-(defun make-test-munge-files (src-dir files)
-  (make-test-sans-suffix
-   (make-test-de-stem
-    src-dir
-    (make-test-no-legacy
-     (make-test-no-test-dir
-      (make-test-no-resources
-       files))))))
-
-(defun make-test-sans-suffix (files)
-  (mapcar
-   (lambda (file)
-     (substring file 0 -9))
-   files))
-
-(defun make-test-de-stem (stem files)
-  (mapcar
-   (lambda (file)
-     (substring
-      file
-      (+ 1 (length stem))))
-   files))
-
-(defun make-test-no-legacy (list)
-  (make-test-remove list "legacy/"))
-
-(defun make-test-no-resources (list)
-  (make-test-remove list "-resources/"))
-
-(defun make-test-no-test-dir (list)
-  (make-test-remove list "-tests/"))
-
-(defun make-test-remove (list match)
-  (seq-remove
-   (lambda (file)
-     (string-match-p match file))
-   list))
diff --git a/test/src/inotify-tests.el b/test/src/inotify-tests.el
index f30aecc..987e1fc 100644
--- a/test/src/inotify-tests.el
+++ b/test/src/inotify-tests.el
@@ -28,6 +28,13 @@
 (declare-function inotify-add-watch "inotify.c" (file-name aspect callback))
 (declare-function inotify-rm-watch "inotify.c" (watch-descriptor))
 
+(ert-deftest inotify-valid-p-simple ()
+  "Simple tests for `inotify-valid-p'."
+  (skip-unless (featurep 'inotify))
+  (should-not (inotify-valid-p 0))
+  (should-not (inotify-valid-p nil))
+  (should-not (inotify-valid-p '(0 . 0))))
+
 ;; (ert-deftest filewatch-file-watch-aspects-check ()
 ;;   "Test whether `file-watch' properly checks the aspects."
 ;;   (let ((temp-file (make-temp-file "filewatch-aspects")))
@@ -56,7 +63,9 @@
              (insert "Foo\n"))
            (read-event nil nil 5)
            (should (> events 0)))
+       (should (inotify-valid-p wd))
        (inotify-rm-watch wd)
+       (should-not (inotify-valid-p wd))
        (delete-file temp-file)))))
 
 (provide 'inotify-tests)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]