emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] pdumper 1527215: Merge remote-tracking branch 'origin/mast


From: Daniel Colascione
Subject: [Emacs-diffs] pdumper 1527215: Merge remote-tracking branch 'origin/master' into pdumper
Date: Mon, 19 Feb 2018 12:15:57 -0500 (EST)

branch: pdumper
commit 152721551f4d80d6ae2d4ebe45d151290fe51049
Merge: b7da1a5 b877afd
Author: Daniel Colascione <address@hidden>
Commit: Daniel Colascione <address@hidden>

    Merge remote-tracking branch 'origin/master' into pdumper
---
 admin/grammars/c.by                     |   4 +-
 admin/notes/unicode                     |   2 +-
 configure.ac                            |  92 ++++----
 doc/emacs/basic.texi                    |  22 +-
 doc/emacs/building.texi                 |  35 +--
 doc/emacs/cmdargs.texi                  |  17 +-
 doc/emacs/custom.texi                   |  24 +-
 doc/emacs/dired.texi                    |  11 +-
 doc/emacs/docstyle.texi                 |   6 +
 doc/emacs/emacs.texi                    |   1 +
 doc/emacs/files.texi                    |  11 +-
 doc/emacs/fixit.texi                    |  31 +--
 doc/emacs/fortran-xtra.texi             |  42 ++--
 doc/emacs/frames.texi                   |  20 +-
 doc/emacs/glossary.texi                 |  58 +++--
 doc/emacs/help.texi                     |   2 +-
 doc/emacs/killing.texi                  |   2 +-
 doc/emacs/macos.texi                    |   6 +-
 doc/emacs/maintaining.texi              |  68 +++---
 doc/emacs/mark.texi                     |   2 +-
 doc/emacs/misc.texi                     |  36 ++-
 doc/emacs/msdos-xtra.texi               |   2 +-
 doc/emacs/msdos.texi                    | 124 +++++++----
 doc/emacs/mule.texi                     |  34 ++-
 doc/emacs/package.texi                  |  82 ++++---
 doc/emacs/programs.texi                 | 244 ++++++++++----------
 doc/emacs/regs.texi                     |   2 +-
 doc/emacs/rmail.texi                    |   2 +-
 doc/emacs/search.texi                   |  32 +--
 doc/emacs/text.texi                     |   8 +-
 doc/emacs/trouble.texi                  |   2 +-
 doc/emacs/vc1-xtra.texi                 |   7 +-
 doc/emacs/windows.texi                  |   2 +-
 doc/emacs/xresources.texi               |   4 +-
 doc/lispintro/emacs-lisp-intro.texi     |   4 +-
 doc/lispref/buffers.texi                |   2 +-
 doc/lispref/debugging.texi              |  60 +++--
 doc/lispref/display.texi                |  21 +-
 doc/lispref/edebug.texi                 |   2 +-
 doc/lispref/internals.texi              |   7 +
 doc/lispref/os.texi                     |  39 +++-
 doc/lispref/package.texi                |  32 ++-
 doc/lispref/text.texi                   |   2 +-
 doc/lispref/windows.texi                |   2 +-
 doc/misc/autotype.texi                  |   2 +-
 doc/misc/cc-mode.texi                   |   2 +-
 doc/misc/efaq.texi                      |  33 ++-
 doc/misc/eshell.texi                    |   2 +-
 doc/misc/gnus-faq.texi                  |   8 +-
 doc/misc/org.texi                       |   6 +-
 doc/misc/sc.texi                        |   4 +-
 doc/misc/tramp.texi                     | 146 +++++++-----
 etc/CALC-NEWS                           |   2 +-
 etc/ETAGS.EBNF                          |   2 +-
 etc/NEWS                                |  27 +++
 etc/NEWS.20                             |  15 +-
 etc/NEWS.21                             |   4 +-
 etc/NEWS.22                             |   2 +-
 etc/NEWS.26                             |   8 +-
 etc/ORG-NEWS                            |   2 +-
 etc/PROBLEMS                            |   6 +-
 lisp/abbrev.el                          |   8 +-
 lisp/bindings.el                        |   2 +-
 lisp/calendar/diary-lib.el              |   3 +-
 lisp/calendar/holidays.el               |   2 +-
 lisp/calendar/icalendar.el              |  80 ++++---
 lisp/calendar/todo-mode.el              |   2 +-
 lisp/cedet/ede/cpp-root.el              |   2 +-
 lisp/cedet/ede/files.el                 |   2 +-
 lisp/cedet/semantic/analyze.el          |   2 +-
 lisp/cedet/semantic/dep.el              |   2 +-
 lisp/cedet/semantic/lex.el              |   2 +-
 lisp/cedet/semantic/util-modes.el       |   2 +-
 lisp/cedet/srecode/el.el                |   2 +-
 lisp/cus-edit.el                        |   2 +-
 lisp/desktop.el                         |   3 +-
 lisp/emacs-lisp/benchmark.el            |   3 +-
 lisp/emacs-lisp/bytecomp.el             |   5 +
 lisp/emacs-lisp/edebug.el               |   2 +-
 lisp/emacs-lisp/elp.el                  |   5 +-
 lisp/emacs-lisp/ewoc.el                 |   2 +-
 lisp/emacs-lisp/package.el              |  73 +-----
 lisp/epa.el                             |   2 +-
 lisp/eshell/esh-cmd.el                  |   2 +-
 lisp/eshell/esh-proc.el                 |   2 +-
 lisp/faces.el                           |   2 +-
 lisp/ffap.el                            |   2 +-
 lisp/filenotify.el                      |   2 +-
 lisp/font-lock.el                       |   2 +-
 lisp/gnus/deuglify.el                   |   2 +-
 lisp/gnus/gnus-agent.el                 |   2 +-
 lisp/gnus/gnus-cache.el                 |   2 +-
 lisp/gnus/gnus-cus.el                   |   2 +-
 lisp/gnus/gnus-fun.el                   |   2 +-
 lisp/gnus/gnus.el                       |   6 +-
 lisp/gnus/message.el                    |   2 +-
 lisp/gnus/mm-uu.el                      |  18 +-
 lisp/hexl.el                            |   2 +-
 lisp/htmlfontify.el                     |   2 +-
 lisp/image.el                           |   2 +-
 lisp/image/gravatar.el                  |   4 +-
 lisp/international/fontset.el           |   2 +-
 lisp/international/mule-cmds.el         |   3 +
 lisp/mail/rmailedit.el                  |   2 +-
 lisp/mh-e/mh-e.el                       |   2 +-
 lisp/mh-e/mh-mime.el                    |   2 +-
 lisp/mh-e/mh-search.el                  |   6 +-
 lisp/net/gnutls.el                      |   2 +-
 lisp/net/mailcap.el                     |   4 +-
 lisp/nxml/xsd-regexp.el                 |   6 +-
 lisp/org/ob-calc.el                     |   2 +-
 lisp/org/ob-core.el                     |   6 +-
 lisp/org/ob-org.el                      |   2 +-
 lisp/org/ob-picolisp.el                 |   2 +-
 lisp/org/org-clock.el                   |   2 +-
 lisp/org/org-eww.el                     |   6 +-
 lisp/org/org-protocol.el                |   2 +-
 lisp/org/ox-html.el                     |   2 +-
 lisp/org/ox-latex.el                    |   2 +-
 lisp/org/ox-odt.el                      |   5 +-
 lisp/org/ox-texinfo.el                  |   2 +-
 lisp/progmodes/ada-mode.el              |   2 +-
 lisp/progmodes/ada-stmt.el              |   4 +-
 lisp/progmodes/antlr-mode.el            |   2 +-
 lisp/progmodes/cc-engine.el             |   4 +-
 lisp/progmodes/cc-menus.el              |   2 +-
 lisp/progmodes/cc-mode.el               |   2 +-
 lisp/progmodes/compile.el               |   2 +-
 lisp/progmodes/elisp-mode.el            |   5 +-
 lisp/progmodes/grep.el                  |  46 ++--
 lisp/progmodes/icon.el                  |   2 +-
 lisp/progmodes/python.el                |   8 +-
 lisp/progmodes/sh-script.el             |   2 +-
 lisp/progmodes/sql.el                   |   4 +-
 lisp/progmodes/vhdl-mode.el             |   2 +-
 lisp/server.el                          | 144 +++++++-----
 lisp/startup.el                         | 382 +++++++++++++++++---------------
 lisp/tempo.el                           |   2 +-
 lisp/term/README                        |   2 +-
 lisp/term/ns-win.el                     |   9 +-
 lisp/term/pc-win.el                     | 138 ++----------
 lisp/textmodes/artist.el                |  28 +--
 lisp/textmodes/flyspell.el              |   7 +-
 lisp/textmodes/reftex-vars.el           |   2 +-
 lisp/textmodes/rst.el                   |  12 +-
 lisp/thumbs.el                          |   2 +-
 lisp/vc/add-log.el                      |   2 +-
 lisp/vc/diff-mode.el                    |  80 +++++--
 lisp/vc/vc-git.el                       |   9 +-
 lisp/vc/vc.el                           |   7 +-
 lisp/wid-edit.el                        |   4 +-
 src/.gdbinit                            |   2 +-
 src/Makefile.in                         |   7 +-
 src/bidi.c                              |  10 +-
 src/character.c                         |   2 +-
 src/character.h                         |   2 +-
 src/charset.c                           |   2 +-
 src/coding.c                            |   4 +-
 src/dbusbind.c                          |   2 +-
 src/doc.c                               |  42 ++--
 src/dosfns.c                            |   6 +-
 src/eval.c                              |   5 +-
 src/frame.c                             |  33 ++-
 src/image.c                             |   2 +-
 src/inotify.c                           |   2 +-
 src/keymap.c                            |   2 +-
 src/lread.c                             |   2 +-
 src/nsfns.m                             | 163 ++------------
 src/nsmenu.m                            |   2 +-
 src/nsterm.m                            | 116 ++++++++--
 src/process.c                           |  60 ++++-
 src/process.h                           |   2 +
 src/regex.c                             |   2 +-
 src/sound.c                             |   5 +-
 src/syntax.c                            |   2 +-
 src/w16select.c                         |  39 +---
 src/w32fns.c                            | 275 ++++-------------------
 src/w32menu.c                           |   2 +-
 src/w32notify.c                         |   9 +-
 src/w32reg.c                            |   8 +-
 src/w32select.c                         |  42 +---
 src/w32term.c                           |  27 +--
 src/xdisp.c                             |  33 ++-
 src/xfns.c                              |  82 ++++---
 src/xmenu.c                             |  17 +-
 src/xsettings.c                         |   2 +-
 src/xterm.c                             |   7 +-
 test/lisp/abbrev-tests.el               |  17 ++
 test/lisp/emacs-lisp/generator-tests.el |  10 +
 test/src/eval-tests.el                  |  20 ++
 190 files changed, 1914 insertions(+), 1877 deletions(-)

diff --git a/admin/grammars/c.by b/admin/grammars/c.by
index 4a52bec..3755c32 100644
--- a/admin/grammars/c.by
+++ b/admin/grammars/c.by
@@ -917,8 +917,8 @@ variablearg-opt-name
     ( ,$1 )
   | semantic-list arg-list
     ( (car ( EXPAND $1 function-pointer )) $2)
- ;; Klaus Berndl: This allows variableargs without a arg-name being
- ;; parsed correct even if there several pointers (*)
+ ;; Klaus Berndl: This allows variableargs without an arg-name being
+ ;; parsed correctly even if there several pointers (*)
   | opt-stars
     ( "" ,$1 nil nil nil )
   ;
diff --git a/admin/notes/unicode b/admin/notes/unicode
index 85ba67b..ff0de8a 100644
--- a/admin/notes/unicode
+++ b/admin/notes/unicode
@@ -85,7 +85,7 @@ regard to completeness.
        code (keymap.c and print.c).
 
  * Rationalize character syntax and its relationship to the Unicode
-   database.  (Applies mainly to symbol an punctuation syntax.)
+   database.  (Applies mainly to symbol and punctuation syntax.)
 
  * Fontset handling and customization needs work.  We want to relate
    fonts to scripts, probably based on the Unicode blocks.  The
diff --git a/configure.ac b/configure.ac
index a3595a6..dbc9edd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3548,23 +3548,20 @@ fi
 AC_SUBST(LIBJPEG)
 
 HAVE_LCMS2=no
-LIBLCMS2=
+LCMS2_CFLAGS=
+LCMS2_LIBS=
 if test "${with_lcms2}" != "no"; then
-  OLIBS=$LIBS
-  AC_SEARCH_LIBS([cmsCreateTransform], [lcms2], [HAVE_LCMS2=yes])
-  LIBS=$OLIBS
-  case $ac_cv_search_cmsCreateTransform in
-    -*) LIBLCMS2=$ac_cv_search_cmsCreateTransform ;;
-  esac
+  EMACS_CHECK_MODULES([LCMS2], [lcms2])
 fi
 if test "${HAVE_LCMS2}" = "yes"; then
   AC_DEFINE([HAVE_LCMS2], 1, [Define to 1 if you have the lcms2 library 
(-llcms2).])
   ### mingw32 doesn't use -llcms2, since it loads the library dynamically.
   if test "${opsys}" = "mingw32"; then
-     LIBLCMS2=
+     LCMS2_LIBS=
   fi
 fi
-AC_SUBST(LIBLCMS2)
+AC_SUBST(LCMS2_CFLAGS)
+AC_SUBST(LCMS2_LIBS)
 
 HAVE_ZLIB=no
 LIBZ=
@@ -3646,39 +3643,48 @@ elif test "${with_png}" != no; then
   if test "$opsys" = mingw32; then
     AC_CHECK_HEADER([png.h], [HAVE_PNG=yes])
   elif test "${HAVE_X11}" = "yes" || test "${HAVE_W32}" = "yes"; then
-    AC_MSG_CHECKING([for png])
-    png_cflags=`(libpng-config --cflags) 2>&AS_MESSAGE_LOG_FD` &&
-    png_ldflags=`(libpng-config --ldflags) 2>&AS_MESSAGE_LOG_FD` || {
-      # libpng-config does not work; configure by hand.
-      # Debian unstable as of July 2003 has multiple libpngs, and puts png.h
-      # in /usr/include/libpng.
-      if test -r /usr/include/libpng/png.h &&
-        test ! -r /usr/include/png.h; then
-       png_cflags=-I/usr/include/libpng
-      else
-       png_cflags=
-      fi
-      png_ldflags='-lpng'
-    }
-    SAVE_CFLAGS=$CFLAGS
-    SAVE_LIBS=$LIBS
-    CFLAGS="$CFLAGS $png_cflags"
-    LIBS="$png_ldflags -lz -lm $LIBS"
-    AC_LINK_IFELSE(
-      [AC_LANG_PROGRAM([[#include <png.h>]],
-        [[return !png_get_channels (0, 0);]])],
-      [HAVE_PNG=yes
-       PNG_CFLAGS=`AS_ECHO(["$png_cflags"]) | sed -e "$edit_cflags"`
-       LIBPNG=$png_ldflags
-       # $LIBPNG requires explicit -lz in some cases.
-       # We don't know what those cases are, exactly, so play it safe and
-       # append -lz to any nonempty $LIBPNG, unless we're already using LIBZ.
-       if test -n "$LIBPNG" && test -z "$LIBZ"; then
-        LIBPNG="$LIBPNG -lz"
-       fi])
-    CFLAGS=$SAVE_CFLAGS
-    LIBS=$SAVE_LIBS
-    AC_MSG_RESULT([$HAVE_PNG])
+    EMACS_CHECK_MODULES([PNG], [libpng >= 1.0.0])
+    if test $HAVE_PNG = yes; then
+      LIBPNG=$PNG_LIBS
+    else
+      # Test old way in case pkg-config doesn't have it (older machines).
+      AC_MSG_CHECKING([for libpng not configured by pkg-config])
+
+      png_cflags=`(libpng-config --cflags) 2>&AS_MESSAGE_LOG_FD` &&
+      png_ldflags=`(libpng-config --ldflags) 2>&AS_MESSAGE_LOG_FD` || {
+       # libpng-config does not work; configure by hand.
+       # Debian unstable as of July 2003 has multiple libpngs, and puts png.h
+       # in /usr/include/libpng.
+       if test -r /usr/include/libpng/png.h &&
+          test ! -r /usr/include/png.h; then
+         png_cflags=-I/usr/include/libpng
+       else
+         png_cflags=
+       fi
+       png_ldflags='-lpng'
+      }
+      SAVE_CFLAGS=$CFLAGS
+      SAVE_LIBS=$LIBS
+      CFLAGS="$CFLAGS $png_cflags"
+      LIBS="$png_ldflags -lz -lm $LIBS"
+      AC_LINK_IFELSE(
+       [AC_LANG_PROGRAM([[#include <png.h>]],
+          [[return !png_get_channels (0, 0);]])],
+       [HAVE_PNG=yes
+        PNG_CFLAGS=`AS_ECHO(["$png_cflags"]) | sed -e "$edit_cflags"`
+        LIBPNG=$png_ldflags])
+      CFLAGS=$SAVE_CFLAGS
+      LIBS=$SAVE_LIBS
+      AC_MSG_RESULT([$HAVE_PNG])
+    fi
+
+    # $LIBPNG requires explicit -lz in some cases.
+    # We don't know what those cases are, exactly, so play it safe and
+    # append -lz to any nonempty $LIBPNG, unless we're already using LIBZ.
+    case " $LIBPNG ",$LIBZ in
+      *' -lz '*, | *' ',?*) ;;
+      *) LIBPNG="$LIBPNG -lz" ;;
+    esac
   fi
 fi
 if test $HAVE_PNG = yes; then
@@ -5297,7 +5303,7 @@ case "$opsys" in
    if test "$HAVE_NS" = "yes"; then
      libs_nsgui="-framework AppKit"
      if test "$NS_IMPL_COCOA" = "yes"; then
-        libs_nsgui="$libs_nsgui -framework IOKit"
+        libs_nsgui="$libs_nsgui -framework IOKit -framework Carbon"
      fi
    else
      libs_nsgui=
diff --git a/doc/emacs/basic.texi b/doc/emacs/basic.texi
index 8a8298b..4db3855 100644
--- a/doc/emacs/basic.texi
+++ b/doc/emacs/basic.texi
@@ -184,18 +184,8 @@ Move forward one character (@code{forward-char}).
 @item @key{RIGHT}
 @kindex RIGHT
 @findex right-char
address@hidden visual-order-cursor-movement
address@hidden cursor, visual-order motion
-This command (@code{right-char}) behaves like @kbd{C-f}, with one
-exception: when editing right-to-left scripts such as Arabic, it
-instead moves @emph{backward} if the current paragraph is a
-right-to-left paragraph.  @xref{Bidirectional Editing}.
-
-If @code{visual-order-cursor-movement} is address@hidden, this command
-moves to the character that is to the right of the current screen
-position, moving to the next or previous screen line as appropriate.
-Note that this might potentially move point many buffer positions
-away, depending on the surrounding bidirectional context.
+This command (@code{right-char}) behaves like @kbd{C-f}, except when
+point is in a right-to-left paragraph (@pxref{Bidirectional Editing}).
 
 @item C-b
 @kindex C-b
@@ -205,12 +195,8 @@ Move backward one character (@code{backward-char}).
 @item @key{LEFT}
 @kindex LEFT
 @findex left-char
-This command (@code{left-char}) behaves like @kbd{C-b}, except it
-moves @emph{forward} if the current paragraph is right-to-left.
address@hidden Editing}.
-
-The variable @code{visual-order-cursor-movement} affects this like
address@hidden, but moving left instead of right on the screen.
+This command (@code{left-char}) behaves like @kbd{C-b}, except if the
+current paragraph is right-to-left (@pxref{Bidirectional Editing}).
 
 @item C-n
 @itemx @key{DOWN}
diff --git a/doc/emacs/building.texi b/doc/emacs/building.texi
index f61e333..b6b664d 100644
--- a/doc/emacs/building.texi
+++ b/doc/emacs/building.texi
@@ -90,9 +90,9 @@ inserted above point, which remains at the end.  Otherwise, 
point
 remains fixed while compilation output is added at the end of the
 buffer.
 
-  While compilation proceeds, the mode line is updated to show the
-number of errors, warnings, and informational messages that have been
-seen so far.
+  While compilation proceeds, the mode line shows the number of
+errors, warnings, and informational messages emitted by the compiler
+so far.
 
 @cindex compilation buffer, keeping point at end
 @vindex compilation-scroll-output
@@ -384,16 +384,16 @@ grep -nH -e foo *.el | grep bar | grep toto
 can find the corresponding lines in the original files using @address@hidden
 `}}, @key{RET}, and so forth, just like compilation errors.
 
-  As with compilation commands (@pxref{Compilation}), while the grep
-command runs, the mode line is updated to show the number of matches
-that have been seen so far.
-
   Some grep programs accept a @samp{--color} option to output special
 markers around matches for the purpose of highlighting.  You can make
 use of this feature by setting @code{grep-highlight-matches} to
 @code{t}.  When displaying a match in the source buffer, the exact
 match will be highlighted, instead of the entire source line.
 
+  As with compilation commands (@pxref{Compilation}), while the grep
+command runs, the mode line shows the running number of matches found
+and highlighted so far.
+
   The @command{grep} commands will offer to save buffers before
 running.  This is controlled by the @code{grep-save-buffers} variable.
 The possible values are either @code{nil} (don't save), @code{ask}
@@ -649,7 +649,7 @@ Set a breakpoint on the source line that point is on.
 buffer, sets a debugger breakpoint on the current source line.  This
 command is available only after starting address@hidden  If you call it in a
 buffer that is not associated with any debugger subprocess, it signals
-a error.
+an error.
 
 @kindex C-x C-a @r{(GUD)}
   The following commands are available both in the GUD interaction
@@ -1096,9 +1096,9 @@ display the corresponding buffer in a new frame.
   When you create a buffer showing information about some specific
 thread, it becomes bound to that thread and keeps showing actual
 information while you debug your program.  The mode indicator for each
-GDB buffer shows the number of thread it is showing information about.
-The thread number is also included in the buffer name of bound
-buffers.
+GDB buffer shows the number of the thread whose information that
+buffer displays.  The thread number is also included in the name of
+each bound buffer.
 
   Further commands are available in the GDB Threads buffer which
 depend on the mode of GDB that is used for controlling execution of
@@ -1410,12 +1410,13 @@ Loading,,, elisp, the Emacs Lisp Reference Manual}.
 @code{load-path}.  Its value should be a list of directories
 (strings).  These directories are searched, in the specified order, by
 the @kbd{M-x load-library} command, the lower-level @code{load}
-function, and other Emacs functions that find Emacs Lisp libraries.  A
-list entry in @code{load-path} can also have the special value
+function, and other Emacs functions that find Emacs Lisp libraries.
+An entry in @code{load-path} can also have the special value
 @code{nil}, which stands for the current default directory, but it is
-almost always a bad idea to use this.  (If you find yourself wishing
-that @code{nil} were in the list, most likely what you really want is
-to use @kbd{M-x load-file}.)
+almost always a bad idea to use this, because its meaning will depend
+on the buffer that is current when @code{load-path} is used by Emacs.
+(If you find yourself wishing that @code{nil} were in the list, most
+likely what you really want is to use @kbd{M-x load-file}.)
 
   The default value of @code{load-path} is a list of directories where
 the Lisp code for Emacs itself is stored.  If you have libraries of
@@ -1448,7 +1449,7 @@ buffer).  To disable this feature, change the variable
 @vindex load-dangerous-libraries
 @cindex Lisp files byte-compiled by XEmacs
   By default, Emacs refuses to load compiled Lisp files which were
-compiled with XEmacs, a modified versions of Emacs---they can cause
+compiled with XEmacs, a modified version of Emacs---they can cause
 Emacs to crash.  Set the variable @code{load-dangerous-libraries} to
 @code{t} if you want to try loading them.
 
diff --git a/doc/emacs/cmdargs.texi b/doc/emacs/cmdargs.texi
index e463e7c..d18de8e 100644
--- a/doc/emacs/cmdargs.texi
+++ b/doc/emacs/cmdargs.texi
@@ -1104,15 +1104,14 @@ border is 2.
 @node Title X
 @appendixsec Frame Titles
 
-  An Emacs frame may or may not have a specified title.  The frame
-title, if specified, appears in window decorations and icons as the
-name of the frame.  If an Emacs frame has no specified title, the
-default title has the form @address@hidden@@@var{machine}}
-(if there is only one frame) or the selected window's buffer name (if
-there is more than one frame).
-
-  You can specify a title for the initial Emacs frame with a command
-line option:
+  Each Emacs frame always has a title, which appears in window
+decorations and icons as the name of the frame.  The default title is
+of the form @address@hidden@@@var{machine}} (if there is
+only one frame) or shows the selected window's buffer name (if there
+is more than one frame).
+
+  You can specify a non-default title for the initial Emacs frame with
+a command line option:
 
 @table @samp
 @item -T @var{title}
diff --git a/doc/emacs/custom.texi b/doc/emacs/custom.texi
index e27760b..b985d12 100644
--- a/doc/emacs/custom.texi
+++ b/doc/emacs/custom.texi
@@ -2167,6 +2167,7 @@ Manual}.
 * Terminal Init::       Each terminal type can have an init file.
 * Find Init::           How Emacs finds the init file.
 * Init Non-ASCII::      Using address@hidden characters in an init file.
+* Early Init File::     Another init file, which is read early on.
 @end menu
 
 @node Init Syntax
@@ -2568,10 +2569,19 @@ instance:
 @noindent
 Type @kbd{C-q}, followed by the key you want to bind, to insert @var{char}.
 
-  @strong{Warning:} if you change the keyboard encoding, or change
-between multibyte and unibyte mode, or anything that would alter which
-code @kbd{C-q} would insert for that character, this key binding may
-stop working.  It is therefore advisable to use one and only one
-coding system, for your init file as well as the files you edit.  For
-example, don't mix the @samp{latin-1} and @samp{latin-9} coding
-systems.
address@hidden Early Init File
address@hidden The Early Init File
address@hidden early init file
+
+  Most customizations for Emacs can be put in the normal init file,
address@hidden or @file{~/.emacs.d/init.el}.  However, it is sometimes
+desirable to have customizations that take effect during Emacs startup
+earlier than the normal init file is processed.  Such customizations
+can be put in the early init file, @file{~/.emacs.d/early-init.el}.
+This file is loaded before the package system is initialized, so in it
+you can customize variables that affect the initialization process,
+such as @code{package-enable-at-startup} and @code{package-load-list}.
address@hidden Installation}.
+
+  For more information on the early init file, @pxref{Early Init
+File,,, elisp, The Emacs Lisp Reference Manual}.
diff --git a/doc/emacs/dired.texi b/doc/emacs/dired.texi
index 71aea90..0a62285 100644
--- a/doc/emacs/dired.texi
+++ b/doc/emacs/dired.texi
@@ -578,10 +578,11 @@ command will look in the buffer without revisiting the 
file, so the results
 might be inconsistent with the file on disk if its contents have changed
 since it was last visited.  If you don't want this, you may wish to
 revert the files you have visited in your buffers, or to turn on
-the @code{auto-revert} mode in those buffers, before invoking this
-command.  @xref{Reverting}.  If you prefer that this command always revisit
-the file, without having to revert the file or enable @code{auto-revert}
-mode, you might want to set @code{dired-always-read-filesystem} to 
address@hidden
address@hidden mode in those buffers, before invoking this
+command.  @xref{Reverting}.  If you prefer that this command should always
+revisit the file, without you having to revert the file or enable
address@hidden mode, you might want to set
address@hidden to address@hidden
 
 @item C-/
 @itemx C-x u
@@ -1184,7 +1185,7 @@ without having to remove the Dired marks on files in those
 subdirectories.
 
 @xref{Subdirectories in Dired}, for how to insert a subdirectory
-listing, and @pxref{Dired Updating} for how delete it.
+listing, and see @ref{Dired Updating}, for how to delete it.
 
 @node Dired Updating
 @section Updating the Dired Buffer
diff --git a/doc/emacs/docstyle.texi b/doc/emacs/docstyle.texi
index dfd1430..f682e3d 100644
--- a/doc/emacs/docstyle.texi
+++ b/doc/emacs/docstyle.texi
@@ -8,3 +8,9 @@
 @end ignore
 @set txicodequoteundirected
 @set txicodequotebacktick
address@hidden It turns out TeX sometimes fails to hyphenate, so we help it here
address@hidden
address@hidden
address@hidden
address@hidden
address@hidden
diff --git a/doc/emacs/emacs.texi b/doc/emacs/emacs.texi
index 163b6f2..65affeb 100644
--- a/doc/emacs/emacs.texi
+++ b/doc/emacs/emacs.texi
@@ -1163,6 +1163,7 @@ The Emacs Initialization File
 * Terminal Init::       Each terminal type can have an init file.
 * Find Init::           How Emacs finds the init file.
 * Init Non-ASCII::      Using address@hidden characters in an init file.
+* Early Init File::     Another init file, which is read early on.
 
 Dealing with Emacs Trouble
 
diff --git a/doc/emacs/files.texi b/doc/emacs/files.texi
index 37d9056..bd772e9 100644
--- a/doc/emacs/files.texi
+++ b/doc/emacs/files.texi
@@ -694,11 +694,12 @@ Otherwise, renaming is the default choice.
 
   When a file is managed with a version control system (@pxref{Version
 Control}), Emacs does not normally make backups in the usual way for
-that file.  But check-in and check-out are similar in some ways to
-making backups.  One unfortunate similarity is that these operations
-typically break hard links, disconnecting the file name you visited from
-any alternate names for the same file.  This has nothing to do with
-Emacs---the version control system does it.
+that file.  But @dfn{committing} (a.k.a.@: @dfn{checking in},
address@hidden Concepts}) new versions of files is similar in some ways
+to making backups.  One unfortunate similarity is that these
+operations typically break hard links, disconnecting the file name you
+visited from any alternate names for the same file.  This has nothing
+to do with Emacs---the version control system does it.
 
 @node Customize Save
 @subsection Customizing Saving of Files
diff --git a/doc/emacs/fixit.texi b/doc/emacs/fixit.texi
index c872e9b..7cacac4 100644
--- a/doc/emacs/fixit.texi
+++ b/doc/emacs/fixit.texi
@@ -69,10 +69,10 @@ changes have already been undone, the undo command signals 
an error.
   Any command other than an undo command breaks the sequence of undo
 commands.  Starting from that moment, the entire sequence of undo
 commands that you have just performed are themselves placed into the
-undo record, as a single set of changes.  Therefore, to re-apply
-changes you have undone, type @kbd{C-f} or any other command that
-harmlessly breaks the sequence of undoing; then type @kbd{C-/} to undo
-the undo command.
+undo record.  Therefore, to re-apply changes you have undone, type
address@hidden or any other command that harmlessly breaks the sequence of
+undoing; then type @kbd{C-/} one or more times to undo some of the
+undo commands.
 
   Alternatively, if you want to resume undoing, without redoing
 previous undo commands, use @kbd{M-x undo-only}.  This is like
@@ -180,7 +180,8 @@ Otherwise, a reverse search (@kbd{C-r}) is often the best 
way.
 dragging the word preceding or containing point forward as well.  The
 punctuation characters between the words do not move.  For example,
 @address@hidden, BAR}} transposes into @address@hidden, FOO}} rather than
address@hidden@w{BAR FOO,}}.
address@hidden@w{BAR FOO,}}.  When point is at the end of the line, it will
+transpose the word before point with the first word on the next line.
 
   @kbd{C-M-t} (@code{transpose-sexps}) is a similar command for
 transposing two expressions (@pxref{Expressions}), and @kbd{C-x C-t}
@@ -344,16 +345,16 @@ wildcard.
 
 @item C-g
 @itemx X
-Quit interactive spell checking, leaving point at the word that was
+Quit interactive spell-checking, leaving point at the word that was
 being checked.  You can restart checking again afterward with @kbd{C-u
 M-$}.
 
 @item x
-Quit interactive spell checking and move point back to where it was
-when you started spell checking.
+Quit interactive spell-checking and move point back to where it was
+when you started spell-checking.
 
 @item q
-Quit interactive spell checking and kill the spell-checker subprocess.
+Quit interactive spell-checking and kill the spell-checker subprocess.
 
 @item ?
 Show the list of options.
@@ -371,7 +372,7 @@ character; type that digit or character to choose it.
 @cindex @code{ispell} program
 @findex ispell-kill-ispell
   Once started, the spell-checker subprocess continues
-to run, waiting for something to do, so that subsequent spell checking
+to run, waiting for something to do, so that subsequent spell-checking
 commands complete more quickly.  If you want to get rid of the
 process, use @kbd{M-x ispell-kill-ispell}.  This is not usually
 necessary, since the process uses no processor time except when you do
@@ -392,19 +393,21 @@ so that it will use a different standard dictionary.  
Your personal
 dictionary is specified by the variable
 @code{ispell-personal-dictionary}.  If that is @code{nil}, the
 spelling program looks for a personal dictionary in a default
-location.
+location, which is specific to each spell-checker.
 
 @vindex ispell-complete-word-dict
   A separate dictionary is used for word completion.  The variable
 @code{ispell-complete-word-dict} specifies the file name of this
 dictionary.  The completion dictionary must be different because it
-cannot use root and affix information.  For some languages, there
-is a spell checking dictionary but no word completion dictionary.
+cannot use the information about roots and affixes of the words, which
+spell-checking uses to detect variations of words.  For some
+languages, there is a spell-checking dictionary but no word completion
+dictionary.
 
 @cindex Flyspell mode
 @cindex mode, Flyspell
 @findex flyspell-mode
-  Flyspell mode is a minor mode that performs automatic spell checking
+  Flyspell mode is a minor mode that performs automatic spell-checking
 as you type.  When it finds a word that it does not recognize, it
 highlights that word.  Type @kbd{M-x flyspell-mode} to toggle Flyspell
 mode in the current buffer.  To enable Flyspell mode in all text mode
diff --git a/doc/emacs/fortran-xtra.texi b/doc/emacs/fortran-xtra.texi
index 98ff825..859c613 100644
--- a/doc/emacs/fortran-xtra.texi
+++ b/doc/emacs/fortran-xtra.texi
@@ -158,11 +158,14 @@ the required columns.
 @item C-M-j
 Break the current line at point and set up a continuation line
 (@code{fortran-split-line}).
+
 @item M-^
 Join this line to the previous line (@code{fortran-join-line}).
+
 @item C-M-q
 Indent all the lines of the subprogram that point is in
 (@code{fortran-indent-subprogram}).
+
 @item M-q
 Fill a comment block or statement (using @code{fortran-fill-paragraph}
 or @code{fortran-fill-statement}).
@@ -185,7 +188,7 @@ lines.
 @kindex M-^ @r{(Fortran mode)}
 @kindex C-c C-d @r{(Fortran mode)}
 @findex fortran-join-line
-  @kbd{M-^} or @kbd{C-c C-d} runs the command @code{fortran-join-line},
+  @kbd{M-^} or @kbd{C-c C-d} run the command @code{fortran-join-line},
 which joins a continuation line back to the previous line, roughly as
 the inverse of @code{fortran-split-line}.  The point must be on a
 continuation line when this command is invoked.
@@ -203,7 +206,9 @@ point is in.  This removes any excess statement 
continuations.
 If the first non-space character on a line is in column 5, then that
 line is a continuation of the previous line.  We call this @dfn{fixed
 form}.  (In GNU Emacs we always count columns from 0; but note that
-the Fortran standard counts from 1.)  The variable
+the Fortran standard counts from 1.  You can customize the variable
address@hidden to make the column display
+Fortran-like; @pxref{Optional Mode Line}.)  The variable
 @code{fortran-continuation-string} specifies what character to put in
 column 5.  A line that starts with a tab character followed by any digit
 except @samp{0} is also a continuation line.  We call this style of
@@ -229,10 +234,10 @@ accordingly.
   If the text on a line starts with the Fortran continuation marker
 @samp{$}, or if it begins with any non-whitespace character in column
 5, Fortran mode treats it as a continuation line.  When you indent a
-continuation line with @key{TAB}, it converts the line to the current
-continuation style.  When you split a Fortran statement with
address@hidden, the continuation marker on the newline is created according
-to the continuation style.
+continuation line with @address@hidden, it converts the line to the
+current continuation style.  When you split a Fortran statement with
address@hidden, the continuation marker on the newline is created
+according to the continuation style.
 
   The setting of continuation style affects several other aspects of
 editing in Fortran mode.  In fixed form mode, the minimum column
@@ -247,7 +252,9 @@ column 8 must consist of one tab character.
 
   If a number is the first non-whitespace in the line, Fortran
 indentation assumes it is a line number and moves it to columns 0
-through 4.  (Columns always count from 0 in Emacs.)
+through 4.  (Columns always count from 0 in Emacs, but setting
address@hidden to @code{nil} can change
+that, @pxref{Optional Mode Line}.)
 
 @vindex fortran-line-number-indent
   Line numbers of four digits or less are normally indented one space.
@@ -320,7 +327,7 @@ Extra indentation within each level of @samp{structure}, 
@samp{union},
 Extra indentation for bodies of continuation lines (default 5).
 
 @item fortran-check-all-num-for-matching-do
-In Fortran 77, a numbered @samp{do} statement is ended by any statement
+In Fortran 77, a numbered @samp{do} statement is terminated by any statement
 with a matching line number.  It is common (but not compulsory) to use a
 @samp{continue} statement for this purpose.  If this variable has a
 address@hidden value, indenting any numbered statement must check for a
@@ -330,7 +337,7 @@ then you can speed up indentation by setting this variable 
to
 @code{nil} (the default).
 
 @item fortran-blink-matching-if
-If this is @code{t}, indenting an @samp{endif} (or @samp{enddo}
+If this is @code{t}, indenting an @samp{endif} (or @samp{enddo})
 statement moves the cursor momentarily to the matching @samp{if} (or
 @samp{do}) statement to show where it is.  The default is @code{nil}.
 
@@ -386,7 +393,7 @@ Fortran mode as in other modes.
 
   When a new comment must be inserted, if the current line is blank, a
 full-line comment is inserted.  On a non-blank line, a nonstandard @samp{!}
-comment is inserted if you have said you want to use them.  Otherwise a
+comment is inserted if you have said you want to use them.  Otherwise, a
 full-line comment is inserted on a new line before the current line.
 
   Nonstandard @samp{!} comments are aligned like comments in other
@@ -434,7 +441,7 @@ distinctive font-locking.
 
   The normal Emacs comment command @kbd{C-x ;} (@code{comment-set-column})
 has not been redefined.  If you use @samp{!} comments, this command
-can be used with them.  Otherwise it is useless in Fortran mode.
+can be used with them.  Otherwise, it is useless in Fortran mode.
 
 @kindex C-c ; @r{(Fortran mode)}
 @findex fortran-comment-region
@@ -457,9 +464,9 @@ minor mode that automatically splits statements as you 
insert them
 when they become too wide.  Splitting a statement involves making
 continuation lines using @code{fortran-continuation-string}
 (@pxref{ForIndent Cont}).  This splitting happens when you type
address@hidden, @key{RET}, or @key{TAB}, and also in the Fortran
-indentation commands.  You activate Auto Fill in Fortran mode in the
-normal way.
address@hidden@key{SPC}}, @address@hidden, or @address@hidden, and also in the
+Fortran indentation commands.  You activate Auto Fill in Fortran mode
+in the normal way.
 @iftex
 @xref{Auto Fill,,, emacs, the Emacs Manual}.
 @end iftex
@@ -501,15 +508,18 @@ will confuse font-lock.)
 @item C-c C-r
 Display a column ruler momentarily above the current line
 (@code{fortran-column-ruler}).
+
 @item C-c C-w
 Split the current window horizontally temporarily so that it is
 @code{fortran-line-length} columns wide
 (@code{fortran-window-create-momentarily}).  This may help you avoid
 making lines longer than the limit imposed by your Fortran compiler.
+
 @item C-u C-c C-w
 Split the current window horizontally so that it is
 @code{fortran-line-length} columns wide (@code{fortran-window-create}).
 You can then continue editing.
+
 @item M-x fortran-strip-sequence-nos
 Delete all text in column @code{fortran-line-length} and beyond.
 @end table
@@ -523,7 +533,9 @@ Fortran programs.  Square brackets show the limits of the 
columns for line
 numbers, and curly brackets show the limits of the columns for the
 statement body.  Column numbers appear above them.
 
-  Note that the column numbers count from zero, as always in GNU Emacs.
+  Note that the column numbers count from zero, as always in GNU Emacs
+(but customizing @code{column-number-indicator-zero-based} can change
+column display to match that of Fortran; @pxref{Optional Mode Line}).
 As a result, the numbers may be one less than those you are familiar
 with; but the positions they indicate in the line are standard for
 Fortran.
diff --git a/doc/emacs/frames.texi b/doc/emacs/frames.texi
index afdfa6c..b2ec574 100644
--- a/doc/emacs/frames.texi
+++ b/doc/emacs/frames.texi
@@ -248,13 +248,13 @@ this to move point to the beginning of the region, 
scrolling the
 display backward if necessary.
 
 @item Double-Drag-mouse-1
-Select the text you drag across, in the form of whole words.
+Select the text you drag across, in units of whole words.
 
 @item Triple-mouse-1
 Select the line you click on.
 
 @item Triple-Drag-mouse-1
-Select the text you drag across, in the form of whole lines.
+Select the text you drag across, in units of whole lines.
 @end table
 
 @node Mouse References
@@ -312,7 +312,7 @@ button.
 @node Menu Mouse Clicks
 @section Mouse Clicks for Menus
 
-  Several mouse clicks with the @key{CTRL} and @key{SHIFT} modifiers
+  Several mouse clicks with the @key{Ctrl} and @key{SHIFT} modifiers
 bring up menus.
 
 @table @kbd
@@ -409,10 +409,11 @@ boundary to the left or right.
   The prefix key @kbd{C-x 5} is analogous to @kbd{C-x 4}.  Whereas
 each @kbd{C-x 4} command pops up a buffer in a different window in the
 selected frame (@pxref{Pop Up Window}), the @kbd{C-x 5} commands use a
-different frame.  If an existing visible or iconified (a.k.a.@: ``minimized'')
-frame already displays the requested buffer, that frame is raised and
-deiconified (``un-minimized''); otherwise, a new frame is created on
-the current display terminal.
+different frame.  If an existing visible or iconified (a.k.a.@:
+``minimized'', @pxref{Visibility of Frames,,, elisp, The Emacs Lisp
+Reference Manual}) frame already displays the requested buffer, that
+frame is raised and deiconified (``un-minimized''); otherwise, a new
+frame is created on the current display terminal.
 
   The various @kbd{C-x 5} commands differ in how they find or create the
 buffer to select:
@@ -642,7 +643,7 @@ Monospace-12:weight=bold:slant=italic
 
 For a more detailed description of Fontconfig patterns, see the
 Fontconfig manual, which is distributed with Fontconfig and available
-online at @url{http://fontconfig.org/fontconfig-user.html}.
+online at @url{https://fontconfig.org/fontconfig-user.html}.
 
 @cindex GTK font pattern
   The second way to specify a font is to use a @dfn{GTK font pattern}.
@@ -954,7 +955,8 @@ toolkits allow you to customize the scroll bars to not have 
those
 buttons).  Clicking @kbd{mouse-1} above or below the scroll bar's
 inner box scrolls the window by nearly the entire height of the
 window, like @kbd{M-v} and @kbd{C-v} respectively (@pxref{Moving
-Point}).  Dragging the inner box scrolls continuously.
+Point}).  (This, too, can behave differently with some toolkits.)
+Dragging the inner box scrolls continuously.
 
   If Emacs is compiled on the X Window System without X toolkit
 support, the scroll bar behaves differently.  Clicking @kbd{mouse-1}
diff --git a/doc/emacs/glossary.texi b/doc/emacs/glossary.texi
index 7a0dd6d..a912019 100644
--- a/doc/emacs/glossary.texi
+++ b/doc/emacs/glossary.texi
@@ -24,7 +24,7 @@ Setting the mark (q.v.@:) at a position in the text also 
activates it.
 When the mark is active, we call the region an active region.
 @xref{Mark}.
 
address@hidden Alt
address@hidden @key{Alt}
 Alt is the name of a modifier bit that a keyboard input character may
 have.  To make a character Alt, type it while holding down the @key{Alt}
 key.  Such characters are given names that start with @address@hidden
@@ -160,6 +160,12 @@ right away when you press down on a mouse button.  
@xref{Mouse Buttons}.
 @item Byte Compilation
 @xref{Glossary---Compilation}.
 
address@hidden cf.
address@hidden c.f.
+Short for ``confer'' in Latin, which means ``compare with'' or
+``compare to''.  The second variant, ``c.f.'', is a widespread
+misspelling.
+
 @anchor{Glossary---C-}
 @item @kbd{C-}
 @kbd{C-} in the name of a character is an abbreviation for Control.
@@ -187,7 +193,7 @@ other input events as well).  @xref{User Input}.
 
 @item Character Folding
 Character folding means ignoring differences between similarly looking
-characters, such as between @code{a}, and @code{@:a} and @code{@'a}.
+characters, such as between @code{a}, and @code{@"a} and @code{@'a}.
 Emacs performs character folding by default in text search.  @xref{Lax
 Search}.
 
@@ -220,14 +226,16 @@ text to or from a variety of coding systems when reading 
or writing it.
 @xref{Coding Systems}.
 
 @item Command
-A command is a Lisp function specially defined to be able to serve as a
-key binding in Emacs.  When you type a key sequence (q.v.), its
-binding (q.v.@:) is looked up in the relevant keymaps (q.v.@:) to find
-the command to run.  @xref{Commands}.
+A command is a Lisp function specially defined to be able to serve as
+a key binding in Emacs or to be invoked by its name
+(@pxref{Glossary---Command Name}).  When you type a key sequence
+(q.v.), its binding (q.v.@:) is looked up in the relevant keymaps
+(q.v.@:) to find the command to run.  @xref{Commands}.
 
 @item Command History
 @xref{Glossary---Minibuffer History}.
 
address@hidden Name}
 @item Command Name
 A command name is the name of a Lisp symbol that is a command
 (@pxref{Commands}).  You can invoke any command by its name using
@@ -250,7 +258,8 @@ Compilation is the process of creating an executable 
program from source
 code.  Emacs has commands for compiling files of Emacs Lisp code
 (@pxref{Byte Compilation,,, elisp, the Emacs Lisp
 Reference Manual}) and programs in C and other languages
-(@pxref{Compilation}).
+(@pxref{Compilation}).  Byte-compiled Emacs Lisp code loads and
+executes faster.
 
 @item Complete Key
 A complete key is a key sequence that fully specifies one action to be
@@ -440,6 +449,9 @@ tell it to.  @xref{Bugs}.
 @c TODO?  Not really appropriate for the user manual I think.
 @c Dynamic Binding
 
address@hidden e.g.
+Short for ``exempli gratia'' in Latin, which means ``for example''.
+
 @item Echo Area
 The echo area is the bottom line of the screen, used for echoing the
 arguments to commands, for asking questions, and showing brief messages
@@ -499,6 +511,9 @@ like the @key{SHIFT} key, is held down while another 
character is
 typed), you press the @key{ESC} key as you would press a letter key, and
 it applies to the next character you type.
 
address@hidden etc.
+Short for ``et cetera'' in Latin, which means ``and so on''.
+
 @item Expression
 @xref{Glossary---Balanced Expression}.
 
@@ -709,6 +724,9 @@ have.  To make a character Hyper, type it while holding 
down the
 @key{Hyper} key.  Such characters are given names that start with
 @kbd{Hyper-} (usually written @kbd{H-} for short).  @xref{User Input}.
 
address@hidden i.e.
+Short for ``id est'' in Latin, which means ``that is''.
+
 @item Iff
 ``Iff'' means ``if and only if''.  This terminology comes from
 mathematics.  Try to avoid using this term in documentation, since
@@ -861,7 +879,7 @@ A local value of a variable (q.v.@:) applies to only one 
buffer.
 @xref{Locals}.
 
 @item @kbd{M-}
address@hidden in the name of a character is an abbreviation for @key{Meta},
address@hidden in the name of a character is an abbreviation for @key{META},
 one of the modifier keys that can accompany any character.
 @xref{User Input,M-}.
 
@@ -919,15 +937,15 @@ a keyboard interface to navigate it.  @xref{Menu Bars}.
 
 @item Meta
 Meta is the name of a modifier bit which you can use in a command
-character.  To enter a meta character, you hold down the @key{Meta}
+character.  To enter a meta character, you hold down the @key{META}
 key while typing the character.  We refer to such characters with
 names that start with @kbd{Meta-} (usually written @kbd{M-} for
-short).  For example, @kbd{M-<} is typed by holding down @key{Meta}
+short).  For example, @kbd{M-<} is typed by holding down @key{META}
 and at the same time typing @kbd{<} (which itself is done, on most
 terminals, by holding down @key{SHIFT} and typing @kbd{,}).
 @xref{User Input,Meta}.
 
-On some terminals, the @key{Meta} key is actually labeled @key{Alt}
+On some terminals, the @key{META} key is actually labeled @key{Alt}
 or @key{Edit}.
 
 @item Meta Character
@@ -1082,6 +1100,9 @@ read an argument (@pxref{Minibuffer}); the echoing that 
happens when
 you pause in the middle of typing a multi-character key sequence is also
 a kind of prompting (@pxref{Echo Area}).
 
address@hidden q.v.
+Short for ``quod vide'' in Latin, which means ``which see''.
+
 @item Query-Replace
 Query-replace is an interactive string replacement feature provided by
 Emacs.  @xref{Query Replace}.
@@ -1122,8 +1143,8 @@ one corner and putting the mark at the diagonally 
opposite corner.
 A recursive editing level is a state in which part of the execution of
 a command involves asking you to edit some text.  This text may
 or may not be the same as the text to which the command was applied.
-The mode line indicates recursive editing levels with square brackets
-(@samp{[} and @samp{]}).  @xref{Recursive Edit}.
+The mode line (q.v.@:) indicates recursive editing levels with square
+brackets (@samp{[} and @samp{]}).  @xref{Recursive Edit}.
 
 @item Redisplay
 Redisplay is the process of correcting the image on the screen to
@@ -1151,7 +1172,7 @@ digits.  @xref{Regexps}.
 @item Remote File
 A remote file is a file that is stored on a system other than your own.
 Emacs can access files on other computers provided that they are
-connected to the same network as your machine, and (obviously) that
+reachable from your machine over the network, and (obviously) that
 you have a supported method to gain access to those files.
 @xref{Remote Files}.
 
@@ -1173,8 +1194,9 @@ newline into the text.  It is also used to terminate most 
arguments
 read in the minibuffer (q.v.).  @xref{User Input,Return}.
 
 @item Reverting
-Reverting means returning to the original state.  Emacs lets you
-revert a buffer by re-reading its file from disk.  @xref{Reverting}.
+Reverting means returning to the original state.  For example, Emacs
+lets you revert a buffer by re-reading its file from disk.
address@hidden
 
 @c Seems too obvious, also there is nothing special about the format
 @c these days.
@@ -1346,6 +1368,7 @@ Emacs does not make a termscript file unless you tell it 
to.
 @xref{Bugs}.
 
 @item Text
+
 ``Text'' has two meanings (@pxref{Text}):
 
 @itemize @bullet
@@ -1354,6 +1377,7 @@ Data consisting of a sequence of characters, as opposed 
to binary
 numbers, executable programs, and the like.  The basic contents of an
 Emacs buffer (aside from the text properties, q.v.@:) are always text
 in this sense.
+
 @item
 Data consisting of written human language (as opposed to programs),
 or following the stylistic conventions of human language.
@@ -1456,7 +1480,7 @@ where they can be edited.  @xref{Visiting}.
 
 @item Whitespace
 Whitespace is any run of consecutive formatting characters (space,
-tab, newline, and backspace).
+tab, newline, backspace, etc.).
 
 @item Widening
 Widening is removing any restriction (q.v.@:) on the current buffer;
diff --git a/doc/emacs/help.texi b/doc/emacs/help.texi
index 2ed2642..6c093f1 100644
--- a/doc/emacs/help.texi
+++ b/doc/emacs/help.texi
@@ -642,7 +642,7 @@ Display information about where to get external packages
 @item C-h C-f
 Display the Emacs frequently-answered-questions list (@code{view-emacs-FAQ}).
 @item C-h g
-Visit a @uref{https://www.gnu.org} page with information about the GNU
+Visit the @uref{https://www.gnu.org, page} with information about the GNU
 Project (@code{describe-gnu-project}).
 @item C-h C-m
 Display information about ordering printed copies of Emacs manuals
diff --git a/doc/emacs/killing.texi b/doc/emacs/killing.texi
index 3416db5..19aa907 100644
--- a/doc/emacs/killing.texi
+++ b/doc/emacs/killing.texi
@@ -675,7 +675,7 @@ use to alter a buffer, then point is always at the end.
 
   @kbd{M-x prepend-to-buffer} is just like @code{append-to-buffer}
 except that point in the other buffer is left before the copied text, so
-successive prependings add text in reverse order.  @kbd{M-x
+successive uses of this command add text in reverse order.  @kbd{M-x
 copy-to-buffer} is similar, except that any existing text in the other
 buffer is deleted, so the buffer is left containing just the text newly
 copied into it.
diff --git a/doc/emacs/macos.texi b/doc/emacs/macos.texi
index 28a5f90..bf37d67 100644
--- a/doc/emacs/macos.texi
+++ b/doc/emacs/macos.texi
@@ -34,8 +34,8 @@ Support}), but we hope to improve it in the future.
 @node Mac / GNUstep Basics
 @section Basic Emacs usage under macOS and GNUstep
 
-  By default, the @key{alt} and @key{option} keys are the same as
address@hidden  The Mac @key{Cmd} key is the same as @key{Super}, and
+  By default, the @key{Alt} and @key{Option} keys are the same as
address@hidden  The Mac @key{Cmd} key is the same as @key{Super}, and
 Emacs provides a set of key bindings using this modifier key that mimic
 other Mac / GNUstep applications (@pxref{Mac / GNUstep Events}).  You
 can change these bindings in the usual way (@pxref{Key Bindings}).
@@ -43,7 +43,7 @@ can change these bindings in the usual way (@pxref{Key 
Bindings}).
 @vindex ns-alternate-modifier
 @vindex ns-right-alternate-modifier
   The variable @code{ns-right-alternate-modifier} controls the
-behavior of the right @key{alt} and @key{option} keys.  These keys
+behavior of the right @key{Alt} and @key{Option} keys.  These keys
 behave like the left-hand keys if the value is @code{left} (the
 default).  A value of @code{control}, @code{meta}, @code{alt},
 @code{super}, or @code{hyper} makes them behave like the corresponding
diff --git a/doc/emacs/maintaining.texi b/doc/emacs/maintaining.texi
index 127c27c..541bf97 100644
--- a/doc/emacs/maintaining.texi
+++ b/doc/emacs/maintaining.texi
@@ -60,8 +60,8 @@ changed.
   The Emacs version control interface is called @address@hidden  VC
 commands work with several different version control systems;
 currently, it supports Bazaar, CVS, Git, Mercurial, Monotone, RCS,
-SCCS/CSSC, and Subversion.  Of these, the GNU project distributes CVS,
-RCS, and Bazaar.
+SRC, SCCS/CSSC, and Subversion.  Of these, the GNU project distributes
+CVS, RCS, and Bazaar.
 
   VC is enabled automatically whenever you visit a file governed by a
 version control system.  To disable VC entirely, set the customizable
@@ -80,9 +80,7 @@ current buffer, use the command @code{vc-refresh-state}.  
This command
 is useful when you perform version control commands outside Emacs
 (e.g., from the shell prompt), or if you put the buffer's file under a
 different version control system, or remove it from version control
-entirely.  A companion command @code{vc-state-refresh} does the same,
-but does not consider switching the version control system or removal
-from VC.
+entirely.
 
 @menu
 * Introduction to VC::  How version control works in general.
@@ -185,12 +183,12 @@ everything you can do with RCS can be done through VC.
 
 @cindex CVS
 @item
-CVS is the free version control system that was, until recently (circa
-2008), used by the majority of free software projects.  Nowadays, it
-is slowly being superseded by newer systems.  CVS allows concurrent
-multi-user development either locally or over the network.  Unlike
-newer systems, it lacks support for atomic commits and file
-moving/renaming.  VC supports all basic editing operations under CVS.
+CVS is the free version control system that was, until circa 2008,
+used by the majority of free software projects.  Since then, it has
+been superseded by newer systems.  CVS allows concurrent multi-user
+development either locally or over the network.  Unlike newer systems,
+it lacks support for atomic commits and file moving/renaming.  VC
+supports all basic editing operations under CVS.
 
 @cindex SVN
 @cindex Subversion
@@ -322,13 +320,14 @@ possible.
 @subsubsection Changeset-based vs File-based Version Control
 
 @cindex file-based version control
-  On SCCS, RCS, CVS, and other early version control systems, version
-control operations are @dfn{file-based}: each file has its own comment
-and revision history separate from that of all other files.  Newer
-systems, beginning with Subversion, are @dfn{changeset-based}: a
-commit may include changes to several files, and the entire set of
-changes is handled as a unit.  Any comment associated with the change
-does not belong to a single file, but to the changeset itself.
+  On SCCS, RCS, CVS, and other early version control systems (and also
+in SRC), version control operations are @dfn{file-based}: each file
+has its own comment and revision history separate from that of all
+other files.  Newer systems, beginning with Subversion, are
address@hidden: a commit may include changes to several files,
+and the entire set of changes is handled as a unit.  Any comment
+associated with the change does not belong to a single file, but to
+the changeset itself.
 
 @cindex changeset-based version control
   Changeset-based version control is more flexible and powerful than
@@ -344,7 +343,7 @@ all of it.
 @cindex distributed version control
   Early version control systems were designed around a
 @dfn{centralized} model in which each project has only one repository
-used by all developers.  SCCS, RCS, CVS, and Subversion share this
+used by all developers.  SCCS, RCS, CVS, Subversion, and SRC share this
 kind of model.  One of its drawbacks is that the repository is a choke
 point for reliability and efficiency.
 
@@ -526,7 +525,7 @@ desired log entry for the new revision, followed by 
@kbd{C-c C-c} to
 commit.  @xref{Log Buffer}.
 
 If committing to a shared repository, the commit may fail if the
-repository that has been changed since your last update.  In that
+repository has been changed since your last update.  In that
 case, you must perform an update before trying again.  On a
 decentralized version control system, use @kbd{C-x v +}
 (@pxref{Pulling / Pushing}) or @kbd{C-x v m} (@pxref{Merging}).
@@ -609,7 +608,7 @@ if the fileset can be managed by more than one version 
control system,
 and Emacs fails to detect the correct one.
 
 @item
-Otherwise, if using CVS or RCS, you can specify a revision ID.
+Otherwise, if using CVS, RCS or SRC, you can specify a revision ID.
 
 If the fileset is modified (or locked), this makes Emacs commit with
 that revision address@hidden  You can create a new branch by supplying an
@@ -660,11 +659,10 @@ Author: J. R. Hacker <jrh@@example.com>
 
 @noindent
 Apart from the @samp{Author} header, Emacs recognizes the headers
address@hidden (a manually-specified commit time) and @samp{Fixes} (a
-reference to a bug fixed by the change).  Not all version control
-systems recognize all headers: Bazaar recognizes all three headers,
-while Git, Mercurial, and Monotone recognize only @samp{Author} and
address@hidden  If you specify a header for a system that does not
address@hidden (a one-line summary of the changeset), @samp{Date} (a
+manually-specified commit time), and @samp{Fixes} (a reference to a
+bug fixed by the change).  Not all version control systems recognize
+all headers.  If you specify a header for a system that does not
 support it, the header is treated as part of the log entry.
 
 @kindex C-c C-f @r{(Log Edit mode)}
@@ -969,9 +967,9 @@ file listed on the current line.
 @findex log-view-toggle-entry-display
   @kbd{C-x v L} (@code{vc-print-root-log}) displays a
 @file{*vc-change-log*} buffer showing the history of the entire
-version-controlled directory tree (RCS, SCCS, and CVS do not support
-this feature).  With a prefix argument, the command prompts for the
-maximum number of revisions to display.
+version-controlled directory tree (RCS, SCCS, CVS, and SRC do not
+support this feature).  With a prefix argument, the command prompts
+for the maximum number of revisions to display.
 
   The @kbd{C-x v L} history is shown in a compact form, usually
 showing only the first line of each log entry.  However, you can type
@@ -1048,7 +1046,7 @@ if you set the value to zero, that removes the limit.  
You can also
 increase the number of revisions shown in an existing
 @file{*vc-change-log*} buffer by clicking on the @samp{Show 2X
 entries} or @samp{Show unlimited entries} buttons at the end of the
-buffer.  However, RCS, SCCS, and CVS do not support this feature.
+buffer.  However, RCS, SCCS, CVS, and SRC do not support this feature.
 
 @kindex C-x v h
 @findex vc-region-history
@@ -1189,7 +1187,7 @@ but is not yet committed, while @file{temp.txt} is not 
under version
 control (@pxref{Registering}).
 
 The @samp{*} characters next to the entries for @file{README} and
address@hidden/main.c} indicate that the user has marked out these files as
address@hidden/main.c} indicate that the user has marked these files as
 the current VC fileset
 @iftex
 (see below).
@@ -1280,7 +1278,7 @@ point is on a directory entry, unmark all files in that 
directory tree
 files and directories.
 
 @item x
-Hide files with @samp{up-to-date} status
+Hide files with @samp{up-to-date} or @samp{ignored} status
 (@code{vc-dir-hide-up-to-date}).  With a prefix argument, hide items
 whose state is that of the item at point.
 @end table
@@ -1352,7 +1350,7 @@ Switch to a branch (@code{vc-retrieve-tag}).  
@xref{Switching Branches}.
 context menu invoked by @kbd{mouse-2}.  Furthermore, some VC backends
 use the menu to provide extra backend-specific commands.  For example,
 Git and Bazaar allow you to manipulate @dfn{stashes} and @dfn{shelves}
-(where are a way to temporarily put aside uncommitted changes, and
+(which are a way to temporarily put aside uncommitted changes, and
 bring them back at a later time).
 
 @node Branches
@@ -1517,7 +1515,7 @@ is shown in a separate buffer.
 prompts for a branch ID, or a pair of revision IDs (@pxref{Switching
 Branches}); then it finds the changes from that branch, or the changes
 between the two revisions you specified, and merges those changes into
-the current VC fileset.  If you just type @key{RET}, Emacs simply
+the current VC fileset.  If you just type @address@hidden, Emacs simply
 merges any changes that were made on the same branch since you checked
 the file out.
 
@@ -2203,7 +2201,7 @@ In Ada, the same name can be used for different kinds of 
entity
 (e.g., for a procedure and for a function).  Also, for things like
 packages, procedures and functions, there is the spec (i.e., the
 interface) and the body (i.e., the implementation).  To make it
-easier to pick the definition you want, Ada tag name have suffixes
+easier to pick the definition you want, Ada tag names have suffixes
 indicating the type of entity:
 
 @table @samp
diff --git a/doc/emacs/mark.texi b/doc/emacs/mark.texi
index 7cb48a6..0ffa9f7 100644
--- a/doc/emacs/mark.texi
+++ b/doc/emacs/mark.texi
@@ -260,7 +260,7 @@ change the variable @code{use-empty-active-region} to 
@code{t}.
 
 @vindex delete-active-region
   As described in @ref{Erasing}, the @key{DEL}
-(@code{backward-delete-char}) and @key{delete}
+(@code{backward-delete-char}) and @key{Delete}
 (@code{delete-forward-char}) commands also act this way.  If the mark
 is active, they delete the text in the region.  (As an exception, if
 you supply a numeric argument @var{n}, where @var{n} is not one, these
diff --git a/doc/emacs/misc.texi b/doc/emacs/misc.texi
index 5babd50..cfc689e 100644
--- a/doc/emacs/misc.texi
+++ b/doc/emacs/misc.texi
@@ -2434,6 +2434,11 @@ To disable this, set @code{desktop-restore-frames} to 
@code{nil}.
 (See that variable's documentation for some related options
 that you can customize to fine-tune this behavior.)
 
address@hidden desktop-files-not-to-save
+Information about buffers visiting remote files is not saved by
+default.  Customize the variable @code{desktop-files-not-to-save} to
+change this.
+
 @vindex frameset-filter-alist
    When the desktop restores the frame and window configuration, it
 uses the recorded values of frame parameters, disregarding any
@@ -2485,7 +2490,7 @@ since it bypasses the init file, where 
@code{desktop-save-mode} is
 usually turned on.
 
 @vindex desktop-restore-eager
-  By default, all the buffers in the desktop are restored at one go.
+  By default, all the buffers in the desktop are restored in one go.
 However, this may be slow if there are a lot of buffers in the
 desktop.  You can specify the maximum number of buffers to restore
 immediately with the variable @code{desktop-restore-eager}; the
@@ -2504,6 +2509,35 @@ expression matching the names of buffers not to kill.
   If you want to save minibuffer history from one session to
 another, use the @code{savehist} library.
 
address@hidden desktop-auto-save-timeout
+  While Emacs runs with @code{desktop-save-mode} turned on, it by
+default auto-saves the desktop whenever any of it changes.  The
+variable @code{desktop-auto-save-timeout} determines how frequently
+Emacs checks for modifications to your desktop.
+
address@hidden desktop-load-locked-desktop
+  The file in which Emacs saves the desktop is locked while the
+session runs, to avoid inadvertently overwriting it from another Emacs
+session.  That lock is normally removed when Emacs exits, but if Emacs
+or your system crashes, the lock stays, and when you restart Emacs, it
+will by default ask you whether to use the locked desktop file.  You
+can avoid the question by customizing the variable
address@hidden to either @code{nil}, which means
+never load the desktop in this case, or @code{t}, which means load the
+desktop without asking.
+
address@hidden desktop restore in daemon mode
+  When Emacs starts in daemon mode, it cannot ask you any questions,
+so if it finds the desktop file locked, it will not load it, unless
address@hidden is @code{t}.  Note that restoring
+the desktop in daemon mode is somewhat problematic for other reasons:
+e.g., the daemon cannot use GUI features, so parameters such as frame
+position, size, and decorations cannot be restored.  For that reason,
+you may wish to delay restoring the desktop in daemon mode until the
+first client connects, by calling @code{desktop-read} in a hook
+function that you add to @code{after-make-frame-functions}
+(@pxref{Creating Frames,,, elisp, The Emacs Lisp Reference Manual}).
+
 @node Recursive Edit
 @section Recursive Editing Levels
 @cindex recursive editing level
diff --git a/doc/emacs/msdos-xtra.texi b/doc/emacs/msdos-xtra.texi
index 541e29a..39d003c 100644
--- a/doc/emacs/msdos-xtra.texi
+++ b/doc/emacs/msdos-xtra.texi
@@ -84,7 +84,7 @@ a running command and for emergency escape
 @vindex dos-super-key
 @vindex dos-hyper-key
   The PC keyboard maps use the left @key{Alt} key as the @key{META} key.
-You have two choices for emulating the @key{SUPER} and @key{HYPER} keys:
+You have two choices for emulating the @key{SUPER} and @key{Hyper} keys:
 choose either the right @key{Ctrl} key or the right @key{Alt} key by
 setting the variables @code{dos-hyper-key} and @code{dos-super-key} to 1
 or 2 respectively.  If neither @code{dos-super-key} nor
diff --git a/doc/emacs/msdos.texi b/doc/emacs/msdos.texi
index 9c47f47..2790d56 100644
--- a/doc/emacs/msdos.texi
+++ b/doc/emacs/msdos.texi
@@ -69,6 +69,20 @@ right-click on the shortcut, select ``Properties'', and in 
the
 ``Shortcut'' tab modify the ``Start in'' field to your liking.
 
 @item
address@hidden pinning Emacs to Windows task bar
+From a task-bar shortcut icon, by clicking once the left mouse button.
+Windows versions since Vista allow you to create such shortcuts by
address@hidden the icon of a running program that appears in the task
+bar.  You can do that with Emacs, but afterwards you will have to
+change the properties of the pinned shortcut to run
address@hidden, @emph{not} of @file{emacs.exe}.  You can also pin
+Emacs to the task bar by clicking the right mouse button on its icon
+in the Start menu, then selecting @samp{Pin to taskbar}.  Once again,
+be sure to specify @file{runemacs.exe} as the program to run.  You can
+control where Emacs starts by setting the ``Start in'' field of the
+shortcut's Properties.
+
address@hidden
 From the Command Prompt window, by typing @kbd{emacs @key{RET}} at the
 prompt.  The Command Prompt window where you did that will not be
 available for invoking other commands until Emacs exits.  In this
@@ -81,6 +95,12 @@ immediately available for invoking other commands.  In this 
case,
 Emacs will start in the current directory of the Windows shell.
 
 @item
+From the Windows @code{Run} dialog (normally reached by clicking the
address@hidden button).  Typing @kbd{runemacs @key{RET}} into the dialog
+will start Emacs in the parent directory of the Windows equivalent of
+your user's @code{HOME} directory, see @ref{Windows HOME}.
+
address@hidden
 @cindex invoking Emacs from Windows Explorer
 @pindex emacsclient.exe
 @pindex emacsclientw.exe
@@ -204,8 +224,8 @@ designates directory @file{\foo} on drive Z as an 
untranslated file
 system.
 
   Most often you would use @code{add-untranslated-filesystem} in your
address@hidden file, or in @file{site-start.el} so that all the users at
-your site get the benefit of it.
address@hidden or @file{init.el} init file, or in @file{site-start.el}
+so that all the users at your site get the benefit of it.
 
 @findex remove-untranslated-filesystem
   To countermand the effect of @code{add-untranslated-filesystem}, use
@@ -215,8 +235,8 @@ previously with @code{add-untranslated-filesystem}.
 
   Designating a file system as untranslated does not affect character
 set conversion, only end-of-line conversion.  Essentially, it directs
-Emacs to create new files with the Unix-style convention of using
-newline at the end of a line.  @xref{Coding Systems}.
+Emacs to default to creating new files with the Unix-style convention
+of using newline at the end of a line.  @xref{Coding Systems}.
 
 @node Windows Files
 @section File Names on MS-Windows
@@ -229,7 +249,9 @@ backslash, and also knows about drive letters in file names.
 
 @cindex file-name completion, on MS-Windows
   On MS-DOS/MS-Windows, file names are case-insensitive, so Emacs by
-default ignores letter-case in file names during completion.
+default ignores letter-case in file names during completion.  To this
+end, the default value of @code{read-file-name-completion-ignore-case}
+is address@hidden on MS-DOS/MS-Windows.  @xref{Completion Options}.
 
 @vindex w32-get-true-file-attributes
   The variable @code{w32-get-true-file-attributes} controls whether
@@ -311,9 +333,9 @@ it doesn't support all of them.  Here's the list of the 
switches it
 does support: @option{-A}, @option{-a}, @option{-B}, @option{-C},
 @option{-c}, @option{-G}, @option{-g}, @option{-h}, @option{-i}, @option{-n},
 @option{-R}, @option{-r}, @option{-S}, @option{-s}, @option{-t}, @option{-U},
address@hidden, and @option{-X}.  The @option{-F} switch is partially
-supported (it appends the character that classifies the file, but does
-not prevent symlink following).
address@hidden, @option{v}, and @option{-X}.  The @option{-F} switch is
+partially supported (it appends the character that classifies the
+file, but does not prevent symlink following).
 
 @vindex ls-lisp-use-insert-directory-program
   On MS-Windows and MS-DOS, @file{ls-lisp.el} is preloaded when Emacs
@@ -323,6 +345,26 @@ platforms.  If you have a ported @code{ls}, setting
 will revert to using an external program named by the variable
 @code{insert-directory-program}.
 
address@hidden Dired sorting order, on MS-Windows/MS-DOS
+  The order in which @file{ls-lisp.el} sorts files depends on several
+customizable options described below.
+
address@hidden ls-lisp-use-string-collate
+  The default sorting order follows locale-specific rules derived from
+your system locale.  You can make the order locale-independent by
+customizing @code{ls-lisp-use-string-collate} to a @code{nil} value.
+
address@hidden Unicode Collation Algorithm (UCA), and @file{ls-lisp.el}
address@hidden ls-lisp-UCA-like-collation
+  On GNU and Unix systems, when the locale's encoding is UTF-8, the
+collation order follows the Unicode Collation Algorithm
+(@acronym{UCA}).  To have a similar effect on MS-Windows, the variable
address@hidden should have a address@hidden value
+(this is the default).  The resulting sorting order ignores
+punctuation, symbol characters, and whitespace characters, so
address@hidden, @file{foobar} and @address@hidden bar}} will appear
+together rather than far apart.
+
 @vindex ls-lisp-ignore-case
   By default, @file{ls-lisp.el} uses a case-sensitive sort order for
 the directory listing it produces; this is so the listing looks the
@@ -371,10 +413,10 @@ Emulate address@hidden  Sets @code{ls-lisp-ignore-case} 
to @code{t}, and
 @item MS-Windows
 Emulate MS-Windows.  Sets @code{ls-lisp-ignore-case} and
 @code{ls-lisp-dirs-first} to @code{t}, and @code{ls-lisp-verbosity} to
address@hidden(links)} on Windows NT/2K/XP/2K3 and to @code{nil} on Windows 
address@hidden
-Note that the default emulation is @emph{not} @code{MS-Windows}, even
-on Windows, since many users of Emacs on those platforms prefer the
address@hidden defaults.
address@hidden on Windows 9X and to @code{t} on modern versions of
+Windows.  Note that the default emulation is @emph{not}
address@hidden, even on Windows, since many users of Emacs on those
+platforms prefer the @sc{gnu} defaults.
 @end table
 
 @noindent
@@ -421,6 +463,8 @@ formats file time stamps according to what
 @code{ls-lisp-format-time-list} specifies.  The @samp{%}-sequences in
 @code{ls-lisp-format-time-list} produce locale-dependent month and day
 names, which might cause misalignment of columns in Dired display.
+The default value of @code{ls-lisp-use-localized-time-format} is
address@hidden
 @end ifnottex
 
 @node Windows HOME
@@ -430,9 +474,9 @@ names, which might cause misalignment of columns in Dired 
display.
   The Windows equivalent of @code{HOME} is the @dfn{user-specific
 application data directory}.  The actual location depends on the
 Windows version; typical values are @file{C:\Documents and
address@hidden Data} on Windows 2000/XP/2K3,
address@hidden:address@hidden on Windows
-Vista/7/2008, and either @file{C:\WINDOWS\Application Data} or
address@hidden Data} on Windows 2000 up to XP,
address@hidden:address@hidden on Windows Vista and
+later, and either @file{C:\WINDOWS\Application Data} or
 @file{C:address@hidden Data} on Windows
 9X/address@hidden  If this directory does not exist or cannot be accessed, 
Emacs
 falls back to @file{C:\} as the default value of @code{HOME}.
@@ -453,7 +497,8 @@ default @code{HOME} location, and will not look in the 
application
 data directory, even if it exists.  Note that only @file{.emacs} is
 looked for in @file{C:\}; the older name @file{_emacs} (see below) is
 not.  This use of @file{C:\.emacs} to define @code{HOME} is
-deprecated.
+deprecated; Emacs will display a warning about its use during
+startup.
 
   Whatever the final place is, Emacs sets the internal value of the
 @env{HOME} environment variable to point to it, and it will use that
@@ -467,15 +512,15 @@ first line.  Likewise, to visit your init file, type 
@kbd{C-x C-f
 ~/.emacs @key{RET}} (assuming the file's name is @file{.emacs}).
 
 @cindex init file @file{.emacs} on MS-Windows
-  The home directory is where your init file is stored.  It can have
-any name mentioned in @ref{Init File}.
+  Your init file can have any name mentioned in @ref{Init File}.
 
 @cindex @file{_emacs} init file, MS-Windows
   Because MS-DOS does not allow file names with leading dots, and
 older Windows systems made it hard to create files with such names,
 the Windows port of Emacs supports an init file name @file{_emacs}, if
 such a file exists in the home directory and @file{.emacs} does not.
-This name is considered obsolete.
+This name is considered obsolete, so Emacs will display a warning if
+it is used.
 
 @node Windows Keyboard
 @section Keyboard Usage on MS-Windows
@@ -491,7 +536,9 @@ Emacs key bindings.  (These Emacs key bindings were 
established years
 before Microsoft was founded.)  Examples of conflicts include
 @kbd{C-c}, @kbd{C-x}, @kbd{C-z}, @kbd{C-a}, and @address@hidden
 You can redefine some of them with meanings more like the MS-Windows
-meanings by enabling CUA Mode (@pxref{CUA Bindings}).
+meanings by enabling CUA Mode (@pxref{CUA Bindings}).  Another
+optional feature which will make Emacs behave like other Windows
+applications is Delete Selection mode (@pxref{Using Region}).
 
 @iftex
 @inforef{Windows Keyboard, , emacs}, for information about additional
@@ -575,7 +622,7 @@ keys (it converts lower-case characters to their upper-case
 variants).  However, if you set the variable
 @code{w32-capslock-is-shiftlock} to a address@hidden value, the
 @key{CapsLock} key will affect non-character keys as well, as if you
-pressed the @key{Shift} key while typing the non-character key.
+pressed the @key{SHIFT} key while typing the non-character key.
 
 @vindex w32-enable-caps-lock
   If the variable @code{w32-enable-caps-lock} is set to a @code{nil}
@@ -690,16 +737,14 @@ is address@hidden, the roles of these two buttons are 
reversed.
 @cindex subprocesses on MS-Windows
 
 @cindex DOS applications, running from Emacs
-  Emacs compiled as a native Windows application (as opposed to the DOS
-version) includes full support for asynchronous subprocesses.
-In the Windows version, synchronous and asynchronous subprocesses work
-fine on both
-Windows 9X/ME and Windows NT/2K/XP/Vista/7/8/10 as long as you run
-only 32-bit or 64-bit Windows
-applications.  However, when you run a DOS application in a subprocess,
-you may encounter problems or be unable to run the application at all;
-and if you run two DOS applications at the same time in two
-subprocesses, you may have to reboot your system.
+  Emacs compiled as a native Windows application (as opposed to the
+DOS version) includes full support for asynchronous subprocesses.  In
+the Windows version, synchronous and asynchronous subprocesses work
+fine on all versions of MS-Windows, as long as you run only 32-bit or
+64-bit Windows applications.  However, when you run a DOS application
+in a subprocess, you may encounter problems or be unable to run the
+application at all; and if you run two DOS applications at the same
+time in two subprocesses, you may have to reboot your system.
 
 Since the standard command interpreter (and most command line utilities)
 on Windows 9X are DOS applications, these problems are significant when
@@ -724,13 +769,13 @@ first one finishes, even if either or both of them are 
asynchronous.
 
 @cindex kill DOS application
 If you can go to the first subprocess, and tell it to exit, the second
-subprocess should continue normally.  However, if the second subprocess
-is synchronous, Emacs itself will be hung until the first subprocess
-finishes.  If it will not finish without user input, then you have no
-choice but to reboot if you are running on Windows address@hidden  If you are
-running on Windows NT/2K/XP, you can use a process viewer application to kill
-the appropriate instance of NTVDM instead (this will terminate both DOS
-subprocesses).
+subprocess should continue normally.  However, if the second
+subprocess is synchronous, Emacs itself will be hung until the first
+subprocess finishes.  If it will not finish without user input, then
+you have no choice but to reboot if you are running on Windows address@hidden
+If you are running on Windows NT and later, you can use a process
+viewer application to kill the appropriate instance of NTVDM instead
+(this will terminate both DOS subprocesses).
 
 If you have to reboot Windows 9X in this situation, do not use the
 @code{Shutdown} command on the @code{Start} menu; that usually hangs the
@@ -1033,7 +1078,8 @@ the system default antialiasing.
 @node Windows Misc
 @section Miscellaneous Windows-specific features
 
-  This section describes miscellaneous Windows-specific features.
+  This section describes Windows-specific features that don't fit
+anywhere else.
 
 @vindex w32-use-visible-system-caret
 @cindex screen reader software, MS-Windows
diff --git a/doc/emacs/mule.texi b/doc/emacs/mule.texi
index 4989982..dc80bc9 100644
--- a/doc/emacs/mule.texi
+++ b/doc/emacs/mule.texi
@@ -1841,7 +1841,33 @@ sometimes jump when point traverses reordered 
bidirectional text.
 Similarly, a highlighted region covering a contiguous range of
 character positions may look discontinuous if the region spans
 reordered text.  This is normal and similar to the behavior of other
-programs that support bidirectional text.  If you set
address@hidden to a address@hidden value, cursor
-motion by the arrow keys follows the visual order on screen
-(@pxref{Moving Point, visual-order movement}).
+programs that support bidirectional text.
+
address@hidden address@hidden, and bidirectional text}
address@hidden address@hidden, and bidirectional text}
address@hidden address@hidden, and bidirectional text}
address@hidden address@hidden, and bidirectional text}
+  Cursor motion commands bound to arrow keys, such as @key{LEFT} and
address@hidden@key{RIGHT}}, are sensitive to the base direction of the
+current paragraph.  In a left-to-right paragraph, commands bound to
address@hidden with or without modifiers move @emph{forward} through
+buffer text, but in a right-to-left paragraph they move
address@hidden instead.  This reflects the fact that in a
+right-to-left paragraph buffer positions predominantly increase when
+moving to the left on display.
+
+  When you move out of a paragraph, the meaning of the arrow keys
+might change if the base direction of the preceding or the following
+paragraph is different from the paragraph out of which you moved.
+When that happens, you need to adjust the arrow key you press to the
+new base direction.
+
address@hidden visual-order-cursor-movement
address@hidden cursor, visual-order motion
+  By default, @key{LEFT} and @key{RIGHT} move in the logical order,
+but if @code{visual-order-cursor-movement} is address@hidden, these
+commands move to the character that is, correspondingly, to the left
+or right of the current screen position, moving to the next or
+previous screen line as appropriate.  Note that this might potentially
+move point many buffer positions away, depending on the surrounding
+bidirectional context.
diff --git a/doc/emacs/package.texi b/doc/emacs/package.texi
index bc6afb7..6c74937 100644
--- a/doc/emacs/package.texi
+++ b/doc/emacs/package.texi
@@ -241,57 +241,55 @@ lower-priority archives will not be shown in the menu, if 
the same
 package is available from a higher-priority archive.  (This is
 controlled by the value of @code{package-menu-hide-low-priority}.)
 
-  Once a package is downloaded and installed, it is @dfn{loaded} into
-the current Emacs session.  Loading a package is not quite the same as
-loading a Lisp library (@pxref{Lisp Libraries}); loading a package
-adds its directory to @code{load-path} and loads its autoloads.  The
-effect of a package's autoloads varies from package to package.  Most
-packages just make some new commands available, while others have more
+  Once a package is downloaded and installed, it is made available to
+the current Emacs session.  Making a package available adds its
+directory to @code{load-path} and loads its autoloads.  The effect of
+a package's autoloads varies from package to package.  Most packages
+just make some new commands available, while others have more
 wide-ranging effects on the Emacs session.  For such information,
 consult the package's help buffer.
 
-  By default, Emacs also automatically loads all installed packages in
-subsequent Emacs sessions.  This happens at startup, after processing
-the init file (@pxref{Init File}).  As an exception, Emacs does not
-load packages at startup if invoked with the @samp{-q} or
address@hidden options (@pxref{Initial Options}).
+  After a package is installed, it is automatically made available by
+Emacs in all subsequent sessions.  This happens at startup, before
+processing the init file but after processing the early init file
+(@pxref{Early Init File,,, elisp, The Emacs Lisp Reference Manual}).
+As an exception, Emacs does not make packages available at startup if
+invoked with the @samp{-q} or @samp{--no-init-file} options
+(@pxref{Initial Options}).
 
 @vindex package-enable-at-startup
-  To disable automatic package loading, change the variable
address@hidden to @code{nil}.
+  To keep Emacs from automatically making packages available at
+startup, change the variable @code{package-enable-at-startup} to
address@hidden  You must do this in the early init file (@pxref{Early
+Init File,,, elisp, The Emacs Lisp Reference Manual}), as the variable
+is read before loading the regular init file.  Currently this variable
+cannot be set via Customize.
 
 @findex package-initialize
-  The reason automatic package loading occurs after loading the init
-file is that user options only receive their customized values after
-loading the init file, including user options which affect the
-packaging system.  In some circumstances, you may want to load
-packages explicitly in your init file (usually because some other code
-in your init file depends on a package).  In that case, your init file
-should call the function @code{package-initialize}.  It is up to you
-to ensure that relevant user options, such as @code{package-load-list}
-(see below), are set up prior to the @code{package-initialize} call.
-This will automatically set @code{package-enable-at-startup} to @code{nil}, to
-avoid loading the packages again after processing the init file.
-Alternatively, you may choose to completely inhibit package loading at
-startup, and invoke the command @kbd{M-x package-initialize} to load
-your packages manually.
+  If you have set @code{package-enable-at-startup} to @code{nil}, you
+can still make packages available either during or after startup.  To
+make installed packages available during startup, call the function
address@hidden in your init file.  To make installed
+packages available after startup, invoke the command @kbd{M-x
+package-initialize}.
 
 @vindex package-load-list
-  For finer control over package loading, you can use the variable
address@hidden  Its value should be a list.  A list element
-of the form @code{(@var{name} @var{version})} tells Emacs to load
-version @var{version} of the package named @var{name}.  Here,
address@hidden should be a version string (corresponding to a specific
-version of the package), or @code{t} (which means to load any
-installed version), or @code{nil} (which means no version; this
-disables the package, preventing it from being loaded).  A list
-element can also be the symbol @code{all}, which means to load the
-latest installed version of any package not named by the other list
-elements.  The default value is just @code{'(all)}.
-
-  For example, if you set @code{package-load-list} to @code{'((muse
-"3.20") all)}, then Emacs only loads version 3.20 of the @samp{muse}
-package, plus any installed version of packages other than
+  For finer control over which packages are made available at startup,
+you can use the variable @code{package-load-list}.  Its value should
+be a list.  A list element of the form @address@hidden(@var{name}
address@hidden)}} tells Emacs to make available version @var{version} of
+the package named @var{name}.  Here, @var{version} should be a version
+string (corresponding to a specific version of the package), or
address@hidden (which means to make available any installed version), or
address@hidden (which means no version; this disables the package,
+preventing it from being made available).  A list element can also be
+the symbol @code{all}, which means to make available the latest
+installed version of any package not named by the other list elements.
+The default value is just @code{'(all)}.
+
+  For example, if you set @code{package-load-list} to @address@hidden'((muse
+"3.20") all)}}, then Emacs only makes available version 3.20 of the
address@hidden package, plus any installed version of packages other than
 @samp{muse}.  Any other version of @samp{muse} that happens to be
 installed will be ignored.  The @samp{muse} package will be listed in
 the package menu with the @samp{held} status.
diff --git a/doc/emacs/programs.texi b/doc/emacs/programs.texi
index 4289124..4a59f43 100644
--- a/doc/emacs/programs.texi
+++ b/doc/emacs/programs.texi
@@ -73,23 +73,27 @@ mode for the C programming language is @code{c-mode}.
 @cindex Python mode
 @cindex Ruby mode
 @cindex Simula mode
address@hidden Verilog mode
 @cindex VHDL mode
 @cindex M4 mode
 @cindex Shell-script mode
address@hidden Scheme mode
 @cindex OPascal mode
 @cindex PostScript mode
 @cindex Conf mode
 @cindex DNS mode
 @cindex Javascript mode
address@hidden Awk mode
   Emacs has programming language modes for Lisp, Scheme, the
 Scheme-based DSSSL expression language, Ada, ASM, AWK, C, C++,
-Fortran, Icon, IDL (CORBA), IDLWAVE, Java, Javascript, Metafont
-(@TeX{}'s companion for font creation), Modula2, Object Pascal, Objective-C,
-Octave, Pascal, Perl, Pike, PostScript, Prolog, Python, Ruby, Simula, Tcl,
-and address@hidden  An alternative mode for Perl is called CPerl mode.  Modes 
are
-also available for the scripting languages of the common GNU and Unix
-shells, and MS-DOS/MS-Windows @samp{BAT} files, and for makefiles,
-DNS master files, and various sorts of configuration files.
+Fortran, Icon, IDL (CORBA), IDLWAVE, Java, Javascript, M4, Makefiles,
+Metafont (@TeX{}'s companion for font creation), Modula2, Object
+Pascal, Objective-C, Octave, Pascal, Perl, Pike, PostScript, Prolog,
+Python, Ruby, Simula, SQL, Tcl, Verilog, and address@hidden  An alternative
+mode for Perl is called CPerl mode.  Modes are also available for the
+scripting languages of the common GNU and Unix shells, and
+MS-DOS/MS-Windows @samp{BAT} files, and for makefiles, DNS master
+files, and various sorts of configuration files.
 
   Ideally, Emacs should have a major mode for each programming
 language that you might want to edit.  If it doesn't have a mode for
@@ -100,12 +104,13 @@ distributed with Emacs (@pxref{Packages}); or you can 
contribute one.
 @findex backward-delete-char-untabify
   In most programming languages, indentation should vary from line to
 line to illustrate the structure of the program.  Therefore, in most
-programming language modes, typing @key{TAB} updates the indentation
-of the current line (@pxref{Program Indent}).  Furthermore, @key{DEL}
-is usually bound to @code{backward-delete-char-untabify}, which
-deletes backward treating each tab as if it were the equivalent number
-of spaces, so that you can delete one column of indentation without
-worrying whether the whitespace consists of spaces or tabs.
+programming language modes, typing @address@hidden updates the
+indentation of the current line (@pxref{Program Indent}).
+Furthermore, @address@hidden is usually bound to
address@hidden, which deletes backward treating
+each tab as if it were the equivalent number of spaces, so that you
+can delete one column of indentation without worrying whether the
+whitespace consists of spaces or tabs.
 
 @cindex mode hook, and major modes
 @vindex c-mode-hook
@@ -122,13 +127,14 @@ For instance, entering C mode runs the hooks 
@code{prog-mode-hook} and
 @ifnottex
   Separate manuals are available for the modes for Ada (@pxref{Top,,
 Ada Mode, ada-mode, Ada Mode}), C/C++/Objective C/Java/Corba
-IDL/Pike/AWK (@pxref{Top, , CC Mode, ccmode, CC Mode}), and IDLWAVE
-(@pxref{Top,, IDLWAVE, idlwave, IDLWAVE User Manual}).
+IDL/Pike/AWK (@pxref{Top, , CC Mode, ccmode, CC Mode}), Octave, VHDL,
+and IDLWAVE (@pxref{Top,, IDLWAVE, idlwave, IDLWAVE User Manual}).
 @end ifnottex
 @iftex
   The Emacs distribution contains Info manuals for the major modes for
-Ada, C/C++/Objective C/Java/Corba IDL/Pike/AWK, and address@hidden  For
-Fortran mode, @pxref{Fortran,,, emacs-xtra, Specialized Emacs Features}.
+Ada, C/C++/Objective C/Java/Corba IDL/Pike/AWK, Octave, VHDL, and
address@hidden  For Fortran mode, @pxref{Fortran,,, emacs-xtra, Specialized
+Emacs Features}.
 @end iftex
 
 @node Defuns
@@ -151,56 +157,22 @@ Emacs we use it for all languages.
 
 @cindex open-parenthesis in leftmost column
 @cindex ( in leftmost column
-  Many programming-language modes assume by default that any opening
-delimiter found at the left margin is the start of a top-level
-definition, or defun.  Therefore, @strong{don't put an opening
-delimiter at the left margin unless it should have that significance}.
-For instance, never put an open-parenthesis at the left margin in a
-Lisp file unless it is the start of a top-level list.
-
-  The convention speeds up many Emacs operations, which would
-otherwise have to scan back to the beginning of the buffer to analyze
-the syntax of the code.
-
-  If you don't follow this convention, not only will you have trouble
-when you explicitly use the commands for motion by defuns; other
-features that use them will also give you trouble.  This includes the
-indentation commands (@pxref{Program Indent}) and Font Lock mode
-(@pxref{Font Lock}).
-
-  The most likely problem case is when you want an opening delimiter
-at the start of a line inside a string.  To avoid trouble, put an
-escape character (@samp{\}, in C and Emacs Lisp, @samp{/} in some
-other Lisp dialects) before the opening delimiter.  This will not
-affect the contents of the string, but will prevent that opening
-delimiter from starting a defun.  Here's an example:
-
address@hidden
-  (insert "Foo:
-\(bar)
-")
address@hidden example
-
-  To help you catch violations of this convention, Font Lock mode
-highlights confusing opening delimiters (those that ought to be
-quoted) in bold red.
+  Many programming-language modes have traditionally assumed that any
+opening parenthesis or brace found at the left margin is the start of
+a top-level definition, or defun.  So, by default, commands which seek
+the beginning of a defun accept such a delimiter as signifying that
+position.
 
 @vindex open-paren-in-column-0-is-defun-start
-  If you need to override this convention, you can do so by setting
-the variable @code{open-paren-in-column-0-is-defun-start}.
-If this user option is set to @code{t} (the default), opening
-parentheses or braces at column zero always start defuns.  When it is
+  If you want to override this convention, you can do so by setting
+the user option @code{open-paren-in-column-0-is-defun-start} to
address@hidden  If this option is set to @code{t} (the default), commands
+seeking the start of a defun will stop at opening parentheses or
+braces at column zero which aren't in a comment or string.  When it is
 @code{nil}, defuns are found by searching for parens or braces at the
-outermost level.
-
-  Usually, you should leave this option at its default value of
address@hidden  If your buffer contains parentheses or braces in column
-zero which don't start defuns, and it is somehow impractical to remove
-these parentheses or braces, it might be helpful to set the option to
address@hidden  Be aware that this might make scrolling and display in
-large buffers quite sluggish.  Furthermore, the parentheses and braces
-must be correctly matched throughout the buffer for it to work
-properly.
+outermost level.  Since low-level Emacs routines no longer depend on
+this convention, you usually won't need to change
address@hidden from its default.
 
 @node Moving by Defuns
 @subsection Moving by Defuns
@@ -362,6 +334,7 @@ language modes.
 @cindex pretty-printer
   Emacs also provides a Lisp pretty-printer in the @code{pp} package,
 which reformats Lisp objects with nice-looking indentation.
address@hidden Functions, pp,, elisp, The Emacs Lisp Reference Manual}.
 
 @node Basic Indent
 @subsection Basic Program Indentation Commands
@@ -376,16 +349,18 @@ Insert a newline, then adjust indentation of following 
line
 
 @kindex TAB @r{(programming modes)}
 @findex indent-line-function
-  The basic indentation command is @key{TAB}
+  The basic indentation command is @address@hidden
 (@code{indent-for-tab-command}), which was documented in
address@hidden  In programming language modes, @key{TAB} indents
-the current line, based on the indentation and syntactic content of
-the preceding lines; if the region is active, @key{TAB} indents each
-line within the region, not just the current line.
address@hidden  In programming language modes, @address@hidden
+indents the current line, based on the indentation and syntactic
+content of the preceding lines; if the region is active,
address@hidden@key{TAB}} indents each line within the region, not just the
+current line.
 
-  The command @key{RET} (@code{newline}), which was documented in
address@hidden Text}, does the same as @kbd{C-j} followed by
address@hidden: it inserts a new line, then adjusts the line's indentation.
+  The command @address@hidden (@code{newline}), which was documented
+in @ref{Inserting Text}, does the same as @kbd{C-j} followed by
address@hidden@key{TAB}}: it inserts a new line, then adjusts the line's
+indentation.
 
   When indenting a line that starts within a parenthetical grouping,
 Emacs usually places the start of the line under the preceding line
@@ -394,7 +369,7 @@ manually give one of these lines a nonstandard indentation 
(e.g., for
 aesthetic purposes), the lines below will follow it.
 
   The indentation commands for most programming language modes assume
-that a open-parenthesis, open-brace or other opening delimiter at the
+that an open-parenthesis, open-brace or other opening delimiter at the
 left margin is the start of a function.  If the code you are editing
 violates this assumption---even if the delimiters occur in strings or
 comments---you must set @code{open-paren-in-column-0-is-defun-start}
@@ -406,7 +381,7 @@ Paren}.
 
   Sometimes, you may want to reindent several lines of code at a time.
 One way to do this is to use the mark; when the mark is active and the
-region is non-empty, @key{TAB} indents every line in the region.
+region is non-empty, @address@hidden indents every line in the region.
 Alternatively, the command @kbd{C-M-\} (@code{indent-region}) indents
 every line in the region, whether or not the mark is active
 (@pxref{Indentation Commands}).
@@ -434,19 +409,19 @@ grouping, without affecting its overall indentation 
(i.e., the
 indentation of the line where the grouping starts).  The function that
 @kbd{C-M-q} runs depends on the major mode; it is
 @code{indent-pp-sexp} in Lisp mode, @code{c-indent-exp} in C mode,
-etc.  To correct the overall indentation as well, type @key{TAB}
+etc.  To correct the overall indentation as well, type @address@hidden
 first.
 
 @kindex C-u TAB
   If you like the relative indentation within a grouping but not the
 indentation of its first line, move point to that first line and type
 @kbd{C-u @key{TAB}}.  In Lisp, C, and some other major modes,
address@hidden with a numeric argument reindents the current line as usual,
-then reindents by the same amount all the lines in the parenthetical
-grouping starting on the current line.  It is clever, though, and does
-not alter lines that start inside strings.  Neither does it alter C
-preprocessor lines when in C mode, but it does reindent any
-continuation lines that may be attached to them.
address@hidden@key{TAB}} with a numeric argument reindents the current line as
+usual, then reindents by the same amount all the lines in the
+parenthetical grouping starting on the current line.  It is clever,
+though, and does not alter lines that start inside strings.  Neither
+does it alter C preprocessor lines when in C mode, but it does
+reindent any continuation lines that may be attached to them.
 
 @findex indent-code-rigidly
   The command @kbd{M-x indent-code-rigidly} rigidly shifts all the
@@ -488,7 +463,7 @@ expression.
   You can override the standard pattern in various ways for individual
 functions, according to the @code{lisp-indent-function} property of
 the function name.  This is normally done for macro definitions, using
-the @code{declare} construct.  @xref{Defining Macros,,, elisp, the
+the @code{declare} construct.  @xref{Defining Macros,,, elisp, The
 Emacs Lisp Reference Manual}.
 
 @node C Indent
@@ -496,7 +471,7 @@ Emacs Lisp Reference Manual}.
 
   Here are special features for indentation in C mode and related modes:
 
address@hidden @code
address@hidden @kbd
 @item C-c C-q
 @kindex C-c C-q @r{(C mode)}
 @findex c-indent-defun
@@ -918,9 +893,9 @@ also do spell checking on comments with Flyspell Prog mode
 comments.  For example, in Lisp code, comments starting with two
 semicolons are indented as if they were lines of code, while those
 starting with three semicolons are supposed to be aligned to the left
-margin and are often used for sectioning purposes.  Emacs understand
-these conventions; for instance, typing @key{TAB} on a comment line
-will indent the comment to the appropriate position.
+margin and are often used for sectioning purposes.  Emacs understands
+these conventions; for instance, typing @address@hidden on a comment
+line will indent the comment to the appropriate position.
 
 @example
 ;; This function is just an example.
@@ -949,14 +924,16 @@ will indent the comment to the appropriate position.
 Insert or realign comment on current line; if the region is active,
 comment or uncomment the region instead (@code{comment-dwim}).
 @item @kbd{C-x C-;}
-Comment or uncomment the current line (@code{comment-line}).
+Comment or uncomment the current line (@code{comment-line}).  If the
+region is active, comment or uncomment the lines in the region
+instead.
 @item @kbd{C-u M-;}
 Kill comment on current line (@code{comment-kill}).
 @item @kbd{C-x ;}
 Set comment column (@code{comment-set-column}).
 @item @kbd{C-M-j}
 @itemx @kbd{M-j}
-Like @key{RET} followed by inserting and aligning a comment
+Like @address@hidden followed by inserting and aligning a comment
 (@code{comment-indent-new-line}).  @xref{Multi-Line Comments}.
 @item @kbd{M-x comment-region}
 @itemx @kbd{C-c C-c} (in C-like modes)
@@ -986,15 +963,15 @@ negative argument @var{-n} removes @var{n} delimiters.
 current line, @kbd{M-;} adds a new comment to the current line.  If
 the line is blank (i.e., empty or containing only whitespace
 characters), the comment is indented to the same position where
address@hidden would indent to (@pxref{Basic Indent}).  If the line is
-non-blank, the comment is placed after the last non-whitespace
-character on the line; normally, Emacs tries putting it at the column
-specified by the variable @code{comment-column} (@pxref{Options for
-Comments}), but if the line already extends past that column, it puts
-the comment at some suitable position, usually separated from the
-non-comment text by at least one space.  In each case, Emacs places
-point after the comment's starting delimiter, so that you can start
-typing the comment text right away.
address@hidden@key{TAB}} would indent to (@pxref{Basic Indent}).  If the line
+is non-blank, the comment is placed after the last non-whitespace
+character on the line.  Emacs tries to fit the comment between the
+columns specified by the variables @code{comment-column} and
address@hidden (@pxref{Options for Comments}), if
+possible.  Otherwise, it will choose some other suitable position,
+usually separated from the non-comment text by at least one space.  In
+each case, Emacs places point after the comment's starting delimiter,
+so that you can start typing the comment text right away.
 
   You can also use @kbd{M-;} to align an existing comment.  If a line
 already contains the comment-start string, @kbd{M-;} realigns it to
@@ -1036,8 +1013,7 @@ region, even if the mark is inactive.  In C mode and 
related modes,
 this command is bound to @kbd{C-c C-c}.  The command @kbd{M-x
 uncomment-region} uncomments each line in the region; a numeric prefix
 argument specifies the number of comment delimiters to remove
-(negative arguments specify the number of comment to delimiters to
-add).
+(negative arguments specify the number of comment delimiters to add).
 
   For C-like modes, you can configure the exact effect of @kbd{M-;} by
 setting the variables @code{c-indent-comment-alist} and
@@ -1088,13 +1064,16 @@ comment.  Enable the @code{comment-close-slash} 
clean-up for this.
 @subsection Options Controlling Comments
 
 @vindex comment-column
address@hidden comment-fill-column
 @kindex C-x ;
 @findex comment-set-column
   As mentioned in @ref{Comment Commands}, when the @kbd{M-j} command
-adds a comment to a line, it tries to place the comment at the column
-specified by the buffer-local variable @code{comment-column}.  You can
-set either the local value or the default value of this buffer-local
-variable in the usual way (@pxref{Locals}).  Alternatively, you can
+adds a comment to a line, it tries to place the comment between the
+columns specified by the buffer-local variables @code{comment-column}
+and @code{comment-fill-column} (or if that is @code{nil}, then the
+value of @code{fill-column}, @pxref{Fill Commands}).  You can set
+either the local value or the default value of these buffer-local
+variables in the usual way (@pxref{Locals}).  Alternatively, you can
 type @kbd{C-x ;} (@code{comment-set-column}) to set the value of
 @code{comment-column} in the current buffer to the column where point
 is currently located.  @kbd{C-u C-x ;} sets the comment column to
@@ -1142,8 +1121,8 @@ comment or for aligning an existing comment.  It is set 
differently by
 various major modes.  The function is called with no arguments, but with
 point at the beginning of the comment, or at the end of a line if a new
 comment is to be inserted.  It should return the column in which the
-comment ought to start.  For example, the default hook function bases
-its decision on how many comment characters begin an existing comment.
+comment ought to start.  For example, the default function bases its
+decision on how many comment characters begin an existing comment.
 
 Emacs also tries to align comments on adjacent lines.  To override
 this, the function may return a cons of two (possibly equal) integers
@@ -1174,10 +1153,10 @@ buffer at point.  For example, in C mode this looks for 
the symbol in
 the C Library Manual.  The command only works if the appropriate
 manual's Info files are installed.
 
-  The major mode determines where to look for documentation for the
-symbol---which Info files to look in, and which indices to search.
-You can also use @kbd{M-x info-lookup-file} to look for documentation
-for a file name.
+  Emacs determines where to look for documentation for the
+symbol---which Info files to look in, and which indices to
+search---based on the major mode.  You can also use @kbd{M-x
+info-lookup-file} to look for documentation for a file name.
 
   If you use @kbd{C-h S} in a major mode that does not support it,
 it asks you to specify the symbol help mode.  You should enter
@@ -1247,6 +1226,10 @@ several manual pages by the same name exist in different 
sections, it
 pops up a window with possible candidates asking you to choose one of
 them.
 
+  Note that @kbd{M-x woman} doesn't yet support the latest features of
+modern man pages, so we recommend using @kbd{M-x man} if that is
+available on your system.
+
   For more information about setting up and using @kbd{M-x woman}, see
 @ifinfo
 @ref{Top, WoMan, Browse UN*X Manual Pages WithOut Man, woman, The
@@ -1327,7 +1310,7 @@ Hide all top-level blocks (@code{hs-hide-all}).
 @item C-c @@ C-M-s
 @itemx C-c @@ C-a
 Show all blocks in the buffer (@code{hs-show-all}).
address@hidden C-c @@ C-l
address@hidden C-u @var{n} C-c @@ C-l
 Hide all blocks @var{n} levels below this block
 (@code{hs-hide-level}).
 @end table
@@ -1449,8 +1432,8 @@ the menu item named @samp{Source Code Parsers (Semantic)} 
in the
 
    When Semantic mode is enabled, Emacs automatically attempts to
 parse each file you visit.  Currently, Semantic understands C, C++,
-Scheme, Javascript, Java, HTML, and Make.  Within each parsed buffer,
-the following commands are available:
+HTML, Java, Javascript, Make, Python, Scheme, SRecode, and Texinfo.
+Within each parsed buffer, the following commands are available:
 
 @table @kbd
 @item C-c , j
@@ -1467,10 +1450,10 @@ parsed, and move point there 
(@code{semantic-complete-jump}).
 @kindex C-c , SPC
 Display a list of possible completions for the symbol at point
 (@code{semantic-complete-analyze-inline}).  This also activates a set
-of special key bindings for choosing a completion: @key{RET} accepts
-the current completion, @kbd{M-n} and @kbd{M-p} cycle through possible
-completions, @key{TAB} completes as far as possible and then cycles,
-and @kbd{C-g} or any other key aborts completion.
+of special key bindings for choosing a completion: @address@hidden
+accepts the current completion, @kbd{M-n} and @kbd{M-p} cycle through
+possible completions, @address@hidden completes as far as possible and
+then cycles, and @kbd{C-g} or any other key aborts completion.
 
 @item C-c , l
 @kindex C-c , l
@@ -1494,7 +1477,7 @@ is idle.
 programs are useful for that nonetheless.
 
   The Emacs commands that operate on words, sentences and paragraphs
-are useful for editing code.  Most symbols names contain words
+are useful for editing code.  Most symbol names contain words
 (@pxref{Words}), while sentences can be found in strings and comments
 (@pxref{Sentences}).  As for paragraphs, they are defined in most
 programming language modes to begin and end at blank lines
@@ -1669,8 +1652,9 @@ electric characters are @address@hidden, @address@hidden, 
@kbd{:}, @kbd{#},
   You might find electric indentation inconvenient if you are editing
 chaotically indented code.  If you are new to CC Mode, you might find
 it disconcerting.  You can toggle electric action with the command
address@hidden C-l}; when it is enabled, @samp{/l} appears in the mode line
-after the mode name:
address@hidden C-l}; when it is enabled, @samp{/@var{c}l} appears in the
+mode line after the mode name (where @var{c}, if present, is @samp{*}
+or @samp{/}):
 
 @table @kbd
 @item C-c C-l
@@ -1683,8 +1667,8 @@ negative one it disables it.
 
   Electric characters insert newlines only when, in addition to the
 electric state, the @dfn{auto-newline} feature is enabled (indicated
-by @samp{/la} in the mode line after the mode name).  You can turn
-this feature on or off with the command @kbd{C-c C-a}:
+by @samp{/@var{c}la} in the mode line after the mode name).  You can
+turn this feature on or off with the command @kbd{C-c C-a}:
 
 @table @kbd
 @item C-c C-a
@@ -1728,10 +1712,11 @@ Delete the entire block of whitespace after point 
(@code{c-hungry-delete-forward
 @end table
 
   As an alternative to the above commands, you can enable @dfn{hungry
-delete mode}.  When this feature is enabled (indicated by @samp{/h} in
-the mode line after the mode name), a single @key{DEL} deletes all
-preceding whitespace, not just one space, and a single @kbd{C-d}
-(but @emph{not} plain @key{Delete}) deletes all following whitespace.
+delete mode}.  When this feature is enabled (indicated by @samp{h}
+after a @samp{/} in the mode line after the mode name), a single
address@hidden@key{DEL}} deletes all preceding whitespace, not just one space,
+and a single @kbd{C-d} (but @emph{not} plain @address@hidden)
+deletes all following whitespace.
 
 @table @kbd
 @item M-x c-toggle-hungry-state
@@ -1754,14 +1739,14 @@ hungry-delete feature is enabled.
 @findex c-context-line-break
 This command inserts a line break and indents the new line in a manner
 appropriate to the context.  In normal code, it does the work of
address@hidden (@code{newline}), in a C preprocessor line it additionally
address@hidden@key{RET}} (@code{newline}), in a C preprocessor line it 
additionally
 inserts a @samp{\} at the line break, and within comments it's like
 @kbd{M-j} (@code{c-indent-new-comment-line}).
 
 @code{c-context-line-break} isn't bound to a key by default, but it
 needs a binding to be useful.  The following code will bind it to
address@hidden  We use @code{c-initialization-hook} here to make sure
-the keymap is loaded before we try to change it.
address@hidden@key{RET}}.  We use @code{c-initialization-hook} here to make
+sure the keymap is loaded before we try to change it.
 
 @example
 (defun my-bind-clb ()
@@ -1886,11 +1871,14 @@ defines these commands:
 @item @key{TAB}
 @code{tab-to-tab-stop}.
 @c FIXME: Maybe this should be consistent with other programming modes.
+
 @item C-j
 Insert a newline and then indent using @code{tab-to-tab-stop}.
+
 @item :
 Insert a colon and then remove the indentation from before the label
 preceding colon.  Then do @code{tab-to-tab-stop}.
+
 @item ;
 Insert or align a comment.
 @end table
diff --git a/doc/emacs/regs.texi b/doc/emacs/regs.texi
index dd9e4d7..8ff36ca 100644
--- a/doc/emacs/regs.texi
+++ b/doc/emacs/regs.texi
@@ -18,7 +18,7 @@ or a number (such as @samp{1}); case matters, so register 
@samp{a} is
 not the same as register @samp{A}.  You can also set a register in
 non-alphanumeric characters, for instance @samp{*} or @samp{C-d}.
 Note, it's not possible to set a register in @samp{C-g} or @samp{ESC},
-because these keys are reserved to terminate interactive commands.
+because these keys are reserved for quitting (@pxref{Quitting}).
 
 @findex view-register
   A register can store a position, a piece of text, a rectangle, a
diff --git a/doc/emacs/rmail.texi b/doc/emacs/rmail.texi
index 09cb034..e9371f3 100644
--- a/doc/emacs/rmail.texi
+++ b/doc/emacs/rmail.texi
@@ -1585,7 +1585,7 @@ use it, add the @samp{--tls} flag to 
@code{rmail-movemail-flags}.
   If your incoming mail is stored on a local machine in a format other
 than Unix mailbox, you will need the Mailutils @command{movemail} to
 retrieve it.  @xref{Movemail}, for the detailed description of
address@hidden versions.  For example, to access mail from a inbox in
address@hidden versions.  For example, to access mail from an inbox in
 @code{maildir} format located in @file{/var/spool/mail/in}, you would
 include the following in the Rmail inbox list:
 
diff --git a/doc/emacs/search.texi b/doc/emacs/search.texi
index c0adab4..319f64f 100644
--- a/doc/emacs/search.texi
+++ b/doc/emacs/search.texi
@@ -1,3 +1,4 @@
address@hidden -*- coding: utf-8 -*-
 @c This is part of the Emacs manual.
 @c Copyright (C) 1985-1987, 1993-1995, 1997, 2000-2018 Free Software
 @c Foundation, Inc.
@@ -902,7 +903,8 @@ starting and ending characters with a @samp{-} between 
them.  Thus,
 @samp{[a-z]} matches any lower-case @acronym{ASCII} letter.  Ranges may be
 intermixed freely with individual characters, as in @samp{[a-z$%.]},
 which matches any lower-case @acronym{ASCII} letter or @samp{$}, @samp{%} or
-period.
+period.  As another example, @samp{[α-ωί]} matches all lower-case
+Greek letters.
 
 You can also include certain special @dfn{character classes} in a
 character set.  A @samp{[:} and balancing @samp{:]} enclose a
@@ -1114,7 +1116,8 @@ matches the empty string, but only at the beginning of a 
symbol.
 A symbol is a sequence of one or more symbol-constituent characters.
 A symbol-constituent character is a character whose syntax is either
 @samp{w} or @samp{_}.  @samp{\_<} matches at the beginning of the
-buffer only if a symbol-constituent character follows.
+buffer only if a symbol-constituent character follows.  As with words,
+the syntax table determines which characters are symbol-constituent.
 
 @item \_>
 matches the empty string, but only at the end of a symbol.  @samp{\_>}
@@ -1214,7 +1217,7 @@ search string matches exactly one space.
   Searches in Emacs by default ignore the case of the text they are
 searching through, if you specify the search string in lower case.
 Thus, if you specify searching for @samp{foo}, then @samp{Foo} and
address@hidden also match.  Regexps, and in particular character sets,
address@hidden also match.  Regexps, and in particular character sets,
 behave likewise: @samp{[ab]} matches @samp{a} or @samp{A} or @samp{b}
 or @samp{B}.  This feature is known as @dfn{case folding}, and it is
 supported in both incremental and non-incremental search modes.
@@ -1226,9 +1229,9 @@ case-sensitive.  Thus, searching for @samp{Foo} does not 
find
 as well as to literal string search.  The effect ceases if you delete
 the upper-case letter from the search string.  The variable
 @code{search-upper-case} controls this: if it is address@hidden (the
-default), an upper-case character in the search string make the search
-case-sensitive; setting it to @code{nil} disables this effect of
-upper-case characters.
+default), an upper-case character in the search string makes the
+search case-sensitive; setting it to @code{nil} disables this effect
+of upper-case characters.
 
 @vindex case-fold-search
   If you set the variable @code{case-fold-search} to @code{nil}, then
@@ -1349,7 +1352,7 @@ activating the mark; use @kbd{C-u address@hidden to move 
back there.
 surrounded by word boundaries.
 
   @xref{Replacement and Lax Matches}, for details about
-case-sensitivity in replace commands.
+case-sensitivity and character folding in replace commands.
 
 @node Regexp Replace
 @subsection Regexp Replacement
@@ -1411,13 +1414,14 @@ symbol name goes with the symbol name, so the value 
replaces them
 both.
 
   Inside such an expression, you can use some special sequences.
address@hidden&} and @address@hidden refer here, as usual, to the entire
-match as a string, and to a submatch as a string.  @var{n} may be
-multiple digits, and the value of @address@hidden is @code{nil} if
-subexpression @var{n} did not match.  You can also use @samp{\#&} and
address@hidden@var{n}} to refer to those matches as numbers (this is valid
-when the match or submatch has the form of a numeral).  @samp{\#} here
-too stands for the number of already-completed replacements.
address@hidden&} and @address@hidden refer here, as usual, to the entire
+match as a string, and to a submatch as a string.  @var{d} may be
+multiple digits, and the value of @address@hidden is @code{nil} if the
address@hidden'th parenthesized grouping did not match.  You can also use
address@hidden&} and @address@hidden to refer to those matches as numbers
+(this is valid when the match or submatch has the form of a numeral).
address@hidden here too stands for the number of already-completed
+replacements.
 
   Repeating our example to exchange @samp{x} and @samp{y}, we can thus
 do it also this way:
diff --git a/doc/emacs/text.texi b/doc/emacs/text.texi
index 58c5920..d32bb3c 100644
--- a/doc/emacs/text.texi
+++ b/doc/emacs/text.texi
@@ -1694,7 +1694,7 @@ when you type the corresponding one.
 @node TeX Print
 @subsection @TeX{} Printing Commands
 
-  You can invoke @TeX{} as an subprocess of Emacs, supplying either
+  You can invoke @TeX{} as a subprocess of Emacs, supplying either
 the entire contents of the buffer or just part of it (e.g., one
 chapter of a larger document).
 
@@ -1746,7 +1746,7 @@ C-p} (@code{tex-print}) to print a hardcopy of the output 
file.
 output of @TeX{} also goes in this directory.  To run @TeX{} in a
 different directory, change the variable @code{tex-directory} to
 the desired directory.  If your environment variable @env{TEXINPUTS}
-contains relative names, or if your files contains
+contains relative names, or if your files contain
 @samp{\input} commands with relative file names, then
 @code{tex-directory} @emph{must} be @code{"."} or you will get the
 wrong results.  Otherwise, it is safe to specify some other directory,
@@ -2017,7 +2017,7 @@ used as a cheap preview (@code{sgml-tags-invisible}).
 @findex nxml-mode
 @cindex XML schema
   The major mode for editing XML documents is called nXML mode.  This
-is a powerful major mode that can recognize many existing XML schema
+is a powerful major mode that can recognize many existing XML schemas
 and use them to provide completion of XML elements via
 @address@hidden, as well as on-the-fly XML
 validation with error highlighting.  To enable nXML mode in an
@@ -2290,7 +2290,7 @@ Prompt for a color, and apply it as a background color.
 @end table
 
 @noindent
-These command are also available via the Text Properties menu.
+These commands are also available via the Text Properties menu.
 
   A self-inserting character normally inherits the face properties
 (and most other text properties) from the preceding character in the
diff --git a/doc/emacs/trouble.texi b/doc/emacs/trouble.texi
index 2edeb05..330497c 100644
--- a/doc/emacs/trouble.texi
+++ b/doc/emacs/trouble.texi
@@ -1322,7 +1322,7 @@ the Emacs Lisp Reference Manual
 @url{https://www.gnu.org/software/emacs}
 
 @item
address@hidden://www.emacswiki.org/}
address@hidden://www.emacswiki.org/}
 @end itemize
 
 @menu
diff --git a/doc/emacs/vc1-xtra.texi b/doc/emacs/vc1-xtra.texi
index 7a4b8e4..35dd6d1 100644
--- a/doc/emacs/vc1-xtra.texi
+++ b/doc/emacs/vc1-xtra.texi
@@ -113,8 +113,9 @@ Prompt for a file name, delete the file from the working 
tree, and
 schedule the deletion for committing.
 
 @item M-x vc-rename-file
-Prompt for two file names, @var{var} and @var{old}, rename them in the
-working tree, and schedule the renaming for committing.
+Prompt for two file names, @var{old} and @var{new}, rename them in the
+working tree, and schedule the renaming for committing.  The @var{old}
+file defaults to the current buffer's file name if it is under VC.
 @end table
 
 @findex vc-delete-file
@@ -268,7 +269,7 @@ with the file's version control type.
 @vindex vc-handled-backends
   The variable @code{vc-handled-backends} determines which version
 control systems VC should handle.  The default value is @code{(RCS CVS
-SVN SCCS Bzr Git Hg Mtn Arch)}, so it contains all the version systems
+SVN SCCS SRC Bzr Git Hg Mtn)}, so it contains all the version systems
 that are currently supported.  If you want VC to ignore one or more of
 these systems, exclude its name from the list.  To disable VC
 entirely, set this variable to @code{nil}.
diff --git a/doc/emacs/windows.texi b/doc/emacs/windows.texi
index 945b7cb..9f3b1b6 100644
--- a/doc/emacs/windows.texi
+++ b/doc/emacs/windows.texi
@@ -465,7 +465,7 @@ bottom of the selected frame, regardless of the number of 
windows
 already shown on that frame.
 
   If you prefer Emacs to display a temporary buffer in a different
-fashion, we recommend to customize the variable
+fashion, we recommend customizing the variable
 @code{display-buffer-alist} (@pxref{Choosing Window,,Choosing a Window
 for Display, elisp, The Emacs Lisp Reference Manual}).  For example,
 to display @file{*Completions*} by splitting a window as described in
diff --git a/doc/emacs/xresources.texi b/doc/emacs/xresources.texi
index d58c6b9..ee59551 100644
--- a/doc/emacs/xresources.texi
+++ b/doc/emacs/xresources.texi
@@ -512,7 +512,7 @@ those are governed by normal X resources 
(@pxref{Resources}).
 
   The following sections describe how to customize GTK+ resources for
 Emacs.  For details about GTK+ resources, see the GTK+ API document at
address@hidden://developer.gnome.org/gtk2/stable/gtk2-Resource-Files.html}.
address@hidden://developer.gnome.org/gtk2/stable/gtk2-Resource-Files.html}.
 
   In GTK+ version 3, GTK+ resources have been replaced by a completely
 different system.  The appearance of GTK+ widgets is now determined by
@@ -522,7 +522,7 @@ style settings (where @var{theme} is the name of the 
current GTK+
 theme).  Therefore, the description of GTK+ resources in this section
 does not apply to GTK+ 3.  For details about the GTK+ 3 styling
 system, see
address@hidden://developer.gnome.org/gtk3/3.0/GtkCssProvider.html}.
address@hidden://developer.gnome.org/gtk3/3.0/GtkCssProvider.html}.
 
 @menu
 * GTK Resource Basics::   Basic usage of GTK+ resources.
diff --git a/doc/lispintro/emacs-lisp-intro.texi 
b/doc/lispintro/emacs-lisp-intro.texi
index 8b24cc1..137ccfe 100644
--- a/doc/lispintro/emacs-lisp-intro.texi
+++ b/doc/lispintro/emacs-lisp-intro.texi
@@ -11799,7 +11799,7 @@ Uses recursion."
 @end group
 @end smallexample
 
-What happens when we call this function with a argument of 7?
+What happens when we call this function with an argument of 7?
 
 The first instance of the @code{triangle-recursively} function adds
 the number 7 to the value returned by a second instance of
@@ -20821,7 +20821,7 @@ The function @code{1+} which adds one to its argument, 
is executed on
 
 Contrast this with @code{apply}, which applies its first argument to
 all the remaining.
-(@xref{Readying a Graph, , Readying a Graph}, for a explanation of
+(@xref{Readying a Graph, , Readying a Graph}, for an explanation of
 @code{apply}.)
 
 @need 1250
diff --git a/doc/lispref/buffers.texi b/doc/lispref/buffers.texi
index 7e41eb3..3750fa6 100644
--- a/doc/lispref/buffers.texi
+++ b/doc/lispref/buffers.texi
@@ -667,7 +667,7 @@ reason.
 
 @defun ask-user-about-supersession-threat filename
 This function is used to ask a user how to proceed after an attempt to
-modify an buffer visiting file @var{filename} when the file is newer
+modify a buffer visiting file @var{filename} when the file is newer
 than the buffer text.  Emacs detects this because the modification
 time of the file on disk is newer than the last save-time and its contents
 have changed.
diff --git a/doc/lispref/debugging.texi b/doc/lispref/debugging.texi
index 0969207..2daa8a5 100644
--- a/doc/lispref/debugging.texi
+++ b/doc/lispref/debugging.texi
@@ -918,51 +918,65 @@ be cleaner to combine them.
 @section Profiling
 @cindex profiling
 @cindex profile
address@hidden performance analysis
 @cindex measuring resource usage
 @cindex memory usage
 
-If your program is working correctly, but you want to make it run more
-quickly or efficiently, the first thing to do is @dfn{profile} your
-code so that you know how it is using resources.  If you find that one
-particular function is responsible for a significant portion of the
-runtime, you can start looking for ways to optimize that piece.
+If your program is working correctly, but not fast enough, and you
+want to make it run more quickly or efficiently, the first thing to do
+is @dfn{profile} your code so that you know where it spends most of
+the execution time.  If you find that one particular function is
+responsible for a significant portion of the execution time, you can
+start looking for ways to optimize that piece.
 
 Emacs has built-in support for this.  To begin profiling, type
 @kbd{M-x profiler-start}.  You can choose to profile by processor
-usage, memory usage, or both.  After doing some work, type
address@hidden profiler-report} to display a summary buffer for each
-resource that you chose to profile.  The names of the report buffers
-include the times at which the reports were generated, so you can
-generate another report later on without erasing previous results.
-When you have finished profiling, type @kbd{M-x profiler-stop} (there
-is a small overhead associated with profiling).
+usage, memory usage, or both.  Then run the code you'd like to speed
+up.  After that, type @kbd{M-x profiler-report} to display a summary
+buffer for each resource (cpu and memory) that you chose to profile.
+The names of the report buffers include the times at which the reports
+were generated, so you can generate another report later on without
+erasing previous results.  When you have finished profiling, type
address@hidden profiler-stop} (there is a small overhead associated with
+profiling, so we don't recommend leaving it active except when you are
+actually running the code you want to examine).
 
 The profiler report buffer shows, on each line, a function that was
-called, followed by how much resource (processor or memory) it used in
-absolute and percentage times since profiling started.  If a given
+called, followed by how much resources (cpu or memory) it used in
+absolute and percentage terms since profiling started.  If a given
 line has a @samp{+} symbol at the left-hand side, you can expand that
 line by typing @address@hidden, in order to see the function(s) called
 by the higher-level function.  Use a prefix argument (@kbd{C-u
 @key{RET}}) to see the whole call tree below a function.  Pressing
 @address@hidden again will collapse back to the original state.
 
-Press @kbd{j} or @kbd{mouse-2} to jump to the definition of a function.
-Press @kbd{d} to view a function's documentation.
-You can save a profile to a file using @kbd{C-x C-w}.
-You can compare two profiles using @kbd{=}.
+Press @kbd{j} or @kbd{mouse-2} to jump to the definition of a function
+at point.  Press @kbd{d} to view a function's documentation.  You can
+save a profile to a file using @kbd{C-x C-w}.  You can compare two
+profiles using @kbd{=}.
 
 @c FIXME reversed calltree?
 
 @cindex @file{elp.el}
 @cindex timing programs
-The @file{elp} library offers an alternative approach.  See the file
address@hidden for instructions.
+The @file{elp} library offers an alternative approach, which is useful
+when you know in advance which Lisp function(s) you want to profile.
+Using that library, you begin by setting @code{elp-function-list} to
+the list of function symbols---those are the functions you want to
+profile.  Then type @address@hidden elp-instrument-list @key{RET} nil
address@hidden to arrange for profiling those functions.  After running
+the code you want to profile, invoke @address@hidden elp-results}} to
+display the current results.  See the file @file{elp.el} for more
+detailed instructions.  This approach is limited to profiling
+functions written in Lisp, it cannot profile Emacs primitives.
 
 @cindex @file{benchmark.el}
 @cindex benchmarking
-You can check the speed of individual Emacs Lisp forms using the
address@hidden library.  See the functions @code{benchmark-run} and
address@hidden in @file{benchmark.el}.
+You can measure the time it takes to evaluate individual Emacs Lisp
+forms using the @file{benchmark} library.  See the macros
address@hidden and @code{benchmark-run-compiled} in
address@hidden  You can also use the @code{benchmark} command
+for timing forms interactively.
 
 @c Not worth putting in the printed manual.
 @ifnottex
diff --git a/doc/lispref/display.texi b/doc/lispref/display.texi
index 7bf03b8..64b8c0a 100644
--- a/doc/lispref/display.texi
+++ b/doc/lispref/display.texi
@@ -6966,14 +6966,16 @@ means to use the default for that slot, as stated below.
 @table @asis
 @item 0
 The glyph for the end of a truncated screen line (the default for this
-is @samp{$}).  @xref{Glyphs}.  On graphical terminals, Emacs uses
-arrows in the fringes to indicate truncation, so the display table has
-no effect.
+is @samp{$}).  @xref{Glyphs}.  On graphical terminals, Emacs by
+default uses arrows in the fringes to indicate truncation, so the
+display table has no effect, unless you disable the fringes
+(@pxref{Fringes,, Window Fringes, emacs, the Gnu Emacs Manual}).
 
 @item 1
 The glyph for the end of a continued line (the default is @samp{\}).
-On graphical terminals, Emacs uses curved arrows in the fringes to
-indicate continuation, so the display table has no effect.
+On graphical terminals, Emacs by default uses curved arrows in the
+fringes to indicate continuation, so the display table has no effect,
+unless you disable the fringes.
 
 @item 2
 The glyph for indicating a character displayed as an octal character
@@ -6988,9 +6990,12 @@ default is @samp{...}).  @xref{Selective Display}.
 
 @item 5
 The glyph used to draw the border between side-by-side windows (the
-default is @samp{|}).  @xref{Splitting Windows}.  This takes effect only
-when there are no scroll bars; if scroll bars are supported and in use,
-a scroll bar separates the two windows.
+default is @samp{|}).  @xref{Splitting Windows}.  This currently has
+effect only on text terminals; on graphical terminals, if vertical
+scroll bars are supported and in use, a scroll bar separates the two
+windows, and if there are no vertical scroll bars and no dividers
+(@pxref{Window Dividers}), Emacs uses a thin line to indicate the
+border.
 @end table
 
   For example, here is how to construct a display table that mimics
diff --git a/doc/lispref/edebug.texi b/doc/lispref/edebug.texi
index 0c17e1e..031fe65 100644
--- a/doc/lispref/edebug.texi
+++ b/doc/lispref/edebug.texi
@@ -898,7 +898,7 @@ lines inserted.
 
 @cindex coverage testing (Edebug)
 @cindex frequency counts
address@hidden performance analysis
address@hidden performance analysis (Edebug)
   Edebug provides rudimentary coverage testing and display of execution
 frequency.
 
diff --git a/doc/lispref/internals.texi b/doc/lispref/internals.texi
index 8bf9abf..76be7bf 100644
--- a/doc/lispref/internals.texi
+++ b/doc/lispref/internals.texi
@@ -758,6 +758,13 @@ names in the documentation string from the ones used in 
the C code.
 @samp{usage:} is required if the function has an unlimited number of
 arguments.
 
+Some primitives have multiple definitions, one per platform (e.g.,
address@hidden).  In such cases, rather than writing the
+same documentation string in each definition, only one definition has
+the actual documentation.  The others have placeholders beginning with
address@hidden, which are ignored by the function that parses the
address@hidden file.
+
 All the usual rules for documentation strings in Lisp code
 (@pxref{Documentation Tips}) apply to C code documentation strings
 too.
diff --git a/doc/lispref/os.texi b/doc/lispref/os.texi
index 42be604..be2d148 100644
--- a/doc/lispref/os.texi
+++ b/doc/lispref/os.texi
@@ -95,6 +95,22 @@ if requested by environment variables such as @env{LANG}.
 @item
 It does some basic parsing of the command-line arguments.
 
address@hidden
+It loads your early init file (@pxref{Early Init File,,, emacs, The
+GNU Emacs Manual}).  This is not done if the options @samp{-q},
address@hidden, or @samp{--batch} were specified.  If the @samp{-u} option
+was specified, Emacs looks for the init file in that user's home
+directory instead.
+
address@hidden
+It calls the function @code{package-initialize} to activate any
+optional Emacs Lisp package that has been installed.  @xref{Packaging
+Basics}.  However, Emacs doesn't initialize packages when
address@hidden is @code{nil} or when it's started
+with one of the options @samp{-q}, @samp{-Q}, or @samp{--batch}.  To
+initialize packages in the latter case, @code{package-initialize}
+should be called explicitly (e.g., via the @samp{--funcall} option).
+
 @vindex address@hidden, and startup}
 @vindex window-system-initialization-alist
 @item
@@ -154,15 +170,6 @@ It loads your abbrevs from the file specified by
 (@pxref{Abbrev Files, abbrev-file-name}).  This is not done if the
 option @samp{--batch} was specified.
 
address@hidden
-It calls the function @code{package-initialize} to activate any
-optional Emacs Lisp package that has been installed.  @xref{Packaging
-Basics}.  However, Emacs doesn't initialize packages when
address@hidden is @code{nil} or when it's started
-with one of the options @samp{-q}, @samp{-Q}, or @samp{--batch}.  To
-initialize packages in the latter case, @code{package-initialize}
-should be called explicitly (e.g., via the @samp{--funcall} option).
-
 @vindex after-init-time
 @item
 It sets the variable @code{after-init-time} to the value of
@@ -361,6 +368,7 @@ Equivalent to @samp{-q --no-site-file --no-splash}.
 @cindex init file
 @cindex @file{.emacs}
 @cindex @file{init.el}
address@hidden @file{early-init.el}
 
   When you start Emacs, it normally attempts to load your @dfn{init
 file}.  This is either a file named @file{.emacs} or @file{.emacs.el}
@@ -384,6 +392,19 @@ file; this way, even if you have su'd, Emacs still loads 
your own init
 file.  If those environment variables are absent, though, Emacs uses
 your user-id to find your home directory.
 
address@hidden early init file
+  Emacs also attempts to load a second init file, called the
address@hidden init file}, if it exists.  This is a file named
address@hidden in your @file{~/.emacs.d} directory.  The
+difference between the early init file and the regular init file is
+that the early init file is loaded much earlier during the startup
+process, so you can use it to customize some things that are
+initialized before loading the regular init file.  For example, you
+can customize the process of initializing the package system, by
+setting variables such as @var{package-load-list} or
address@hidden  @xref{Package Installation,,,
+emacs,The GNU Emacs Manual}.
+
 @cindex default init file
   An Emacs installation may have a @dfn{default init file}, which is a
 Lisp library named @file{default.el}.  Emacs finds this file through
diff --git a/doc/lispref/package.texi b/doc/lispref/package.texi
index 21dfe1c..7e7a8cd 100644
--- a/doc/lispref/package.texi
+++ b/doc/lispref/package.texi
@@ -105,24 +105,32 @@ adds the package's content directory to @code{load-path}, 
and
 evaluates the autoload definitions in @address@hidden
 
   Whenever Emacs starts up, it automatically calls the function
address@hidden to load installed packages.  This is done
-after loading the init file and abbrev file (if any) and before
-running @code{after-init-hook} (@pxref{Startup Summary}).  Automatic
-package loading is disabled if the user option
address@hidden is @code{nil}.
address@hidden to make installed packages available to the
+current session.  This is done after loading the early init file, but
+before loading the regular init file (@pxref{Startup Summary}).
+Packages are not automatically made available if the user option
address@hidden is set to @code{nil} in the early
+init file.
 
 @deffn Command package-initialize &optional no-activate
 This function initializes Emacs' internal record of which packages are
-installed, and loads them.  The user option @code{package-load-list}
-specifies which packages to load; by default, all installed packages
-are loaded.  If called during startup, this function also sets
+installed, and makes the packages available to the current session.
+The user option @code{package-load-list} specifies which packages to
+make available; by default, all installed packages are made available.
+If called during startup, this function also sets
 @code{package-enable-at-startup} to @code{nil}, to avoid accidentally
-loading the packages twice.  @xref{Package Installation,,, emacs, The
-GNU Emacs Manual}.
+evaluating package autoloads more than once.  @xref{Package
+Installation,,, emacs, The GNU Emacs Manual}.
 
 The optional argument @var{no-activate}, if address@hidden, causes
 Emacs to update its record of installed packages without actually
-loading them; it is for internal use only.
+making them available; it is for internal use only.
+
+In most cases, you should not need to call @code{package-initialize},
+as this is done automatically during startup.  Simply make sure to put
+any code that should run before @code{package-initialize} in the early
+init file, and any code that should run after it in the primary init
+file (@pxref{Init File,,, emacs, The GNU Emacs Manual}).
 @end deffn
 
 @node Simple Packages
@@ -191,7 +199,7 @@ standard keyword from the @code{finder-known-keywords} list.
 as explained in @ref{Packaging Basics}.  In the above example, a magic
 comment autoloads @code{superfrobnicator-mode}.
 
-  @xref{Package Archives}, for a explanation of how to add a
+  @xref{Package Archives}, for an explanation of how to add a
 single-file package to a package archive.
 
 @node Multi-file Packages
diff --git a/doc/lispref/text.texi b/doc/lispref/text.texi
index 299ed0b..51a440c 100644
--- a/doc/lispref/text.texi
+++ b/doc/lispref/text.texi
@@ -2981,7 +2981,7 @@ optional argument @var{append} is address@hidden, 
@var{face} is
 appended to the end of the list instead.  Note that in a face list,
 the first occurring value for each attribute takes precedence.
 
-For example, the following code would assign a italicized green face
+For example, the following code would assign an italicized green face
 to the text between @var{start} and @var{end}:
 
 @example
diff --git a/doc/lispref/windows.texi b/doc/lispref/windows.texi
index 5ab6d6e..687d597 100644
--- a/doc/lispref/windows.texi
+++ b/doc/lispref/windows.texi
@@ -862,7 +862,7 @@ If the optional argument @var{pixelwise} is address@hidden,
 A positive @var{delta} moves the edge downwards or to the right; a
 negative @var{delta} moves it upwards or to the left.  If the edge
 cannot be moved as far as specified by @var{delta}, this function
-moves it as far as possible but does not signal a error.
+moves it as far as possible but does not signal an error.
 
 This function tries to resize windows adjacent to the edge that is
 moved.  If this is not possible for some reason (e.g., if that adjacent
diff --git a/doc/misc/autotype.texi b/doc/misc/autotype.texi
index 026c571..3d61d24 100644
--- a/doc/misc/autotype.texi
+++ b/doc/misc/autotype.texi
@@ -243,7 +243,7 @@ Interesting point.  When wrapping skeletons around 
successive regions, they are
 put at these places.  Point is left at first @code{_} where nothing is wrapped.
 @item @code{>}
 Indent line according to major mode.  When following element is @code{_}, and
-there is a interregion that will be wrapped here, indent that interregion.
+there is an interregion that will be wrapped here, indent that interregion.
 @item @code{&}
 Logical and.  If preceding element moved point, i.e., usually inserted
 something, do following element.
diff --git a/doc/misc/cc-mode.texi b/doc/misc/cc-mode.texi
index 0132ab1..2de56fa 100644
--- a/doc/misc/cc-mode.texi
+++ b/doc/misc/cc-mode.texi
@@ -2408,7 +2408,7 @@ could achieve this with code like this in your 
@file{.emacs}:
 @end group
 @end example
 
-In a programming team, a hook is a also a good place for each member
+In a programming team, a hook is also a good place for each member
 to put his own personal preferences.  For example, you might be the
 only person in your team who likes Auto-newline minor mode.  You could
 have it enabled by default by placing the following in your
diff --git a/doc/misc/efaq.texi b/doc/misc/efaq.texi
index fef9b10..da6fda0 100644
--- a/doc/misc/efaq.texi
+++ b/doc/misc/efaq.texi
@@ -753,7 +753,7 @@ privileges, you have several options:
 Info files don't actually need to be installed before being used.
 You can use a prefix argument for the @code{info} command and specify
 the name of the Info file in the minibuffer.  This goes to the node
-named @samp{Top} in that file.  For example, to view a Info file named
+named @samp{Top} in that file.  For example, to view an Info file named
 @address@hidden in your home directory, you can type this:
 
 @example
@@ -1490,6 +1490,7 @@ exhibits all the colors Emacs knows about on the current 
display.
 
 Syntax highlighting is on by default since version 22.1.
 
address@hidden direct color in terminals
 Emacs 26.1 and later support direct color mode in terminals.  If Emacs
 finds Terminfo capabilities @samp{setb24} and @samp{setf24}, 24-bit
 direct color mode is used.  The capability strings are expected to
@@ -1504,14 +1505,17 @@ $ cat terminfo-custom.src
 
 xterm-emacs|xterm with 24-bit direct color mode for Emacs,
   use=xterm-256color,
-  
setb24=\E[48\:2\:\:address@hidden@}%/%d\:address@hidden@}%/address@hidden@}%&%d\:address@hidden@}%&%dm,
-  
setf24=\E[38\:2\:\:address@hidden@}%/%d\:address@hidden@}%/address@hidden@}%&%d\:address@hidden@}%&%dm,
+  
setb24=\E[48\:2\:\:address@hidden@}%/%d\:address@hidden@}%/address@hidden@}%&\
+     %d\:address@hidden@}%&%dm,
+  
setf24=\E[38\:2\:\:address@hidden@}%/%d\:address@hidden@}%/address@hidden@}%&\
+     %d\:address@hidden@}%&%dm,
 
 $ tic -x -o ~/.terminfo terminfo-custom.src
 
 $ TERM=xterm-emacs emacs -nw
 @end example
 
address@hidden 24-bit direct color mode
 Emacs 27.1 and later support Terminfo capability @samp{RGB} for
 detecting 24-bit direct color mode.  Multiple standard terminal
 definitions support this capability.
@@ -1519,12 +1523,29 @@ definitions support this capability.
 @example
 $ TERM=xterm-direct infocmp | grep seta[bf]
 
-  
address@hidden@}%<%t4%p1%d%e48\:2\:\:address@hidden@}%/%d\:address@hidden@}%/address@hidden@}%&%d\:address@hidden@}%&%d%;m,
-  
address@hidden@}%<%t3%p1%d%e38\:2\:\:address@hidden@}%/%d\:address@hidden@}%/address@hidden@}%&%d\:address@hidden@}%&%d%;m,
+  address@hidden@}%<%t4%p1%d%e48\:2\:\:address@hidden@}%/\
+     %d\:address@hidden@}%/address@hidden@}%&%d\:address@hidden@}%&%d%;m,
+  address@hidden@}%<%t3%p1%d%e38\:2\:\:address@hidden@}%/\
+     %d\:address@hidden@}%/address@hidden@}%&%d\:address@hidden@}%&%d%;m,
 
 $ TERM=xterm-direct emacs -nw
 @end example
 
+If your terminal is incompatible with XTerm, you may have to use
+another @env{TERM} definition.  Any terminal whose name includes
address@hidden should be a candidate.  The @command{toe} command can be
+used to find out which of these are installed on your system:
+
address@hidden
+$ toe | grep '\-direct'
+
+konsole-direct  konsole with direct-color indexing
+vte-direct      vte with direct-color indexing
+st-direct       st with direct-color indexing
+xterm-direct2   xterm with direct-color indexing (old)
+xterm-direct    xterm with direct-color indexing
address@hidden example
+
 Terminals with @samp{RGB} capability treat pixels #000001 - #000007 as
 indexed colors to maintain backward compatibility with applications
 that are unaware of direct color mode.  Therefore the seven darkest
@@ -3398,7 +3419,7 @@ version of Emacs, and see @ref{Current GNU 
distributions}, for a list of
 archive sites that make GNU software available.
 
 @node Finding a package with particular functionality
address@hidden How do I find a Emacs Lisp package that does XXX?
address@hidden How do I find an Emacs Lisp package that does XXX?
 @cindex Package, finding
 @cindex Finding an Emacs Lisp package
 @cindex Functionality, finding a particular package
diff --git a/doc/misc/eshell.texi b/doc/misc/eshell.texi
index 43f8cd6..1789767 100644
--- a/doc/misc/eshell.texi
+++ b/doc/misc/eshell.texi
@@ -1022,7 +1022,7 @@ So that the user can enter @samp{info chmod}, for example.
 
 @item Create a mode @code{eshell-browse}
 
-It would treat the Eshell buffer as a outline.  Collapsing the outline
+It would treat the Eshell buffer as an outline.  Collapsing the outline
 hides all of the output text.  Collapsing again would show only the
 first command run in each directory
 
diff --git a/doc/misc/gnus-faq.texi b/doc/misc/gnus-faq.texi
index 14c0117..26135b8 100644
--- a/doc/misc/gnus-faq.texi
+++ b/doc/misc/gnus-faq.texi
@@ -441,7 +441,7 @@ machine news.yourprovider.net login YourUserName password 
YourPassword
 @noindent
 .
 Make sure that the file isn't readable to others if you
-work on a OS which is capable of doing so.  (Under Unix
+work on an OS which is capable of doing so.  (Under Unix
 say
 @example
 chmod 600 ~/.authinfo
@@ -1449,7 +1449,7 @@ all those email addresses?
 
 @subsubheading Answer
 
-There's an very basic solution for this, mail aliases.
+There's a very basic solution for this, mail aliases.
 You can store your mail addresses in a ~/.mailrc file using a simple
 alias syntax:
 
@@ -2012,7 +2012,7 @@ server by typing @samp{J a}.  If you
 make a mistake, or change your mind, you can undo this
 action by typing @samp{J r}.  When
 you're done, type 'q' to return to the group buffer.
-Now the next time you enter a group on a agentized
+Now the next time you enter a group on an agentized
 server, the headers will be stored on disk and read from
 there the next time you enter the group.
 
@@ -2293,7 +2293,7 @@ When the term Emacs is used in this FAQ, it means either 
GNU
 Emacs or XEmacs.
 
 @item Message
-In this FAQ message means a either a mail or a posting to a
+In this FAQ message means either a mail or a posting to a
 Usenet Newsgroup or to some other fancy back end, no matter
 of which kind it is.
 
diff --git a/doc/misc/org.texi b/doc/misc/org.texi
index aa3b029..1793190 100644
--- a/doc/misc/org.texi
+++ b/doc/misc/org.texi
@@ -890,9 +890,7 @@ Elisp libraries.  You can install Org with @kbd{M-x 
package-install RET org}.
 been visited, i.e., where no Org built-in function have been loaded.
 Otherwise autoload Org functions will mess up the installation.
 
-Then, to make sure your Org configuration is taken into account, initialize
-the package system with @code{(package-initialize)} in your Emacs init file
-before setting any Org option.  If you want to use Org's package repository,
+If you want to use Org's package repository,
 check out the @uref{http://orgmode.org/elpa.html, Org ELPA page}.
 
 @subsubheading Downloading Org as an archive
@@ -12991,7 +12989,7 @@ of these examples works:
 
 @subsubheading Embedding clickable images
 For clickable images, provide a link whose description is another link to an
-image file.  For example, to embed a image @file{org-mode-unicorn.png} which
+image file.  For example, to embed an image @file{org-mode-unicorn.png} which
 when clicked jumps to @uref{http://Orgmode.org} website, do the following
 
 @example
diff --git a/doc/misc/sc.texi b/doc/misc/sc.texi
index d8faad9..f214152 100644
--- a/doc/misc/sc.texi
+++ b/doc/misc/sc.texi
@@ -1340,7 +1340,7 @@ currently part of Supercite, but contributions are 
welcome!
 
 Regi works by interpreting frames with the function
 @code{regi-interpret}.  A frame is a list of arbitrary size where each
-element is a entry of the following form:
+element is an entry of the following form:
 
 @example
 (@var{pred} @var{func} address@hidden address@hidden)
@@ -1709,7 +1709,7 @@ of information from the info alist.
 @item @code{sc-mail-field-query} (@kbd{C-c C-p f})
 Allows you to interactively view, modify, add, and delete info alist
 key-value pairs.  With no argument, you are prompted (with completion)
-for a info key.  The value associated with that key is displayed in the
+for an info key.  The value associated with that key is displayed in the
 minibuffer.  With an argument, this command will first ask if you want
 to view, modify, add, or delete an info key.  Viewing is identical to
 running the command with no arguments.
diff --git a/doc/misc/tramp.texi b/doc/misc/tramp.texi
index ae544b0..0dd82c5 100644
--- a/doc/misc/tramp.texi
+++ b/doc/misc/tramp.texi
@@ -1,18 +1,16 @@
 \input texinfo   @c -*- mode: texinfo; coding: utf-8 -*-
 @setfilename ../../info/tramp.info
 @c %**start of header
address@hidden TRAMP User Manual
 @include docstyle.texi
address@hidden %**end of header
-
address@hidden This is *so* much nicer :)
address@hidden end
-
 @c In the Tramp repository, the version number is auto-frobbed from
 @c configure.ac, so you should edit that file and run
 @c "autoconf && ./configure" to change the version number.
-
 @include trampver.texi
address@hidden @value{tramp} @value{trampver} User Manual
address@hidden %**end of header
+
address@hidden This is *so* much nicer :)
address@hidden end
 
 @c Macro for formatting a file name according to the respective
 @c syntax.  Macro arguments should not have any leading or trailing
@@ -48,7 +46,7 @@ copy and modify this GNU manual.''
 @end direntry
 
 @titlepage
address@hidden @value{tramp} version @value{trampver} User Manual
address@hidden @value{tramp} @value{trampver} User Manual
 @author by Daniel Pittman
 @author based on documentation by Kai Großjohann
 @end titlepage
@@ -57,9 +55,9 @@ copy and modify this GNU manual.''
 
 
 @node Top, Overview, (dir), (dir)
address@hidden @value{tramp} version @value{trampver} User Manual
address@hidden @value{tramp} @value{trampver} User Manual
 
-This file documents @value{tramp} version @value{trampver}, a remote file
+This file documents @value{tramp} @value{trampver}, a remote file
 editing package for Emacs.
 
 @value{tramp} stands for ``Transparent Remote (file) Access, Multiple
@@ -320,7 +318,7 @@ behind the scenes when you open a file with @value{tramp}.
 @chapter Obtaining @value{tramp}
 @cindex obtaining @value{tramp}
 
address@hidden is included as part of Emacs (since Emacs version 22.1).
address@hidden is included as part of Emacs (since Emacs 22.1).
 
 @value{tramp} is also freely packaged for download on the Internet at
 @uref{https://ftp.gnu.org/gnu/tramp/}.
@@ -681,6 +679,7 @@ In case both @command{mimencode} and @command{uuencode} are
 unavailable, @value{tramp} first transfers a small Perl program to the
 remote host, and then tries that program for encoding and decoding.
 
address@hidden tramp-inline-compress-start-size
 To increase transfer speeds for large text files, use compression
 before encoding.  The user option
 @option{tramp-inline-compress-start-size} specifies the file size for
@@ -1023,6 +1022,7 @@ can.
 @cindex @option{adb} method
 @cindex android (with @option{adb} method)
 
address@hidden tramp-adb-program
 This method uses Android Debug Bridge program for accessing Android
 devices.  The Android Debug Bridge must be installed locally for
 @value{tramp} to work.  Some GNU/Linux distributions provide Android
@@ -1031,6 +1031,7 @@ is installed as part of the Android address@hidden  
@value{tramp} finds the
 @command{adb} program either via the @env{PATH} environment variable
 or the absolute path set in the user option @option{tramp-adb-program}.
 
address@hidden tramp-adb-connect-if-not-connected
 @value{tramp} connects to Android devices with @option{adb} only when
 the user option @option{tramp-adb-connect-if-not-connected} is not
 @code{nil}.  Otherwise, the connection must be established outside
@@ -1459,8 +1460,8 @@ server.
 
 Both ssh and PuTTY support such proxy settings, using an HTTP tunnel
 via the @command{CONNECT} command (conforming to RFC 2616, 2817
-specifications).  Proxy servers using HTTP version 1.1 or later
-protocol support this command.
+specifications).  Proxy servers using HTTP 1.1 or later protocol
+support this command.
 
 @subsection Tunneling with ssh
 
@@ -1498,6 +1499,7 @@ proxy server @samp{proxy.your.domain} on port 3128.
 @cindex using non-standard methods
 @cindex create your own methods
 
address@hidden tramp-methods
 The @code{tramp-methods} variable currently has an exhaustive list of
 predefined methods.  Any part of this list can be modified with more
 suitable settings.  Refer to the Lisp documentation of that variable,
@@ -1508,8 +1510,8 @@ accessible with @kbd{C-h v tramp-methods @key{RET}}.
 @section Selecting config files for user/host name completion
 @cindex customizing completion
 @cindex selecting config files
address@hidden tramp-completion-function-alist
 
address@hidden tramp-completion-function-alist
 @code{tramp-completion-function-alist} uses predefined files for user
 and host name completion (@pxref{File name completion}).  For each
 method, it keeps a set of configuration files and a function that can
@@ -1647,8 +1649,8 @@ the need.
 
 @anchor{Using an authentication file}
 @subsection Using an authentication file
address@hidden auth-sources
 
address@hidden auth-sources
 The package @file{auth-source.el}, originally developed for No Gnus,
 reads passwords from different sources, @xref{Help for users, ,
 auth-source, auth}.  The default authentication file is
@@ -1694,8 +1696,8 @@ Set @code{password-cache} to @code{nil} to disable 
password caching.
 @node Connection caching
 @section Reusing connection related information
 @cindex caching
address@hidden tramp-persistency-file-name
 
address@hidden tramp-persistency-file-name
 For faster initial connection times, @value{tramp} stores previous
 connection properties in a file specified by the user option
 @option{tramp-persistency-file-name}.
@@ -1717,11 +1719,11 @@ connection related information for that host and 
creates a new entry.
 
 @node Predefined connection information
 @section Setting own connection related information
address@hidden tramp-connection-properties
 
 For more precise customization, parameters specified by
 @code{tramp-methods} can be overwritten manually.
 
address@hidden tramp-connection-properties
 Set @option{tramp-connection-properties} to manually override
 @code{tramp-methods}.  Properties in this list are in the form
 @code{(@var{regexp} @var{property} @var{value})}.  @var{regexp}
@@ -1896,8 +1898,8 @@ prompts, for which @value{tramp} uses 
@option{tramp-wrong-passwd-regexp}.
 @item @command{tset} and other questions
 @cindex unix command @command{tset}
 @cindex @command{tset} unix command
address@hidden tramp-terminal-type
 
address@hidden tramp-terminal-type
 To suppress inappropriate prompts for terminal type, @value{tramp}
 sets the @env{TERM} to @code{dumb} before the remote login process
 begins via the user option @option{tramp-terminal-type}.  This will
@@ -1976,9 +1978,9 @@ shell-specific config files.  For example, bash can use
 
 @value{tramp} redefines the remote shell prompt internally for robust
 parsing.  This redefinition affects the looks of a prompt in an
-interactive remote shell through commands, such as @kbd{M-x
-shell}.  Such prompts, however, can be reset to something more readable
-and recognizable using these @value{tramp} variables.
+interactive remote shell through commands, such as @kbd{M-x shell
address@hidden  Such prompts, however, can be reset to something more
+readable and recognizable using these @value{tramp} variables.
 
 @value{tramp} sets the @env{INSIDE_EMACS} variable in the startup
 script file @file{~/.emacs_SHELLNAME}.
@@ -2091,8 +2093,8 @@ directory for temporary files:
 
 @item
 Open a remote connection with the command @kbd{C-x C-f
address@hidden,192.168.0.26#2222,}}, where @command{sshd} is listening
-on port @samp{2222}.
address@hidden,192.168.0.26#2222,} @key{RET}}, where @command{sshd} is
+listening on port @samp{2222}.
 
 To add a corresponding entry to the @file{~/.ssh/config} file
 (recommended), use this:
@@ -2119,7 +2121,7 @@ the previous example, fix the connection properties as 
follows:
 
 @noindent
 Open a remote connection with a more concise command @kbd{C-x C-f
address@hidden,android,}}.
address@hidden,android,} @key{RET}}.
 @end itemize
 
 
@@ -2127,8 +2129,8 @@ Open a remote connection with a more concise command 
@kbd{C-x C-f
 @section Auto-save and Backup configuration
 @cindex auto-save
 @cindex backup
address@hidden backup-directory-alist
 
address@hidden backup-directory-alist
 To avoid @value{tramp} from saving backup files owned by @samp{root}
 to locations accessible to others, default backup settings in
 @option{backup-directory-alist} have to be altered.
@@ -2171,6 +2173,7 @@ Disabling backups can be targeted to just the @option{su} 
and
 @end group
 @end lisp
 
address@hidden tramp-backup-directory-alist
 Another option is to create better backup file naming with user and
 host names prefixed to the file name.  For example, transforming
 @file{/etc/secretfile} to
@@ -2204,6 +2207,7 @@ The backup file name of
 
@address@hidden,root@@localhost,~/.emacs.d/backups/![su!root@@localhost]!etc!secretfile~}}
 @end ifset
 
address@hidden auto-save-file-name-transforms
 Just as for backup files, similar issues of file naming affect
 auto-saving @value{tramp} files.  Auto-saved files are saved in the
 directory specified by the user option
@@ -2215,6 +2219,7 @@ compiled.  Reset such values to a valid directory.
 Set @option{auto-save-file-name-transforms} to @code{nil} to save
 auto-saved files to the same directory as the original file.
 
address@hidden tramp-auto-save-directory
 Alternatively, set the user option @option{tramp-auto-save-directory}
 to direct all auto saves to that location.
 
@@ -2228,8 +2233,9 @@ This section is incomplete.  Please share your solutions.
 @cindex @option{sshx} method with cygwin
 
 Cygwin's @command{ssh} works only with a Cygwin version of Emacs.  To
-check for compatibility: type @kbd{M-x eshell}, and start @kbd{ssh
-test.host}.  Incompatibilities trigger this message:
+check for compatibility: type @kbd{M-x eshell @key{RET}}, and start
address@hidden test.host @key{RET}}.  Incompatibilities trigger this
+message:
 
 @example
 Pseudo-terminal will not be allocated because stdin is not a terminal.
@@ -2546,8 +2552,8 @@ remote host name and file name.  For example, hopping 
over a single
 proxy @samp{bird@@bastion} to a remote file on @samp{you@@remotehost}:
 
 @example
address@hidden @kbd{C-x C-f @address@hidden@@bastion|ssh,you,remotehost,/path}}
address@hidden C-f @address@hidden@@bastion|address@hidden@@address@hidden/path}
address@hidden @kbd{C-x C-f @address@hidden@@bastion|ssh,you,remotehost,/path} 
@key{RET}}
address@hidden C-f @address@hidden@@bastion|address@hidden@@address@hidden/path 
@key{RET}}
 @end example
 
 Proxies can take patterns @code{%h} or @code{%u}.
@@ -2615,6 +2621,7 @@ upon first connection.  Alternatively, use an absolute 
path or extend
 @end group
 @end lisp
 
address@hidden tramp-remote-process-environment
 Customize user option @option{tramp-remote-process-environment} to
 suit the remote program's environment for the remote host.
 @option{tramp-remote-process-environment} is a list of strings
@@ -2660,11 +2667,13 @@ this.  You could overwrite this behavior by evaluating
 @end group
 @end lisp
 
address@hidden does not use the defaults specified in
address@hidden for running @code{process-file} or
address@hidden on remote hosts.  When values from
address@hidden are needed for remote processes, then set
-them as follows:
+In addition to @option{tramp-remote-process-environment}, you can set
+environment variables for individual remote process calls by
+let-binding @code{process-environment}.  @value{tramp} applies any
+entries not present in the global default value of
address@hidden (overriding
address@hidden settings, if they conflict).
+For example:
 
 @lisp
 @group
@@ -2673,8 +2682,10 @@ them as follows:
 @end group
 @end lisp
 
-This works only for environment variables not already set in the
address@hidden
+Let-binding in this way works regardless of whether the process to be
+called is local or remote, since @value{tramp} would add just the
address@hidden setting and local processes would take whole value of
address@hidden along with the new value of @env{HGPLAIN}.
 
 For integrating other Emacs packages so @value{tramp} can execute
 remotely, please file a bug report.  @xref{Bug Reports}.
@@ -2764,14 +2775,15 @@ host.  Example:
 @example
 @group
 @kbd{C-x C-f @trampfn{sudo,,} @key{RET}}
address@hidden tail -f /var/log/syslog.log & @key{RET}}
address@hidden& tail -f /var/log/syslog.log @key{RET}}
 @end group
 @end example
 
 @command{tail} command outputs continuously to the local buffer,
 @file{*Async Shell Command*}
 
address@hidden auto-revert-tail-mode} runs similarly showing continuous output.
address@hidden auto-revert-tail-mode @key{RET}} runs similarly showing
+continuous output.
 
 
 @subsection Running @code{eshell} on a remote host
@@ -2780,8 +2792,8 @@ host.  Example:
 @value{tramp} is integrated into @file{eshell.el}, which enables
 interactive eshell sessions on remote hosts at the command prompt.
 You must add the module @code{em-tramp} to @code{eshell-modules-list}.
-Here's a sample interaction after opening @kbd{M-x eshell} on a remote
-host:
+Here's a sample interaction after opening @kbd{M-x eshell @key{RET}}
+on a remote host:
 
 @example
 @group
@@ -2862,7 +2874,7 @@ calls include:
 @end group
 @end example
 
-Just the local part of a remote file name, such as @kbd{perl -d
+Just the local part of a remote file name, such as @command{perl -d
 /home/user/myprog.pl}, is not possible.
 
 Arguments of the program to be debugged must be literal, can take
@@ -2882,8 +2894,8 @@ command.  Powershell V2.0 on the remote host is required 
to run
 processes triggered from @value{tramp}.
 
 @option{explicit-shell-file-name} and @option{explicit-*-args} have to
-be set properly so @kbd{M-x shell} can open a proper remote shell on a
-MS Windows host.  To open @command{cmd}, set it as follows:
+be set properly so @kbd{M-x shell @key{RET}} can open a proper remote
+shell on a MS Windows host.  To open @command{cmd}, set it as follows:
 
 @lisp
 @group
@@ -3175,9 +3187,9 @@ Before sending a bug report, run the test suite first 
@ref{Testing}.
 Check if the bug or problem is already addressed in @xref{Frequently
 Asked Questions}.
 
-Run @kbd{M-x tramp-bug} to generate a buffer with details of the
-system along with the details of the @value{tramp}
-installation.  Please include these details with the bug report.
+Run @kbd{M-x tramp-bug @key{RET}} to generate a buffer with details of
+the system along with the details of the @value{tramp} installation.
+Please include these details with the bug report.
 
 The bug report must describe in as excruciating detail as possible the
 steps required to reproduce the problem.  These details must include
@@ -3303,7 +3315,7 @@ put the cursor at the top of the buffer, and then apply 
the following
 expression:
 
 @example
address@hidden: (re-search-forward (concat tramp-shell-prompt-pattern "$"))}
address@hidden: (re-search-forward (concat tramp-shell-prompt-pattern "$")) 
@key{RET}}
 @end example
 
 If the cursor has not moved to the prompt at the bottom of the buffer,
@@ -3507,8 +3519,10 @@ the following code in @file{~/.emacs} file.
 How to get a Visual Warning when working with @samp{root} privileges?
 Host indication in the mode line?
 
address@hidden @value{tramp} theme
address@hidden tramp-theme-face-remapping-alist
 Install @file{tramp-theme} from GNU ELPA via Emacs' Package Manager.
-Enable it via @kbd{M-x load-theme @key{RET} tramp}.  Further
+Enable it via @kbd{M-x load-theme @key{RET} tramp @key{RET}}.  Further
 customization is explained in user option
 @option{tramp-theme-face-remapping-alist}.
 
@@ -3534,10 +3548,11 @@ then set them with a hook as follows:
 @item
 Why is @file{~/.sh_history} file on the remote host growing?
 
address@hidden tramp-histfile-override
 Due to the remote shell saving tilde expansions triggered by
 @value{tramp}, the history file is probably growing rapidly.
 @value{tramp} can suppress this behaviour with the user option
address@hidden  When set to @code{t}, environment
address@hidden  When set to @code{t}, environment
 variable @env{HISTFILE} is unset, and environment variables
 @env{HISTFILESIZE} @env{HISTSIZE} are set to 0.
 
@@ -3582,6 +3597,24 @@ is @address@hidden,news@@news.my.domain,/opt/news/etc}}, 
then:
 @enumerate
 
 @item
+Use simplified syntax:
+
+If you always apply the default method (@pxref{Default Method}), you
+could use the simplified @value{tramp} syntax (@pxref{Change file name
+syntax}):
+
address@hidden
address@hidden
+(customize-set-variable 'tramp-default-method "ssh")
+(tramp-change-syntax 'simplified)
address@hidden group
address@hidden lisp
+
+The reduced typing: @kbd{C-x C-f
address@hidden@value{prefix}news@@address@hidden/opt/news/etc}
address@hidden
+
address@hidden
 Use default values for method name and user name:
 
 You can define default methods and user names for hosts,
@@ -3595,11 +3628,12 @@ You can define default methods and user names for hosts,
 @end group
 @end lisp
 
-The reduced typing: @kbd{C-x C-f @trampfn{-,news.my.domain,/opt/news/etc}}.
+The reduced typing: @kbd{C-x C-f
address@hidden,news.my.domain,/opt/news/etc} @key{RET}}.
 
 @strong{Note} that there are some useful shortcuts already.  Accessing
 your local host as @samp{root} user, is possible just by @kbd{C-x C-f
address@hidden,,}}.
address@hidden,,} @key{RET}}.
 
 @item
 Use configuration options of the access method:
@@ -3616,7 +3650,7 @@ Host xy
 @end group
 @end example
 
-The reduced typing: @kbd{C-x C-f @trampfn{ssh,xy,/opt/news/etc}}.
+The reduced typing: @kbd{C-x C-f @trampfn{ssh,xy,/opt/news/etc} @key{RET}}.
 
 Depending on the number of files in the directories, host names
 completion can further reduce key strokes: @kbd{C-x C-f
@@ -3784,8 +3818,8 @@ Load @file{bbdb} in Emacs:
 @end group
 @end lisp
 
-Create a BBDB entry with @kbd{M-x bbdb-create-ftp-site}.  Then specify
-a method and user name where needed.  Examples:
+Create a BBDB entry with @kbd{M-x bbdb-create-ftp-site @key{RET}}.
+Then specify a method and user name where needed.  Examples:
 
 @example
 @group
@@ -3921,8 +3955,8 @@ To disable both @value{tramp} (and Ange FTP), set 
@code{tramp-mode} to
 @end lisp
 
 @item
-To unload @value{tramp}, type @kbd{M-x tramp-unload-tramp}.  Unloading
address@hidden resets Ange FTP plugins also.
+To unload @value{tramp}, type @kbd{M-x tramp-unload-tramp @key{RET}}.
+Unloading @value{tramp} resets Ange FTP plugins also.
 @end itemize
 @end itemize
 
diff --git a/etc/CALC-NEWS b/etc/CALC-NEWS
index 394894a..04baf41 100644
--- a/etc/CALC-NEWS
+++ b/etc/CALC-NEWS
@@ -70,7 +70,7 @@ For changes in Emacs 23.1 and later, see the main Emacs NEWS 
file.
 
 * Version 2.02d:
 
-** Fixed a minor installation problem with a Emacs 19.29 byte-compiler bug.
+** Fixed a minor installation problem with an Emacs 19.29 byte-compiler bug.
 
 ** Removed archaic "macedit" package (superseded by "edmacro").
 
diff --git a/etc/ETAGS.EBNF b/etc/ETAGS.EBNF
index 221078a..23bb944 100644
--- a/etc/ETAGS.EBNF
+++ b/etc/ETAGS.EBNF
@@ -84,7 +84,7 @@ whether it is possible to deduce the tag name from the 
pattern, and make
 an unnamed tag in those cases.  The name deduced from the pattern of an
 unnamed tag is the implicit name of that tag.
   When the user looks for a tag, and Emacs finds no explicit tag names
-that match it, Emacs then looks for an tag whose implicit tag name
+that match it, Emacs then looks for a tag whose implicit tag name
 matches the request.  etags.c uses implicit tag names when possible, in
 order to reduce the size of the tags file.
   An implicit tag name is deduced from the pattern by discarding the
diff --git a/etc/NEWS b/etc/NEWS
index 005f177..8db638e 100644
--- a/etc/NEWS
+++ b/etc/NEWS
@@ -49,6 +49,25 @@ to reduce differences between developer and production 
builds.
 
 * Startup Changes in Emacs 27.1
 
++++
+** Emacs can now be configured using an early init file.
+The file is called 'early-init.el', in 'user-emacs-directory'.  It is
+loaded very early in the startup process: before graphical elements
+such as the tool bar are initialized, and before the package manager
+is initialized.  The primary purpose is to allow customizing how the
+package system is initialized given that initialization now happens
+before loading the regular init file (see below).
+
++++
+** Emacs now calls 'package-initialize' before loading the init file.
+This is part of a change intended to eliminate the behavior of
+package.el inserting a call to 'package-initialize' into the init
+file, which was previously done when Emacs was started.  As a result
+of this change, it is no longer necessary to call 'package-initialize'
+in your init file.  However, if your init file changes the values of
+'package-load-list' or 'package-user-dir', then that code needs to be
+moved to the early init file (see above).
+
 
 * Changes in Emacs 27.1
 
@@ -103,6 +122,11 @@ characters that quote text "like this" are replaced by 
double
 typographic quotes, “like this”, in text modes, and in comments in
 non-text modes.
 
+---
+** 'write-abbrev-file' now includes special properties.
+'write-abbrev-file' now writes special properties like ':case-fixed'
+for abbrevs that have them.
+
 
 * Changes in Specialized Modes and Packages in Emacs 27.1
 
@@ -248,6 +272,9 @@ forward-comment, scan-sexps, and forward-sexp when parsing 
backward.
 The new variable 'comment-use-syntax-ppss' can be set to nil to recover the old
 behavior if needed.
 
+** The `server-name' and `server-socket-dir' variables are set when a
+socket has been pased to Emacs (Bug#24218).
+
 ---
 ** The 'file-system-info' function is now available on all platforms.
 instead of just Microsoft platforms.  This fixes a 'get-free-disk-space'
diff --git a/etc/NEWS.20 b/etc/NEWS.20
index 3391d3e..31e640f 100644
--- a/etc/NEWS.20
+++ b/etc/NEWS.20
@@ -4130,17 +4130,16 @@ is an alternative to using the keymap itself.
 ** Changes in invisibility features
 
 *** Isearch can now temporarily show parts of the buffer which are
-hidden by an overlay with a invisible property, when the search match
+hidden by an overlay with an invisible property, when the search match
 is inside that portion of the buffer.  To enable this the overlay
-should have a isearch-open-invisible property which is a function that
-would be called having the overlay as an argument, the function should
-make the overlay visible.
+should have an isearch-open-invisible property, which is a function that
+would be called with the overlay as an argument, and should make it visible.
 
 During incremental search the overlays are shown by modifying the
-invisible and intangible properties, if beside this more actions are
-needed the overlay should have a isearch-open-invisible-temporary
-which is a function. The function is called with 2 arguments: one is
-the overlay and the second is nil when it should show the overlay and
+invisible and intangible properties.  If more actions are
+needed, the overlay should have an isearch-open-invisible-temporary property,
+which is a function.  The function is called with 2 arguments: one is
+the overlay, and the second is nil when it should show the overlay and
 t when it should hide it.
 
 *** add-to-invisibility-spec, remove-from-invisibility-spec
diff --git a/etc/NEWS.21 b/etc/NEWS.21
index 04bde7e..ea4f421 100644
--- a/etc/NEWS.21
+++ b/etc/NEWS.21
@@ -4348,7 +4348,7 @@ integer.  This is a required property.
 `:pt-height HEIGHT'
 
 HEIGHT specifies the height of the image in pt (1/72 inch).  HEIGHT
-must be a integer.  This is an required property.
+must be an integer.  This is a required property.
 
 `:bounding-box BOX'
 
@@ -4868,7 +4868,7 @@ temporarily to nil, for example
      (enlarge-window 10))
 
 Likewise, an attempt to split a fixed-height window vertically,
-or a fixed-width window horizontally results in a error.
+or a fixed-width window horizontally results in an error.
 
 ** The cursor-type frame parameter is now supported on MS-DOS
 terminals.  When Emacs starts, it by default changes the cursor shape
diff --git a/etc/NEWS.22 b/etc/NEWS.22
index c1009fc..26054d2 100644
--- a/etc/NEWS.22
+++ b/etc/NEWS.22
@@ -4895,7 +4895,7 @@ described above and specifies the total height of the 
line, causing a
 varying number of pixels to be inserted after the line to make it line
 exactly that many pixels high.
 
-If the `line-spacing' property value is an positive integer, the value
+If the `line-spacing' property value is a positive integer, the value
 is used as additional pixels to insert after the display line; this
 overrides the default frame `line-spacing' and any buffer local value of
 the `line-spacing' variable.
diff --git a/etc/NEWS.26 b/etc/NEWS.26
index 00ff9cd..a8880d0 100644
--- a/etc/NEWS.26
+++ b/etc/NEWS.26
@@ -1714,7 +1714,13 @@ t for all Emacs integers N.
 ---
 ** Calls that accept floating-point integers (for use on hosts with
 limited integer range) now signal an error if arguments are not
-integral.  For example '(decode-char 'ascii 0.5)' now signals an error.
+integral.  For example '(decode-char 'ascii 0.5)' now signals an
+error.
+
+---
+** Functions 'string-trim-left', 'string-trim-right' and 'string-trim'
+now accept optional arguments which specify the regexp of a substring
+to trim.
 
 +++
 ** The new function 'char-from-name' converts a Unicode name string
diff --git a/etc/ORG-NEWS b/etc/ORG-NEWS
index e7e60be..12eab44 100644
--- a/etc/ORG-NEWS
+++ b/etc/ORG-NEWS
@@ -148,7 +148,7 @@ directories in published site-maps.
 **** Scheme: support for tables
 **** Scheme: new variable: ~org-babel-scheme-null-to~
 
-This new custom option allows to use a empty list or null symbol to
+This new custom option allows you to use an empty list or null symbol to
 format the table output, initially assigned to ~hlines~.
 
 **** Scheme: new header ~:prologue~
diff --git a/etc/PROBLEMS b/etc/PROBLEMS
index dedbf80..0797176 100644
--- a/etc/PROBLEMS
+++ b/etc/PROBLEMS
@@ -783,10 +783,8 @@ frame's parameter list, like this:
 ** Underlines appear at the wrong position.
 
 This is caused by fonts having a wrong UNDERLINE_POSITION property.
-Examples are the 7x13 font on XFree86 prior to version 4.1, or the jmk
-neep font from the Debian xfonts-jmk package prior to version 3.0.17.
-To circumvent this problem, set x-use-underline-position-properties
-to nil in your '.emacs'.
+To avoid this problem (seen in some very old X releases and font packages),
+set x-use-underline-position-properties to nil.
 
 To see what is the value of UNDERLINE_POSITION defined by the font,
 type 'xlsfonts -lll FONT' and look at the font's UNDERLINE_POSITION property.
diff --git a/lisp/abbrev.el b/lisp/abbrev.el
index 734cefb..197276c 100644
--- a/lisp/abbrev.el
+++ b/lisp/abbrev.el
@@ -908,8 +908,14 @@ Presumes that `standard-output' points to 
`current-buffer'."
     (prin1 (symbol-value sym))
     (insert " ")
     (prin1 (symbol-function sym))
-    (insert " ")
+    (insert " :count ")
     (prin1 (abbrev-get sym :count))
+    (when (abbrev-get sym :case-fixed)
+      (insert " :case-fixed ")
+      (prin1 (abbrev-get sym :case-fixed)))
+    (when (abbrev-get sym :enable-function)
+      (insert " :enable-function ")
+      (prin1 (abbrev-get sym :enable-function)))
     (insert ")\n")))
 
 (defun abbrev--describe (sym)
diff --git a/lisp/bindings.el b/lisp/bindings.el
index 6082344..6ef8ffb 100644
--- a/lisp/bindings.el
+++ b/lisp/bindings.el
@@ -619,7 +619,7 @@ Switch to the most recently selected buffer other than the 
current one."
              :button (:toggle . (bound-and-true-p flyspell-mode))))
 (bindings--define-key mode-line-mode-menu [auto-revert-tail-mode]
   '(menu-item "Auto revert tail (Tail)" auto-revert-tail-mode
-             :help "Revert the tail of the buffer when buffer grows"
+             :help "Revert the tail of the buffer when the file on disk grows"
              :enable (buffer-file-name)
              :button (:toggle . (bound-and-true-p auto-revert-tail-mode))))
 (bindings--define-key mode-line-mode-menu [auto-revert-mode]
diff --git a/lisp/calendar/diary-lib.el b/lisp/calendar/diary-lib.el
index 181b117..acf4b20 100644
--- a/lisp/calendar/diary-lib.el
+++ b/lisp/calendar/diary-lib.el
@@ -2049,7 +2049,8 @@ calendar."
         (when (setq diary-entry (eval sexp))
           ;; Discard any mark portion from diary-anniversary, etc.
           (if (consp diary-entry) (setq diary-entry (cdr diary-entry)))
-          (mapconcat #'eval diary-remind-message ""))))
+          (calendar-dlet* ((days days))
+            (mapconcat #'eval diary-remind-message "")))))
      ;; Diary entry may apply to one of a list of days before date.
      ((and (listp days) days)
       (or (diary-remind sexp (car days) marking)
diff --git a/lisp/calendar/holidays.el b/lisp/calendar/holidays.el
index 198c3bb..f383083 100644
--- a/lisp/calendar/holidays.el
+++ b/lisp/calendar/holidays.el
@@ -399,7 +399,7 @@ use instead of point."
 (defun holidays (&optional arg)
   "Display the holidays for last month, this month, and next month.
 If called with an optional prefix argument ARG, prompts for month and year.
-This function is suitable for execution in a init file."
+This function is suitable for execution in an init file."
   (interactive "P")
   (save-excursion
     (let* ((completion-ignore-case t)
diff --git a/lisp/calendar/icalendar.el b/lisp/calendar/icalendar.el
index a725a4e..ca3adfa 100644
--- a/lisp/calendar/icalendar.el
+++ b/lisp/calendar/icalendar.el
@@ -1048,12 +1048,10 @@ written into the buffer `*icalendar-errors*'."
   (interactive "r
 FExport diary data into iCalendar file: ")
   (let ((result "")
-        (start 0)
         (entry-main "")
         (entry-rest "")
        (entry-full "")
         (header "")
-        (contents-n-summary)
         (contents)
         (alarm)
         (found-error nil)
@@ -1073,7 +1071,8 @@ FExport diary data into iCalendar file: ")
               ;; possibly ignore hidden entries beginning with "&"
               (if icalendar-export-hidden-diary-entries
                   "^\\([^ \t\n#].+\\)\\(\\(\n[ \t].*\\)*\\)"
-                "^\\([^ \t\n&#].+\\)\\(\\(\n[ \t].*\\)*\\)") max t)
+                "^\\([^ \t\n&#].+\\)\\(\\(\n[ \t].*\\)*\\)")
+              max t)
         (setq entry-main (match-string 1))
         (if (match-beginning 2)
             (setq entry-rest (match-string 2))
@@ -1095,7 +1094,7 @@ FExport diary data into iCalendar file: ")
                             (loc (cdr (assoc 'loc other-elements)))
                             (org (cdr (assoc 'org other-elements)))
                             (sta (cdr (assoc 'sta other-elements)))
-                            (sum (cdr (assoc 'sum other-elements)))
+                            ;; (sum (cdr (assoc 'sum other-elements)))
                             (url (cdr (assoc 'url other-elements)))
                             (uid (cdr (assoc 'uid other-elements))))
                         (if cla
@@ -1202,7 +1201,7 @@ Returns an alist."
              (p-uid (or (string-match "%U" icalendar-import-format) -1))
              (p-list (sort (list p-cla p-des p-loc p-org p-sta p-sum p-url 
p-uid) '<))
             (ct 0)
-             pos-cla pos-des pos-loc pos-org pos-sta pos-sum pos-url pos-uid)
+             pos-cla pos-des pos-loc pos-org pos-sta pos-url pos-uid) ;pos-sum
         (dotimes (i (length p-list))
          ;; Use 'ct' to keep track of current position in list
           (cond ((and (>= p-cla 0) (= (nth i p-list) p-cla))
@@ -1222,7 +1221,8 @@ Returns an alist."
                  (setq pos-sta (* 2 ct)))
                 ((and (>= p-sum 0) (= (nth i p-list) p-sum))
                 (setq ct (+ ct 1))
-                 (setq pos-sum (* 2 ct)))
+                 ;; (setq pos-sum (* 2 ct))
+                 )
                 ((and (>= p-url 0) (= (nth i p-list) p-url))
                 (setq ct (+ ct 1))
                  (setq pos-url (* 2 ct)))
@@ -1254,11 +1254,11 @@ Returns an alist."
                           (icalendar--rris "%s" "\\(.*?\\)" s nil t)
                         "\\'"))
         (if (string-match s summary-and-rest)
-            (let (cla des loc org sta sum url uid)
-              (if (and pos-sum (match-beginning pos-sum))
-                  (setq sum (substring summary-and-rest
-                                       (match-beginning pos-sum)
-                                       (match-end pos-sum))))
+            (let (cla des loc org sta url uid) ;; sum
+              ;; (if (and pos-sum (match-beginning pos-sum))
+              ;;     (setq sum (substring summary-and-rest
+              ;;                          (match-beginning pos-sum)
+              ;;                          (match-end pos-sum))))
               (if (and pos-cla (match-beginning pos-cla))
                   (setq cla (substring summary-and-rest
                                        (match-beginning pos-cla)
@@ -1763,8 +1763,8 @@ entries.  ENTRY-MAIN is the first line of the diary 
entry."
                  ;;BUT remove today if `diary-float'
                  ;;expression does not hold true for today:
                  (when
-                     (null (let ((date (calendar-current-date))
-                                 (entry entry-main))
+                     (null (calendar-dlet* ((date (calendar-current-date))
+                                            (entry entry-main))
                              (diary-float month dayname n)))
                    (concat
                     "\nEXDATE;VALUE=DATE:"
@@ -1975,13 +1975,13 @@ P")
     (icalendar-import-buffer diary-filename t non-marking)))
 
 ;;;###autoload
-(defun icalendar-import-buffer (&optional diary-file do-not-ask
+(defun icalendar-import-buffer (&optional diary-filename do-not-ask
                                           non-marking)
   "Extract iCalendar events from current buffer.
 
 This function searches the current buffer for the first iCalendar
 object, reads it and adds all VEVENT elements to the diary
-DIARY-FILE.
+DIARY-FILENAME.
 
 It will ask for each appointment whether to add it to the diary
 unless DO-NOT-ASK is non-nil.  When called interactively,
@@ -2011,10 +2011,10 @@ buffer `*icalendar-errors*'."
           (message "Converting iCalendar...")
           (setq ical-errors (icalendar--convert-ical-to-diary
                              ical-contents
-                             diary-file do-not-ask non-marking))
-          (when diary-file
+                             diary-filename do-not-ask non-marking))
+          (when diary-filename
             ;; save the diary file if it is visited already
-            (let ((b (find-buffer-visiting diary-file)))
+            (let ((b (find-buffer-visiting diary-filename)))
               (when b
                 (save-current-buffer
                   (set-buffer b)
@@ -2066,12 +2066,12 @@ buffer `*icalendar-errors*'."
          conversion-list)
     string)))
 
-(defun icalendar--convert-ical-to-diary (ical-list diary-file
+(defun icalendar--convert-ical-to-diary (ical-list diary-filename
                                                    &optional do-not-ask
                                                    non-marking)
   "Convert iCalendar data to an Emacs diary file.
 Import VEVENTS from the iCalendar object ICAL-LIST and saves them to a
-DIARY-FILE.  If DO-NOT-ASK is nil the user is asked for each event
+DIARY-FILENAME.  If DO-NOT-ASK is nil the user is asked for each event
 whether to actually import it.  NON-MARKING determines whether diary
 events are created as non-marking.
 This function attempts to return t if something goes wrong.  In this
@@ -2164,7 +2164,7 @@ written into the buffer `*icalendar-errors*'."
              (rdate
               (icalendar--dmsg "rdate event")
               (setq diary-string "")
-              (mapc (lambda (datestring)
+              (mapc (lambda (_datestring)
                      (setq diary-string
                            (concat diary-string
                                    (format "......"))))
@@ -2174,14 +2174,14 @@ written into the buffer `*icalendar-errors*'."
              ((not (string= start-d end-d))
               (setq diary-string
                     (icalendar--convert-non-recurring-all-day-to-diary
-                     e start-d end-1-d))
+                     start-d end-1-d))
               (setq event-ok t))
              ;; not all-day
              ((and start-t (or (not end-t)
                                (not (string= start-t end-t))))
               (setq diary-string
                     (icalendar--convert-non-recurring-not-all-day-to-diary
-                     e dtstart-dec dtend-dec start-t end-t))
+                     dtstart-dec start-t end-t))
               (setq event-ok t))
              ;; all-day event
              (t
@@ -2199,8 +2199,8 @@ written into the buffer `*icalendar-errors*'."
                   (if do-not-ask (setq summary nil))
                   ;; add entry to diary and store actual name of diary
                   ;; file (in case it was nil)
-                  (setq diary-file
-                        (icalendar--add-diary-entry diary-string diary-file
+                  (setq diary-filename
+                        (icalendar--add-diary-entry diary-string diary-filename
                                                     non-marking summary)))
               ;; event was not ok
               (setq found-error t)
@@ -2217,8 +2217,8 @@ written into the buffer `*icalendar-errors*'."
          (message "%s" error-string))))
 
     ;; insert final newline
-    (if diary-file
-        (let ((b (find-buffer-visiting diary-file)))
+    (if diary-filename
+        (let ((b (find-buffer-visiting diary-filename)))
           (when b
             (save-current-buffer
               (set-buffer b)
@@ -2467,7 +2467,7 @@ END-T is the event's end time in diary format."
                        e 'EXRULE))))
     result))
 
-(defun icalendar--convert-non-recurring-all-day-to-diary (event start-d end-d)
+(defun icalendar--convert-non-recurring-all-day-to-diary (start-d end-d)
   "Convert non-recurring iCalendar EVENT to diary format.
 
 DTSTART is the decoded DTSTART property of E.
@@ -2476,14 +2476,12 @@ Argument END-D gives the last day."
   (icalendar--dmsg "non-recurring all-day event")
   (format "%%%%(and (diary-block %s %s))" start-d end-d))
 
-(defun icalendar--convert-non-recurring-not-all-day-to-diary (event dtstart-dec
-                                                                    dtend-dec
-                                                                    start-t
-                                                                    end-t)
+(defun icalendar--convert-non-recurring-not-all-day-to-diary (dtstart-dec
+                                                              start-t
+                                                              end-t)
   "Convert recurring icalendar EVENT to diary format.
 
 DTSTART-DEC is the decoded DTSTART property of E.
-DTEND-DEC is the decoded DTEND property of E.
 START-T is the event's start time in diary format.
 END-T is the event's end time in diary format."
   (icalendar--dmsg "not all day event")
@@ -2498,9 +2496,9 @@ END-T is the event's end time in diary format."
                   dtstart-dec "/")
                  start-t))))
 
-(defun icalendar--add-diary-entry (string diary-file non-marking
+(defun icalendar--add-diary-entry (string diary-filename non-marking
                                           &optional summary)
-  "Add STRING to the diary file DIARY-FILE.
+  "Add STRING to the diary file DIARY-FILENAME.
 STRING must be a properly formatted valid diary entry.  NON-MARKING
 determines whether diary events are created as non-marking.  If
 SUMMARY is not nil it must be a string that gives the summary of the
@@ -2513,21 +2511,21 @@ the entry."
       (setq non-marking
             (y-or-n-p (format "Make appointment non-marking? "))))
     (save-window-excursion
-      (unless diary-file
-        (setq diary-file
+      (unless diary-filename
+        (setq diary-filename
               (read-file-name "Add appointment to this diary file: ")))
       ;; Note: diary-make-entry will add a trailing blank char.... :(
       (funcall (if (fboundp 'diary-make-entry)
                    'diary-make-entry
                  'make-diary-entry)
-               string non-marking diary-file)))
+               string non-marking diary-filename)))
   ;; Würgaround to remove the trailing blank char
-  (with-current-buffer (find-file diary-file)
+  (with-current-buffer (find-file diary-filename)
     (goto-char (point-max))
     (if (= (char-before) ? )
         (delete-char -1)))
-  ;; return diary-file in case it has been changed interactively
-  diary-file)
+  ;; return diary-filename in case it has been changed interactively
+  diary-filename)
 
 ;; ======================================================================
 ;; Examples
diff --git a/lisp/calendar/todo-mode.el b/lisp/calendar/todo-mode.el
index 4246ca5..5161ae8 100644
--- a/lisp/calendar/todo-mode.el
+++ b/lisp/calendar/todo-mode.el
@@ -623,7 +623,7 @@ Todo mode revisit this file or, with option
 file was last visited.
 
 If you call this command before you have created any todo file in
-the current format, and you have an todo file in old format, it
+the current format, and you have a todo file in old format, it
 will ask you whether to convert that file and show it.
 Otherwise, calling this command before any todo file exists
 prompts for a file name and an initial category (defaulting to
diff --git a/lisp/cedet/ede/cpp-root.el b/lisp/cedet/ede/cpp-root.el
index 76afe9b..bcefb4e 100644
--- a/lisp/cedet/ede/cpp-root.el
+++ b/lisp/cedet/ede/cpp-root.el
@@ -137,7 +137,7 @@
 ;; Need a way to reconfigure a project, and have it affect all open buffers.
 ;; From Tobias Gerdin:
 ;;
-;;   >>3) Is there any way to refresh a ede-cpp-root-project dynamically? I 
have
+;;   >>3) Is there any way to refresh an ede-cpp-root-project dynamically? I 
have
 ;;   >>some file open part of the project, fiddle with the include paths and 
would
 ;;   >>like the open buffer to notice this when I re-evaluate the
 ;;   >>ede-cpp-root-project constructor.
diff --git a/lisp/cedet/ede/files.el b/lisp/cedet/ede/files.el
index 36ec7a1..c95402e 100644
--- a/lisp/cedet/ede/files.el
+++ b/lisp/cedet/ede/files.el
@@ -25,7 +25,7 @@
 ;;
 ;; Basic Model:
 ;;
-;; A directory belongs to a project if a ede-project-autoload structure
+;; A directory belongs to a project if an ede-project-autoload structure
 ;; matches your directory.
 ;;
 ;; A toplevel project is one where there is no active project above
diff --git a/lisp/cedet/semantic/analyze.el b/lisp/cedet/semantic/analyze.el
index 8f3d5b2..7c9f102 100644
--- a/lisp/cedet/semantic/analyze.el
+++ b/lisp/cedet/semantic/analyze.el
@@ -121,7 +121,7 @@ See `semantic-analyze-scoped-tags' for details.")
           :type buffer
           :documentation "The buffer this context is derived from.")
    (errors :initarg :errors
-          :documentation "Any errors thrown an caught during analysis.")
+          :documentation "Any errors thrown and caught during analysis.")
    )
   "Base analysis data for any context.")
 
diff --git a/lisp/cedet/semantic/dep.el b/lisp/cedet/semantic/dep.el
index 6f1bde0..640884d 100644
--- a/lisp/cedet/semantic/dep.el
+++ b/lisp/cedet/semantic/dep.el
@@ -67,7 +67,7 @@ For mode authors, use
 `defcustom-mode-local-semantic-dependency-system-include-path'
 to create a mode-specific variable to control this.
 
-When searching for a file associated with a name found in an tag of
+When searching for a file associated with a name found in a tag of
 class include, this path will be inspected for includes of type
 `system'.  Some include tags are agnostic to this setting and will
 check both the project and system directories.")
diff --git a/lisp/cedet/semantic/lex.el b/lisp/cedet/semantic/lex.el
index 0403e5e..0cc296f 100644
--- a/lisp/cedet/semantic/lex.el
+++ b/lisp/cedet/semantic/lex.el
@@ -408,7 +408,7 @@ TYPE name does not exist.  Otherwise signal an error."
 SPECS must be a list of (TYPE . TOKENS) elements, where:
 
   TYPE is the name of the type symbol to define.
-  TOKENS is an list of (TOKSYM . MATCHER) elements, where:
+  TOKENS is a list of (TOKSYM . MATCHER) elements, where:
 
     TOKSYM is any lexical token symbol.
     MATCHER is a string or regexp a text must match to be a such
diff --git a/lisp/cedet/semantic/util-modes.el 
b/lisp/cedet/semantic/util-modes.el
index 6374a0c..54c9578 100644
--- a/lisp/cedet/semantic/util-modes.el
+++ b/lisp/cedet/semantic/util-modes.el
@@ -782,7 +782,7 @@ If there is no function, disable the header line."
                  (goto-char (semantic-tag-start tag))
                  ;; Klaus Berndl <address@hidden>:
                  ;; goto the tag name; this is especially needed for languages
-                 ;; like c++ where a often used style is like:
+                 ;; like c++ where an often used style is like:
                  ;;     void
                  ;;     ClassX::methodM(arg1...)
                  ;;     {
diff --git a/lisp/cedet/srecode/el.el b/lisp/cedet/srecode/el.el
index f5f1265..ff9e1d5 100644
--- a/lisp/cedet/srecode/el.el
+++ b/lisp/cedet/srecode/el.el
@@ -24,7 +24,7 @@
 ;; Emacs Lisp specific handlers.  To use these handlers in your
 ;; template, add the :name part to your template argument list.
 ;;
-;; Error if not in a Emacs Lisp mode
+;; Error if not in an Emacs Lisp mode
 
 ;;; Code:
 
diff --git a/lisp/cus-edit.el b/lisp/cus-edit.el
index 8284e91..816c7f7 100644
--- a/lisp/cus-edit.el
+++ b/lisp/cus-edit.el
@@ -1192,7 +1192,7 @@ For example, the MH-E package updates this alist as 
follows:
 
 The value of PACKAGE needs to be unique and it needs to match the
 PACKAGE value appearing in the :package-version keyword.  Since
-the user might see the value in a error message, a good choice is
+the user might see the value in an error message, a good choice is
 the official name of the package, such as MH-E or Gnus.")
 
 ;;;###autoload
diff --git a/lisp/desktop.el b/lisp/desktop.el
index 420d62a..8bd4465 100644
--- a/lisp/desktop.el
+++ b/lisp/desktop.el
@@ -393,7 +393,8 @@ or `desktop-modes-not-to-save'."
 ;; Skip tramp and ange-ftp files
 (defcustom desktop-files-not-to-save
   "\\(^/[^/:]*:\\|(ftp)$\\)"
-  "Regexp identifying files whose buffers are to be excluded from saving."
+  "Regexp identifying files whose buffers are to be excluded from saving.
+The default value excludes buffers visiting remote files."
   :type '(choice (const :tag "None" nil)
                 regexp)
   :group 'desktop)
diff --git a/lisp/emacs-lisp/benchmark.el b/lisp/emacs-lisp/benchmark.el
index 0dc9333..b86b56b 100644
--- a/lisp/emacs-lisp/benchmark.el
+++ b/lisp/emacs-lisp/benchmark.el
@@ -96,7 +96,8 @@ result.  The overhead of the `lambda's is accounted for."
 ;;;###autoload
 (defun benchmark (repetitions form)
   "Print the time taken for REPETITIONS executions of FORM.
-Interactively, REPETITIONS is taken from the prefix arg.
+Interactively, REPETITIONS is taken from the prefix arg, and
+the command prompts for the form to benchmark.
 For non-interactive use see also `benchmark-run' and
 `benchmark-run-compiled'."
   (interactive "p\nxForm: ")
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el
index a64c88c..1bf6d04 100644
--- a/lisp/emacs-lisp/bytecomp.el
+++ b/lisp/emacs-lisp/bytecomp.el
@@ -295,6 +295,11 @@ The information is logged to `byte-compile-log-buffer'."
   "If true, the byte-compiler reports warnings with `error'."
   :group 'bytecomp
   :type 'boolean)
+;; This needs to be autoloaded because it needs to be available to
+;; Emacs before the byte compiler is loaded, otherwise Emacs will not
+;; know that this variable is marked as safe until it is too late.
+;; (See https://lists.gnu.org/archive/html/emacs-devel/2018-01/msg00261.html )
+;;;###autoload(put 'byte-compile-error-on-warn 'safe-local-variable 'booleanp)
 
 (defconst byte-compile-warning-types
   '(redefine callargs free-vars unresolved
diff --git a/lisp/emacs-lisp/edebug.el b/lisp/emacs-lisp/edebug.el
index a0b4208..4f97712 100644
--- a/lisp/emacs-lisp/edebug.el
+++ b/lisp/emacs-lisp/edebug.el
@@ -641,7 +641,7 @@ list of a symbol.")
 
 (defun edebug-form-data-symbol ()
   "Return the edebug data symbol of the form where point is in.
-If point is not inside a edebuggable form, cause error."
+If point is not inside an edebuggable form, signal an error."
   (or (edebug--form-data-name (edebug-get-form-data-entry (point)))
       (error "Not inside instrumented form")))
 
diff --git a/lisp/emacs-lisp/elp.el b/lisp/emacs-lisp/elp.el
index 2dc1816..012e7cf 100644
--- a/lisp/emacs-lisp/elp.el
+++ b/lisp/emacs-lisp/elp.el
@@ -278,8 +278,9 @@ Argument FUNSYM is the symbol of a defined function."
 (defun elp-instrument-list (&optional list)
   "Instrument, for profiling, all functions in `elp-function-list'.
 Use optional LIST if provided instead.
-If called interactively, read LIST using the minibuffer."
-  (interactive "PList of functions to instrument: ") ;FIXME: Doesn't work?!
+If called interactively, prompt for LIST in the minibuffer;
+type \"nil\" to use `elp-function-list'."
+  (interactive "xList of functions to instrument: ")
   (unless (listp list)
     (signal 'wrong-type-argument (list 'listp list)))
   (mapcar #'elp-instrument-function (or list elp-function-list)))
diff --git a/lisp/emacs-lisp/ewoc.el b/lisp/emacs-lisp/ewoc.el
index b88a1a5..262d4d8 100644
--- a/lisp/emacs-lisp/ewoc.el
+++ b/lisp/emacs-lisp/ewoc.el
@@ -411,7 +411,7 @@ If the EWOC is empty, nil is returned."
      ((>= pos (ewoc--node-start-marker (ewoc--node-nth dll -2)))
       (ewoc--node-nth dll -2))
 
-     ;; We now know that pos is within a elem.
+     ;; We now know that pos is within an elem.
      (t
       ;; Make an educated guess about which of the three known
       ;; node'es (the first, the last, or GUESS) is nearest.
diff --git a/lisp/emacs-lisp/package.el b/lisp/emacs-lisp/package.el
index 71d1c41..999e0d0 100644
--- a/lisp/emacs-lisp/package.el
+++ b/lisp/emacs-lisp/package.el
@@ -1431,16 +1431,11 @@ If successful, set `package-archive-contents'."
 ;; available on disk.
 (defvar package--initialized nil)
 
-(defvar package--init-file-ensured nil
-  "Whether we know the init file has package-initialize.")
-
 ;;;###autoload
 (defun package-initialize (&optional no-activate)
   "Load Emacs Lisp packages, and activate them.
 The variable `package-load-list' controls which packages to load.
 If optional arg NO-ACTIVATE is non-nil, don't activate packages.
-If `user-init-file' does not mention `(package-initialize)', add
-it to the file.
 If called as part of loading `user-init-file', set
 `package-enable-at-startup' to nil, to prevent accidentally
 loading packages twice.
@@ -1449,13 +1444,7 @@ individual packages after calling `package-initialize' 
-- this is
 taken care of by `package-initialize'."
   (interactive)
   (setq package-alist nil)
-  (if after-init-time
-      (package--ensure-init-file)
-    ;; If `package-initialize' is before we finished loading the init
-    ;; file, it's obvious we don't need to ensure-init.
-    (setq package--init-file-ensured t
-          ;; And likely we don't need to run it again after init.
-          package-enable-at-startup nil))
+  (setq package-enable-at-startup nil)
   (package-load-all-descriptors)
   (package-read-all-archive-contents)
   (unless no-activate
@@ -1761,7 +1750,7 @@ with PKG-DESC entry removed."
   "Return a list of dependencies for PACKAGE sorted by dependency.
 PACKAGE is included as the first element of the returned list.
 ONLY is an alist associating package names to package objects.
-Only these packages will be in the return value an their cdrs are
+Only these packages will be in the return value and their cdrs are
 destructively set to nil in ONLY."
   (let ((out))
     (dolist (dep (package-desc-reqs package))
@@ -1872,64 +1861,6 @@ PACKAGES are satisfied, i.e. that PACKAGES is computed
 using `package-compute-transaction'."
   (mapc #'package-install-from-archive packages))
 
-(defun package--ensure-init-file ()
-  "Ensure that the user's init file has `package-initialize'.
-`package-initialize' doesn't have to be called, as long as it is
-present somewhere in the file, even as a comment.  If it is not,
-add a call to it along with some explanatory comments."
-  ;; Don't mess with the init-file from "emacs -Q".
-  (when (and (stringp user-init-file)
-             (not package--init-file-ensured)
-             (file-readable-p user-init-file)
-             (file-writable-p user-init-file))
-    (let* ((buffer (find-buffer-visiting user-init-file))
-           buffer-name
-           (contains-init
-            (if buffer
-                (with-current-buffer buffer
-                  (save-excursion
-                    (save-restriction
-                      (widen)
-                      (goto-char (point-min))
-                      (re-search-forward "(package-initialize\\_>" nil 
'noerror))))
-              ;; Don't visit the file if we don't have to.
-              (with-temp-buffer
-                (insert-file-contents user-init-file)
-                (goto-char (point-min))
-                (re-search-forward "(package-initialize\\_>" nil 'noerror)))))
-      (unless contains-init
-        (with-current-buffer (or buffer
-                                 (let ((delay-mode-hooks t)
-                                       (find-file-visit-truename t))
-                                   (find-file-noselect user-init-file)))
-          (when buffer
-            (setq buffer-name (buffer-file-name))
-            (set-visited-file-name (file-chase-links user-init-file)))
-          (save-excursion
-            (save-restriction
-              (widen)
-              (goto-char (point-min))
-              (while (and (looking-at-p "[[:blank:]]*\\(;\\|$\\)")
-                          (not (eobp)))
-                (forward-line 1))
-              (insert
-               "\n"
-               ";; Added by Package.el.  This must come before configurations 
of\n"
-               ";; installed packages.  Don't delete this line.  If you don't 
want it,\n"
-               ";; just comment it out by adding a semicolon to the start of 
the line.\n"
-               ";; You may delete these explanatory comments.\n"
-               "(package-initialize)\n")
-              (unless (looking-at-p "$")
-                (insert "\n"))
-              (let ((file-precious-flag t))
-                (save-buffer))
-              (if buffer
-                  (progn
-                    (set-visited-file-name buffer-name)
-                    (set-buffer-modified-p nil))
-                (kill-buffer (current-buffer)))))))))
-  (setq package--init-file-ensured t))
-
 ;;;###autoload
 (defun package-install (pkg &optional dont-select)
   "Install the package PKG.
diff --git a/lisp/epa.el b/lisp/epa.el
index 8694de4..5c237bc 100644
--- a/lisp/epa.el
+++ b/lisp/epa.el
@@ -267,7 +267,7 @@ You should bind this variable with `let', but do not set it 
globally.")
 (defvar epa-exit-buffer-function #'quit-window)
 
 (define-widget 'epa-key 'push-button
-  "Button for representing a epg-key object."
+  "Button for representing an epg-key object."
   :format "%[%v%]"
   :button-face-get 'epa--key-widget-button-face-get
   :value-create 'epa--key-widget-value-create
diff --git a/lisp/eshell/esh-cmd.el b/lisp/eshell/esh-cmd.el
index ddab335..61c0ebc 100644
--- a/lisp/eshell/esh-cmd.el
+++ b/lisp/eshell/esh-cmd.el
@@ -80,7 +80,7 @@
 ;;
 ;;   echo x$(+ 1 2) "String $(+ 1 2)"
 ;;
-;; To pass a Lisp symbol as a argument, use the alternate quoting
+;; To pass a Lisp symbol as an argument, use the alternate quoting
 ;; syntax, since the single quote character is far too overused in
 ;; shell syntax:
 ;;
diff --git a/lisp/eshell/esh-proc.el b/lisp/eshell/esh-proc.el
index 841a950..59fb9b9 100644
--- a/lisp/eshell/esh-proc.el
+++ b/lisp/eshell/esh-proc.el
@@ -87,7 +87,7 @@ variable's value to take effect."
   "Called each time a process is exec'd by `eshell-gather-process-output'.
 It is passed one argument, which is the process that was just started.
 It is useful for things that must be done each time a process is
-executed in a eshell mode buffer (e.g., `process-kill-without-query').
+executed in an eshell mode buffer (e.g., `process-kill-without-query').
 In contrast, `eshell-mode-hook' is only executed once when the buffer
 is created."
   :type 'hook
diff --git a/lisp/faces.el b/lisp/faces.el
index 0fe839d..18b821a 100644
--- a/lisp/faces.el
+++ b/lisp/faces.el
@@ -698,7 +698,7 @@ Otherwise, VALUE must be a property list of the form:
 
 `(:color COLOR :style STYLE)'.
 
-COLOR can be a either a color name string or `foreground-color'.
+COLOR can be either a color name string or `foreground-color'.
 STYLE can be either `line' or `wave'.
 If a keyword/value pair is missing from the property list, a
 default value will be used for the value.
diff --git a/lisp/ffap.el b/lisp/ffap.el
index d584692..4e479d1 100644
--- a/lisp/ffap.el
+++ b/lisp/ffap.el
@@ -1081,7 +1081,7 @@ If a given RFC isn't in these then `ffap-rfc-path' is 
offered."
     ;; * strip trailing "@" and ":"
     ;; * no commas (good for latex)
     (file "--:\\\\${}+<>@-Z_[:alpha:]~*?" "<@" "@>;.,!:")
-    ;; An url, or maybe a email/news message-id:
+    ;; An url, or maybe an email/news message-id:
     (url "--:=&address@hidden:alpha:]~#,%;*()!'" "^[0-9a-zA-Z]" ":;.,!?")
     ;; Find a string that does *not* contain a colon:
     (nocolon "--9$+<>@-Z_[:alpha:]~" "<@" "@>;.,!?")
diff --git a/lisp/filenotify.el b/lisp/filenotify.el
index d88578b..5d37f39 100644
--- a/lisp/filenotify.el
+++ b/lisp/filenotify.el
@@ -424,7 +424,7 @@ DESCRIPTOR should be an object returned by 
`file-notify-add-watch'."
 ;; TODO:
 ;; * Watching a /dir/file may receive events for dir.
 ;;   (This may be the desired behaviour.)
-;; * Watching a file in a already watched directory
+;; * Watching a file in an 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
diff --git a/lisp/font-lock.el b/lisp/font-lock.el
index 6f28569..29d3bc5 100644
--- a/lisp/font-lock.el
+++ b/lisp/font-lock.el
@@ -1835,7 +1835,7 @@ If SYNTACTIC-KEYWORDS is non-nil, it means these keywords 
are used for
                               (eval keywords)))))
 
 (defun font-lock-value-in-major-mode (values)
-  "If VALUES is an list, use `major-mode' as a key and return the `assq' value.
+  "If VALUES is a list, use `major-mode' as a key and return the `assq' value.
 VALUES should then be an alist on the form ((MAJOR-MODE . VALUE) ...) where
 MAJOR-MODE may be t.
 If VALUES isn't a list, return VALUES."
diff --git a/lisp/gnus/deuglify.el b/lisp/gnus/deuglify.el
index ce3ead3..d2bc87c 100644
--- a/lisp/gnus/deuglify.el
+++ b/lisp/gnus/deuglify.el
@@ -284,7 +284,7 @@
   :group 'gnus-outlook-deuglify)
 
 (defcustom gnus-outlook-display-hook nil
-  "A hook called after an deuglified article has been prepared.
+  "A hook called after a deuglified article has been prepared.
 It is run after `gnus-article-prepare-hook'."
   :version "22.1"
   :type 'hook
diff --git a/lisp/gnus/gnus-agent.el b/lisp/gnus/gnus-agent.el
index c786a9c..ada148d 100644
--- a/lisp/gnus/gnus-agent.el
+++ b/lisp/gnus/gnus-agent.el
@@ -451,7 +451,7 @@ manipulated as follows:
 (defvar gnus-agent-mode-status '(gnus-agent-mode " Plugged"))
 
 (defun gnus-agent-mode ()
-  "Minor mode for providing a agent support in Gnus buffers."
+  "Minor mode for providing agent support in Gnus buffers."
   (let* ((buffer (progn (string-match "^gnus-\\(.*\\)-mode$"
                                      (symbol-name major-mode))
                        (match-string 1 (symbol-name major-mode))))
diff --git a/lisp/gnus/gnus-cache.el b/lisp/gnus/gnus-cache.el
index d1324fe..1cdfea6 100644
--- a/lisp/gnus/gnus-cache.el
+++ b/lisp/gnus/gnus-cache.el
@@ -443,7 +443,7 @@ A group name is decoded according to
 decoded again according to `nnmail-pathname-coding-system',
 `file-name-coding-system', or `default-file-name-coding-system'.
 
-It is used when asking for a original group name from a cache
+It is used when asking for an original group name from a cache
 directory name, in which non-ASCII characters might have been unified
 into the ones of a certain charset particularly if the `utf-8' coding
 system for example was used.")
diff --git a/lisp/gnus/gnus-cus.el b/lisp/gnus/gnus-cus.el
index 00ccfb7..f4c0aa7 100644
--- a/lisp/gnus/gnus-cus.el
+++ b/lisp/gnus/gnus-cus.el
@@ -365,7 +365,7 @@ category."))
     (unless (or group topic)
       (error "No group on current line"))
     (when (and group topic)
-      (error "Both a group an topic on current line"))
+      (error "Both a group and topic on current line"))
     (unless (or topic (setq info (gnus-get-info group)))
       (error "Killed group; can't be edited"))
     ;; Ready.
diff --git a/lisp/gnus/gnus-fun.el b/lisp/gnus/gnus-fun.el
index d0557dc..40c6d51 100644
--- a/lisp/gnus/gnus-fun.el
+++ b/lisp/gnus/gnus-fun.el
@@ -66,7 +66,7 @@
 (defcustom gnus-convert-image-to-x-face-command
   "convert -scale 48x48! %s xbm:- | xbm2xface.pl"
   "Command for converting an image to an X-Face.
-The command must take a image filename (use \"%s\") as input.
+The command must take an image filename (use \"%s\") as input.
 The output must be the X-Face header data on stdout."
   :version "22.1"
   :group 'gnus-fun
diff --git a/lisp/gnus/gnus.el b/lisp/gnus/gnus.el
index 0edde63..123b64a 100644
--- a/lisp/gnus/gnus.el
+++ b/lisp/gnus/gnus.el
@@ -2378,11 +2378,11 @@ This variable is persisted in the user's .newsrc.eld 
file.")
 
 ;; Propagate flags to server, with the following exceptions:
 ;; `seen' is private to each gnus installation
-;; `cache' is a internal gnus flag for each gnus installation
-;; `download' is a agent flag private to each gnus installation
+;; `cache' is an internal gnus flag for each gnus installation
+;; `download' is an agent flag private to each gnus installation
 ;; `unsend' are for nndraft groups only
 ;; `score' is not a proper mark
-;; `bookmark': don't propagated it, or fix the bug in update-mark.
+;; `bookmark': don't propagate it, or fix the bug in update-mark.
 (defconst gnus-article-unpropagated-mark-lists
   '(seen cache download unsend score bookmark unexist)
   "Marks that shouldn't be propagated to back ends.
diff --git a/lisp/gnus/message.el b/lisp/gnus/message.el
index a0adcce..4f4ec3b 100644
--- a/lisp/gnus/message.el
+++ b/lisp/gnus/message.el
@@ -8242,7 +8242,7 @@ Meant for use on `completion-at-point-functions'."
          (start (save-excursion
                    (skip-chars-backward "^, \t\n")
                    (point))))
-      `(,start ,end ,(apply-partially #'ecomplete-completion-table 'mail)))))
+      `(,start ,end ,(ecomplete-completion-table 'mail)))))
 
 ;; To send pre-formatted letters like the example below, you can use
 ;; `message-send-form-letter':
diff --git a/lisp/gnus/mm-uu.el b/lisp/gnus/mm-uu.el
index 32be336..e15eba7 100644
--- a/lisp/gnus/mm-uu.el
+++ b/lisp/gnus/mm-uu.el
@@ -624,7 +624,7 @@ MIME-TYPE specifies a MIME type and parameters, which 
defaults to the
 value of `mm-uu-text-plain-type'."
   (let ((case-fold-search t)
        (mm-uu-text-plain-type (or mime-type mm-uu-text-plain-type))
-       text-start start-point end-point file-name result entry func)
+       text-start start-point end-point file-name result mm-uu-entry func)
     (save-excursion
       (goto-char (point-min))
       (cond
@@ -637,26 +637,26 @@ value of `mm-uu-text-plain-type'."
       (setq text-start (point))
       (while (re-search-forward mm-uu-beginning-regexp nil t)
        (setq start-point (match-beginning 0)
-             entry nil)
+             mm-uu-entry nil)
        (let ((alist mm-uu-type-alist)
              (beginning-regexp (match-string 0)))
-         (while (not entry)
+         (while (not mm-uu-entry)
            (if (string-match (mm-uu-beginning-regexp (car alist))
                              beginning-regexp)
-               (setq entry (car alist))
+               (setq mm-uu-entry (car alist))
              (pop alist))))
-       (if (setq func (mm-uu-function-1 entry))
+       (if (setq func (mm-uu-function-1 mm-uu-entry))
            (funcall func))
        (forward-line);; in case of failure
-       (when (and (not (mm-uu-configure-p (mm-uu-type entry) 'disabled))
-                  (let ((end-regexp (mm-uu-end-regexp entry)))
+       (when (and (not (mm-uu-configure-p (mm-uu-type mm-uu-entry) 'disabled))
+                  (let ((end-regexp (mm-uu-end-regexp mm-uu-entry)))
                     (if (not end-regexp)
                         (or (setq end-point (point-max)) t)
                       (prog1
                           (re-search-forward end-regexp nil t)
                         (forward-line)
                         (setq end-point (point)))))
-                  (or (not (setq func (mm-uu-function-2 entry)))
+                  (or (not (setq func (mm-uu-function-2 mm-uu-entry)))
                       (funcall func)))
          (if (and (> start-point text-start)
                   (progn
@@ -675,7 +675,7 @@ value of `mm-uu-text-plain-type'."
                mm-uu-text-plain-type)
               result))
          (push
-          (funcall (mm-uu-function-extract entry))
+          (funcall (mm-uu-function-extract mm-uu-entry))
           result)
          (goto-char (setq text-start end-point))))
       (when result
diff --git a/lisp/hexl.el b/lisp/hexl.el
index 681a26b..d716405 100644
--- a/lisp/hexl.el
+++ b/lisp/hexl.el
@@ -890,7 +890,7 @@ This discards the buffer's undo information."
        (error "Invalid hex digit `%c'" ch)))))
 
 (defun hexl-oct-char-to-integer (character)
-  "Take a char and return its value as if it was a octal digit."
+  "Take a char and return its value as if it was an octal digit."
   (if (and (>= character ?0) (<= character ?7))
       (- character ?0)
     (error "Invalid octal digit `%c'" character)))
diff --git a/lisp/htmlfontify.el b/lisp/htmlfontify.el
index 82c0a89..dfa6bde 100644
--- a/lisp/htmlfontify.el
+++ b/lisp/htmlfontify.el
@@ -1630,7 +1630,7 @@ TEXT-ID marks a unique position within a block.  It is 
set to
 value of `point' at the current buffer position.
 
 TEXT-BEGINS-BLOCK-P is a boolean and is non-nil if the current
-span also begins a invisible portion of text.
+span also begins an invisible portion of text.
 
 An implementation can use TEXT-BLOCK, TEXT-ID,
 TEXT-BEGINS-BLOCK-P to implement fold/unfold-on-mouse-click like
diff --git a/lisp/image.el b/lisp/image.el
index 2a8ea1f..b5f2235 100644
--- a/lisp/image.el
+++ b/lisp/image.el
@@ -977,7 +977,7 @@ default is 20%."
 
 (defun image--get-imagemagick-and-warn ()
   (unless (or (fboundp 'imagemagick-types) (featurep 'ns))
-    (error "Can't rescale images without ImageMagick support"))
+    (error "Cannot rescale images without ImageMagick support"))
   (let ((image (image--get-image)))
     (image-flush image)
     (when (fboundp 'imagemagick-types)
diff --git a/lisp/image/gravatar.el b/lisp/image/gravatar.el
index fe44f0d..e7c472d 100644
--- a/lisp/image/gravatar.el
+++ b/lisp/image/gravatar.el
@@ -60,11 +60,11 @@
   "Base URL for getting gravatars.")
 
 (defun gravatar-hash (mail-address)
-  "Create an hash from MAIL-ADDRESS."
+  "Create a hash from MAIL-ADDRESS."
   (md5 (downcase mail-address)))
 
 (defun gravatar-build-url (mail-address)
-  "Return an URL to retrieve MAIL-ADDRESS gravatar."
+  "Return a URL to retrieve MAIL-ADDRESS gravatar."
   (format "%s/%s?d=404&r=%s&s=%d"
           gravatar-base-url
           (gravatar-hash mail-address)
diff --git a/lisp/international/fontset.el b/lisp/international/fontset.el
index 45eabfc..6f91207 100644
--- a/lisp/international/fontset.el
+++ b/lisp/international/fontset.el
@@ -823,7 +823,7 @@
                     '("FreeMono" . "iso10646-1") nil 'prepend)
 
   ;; Since standard-fontset-spec on X uses fixed-medium font, which
-  ;; gets mapped to a iso8859-1 variant, we would like to prefer its
+  ;; gets mapped to an iso8859-1 variant, we would like to prefer its
   ;; iso10646-1 variant for symbols, where the coverage is known to be
   ;; good.
   (dolist (symbol-subgroup
diff --git a/lisp/international/mule-cmds.el b/lisp/international/mule-cmds.el
index 3468166..f737869 100644
--- a/lisp/international/mule-cmds.el
+++ b/lisp/international/mule-cmds.el
@@ -1795,6 +1795,9 @@ The default status is as follows:
   (setq default-sendmail-coding-system 'iso-latin-1)
   ;; On Darwin systems, this should be utf-8-unix, but when this file is loaded
   ;; that is not yet defined, so we set it in set-locale-environment instead.
+  ;; [Actually, it seems to work fine to use utf-8-unix here, and not just
+  ;; on Darwin.  The previous comment seems to be outdated?
+  ;; See patch at https://debbugs.gnu.org/15803 ]
   (setq default-file-name-coding-system 'iso-latin-1-unix)
   ;; Preserve eol-type from existing default-process-coding-systems.
   ;; On non-unix-like systems in particular, these may have been set
diff --git a/lisp/mail/rmailedit.el b/lisp/mail/rmailedit.el
index 623a829..91aeb41 100644
--- a/lisp/mail/rmailedit.el
+++ b/lisp/mail/rmailedit.el
@@ -410,7 +410,7 @@ or else nil to insert it at the beginning.
 
 DELETED's elements are elements of OLD-HEADERS.
 CHANGED's elements have the form (OLD . NEW)
-where OLD is a element of OLD-HEADERS and NEW is an element of NEW-HEADERS."
+where OLD is an element of OLD-HEADERS and NEW is an element of NEW-HEADERS."
 
   (let ((reverse-new (reverse new-headers))
        inserted deleted changed)
diff --git a/lisp/mh-e/mh-e.el b/lisp/mh-e/mh-e.el
index 63d7a29..05ff672 100644
--- a/lisp/mh-e/mh-e.el
+++ b/lisp/mh-e/mh-e.el
@@ -831,7 +831,7 @@ This assumes that a temporary buffer is set up."
                               (expand-file-name "flists" dir)))))))))
 
 (defun mh-file-command-p (file)
-  "Return t if file FILE is the name of a executable regular file."
+  "Return t if file FILE is the name of an executable regular file."
   (and (file-regular-p file) (file-executable-p file)))
 
 (defun mh-variant-set-variant (variant)
diff --git a/lisp/mh-e/mh-mime.el b/lisp/mh-e/mh-mime.el
index 967eb86..e2c682a 100644
--- a/lisp/mh-e/mh-mime.el
+++ b/lisp/mh-e/mh-mime.el
@@ -1242,7 +1242,7 @@ MESSAGE number."
                             "message/rfc822"
                             (if (string= "" description) nil description)
                             "inline"))
-          (t (error "The message number, %s, is not a integer" msg)))))
+          (t (error "The message number, %s, is not an integer" msg)))))
 
 (defun mh-mh-forward-message (&optional description folder messages)
   "Add tag to forward a message.
diff --git a/lisp/mh-e/mh-search.el b/lisp/mh-e/mh-search.el
index 3e591c6..8b8ba96 100644
--- a/lisp/mh-e/mh-search.el
+++ b/lisp/mh-e/mh-search.el
@@ -443,7 +443,7 @@ search all folders."
            (setq redo-flag t))
           ((mh-folder-exists-p new-folder)
            ;; Folder exists but we don't have it open. That means they are
-           ;; stale results from a old flists search. Clear it out.
+           ;; stale results from an old flists search. Clear it out.
            (mh-exec-cmd-quiet nil "rmf" new-folder)))
     (setq message (mh-search "+" mh-flists-results-folder
                              redo-flag window-config)
@@ -1583,7 +1583,7 @@ If the folder returned doesn't exist then it is created."
     chosen-name))
 
 (defun mh-index-folder-search-regexp (folder)
-  "If FOLDER was created by a index search, return the search regexp.
+  "If FOLDER was created by an index search, return the search regexp.
 Return nil if FOLDER doesn't exist or the .mhe_index file is
 garbled."
   (ignore-errors
@@ -1912,7 +1912,7 @@ origin-index) map is updated too."
 
 (defun mh-index-update-single-msg (msg checksum origin-map)
   "Update various maps for one message.
-MSG is a index folder message, CHECKSUM its MD5 hash and
+MSG is an index folder message, CHECKSUM its MD5 hash and
 ORIGIN-MAP, if non-nil, a hash table containing which maps each
 message in the index folder to the folder and message that it was
 copied from. The function updates the hash tables
diff --git a/lisp/net/gnutls.el b/lisp/net/gnutls.el
index ea17fb51..85c9308 100644
--- a/lisp/net/gnutls.el
+++ b/lisp/net/gnutls.el
@@ -202,7 +202,7 @@ For the meaning of the rest of the parameters, see 
`gnutls-boot-parameters'."
      "boot: %s" params)
 
     (when (gnutls-errorp ret)
-      ;; This is a error from the underlying C code.
+      ;; This is an error from the underlying C code.
       (signal 'gnutls-error (list process ret)))
 
     process))
diff --git a/lisp/net/mailcap.el b/lisp/net/mailcap.el
index 748fb39..4ec0045 100644
--- a/lisp/net/mailcap.el
+++ b/lisp/net/mailcap.el
@@ -92,7 +92,7 @@ replaced with the file.
 MIME-TYPE is a regular expression being matched against the
 actual MIME type.  It is implicitly surrounded with ^ and $.
 
-TEST is an lisp form which is evaluated in order to test if the
+TEST is a lisp form which is evaluated in order to test if the
 entry should be chosen.  The `test' entry is optional.
 
 When selecting a viewer for a given MIME type, the first viewer
@@ -555,7 +555,7 @@ MAILCAPS if set; otherwise (on Unix) use the path from RFC 
1524, plus
 (defun mailcap-mailcap-entry-passes-test (info)
   "Replace the test clause of INFO itself with a boolean for some cases.
 This function supports only `test -n $DISPLAY' and `test -z $DISPLAY',
-replaces them with t or nil.  As for others or if INFO has a interactive
+replaces them with t or nil.  As for others or if INFO has an interactive
 spec (needsterm, needsterminal, or needsx11) but DISPLAY is not set,
 the test clause will be unchanged."
   (let ((test (assq 'test info))       ; The test clause
diff --git a/lisp/nxml/xsd-regexp.el b/lisp/nxml/xsd-regexp.el
index f83dad5..54f56dd 100644
--- a/lisp/nxml/xsd-regexp.el
+++ b/lisp/nxml/xsd-regexp.el
@@ -208,7 +208,7 @@ Signal an error if it is not."
         (nreverse (xsdre-compile-regexp re nil))))
 
 (defun xsdre-compile-regexp (re accum)
-  "Return a Emacs regular expression for the symbolic regexp RE.
+  "Return an Emacs regular expression for the symbolic regexp RE.
 Returns a list of strings whose head is the regexp for RE
 and whose tail is ACCUM."
   (cond ((not (consp re))
@@ -271,7 +271,7 @@ and whose tail is ACCUM."
        (t (xsdre-compile-char-class re accum))))
 
 (defun xsdre-compile-char-class (cc accum)
-  "Return a Emacs regular expression for the symbolic character class CC.
+  "Return an Emacs regular expression for the symbolic character class CC.
 Returns a list of strings whose head is the regexp for CC
 and whose tail is ACCUM."
   (cons (if (integerp cc)
@@ -450,7 +450,7 @@ LOWER ::= UNICODE
 UPPER ::= UNICODE
 SYMBOLIC-CHAR-CLASS ::= SYMBOL
 
-where UNICODE is a integer specifying a Unicode code-point and
+where UNICODE is an integer specifying a Unicode code-point and
 SYMBOLIC-CHAR-CLASS is a symbol which has either a `xsdre-char-class'
 property whose value is a CHAR-CLASS, or a `xsdre-ranges' property
 whose value is a range-list."
diff --git a/lisp/org/ob-calc.el b/lisp/org/ob-calc.el
index f491a6c..4ed5dd4 100644
--- a/lisp/org/ob-calc.el
+++ b/lisp/org/ob-calc.el
@@ -37,7 +37,7 @@
 (declare-function org-trim "org" (s &optional keep-lead))
 
 (defvar org-babel-default-header-args:calc nil
-  "Default arguments for evaluating an calc source block.")
+  "Default arguments for evaluating a calc source block.")
 
 (defun org-babel-expand-body:calc (body _params)
   "Expand BODY according to PARAMS, return the expanded body." body)
diff --git a/lisp/org/ob-core.el b/lisp/org/ob-core.el
index 5f378b2..0e2e78a 100644
--- a/lisp/org/ob-core.el
+++ b/lisp/org/ob-core.el
@@ -363,7 +363,7 @@ a window into the `org-babel-get-src-block-info' function."
 ;;;###autoload
 (defun org-babel-expand-src-block-maybe ()
   "Conditionally expand a source block.
-Detect if this is context for a org-babel src-block and if so
+Detect if this is context for an org-babel src-block and if so
 then run `org-babel-expand-src-block'."
   (interactive)
   (org-babel-when-in-src-block
@@ -372,7 +372,7 @@ then run `org-babel-expand-src-block'."
 ;;;###autoload
 (defun org-babel-load-in-session-maybe ()
   "Conditionally load a source block in a session.
-Detect if this is context for a org-babel src-block and if so
+Detect if this is context for an org-babel src-block and if so
 then run `org-babel-load-in-session'."
   (interactive)
   (org-babel-when-in-src-block
@@ -383,7 +383,7 @@ then run `org-babel-load-in-session'."
 ;;;###autoload
 (defun org-babel-pop-to-session-maybe ()
   "Conditionally pop to a session.
-Detect if this is context for a org-babel src-block and if so
+Detect if this is context for an org-babel src-block and if so
 then run `org-babel-switch-to-session'."
   (interactive)
   (org-babel-when-in-src-block
diff --git a/lisp/org/ob-org.el b/lisp/org/ob-org.el
index e522838..310aaec 100644
--- a/lisp/org/ob-org.el
+++ b/lisp/org/ob-org.el
@@ -34,7 +34,7 @@
 
 (defvar org-babel-default-header-args:org
   '((:results . "raw silent") (:exports . "code"))
-  "Default arguments for evaluating a org source block.")
+  "Default arguments for evaluating an org source block.")
 
 (defvar org-babel-org-default-header
   "#+TITLE: default empty header\n"
diff --git a/lisp/org/ob-picolisp.el b/lisp/org/ob-picolisp.el
index b6dc898..fd129b8 100644
--- a/lisp/org/ob-picolisp.el
+++ b/lisp/org/ob-picolisp.el
@@ -35,7 +35,7 @@
 ;; (http://picolisp.com/5000/-2.html). PicoLisp is included in some
 ;; GNU/Linux Distributions, and can be downloaded here:
 ;; http://software-lab.de/down.html.  It ships with a picolisp-mode and
-;; a inferior-picolisp-mode for Emacs (to be found in the /lib/el/
+;; an inferior-picolisp-mode for Emacs (to be found in the /lib/el/
 ;; directory).
 
 ;; Although it might seem more natural to use Emacs Lisp for most
diff --git a/lisp/org/org-clock.el b/lisp/org/org-clock.el
index 9bc1f0c..4c5fcc6 100644
--- a/lisp/org/org-clock.el
+++ b/lisp/org/org-clock.el
@@ -1394,7 +1394,7 @@ the default behavior."
 ;;;###autoload
 (defun org-clock-in-last (&optional arg)
   "Clock in the last closed clocked item.
-When already clocking in, send an warning.
+When already clocking in, send a warning.
 With a universal prefix argument, select the task you want to
 clock in from the last clocked in tasks.
 With two universal prefix arguments, start clocking using the
diff --git a/lisp/org/org-eww.el b/lisp/org/org-eww.el
index 0792c87..3d9dddc 100644
--- a/lisp/org/org-eww.el
+++ b/lisp/org/org-eww.el
@@ -25,9 +25,9 @@
 ;;; Commentary:
 
 ;; When this module is active `org-store-link' (often on key C-c l) in
-;; a eww buffer stores a link to the current url of the eww buffer.
+;; an EWW buffer stores a link to the current url of the eww buffer.
 
-;; In an eww buffer function `org-eww-copy-for-org-mode' kills either
+;; In an EWW buffer function `org-eww-copy-for-org-mode' kills either
 ;; a region or the whole buffer if no region is set and transforms the
 ;; text on the fly so that it can be pasted into an Org buffer with
 ;; hot links.
@@ -58,7 +58,7 @@
 ;; Store Org-link in eww-mode buffer
 (org-link-set-parameters "eww" :follow #'eww :store #'org-eww-store-link)
 (defun org-eww-store-link ()
-  "Store a link to the url of a Eww buffer."
+  "Store a link to the url of an EWW buffer."
   (when (eq major-mode 'eww-mode)
     (org-store-link-props
      :type "eww"
diff --git a/lisp/org/org-protocol.el b/lisp/org/org-protocol.el
index 3cbbc78..27c2bb2 100644
--- a/lisp/org/org-protocol.el
+++ b/lisp/org/org-protocol.el
@@ -663,7 +663,7 @@ to deal with new-style links.")
 ;;; Org specific functions:
 
 (defun org-protocol-create-for-org ()
-  "Create a Org protocol project for the current file's project.
+  "Create an Org protocol project for the current file's project.
 The visited file needs to be part of a publishing project in
 `org-publish-project-alist' for this to work.  The function
 delegates most of the work to `org-protocol-create'."
diff --git a/lisp/org/ox-html.el b/lisp/org/ox-html.el
index 06edb82..83f6479 100644
--- a/lisp/org/ox-html.el
+++ b/lisp/org/ox-html.el
@@ -2697,7 +2697,7 @@ holding contextual information."
 
 (defun org-html-format-inlinetask-default-function
   (todo todo-type priority text tags contents info)
-  "Default format function for a inlinetasks.
+  "Default format function for inlinetasks.
 See `org-html-format-inlinetask-function' for details."
   (format "<div class=\"inlinetask\">\n<b>%s</b>%s\n%s</div>"
          (org-html-format-headline-default-function
diff --git a/lisp/org/ox-latex.el b/lisp/org/ox-latex.el
index a656e06..c32aa29 100644
--- a/lisp/org/ox-latex.el
+++ b/lisp/org/ox-latex.el
@@ -2125,7 +2125,7 @@ holding contextual information."
 
 (defun org-latex-format-inlinetask-default-function
     (todo _todo-type priority title tags contents _info)
-  "Default format function for a inlinetasks.
+  "Default format function for inlinetasks.
 See `org-latex-format-inlinetask-function' for details."
   (let ((full-title
         (concat (when todo (format "\\textbf{\\textsf{\\textsc{%s}}} " todo))
diff --git a/lisp/org/ox-odt.el b/lisp/org/ox-odt.el
index e0c5166..cdee568 100644
--- a/lisp/org/ox-odt.el
+++ b/lisp/org/ox-odt.el
@@ -600,8 +600,7 @@ allow document of a given class (irrespective of its source
 format) to be converted to any of the export formats associated
 with that class.
 
-See default setting of this variable for an typical
-configuration."
+See default setting of this variable for a typical configuration."
   :group 'org-export-odt
   :version "24.1"
   :type
@@ -1938,7 +1937,7 @@ holding contextual information."
 
 (defun org-odt-format-inlinetask-default-function
   (todo todo-type priority name tags contents)
-  "Default format function for a inlinetasks.
+  "Default format function for inlinetasks.
 See `org-odt-format-inlinetask-function' for details."
   (format "\n<text:p text:style-name=\"%s\">%s</text:p>"
          "Text_20_body"
diff --git a/lisp/org/ox-texinfo.el b/lisp/org/ox-texinfo.el
index fd4235a..d877c9c 100644
--- a/lisp/org/ox-texinfo.el
+++ b/lisp/org/ox-texinfo.el
@@ -958,7 +958,7 @@ holding contextual information."
 
 (defun org-texinfo-format-inlinetask-default-function
   (todo _todo-type priority title tags contents)
-  "Default format function for a inlinetasks.
+  "Default format function for inlinetasks.
 See `org-texinfo-format-inlinetask-function' for details."
   (let ((full-title
         (concat (when todo (format "@strong{%s} " todo))
diff --git a/lisp/progmodes/ada-mode.el b/lisp/progmodes/ada-mode.el
index d09ee52..2d3f6e2 100644
--- a/lisp/progmodes/ada-mode.el
+++ b/lisp/progmodes/ada-mode.el
@@ -2479,7 +2479,7 @@ and the offset."
            (forward-word-strictly -1))
 
          ;; If there is a parameter list, and we have a function declaration
-         ;; or a access to subprogram declaration
+         ;; or access to subprogram declaration
          (let ((num-back 1))
            (if (and (= (following-char) ?\()
                     (save-excursion
diff --git a/lisp/progmodes/ada-stmt.el b/lisp/progmodes/ada-stmt.el
index 02f7e39..f1ed01e 100644
--- a/lisp/progmodes/ada-stmt.el
+++ b/lisp/progmodes/ada-stmt.el
@@ -415,13 +415,13 @@ Invoke right after `ada-function-spec' or 
`ada-procedure-spec'."
 
 
 (define-skeleton ada-entry-family-prompt-discriminant
-  "Insert a entry specification, prompting for the entry name."
+  "Insert an entry specification, prompting for the entry name."
   "[discriminant name]: "
   str)
 
 
 (define-skeleton ada-entry-family
-  "Insert a entry specification, prompting for the entry name."
+  "Insert an entry specification, prompting for the entry name."
   "[entry name]: "
   "entry " str
   " (" (ada-entry-family-prompt-discriminant) ")"
diff --git a/lisp/progmodes/antlr-mode.el b/lisp/progmodes/antlr-mode.el
index 921db6b..1d4fd4f 100644
--- a/lisp/progmodes/antlr-mode.el
+++ b/lisp/progmodes/antlr-mode.el
@@ -1562,7 +1562,7 @@ The search for a correct position is as follows:
 
   * If search is within an area where options can be inserted, use the
     position of point.  Inside the options section and if point is in
-    the middle of a option definition, skip the rest of it.
+    the middle of an option definition, skip the rest of it.
   * If an options section already exists, insert the options at the end.
     If only the beginning of the area is visible, insert at the
     beginning.
diff --git a/lisp/progmodes/cc-engine.el b/lisp/progmodes/cc-engine.el
index be7e86b..cddf79b 100644
--- a/lisp/progmodes/cc-engine.el
+++ b/lisp/progmodes/cc-engine.el
@@ -3304,7 +3304,7 @@ comment at the start of cc-engine.el for more info."
                             (point)
                           here)))
        pa+1                  ; pos just after an opening PAren (or brace).
-       (ren+1 from)          ; usually a pos just after an closing paREN etc.
+       (ren+1 from)          ; usually a pos just after a closing paREN etc.
                              ; Is actually the pos. to scan for a (/{/[ from,
                              ; which sometimes is after a silly )/}/].
        paren+1               ; Pos after some opening or closing paren.
@@ -10345,7 +10345,7 @@ comment at the start of cc-engine.el for more info."
       b-pos)))
 
 (defun c-backward-typed-enum-colon ()
-  ;; We're at a "{" which might be the opening brace of a enum which is
+  ;; We're at a "{" which might be the opening brace of an enum which is
   ;; strongly typed (by a ":" followed by a type).  If this is the case, leave
   ;; point before the colon and return t.  Otherwise leave point unchanged and 
return nil.
   ;; Match data will be clobbered.
diff --git a/lisp/progmodes/cc-menus.el b/lisp/progmodes/cc-menus.el
index ae7759e..a42fe27 100644
--- a/lisp/progmodes/cc-menus.el
+++ b/lisp/progmodes/cc-menus.el
@@ -360,7 +360,7 @@ Example:
       (setq char (aref method p)
            p (1+ p))
       (cond
-       ;; Is CHAR part of a objc token?
+       ;; Is CHAR part of an objc token?
        ((and (not inargvar)   ; Ignore if CHAR is part of an argument variable.
             (eq 0 betweenparen) ; Ignore if CHAR is in parentheses.
             (or (and (<= ?a char) (<= char ?z))
diff --git a/lisp/progmodes/cc-mode.el b/lisp/progmodes/cc-mode.el
index 2ce3d96..664f010 100644
--- a/lisp/progmodes/cc-mode.el
+++ b/lisp/progmodes/cc-mode.el
@@ -622,7 +622,7 @@ that requires a literal mode spec at compile time."
   ;; buffer local value has its own alist structure.
   (setq c-offsets-alist (copy-alist c-offsets-alist))
 
-  ;; setup the comment indent variable in a Emacs version portable way
+  ;; setup the comment indent variable in an Emacs version portable way
   (set (make-local-variable 'comment-indent-function) 'c-comment-indent)
   ;; What sort of comments are default for M-;?
   (setq c-block-comment-flag c-block-comment-is-default)
diff --git a/lisp/progmodes/compile.el b/lisp/progmodes/compile.el
index 92e202a..4229743 100644
--- a/lisp/progmodes/compile.el
+++ b/lisp/progmodes/compile.el
@@ -919,7 +919,7 @@ from a different message."
 
 ;; COLUMN and LINE are numbers parsed from an error message.  COLUMN and maybe
 ;; LINE will be nil for a message that doesn't contain them.  Then the
-;; location refers to a indented beginning of line or beginning of file.
+;; location refers to an indented beginning of line or beginning of file.
 ;; Once any location in some file has been jumped to, the list is extended to
 ;; (COLUMN LINE FILE-STRUCTURE MARKER TIMESTAMP . VISITED)
 ;; for all LOCs pertaining to that file.
diff --git a/lisp/progmodes/elisp-mode.el b/lisp/progmodes/elisp-mode.el
index e6e55a3..935e55c 100644
--- a/lisp/progmodes/elisp-mode.el
+++ b/lisp/progmodes/elisp-mode.el
@@ -1132,7 +1132,9 @@ character)."
         (eval-expression-get-print-arguments eval-last-sexp-arg-internal)))
     ;; Setup the lexical environment if lexical-binding is enabled.
     (elisp--eval-last-sexp-print-value
-     (eval (eval-sexp-add-defvars (elisp--preceding-sexp)) lexical-binding)
+     (eval (macroexpand-all
+            (eval-sexp-add-defvars (elisp--preceding-sexp)))
+           lexical-binding)
      (if insert-value (current-buffer) t) no-truncate char-print-limit)))
 
 (defun elisp--eval-last-sexp-print-value
@@ -1165,7 +1167,6 @@ character)."
 (defun eval-sexp-add-defvars (exp &optional pos)
   "Prepend EXP with all the `defvar's that precede it in the buffer.
 POS specifies the starting position where EXP was found and defaults to point."
-  (setq exp (macroexpand-all exp))      ;Eager macro-expansion.
   (if (not lexical-binding)
       exp
     (save-excursion
diff --git a/lisp/progmodes/grep.el b/lisp/progmodes/grep.el
index 9ce4ff8..14e251e 100644
--- a/lisp/progmodes/grep.el
+++ b/lisp/progmodes/grep.el
@@ -425,6 +425,14 @@ See `compilation-error-regexp-alist' for format details.")
 (defvar grep-context-face 'shadow
   "Face name to use for grep context lines.")
 
+(defvar grep-num-matches-found 0)
+
+(defconst grep-mode-line-matches
+  `(" [" (:propertize (:eval (int-to-string grep-num-matches-found))
+                      face ,grep-hit-face
+                      help-echo "Number of matches so far")
+    "]"))
+
 (defvar grep-mode-font-lock-keywords
    '(;; Command output lines.
      (": \\(.+\\): \\(?:Permission denied\\|No such \\(?:file or 
directory\\|device or address\\)\\)$"
@@ -432,7 +440,7 @@ See `compilation-error-regexp-alist' for format details.")
      ;; remove match from grep-regexp-alist before fontifying
      ("^Grep[/a-zA-z]* started.*"
       (0 '(face nil compilation-message nil help-echo nil mouse-face nil) t))
-     ("^Grep[/a-zA-z]* finished \\(?:(\\(matches found\\))\\|with \\(no 
matches found\\)\\).*"
+     ("^Grep[/a-zA-z]* finished with \\(?:\\(\\(?:[0-9]+ \\)?matches 
found\\)\\|\\(no matches found\\)\\).*"
       (0 '(face nil compilation-message nil help-echo nil mouse-face nil) t)
       (1 compilation-info-face nil t)
       (2 compilation-warning-face nil t))
@@ -503,21 +511,28 @@ Set up `compilation-exit-message-function' and run 
`grep-setup-hook'."
     (setenv "GREP_COLOR" "01;31")
     ;; GREP_COLORS is used in GNU grep 2.5.2 and later versions
     (setenv "GREP_COLORS" "mt=01;31:fn=:ln=:bn=:se=:sl=:cx=:ne"))
+  (setq-local grep-num-matches-found 0)
   (set (make-local-variable 'compilation-exit-message-function)
-       (lambda (status code msg)
-        (if (eq status 'exit)
-            ;; This relies on the fact that `compilation-start'
-            ;; sets buffer-modified to nil before running the command,
-            ;; so the buffer is still unmodified if there is no output.
-            (cond ((and (zerop code) (buffer-modified-p))
-                   '("finished (matches found)\n" . "matched"))
-                  ((not (buffer-modified-p))
-                   '("finished with no matches found\n" . "no match"))
-                  (t
-                   (cons msg code)))
-          (cons msg code))))
+       'grep-exit-message)
   (run-hooks 'grep-setup-hook))
 
+(defun grep-exit-message (status code msg)
+  "Return a status message for grep results."
+  (if (eq status 'exit)
+      ;; This relies on the fact that `compilation-start'
+      ;; sets buffer-modified to nil before running the command,
+      ;; so the buffer is still unmodified if there is no output.
+      (cond ((and (zerop code) (buffer-modified-p))
+            (if (> grep-num-matches-found 0)
+                 (cons (format "finished with %d matches found\n" 
grep-num-matches-found)
+                       "matched")
+               '("finished with matches found\n" . "matched")))
+           ((not (buffer-modified-p))
+            '("finished with no matches found\n" . "no match"))
+           (t
+            (cons msg code)))
+    (cons msg code)))
+
 (defun grep-filter ()
   "Handle match highlighting escape sequences inserted by the grep process.
 This function is called from `compilation-filter-hook'."
@@ -535,7 +550,8 @@ This function is called from `compilation-filter-hook'."
         (while (re-search-forward "\033\\[0?1;31m\\(.*?\\)\033\\[[0-9]*m" end 
1)
           (replace-match (propertize (match-string 1)
                                      'face nil 'font-lock-face grep-match-face)
-                         t t))
+                         t t)
+          (cl-incf grep-num-matches-found))
         ;; Delete all remaining escape sequences
         (goto-char beg)
         (while (re-search-forward "\033\\[[0-9;]*[mK]" end 1)
@@ -775,6 +791,8 @@ This function is called from `compilation-filter-hook'."
        grep-hit-face)
   (set (make-local-variable 'compilation-error-regexp-alist)
        grep-regexp-alist)
+  (set (make-local-variable 'compilation-mode-line-errors)
+       grep-mode-line-matches)
   ;; compilation-directory-matcher can't be nil, so we set it to a regexp that
   ;; can never match.
   (set (make-local-variable 'compilation-directory-matcher) '("\\`a\\`"))
diff --git a/lisp/progmodes/icon.el b/lisp/progmodes/icon.el
index 68bff26..6e02392 100644
--- a/lisp/progmodes/icon.el
+++ b/lisp/progmodes/icon.el
@@ -90,7 +90,7 @@
   :group 'icon)
 
 (defcustom icon-brace-imaginary-offset 0
-  "Imagined indentation of a Icon open brace that actually follows a 
statement."
+  "Imagined indentation of an Icon open brace that actually follows a 
statement."
   :type 'integer
   :group 'icon)
 
diff --git a/lisp/progmodes/python.el b/lisp/progmodes/python.el
index ff8269d..530eb2f 100644
--- a/lisp/progmodes/python.el
+++ b/lisp/progmodes/python.el
@@ -4,7 +4,7 @@
 
 ;; Author: Fabián E. Gallina <address@hidden>
 ;; URL: https://github.com/fgallina/python.el
-;; Version: 0.25.2
+;; Version: 0.26
 ;; Package-Requires: ((emacs "24.1") (cl-lib "1.0"))
 ;; Maintainer: address@hidden
 ;; Created: Jul 2010
@@ -422,7 +422,7 @@
       (string-delimiter . ,(rx (and
                                 ;; Match even number of backslashes.
                                 (or (not (any ?\\ ?\' ?\")) point
-                                    ;; Quotes might be preceded by a escaped 
quote.
+                                    ;; Quotes might be preceded by an escaped 
quote.
                                     (and (or (not (any ?\\)) point) ?\\
                                          (* ?\\ ?\\) (any ?\' ?\")))
                                 (* ?\\ ?\\)
@@ -925,7 +925,7 @@ keyword
                 (back-to-indentation)
                 (python-syntax-closing-paren-p))
               (cons :inside-paren-at-closing-nested-paren start))
-             ;; This line starts from a opening block in its own line.
+             ;; This line starts from an opening block in its own line.
              ((save-excursion
                 (goto-char start)
                 (when (and
@@ -1641,7 +1641,7 @@ ARG move forward only one sexp, else move backwards."
 
 (defun python-nav--lisp-forward-sexp-safe (&optional arg)
   "Safe version of standard `forward-sexp'.
-When at end of sexp (i.e. looking at a opening/closing paren)
+When at end of sexp (i.e. looking at an opening/closing paren)
 skips it instead of throwing an error.  With positive ARG move
 forward only one sexp, else move backwards."
   (let* ((arg (if (or (not arg) (> arg 0)) 1 -1))
diff --git a/lisp/progmodes/sh-script.el b/lisp/progmodes/sh-script.el
index 1b9e10a..aaa86b5 100644
--- a/lisp/progmodes/sh-script.el
+++ b/lisp/progmodes/sh-script.el
@@ -3019,7 +3019,7 @@ If INFO is supplied it is used, else it is calculated."
 ;; line -- it is the PREVIOUS line which is continued, not the one
 ;; we are going to!
 ;; Also, we want to treat a whole "here document" as one big line,
-;; because we may want to a align to the beginning of it.
+;; because we may want to align to the beginning of it.
 ;;
 ;; What we do:
 ;; - go back to previous non-empty line
diff --git a/lisp/progmodes/sql.el b/lisp/progmodes/sql.el
index 7bc3a5a..d20c579 100644
--- a/lisp/progmodes/sql.el
+++ b/lisp/progmodes/sql.el
@@ -2774,7 +2774,7 @@ local variable."
 
     ;; Our start must be between them
     (goto-char last)
-    ;; Find an beginning-of-stmt that's not in a comment
+    ;; Find a beginning-of-stmt that's not in a comment
     (while (and (re-search-forward regexp next t 1)
                 (nth 7 (syntax-ppss)))
       (goto-char (match-end 0)))
@@ -4225,7 +4225,7 @@ the call to \\[sql-product-interactive] with
                (symbolp product)) product)
          (t sql-product)))              ; Default to sql-product
 
-  ;; If we have a product and it has a interactive mode
+  ;; If we have a product and it has an interactive mode
   (if product
       (when (sql-get-product-feature product :sqli-comint-func)
         ;; If no new name specified, try to pop to an active SQL
diff --git a/lisp/progmodes/vhdl-mode.el b/lisp/progmodes/vhdl-mode.el
index db29435..a841f87 100644
--- a/lisp/progmodes/vhdl-mode.el
+++ b/lisp/progmodes/vhdl-mode.el
@@ -4890,7 +4890,7 @@ Key bindings:
   (set (make-local-variable 'indent-tabs-mode) vhdl-indent-tabs-mode)
   (set (make-local-variable 'hippie-expand-verbose) nil)
 
-  ;; setup the comment indent variable in a Emacs version portable way
+  ;; setup the comment indent variable in an Emacs version portable way
   ;; ignore any byte compiler warnings you might get here
   (when (boundp 'comment-indent-function)
     (set (make-local-variable 'comment-indent-function) 'vhdl-comment-indent))
diff --git a/lisp/server.el b/lisp/server.el
index d91a51e..a892203 100644
--- a/lisp/server.el
+++ b/lisp/server.el
@@ -251,8 +251,16 @@ This means that the server should not kill the buffer when 
you say you
 are done with it in the server.")
 (make-variable-buffer-local 'server-existing-buffer)
 
-;;;###autoload
-(defcustom server-name "server"
+(defvar server--external-socket-initialized nil
+  "When an external socket is passed into Emacs, we need to call
+`server-start' in order to initialize the connection.  This flag
+prevents multiple initializations when an external socket has
+been consumed.")
+
+(defcustom server-name
+  (if internal--daemon-sockname
+      (file-name-nondirectory internal--daemon-sockname)
+    "server")
   "The name of the Emacs server, if this Emacs process creates one.
 The command `server-start' makes use of this.  It should not be
 changed while a server is running."
@@ -263,8 +271,10 @@ changed while a server is running."
 ;; We do not use `temporary-file-directory' here, because emacsclient
 ;; does not read the init file.
 (defvar server-socket-dir
-  (and (featurep 'make-network-process '(:family local))
-       (format "%s/emacs%d" (or (getenv "TMPDIR") "/tmp") (user-uid)))
+  (if internal--daemon-sockname
+      (file-name-directory internal--daemon-sockname)
+    (and (featurep 'make-network-process '(:family local))
+         (format "%s/emacs%d" (or (getenv "TMPDIR") "/tmp") (user-uid))))
   "The directory in which to place the server socket.
 If local sockets are not supported, this is nil.")
 
@@ -618,23 +628,29 @@ To force-start a server, do \\[server-force-delete] and 
then
       (when server-process
        ;; kill it dead!
        (ignore-errors (delete-process server-process)))
-      ;; Delete the socket files made by previous server invocations.
-      (if (not (eq t (server-running-p server-name)))
-         ;; Remove any leftover socket or authentication file
-         (ignore-errors
-           (let (delete-by-moving-to-trash)
-             (delete-file server-file)))
-       (setq server-mode nil) ;; already set by the minor mode code
-       (display-warning
-        'server
-        (concat "Unable to start the Emacs server.\n"
-                (format "There is an existing Emacs server, named %S.\n"
-                        server-name)
-                (substitute-command-keys
-                  "To start the server in this Emacs process, stop the existing
+      ;; Check to see if an uninitialized external socket has been
+      ;; passed in, if that is the case, skip checking
+      ;; `server-running-p' as this will return the wrong result.
+      (if (and internal--daemon-sockname
+               (not server--external-socket-initialized))
+          (setq server--external-socket-initialized t)
+        ;; Delete the socket files made by previous server invocations.
+        (if (not (eq t (server-running-p server-name)))
+           ;; Remove any leftover socket or authentication file.
+           (ignore-errors
+             (let (delete-by-moving-to-trash)
+               (delete-file server-file)))
+         (setq server-mode nil) ;; already set by the minor mode code
+         (display-warning
+          'server
+          (concat "Unable to start the Emacs server.\n"
+                  (format "There is an existing Emacs server, named %S.\n"
+                          server-name)
+                  (substitute-command-keys
+                    "To start the server in this Emacs process, stop the 
existing
 server or call `\\[server-force-delete]' to forcibly disconnect it."))
-        :warning)
-       (setq leave-dead t))
+          :warning)
+         (setq leave-dead t)))
       ;; If this Emacs already had a server, clear out associated status.
       (while server-clients
        (server-delete-client (car server-clients)))
@@ -1076,7 +1092,8 @@ The following commands are accepted by the client:
                tty-type   ; string.
                files
                filepos
-               args-left)
+               args-left
+                create-frame-func)
            ;; Remove this line from STRING.
            (setq string (substring string (match-end 0)))
            (setq args-left
@@ -1228,28 +1245,29 @@ The following commands are accepted by the client:
                 (or files commands)
                 (setq use-current-frame t))
 
-           (setq frame
-                 (cond
-                  ((and use-current-frame
-                        (or (eq use-current-frame 'always)
-                            ;; We can't use the Emacs daemon's
-                            ;; terminal frame.
-                            (not (and (daemonp)
-                                      (null (cdr (frame-list)))
-                                      (eq (selected-frame)
-                                          terminal-frame)))))
-                   (setq tty-name nil tty-type nil)
-                   (if display (server-select-display display)))
-                  ((or (and (eq system-type 'windows-nt)
-                            (daemonp)
-                            (setq display "w32"))
-                       (eq tty-name 'window-system))
-                   (server-create-window-system-frame display nowait proc
-                                                      parent-id
-                                                      frame-parameters))
-                  ;; When resuming on a tty, tty-name is nil.
-                  (tty-name
-                   (server-create-tty-frame tty-name tty-type proc))))
+           (setq create-frame-func
+                  (lambda ()
+                   (cond
+                    ((and use-current-frame
+                          (or (eq use-current-frame 'always)
+                              ;; We can't use the Emacs daemon's
+                              ;; terminal frame.
+                              (not (and (daemonp)
+                                        (null (cdr (frame-list)))
+                                        (eq (selected-frame)
+                                            terminal-frame)))))
+                     (setq tty-name nil tty-type nil)
+                     (if display (server-select-display display)))
+                    ((or (and (eq system-type 'windows-nt)
+                              (daemonp)
+                              (setq display "w32"))
+                         (eq tty-name 'window-system))
+                     (server-create-window-system-frame display nowait proc
+                                                   parent-id
+                                                   frame-parameters))
+                    ;; When resuming on a tty, tty-name is nil.
+                    (tty-name
+                     (server-create-tty-frame tty-name tty-type proc)))))
 
             (process-put
              proc 'continuation
@@ -1261,7 +1279,7 @@ The following commands are accepted by the client:
                          (if (and dir (file-directory-p dir))
                              dir default-directory)))
                    (server-execute proc files nowait commands
-                                   dontkill frame tty-name)))))
+                                   dontkill create-frame-func tty-name)))))
 
             (when (or frame files)
               (server-goto-toplevel proc))
@@ -1270,7 +1288,7 @@ The following commands are accepted by the client:
     ;; condition-case
     (error (server-return-error proc err))))
 
-(defun server-execute (proc files nowait commands dontkill frame tty-name)
+(defun server-execute (proc files nowait commands dontkill create-frame-func 
tty-name)
   ;; This is run from timers and process-filters, i.e. "asynchronously".
   ;; But w.r.t the user, this is not really asynchronous since the timer
   ;; is run after 0s and the process-filter is run in response to the
@@ -1280,21 +1298,29 @@ The following commands are accepted by the client:
   ;; including code that needs to wait.
   (with-local-quit
     (condition-case err
-        (let ((buffers (server-visit-files files proc nowait)))
-          (mapc 'funcall (nreverse commands))
+        (let* ((buffers (server-visit-files files proc nowait))
+               ;; If we were told only to open a new client, obey
+               ;; `initial-buffer-choice' if it specifies a file
+               ;; or a function.
+               (initial-buffer (unless (or files commands)
+                                 (let ((buf
+                                        (cond ((stringp initial-buffer-choice)
+                                               (find-file-noselect 
initial-buffer-choice))
+                                              ((functionp 
initial-buffer-choice)
+                                               (funcall 
initial-buffer-choice)))))
+                                   (if (buffer-live-p buf) buf 
(get-buffer-create "*scratch*")))))
+               ;; Set current buffer so that newly created tty frames
+               ;; show the correct buffer initially.
+               (frame (with-current-buffer (or (car buffers)
+                                               initial-buffer
+                                               (current-buffer))
+                        (prog1
+                            (funcall create-frame-func)
+                          ;; Switch to initial buffer in case the frame was 
reused.
+                          (when initial-buffer
+                            (switch-to-buffer initial-buffer 'norecord))))))
 
-         ;; If we were told only to open a new client, obey
-         ;; `initial-buffer-choice' if it specifies a file
-          ;; or a function.
-          (unless (or files commands)
-            (let ((buf
-                   (cond ((stringp initial-buffer-choice)
-                         (find-file-noselect initial-buffer-choice))
-                        ((functionp initial-buffer-choice)
-                         (funcall initial-buffer-choice)))))
-             (switch-to-buffer
-              (if (buffer-live-p buf) buf (get-buffer-create "*scratch*"))
-              'norecord)))
+          (mapc 'funcall (nreverse commands))
 
           ;; Delete the client if necessary.
           (cond
diff --git a/lisp/startup.el b/lisp/startup.el
index 8c36c19..4105c1d 100644
--- a/lisp/startup.el
+++ b/lisp/startup.el
@@ -123,15 +123,17 @@ the remaining command-line args are in the variable 
`command-line-args-left'.")
 (defvar command-line-args-left nil
   "List of command-line args not yet processed.")
 
-(defvaralias 'argv 'command-line-args-left
-  "List of command-line args not yet processed.
-This is a convenience alias, so that one can write \(pop argv)
+(with-no-warnings
+  (defvaralias 'argv 'command-line-args-left
+    "List of command-line args not yet processed.
+This is a convenience alias, so that one can write (pop argv)
 inside of --eval command line arguments in order to access
-following arguments.")
+following arguments."))
 (internal-make-var-non-special 'argv)
 
-(defvar argi nil
-  "Current command-line argument.")
+(with-no-warnings
+  (defvar argi nil
+    "Current command-line argument."))
 (internal-make-var-non-special 'argi)
 
 (defvar command-line-functions nil    ;; lrs 7/31/89
@@ -312,6 +314,12 @@ see `tty-setup-hook'.")
 Currently this applies to: `emacs-startup-hook', `term-setup-hook',
 and `window-setup-hook'.")
 
+(defvar early-init-file nil
+  "File name, including directory, of user's early init file.
+See `user-init-file'.  The only difference is that
+`early-init-file' is not set during the course of evaluating the
+early init file.")
+
 (defvar keyboard-type nil
   "The brand of keyboard you are using.
 This variable is used to define the proper function and keypad
@@ -870,6 +878,92 @@ If STYLE is nil, display appropriately for the terminal."
           (when standard-display-table
             (aset standard-display-table char nil)))))))
 
+(defun load-user-init-file
+    (filename-function &optional alternate-filename-function load-defaults)
+  "Load a user init-file.
+FILENAME-FUNCTION is called with no arguments and should return
+the name of the init-file to load.  If this file cannot be
+loaded, and ALTERNATE-FILENAME-FUNCTION is non-nil, then it is
+called with no arguments and should return the name of an
+alternate init-file to load.  If LOAD-DEFAULTS is non-nil, then
+load default.el after the init-file.
+
+This function sets `user-init-file' to the name of the loaded
+init-file, or to a default value if loading is not possible."
+  (let ((debug-on-error-from-init-file nil)
+        (debug-on-error-should-be-set nil)
+        (debug-on-error-initial
+         (if (eq init-file-debug t)
+             'startup
+           init-file-debug)))
+    (let ((debug-on-error debug-on-error-initial))
+      (condition-case-unless-debug error
+          (when init-file-user
+            (let ((init-file-name (funcall filename-function)))
+
+              ;; If `user-init-file' is t, then `load' will store
+              ;; the name of the file that it loads into
+              ;; `user-init-file'.
+              (setq user-init-file t)
+              (load init-file-name 'noerror 'nomessage)
+
+              (when (and (eq user-init-file t) alternate-filename-function)
+                (load (funcall alternate-filename-function)
+                      'noerror 'nomessage))
+
+              ;; If we did not find the user's init file, set
+              ;; user-init-file conclusively.  Don't let it be
+              ;; set from default.el.
+              (when (eq user-init-file t)
+                (setq user-init-file init-file-name)))
+
+            ;; If we loaded a compiled file, set `user-init-file' to
+            ;; the source version if that exists.
+            (when (equal (file-name-extension user-init-file)
+                         "elc")
+              (let* ((source (file-name-sans-extension user-init-file))
+                     (alt (concat source ".el")))
+                (setq source (cond ((file-exists-p alt) alt)
+                                   ((file-exists-p source) source)
+                                   (t nil)))
+                (when source
+                  (when (file-newer-than-file-p source user-init-file)
+                    (message "Warning: %s is newer than %s"
+                             source user-init-file)
+                    (sit-for 1))
+                  (setq user-init-file source))))
+
+            (when load-defaults
+
+              ;; Prevent default.el from changing the value of
+              ;; `inhibit-startup-screen'.
+              (let ((inhibit-startup-screen nil))
+                (load "default" 'noerror 'nomessage))))
+        (error
+         (display-warning
+          'initialization
+          (format-message "\
+An error occurred while loading `%s':\n\n%s%s%s\n\n\
+To ensure normal operation, you should investigate and remove the
+cause of the error in your initialization file.  Start Emacs with
+the `--debug-init' option to view a complete error backtrace."
+                          user-init-file
+                          (get (car error) 'error-message)
+                          (if (cdr error) ": " "")
+                          (mapconcat (lambda (s) (prin1-to-string s t))
+                                     (cdr error) ", "))
+          :warning)
+         (setq init-file-had-error t)))
+
+      ;; If we can tell that the init file altered debug-on-error,
+      ;; arrange to preserve the value that it set up.
+      (or (eq debug-on-error debug-on-error-initial)
+          (setq debug-on-error-should-be-set t
+                debug-on-error-from-init-file debug-on-error)))
+
+    (when debug-on-error-should-be-set
+      (setq debug-on-error debug-on-error-from-init-file))))
+
 (defun command-line ()
   "A subroutine of `normal-top-level'.
 Amongst another things, it parses the command-line arguments."
@@ -1021,6 +1115,69 @@ please check its value")
     (and command-line-args
          (setcdr command-line-args args)))
 
+  ;; Warn for invalid user name.
+  (when init-file-user
+    (if (string-match "[~/:\n]" init-file-user)
+        (display-warning 'initialization
+                         (format "Invalid user name %s"
+                                 init-file-user)
+                         :error)
+      (if (file-directory-p (expand-file-name
+                             ;; We don't support ~USER on MS-Windows
+                             ;; and MS-DOS except for the current
+                             ;; user, and always load .emacs from
+                             ;; the current user's home directory
+                             ;; (see below).  So always check "~",
+                             ;; even if invoked with "-u USER", or
+                             ;; if $USER or $LOGNAME are set to
+                             ;; something different.
+                             (if (memq system-type '(windows-nt ms-dos))
+                                 "~"
+                               (concat "~" init-file-user))))
+          nil
+        (display-warning 'initialization
+                         (format "User %s has no home directory"
+                                 (if (equal init-file-user "")
+                                     (user-real-login-name)
+                                   init-file-user))
+                         :error))))
+
+  ;; Load the early init file, if found.
+  (load-user-init-file
+   (lambda ()
+     (expand-file-name
+      "early-init"
+      (file-name-as-directory
+       (concat "~" init-file-user "/.emacs.d")))))
+  (setq early-init-file user-init-file)
+
+  ;; If any package directory exists, initialize the package system.
+  (and user-init-file
+       package-enable-at-startup
+       (catch 'package-dir-found
+        (let (dirs)
+          (if (boundp 'package-directory-list)
+              (setq dirs package-directory-list)
+            (dolist (f load-path)
+              (and (stringp f)
+                   (equal (file-name-nondirectory f) "site-lisp")
+                   (push (expand-file-name "elpa" f) dirs))))
+          (push (if (boundp 'package-user-dir)
+                    package-user-dir
+                  (locate-user-emacs-file "elpa"))
+                dirs)
+          (dolist (dir dirs)
+            (when (file-directory-p dir)
+              (dolist (subdir (directory-files dir))
+                (when (let ((subdir (expand-file-name subdir dir)))
+                         (and (file-directory-p subdir)
+                              (file-exists-p
+                               (expand-file-name
+                                (package--description-file subdir)
+                                subdir))))
+                  (throw 'package-dir-found t)))))))
+       (package-initialize))
+
   ;; Make sure window system's init file was loaded in loadup.el if
   ;; using a window system.
   ;; Initialize the window-system only after processing the command-line
@@ -1128,153 +1285,47 @@ please check its value")
     ;; the startup screen.
     (setq inhibit-startup-screen nil)
 
-    ;; Warn for invalid user name.
-    (when init-file-user
-      (if (string-match "[~/:\n]" init-file-user)
-         (display-warning 'initialization
-                          (format "Invalid user name %s"
-                                  init-file-user)
-                          :error)
-       (if (file-directory-p (expand-file-name
-                              ;; We don't support ~USER on MS-Windows
-                              ;; and MS-DOS except for the current
-                              ;; user, and always load .emacs from
-                              ;; the current user's home directory
-                              ;; (see below).  So always check "~",
-                              ;; even if invoked with "-u USER", or
-                              ;; if $USER or $LOGNAME are set to
-                              ;; something different.
-                              (if (memq system-type '(windows-nt ms-dos))
-                                  "~"
-                                (concat "~" init-file-user))))
-           nil
-         (display-warning 'initialization
-                          (format "User %s has no home directory"
-                                  (if (equal init-file-user "")
-                                      (user-real-login-name)
-                                    init-file-user))
-                          :error))))
-
     ;; Load that user's init file, or the default one, or none.
-    (let (debug-on-error-from-init-file
-         debug-on-error-should-be-set
-         (debug-on-error-initial
-          (if (eq init-file-debug t) 'startup init-file-debug)))
-      (let ((debug-on-error debug-on-error-initial)
-           ;; This function actually reads the init files.
-           (inner
-            (function
-             (lambda ()
-               (if init-file-user
-                   (let ((user-init-file-1
-                          (cond
-                            ((eq system-type 'ms-dos)
-                             (concat "~" init-file-user "/_emacs"))
-                            ((not (eq system-type 'windows-nt))
-                             (concat "~" init-file-user "/.emacs"))
-                            ;; Else deal with the Windows situation
-                            ((directory-files "~" nil 
"^\\.emacs\\(\\.elc?\\)?$")
-                             ;; Prefer .emacs on Windows.
-                             "~/.emacs")
-                            ((directory-files "~" nil "^_emacs\\(\\.elc?\\)?$")
-                             ;; Also support _emacs for compatibility, but 
warn about it.
-                             (push `(initialization
-                                     ,(format-message
-                                       "`_emacs' init file is deprecated, 
please use `.emacs'"))
-                                   delayed-warnings-list)
-                             "~/_emacs")
-                            (t ;; But default to .emacs if _emacs does not 
exist.
-                             "~/.emacs"))))
-                     ;; This tells `load' to store the file name found
-                     ;; into user-init-file.
-                     (setq user-init-file t)
-                     (load user-init-file-1 t t)
-
-                     (when (eq user-init-file t)
-                       ;; If we did not find ~/.emacs, try
-                       ;; ~/.emacs.d/init.el.
-                       (let ((otherfile
-                              (expand-file-name
-                               "init"
-                               (file-name-as-directory
-                                (concat "~" init-file-user "/.emacs.d")))))
-                         (load otherfile t t)
-
-                         ;; If we did not find the user's init file,
-                         ;; set user-init-file conclusively.
-                         ;; Don't let it be set from default.el.
-                         (when (eq user-init-file t)
-                           (setq user-init-file user-init-file-1))))
-
-                     ;; If we loaded a compiled file, set
-                     ;; `user-init-file' to the source version if that
-                     ;; exists.
-                     (when (and user-init-file
-                                (equal (file-name-extension user-init-file)
-                                       "elc"))
-                       (let* ((source (file-name-sans-extension 
user-init-file))
-                              (alt (concat source ".el")))
-                         (setq source (cond ((file-exists-p alt) alt)
-                                            ((file-exists-p source) source)
-                                            (t nil)))
-                         (when source
-                           (when (file-newer-than-file-p source user-init-file)
-                             (message "Warning: %s is newer than %s"
-                                      source user-init-file)
-                             (sit-for 1))
-                           (setq user-init-file source))))
-
-                     (unless inhibit-default-init
-                        (let ((inhibit-startup-screen nil))
-                          ;; Users are supposed to be told their rights.
-                          ;; (Plus how to get help and how to undo.)
-                          ;; Don't you dare turn this off for anyone
-                          ;; except yourself.
-                          (load "default" t t)))))))))
-       (if init-file-debug
-           ;; Do this without a condition-case if the user wants to debug.
-           (funcall inner)
-         (condition-case error
-             (progn
-               (funcall inner)
-               (setq init-file-had-error nil))
-           (error
-            (display-warning
-             'initialization
-             (format-message "\
-An error occurred while loading `%s':\n\n%s%s%s\n\n\
-To ensure normal operation, you should investigate and remove the
-cause of the error in your initialization file.  Start Emacs with
-the `--debug-init' option to view a complete error backtrace."
-                     user-init-file
-                     (get (car error) 'error-message)
-                     (if (cdr error) ": " "")
-                     (mapconcat (lambda (s) (prin1-to-string s t))
-                                (cdr error) ", "))
-             :warning)
-            (setq init-file-had-error t))))
-
-      (if (and deactivate-mark transient-mark-mode)
-           (with-current-buffer (window-buffer)
-             (deactivate-mark)))
-
-       ;; If the user has a file of abbrevs, read it (unless -batch).
-       (when (and (not noninteractive)
-                  (file-exists-p abbrev-file-name)
-                  (file-readable-p abbrev-file-name))
-           (quietly-read-abbrev-file abbrev-file-name))
-
-       ;; If the abbrevs came entirely from the init file or the
-       ;; abbrevs file, they do not need saving.
-       (setq abbrevs-changed nil)
-
-       ;; If we can tell that the init file altered debug-on-error,
-       ;; arrange to preserve the value that it set up.
-       (or (eq debug-on-error debug-on-error-initial)
-           (setq debug-on-error-should-be-set t
-                 debug-on-error-from-init-file debug-on-error)))
-      (if debug-on-error-should-be-set
-         (setq debug-on-error debug-on-error-from-init-file)))
+    (load-user-init-file
+     (lambda ()
+       (cond
+        ((eq system-type 'ms-dos)
+         (concat "~" init-file-user "/_emacs"))
+        ((not (eq system-type 'windows-nt))
+         (concat "~" init-file-user "/.emacs"))
+        ;; Else deal with the Windows situation.
+        ((directory-files "~" nil "^\\.emacs\\(\\.elc?\\)?$")
+         ;; Prefer .emacs on Windows.
+         "~/.emacs")
+        ((directory-files "~" nil "^_emacs\\(\\.elc?\\)?$")
+         ;; Also support _emacs for compatibility, but warn about it.
+         (push `(initialization
+                 ,(format-message
+                   "`_emacs' init file is deprecated, please use `.emacs'"))
+               delayed-warnings-list)
+         "~/_emacs")
+        (t ;; But default to .emacs if _emacs does not exist.
+         "~/.emacs")))
+     (lambda ()
+       (expand-file-name
+        "init"
+        (file-name-as-directory
+         (concat "~" init-file-user "/.emacs.d"))))
+     (not inhibit-default-init))
+
+    (when (and deactivate-mark transient-mark-mode)
+      (with-current-buffer (window-buffer)
+        (deactivate-mark)))
+
+    ;; If the user has a file of abbrevs, read it (unless -batch).
+    (when (and (not noninteractive)
+               (file-exists-p abbrev-file-name)
+               (file-readable-p abbrev-file-name))
+      (quietly-read-abbrev-file abbrev-file-name))
+
+    ;; If the abbrevs came entirely from the init file or the
+    ;; abbrevs file, they do not need saving.
+    (setq abbrevs-changed nil)
 
     ;; Do this here in case the init file sets mail-host-address.
     (and mail-host-address
@@ -1296,33 +1347,6 @@ the `--debug-init' option to view a complete error 
backtrace."
                 (eq face-ignored-fonts old-face-ignored-fonts))
       (clear-face-cache)))
 
-  ;; If any package directory exists, initialize the package system.
-  (and user-init-file
-       package-enable-at-startup
-       (catch 'package-dir-found
-        (let (dirs)
-          (if (boundp 'package-directory-list)
-              (setq dirs package-directory-list)
-            (dolist (f load-path)
-              (and (stringp f)
-                   (equal (file-name-nondirectory f) "site-lisp")
-                   (push (expand-file-name "elpa" f) dirs))))
-          (push (if (boundp 'package-user-dir)
-                    package-user-dir
-                  (locate-user-emacs-file "elpa"))
-                dirs)
-          (dolist (dir dirs)
-            (when (file-directory-p dir)
-              (dolist (subdir (directory-files dir))
-                (when (let ((subdir (expand-file-name subdir dir)))
-                         (and (file-directory-p subdir)
-                              (file-exists-p
-                               (expand-file-name
-                                (package--description-file subdir)
-                                subdir))))
-                  (throw 'package-dir-found t)))))))
-       (package-initialize))
-
   (setq after-init-time (current-time))
   ;; Display any accumulated warnings after all functions in
   ;; `after-init-hook' like `desktop-read' have finalized possible
diff --git a/lisp/tempo.el b/lisp/tempo.el
index 6c39558..5d4dea5 100644
--- a/lisp/tempo.el
+++ b/lisp/tempo.el
@@ -154,7 +154,7 @@ setting it to (upcase), for example.")
 
 (defvar tempo-local-tags '((tempo-tags . nil))
   "A list of locally installed tag completion lists.
-It is a association list where the car of every element is a symbol
+It is an association list where the car of every element is a symbol
 whose variable value is a template list.  The cdr part, if non-nil,
 is a function or a regexp that defines the string to match.  See the
 documentation for the function `tempo-complete-tag' for more info.
diff --git a/lisp/term/README b/lisp/term/README
index d5453e1..4ab1a43 100644
--- a/lisp/term/README
+++ b/lisp/term/README
@@ -60,7 +60,7 @@ they'll frustrate you after you've forgotten about them.
    For another, the X keysyms provide a standard set of names that Emacs knows
 about.  It tries to bind many of them to useful things at startup, before your
 .emacs is read (so you can override them).  In some ways, the X keysym standard
-is a admittedly poor one; it's incomplete, and not well matched to the set of
+is an admittedly poor one; it's incomplete, and not well matched to the set of
 'virtual keys' that UNIX terminfo(3) provides.  But, trust us, the alternatives
 were worse.
 
diff --git a/lisp/term/ns-win.el b/lisp/term/ns-win.el
index ca2cc72..7d89ec3 100644
--- a/lisp/term/ns-win.el
+++ b/lisp/term/ns-win.el
@@ -437,14 +437,7 @@ Lines are highlighted according to `ns-input-line'."
 ;;;; File handling.
 
 (defun x-file-dialog (prompt dir default_filename mustmatch only_dir_p)
-"Read file name, prompting with PROMPT in directory DIR.
-Use a file selection dialog.  Select DEFAULT-FILENAME in the dialog's file
-selection box, if specified.  If MUSTMATCH is non-nil, the returned file
-or directory must exist.
-
-This function is only defined on NS, MS Windows, and X Windows with the
-Motif or Gtk toolkits.  With the Motif toolkit, ONLY-DIR-P is ignored.
-Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories."
+"SKIP: real doc in xfns.c."
   (ns-read-file-name prompt dir mustmatch default_filename only_dir_p))
 
 (defun ns-open-file-using-panel ()
diff --git a/lisp/term/pc-win.el b/lisp/term/pc-win.el
index 3ed21b8..9c1b471 100644
--- a/lisp/term/pc-win.el
+++ b/lisp/term/pc-win.el
@@ -158,159 +158,59 @@ created."
 ;; a useful function for returning 'nil regardless of argument.
 
 ;; Note: Any re-definition in this file of a function that is defined
-;; in C on other platforms, should either have no doc-string, or one
-;; that is identical to the C version, but with the arglist signature
-;; at the end.  Otherwise help-split-fundoc gets confused on other
-;; platforms.  (Bug#10783)
+;; in C on other platforms, should either have a doc-string that
+;; starts with "SKIP", or one that is identical to the C version,
+;; but with the arglist signature at the end.  Otherwise
+;; help-split-fundoc gets confused on other platforms.  (Bug#10783)
 
-;; From src/xfns.c
 (defun x-list-fonts (_pattern &optional _face _frame _maximum width)
-  "Return a list of the names of available fonts matching PATTERN.
-If optional arguments FACE and FRAME are specified, return only fonts
-the same size as FACE on FRAME.
-
-PATTERN should be a string containing a font name in the XLFD,
-Fontconfig, or GTK format.  A font name given in the XLFD format may
-contain wildcard characters:
-  the * character matches any substring, and
-  the ? character matches any single character.
-  PATTERN is case-insensitive.
-
-The return value is a list of strings, suitable as arguments to
-`set-face-font'.
-
-Fonts Emacs can't use may or may not be excluded
-even if they match PATTERN and FACE.
-The optional fourth argument MAXIMUM sets a limit on how many
-fonts to match.  The first MAXIMUM fonts are reported.
-The optional fifth argument WIDTH, if specified, is a number of columns
-occupied by a character of a font.  In that case, return only fonts
-the WIDTH times as wide as FACE on FRAME."
+  "SKIP: real doc in xfaces.c."
   (if (or (null width) (and (numberp width) (= width 1)))
       (list "ms-dos")
     (list "no-such-font")))
 (defun x-display-pixel-width (&optional frame)
-  "Return the width in pixels of DISPLAY.
-The optional argument DISPLAY specifies which display to ask about.
-DISPLAY should be either a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display.
-
-On \"multi-monitor\" setups this refers to the pixel width for all
-physical monitors associated with DISPLAY.  To get information for
-each physical monitor, use `display-monitor-attributes-list'."
+  "SKIP: real doc in xfns.c."
   (frame-width frame))
 (defun x-display-pixel-height (&optional frame)
-  "Return the height in pixels of DISPLAY.
-The optional argument DISPLAY specifies which display to ask about.
-DISPLAY should be either a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display.
-
-On \"multi-monitor\" setups this refers to the pixel height for all
-physical monitors associated with DISPLAY.  To get information for
-each physical monitor, use `display-monitor-attributes-list'."
+  "SKIP: real doc in xfns.c."
   (frame-height frame))
 (defun x-display-planes (&optional _frame)
-  "Return the number of bitplanes of DISPLAY.
-The optional argument DISPLAY specifies which display to ask about.
-DISPLAY should be either a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display."
+  "SKIP: real doc in xfns.c."
   4) ;bg switched to 16 colors as well
 (defun x-display-color-cells (&optional _frame)
-  "Return the number of color cells of DISPLAY.
-The optional argument DISPLAY specifies which display to ask about.
-DISPLAY should be either a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display."
+  "SKIP: real doc in xfns.c."
   16)
 (defun x-server-max-request-size (&optional _frame)
-  "Return the maximum request size of the server of DISPLAY.
-The optional argument DISPLAY specifies which display to ask about.
-DISPLAY should be either a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display."
+  "SKIP: real doc in xfns.c."
   1000000) ; ???
 (defun x-server-vendor (&optional _frame)
-  "Return the \"vendor ID\" string of the GUI software on TERMINAL.
-
-\(Labeling every distributor as a \"vendor\" embodies the false assumption
-that operating systems cannot be developed and distributed noncommercially.)
-
-For GNU and Unix systems, this queries the X server software; for
-MS-Windows, this queries the OS.
-
-The optional argument TERMINAL specifies which display to ask about.
-TERMINAL should be a terminal object, a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display."
+  "SKIP: real doc in xfns.c."
   "GNU")
 (defun x-server-version (&optional _frame)
-  "Return the version numbers of the GUI software on TERMINAL.
-The value is a list of three integers specifying the version of the GUI
-software in use.
-
-For GNU and Unix system, the first 2 numbers are the version of the X
-Protocol used on TERMINAL and the 3rd number is the distributor-specific
-release number.  For MS-Windows, the 3 numbers report the version and
-the build number of the OS.
-
-See also the function `x-server-vendor'.
-
-The optional argument TERMINAL specifies which display to ask about.
-TERMINAL should be a terminal object, a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display."
+  "SKIP: real doc in xfns.c."
   '(1 0 0))
 (defun x-display-screens (&optional _frame)
-  "Return the number of screens on the server of DISPLAY.
-The optional argument DISPLAY specifies which display to ask about.
-DISPLAY should be either a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display."
+  "SKIP: real doc in xfns.c."
   1)
 (defun x-display-mm-height (&optional _frame)
-  "Return the height in millimeters of DISPLAY.
-The optional argument DISPLAY specifies which display to ask about.
-DISPLAY should be either a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display.
-
-On \"multi-monitor\" setups this refers to the height in millimeters for
-all physical monitors associated with DISPLAY.  To get information
-for each physical monitor, use `display-monitor-attributes-list'."
+  "SKIP: real doc in xfns.c."
   245) ; Guess the size of my...
 (defun x-display-mm-width (&optional _frame)
-  "Return the width in millimeters of DISPLAY.
-The optional argument DISPLAY specifies which display to ask about.
-DISPLAY should be either a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display.
-
-On \"multi-monitor\" setups this refers to the width in millimeters for
-all physical monitors associated with TERMINAL.  To get information
-for each physical monitor, use `display-monitor-attributes-list'."
+  "SKIP: real doc in xfns.c."
   322)  ; ...monitor, EZ...
 (defun x-display-backing-store (&optional _frame)
-  "Return an indication of whether DISPLAY does backing store.
-The value may be `always', `when-mapped', or `not-useful'.
-The optional argument DISPLAY specifies which display to ask about.
-DISPLAY should be either a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display."
+  "SKIP: real doc in xfns.c."
   'not-useful)
 (defun x-display-visual-class (&optional _frame)
-  "Return the visual class of DISPLAY.
-The value is one of the symbols `static-gray', `gray-scale',
-`static-color', `pseudo-color', `true-color', or `direct-color'.
-
-The optional argument DISPLAY specifies which display to ask about.
-DISPLAY should be either a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display."
+  "SKIP: real doc in xfns.c."
   'static-color)
 (fset 'x-display-save-under 'ignore)
 (fset 'x-get-resource 'ignore)
 
-;; From lisp/term/x-win.el
 (defvar x-display-name "pc"
-  "The name of the window display on which Emacs was started.
-On X, the display name of individual X frames is recorded in the
-`display' frame parameter.")
+  "SKIP: real doc in common-win.el.")
 (defvar x-colors (mapcar 'car msdos-color-values)
-  "List of basic colors available on color displays.
-For X, the list comes from the `rgb.txt' file,v 10.41 94/02/20.
-For Nextstep, this is a list of non-PANTONE colors returned by
-the operating system.")
+  "SKIP: real doc in common-win.el.")
 
 ;; From lisp/term/w32-win.el
 ;
diff --git a/lisp/textmodes/artist.el b/lisp/textmodes/artist.el
index 7341907..af7bcc7 100644
--- a/lisp/textmodes/artist.el
+++ b/lisp/textmodes/artist.el
@@ -1025,78 +1025,78 @@ If DRAW-HOW is `artist-do-poly':
 
 (defsubst artist-go-get-keyword (info-variant-part)
   "Retrieve the keyword component from an INFO-VARIANT-PART.
-An INFO-VARIANT-PART is the shifted or unshifted info from a info-part."
+An INFO-VARIANT-PART is the shifted or unshifted info from an info-part."
   (elt info-variant-part 0))
 
 (defsubst artist-go-get-symbol (info-variant-part)
   "Retrieve the symbol component from an INFO-VARIANT-PART.
-An INFO-VARIANT-PART is the shifted or unshifted info from a info-part."
+An INFO-VARIANT-PART is the shifted or unshifted info from an info-part."
   (elt info-variant-part 1))
 
 (defsubst artist-go-get-mode-line (info-variant-part)
   "Retrieve the mode line component from an INFO-VARIANT-PART.
-An INFO-VARIANT-PART is the shifted or unshifted info from a info-part."
+An INFO-VARIANT-PART is the shifted or unshifted info from an info-part."
   (elt info-variant-part 2))
 
 (defsubst artist-go-get-arrow-pred (info-variant-part)
   "Retrieve the arrow predicate component from an INFO-VARIANT-PART.
-An INFO-VARIANT-PART is the shifted or unshifted info from a info-part."
+An INFO-VARIANT-PART is the shifted or unshifted info from an info-part."
   (elt info-variant-part 3))
 
 (defsubst artist-go-get-arrow-set-fn (info-variant-part)
   "Retrieve the arrow set component from an INFO-VARIANT-PART.
-An INFO-VARIANT-PART is the shifted or unshifted info from a info-part."
+An INFO-VARIANT-PART is the shifted or unshifted info from an info-part."
   (elt info-variant-part 4))
 
 (defsubst artist-go-get-init-fn (info-variant-part)
   "Retrieve the init function component from an INFO-VARIANT-PART.
-An INFO-VARIANT-PART is the shifted or unshifted info from a info-part."
+An INFO-VARIANT-PART is the shifted or unshifted info from an info-part."
   (elt info-variant-part 5))
 
 (defsubst artist-go-get-prep-fill-fn (info-variant-part)
   "Retrieve the fill preparation function component from an INFO-VARIANT-PART.
-An INFO-VARIANT-PART is the shifted or unshifted info from a info-part."
+An INFO-VARIANT-PART is the shifted or unshifted info from an info-part."
   (elt info-variant-part 6))
 
 (defsubst artist-go-get-exit-fn (info-variant-part)
   "Retrieve the exit component from an INFO-VARIANT-PART.
-An INFO-VARIANT-PART is the shifted or unshifted info from a info-part."
+An INFO-VARIANT-PART is the shifted or unshifted info from an info-part."
   (elt info-variant-part 7))
 
 (defsubst artist-go-get-draw-how (info-variant-part)
   "Retrieve the draw how component from an INFO-VARIANT-PART.
-An INFO-VARIANT-PART is the shifted or unshifted info from a info-part."
+An INFO-VARIANT-PART is the shifted or unshifted info from an info-part."
   (elt info-variant-part 8))
 
 (defsubst artist-go-get-draw-fn (info-variant-part)
   "Retrieve the draw function component from an INFO-VARIANT-PART.
-An INFO-VARIANT-PART is the shifted or unshifted info from a info-part."
+An INFO-VARIANT-PART is the shifted or unshifted info from an info-part."
   (elt info-variant-part 9))
 
 (defsubst artist-go-get-undraw-fn (info-variant-part)
   "Retrieve the undraw function component from an INFO-VARIANT-PART.
-An INFO-VARIANT-PART is the shifted or unshifted info from a info-part.
+An INFO-VARIANT-PART is the shifted or unshifted info from an info-part.
 This interval function component is available only if the `draw-how'
 component is other than `artist-do-continously' or 1."
   (elt (elt info-variant-part 10) 0))
 
 (defsubst artist-go-get-interval-fn (info-variant-part)
   "Retrieve the interval function component from an INFO-VARIANT-PART.
-An INFO-VARIANT-PART is the shifted or unshifted info from a info-part.
+An INFO-VARIANT-PART is the shifted or unshifted info from an info-part.
 This interval function component is available only if the `draw-how'
 component is `artist-do-continously'."
   (elt (elt info-variant-part 10) 0))
 
 (defsubst artist-go-get-fill-pred (info-variant-part)
   "Retrieve the fill predicate component from an INFO-VARIANT-PART.
-An INFO-VARIANT-PART is the shifted or unshifted info from a info-part.
+An INFO-VARIANT-PART is the shifted or unshifted info from an info-part.
 This interval function component is available only if the `draw-how'
 component is other than `artist-do-continously' or 1."
   (elt (elt info-variant-part 10) 1))
 
 (defsubst artist-go-get-fill-fn (info-variant-part)
   "Retrieve the fill function component from an INFO-VARIANT-PART.
-An INFO-VARIANT-PART is the shifted or unshifted info from a info-part.
+An INFO-VARIANT-PART is the shifted or unshifted info from an info-part.
 This interval function component is available only if the `draw-how'
 component is other than `artist-do-continously' or 1."
   (elt (elt info-variant-part 10) 2))
diff --git a/lisp/textmodes/flyspell.el b/lisp/textmodes/flyspell.el
index 1d7dc99..5568bbb 100644
--- a/lisp/textmodes/flyspell.el
+++ b/lisp/textmodes/flyspell.el
@@ -1732,7 +1732,7 @@ FLYSPELL-BUFFER."
 ;;*---------------------------------------------------------------------*/
 ;;*    flyspell-properties-at-p ...                                     */
 ;;*    -------------------------------------------------------------    */
-;;*    Is there an highlight properties at position pos?                */
+;;*    Is there a highlight property at position pos?                   */
 ;;*---------------------------------------------------------------------*/
 (defun flyspell-properties-at-p (pos)
   "Return t if there is a text property at POS, not counting `local-map'.
@@ -1917,7 +1917,10 @@ before point that's highlighted as misspelled."
 ;;*---------------------------------------------------------------------*/
 (defun flyspell-auto-correct-word ()
   "Correct the current word.
-This command proposes various successive corrections for the current word."
+This command proposes various successive corrections for the
+current word.  If invoked repeatedly on the same position, it
+cycles through the possible corrections of the word at or near
+that position."
   (interactive)
   ;; If we are not in the construct where flyspell should be active,
   ;; invoke the original binding of M-TAB, if that was recorded.
diff --git a/lisp/textmodes/reftex-vars.el b/lisp/textmodes/reftex-vars.el
index 6d253f1..01ee4f5 100644
--- a/lisp/textmodes/reftex-vars.el
+++ b/lisp/textmodes/reftex-vars.el
@@ -1405,7 +1405,7 @@ the text, so that the text has to be repeated outside the 
index macro.
 Needed for `reftex-index-selection-or-word' and for indexing from the
 phrase buffer.
 
-The final entry may also be a symbol if this entry has a association
+The final entry may also be a symbol if this entry has an association
 in the variable `reftex-index-macros-builtin' to specify the main
 indexing package you are using.  Valid values are currently
 default         The LaTeX default - unnecessary to specify this one
diff --git a/lisp/textmodes/rst.el b/lisp/textmodes/rst.el
index c93e4e4..48c0128 100644
--- a/lisp/textmodes/rst.el
+++ b/lisp/textmodes/rst.el
@@ -631,7 +631,7 @@ After interpretation of ARGS the results are concatenated 
as for
      &aux
      (char (rst-Ado--validate-char char-arg))
      (-style 'simple)))
-   ;; Construct a over-and-under section header.
+   ;; Construct an over-and-under section header.
    (:constructor
     rst-Ado-new-over-and-under
     (char-arg
@@ -696,7 +696,7 @@ Return CHAR if so or signal an error otherwise."
 
 (defun rst-Ado-is-over-and-under (self)
   ;; testcover: ok.
-  "Return non-nil if SELF is a over-and-under section adornment."
+  "Return non-nil if SELF is an over-and-under section adornment."
   (cl-check-type self rst-Ado)
   (eq (rst-Ado--style self) 'over-and-under))
 
@@ -834,7 +834,7 @@ Return ADO if so or signal an error otherwise."
 
 (defun rst-Hdr-is-over-and-under (self)
   ;; testcover: ok.
-  "Return non-nil if SELF is a over-and-under section header."
+  "Return non-nil if SELF is an over-and-under section header."
   (cl-check-type self rst-Hdr)
   (rst-Ado-is-over-and-under (rst-Hdr-ado self)))
 
@@ -937,7 +937,7 @@ This type is immutable."
                   (or (null und-beg) (integer-or-marker-p und-beg))
                   (or (null und-end) (integer-or-marker-p und-end)))
        (signal 'args-out-of-range
-               '("For a over-and-under section adornment all match pairs must 
be set."))))))
+               '("For an over-and-under section adornment all match pairs must 
be set."))))))
   match)
 
 (defun rst-Ttl--validate-indent (indent ado)
@@ -1224,7 +1224,7 @@ as well but give an additional message."
     ;; Makes paragraphs in region as a bullet list.
     (rst-define-key map [?\C-c ?\C-l ?\C-b] #'rst-bullet-list-region
                    [?\C-c ?\C-b])
-    ;; Makes paragraphs in region as a enumeration.
+    ;; Makes paragraphs in region an enumeration.
     (rst-define-key map [?\C-c ?\C-l ?\C-e] #'rst-enumerate-region
                    [?\C-c ?\C-e])
     ;; Converts bullets to an enumeration.
@@ -1529,7 +1529,7 @@ file."
 (defcustom rst-default-indent 1
   "Number of characters to indent the section title.
 This is only used while toggling adornment styles when switching
-from a simple adornment style to a over-and-under adornment
+from a simple adornment style to an over-and-under adornment
 style.  In addition this is used in cases where the adornments
 found in the buffer are to be used but the indentation for
 over-and-under adornments is inconsistent across the buffer."
diff --git a/lisp/thumbs.el b/lisp/thumbs.el
index 7aaed28..26c9935 100644
--- a/lisp/thumbs.el
+++ b/lisp/thumbs.el
@@ -48,7 +48,7 @@
 ;; That should be a directory containing image files.
 ;; from dired, C-t m enter in thumbs-mode with all marked files
 ;;             C-t a enter in thumbs-mode with all files in current-directory
-;; In thumbs-mode, pressing <return> on a image will bring you in image view
+;; In thumbs-mode, pressing <return> on an image will bring you in image view
 ;; mode for that image.  C-h m will give you a list of available keybinding.
 
 ;;; History:
diff --git a/lisp/vc/add-log.el b/lisp/vc/add-log.el
index ea2e8ec..bc2be4a 100644
--- a/lisp/vc/add-log.el
+++ b/lisp/vc/add-log.el
@@ -1163,7 +1163,7 @@ Has a preference of looking backwards."
   (goto-char (match-end 0)))
 
 (defun change-log-get-method-definition ()
-"For Objective C, return the method name if we are in a method."
+  "For Objective C, return the method name if we are in a method."
   (let ((change-log-get-method-definition-md "["))
     (save-excursion
       (if (re-search-backward "address@hidden([A-Za-z_]*\\)" nil t)
diff --git a/lisp/vc/diff-mode.el b/lisp/vc/diff-mode.el
index 7db5ca9..ef13f55 100644
--- a/lisp/vc/diff-mode.el
+++ b/lisp/vc/diff-mode.el
@@ -891,7 +891,7 @@ PREFIX is only used internally: don't use it."
             (if (and newfile (file-exists-p newfile)) (cl-return newfile))))
          ;; look for each file in turn.  If none found, try again but
          ;; ignoring the first level of directory, ...
-         (cl-do* ((files fs (delq nil (mapcar 'diff-filename-drop-dir files)))
+         (cl-do* ((files fs (delq nil (mapcar #'diff-filename-drop-dir files)))
                   (file nil nil))
             ((or (null files)
                  (setq file (cl-do* ((files files (cdr files))
@@ -1387,12 +1387,12 @@ a diff with \\[diff-reverse-direction].
   ;;   (set (make-local-variable 'paragraph-separate) paragraph-start)
   ;;   (set (make-local-variable 'page-delimiter) "--- [^\t]+\t")
   ;; compile support
-  (set (make-local-variable 'next-error-function) 'diff-next-error)
+  (set (make-local-variable 'next-error-function) #'diff-next-error)
 
   (set (make-local-variable 'beginning-of-defun-function)
-       'diff-beginning-of-file-and-junk)
+       #'diff-beginning-of-file-and-junk)
   (set (make-local-variable 'end-of-defun-function)
-       'diff-end-of-file)
+       #'diff-end-of-file)
 
   (diff-setup-whitespace)
 
@@ -1400,10 +1400,10 @@ a diff with \\[diff-reverse-direction].
       (setq buffer-read-only t))
   ;; setup change hooks
   (if (not diff-update-on-the-fly)
-      (add-hook 'write-contents-functions 'diff-write-contents-hooks nil t)
+      (add-hook 'write-contents-functions #'diff-write-contents-hooks nil t)
     (make-local-variable 'diff-unhandled-changes)
-    (add-hook 'after-change-functions 'diff-after-change-function nil t)
-    (add-hook 'post-command-hook 'diff-post-command-hook nil t))
+    (add-hook 'after-change-functions #'diff-after-change-function nil t)
+    (add-hook 'post-command-hook #'diff-post-command-hook nil t))
   ;; Neat trick from Dave Love to add more bindings in read-only mode:
   (let ((ro-bind (cons 'buffer-read-only diff-mode-shared-map)))
     (add-to-list 'minor-mode-overriding-map-alist ro-bind)
@@ -1415,7 +1415,7 @@ a diff with \\[diff-reverse-direction].
              nil t))
   ;; add-log support
   (set (make-local-variable 'add-log-current-defun-function)
-       'diff-current-defun)
+       #'diff-current-defun)
   (set (make-local-variable 'add-log-buffer-file-name-function)
        (lambda () (diff-find-file-name nil 'noprompt)))
   (unless (buffer-file-name)
@@ -1433,10 +1433,10 @@ the mode if ARG is omitted or nil.
   ;; FIXME: setup font-lock
   ;; setup change hooks
   (if (not diff-update-on-the-fly)
-      (add-hook 'write-contents-functions 'diff-write-contents-hooks nil t)
+      (add-hook 'write-contents-functions #'diff-write-contents-hooks nil t)
     (make-local-variable 'diff-unhandled-changes)
-    (add-hook 'after-change-functions 'diff-after-change-function nil t)
-    (add-hook 'post-command-hook 'diff-post-command-hook nil t)))
+    (add-hook 'after-change-functions #'diff-after-change-function nil t)
+    (add-hook 'post-command-hook #'diff-post-command-hook nil t)))
 
 ;;; Handy hook functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 
@@ -1468,7 +1468,7 @@ modified lines of the diff."
 
 (defun diff-delete-empty-files ()
   "Arrange for empty diff files to be removed."
-  (add-hook 'after-save-hook 'diff-delete-if-empty nil t))
+  (add-hook 'after-save-hook #'diff-delete-if-empty nil t))
 
 (defun diff-make-unified ()
   "Turn context diffs into unified diffs if applicable."
@@ -1693,7 +1693,7 @@ If TEXT isn't found, nil is returned."
 Whitespace differences are ignored."
   (let* ((orig (point))
         (re (concat "^[ \t\n]*"
-                    (mapconcat 'regexp-quote (split-string text) "[ \t\n]+")
+                    (mapconcat #'regexp-quote (split-string text) "[ \t\n]+")
                     "[ \t\n]*\n"))
         (forw (and (re-search-forward re nil t)
                    (cons (match-beginning 0) (match-end 0))))
@@ -2047,7 +2047,7 @@ Return new point, if it was moved."
                           (progn (diff--forward-while-leading-char ?\\ end)
                                  (setq end-add (point))))
                  (smerge-refine-regions beg-del beg-add beg-add end-add
-                                      nil 'diff-refine-preproc props-r 
props-a)))))
+                                        nil #'diff-refine-preproc props-r 
props-a)))))
           (`context
            (let* ((middle (save-excursion (re-search-forward "^---")))
                   (other middle))
@@ -2060,7 +2060,7 @@ Return new point, if it was moved."
                                       (match-beginning 0))
                                     other
                                     (if diff-use-changed-face props-c)
-                                    'diff-refine-preproc
+                                    #'diff-refine-preproc
                                     (unless diff-use-changed-face props-r)
                                     (unless diff-use-changed-face props-a)))))
           (_ ;; Normal diffs.
@@ -2069,7 +2069,7 @@ Return new point, if it was moved."
                ;; It's a combined add&remove, so there's something to do.
                (smerge-refine-regions beg1 (match-beginning 0)
                                     (match-end 0) end
-                                    nil 'diff-refine-preproc props-r 
props-a)))))))))
+                                    nil #'diff-refine-preproc props-r 
props-a)))))))))
 
 (defun diff-undo (&optional arg)
   "Perform `undo', ignoring the buffer's read-only status."
@@ -2175,6 +2175,54 @@ fixed, visit it in a buffer."
                              modified-buffers ", "))
        (message "No trailing whitespace to delete.")))))
 
+;;; Support for converting a diff to diff3 markers via `wiggle'.
+
+;; Wiggle can be found at http://neil.brown.name/wiggle/ or in your nearest
+;; Debian repository.
+
+(defun diff-wiggle ()
+  "Use `wiggle' to apply the whole current file diff by hook or by crook.
+When a hunk can't cleanly be applied, it gets turned into a diff3-style
+conflict."
+  (interactive)
+  (let* ((bounds (diff-bounds-of-file))
+         (file (diff-find-file-name))
+         (tmpbuf (current-buffer))
+         (filebuf (find-buffer-visiting file))
+         (patchfile (make-temp-file
+                     (expand-file-name "wiggle" (file-name-directory file))
+                     nil ".diff"))
+         (errfile (make-temp-file
+                     (expand-file-name "wiggle" (file-name-directory file))
+                     nil ".error")))
+    (unwind-protect
+        (with-temp-buffer
+          (set-buffer (prog1 tmpbuf (setq tmpbuf (current-buffer))))
+          (when (buffer-modified-p filebuf)
+            (save-some-buffers nil (lambda () (eq (current-buffer) filebuf)))
+            (if (buffer-modified-p filebuf) (error "Abort!")))
+          (write-region (car bounds) (cadr bounds) patchfile nil 'silent)
+          (let ((exitcode
+                 (call-process "wiggle" nil (list tmpbuf errfile) nil
+                               file patchfile)))
+            (if (not (memq exitcode '(0 1)))
+                (message "diff-wiggle error: %s"
+                         (with-current-buffer tmpbuf
+                           (goto-char (point-min))
+                           (insert-file-contents errfile)
+                           (buffer-string)))
+              (with-current-buffer tmpbuf
+                (write-region nil nil file nil 'silent)
+                (with-current-buffer filebuf
+                  (revert-buffer t t t)
+                  (save-excursion
+                    (goto-char (point-min))
+                    (if (re-search-forward "^<<<<<<<" nil t)
+                        (smerge-mode 1)))
+                  (pop-to-buffer filebuf))))))
+      (delete-file patchfile)
+      (delete-file errfile))))
+
 ;; provide the package
 (provide 'diff-mode)
 
diff --git a/lisp/vc/vc-git.el b/lisp/vc/vc-git.el
index 47172dd..26af998 100644
--- a/lisp/vc/vc-git.el
+++ b/lisp/vc/vc-git.el
@@ -227,7 +227,7 @@ Should be consistent with the Git config value 
i18n.logOutputEncoding."
                         (concat name "\0"))))))))
 
 (defun vc-git--state-code (code)
-  "Convert from a string to a added/deleted/modified state."
+  "Convert from a string to an added/deleted/modified state."
   (pcase (string-to-char code)
     (?M 'edited)
     (?A 'added)
@@ -243,8 +243,11 @@ Should be consistent with the Git config value 
i18n.logOutputEncoding."
              (vc-git--run-command-string nil "version")))
         (setq vc-git--program-version
               (if (and version-string
-                       (string-match "git version \\([0-9.]+\\)$"
-                                     version-string))
+                       ;; Git for Windows appends ".windows.N" to the
+                       ;; numerical version reported by Git.
+                       (string-match
+                        "git version \\([0-9.]+\\)\\(\.windows.[0-9]+\\)?$"
+                        version-string))
                   (match-string 1 version-string)
                 "0")))))
 
diff --git a/lisp/vc/vc.el b/lisp/vc/vc.el
index 21f56c9..01dc47e 100644
--- a/lisp/vc/vc.el
+++ b/lisp/vc/vc.el
@@ -996,7 +996,7 @@ Within directories, only files already under version 
control are noticed."
        ((derived-mode-p 'diff-mode)     diff-vc-backend)
         ;; Maybe we could even use comint-mode rather than shell-mode?
        ((derived-mode-p 'dired-mode 'shell-mode 'compilation-mode)
-        (vc-responsible-backend default-directory))
+        (ignore-errors (vc-responsible-backend default-directory)))
        (vc-mode (vc-backend buffer-file-name))))
 
 (declare-function vc-dir-current-file "vc-dir" ())
@@ -2415,7 +2415,10 @@ When called interactively with a prefix argument, prompt 
for REMOTE-LOCATION."
 
 ;;;###autoload
 (defun vc-region-history (from to)
-  "Show the history of the region FROM..TO."
+  "Show the history of the region between FROM and TO.
+
+If called interactively, show the history between point and
+mark."
   (interactive "r")
   (let* ((lfrom (line-number-at-pos from t))
          (lto   (line-number-at-pos (1- to) t))
diff --git a/lisp/wid-edit.el b/lisp/wid-edit.el
index 8828236..bee7f80 100644
--- a/lisp/wid-edit.el
+++ b/lisp/wid-edit.el
@@ -1229,7 +1229,7 @@ When not inside a field, signal an error."
                               (save-restriction
                                 ;; `widget-narrow-to-field' can be
                                 ;; active when this function is called
-                                ;; from an change-functions hook. So
+                                ;; from a change-functions hook. So
                                 ;; temporarily remove field narrowing
                                 ;; before to call `get-char-property'.
                                 (widen)
@@ -1802,7 +1802,7 @@ If END is omitted, it defaults to the length of LIST."
 ;;; The `url-link' Widget.
 
 (define-widget 'url-link 'link
-  "A link to an www page."
+  "A link to a web page."
   :action 'widget-url-link-action)
 
 (defun widget-url-link-action (widget &optional _event)
diff --git a/src/.gdbinit b/src/.gdbinit
index 9fdcaf8..eb4d57a 100644
--- a/src/.gdbinit
+++ b/src/.gdbinit
@@ -564,7 +564,7 @@ define pgi
 end
 document pgi
 Pretty print glyph structure glyph[I].
-Takes one argument, a integer I.
+Takes one argument, an integer I.
 end
 
 define pgn
diff --git a/src/Makefile.in b/src/Makefile.in
index 4a0f5d5..e2950a0 100644
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -232,7 +232,8 @@ LIBXML2_CFLAGS = @LIBXML2_CFLAGS@
 
 GETADDRINFO_A_LIBS = @GETADDRINFO_A_LIBS@
 
-LIBLCMS2 = @LIBLCMS2@
+LCMS2_LIBS = @LCMS2_LIBS@
+LCMS2_CFLAGS = @LCMS2_CFLAGS@
 
 LIBZ = @LIBZ@
 
@@ -370,7 +371,7 @@ EMACS_CFLAGS=-Demacs $(MYCPPFLAGS) -I. -I$(srcdir) \
   $(GNUSTEP_CFLAGS) $(CFLAGS_SOUND) $(RSVG_CFLAGS) $(IMAGEMAGICK_CFLAGS) \
   $(PNG_CFLAGS) $(LIBXML2_CFLAGS) $(DBUS_CFLAGS) \
   $(XRANDR_CFLAGS) $(XINERAMA_CFLAGS) $(XFIXES_CFLAGS) $(XDBE_CFLAGS) \
-  $(WEBKIT_CFLAGS) \
+  $(WEBKIT_CFLAGS) $(LCMS2_CFLAGS) \
   $(SETTINGS_CFLAGS) $(FREETYPE_CFLAGS) $(FONTCONFIG_CFLAGS) \
   $(LIBOTF_CFLAGS) $(M17N_FLT_CFLAGS) $(DEPFLAGS) \
   $(LIBSYSTEMD_CFLAGS) $(JSON_CFLAGS) \
@@ -508,7 +509,7 @@ LIBES = $(LIBS) $(W32_LIBS) $(LIBS_GNUSTEP) $(LIBX_BASE) 
$(LIBIMAGE) \
    $(LIBXML2_LIBS) $(LIBGPM) $(LIBS_SYSTEM) $(CAIRO_LIBS) \
    $(LIBS_TERMCAP) $(GETLOADAVG_LIBS) $(SETTINGS_LIBS) $(LIBSELINUX_LIBS) \
    $(FREETYPE_LIBS) $(FONTCONFIG_LIBS) $(LIBOTF_LIBS) $(M17N_FLT_LIBS) \
-   $(LIBGNUTLS_LIBS) $(LIB_PTHREAD) $(GETADDRINFO_A_LIBS) $(LIBLCMS2) \
+   $(LIBGNUTLS_LIBS) $(LIB_PTHREAD) $(GETADDRINFO_A_LIBS) $(LCMS2_LIBS) \
    $(NOTIFY_LIBS) $(LIB_MATH) $(LIBZ) $(LIBMODULES) $(LIBSYSTEMD_LIBS) \
    $(JSON_LIBS)
 
diff --git a/src/bidi.c b/src/bidi.c
index 1f05a1f..9bc8dbe 100644
--- a/src/bidi.c
+++ b/src/bidi.c
@@ -1,6 +1,8 @@
 /* Low-level bidirectional buffer/string-scanning functions for GNU Emacs.
-   Copyright (C) 2000-2001, 2004-2005, 2009-2018 Free Software
-   Foundation, Inc.
+
+Copyright (C) 2000-2001, 2004-2005, 2009-2018 Free Software Foundation, Inc.
+
+Author: Eli Zaretskii <address@hidden>
 
 This file is part of GNU Emacs.
 
@@ -17,9 +19,7 @@ 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 <https://www.gnu.org/licenses/>.  */
 
-/* Written by Eli Zaretskii <address@hidden>.
-
-   A sequential implementation of the Unicode Bidirectional algorithm,
+/* A sequential implementation of the Unicode Bidirectional algorithm,
    (UBA) as per UAX#9, a part of the Unicode Standard.
 
    Unlike the Reference Implementation and most other implementations,
diff --git a/src/character.c b/src/character.c
index 4a934c7..6a68980 100644
--- a/src/character.c
+++ b/src/character.c
@@ -983,7 +983,7 @@ alphabeticp (int c)
          || gen_cat == UNICODE_CATEGORY_Nl);
 }
 
-/* Return true if C is a alphabetic or decimal-number character.  */
+/* Return true if C is an alphabetic or decimal-number character.  */
 bool
 alphanumericp (int c)
 {
diff --git a/src/character.h b/src/character.h
index d9e2d7b..1e420ba 100644
--- a/src/character.h
+++ b/src/character.h
@@ -695,7 +695,7 @@ INLINE int
 char_table_translate (Lisp_Object obj, int ch)
 {
   /* This internal function is expected to be called with valid arguments,
-     so there is a eassert instead of CHECK_xxx for the sake of speed.  */
+     so there is an eassert instead of CHECK_xxx for the sake of speed.  */
   eassert (CHAR_VALID_P (ch));
   eassert (CHAR_TABLE_P (obj));
   obj = CHAR_TABLE_REF (obj, ch);
diff --git a/src/charset.c b/src/charset.c
index e7dd302..98529bb 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -2345,7 +2345,7 @@ init_charset_once (void)
    Don't make the value so small that the table is reallocated during
    bootstrapping, as glibc malloc calls larger than just under 64 KiB
    during an initial bootstrap wreak havoc after dumping; see the
-   M_MMAP_THRESHOLD value in alloc.c, plus there is a extra overhead
+   M_MMAP_THRESHOLD value in alloc.c, plus there is an extra overhead
    internal to glibc malloc and perhaps to Emacs malloc debugging.  */
 static struct charset charset_table_init[180];
 
diff --git a/src/coding.c b/src/coding.c
index 24163b7..22a04b3 100644
--- a/src/coding.c
+++ b/src/coding.c
@@ -252,7 +252,7 @@ decode_coding_XXXX (struct coding_system *coding)
   CODING_RESULT_XXX indicating how the encoding finished.
 
   DST_BYTES zero means that source area and destination area are
-  overlapped, which means that we can produce a encoded text until it
+  overlapped, which means that we can produce an encoded text until it
   reaches at the head of not-yet-encoded source text.
 
   Below is a template of these functions.  */
@@ -3974,7 +3974,7 @@ decode_coding_iso_2022 (struct coding_system *coding)
       /* Reset the invocation and designation status to the safest
         one; i.e. designate ASCII to the graphic register 0, and
         invoke that register to the graphic plane 0.  This typically
-        helps the case that an designation sequence for ASCII "ESC (
+        helps the case that a designation sequence for ASCII "ESC (
         B" is somehow broken (e.g. broken by a newline).  */
       CODING_ISO_INVOCATION (coding, 0) = 0;
       CODING_ISO_DESIGNATION (coding, 0) = charset_ascii;
diff --git a/src/dbusbind.c b/src/dbusbind.c
index 01cbc3a..8cf2ef9 100644
--- a/src/dbusbind.c
+++ b/src/dbusbind.c
@@ -1401,7 +1401,7 @@ usage: (dbus-message-internal &rest REST)  */)
 
       if ((mtype == DBUS_MESSAGE_TYPE_ERROR)
          && (!dbus_message_set_error_name (dmessage, DBUS_ERROR_FAILED)))
-       XD_SIGNAL1 (build_string ("Unable to create a error message"));
+       XD_SIGNAL1 (build_string ("Unable to create an error message"));
     }
 
   /* Check for timeout parameter.  */
diff --git a/src/doc.c b/src/doc.c
index 91cfd99..233130d 100644
--- a/src/doc.c
+++ b/src/doc.c
@@ -532,7 +532,6 @@ the same file name is found in the `doc-directory'.  */)
   EMACS_INT pos;
   Lisp_Object sym;
   char *p, *name;
-  bool skip_file = 0;
   ptrdiff_t count;
   char const *dirname;
   ptrdiff_t dirlen;
@@ -601,34 +600,24 @@ the same file name is found in the `doc-directory'.  */)
        {
          end = strchr (p, '\n');
 
-          /* See if this is a file name, and if it is a file in build-files.  
*/
-          if (p[1] == 'S')
-            {
-              skip_file = 0;
-              if (end - p > 4 && end[-2] == '.'
-                  && (end[-1] == 'o' || end[-1] == 'c'))
-                {
-                  ptrdiff_t len = end - p - 2;
-                  char *fromfile = SAFE_ALLOCA (len + 1);
-                  memcpy (fromfile, &p[2], len);
-                  fromfile[len] = 0;
-                  if (fromfile[len-1] == 'c')
-                    fromfile[len-1] = 'o';
-
-                  skip_file = NILP (Fmember (build_string (fromfile),
-                                             Vbuild_files));
-                }
-            }
+         /* We used to skip files not in build_files, so that when a
+            function was defined several times in different files
+            (typically, once in xterm, once in w32term, ...), we only
+            paid attention to the relevant one.
+
+            But this meant the doc had to be kept and updated in
+            multiple files.  Nowadays we keep the doc only in eg xterm.
+            The (f)boundp checks below ensure we don't report
+            docs for eg w32-specific items on X.
+         */
 
          sym = oblookup (Vobarray, p + 2,
                          multibyte_chars_in_text ((unsigned char *) p + 2,
                                                   end - p - 2),
                          end - p - 2);
-         /* Check skip_file so that when a function is defined several
-            times in different files (typically, once in xterm, once in
-            w32term, ...), we only pay attention to the one that
-            matters.  */
-         if (! skip_file && SYMBOLP (sym))
+          /* Ignore docs that start with SKIP.  These mark
+             placeholders where the real doc is elsewhere.  */
+         if (SYMBOLP (sym))
            {
              /* Attach a docstring to a variable?  */
              if (p[1] == 'V')
@@ -636,8 +625,9 @@ the same file name is found in the `doc-directory'.  */)
                  /* Install file-position as variable-documentation property
                     and make it negative for a user-variable
                     (doc starts with a `*').  */
-                  if (!NILP (Fboundp (sym))
+                  if ((!NILP (Fboundp (sym))
                       || !NILP (Fmemq (sym, delayed_init)))
+                      && strncmp (end, "\nSKIP", 5))
                     Fput (sym, Qvariable_documentation,
                           make_number ((pos + end + 1 - buf)
                                        * (end[1] == '*' ? -1 : 1)));
@@ -646,7 +636,7 @@ the same file name is found in the `doc-directory'.  */)
              /* Attach a docstring to a function?  */
              else if (p[1] == 'F')
                 {
-                  if (!NILP (Ffboundp (sym)))
+                  if (!NILP (Ffboundp (sym)) && strncmp (end, "\nSKIP", 5))
                     store_function_docstring (sym, pos + end + 1 - buf);
                 }
              else if (p[1] == 'S')
diff --git a/src/dosfns.c b/src/dosfns.c
index c6d4d5b..f9845a3 100644
--- a/src/dosfns.c
+++ b/src/dosfns.c
@@ -480,11 +480,7 @@ x_set_title (struct frame *f, Lisp_Object name)
 #endif /* !HAVE_X_WINDOWS */
 
 DEFUN ("file-system-info", Ffile_system_info, Sfile_system_info, 1, 1, 0,
-       doc: /* Return storage information about the file system FILENAME is on.
-Value is a list of floats (TOTAL FREE AVAIL), where TOTAL is the total
-storage of the file system, FREE is the free storage, and AVAIL is the
-storage available to a non-superuser.  All 3 numbers are in bytes.
-If the underlying system call fails, value is nil.  */)
+       doc: /* SKIP: real doc in fileio.c.  */)
   (Lisp_Object filename)
 {
   struct statfs stfs;
diff --git a/src/eval.c b/src/eval.c
index 4700e87..9aeafa2 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -1608,7 +1608,10 @@ signal_or_quit (Lisp_Object error_symbol, Lisp_Object 
data, bool keyboard_quit)
 
   /* This hook is used by edebug.  */
   if (! NILP (Vsignal_hook_function)
-      && ! NILP (error_symbol))
+      && ! NILP (error_symbol)
+      /* Don't try to call a lisp function if we've already overflowed
+         the specpdl stack.  */
+      && specpdl_ptr < specpdl + specpdl_size)
     {
       /* Edebug takes care of restoring these variables when it exits.  */
       if (lisp_eval_depth + 20 > max_lisp_eval_depth)
diff --git a/src/frame.c b/src/frame.c
index 3c2a6d8..2393980 100644
--- a/src/frame.c
+++ b/src/frame.c
@@ -318,7 +318,7 @@ predicates which report frame's specific UI-related 
capabilities.  */)
 /* Placeholder used by temacs -nw before window.el is loaded.  */
 DEFUN ("frame-windows-min-size", Fframe_windows_min_size,
        Sframe_windows_min_size, 4, 4, 0,
-       doc: /* */
+       doc: /* SKIP: real doc in window.el.  */
        attributes: const)
      (Lisp_Object frame, Lisp_Object horizontal,
       Lisp_Object ignore, Lisp_Object pixelwise)
@@ -343,7 +343,9 @@ DEFUN ("frame-windows-min-size", Fframe_windows_min_size,
  * of `window-min-height' (`window-min-width' if HORIZONTAL is non-nil).
  * With IGNORE non-nil the values of these variables are ignored.
  *
- * In either case, never return a value less than 1.
+ * In either case, never return a value less than 1.  For TTY frames,
+ * additionally limit the minimum frame height to a value large enough
+ * to support the menu bar, the mode line, and the echo area.
  */
 static int
 frame_windows_min_size (Lisp_Object frame, Lisp_Object horizontal,
@@ -351,6 +353,7 @@ frame_windows_min_size (Lisp_Object frame, Lisp_Object 
horizontal,
 {
   struct frame *f = XFRAME (frame);
   Lisp_Object par_size;
+  int retval;
 
   if ((!NILP (horizontal)
        && NUMBERP (par_size = get_frame_param (f, Qmin_width)))
@@ -363,15 +366,27 @@ frame_windows_min_size (Lisp_Object frame, Lisp_Object 
horizontal,
       if (min_size < 1)
        min_size = 1;
 
-      return (NILP (pixelwise)
-             ? min_size
-             : min_size * (NILP (horizontal)
-                           ? FRAME_LINE_HEIGHT (f)
-                           : FRAME_COLUMN_WIDTH (f)));
+      retval = (NILP (pixelwise)
+               ? min_size
+               : min_size * (NILP (horizontal)
+                             ? FRAME_LINE_HEIGHT (f)
+                             : FRAME_COLUMN_WIDTH (f)));
     }
   else
-    return XINT (call4 (Qframe_windows_min_size, frame, horizontal,
-                     ignore, pixelwise));
+    retval = XINT (call4 (Qframe_windows_min_size, frame, horizontal,
+                         ignore, pixelwise));
+  /* Don't allow too small height of text-mode frames, or else cm.c
+     might abort in cmcheckmagic.  */
+  if ((FRAME_TERMCAP_P (f) || FRAME_MSDOS_P (f)) && NILP (horizontal))
+    {
+      int min_height = (FRAME_MENU_BAR_LINES (f)
+                       + FRAME_WANTS_MODELINE_P (f)
+                       + 2);   /* one text line and one echo-area line */
+      if (retval < min_height)
+       retval = min_height;
+    }
+
+  return retval;
 }
 
 
diff --git a/src/image.c b/src/image.c
index afc4ff9..b83b535 100644
--- a/src/image.c
+++ b/src/image.c
@@ -8282,7 +8282,7 @@ extern WandExport void PixelGetMagickColor (const 
PixelWand *,
 #endif
 
 /* Log ImageMagick error message.
-   Useful when a ImageMagick function returns the status `MagickFalse'.  */
+   Useful when an ImageMagick function returns the status `MagickFalse'.  */
 
 static void
 imagemagick_error (MagickWand *wand)
diff --git a/src/inotify.c b/src/inotify.c
index 08da308..e06cc97 100644
--- a/src/inotify.c
+++ b/src/inotify.c
@@ -503,7 +503,7 @@ DEFUN ("inotify-watch-list", Finotify_watch_list, 
Sinotify_watch_list, 0, 0, 0,
 }
 
 DEFUN ("inotify-allocated-p", Finotify_allocated_p, Sinotify_allocated_p, 0, 
0, 0,
-       doc: /* Return non-nil, if a inotify instance is allocated.  */)
+       doc: /* Return non-nil, if an inotify instance is allocated.  */)
 {
   return inotifyfd < 0 ? Qnil : Qt;
 }
diff --git a/src/keymap.c b/src/keymap.c
index 80a899b..c8cc933 100644
--- a/src/keymap.c
+++ b/src/keymap.c
@@ -1278,7 +1278,7 @@ append_key (Lisp_Object key_sequence, Lisp_Object key)
   return CALLN (Fvconcat, key_sequence, key_list);
 }
 
-/* Given a event type C which is a symbol,
+/* Given an event type C which is a symbol,
    signal an error if is a mistake such as RET or M-RET or C-DEL, etc.  */
 
 static void
diff --git a/src/lread.c b/src/lread.c
index f3df379..3d9a2e3 100644
--- a/src/lread.c
+++ b/src/lread.c
@@ -4899,7 +4899,7 @@ directory.  These file names are converted to absolute at 
startup.  */);
 If the file loaded had extension `.elc', and the corresponding source file
 exists, this variable contains the name of source file, suitable for use
 by functions like `custom-save-all' which edit the init file.
-While Emacs loads and evaluates the init file, value is the real name
+While Emacs loads and evaluates any init file, value is the real name
 of the file, regardless of whether or not it has the `.elc' extension.  */);
   Vuser_init_file = Qnil;
 
diff --git a/src/nsfns.m b/src/nsfns.m
index c2ee4df..7d62c58 100644
--- a/src/nsfns.m
+++ b/src/nsfns.m
@@ -997,15 +997,7 @@ get_geometry_from_preferences (struct ns_display_info 
*dpyinfo,
 
 DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
        1, 1, 0,
-       doc: /* Make a new Nextstep window, called a "frame" in Emacs terms.
-Return an Emacs frame object.
-PARMS is an alist of frame parameters.
-If the parameters specify that the frame should not have a minibuffer,
-and do not specify a specific minibuffer window to use,
-then `default-minibuffer-frame' must be a frame whose minibuffer can
-be shared by the new frame.
-
-This function is an internal primitive--use `make-frame' instead.  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
      (Lisp_Object parms)
 {
   struct frame *f;
@@ -1701,7 +1693,7 @@ If VALUE is nil, the default is removed.  */)
 DEFUN ("x-server-max-request-size", Fx_server_max_request_size,
        Sx_server_max_request_size,
        0, 1, 0,
-       doc: /* This function is a no-op.  It is only present for completeness. 
 */)
+       doc: /* SKIP: real doc in xfns.c.  */)
      (Lisp_Object terminal)
 {
   check_ns_display_info (terminal);
@@ -1712,12 +1704,7 @@ DEFUN ("x-server-max-request-size", 
Fx_server_max_request_size,
 
 
 DEFUN ("x-server-vendor", Fx_server_vendor, Sx_server_vendor, 0, 1, 0,
-       doc: /* Return the "vendor ID" string of Nextstep display server 
TERMINAL.
-\(Labeling every distributor as a "vendor" embodies the false assumption
-that operating systems cannot be developed and distributed noncommercially.)
-The optional argument TERMINAL specifies which display to ask about.
-TERMINAL should be a terminal object, a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display.  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
   (Lisp_Object terminal)
 {
   check_ns_display_info (terminal);
@@ -1730,14 +1717,7 @@ If omitted or nil, that stands for the selected frame's 
display.  */)
 
 
 DEFUN ("x-server-version", Fx_server_version, Sx_server_version, 0, 1, 0,
-       doc: /* Return the version numbers of the server of display TERMINAL.
-The value is a list of three integers: the major and minor
-version numbers of the X Protocol in use, and the distributor-specific release
-number.  See also the function `x-server-vendor'.
-
-The optional argument TERMINAL specifies which display to ask about.
-TERMINAL should be a terminal object, a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display.  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
   (Lisp_Object terminal)
 {
   check_ns_display_info (terminal);
@@ -1752,14 +1732,7 @@ If omitted or nil, that stands for the selected frame's 
display.  */)
 
 
 DEFUN ("x-display-screens", Fx_display_screens, Sx_display_screens, 0, 1, 0,
-       doc: /* Return the number of screens on Nextstep display server 
TERMINAL.
-The optional argument TERMINAL specifies which display to ask about.
-TERMINAL should be a terminal object, a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display.
-
-Note: "screen" here is not in Nextstep terminology but in X11's.  For
-the number of physical monitors, use `(length
-\(display-monitor-attributes-list TERMINAL))' instead.  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
   (Lisp_Object terminal)
 {
   check_ns_display_info (terminal);
@@ -1768,14 +1741,7 @@ the number of physical monitors, use `(length
 
 
 DEFUN ("x-display-mm-height", Fx_display_mm_height, Sx_display_mm_height, 0, 
1, 0,
-       doc: /* Return the height in millimeters of the Nextstep display 
TERMINAL.
-The optional argument TERMINAL specifies which display to ask about.
-TERMINAL should be a terminal object, a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display.
-
-On \"multi-monitor\" setups this refers to the height in millimeters for
-all physical monitors associated with TERMINAL.  To get information
-for each physical monitor, use `display-monitor-attributes-list'.  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
   (Lisp_Object terminal)
 {
   struct ns_display_info *dpyinfo = check_ns_display_info (terminal);
@@ -1785,14 +1751,7 @@ for each physical monitor, use 
`display-monitor-attributes-list'.  */)
 
 
 DEFUN ("x-display-mm-width", Fx_display_mm_width, Sx_display_mm_width, 0, 1, 0,
-       doc: /* Return the width in millimeters of the Nextstep display 
TERMINAL.
-The optional argument TERMINAL specifies which display to ask about.
-TERMINAL should be a terminal object, a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display.
-
-On \"multi-monitor\" setups this refers to the width in millimeters for
-all physical monitors associated with TERMINAL.  To get information
-for each physical monitor, use `display-monitor-attributes-list'.  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
   (Lisp_Object terminal)
 {
   struct ns_display_info *dpyinfo = check_ns_display_info (terminal);
@@ -1803,14 +1762,11 @@ for each physical monitor, use 
`display-monitor-attributes-list'.  */)
 
 DEFUN ("x-display-backing-store", Fx_display_backing_store,
        Sx_display_backing_store, 0, 1, 0,
-       doc: /* Return an indication of whether the Nextstep display TERMINAL 
does backing store.
-The value may be `buffered', `retained', or `non-retained'.
-The optional argument TERMINAL specifies which display to ask about.
-TERMINAL should be a terminal object, a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display.  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
   (Lisp_Object terminal)
 {
   check_ns_display_info (terminal);
+  /* Note that the xfns.c version has different return values.  */
   switch ([ns_get_window (terminal) backingType])
     {
     case NSBackingStoreBuffered:
@@ -1830,13 +1786,7 @@ If omitted or nil, that stands for the selected frame's 
display.  */)
 
 DEFUN ("x-display-visual-class", Fx_display_visual_class,
        Sx_display_visual_class, 0, 1, 0,
-       doc: /* Return the visual class of the Nextstep display TERMINAL.
-The value is one of the symbols `static-gray', `gray-scale',
-`static-color', `pseudo-color', `true-color', or `direct-color'.
-
-The optional argument TERMINAL specifies which display to ask about.
-TERMINAL should a terminal object, a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display.  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
   (Lisp_Object terminal)
 {
   NSWindowDepth depth;
@@ -1862,10 +1812,7 @@ If omitted or nil, that stands for the selected frame's 
display.  */)
 
 DEFUN ("x-display-save-under", Fx_display_save_under,
        Sx_display_save_under, 0, 1, 0,
-       doc: /* Return t if TERMINAL supports the save-under feature.
-The optional argument TERMINAL specifies which display to ask about.
-TERMINAL should be a terminal object, a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display.  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
   (Lisp_Object terminal)
 {
   check_ns_display_info (terminal);
@@ -1889,12 +1836,7 @@ If omitted or nil, that stands for the selected frame's 
display.  */)
 
 DEFUN ("x-open-connection", Fx_open_connection, Sx_open_connection,
        1, 3, 0,
-       doc: /* Open a connection to a display server.
-DISPLAY is the name of the display to connect to.
-Optional second arg XRM-STRING is a string of resources in xrdb format.
-If the optional third arg MUST-SUCCEED is non-nil,
-terminate Emacs if we can't open the connection.
-\(In the Nextstep version, the last two arguments are currently ignored.)  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
      (Lisp_Object display, Lisp_Object resource_string, Lisp_Object 
must_succeed)
 {
   struct ns_display_info *dpyinfo;
@@ -1919,10 +1861,7 @@ terminate Emacs if we can't open the connection.
 
 DEFUN ("x-close-connection", Fx_close_connection, Sx_close_connection,
        1, 1, 0,
-       doc: /* Close the connection to TERMINAL's Nextstep display server.
-For TERMINAL, specify a terminal object, a frame or a display name (a
-string).  If TERMINAL is nil, that stands for the selected frame's
-terminal.  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
      (Lisp_Object terminal)
 {
   check_ns_display_info (terminal);
@@ -1932,7 +1871,7 @@ terminal.  */)
 
 
 DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0,
-       doc: /* Return the list of display names that Emacs has connections to. 
 */)
+       doc: /* SKIP: real doc in xfns.c.  */)
      (void)
 {
   Lisp_Object result = Qnil;
@@ -2305,8 +2244,7 @@ x_get_focus_frame (struct frame *frame)
 
 
 DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0,
-       doc: /* Internal function called by `color-defined-p', which see.
-\(Note that the Nextstep version of this function ignores FRAME.)  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
      (Lisp_Object color, Lisp_Object frame)
 {
   NSColor * col;
@@ -2316,7 +2254,7 @@ DEFUN ("xw-color-defined-p", Fxw_color_defined_p, 
Sxw_color_defined_p, 1, 2, 0,
 
 
 DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0,
-       doc: /* Internal function called by `color-values', which see.  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
      (Lisp_Object color, Lisp_Object frame)
 {
   NSColor * col;
@@ -2341,7 +2279,7 @@ DEFUN ("xw-color-values", Fxw_color_values, 
Sxw_color_values, 1, 2, 0,
 
 
 DEFUN ("xw-display-color-p", Fxw_display_color_p, Sxw_display_color_p, 0, 1, 0,
-       doc: /* Internal function called by `display-color-p', which see.  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
      (Lisp_Object terminal)
 {
   NSWindowDepth depth;
@@ -2359,11 +2297,7 @@ DEFUN ("xw-display-color-p", Fxw_display_color_p, 
Sxw_display_color_p, 0, 1, 0,
 
 DEFUN ("x-display-grayscale-p", Fx_display_grayscale_p, Sx_display_grayscale_p,
        0, 1, 0,
-       doc: /* Return t if the Nextstep display supports shades of gray.
-Note that color displays do support shades of gray.
-The optional argument TERMINAL specifies which display to ask about.
-TERMINAL should be a terminal object, a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display.  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
   (Lisp_Object terminal)
 {
   NSWindowDepth depth;
@@ -2377,14 +2311,7 @@ If omitted or nil, that stands for the selected frame's 
display.  */)
 
 DEFUN ("x-display-pixel-width", Fx_display_pixel_width, Sx_display_pixel_width,
        0, 1, 0,
-       doc: /* Return the width in pixels of the Nextstep display TERMINAL.
-The optional argument TERMINAL specifies which display to ask about.
-TERMINAL should be a terminal object, a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display.
-
-On \"multi-monitor\" setups this refers to the pixel width for all
-physical monitors associated with TERMINAL.  To get information for
-each physical monitor, use `display-monitor-attributes-list'.  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
   (Lisp_Object terminal)
 {
   struct ns_display_info *dpyinfo = check_ns_display_info (terminal);
@@ -2395,14 +2322,7 @@ each physical monitor, use 
`display-monitor-attributes-list'.  */)
 
 DEFUN ("x-display-pixel-height", Fx_display_pixel_height,
        Sx_display_pixel_height, 0, 1, 0,
-       doc: /* Return the height in pixels of the Nextstep display TERMINAL.
-The optional argument TERMINAL specifies which display to ask about.
-TERMINAL should be a terminal object, a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display.
-
-On \"multi-monitor\" setups this refers to the pixel height for all
-physical monitors associated with TERMINAL.  To get information for
-each physical monitor, use `display-monitor-attributes-list'.  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
   (Lisp_Object terminal)
 {
   struct ns_display_info *dpyinfo = check_ns_display_info (terminal);
@@ -2647,10 +2567,7 @@ Internal use only, use `display-monitor-attributes-list' 
instead.  */)
 
 DEFUN ("x-display-planes", Fx_display_planes, Sx_display_planes,
        0, 1, 0,
-       doc: /* Return the number of bitplanes of the Nextstep display TERMINAL.
-The optional argument TERMINAL specifies which display to ask about.
-TERMINAL should be a terminal object, a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display.  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
   (Lisp_Object terminal)
 {
   check_ns_display_info (terminal);
@@ -2661,10 +2578,7 @@ If omitted or nil, that stands for the selected frame's 
display.  */)
 
 DEFUN ("x-display-color-cells", Fx_display_color_cells, Sx_display_color_cells,
        0, 1, 0,
-       doc: /* Returns the number of color cells of the Nextstep display 
TERMINAL.
-The optional argument TERMINAL specifies which display to ask about.
-TERMINAL should be a terminal object, a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display.  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
   (Lisp_Object terminal)
 {
   struct ns_display_info *dpyinfo = check_ns_display_info (terminal);
@@ -2752,35 +2666,7 @@ compute_tip_xy (struct frame *f,
 
 
 DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
-       doc: /* Show STRING in a \"tooltip\" window on frame FRAME.
-A tooltip window is a small window displaying a string.
-
-This is an internal function; Lisp code should call `tooltip-show'.
-
-FRAME nil or omitted means use the selected frame.
-
-PARMS is an optional list of frame parameters which can be used to
-change the tooltip's appearance.
-
-Automatically hide the tooltip after TIMEOUT seconds.  TIMEOUT nil
-means use the default timeout of 5 seconds.
-
-If the list of frame parameters PARMS contains a `left' parameter,
-display the tooltip at that x-position.  If the list of frame parameters
-PARMS contains no `left' but a `right' parameter, display the tooltip
-right-adjusted at that x-position. Otherwise display it at the
-x-position of the mouse, with offset DX added (default is 5 if DX isn't
-specified).
-
-Likewise for the y-position: If a `top' frame parameter is specified, it
-determines the position of the upper edge of the tooltip window.  If a
-`bottom' parameter but no `top' frame parameter is specified, it
-determines the position of the lower edge of the tooltip window.
-Otherwise display the tooltip window at the y-position of the mouse,
-with offset DY added (default is -10).
-
-A tooltip's maximum size is specified by `x-max-tooltip-size'.
-Text larger than the specified size is clipped.  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
      (Lisp_Object string, Lisp_Object frame, Lisp_Object parms, Lisp_Object 
timeout, Lisp_Object dx, Lisp_Object dy)
 {
   int root_x, root_y;
@@ -2841,8 +2727,7 @@ Text larger than the specified size is clipped.  */)
 
 
 DEFUN ("x-hide-tip", Fx_hide_tip, Sx_hide_tip, 0, 0, 0,
-       doc: /* Hide the current tooltip window, if there is any.
-Value is t if tooltip was open, nil otherwise.  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
      (void)
 {
   if (ns_tooltip == nil || ![ns_tooltip isActive])
diff --git a/src/nsmenu.m b/src/nsmenu.m
index d67be40..2f919ec 100644
--- a/src/nsmenu.m
+++ b/src/nsmenu.m
@@ -1875,7 +1875,7 @@ DEFUN ("ns-reset-menu", Fns_reset_menu, Sns_reset_menu, 
0, 0, 0,
 
 
 DEFUN ("menu-or-popup-active-p", Fmenu_or_popup_active_p, 
Smenu_or_popup_active_p, 0, 0, 0,
-       doc: /* Return t if a menu or popup dialog is active.  */)
+       doc: /* SKIP: real doc in xmenu.c. */)
      (void)
 {
   return popup_activated () ? Qt : Qnil;
diff --git a/src/nsterm.m b/src/nsterm.m
index 22e554e..08e2fce 100644
--- a/src/nsterm.m
+++ b/src/nsterm.m
@@ -68,6 +68,7 @@ GNUstep port and post-20 update by Adrian Robert 
(address@hidden)
 
 #ifdef NS_IMPL_COCOA
 #include "macfont.h"
+#include <Carbon/Carbon.h>
 #endif
 
 static EmacsMenu *dockMenu;
@@ -2680,7 +2681,78 @@ x_get_keysym_name (int keysym)
   return value;
 }
 
+#ifdef NS_IMPL_COCOA
+static UniChar
+ns_get_shifted_character (NSEvent *event)
+/* Look up the character corresponding to the key pressed on the
+   current keyboard layout and the currently configured shift-like
+   modifiers.  This ignores the control-like modifiers that cause
+   [event characters] to give us the wrong result.
+
+   Although UCKeyTranslate doesn't require the Carbon framework, some
+   of the surrounding paraphernalia does, so this function makes
+   Carbon a requirement.  */
+{
+  static UInt32 dead_key_state;
+
+  /* UCKeyTranslate may return up to 255 characters.  If the buffer
+     isn't large enough then it produces an error.  What kind of
+     keyboard inputs 255 characters in a single keypress?  */
+  UniChar buf[255];
+  UniCharCount max_string_length = 255;
+  UniCharCount actual_string_length = 0;
+  OSStatus result;
+
+  CFDataRef layout_ref = (CFDataRef) TISGetInputSourceProperty
+    (TISCopyCurrentKeyboardLayoutInputSource (), 
kTISPropertyUnicodeKeyLayoutData);
+  UCKeyboardLayout* layout = (UCKeyboardLayout*) CFDataGetBytePtr (layout_ref);
+
+  UInt32 flags = [event modifierFlags];
+  UInt32 modifiers = (flags & NSEventModifierFlagShift) ? shiftKey : 0;
+
+  NSTRACE ("ns_get_shifted_character");
+
+  if ((flags & NSRightAlternateKeyMask) == NSRightAlternateKeyMask
+      && (EQ (ns_right_alternate_modifier, Qnone)
+          || (EQ (ns_right_alternate_modifier, Qleft)
+              && EQ (ns_alternate_modifier, Qnone))))
+    modifiers |= rightOptionKey;
+
+  if ((flags & NSLeftAlternateKeyMask) == NSLeftAlternateKeyMask
+      && EQ (ns_alternate_modifier, Qnone))
+    modifiers |= optionKey;
+
+  if ((flags & NSRightCommandKeyMask) == NSRightCommandKeyMask
+      && (EQ (ns_right_command_modifier, Qnone)
+          || (EQ (ns_right_command_modifier, Qleft)
+              && EQ (ns_command_modifier, Qnone))))
+    /* Carbon doesn't differentiate between left and right command
+       keys.  */
+    modifiers |= cmdKey;
+
+  if ((flags & NSLeftCommandKeyMask) == NSLeftCommandKeyMask
+      && EQ (ns_command_modifier, Qnone))
+    modifiers |= cmdKey;
+
+  result = UCKeyTranslate (layout, [event keyCode], kUCKeyActionDown,
+                           (modifiers >> 8) & 0xFF, LMGetKbdType (),
+                           kUCKeyTranslateNoDeadKeysBit, &dead_key_state,
+                           max_string_length, &actual_string_length, buf);
+
+  if (result != 0)
+    {
+      NSLog(@"Failed to translate character '%@' with modifiers %x",
+            [event characters], modifiers);
+      return 0;
+    }
+
+  /* FIXME: What do we do if more than one code unit is returned?  */
+  if (actual_string_length > 0)
+    return buf[0];
 
+  return 0;
+}
+#endif /* NS_IMPL_COCOA */
 
 /* ==========================================================================
 
@@ -6149,8 +6221,6 @@ not_in_argv (NSString *arg)
       code = ([[theEvent charactersIgnoringModifiers] length] == 0) ?
         0 : [[theEvent charactersIgnoringModifiers] characterAtIndex: 0];
 
-      /* (Carbon way: [theEvent keyCode]) */
-
       /* is it a "function key"? */
       /* Note: Sometimes a plain key will have the 
NSEventModifierFlagNumericPad
          flag set (this is probably a bug in the OS).
@@ -6192,8 +6262,8 @@ not_in_argv (NSString *arg)
          charactersIgnoringModifiers method).  An annoyance happens if
          we have both shift-like and control-like modifiers because
          the NSEvent API doesn’t let us ignore only some modifiers.
-         Therefore we ignore all shift-like modifiers in that
-         case.  */
+         In that case we use UCKeyTranslate (ns_get_shifted_character)
+         to look up the correct character.  */
 
       /* EV_MODIFIERS2 uses parse_solitary_modifier on all known
          modifier keys, which returns 0 for shift-like modifiers.
@@ -6219,7 +6289,6 @@ not_in_argv (NSString *arg)
       if (fnKeysym || (emacs_event->modifiers
                        && (emacs_event->modifiers != shift_modifier)
                        && [[theEvent charactersIgnoringModifiers] length] > 0))
-/*[[theEvent characters] length] */
         {
           emacs_event->kind = NON_ASCII_KEYSTROKE_EVENT;
           /* FIXME: What are the next four lines supposed to do?  */
@@ -6228,12 +6297,21 @@ not_in_argv (NSString *arg)
           else if (code == 0x7f)
             code |= (1<<28)|(3<<16);
           else if (!fnKeysym)
-            /* FIXME: This seems wrong, characters in the range
-               [0x80, 0xFF] are not ASCII characters.  Can’t we just
-               use MULTIBYTE_CHAR_KEYSTROKE_EVENT here for all kinds
-               of characters?  */
-            emacs_event->kind = code > 0xFF
-              ? MULTIBYTE_CHAR_KEYSTROKE_EVENT : ASCII_KEYSTROKE_EVENT;
+            {
+#ifdef NS_IMPL_COCOA
+              /* We potentially have both shift- and control-like
+                 modifiers in use, so find the correct character
+                 ignoring any control-like ones.  */
+              code = ns_get_shifted_character (theEvent);
+#endif
+
+              /* FIXME: This seems wrong, characters in the range
+                 [0x80, 0xFF] are not ASCII characters.  Can’t we just
+                 use MULTIBYTE_CHAR_KEYSTROKE_EVENT here for all kinds
+                 of characters?  */
+              emacs_event->kind = code > 0xFF
+                ? MULTIBYTE_CHAR_KEYSTROKE_EVENT : ASCII_KEYSTROKE_EVENT;
+            }
 
           emacs_event->code = code;
           EV_TRAILER (theEvent);
@@ -9382,27 +9460,17 @@ This variable is ignored on macOS < 10.7 and GNUstep.  
Default is t.  */);
 
   /* TODO: move to common code */
   DEFVAR_LISP ("x-toolkit-scroll-bars", Vx_toolkit_scroll_bars,
-              doc: /* Which toolkit scroll bars Emacs uses, if any.
-A value of nil means Emacs doesn't use toolkit scroll bars.
-With the X Window system, the value is a symbol describing the
-X toolkit.  Possible values are: gtk, motif, xaw, or xaw3d.
-With MS Windows or Nextstep, the value is t.  */);
+              doc: /* SKIP: real doc in xterm.c.  */);
   Vx_toolkit_scroll_bars = Qt;
 
   DEFVAR_BOOL ("x-use-underline-position-properties",
               x_use_underline_position_properties,
-     doc: /*Non-nil means make use of UNDERLINE_POSITION font properties.
-A value of nil means ignore them.  If you encounter fonts with bogus
-UNDERLINE_POSITION font properties, for example 7x13 on XFree prior
-to 4.1, set this to nil. */);
+     doc: /* SKIP: real doc in xterm.c.  */);
   x_use_underline_position_properties = 0;
 
   DEFVAR_BOOL ("x-underline-at-descent-line",
               x_underline_at_descent_line,
-     doc: /* Non-nil means to draw the underline at the same place as the 
descent line.
-A value of nil means to draw the underline according to the value of the
-variable `x-use-underline-position-properties', which is usually at the
-baseline level.  The default value is nil.  */);
+     doc: /* SKIP: real doc in xterm.c.  */);
   x_underline_at_descent_line = 0;
 
   /* Tell Emacs about this window system.  */
diff --git a/src/process.c b/src/process.c
index ed8aaf4..adf6b36 100644
--- a/src/process.c
+++ b/src/process.c
@@ -160,6 +160,18 @@ static bool kbd_is_on_hold;
    when exiting.  */
 bool inhibit_sentinels;
 
+union u_sockaddr
+{
+  struct sockaddr sa;
+  struct sockaddr_in in;
+#ifdef AF_INET6
+  struct sockaddr_in6 in6;
+#endif
+#ifdef HAVE_LOCAL_SOCKETS
+  struct sockaddr_un un;
+#endif
+};
+
 #ifdef subprocesses
 
 #ifndef SOCK_CLOEXEC
@@ -3721,7 +3733,7 @@ setting of the remote datagram address.  When specified 
for a client
 process, the FAMILY, HOST, and SERVICE args are ignored.
 
 The format of ADDRESS depends on the address family:
-- An IPv4 address is represented as an vector of integers [A B C D P]
+- An IPv4 address is represented as a vector of integers [A B C D P]
 corresponding to numeric IP address A.B.C.D and port number P.
 - A local address is represented as a string with the address in the
 local address space.
@@ -4673,16 +4685,7 @@ server_accept_connection (Lisp_Object server, int 
channel)
   struct Lisp_Process *ps = XPROCESS (server);
   struct Lisp_Process *p;
   int s;
-  union u_sockaddr {
-    struct sockaddr sa;
-    struct sockaddr_in in;
-#ifdef AF_INET6
-    struct sockaddr_in6 in6;
-#endif
-#ifdef HAVE_LOCAL_SOCKETS
-    struct sockaddr_un un;
-#endif
-  } saddr;
+  union u_sockaddr saddr;
   socklen_t len = sizeof saddr;
   ptrdiff_t count;
 
@@ -5003,6 +5006,7 @@ wait_reading_process_output (intmax_t time_limit, int 
nsecs, int read_kbd,
   struct timespec got_output_end_time = invalid_timespec ();
   enum { MINIMUM = -1, TIMEOUT, INFINITY } wait;
   int got_some_output = -1;
+  uintmax_t prev_wait_proc_nbytes_read = wait_proc ? wait_proc->nbytes_read : 
0;
 #if defined HAVE_GETADDRINFO_A || defined HAVE_GNUTLS
   bool retry_for_async;
 #endif
@@ -5457,6 +5461,8 @@ wait_reading_process_output (intmax_t time_limit, int 
nsecs, int read_kbd,
       if (nfds == 0)
        {
           /* Exit the main loop if we've passed the requested timeout,
+             or have read some bytes from our wait_proc (either directly
+             in this call or indirectly through timers / process filters),
              or aren't skipping processes and got some output and
              haven't lowered our timeout due to timers or SIGIO and
              have waited a long amount of time due to repeated
@@ -5464,7 +5470,9 @@ wait_reading_process_output (intmax_t time_limit, int 
nsecs, int read_kbd,
          struct timespec huge_timespec
            = make_timespec (TYPE_MAXIMUM (time_t), 2 * TIMESPEC_RESOLUTION);
          struct timespec cmp_time = huge_timespec;
-         if (wait < TIMEOUT)
+         if (wait < TIMEOUT
+              || (wait_proc
+                  && wait_proc->nbytes_read != prev_wait_proc_nbytes_read))
            break;
          if (wait == TIMEOUT)
            cmp_time = end_time;
@@ -5769,6 +5777,15 @@ wait_reading_process_output (intmax_t time_limit, int 
nsecs, int read_kbd,
       maybe_quit ();
     }
 
+  /* Timers and/or process filters that we have run could have themselves 
called
+     `accept-process-output' (and by that indirectly this function), thus
+     possibly reading some (or all) output of wait_proc without us noticing it.
+     This could potentially lead to an endless wait (dealt with earlier in the
+     function) and/or a wrong return value (dealt with here).  */
+  if (wait_proc && wait_proc->nbytes_read != prev_wait_proc_nbytes_read)
+    got_some_output = min (INT_MAX, (wait_proc->nbytes_read
+                                     - prev_wait_proc_nbytes_read));
+
   return got_some_output;
 }
 
@@ -5887,6 +5904,9 @@ read_process_output (Lisp_Object proc, int channel)
       coding->mode |= CODING_MODE_LAST_BLOCK;
     }
 
+  /* Ignore carryover, it's been added by a previous iteration already.  */
+  p->nbytes_read += nbytes;
+
   /* Now set NBYTES how many bytes we must decode.  */
   nbytes += carryover;
 
@@ -8008,6 +8028,18 @@ init_process_emacs (int sockfd)
 #endif
 
   external_sock_fd = sockfd;
+  Lisp_Object sockname = Qnil;
+# if HAVE_GETSOCKNAME
+  if (0 <= sockfd)
+    {
+      union u_sockaddr sa;
+      socklen_t salen = sizeof sa;
+      if (getsockname (sockfd, &sa.sa, &salen) == 0)
+       sockname = conv_sockaddr_to_lisp (&sa.sa, salen);
+    }
+# endif
+  Vinternal__daemon_sockname = sockname;
+
   max_desc = -1;
   memset (fd_callback_info, 0, sizeof (fd_callback_info));
 
@@ -8200,6 +8232,10 @@ These functions are called in the order of the list, 
until one of them
 returns non-`nil'.  */);
   Vinterrupt_process_functions = list1 (Qinternal_default_interrupt_process);
 
+  DEFVAR_LISP ("internal--daemon-sockname", Vinternal__daemon_sockname,
+              doc: /* Name of external socket passed to Emacs, or nil if none. 
 */);
+  Vinternal__daemon_sockname = Qnil;
+
   DEFSYM (Qinternal_default_interrupt_process,
          "internal-default-interrupt-process");
   DEFSYM (Qinterrupt_process_functions, "interrupt-process-functions");
diff --git a/src/process.h b/src/process.h
index ab468b1..6464a8c 100644
--- a/src/process.h
+++ b/src/process.h
@@ -129,6 +129,8 @@ struct Lisp_Process
     pid_t pid;
     /* Descriptor by which we read from this process.  */
     int infd;
+    /* Byte-count modulo (UINTMAX_MAX + 1) for process output read from 
`infd'.  */
+    uintmax_t nbytes_read;
     /* Descriptor by which we write to this process.  */
     int outfd;
     /* Descriptors that were created for this process and that need
diff --git a/src/regex.c b/src/regex.c
index 122cf71..a4e6441 100644
--- a/src/regex.c
+++ b/src/regex.c
@@ -5787,7 +5787,7 @@ re_match_2_internal (struct re_pattern_buffer *bufp, 
re_char *string1,
 
            EXTRACT_NUMBER (mcnt, p2 - 2);
 
-           /* Ensure this is a indeed the trivial kind of loop
+           /* Ensure this is indeed the trivial kind of loop
               we are expecting.  */
            assert (skip_one_char (p1) == p2 - 3);
            assert ((re_opcode_t) p2[-3] == jump && p2 + mcnt == p);
diff --git a/src/sound.c b/src/sound.c
index ce1a11e..b149acd 100644
--- a/src/sound.c
+++ b/src/sound.c
@@ -2,6 +2,8 @@
 
 Copyright (C) 1998-1999, 2001-2018 Free Software Foundation, Inc.
 
+Author: Gerd Moellmann <address@hidden>
+
 This file is part of GNU Emacs.
 
 GNU Emacs is free software: you can redistribute it and/or modify
@@ -17,8 +19,7 @@ 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 <https://www.gnu.org/licenses/>.  */
 
-/* Written by Gerd Moellmann <address@hidden>.  Tested with Luigi's
-   driver on FreeBSD 2.2.7 with a SoundBlaster 16.  */
+/* Tested with Luigi's driver on FreeBSD 2.2.7 with a SoundBlaster 16.  */
 
 /*
   Modified by Ben Key <address@hidden> to add a partial
diff --git a/src/syntax.c b/src/syntax.c
index 52cec23..20c6074 100644
--- a/src/syntax.c
+++ b/src/syntax.c
@@ -3049,7 +3049,7 @@ Comments are ignored if `parse-sexp-ignore-comments' is 
non-nil.
 
 If we reach the beginning or end of the accessible part of the buffer
 before we have scanned over COUNT lists, return nil if the depth at
-that point is zero, and signal a error if the depth is nonzero.  */)
+that point is zero, and signal an error if the depth is nonzero.  */)
   (Lisp_Object from, Lisp_Object count, Lisp_Object depth)
 {
   CHECK_NUMBER (from);
diff --git a/src/w16select.c b/src/w16select.c
index ed3d041..5a80d1c 100644
--- a/src/w16select.c
+++ b/src/w16select.c
@@ -2,6 +2,8 @@
 
 Copyright (C) 1996-1997, 2001-2018 Free Software Foundation, Inc.
 
+Author: Dale P. Smith <address@hidden>
+
 This file is part of GNU Emacs.
 
 GNU Emacs is free software: you can redistribute it and/or modify
@@ -22,7 +24,6 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
    "old" (character-mode) application access to Dynamic Data Exchange,
    menus, and the Windows clipboard.  */
 
-/* Written by Dale P. Smith <address@hidden>  */
 /* Adapted to DJGPP by Eli Zaretskii <address@hidden>  */
 
 #ifdef MSDOS
@@ -678,43 +679,11 @@ syms_of_win16select (void)
   defsubr (&Sw16_selection_exists_p);
 
   DEFVAR_LISP ("selection-coding-system", Vselection_coding_system,
-              doc: /* Coding system for communicating with other programs.
-
-For MS-Windows and MS-DOS:
-When sending or receiving text via selection and clipboard, the text
-is encoded or decoded by this coding system.  The default value is
-the current system default encoding on 9x/Me, `utf-16le-dos'
-\(Unicode) on NT/W2K/XP, and `iso-latin-1-dos' on MS-DOS.
-
-For X Windows:
-When sending text via selection and clipboard, if the target
-data-type matches with the type of this coding system, it is used
-for encoding the text.  Otherwise (including the case that this
-variable is nil), a proper coding system is used as below:
-
-data-type      coding system
----------      -------------
-UTF8_STRING    utf-8
-COMPOUND_TEXT  compound-text-with-extensions
-STRING         iso-latin-1
-C_STRING       no-conversion
-
-When receiving text, if this coding system is non-nil, it is used
-for decoding regardless of the data-type.  If this is nil, a
-proper coding system is used according to the data-type as above.
-
-See also the documentation of the variable `x-select-request-type' how
-to control which data-type to request for receiving text.
-
-The default value is nil.  */);
+              doc: /* SKIP: real doc in select.el.  */);
   Vselection_coding_system = intern ("iso-latin-1-dos");
 
   DEFVAR_LISP ("next-selection-coding-system", Vnext_selection_coding_system,
-              doc: /* Coding system for the next communication with other 
programs.
-Usually, `selection-coding-system' is used for communicating with
-other programs (X Windows clients or MS Windows programs).  But, if this
-variable is set, it is used for the next communication only.
-After the communication, this variable is set to nil.  */);
+              doc: /* SKIP: real doc in select.el.  */);
   Vnext_selection_coding_system = Qnil;
 
   DEFSYM (QCLIPBOARD, "CLIPBOARD");
diff --git a/src/w32fns.c b/src/w32fns.c
index 3347b3d..cf7d6c4 100644
--- a/src/w32fns.c
+++ b/src/w32fns.c
@@ -5672,15 +5672,7 @@ x_default_font_parameter (struct frame *f, Lisp_Object 
parms)
 
 DEFUN ("x-create-frame", Fx_create_frame, Sx_create_frame,
        1, 1, 0,
-       doc: /* Make a new window, which is called a \"frame\" in Emacs terms.
-Return an Emacs frame object.
-PARAMETERS is an alist of frame parameters.
-If the parameters specify that the frame should not have a minibuffer,
-and do not specify a specific minibuffer window to use,
-then `default-minibuffer-frame' must be a frame whose minibuffer can
-be shared by the new frame.
-
-This function is an internal primitive--use `make-frame' instead.  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
   (Lisp_Object parameters)
 {
   struct frame *f;
@@ -6099,8 +6091,7 @@ x_get_focus_frame (struct frame *frame)
 }
 
 DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0,
-       doc: /* Internal function called by `color-defined-p', which see.
-\(Note that the Nextstep version of this function ignores FRAME.)  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
   (Lisp_Object color, Lisp_Object frame)
 {
   XColor foo;
@@ -6115,7 +6106,7 @@ DEFUN ("xw-color-defined-p", Fxw_color_defined_p, 
Sxw_color_defined_p, 1, 2, 0,
 }
 
 DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0,
-       doc: /* Internal function called by `color-values', which see.  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
   (Lisp_Object color, Lisp_Object frame)
 {
   XColor foo;
@@ -6132,7 +6123,7 @@ DEFUN ("xw-color-values", Fxw_color_values, 
Sxw_color_values, 1, 2, 0,
 }
 
 DEFUN ("xw-display-color-p", Fxw_display_color_p, Sxw_display_color_p, 0, 1, 0,
-       doc: /* Internal function called by `display-color-p', which see.  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
   (Lisp_Object display)
 {
   struct w32_display_info *dpyinfo = check_x_display_info (display);
@@ -6145,11 +6136,7 @@ DEFUN ("xw-display-color-p", Fxw_display_color_p, 
Sxw_display_color_p, 0, 1, 0,
 
 DEFUN ("x-display-grayscale-p", Fx_display_grayscale_p,
        Sx_display_grayscale_p, 0, 1, 0,
-       doc: /* Return t if DISPLAY supports shades of gray.
-Note that color displays do support shades of gray.
-The optional argument DISPLAY specifies which display to ask about.
-DISPLAY should be either a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display.  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
   (Lisp_Object display)
 {
   struct w32_display_info *dpyinfo = check_x_display_info (display);
@@ -6162,14 +6149,7 @@ If omitted or nil, that stands for the selected frame's 
display.  */)
 
 DEFUN ("x-display-pixel-width", Fx_display_pixel_width,
        Sx_display_pixel_width, 0, 1, 0,
-       doc: /* Return the width in pixels of DISPLAY.
-The optional argument DISPLAY specifies which display to ask about.
-DISPLAY should be either a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display.
-
-On \"multi-monitor\" setups this refers to the pixel width for all
-physical monitors associated with DISPLAY.  To get information for
-each physical monitor, use `display-monitor-attributes-list'.  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
   (Lisp_Object display)
 {
   struct w32_display_info *dpyinfo = check_x_display_info (display);
@@ -6179,14 +6159,7 @@ each physical monitor, use 
`display-monitor-attributes-list'.  */)
 
 DEFUN ("x-display-pixel-height", Fx_display_pixel_height,
        Sx_display_pixel_height, 0, 1, 0,
-       doc: /* Return the height in pixels of DISPLAY.
-The optional argument DISPLAY specifies which display to ask about.
-DISPLAY should be either a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display.
-
-On \"multi-monitor\" setups this refers to the pixel height for all
-physical monitors associated with DISPLAY.  To get information for
-each physical monitor, use `display-monitor-attributes-list'.  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
   (Lisp_Object display)
 {
   struct w32_display_info *dpyinfo = check_x_display_info (display);
@@ -6196,10 +6169,7 @@ each physical monitor, use 
`display-monitor-attributes-list'.  */)
 
 DEFUN ("x-display-planes", Fx_display_planes, Sx_display_planes,
        0, 1, 0,
-       doc: /* Return the number of bitplanes of DISPLAY.
-The optional argument DISPLAY specifies which display to ask about.
-DISPLAY should be either a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display.  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
   (Lisp_Object display)
 {
   struct w32_display_info *dpyinfo = check_x_display_info (display);
@@ -6209,10 +6179,7 @@ If omitted or nil, that stands for the selected frame's 
display.  */)
 
 DEFUN ("x-display-color-cells", Fx_display_color_cells, Sx_display_color_cells,
        0, 1, 0,
-       doc: /* Return the number of color cells of DISPLAY.
-The optional argument DISPLAY specifies which display to ask about.
-DISPLAY should be either a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display.  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
   (Lisp_Object display)
 {
   struct w32_display_info *dpyinfo = check_x_display_info (display);
@@ -6230,57 +6197,28 @@ If omitted or nil, that stands for the selected frame's 
display.  */)
 DEFUN ("x-server-max-request-size", Fx_server_max_request_size,
        Sx_server_max_request_size,
        0, 1, 0,
-       doc: /* Return the maximum request size of the server of DISPLAY.
-The optional argument DISPLAY specifies which display to ask about.
-DISPLAY should be either a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display.  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
   (Lisp_Object display)
 {
   return make_number (1);
 }
 
 DEFUN ("x-server-vendor", Fx_server_vendor, Sx_server_vendor, 0, 1, 0,
-       doc: /* Return the "vendor ID" string of the GUI software on TERMINAL.
-
-\(Labeling every distributor as a "vendor" embodies the false assumption
-that operating systems cannot be developed and distributed noncommercially.)
-
-For GNU and Unix systems, this queries the X server software; for
-MS-Windows, this queries the OS.
-
-The optional argument TERMINAL specifies which display to ask about.
-TERMINAL should be a terminal object, a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display.  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
   (Lisp_Object terminal)
 {
   return build_string ("Microsoft Corp.");
 }
 
 DEFUN ("x-server-version", Fx_server_version, Sx_server_version, 0, 1, 0,
-       doc: /* Return the version numbers of the GUI software on TERMINAL.
-The value is a list of three integers specifying the version of the GUI
-software in use.
-
-For GNU and Unix system, the first 2 numbers are the version of the X
-Protocol used on TERMINAL and the 3rd number is the distributor-specific
-release number.  For MS-Windows, the 3 numbers report the version and
-the build number of the OS.
-
-See also the function `x-server-vendor'.
-
-The optional argument TERMINAL specifies which display to ask about.
-TERMINAL should be a terminal object, a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display.  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
   (Lisp_Object terminal)
 {
   return list3i (w32_major_version, w32_minor_version, w32_build_number);
 }
 
 DEFUN ("x-display-screens", Fx_display_screens, Sx_display_screens, 0, 1, 0,
-       doc: /* Return the number of screens on the server of DISPLAY.
-The optional argument DISPLAY specifies which display to ask about.
-DISPLAY should be either a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display.  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
   (Lisp_Object display)
 {
   return make_number (1);
@@ -6288,14 +6226,7 @@ If omitted or nil, that stands for the selected frame's 
display.  */)
 
 DEFUN ("x-display-mm-height", Fx_display_mm_height,
        Sx_display_mm_height, 0, 1, 0,
-       doc: /* Return the height in millimeters of DISPLAY.
-The optional argument DISPLAY specifies which display to ask about.
-DISPLAY should be either a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display.
-
-On \"multi-monitor\" setups this refers to the height in millimeters for
-all physical monitors associated with DISPLAY.  To get information
-for each physical monitor, use `display-monitor-attributes-list'.  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
   (Lisp_Object display)
 {
   struct w32_display_info *dpyinfo = check_x_display_info (display);
@@ -6311,14 +6242,7 @@ for each physical monitor, use 
`display-monitor-attributes-list'.  */)
 }
 
 DEFUN ("x-display-mm-width", Fx_display_mm_width, Sx_display_mm_width, 0, 1, 0,
-       doc: /* Return the width in millimeters of DISPLAY.
-The optional argument DISPLAY specifies which display to ask about.
-DISPLAY should be either a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display.
-
-On \"multi-monitor\" setups this refers to the width in millimeters for
-all physical monitors associated with TERMINAL.  To get information
-for each physical monitor, use `display-monitor-attributes-list'.  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
   (Lisp_Object display)
 {
   struct w32_display_info *dpyinfo = check_x_display_info (display);
@@ -6335,11 +6259,7 @@ for each physical monitor, use 
`display-monitor-attributes-list'.  */)
 
 DEFUN ("x-display-backing-store", Fx_display_backing_store,
        Sx_display_backing_store, 0, 1, 0,
-       doc: /* Return an indication of whether DISPLAY does backing store.
-The value may be `always', `when-mapped', or `not-useful'.
-The optional argument DISPLAY specifies which display to ask about.
-DISPLAY should be either a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display.  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
   (Lisp_Object display)
 {
   return intern ("not-useful");
@@ -6347,13 +6267,7 @@ If omitted or nil, that stands for the selected frame's 
display.  */)
 
 DEFUN ("x-display-visual-class", Fx_display_visual_class,
        Sx_display_visual_class, 0, 1, 0,
-       doc: /* Return the visual class of DISPLAY.
-The value is one of the symbols `static-gray', `gray-scale',
-`static-color', `pseudo-color', `true-color', or `direct-color'.
-
-The optional argument DISPLAY specifies which display to ask about.
-DISPLAY should be either a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display.  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
   (Lisp_Object display)
 {
   struct w32_display_info *dpyinfo = check_x_display_info (display);
@@ -6362,7 +6276,7 @@ If omitted or nil, that stands for the selected frame's 
display.  */)
   if (dpyinfo->has_palette)
       result = intern ("pseudo-color");
   else if (dpyinfo->n_planes * dpyinfo->n_cbits == 1)
-      result = intern ("static-grey");
+      result = intern ("static-gray");
   else if (dpyinfo->n_planes * dpyinfo->n_cbits == 4)
       result = intern ("static-color");
   else if (dpyinfo->n_planes * dpyinfo->n_cbits > 8)
@@ -6373,10 +6287,7 @@ If omitted or nil, that stands for the selected frame's 
display.  */)
 
 DEFUN ("x-display-save-under", Fx_display_save_under,
        Sx_display_save_under, 0, 1, 0,
-       doc: /* Return t if DISPLAY supports the save-under feature.
-The optional argument DISPLAY specifies which display to ask about.
-DISPLAY should be either a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display.  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
   (Lisp_Object display)
 {
   return Qnil;
@@ -6641,12 +6552,7 @@ x_display_info_for_name (Lisp_Object name)
 }
 
 DEFUN ("x-open-connection", Fx_open_connection, Sx_open_connection,
-       1, 3, 0, doc: /* Open a connection to a display server.
-DISPLAY is the name of the display to connect to.
-Optional second arg XRM-STRING is a string of resources in xrdb format.
-If the optional third arg MUST-SUCCEED is non-nil,
-terminate Emacs if we can't open the connection.
-\(In the Nextstep version, the last two arguments are currently ignored.)  */)
+       1, 3, 0, doc: /* SKIP: real doc in xfns.c.  */)
   (Lisp_Object display, Lisp_Object xrm_string, Lisp_Object must_succeed)
 {
   char *xrm_option;
@@ -6728,9 +6634,7 @@ terminate Emacs if we can't open the connection.
 
 DEFUN ("x-close-connection", Fx_close_connection,
        Sx_close_connection, 1, 1, 0,
-       doc: /* Close the connection to DISPLAY's server.
-For DISPLAY, specify either a frame or a display name (a string).
-If DISPLAY is nil, that stands for the selected frame's display.  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
   (Lisp_Object display)
 {
   struct w32_display_info *dpyinfo = check_x_display_info (display);
@@ -6748,7 +6652,7 @@ If DISPLAY is nil, that stands for the selected frame's 
display.  */)
 }
 
 DEFUN ("x-display-list", Fx_display_list, Sx_display_list, 0, 0, 0,
-       doc: /* Return the list of display names that Emacs has connections to. 
 */)
+       doc: /* SKIP: real doc in xfns.c.  */)
   (void)
 {
   Lisp_Object result = Qnil;
@@ -6761,17 +6665,7 @@ DEFUN ("x-display-list", Fx_display_list, 
Sx_display_list, 0, 0, 0,
 }
 
 DEFUN ("x-synchronize", Fx_synchronize, Sx_synchronize, 1, 2, 0,
-       doc: /* If ON is non-nil, report X errors as soon as the erring request 
is made.
-This function only has an effect on X Windows.  With MS Windows, it is
-defined but does nothing.
-
-If ON is nil, allow buffering of requests.
-Turning on synchronization prohibits the Xlib routines from buffering
-requests and seriously degrades performance, but makes debugging much
-easier.
-The optional second argument TERMINAL specifies which display to act on.
-TERMINAL should be a terminal object, a frame or a display name (a string).
-If TERMINAL is omitted or nil, that stands for the selected frame's display.  
*/)
+       doc: /* SKIP: real doc in xfns.c.  */)
   (Lisp_Object on, Lisp_Object display)
 {
   return Qnil;
@@ -6787,21 +6681,7 @@ If TERMINAL is omitted or nil, that stands for the 
selected frame's display.  */
 
 DEFUN ("x-change-window-property", Fx_change_window_property,
        Sx_change_window_property, 2, 6, 0,
-       doc: /* Change window property PROP to VALUE on the X window of FRAME.
-PROP must be a string.  VALUE may be a string or a list of conses,
-numbers and/or strings.  If an element in the list is a string, it is
-converted to an atom and the value of the Atom is used.  If an element
-is a cons, it is converted to a 32 bit number where the car is the 16
-top bits and the cdr is the lower 16 bits.
-
-FRAME nil or omitted means use the selected frame.
-If TYPE is given and non-nil, it is the name of the type of VALUE.
-If TYPE is not given or nil, the type is STRING.
-FORMAT gives the size in bits of each element if VALUE is a list.
-It must be one of 8, 16 or 32.
-If VALUE is a string or FORMAT is nil or not given, FORMAT defaults to 8.
-If OUTER-P is non-nil, the property is changed for the outer X window of
-FRAME.  Default is to change on the edit X window.  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
   (Lisp_Object prop, Lisp_Object value, Lisp_Object frame,
    Lisp_Object type, Lisp_Object format, Lisp_Object outer_p)
 {
@@ -6827,8 +6707,7 @@ FRAME.  Default is to change on the edit X window.  */)
 
 DEFUN ("x-delete-window-property", Fx_delete_window_property,
        Sx_delete_window_property, 1, 2, 0,
-       doc: /* Remove window property PROP from X window of FRAME.
-FRAME nil or omitted means use the selected frame.  Value is PROP.  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
   (Lisp_Object prop, Lisp_Object frame)
 {
   struct frame *f = decode_window_system_frame (frame);
@@ -6849,21 +6728,7 @@ FRAME nil or omitted means use the selected frame.  
Value is PROP.  */)
 
 DEFUN ("x-window-property", Fx_window_property, Sx_window_property,
        1, 6, 0,
-       doc: /* Value is the value of window property PROP on FRAME.
-If FRAME is nil or omitted, use the selected frame.
-
-On X Windows, the following optional arguments are also accepted:
-If TYPE is nil or omitted, get the property as a string.
-Otherwise TYPE is the name of the atom that denotes the type expected.
-If SOURCE is non-nil, get the property on that window instead of from
-FRAME.  The number 0 denotes the root window.
-If DELETE-P is non-nil, delete the property after retrieving it.
-If VECTOR-RET-P is non-nil, don't return a string but a vector of values.
-
-On MS Windows, this function accepts but ignores those optional arguments.
-
-Value is nil if FRAME hasn't a property with name PROP or if PROP has
-no value of TYPE (always string in the MS Windows case).  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
   (Lisp_Object prop, Lisp_Object frame, Lisp_Object type,
    Lisp_Object source, Lisp_Object delete_p, Lisp_Object vector_ret_p)
 {
@@ -7328,35 +7193,7 @@ x_hide_tip (bool delete)
 
 
 DEFUN ("x-show-tip", Fx_show_tip, Sx_show_tip, 1, 6, 0,
-       doc: /* Show STRING in a \"tooltip\" window on frame FRAME.
-A tooltip window is a small window displaying a string.
-
-This is an internal function; Lisp code should call `tooltip-show'.
-
-FRAME nil or omitted means use the selected frame.
-
-PARMS is an optional list of frame parameters which can be
-used to change the tooltip's appearance.
-
-Automatically hide the tooltip after TIMEOUT seconds.  TIMEOUT nil
-means use the default timeout of 5 seconds.
-
-If the list of frame parameters PARMS contains a `left' parameter,
-display the tooltip at that x-position.  If the list of frame parameters
-PARMS contains no `left' but a `right' parameter, display the tooltip
-right-adjusted at that x-position. Otherwise display it at the
-x-position of the mouse, with offset DX added (default is 5 if DX isn't
-specified).
-
-Likewise for the y-position: If a `top' frame parameter is specified, it
-determines the position of the upper edge of the tooltip window.  If a
-`bottom' parameter but no `top' frame parameter is specified, it
-determines the position of the lower edge of the tooltip window.
-Otherwise display the tooltip window at the y-position of the mouse,
-with offset DY added (default is -10).
-
-A tooltip's maximum size is specified by `x-max-tooltip-size'.
-Text larger than the specified size is clipped.  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
   (Lisp_Object string, Lisp_Object frame, Lisp_Object parms,
    Lisp_Object timeout, Lisp_Object dx, Lisp_Object dy)
 {
@@ -7635,8 +7472,7 @@ Text larger than the specified size is clipped.  */)
 
 
 DEFUN ("x-hide-tip", Fx_hide_tip, Sx_hide_tip, 0, 0, 0,
-       doc: /* Hide the current tooltip window, if there is any.
-Value is t if tooltip was open, nil otherwise.  */)
+       doc: /* SKIP: real doc in xfns.c.  */)
   (void)
 {
   return x_hide_tip (!tooltip_reuse_hidden_frame);
@@ -7767,18 +7603,7 @@ w32_dialog_in_progress (Lisp_Object in_progress)
 }
 
 DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 5, 0,
-       doc: /* Read file name, prompting with PROMPT in directory DIR.
-Use a file selection dialog.  Select DEFAULT-FILENAME in the dialog's file
-selection box, if specified.  If MUSTMATCH is non-nil, the returned file
-or directory must exist.
-
-This function is only defined on NS, MS Windows, and X Windows with the
-Motif or Gtk toolkits.  With the Motif toolkit, ONLY-DIR-P is ignored.
-Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories.
-On Windows 7 and later, the file selection dialog "remembers" the last
-directory where the user selected a file, and will open that directory
-instead of DIR on subsequent invocations of this function with the same
-value of DIR as in previous invocations; this is standard Windows behavior.  
*/)
+       doc: /* SKIP: real doc in xfns.c.  */)
   (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, 
Lisp_Object mustmatch, Lisp_Object only_dir_p)
 {
   /* Filter index: 1: All Files, 2: Directories only  */
@@ -9244,11 +9069,7 @@ typedef BOOL (WINAPI *GetDiskFreeSpaceExA_Proc)
   (LPCSTR, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER);
 
 DEFUN ("file-system-info", Ffile_system_info, Sfile_system_info, 1, 1, 0,
-       doc: /* Return storage information about the file system FILENAME is on.
-Value is a list of floats (TOTAL FREE AVAIL), where TOTAL is the total
-storage of the file system, FREE is the free storage, and AVAIL is the
-storage available to a non-superuser.  All 3 numbers are in bytes.
-If the underlying system call fails, value is nil.  */)
+       doc: /* SKIP: Real doc in fileio.c.  */)
   (Lisp_Object filename)
 {
   Lisp_Object encoded, value;
@@ -10532,9 +10353,7 @@ bass-down, bass-boost, bass-up, treble-down, treble-up  
*/);
 
 #if 0 /* TODO: Mouse cursor customization.  */
   DEFVAR_LISP ("x-pointer-shape", Vx_pointer_shape,
-              doc: /* The shape of the pointer when over text.
-Changing the value does not affect existing frames
-unless you set the mouse color.  */);
+              doc: /* SKIP: real doc in xfns.c.  */);
   Vx_pointer_shape = Qnil;
 
   Vx_nontext_pointer_shape = Qnil;
@@ -10542,58 +10361,42 @@ unless you set the mouse color.  */);
   Vx_mode_pointer_shape = Qnil;
 
   DEFVAR_LISP ("x-hourglass-pointer-shape", Vx_hourglass_pointer_shape,
-              doc: /* The shape of the pointer when Emacs is busy.
-This variable takes effect when you create a new frame
-or when you set the mouse color.  */);
+              doc: /* SKIP: real doc in xfns.c.  */);
   Vx_hourglass_pointer_shape = Qnil;
 
   DEFVAR_LISP ("x-sensitive-text-pointer-shape",
               Vx_sensitive_text_pointer_shape,
-              doc: /* The shape of the pointer when over mouse-sensitive text.
-This variable takes effect when you create a new frame
-or when you set the mouse color.  */);
+              doc: /* SKIP: real doc in xfns.c.  */);
   Vx_sensitive_text_pointer_shape = Qnil;
 
   DEFVAR_LISP ("x-window-horizontal-drag-cursor",
               Vx_window_horizontal_drag_shape,
-              doc: /* Pointer shape to use for indicating a window can be 
dragged horizontally.
-This variable takes effect when you create a new frame
-or when you set the mouse color.  */);
+              doc: /* SKIP: real doc in xfns.c.  */);
   Vx_window_horizontal_drag_shape = Qnil;
 
   DEFVAR_LISP ("x-window-vertical-drag-cursor",
               Vx_window_vertical_drag_shape,
-              doc: /* Pointer shape to use for indicating a window can be 
dragged vertically.
-This variable takes effect when you create a new frame
-or when you set the mouse color.  */);
+              doc: /* SKIP: real doc in xfns.c.  */);
   Vx_window_vertical_drag_shape = Qnil;
 #endif
 
   DEFVAR_LISP ("x-cursor-fore-pixel", Vx_cursor_fore_pixel,
-              doc: /* A string indicating the foreground color of the cursor 
box.  */);
+              doc: /* SKIP: real doc in xfns.c.  */);
   Vx_cursor_fore_pixel = Qnil;
 
   DEFVAR_LISP ("x-max-tooltip-size", Vx_max_tooltip_size,
-              doc: /* Maximum size for tooltips.
-Value is a pair (COLUMNS . ROWS).  Text larger than this is clipped.  */);
+              doc: /* SKIP: real doc in xfns.c.  */);
   Vx_max_tooltip_size = Fcons (make_number (80), make_number (40));
 
   DEFVAR_LISP ("x-no-window-manager", Vx_no_window_manager,
-              doc: /* Non-nil if no window manager is in use.
-Emacs doesn't try to figure this out; this is always nil
-unless you set it to something else.  */);
+              doc: /* SKIP: real doc in xfns.c.  */);
   /* We don't have any way to find this out, so set it to nil
      and maybe the user would like to set it to t.  */
   Vx_no_window_manager = Qnil;
 
   DEFVAR_LISP ("x-pixel-size-width-font-regexp",
               Vx_pixel_size_width_font_regexp,
-              doc: /* Regexp matching a font name whose width is the same as 
`PIXEL_SIZE'.
-
-Since Emacs gets width of a font matching with this regexp from
-PIXEL_SIZE field of the name, font finding mechanism gets faster for
-such a font.  This is especially effective for such large fonts as
-Chinese, Japanese, and Korean.  */);
+              doc: /* SKIP: real doc in xfns.c.  */);
   Vx_pixel_size_width_font_regexp = Qnil;
 
   DEFVAR_LISP ("w32-bdf-filename-alist",
diff --git a/src/w32menu.c b/src/w32menu.c
index e7018d1..179ec88 100644
--- a/src/w32menu.c
+++ b/src/w32menu.c
@@ -1572,7 +1572,7 @@ w32_free_menu_strings (HWND hwnd)
 /* The following is used by delayed window autoselection.  */
 
 DEFUN ("menu-or-popup-active-p", Fmenu_or_popup_active_p, 
Smenu_or_popup_active_p, 0, 0, 0,
-       doc: /* Return t if a menu or popup dialog is active on selected frame. 
 */)
+       doc: /* SKIP: real doc in xmenu.c.  */)
   (void)
 {
   struct frame *f;
diff --git a/src/w32notify.c b/src/w32notify.c
index c16a8d1..5c1d212 100644
--- a/src/w32notify.c
+++ b/src/w32notify.c
@@ -1,5 +1,8 @@
 /* Filesystem notifications support for GNU Emacs on the Microsoft Windows API.
-   Copyright (C) 2012-2018 Free Software Foundation, Inc.
+
+Copyright (C) 2012-2018 Free Software Foundation, Inc.
+
+Author: Eli Zaretskii <address@hidden>
 
 This file is part of GNU Emacs.
 
@@ -16,9 +19,7 @@ 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 <https://www.gnu.org/licenses/>.  */
 
-/* Written by Eli Zaretskii <address@hidden>.
-
-   Design overview:
+/* Design overview:
 
    For each watch request, we launch a separate worker thread.  The
    worker thread runs the watch_worker function, which issues an
diff --git a/src/w32reg.c b/src/w32reg.c
index df61847..4ddbaa3 100644
--- a/src/w32reg.c
+++ b/src/w32reg.c
@@ -1,6 +1,8 @@
 /* Emulate the X Resource Manager through the registry.
-   Copyright (C) 1990, 1993-1994, 2001-2018 Free Software Foundation,
-   Inc.
+
+Copyright (C) 1990, 1993-1994, 2001-2018 Free Software Foundation, Inc.
+
+Author: Kevin Gallo
 
 This file is part of GNU Emacs.
 
@@ -17,8 +19,6 @@ 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 <https://www.gnu.org/licenses/>.  */
 
-/* Written by Kevin Gallo */
-
 #include <config.h>
 #include "lisp.h"
 #include "w32term.h"   /* for XrmDatabase, xrdb */
diff --git a/src/w32select.c b/src/w32select.c
index c451b7f..a9df3f7 100644
--- a/src/w32select.c
+++ b/src/w32select.c
@@ -2,6 +2,9 @@
 
 Copyright (C) 1993-1994, 2001-2018 Free Software Foundation, Inc.
 
+Author: Kevin Gallo
+       Benjamin Riefenstahl
+
 This file is part of GNU Emacs.
 
 GNU Emacs is free software: you can redistribute it and/or modify
@@ -17,9 +20,6 @@ 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 <https://www.gnu.org/licenses/>.  */
 
-/* Written by Kevin Gallo, Benjamin Riefenstahl */
-
-
 /*
  * Notes on usage of selection-coding-system and
  * next-selection-coding-system on MS Windows:
@@ -1170,45 +1170,13 @@ syms_of_w32select (void)
   defsubr (&Sw32_selection_targets);
 
   DEFVAR_LISP ("selection-coding-system", Vselection_coding_system,
-              doc: /* Coding system for communicating with other programs.
-
-For MS-Windows and MS-DOS:
-When sending or receiving text via selection and clipboard, the text
-is encoded or decoded by this coding system.  The default value is
-the current system default encoding on 9x/Me, `utf-16le-dos'
-\(Unicode) on NT/W2K/XP, and `iso-latin-1-dos' on MS-DOS.
-
-For X Windows:
-When sending text via selection and clipboard, if the target
-data-type matches with the type of this coding system, it is used
-for encoding the text.  Otherwise (including the case that this
-variable is nil), a proper coding system is used as below:
-
-data-type      coding system
----------      -------------
-UTF8_STRING    utf-8
-COMPOUND_TEXT  compound-text-with-extensions
-STRING         iso-latin-1
-C_STRING       no-conversion
-
-When receiving text, if this coding system is non-nil, it is used
-for decoding regardless of the data-type.  If this is nil, a
-proper coding system is used according to the data-type as above.
-
-See also the documentation of the variable `x-select-request-type' how
-to control which data-type to request for receiving text.
-
-The default value is nil.  */);
+              doc: /* SKIP: real doc in select.el.  */);
   /* The actual value is set dynamically in the dumped Emacs, see
      below. */
   Vselection_coding_system = Qnil;
 
   DEFVAR_LISP ("next-selection-coding-system", Vnext_selection_coding_system,
-              doc: /* Coding system for the next communication with other 
programs.
-Usually, `selection-coding-system' is used for communicating with
-other programs (X Windows clients or MS Windows programs).  But, if this
-variable is set, it is used for the next communication only.
-After the communication, this variable is set to nil.  */);
+              doc: /* SKIP: real doc in select.el.  */);
   Vnext_selection_coding_system = Qnil;
 
   DEFSYM (QCLIPBOARD, "CLIPBOARD");
diff --git a/src/w32term.c b/src/w32term.c
index c1d039c..97afb67 100644
--- a/src/w32term.c
+++ b/src/w32term.c
@@ -7329,14 +7329,7 @@ syms_of_w32term (void)
   DEFSYM (Qrenamed_to, "renamed-to");
 
   DEFVAR_LISP ("x-wait-for-event-timeout", Vx_wait_for_event_timeout,
-    doc: /* How long to wait for X events.
-
-Emacs will wait up to this many seconds to receive X events after
-making changes which affect the state of the graphical interface.
-Under some window managers this can take an indefinite amount of time,
-so it is important to limit the wait.
-
-If set to a non-float value, there will be no wait at all.  */);
+    doc: /* SKIP: real doc in xterm.c.  */);
   Vx_wait_for_event_timeout = make_float (0.1);
 
   DEFVAR_INT ("w32-num-mouse-buttons",
@@ -7390,28 +7383,16 @@ the cursor have no effect.  */);
      from cus-start.el and other places, like "M-x set-variable".  */
   DEFVAR_BOOL ("x-use-underline-position-properties",
               x_use_underline_position_properties,
-     doc: /* Non-nil means make use of UNDERLINE_POSITION font properties.
-A value of nil means ignore them.  If you encounter fonts with bogus
-UNDERLINE_POSITION font properties, for example 7x13 on XFree prior
-to 4.1, set this to nil.  You can also use `underline-minimum-offset'
-to override the font's UNDERLINE_POSITION for small font display
-sizes.  */);
+     doc: /* SKIP: real doc in xterm.c.  */);
   x_use_underline_position_properties = 0;
 
   DEFVAR_BOOL ("x-underline-at-descent-line",
               x_underline_at_descent_line,
-     doc: /* Non-nil means to draw the underline at the same place as the 
descent line.
-A value of nil means to draw the underline according to the value of the
-variable `x-use-underline-position-properties', which is usually at the
-baseline level.  The default value is nil.  */);
+     doc: /* SKIP: real doc in xterm.c.  */);
   x_underline_at_descent_line = 0;
 
   DEFVAR_LISP ("x-toolkit-scroll-bars", Vx_toolkit_scroll_bars,
-              doc: /* Which toolkit scroll bars Emacs uses, if any.
-A value of nil means Emacs doesn't use toolkit scroll bars.
-With the X Window system, the value is a symbol describing the
-X toolkit.  Possible values are: gtk, motif, xaw, or xaw3d.
-With MS Windows or Nextstep, the value is t.  */);
+              doc: /* SKIP: real doc in xterm.c.  */);
   Vx_toolkit_scroll_bars = Qt;
 
   DEFVAR_BOOL ("w32-unicode-filenames",
diff --git a/src/xdisp.c b/src/xdisp.c
index 7c90d32..1428644 100644
--- a/src/xdisp.c
+++ b/src/xdisp.c
@@ -10982,10 +10982,18 @@ setup_echo_area_for_printing (bool multibyte_p)
        }
       TEMP_SET_PT_BOTH (BEG, BEG_BYTE);
 
-      /* Set up the buffer for the multibyteness we need.  */
-      if (multibyte_p
-         != !NILP (BVAR (current_buffer, enable_multibyte_characters)))
-       Fset_buffer_multibyte (multibyte_p ? Qt : Qnil);
+      /* Set up the buffer for the multibyteness we need.  We always
+        set it to be multibyte, except when
+        unibyte-display-via-language-environment is non-nil and the
+        buffer from which we are called is unibyte, because in that
+        case unibyte characters should not be displayed as octal
+        escapes.  */
+      if (unibyte_display_via_language_environment
+         && !multibyte_p
+         && !NILP (BVAR (current_buffer, enable_multibyte_characters)))
+       Fset_buffer_multibyte (Qnil);
+      else if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
+       Fset_buffer_multibyte (Qt);
 
       /* Raise the frame containing the echo area.  */
       if (minibuffer_auto_raise)
@@ -11431,10 +11439,17 @@ set_message_1 (ptrdiff_t a1, Lisp_Object string)
 {
   eassert (STRINGP (string));
 
-  /* Change multibyteness of the echo buffer appropriately.  */
-  if (message_enable_multibyte
-      != !NILP (BVAR (current_buffer, enable_multibyte_characters)))
-    Fset_buffer_multibyte (message_enable_multibyte ? Qt : Qnil);
+  /* Change multibyteness of the echo buffer appropriately.  We always
+     set it to be multibyte, except when
+     unibyte-display-via-language-environment is non-nil and the
+     string to display is unibyte, because in that case unibyte
+     characters should not be displayed as octal escapes.  */
+  if (!message_enable_multibyte
+      && unibyte_display_via_language_environment
+      && !NILP (BVAR (current_buffer, enable_multibyte_characters)))
+    Fset_buffer_multibyte (Qnil);
+  else if (NILP (BVAR (current_buffer, enable_multibyte_characters)))
+    Fset_buffer_multibyte (Qt);
 
   bset_truncate_lines (current_buffer, message_truncate_lines ? Qt : Qnil);
   if (!NILP (BVAR (current_buffer, bidi_display_reordering)))
@@ -32484,7 +32499,7 @@ or `nobreak-hyphen' face respectively.
 U+00A0 (no-break space), U+00AD (soft hyphen), U+2010 (hyphen), and
 U+2011 (non-breaking hyphen) are affected.
 
-Any other non-nil value means to display these characters as a escape
+Any other non-nil value means to display these characters as an escape
 glyph followed by an ordinary space or hyphen.
 
 A value of nil means no special handling of these characters.  */);
diff --git a/src/xfns.c b/src/xfns.c
index 9f0d946..78151c8 100644
--- a/src/xfns.c
+++ b/src/xfns.c
@@ -4125,7 +4125,7 @@ x_focus_frame (struct frame *f, bool noactivate)
 
 
 DEFUN ("xw-color-defined-p", Fxw_color_defined_p, Sxw_color_defined_p, 1, 2, 0,
-       doc: /* Internal function called by `color-defined-p', which see.
+       doc: /* Internal function called by `color-defined-p'.
 \(Note that the Nextstep version of this function ignores FRAME.)  */)
   (Lisp_Object color, Lisp_Object frame)
 {
@@ -4141,7 +4141,8 @@ DEFUN ("xw-color-defined-p", Fxw_color_defined_p, 
Sxw_color_defined_p, 1, 2, 0,
 }
 
 DEFUN ("xw-color-values", Fxw_color_values, Sxw_color_values, 1, 2, 0,
-       doc: /* Internal function called by `color-values', which see.  */)
+       doc: /* Internal function called by `color-values'.
+\(Note that the Nextstep version of this function ignores FRAME.)  */)
   (Lisp_Object color, Lisp_Object frame)
 {
   XColor foo;
@@ -4156,7 +4157,7 @@ DEFUN ("xw-color-values", Fxw_color_values, 
Sxw_color_values, 1, 2, 0,
 }
 
 DEFUN ("xw-display-color-p", Fxw_display_color_p, Sxw_display_color_p, 0, 1, 0,
-       doc: /* Internal function called by `display-color-p', which see.  */)
+       doc: /* Internal function called by `display-color-p'.  */)
   (Lisp_Object terminal)
 {
   struct x_display_info *dpyinfo = check_x_display_info (terminal);
@@ -4212,6 +4213,7 @@ DEFUN ("x-display-pixel-width", Fx_display_pixel_width, 
Sx_display_pixel_width,
 The optional argument TERMINAL specifies which display to ask about.
 TERMINAL should be a terminal object, a frame or a display name (a string).
 If omitted or nil, that stands for the selected frame's display.
+\(On MS Windows, this function does not accept terminal objects.)
 
 On \"multi-monitor\" setups this refers to the pixel width for all
 physical monitors associated with TERMINAL.  To get information for
@@ -4229,6 +4231,7 @@ DEFUN ("x-display-pixel-height", Fx_display_pixel_height,
 The optional argument TERMINAL specifies which display to ask about.
 TERMINAL should be a terminal object, a frame or a display name (a string).
 If omitted or nil, that stands for the selected frame's display.
+\(On MS Windows, this function does not accept terminal objects.)
 
 On \"multi-monitor\" setups this refers to the pixel height for all
 physical monitors associated with TERMINAL.  To get information for
@@ -4245,7 +4248,8 @@ DEFUN ("x-display-planes", Fx_display_planes, 
Sx_display_planes,
        doc: /* Return the number of bitplanes of the X display TERMINAL.
 The optional argument TERMINAL specifies which display to ask about.
 TERMINAL should be a terminal object, a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display.  */)
+If omitted or nil, that stands for the selected frame's display.
+\(On MS Windows, this function does not accept terminal objects.)  */)
   (Lisp_Object terminal)
 {
   struct x_display_info *dpyinfo = check_x_display_info (terminal);
@@ -4258,7 +4262,8 @@ DEFUN ("x-display-color-cells", Fx_display_color_cells, 
Sx_display_color_cells,
        doc: /* Return the number of color cells of the X display TERMINAL.
 The optional argument TERMINAL specifies which display to ask about.
 TERMINAL should be a terminal object, a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display.  */)
+If omitted or nil, that stands for the selected frame's display.
+\(On MS Windows, this function does not accept terminal objects.)  */)
   (Lisp_Object terminal)
 {
   struct x_display_info *dpyinfo = check_x_display_info (terminal);
@@ -4282,7 +4287,10 @@ DEFUN ("x-server-max-request-size", 
Fx_server_max_request_size,
        doc: /* Return the maximum request size of the X server of display 
TERMINAL.
 The optional argument TERMINAL specifies which display to ask about.
 TERMINAL should be a terminal object, a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display.  */)
+If omitted or nil, that stands for the selected frame's display.
+
+On MS Windows, this function just returns 1.
+On Nextstep, this function just returns nil.  */)
   (Lisp_Object terminal)
 {
   struct x_display_info *dpyinfo = check_x_display_info (terminal);
@@ -4297,8 +4305,8 @@ DEFUN ("x-server-vendor", Fx_server_vendor, 
Sx_server_vendor, 0, 1, 0,
 that operating systems cannot be developed and distributed noncommercially.)
 The optional argument TERMINAL specifies which display to ask about.
 
-For GNU and Unix systems, this queries the X server software; for
-MS-Windows, this queries the OS.
+For GNU and Unix systems, this queries the X server software.
+For MS Windows and Nextstep the result is hard-coded.
 
 TERMINAL should be a terminal object, a frame or a display name (a string).
 If omitted or nil, that stands for the selected frame's display.  */)
@@ -4318,8 +4326,9 @@ software in use.
 
 For GNU and Unix system, the first 2 numbers are the version of the X
 Protocol used on TERMINAL and the 3rd number is the distributor-specific
-release number.  For MS-Windows, the 3 numbers report the version and
-the build number of the OS.
+release number.  For MS Windows, the 3 numbers report the OS major and
+minor version and build number.  For Nextstep, the first 2 numbers are
+hard-coded and the 3rd represents the OS version.
 
 See also the function `x-server-vendor'.
 
@@ -4339,7 +4348,12 @@ DEFUN ("x-display-screens", Fx_display_screens, 
Sx_display_screens, 0, 1, 0,
        doc: /* Return the number of screens on the X server of display 
TERMINAL.
 The optional argument TERMINAL specifies which display to ask about.
 TERMINAL should be a terminal object, a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display.  */)
+If omitted or nil, that stands for the selected frame's display.
+
+On MS Windows, this function just returns 1.
+On Nextstep, "screen" is in X terminology, not that of Nextstep.
+For the number of physical monitors, use `(length
+\(display-monitor-attributes-list TERMINAL))' instead.  */)
   (Lisp_Object terminal)
 {
   struct x_display_info *dpyinfo = check_x_display_info (terminal);
@@ -4352,6 +4366,7 @@ DEFUN ("x-display-mm-height", Fx_display_mm_height, 
Sx_display_mm_height, 0, 1,
 The optional argument TERMINAL specifies which display to ask about.
 TERMINAL should be a terminal object, a frame or a display name (a string).
 If omitted or nil, that stands for the selected frame's display.
+\(On MS Windows, this function does not accept terminal objects.)
 
 On \"multi-monitor\" setups this refers to the height in millimeters for
 all physical monitors associated with TERMINAL.  To get information
@@ -4368,6 +4383,7 @@ DEFUN ("x-display-mm-width", Fx_display_mm_width, 
Sx_display_mm_width, 0, 1, 0,
 The optional argument TERMINAL specifies which display to ask about.
 TERMINAL should be a terminal object, a frame or a display name (a string).
 If omitted or nil, that stands for the selected frame's display.
+\(On MS Windows, this function does not accept terminal objects.)
 
 On \"multi-monitor\" setups this refers to the width in millimeters for
 all physical monitors associated with TERMINAL.  To get information
@@ -4382,10 +4398,13 @@ for each physical monitor, use 
`display-monitor-attributes-list'.  */)
 DEFUN ("x-display-backing-store", Fx_display_backing_store,
        Sx_display_backing_store, 0, 1, 0,
        doc: /* Return an indication of whether X display TERMINAL does backing 
store.
-The value may be `always', `when-mapped', or `not-useful'.
 The optional argument TERMINAL specifies which display to ask about.
 TERMINAL should be a terminal object, a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display.  */)
+If omitted or nil, that stands for the selected frame's display.
+
+The value may be `always', `when-mapped', or `not-useful'.
+On Nextstep, the value may be `buffered', `retained', or `non-retained'.
+On MS Windows, this returns nothing useful.  */)
   (Lisp_Object terminal)
 {
   struct x_display_info *dpyinfo = check_x_display_info (terminal);
@@ -4417,10 +4436,12 @@ DEFUN ("x-display-visual-class", 
Fx_display_visual_class,
        doc: /* Return the visual class of the X display TERMINAL.
 The value is one of the symbols `static-gray', `gray-scale',
 `static-color', `pseudo-color', `true-color', or `direct-color'.
+\(On MS Windows, the second and last result above are not possible.)
 
 The optional argument TERMINAL specifies which display to ask about.
 TERMINAL should a terminal object, a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display.  */)
+If omitted or nil, that stands for the selected frame's display.
+\(On MS Windows, this function does not accept terminal objects.)  */)
   (Lisp_Object terminal)
 {
   struct x_display_info *dpyinfo = check_x_display_info (terminal);
@@ -4458,7 +4479,9 @@ DEFUN ("x-display-save-under", Fx_display_save_under,
        doc: /* Return t if the X display TERMINAL supports the save-under 
feature.
 The optional argument TERMINAL specifies which display to ask about.
 TERMINAL should be a terminal object, a frame or a display name (a string).
-If omitted or nil, that stands for the selected frame's display.  */)
+If omitted or nil, that stands for the selected frame's display.
+
+On MS Windows, this just returns nil.  */)
   (Lisp_Object terminal)
 {
   struct x_display_info *dpyinfo = check_x_display_info (terminal);
@@ -5652,8 +5675,8 @@ DEFUN ("x-close-connection", Fx_close_connection,
        Sx_close_connection, 1, 1, 0,
        doc: /* Close the connection to TERMINAL's X server.
 For TERMINAL, specify a terminal object, a frame or a display name (a
-string).  If TERMINAL is nil, that stands for the selected frame's
-terminal.  */)
+string).  If TERMINAL is nil, that stands for the selected frame's terminal.
+\(On MS Windows, this function does not accept terminal objects.)  */)
   (Lisp_Object terminal)
 {
   struct x_display_info *dpyinfo = check_x_display_info (terminal);
@@ -5926,8 +5949,6 @@ FRAME.  The number 0 denotes the root window.
 If DELETE-P is non-nil, delete the property after retrieving it.
 If VECTOR-RET-P is non-nil, don't return a string but a vector of values.
 
-On MS Windows, this function accepts but ignores those optional arguments.
-
 Value is nil if FRAME hasn't a property with name PROP or if PROP has
 no value of TYPE (always string in the MS Windows case).  */)
   (Lisp_Object prop, Lisp_Object frame, Lisp_Object type,
@@ -7039,18 +7060,7 @@ clean_up_file_dialog (void *arg)
 
 
 DEFUN ("x-file-dialog", Fx_file_dialog, Sx_file_dialog, 2, 5, 0,
-       doc: /* Read file name, prompting with PROMPT in directory DIR.
-Use a file selection dialog.  Select DEFAULT-FILENAME in the dialog's file
-selection box, if specified.  If MUSTMATCH is non-nil, the returned file
-or directory must exist.
-
-This function is only defined on NS, MS Windows, and X Windows with the
-Motif or Gtk toolkits.  With the Motif toolkit, ONLY-DIR-P is ignored.
-Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories.
-On Windows 7 and later, the file selection dialog "remembers" the last
-directory where the user selected a file, and will open that directory
-instead of DIR on subsequent invocations of this function with the same
-value of DIR as in previous invocations; this is standard Windows behavior.  
*/)
+       doc: /* SKIP: real doc in USE_GTK definition in xfns.c.  */)
   (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename,
    Lisp_Object mustmatch, Lisp_Object only_dir_p)
 {
@@ -7219,10 +7229,10 @@ or directory must exist.
 This function is only defined on NS, MS Windows, and X Windows with the
 Motif or Gtk toolkits.  With the Motif toolkit, ONLY-DIR-P is ignored.
 Otherwise, if ONLY-DIR-P is non-nil, the user can only select directories.
-On Windows 7 and later, the file selection dialog "remembers" the last
+On MS Windows 7 and later, the file selection dialog "remembers" the last
 directory where the user selected a file, and will open that directory
 instead of DIR on subsequent invocations of this function with the same
-value of DIR as in previous invocations; this is standard Windows behavior.  
*/)
+value of DIR as in previous invocations; this is standard MS Windows behavior. 
 */)
   (Lisp_Object prompt, Lisp_Object dir, Lisp_Object default_filename, 
Lisp_Object mustmatch, Lisp_Object only_dir_p)
 {
   struct frame *f = SELECTED_FRAME ();
@@ -7797,9 +7807,9 @@ unless you set it to something else.  */);
               Vx_pixel_size_width_font_regexp,
     doc: /* Regexp matching a font name whose width is the same as 
`PIXEL_SIZE'.
 
-Since Emacs gets width of a font matching with this regexp from
-PIXEL_SIZE field of the name, font finding mechanism gets faster for
-such a font.  This is especially effective for such large fonts as
+Since Emacs gets the width of a font matching this regexp from the
+PIXEL_SIZE field of the name, the font-finding mechanism gets faster for
+such a font.  This is especially effective for large fonts such as
 Chinese, Japanese, and Korean.  */);
   Vx_pixel_size_width_font_regexp = Qnil;
 
diff --git a/src/xmenu.c b/src/xmenu.c
index f48ad60..b3a0c3e 100644
--- a/src/xmenu.c
+++ b/src/xmenu.c
@@ -3,6 +3,10 @@
 Copyright (C) 1986, 1988, 1993-1994, 1996, 1999-2018 Free Software
 Foundation, Inc.
 
+Author: Jon Arnold
+       Roman Budzianowski
+       Robert Krawitz
+
 This file is part of GNU Emacs.
 
 GNU Emacs is free software: you can redistribute it and/or modify
@@ -20,9 +24,6 @@ along with GNU Emacs.  If not, see 
<https://www.gnu.org/licenses/>.  */
 
 /* X pop-up deck-of-cards menu facility for GNU Emacs.
  *
- * Written by Jon Arnold and Roman Budzianowski
- * Mods and rewrite by Robert Krawitz
- *
  */
 
 /* Modified by Fred Pierresteguy on December 93
@@ -279,12 +280,7 @@ popup_get_selection (XEvent *initial_event, struct 
x_display_info *dpyinfo,
 }
 
 DEFUN ("x-menu-bar-open-internal", Fx_menu_bar_open_internal, 
Sx_menu_bar_open_internal, 0, 1, "i",
-       doc: /* Start key navigation of the menu bar in FRAME.
-This initially opens the first menu bar item and you can then navigate with the
-arrow keys, select a menu entry with the return key or cancel with the
-escape key.  If FRAME has no menu bar this function does nothing.
-
-If FRAME is nil or not given, use the selected frame.  */)
+       doc: /* SKIP: real doc in USE_GTK definition in xmenu.c.  */)
   (Lisp_Object frame)
 {
   XEvent ev;
@@ -2377,7 +2373,8 @@ popup_activated (void)
 /* The following is used by delayed window autoselection.  */
 
 DEFUN ("menu-or-popup-active-p", Fmenu_or_popup_active_p, 
Smenu_or_popup_active_p, 0, 0, 0,
-       doc: /* Return t if a menu or popup dialog is active.  */)
+       doc: /* Return t if a menu or popup dialog is active.
+\(On MS Windows, this refers to the selected frame.)  */)
   (void)
 {
   return (popup_activated ()) ? Qt : Qnil;
diff --git a/src/xsettings.c b/src/xsettings.c
index b9a62eb..116f336 100644
--- a/src/xsettings.c
+++ b/src/xsettings.c
@@ -54,7 +54,7 @@ static char *current_font;
 static struct x_display_info *first_dpyinfo;
 static Lisp_Object current_tool_bar_style;
 
-/* Store an config changed event in to the event queue.  */
+/* Store a config changed event in to the event queue.  */
 
 static void
 store_config_changed_event (Lisp_Object arg, Lisp_Object display_name)
diff --git a/src/xterm.c b/src/xterm.c
index 2e2e67c..1b96b08 100644
--- a/src/xterm.c
+++ b/src/xterm.c
@@ -13244,10 +13244,9 @@ syms_of_xterm (void)
               x_use_underline_position_properties,
      doc: /* Non-nil means make use of UNDERLINE_POSITION font properties.
 A value of nil means ignore them.  If you encounter fonts with bogus
-UNDERLINE_POSITION font properties, for example 7x13 on XFree prior
-to 4.1, set this to nil.  You can also use `underline-minimum-offset'
-to override the font's UNDERLINE_POSITION for small font display
-sizes.  */);
+UNDERLINE_POSITION font properties, set this to nil.  You can also use
+`underline-minimum-offset' to override the font's UNDERLINE_POSITION for
+small font display sizes.  */);
   x_use_underline_position_properties = true;
 
   DEFVAR_BOOL ("x-underline-at-descent-line",
diff --git a/test/lisp/abbrev-tests.el b/test/lisp/abbrev-tests.el
index 1187700..facf097 100644
--- a/test/lisp/abbrev-tests.el
+++ b/test/lisp/abbrev-tests.el
@@ -38,6 +38,12 @@
   (abbrev-table-put ert-test-abbrevs :ert-test "ert-test-value")
   ert-test-abbrevs)
 
+(defun setup-test-abbrev-table-with-props ()
+  (defvar ert-test-abbrevs nil)
+  (define-abbrev-table 'ert-test-abbrevs '(("fb" "fooBar" nil :case-fixed t)))
+  (abbrev-table-put ert-test-abbrevs :ert-test "ert-test-value")
+  ert-test-abbrevs)
+
 (ert-deftest abbrev-table-p-test ()
   (should-not (abbrev-table-p 42))
   (should-not (abbrev-table-p "aoeu"))
@@ -230,6 +236,17 @@
     (should (equal "abbrev-ert-test" (abbrev-expansion "a-e-t" 
ert-test-abbrevs)))
     (delete-file temp-test-file)))
 
+(ert-deftest read-write-abbrev-file-test-with-props ()
+  "Test reading and writing abbrevs from file"
+  (let ((temp-test-file (make-temp-file "ert-abbrev-test"))
+        (ert-test-abbrevs (setup-test-abbrev-table-with-props)))
+    (write-abbrev-file temp-test-file)
+    (clear-abbrev-table ert-test-abbrevs)
+    (should (abbrev-table-empty-p ert-test-abbrevs))
+    (read-abbrev-file temp-test-file)
+    (should (equal "fooBar" (abbrev-expansion "fb" ert-test-abbrevs)))
+    (delete-file temp-test-file)))
+
 (ert-deftest abbrev-edit-save-to-file-test ()
   "Test saving abbrev definitions in buffer to file"
   (defvar ert-save-test-table nil)
diff --git a/test/lisp/emacs-lisp/generator-tests.el 
b/test/lisp/emacs-lisp/generator-tests.el
index 9bf8413..bca3efa 100644
--- a/test/lisp/emacs-lisp/generator-tests.el
+++ b/test/lisp/emacs-lisp/generator-tests.el
@@ -292,3 +292,13 @@ identical output.
                                 (i 0)
                                 (j (setq i (1+ i))))
                            (iter-yield i))))))))
+
+(ert-deftest iter-lambda-variable-shadowing ()
+  "`iter-lambda' forms which have local variable shadowing (Bug#26073)."
+  (should (equal (iter-next
+                  (funcall (iter-lambda ()
+                             (let ((it 1))
+                               (iter-yield (funcall
+                                            (lambda (it) (- it))
+                                            (1+ it)))))))
+                 -2)))
diff --git a/test/src/eval-tests.el b/test/src/eval-tests.el
index 201382d..e68fd13 100644
--- a/test/src/eval-tests.el
+++ b/test/src/eval-tests.el
@@ -79,4 +79,24 @@ Bug#24912 and Bug#24913."
   (let ((clauses (list '((progn (setcdr clauses "ouch") nil)))))
     (should-error (eval (cons 'cond clauses)))))
 
+(defun eval-tests--exceed-specbind-limit ()
+  (defvar eval-tests--var1)
+  (defvar eval-tests--var2)
+  ;; Bind two variables, to make extra sure we hit the
+  ;; `max-specpdl-size' limit before the `max-lisp-eval-depth' limit.
+  (let ((eval-tests--var1 1)
+        (eval-tests--var2 2))
+    ;; Recurse until we hit the limit.
+    (eval-tests--exceed-specbind-limit)))
+
+(ert-deftest eval-exceed-specbind-with-signal-hook ()
+  "Test for Bug#30481.
+Check that Emacs doesn't crash when exceeding specbind limit with
+`signal-hook-function' bound.  NOTE: Without the fix for
+Bug#30481, this test can appear to pass, but cause a
+crash/abort/malloc assert failure on the next test."
+  (let ((max-specpdl-size (/ max-lisp-eval-depth 2))
+        (signal-hook-function #'ignore))
+    (should-error (eval-tests--exceed-specbind-limit))))
+
 ;;; eval-tests.el ends here



reply via email to

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